Author Topic: unable to match param names  (Read 2111 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
unable to match param names
« on: December 14, 2018, 06:52:41 AM »
I have this function:

Code: [Select]
FUNCTION MSGBOX(string sText, sys mOptions = 0, string sCaption = "PluriBASIC") AS LONG
   FUNCTION = PluriBASICMessageBox(0, sText, sCaption, mOptions)
END FUNCTION

It works fine. No run time problems at all. I Invoke it this way:

Code: [Select]
MSGBOX("Hello Everybody", 64, "This is the title")
However, this code is not compiling...

Code: [Select]
MSGBOX("=Hello Everybody", 64, "This is the title")
Code: [Select]
ERROR: unable to match param names
WORD: msgbox
LINE: 562
FILE: main source
PASS: 2

Removing the "=" in the string, makes it work.


Brian Alvarez

  • Guest
Re: unable to match param names
« Reply #1 on: December 14, 2018, 06:58:16 AM »
By the way, this applies to any other function, not just this one.

Aurel

  • Guest
Re: unable to match param names
« Reply #2 on: December 14, 2018, 07:21:01 AM »
Removing the "=" in the string, makes it work.

That is because Charles probably forget to remove sign '=' from quoted string parsing routine
and is recognized from o2 as argument.

oups..NOT names are not same  ::)

Arnold

  • Guest
Re: unable to match param names
« Reply #3 on: December 14, 2018, 07:21:49 AM »
HI Brian,

A possible solution would be to use a string in a variable:

Code: [Select]
uses corewin

def PluriBASICMessageBox MessageBox

FUNCTION MSGBOX(string sText="", sys mOptions = 0, string sCaption = "PluriBASIC") AS LONG
   FUNCTION = PluriBASICMessageBox(0, sText, sCaption, mOptions)
END FUNCTION

string myHello = "=Hello Everybody"
MSGBOX(myHello, 64, "This is the title")

I do not understand the purpose of the equal sign?

Roland

Aurel

  • Guest
Re: unable to match param names
« Reply #4 on: December 14, 2018, 07:23:39 AM »
also
sText=""
should be :

string sText

Aurel

  • Guest
Re: unable to match param names
« Reply #5 on: December 14, 2018, 07:28:04 AM »
in awinh.inc i have :

Code: [Select]
Function MsgBox (byval lpText AS STRING,byref lpCaption AS STRING) as INT
If lpCaption = "" then lpCaption="<MsgBox>"
Function =  MessageBox 0, lpText, lpCaption, 0
End Function

so as result i use api not another function which call api function.
this looks to me like overcomplication ?

Brian Alvarez

  • Guest
Re: unable to match param names
« Reply #6 on: December 14, 2018, 09:26:55 AM »
@Roland, thanks, the "=" was being used as a separator, to monitor the output of an operation. Originally there was a full line of "=", like this"

Code: [Select]
? "=results========================" & $crlf & _
   ResultsVariable

 I can use a variable of course, but i rather avoid offering that solution to others, and i doubt Charles would like that
workaround either, because some times, passing strings to other functions require that character and it would limit the
one-liner-ness of statements. Who knows.

@Aurel, you are correct, the first parameter is NOT optional. About your awinh.inc aproach, it lacks the ability to specify an icon, and since is not standard, i had to make my own.

Aurel

  • Guest
Re: unable to match param names
« Reply #7 on: December 14, 2018, 10:26:07 AM »
 
Quote
About your awinh.inc aproach, it lacks the ability to specify an icon, and since is not standard, i had to make my own.

Yes you have right...and also you don't have..why?
simply because is standard...
Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hWnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal dwType As Long) As Long
you probably know that last parameter is type of messageBox ...in my case is NULL
because i simply don't need icons in my interpreters and other programs
in fact as you know? .. this is just combination of arguments or beter to say constants to
get messagebox type , icon,yes/cancel/no  etc...
So it is nice to have it all  :D

Charles Pegge

  • Guest
Re: unable to match param names
« Reply #8 on: December 14, 2018, 10:35:31 AM »
Hi Brian,

Well caught! That will be fixed on the next update.

Brian Alvarez

  • Guest
Re: unable to match param names
« Reply #9 on: December 14, 2018, 11:42:28 AM »
Yes you have right...and also you don't have..why?
simply because is standard..

 Hehehe, yes. I meant PowerBASIC standard, but you are right. Good thing Oxygen has function overflow,
so, now it can be called whatever we want. :)

@Charles, Thanks! :)