String Delimiters
Most any character except: []\^$.|?*+()- (as of release 112o)
Summary
TrueGUI allows any value, from 0 to 255, to be chosen as the StringDelimiters except for those that represent these thirteen characters: []\^$.|?*+()-. Generally, a non-printing character should be chosen, such as 144 decimal (0x90).
The selected Delimiter is only effective for communications from the TrueGUI server to the TrueGUI client. Scripts and Debugger commands currently use .NET syntax and are independent of this issue.
Sample at the end of the page.
Details
Like most programming environments, TrueGUI needs some key syntax rules and/or symbols to identify commands and literals.
However, unlike most programming environments, TrueGUI needs to function within many different programming environments. So TrueGUI lets the developer chose many of the symbols used from a very wide range of possibilities.
Perhaps the most critical and troublesome of these symbols is the string literal delimiter. As strings can typically have any printable and some non-printable characters, handling the inclusion of the delimiter as a literal character is a special case.
With TrueGUI this is even more important because the literal data may be taken from the server data storage but must be sent to TrueGUI as literal characters. Most programming environments will simply pass all of the stored data as a literal even if it contains a literal data delimiter - it knows the delimiter from storage is not part of the "program".
In the case of TrueGUI, there is no "data storage". For the trip from the server to the TrueGUI client, everything is "literal". For example, the default rules for TrueGUI would pass the following as an instruction to the client: { xxx.Text=`String delimiter is "`"!` } But the middle ` would be seen by the client as the closing string delimiter and the third ` would be seen as a new starting delimiter of another string. As the } delimiter is now seen as part of this second literal, TrueGUI would be well on its way to confusion.
One common solution in various programming environments is to "escape" the delimiter with itself. That is, after the starting delimiter, two delimiters in a row are considered treated as the literal of the delimiter. A very common example is when " is used as a delimiter, a " is included in the data by using two in a row, as "x""x" would be x"x. This would be a poor solution for TrueGUI. It would require the server application to scan every literal for the delimiter and then double it. This is a lot of extra design work and a lot of actual overhead.
Instead, TrueGUI allows the developer, via the server application, to dynamically define the StringDelimiters. Beginning with version 112o, the StringDelimiters can be any byte value from 0 to 255 except those that represent these thirteen characters []\^$.|?*+()-. Everything after the first delimiter is treated as literal text and pass through until the second delimiter is encountered. Now the StringDelimiters can be set to a non-printing value, such as 144. decimal (220 octal, 0x90 hex) - usually defined as "Device Control String".
NOTE: If you are using a CodePage that has that as a printable character, then you should pick a different value. The default Windows code page - 1252 - does not use that as a printable character.
These rules may also apply to BeginCommand, EndCommand, BeginStringDelimiter, EndStringDelimiter, and CharDelimiter.
============ Working code at 66.166.1.38:8888:
! The following is for TESTING revisions 112o and later:
map1 sd$,s,5 ! For TESTING version 112o and later
map1 orig'sd$,s,5
sd$ = "`" ! set to default
print "{ StringDelimiter? }" ! get the current string delimiter
call TgGetReply
orig'sd$ = TgText$ ! save it to reset if desired later
print "! Original StringDelimiter byte value is "+asc(orig'sd$)+"."
sd$ = chr$(144) ! 220o 144. 90h "Device Control String"
print "{ StringDelimiter='"+sd$"' }" ! make that the current one
print "{ StringDelimiter? }" ! get the current string delimiter
call TgGetReply
print "! Now StringDelimiter byte value is "+asc(sd$)+"."
! use it:
!Load the CsForms.exe Assembly file
print "{ TrueGui.LoadAssembly("+sd$+"CsForms"+sd$") }"
!Create an instance of Form1 calling it "MyForm"
print "{ MyForm = New CsForms.Form1() }"
!Show MyForm
print "{ MyForm.Show() }"
print "{ OuterSpaceText.Text="+sd$+"The Deliminator!"+sd$+" }"
! etc.
! put back whatever was there before:
print "{ StringDelimiter='"+orig'sd$+"' }"
sd$ = orig'sd$ ! put is all back
! end of 112o test section
MORE about string limitations: The AlphaBASIC I use allows any 8 bit value in a string. However, the input line routine will strip them out if the target variable is a string. Thus using "overlays" my input string (TgInput$) is overlayed (@) with a raw (unformatted - x type) variable:
Map1 TgInput$,S ! read the raw input into this string variable
Map2 TgTypeCode$,S,1 ! this character will be the type code
Map2 TgText$,S ! this string has the rest of the input
Map1 TgInput,x,500,@TgInput$ ! type x (raw)
Then my input routine is:
TgGetReply:
TgInput$ = "" ! clean it out
INPUT LINE TgInput ! put the TrueGUI reply into a raw variable
Thus my application gets everything TrueGUI sends, including the StringDelimiter when I need to check it.
============ Debug trace of the above:
Command: <== { StringDelimiter? }
Data: `
***Queued 3 bytes to be sent to the server***
***Transmitted 3 bytes to the server***
***Received 188 bytes from server***
! Got TypeCode 2="`", length: 2
! Original StringDelimiter byte value is 96.
Command: <== { StringDelimiter='' }
Command: <== { StringDelimiter? }
Data:
***Queued 3 bytes to be sent to the server***
***Transmitted 3 bytes to the server***
***Received 126 bytes from server***
! Got TypeCode 2="", length: 1
! Now StringDelimiter byte value is 144.
Command: <== { TrueGui.LoadAssembly(CsForms) }
Command: <== { MyForm = New CsForms.Form1() }
Adding ObjectEvent #1: mscorlib_System_Click_EventArgs
Adding ObjectEvent #2: mscorlib_System_Leave_EventArgs
Command: <== { MyForm.Show() }
Command: <== { OuterSpaceText.Text=The Deliminator! }
Command: <== { StringDelimiter='`' }
Comments (0)
You don't have permission to comment on this page.