Here is the code:
Code: Select all
declare sub ValidateLeadingSign(_
Digit as string,_
PlusExists as byte,_
MinusExists as byte)
declare sub GetOperand()
Dim shared TxtLine as ZString*513 'max size of line of text
Dim shared TxtChar as zstring*2
dim shared TxtPos as ubyte
'Validate unairy + or - sign for number
sub ValidateLeadingSign(_
Digit as string,_
ByRef PlusExists as byte,_
ByRef MinusExists as byte)
'Make sure PlusExists is defined with "ByRef" so this value can be passed back.
'Make sure MinusExists is defined with "ByRef" so this value can be passed back.
Dim AscChar as Ubyte
do
TxtChar[0] = TxtLine[TxtPos]
TxtPos = TxtPos + 1
AscChar = asc(TxtChar)
If AscChar = 43 then
'check for "+"
PlusExists = not PlusExists
if PlusExists = 0 then
Print "Error cannot have more than 1 leading + sign in a number"
exit do
end if
if MinusExists then
print "error bad signed number"
exit do
end if
elseif AscChar = 45 then
'check for "-"
MinusExists = not MinusExists
if MinusExists = 0 then
Print "Error cannot have more than 1 leading - sign in a number"
exit do
end if
if PlusExists then
print "error bad signed number"
exit do
end if
else
exit do
end if
Digit = Digit + TxtChar
loop
end sub
Sub GetOperand()
dim CurrentOpCaseNumber as ubyte
dim PriorPrecedence as ushort
dim PlusSignExists as byte
dim MinusSignExists as byte
dim Digit as string
TxtPos = 0
PlusSignExists = 0
MinusSignExists = 0
ValidateLeadingSign(Digit,PlusSignExists,MinusSignExists)
if MinusSignExists then
'is Negation
PriorPrecedence = 100
CurrentOpCaseNumber = 9
exit sub
end if
end sub
input "enter instruction: ";TxtLine
TxtPos = 0
GetOperand()
end
Error 57: Type mismatch, at parameter 2 (PlusExists) of ValiadteLeadingSign() in 'ByRef MinusExists as Byte)
I do not see any type mismatch.
Can anybody tell me what I am doing wrong with the way I am passing parameters?
I am attempting to learn how to pass parameters.
Thank you for any help.