New Features in the Internet Basic Compiler
- Compiler “L” option
The compiler now includes the “L” option, which creates a text file with the compiler listing (including memory addresses and compiler statistics). The text file name is the same as the source file name, but with a “LST” extension. For example, if the source file is named TEST.IBS, the listing file is named TEST.LST. The listing file is stored in the same directory as the source file.
Example:
! //IB// Src(test.ibs,dsk) Obj(test,dsk) Opt(L)
- Larger symbol table
The compiler now includes symbol table that is approximately 25% larger than previous releases. This means that your programs can include more variables, statement labels, constants, and symbolic constants.
-
New compiler warning message
When compiling through UltraEdit, the compiler now displays a warning message for defined but unreferenced variables. This makes it easy to identify variables that have been declared but are not being used in the program.
- LOG statement
The LOG statement writes a specified string to the user’s startup details log. This is a convenient way to log when a particular program is started or stopped.
Syntax:
LOG string-expression
Example:
LOG “Program XYZ is now running.”
.
.
.
LOG “Program XYZ is complete.”
RUN “QMONITOR”
END
|
-
MSGBOX statement
The MSGBOX statement displays a simple Windows-style message box containing a specified string and an OK button. The program is halted until the user clicks the OK button or presses the Enter key, making this function perform the same as a dummy INPUT statement and a WAIT statement.
Syntax:
MSGBOX string-expression
Where:
String-expression is the text that will appear in the message box above the OK button.
Example:
MSGBOX “This is a sample message box. Click OK or press Enter.”
|
-
MSGBOX function
The MSGBOX function displays a Windows-style message box containing a specified string and one or more buttons (i.e., OK, Cancel, Abort, Retry, Ignore, Yes, No, Close, Help). The program is halted until the user clicks on one of the buttons. The value of the clicked button is returned to the program.
Syntax:
Result = MSGBOX(string-expression, caption, type)
Where:
Result is a numeric value representing which button was clicked, based on the following table:
! From windows.inc in the WDL dir
!==========================================================
! These are standard ID's assigned by WINDOWS and used
! in many dialogs that have an OK and CANCEL button etc.
!==========================================================
if result = 1 print 'That means ID.OK'
if result = 1 print 'That means IDOK'
if result = 2 print 'That means ID.CANCEL'
if result = 2 print 'That means IDCANCEL'
if result = 3 print 'That means ID.ABORT'
if result = 3 print 'That means IDABORT '
if result = 4 print 'That means ID.RETRY'
if result = 4 print 'That means IDRETRY'
if result = 5 print 'That means ID.IGNORE'
if result = 5 print 'That means IDIGNORE'
if result = 6 print 'That means ID.YES'
if result = 6 print 'That means IDYES'
if result = 7 print 'That means ID.NO'
if result = 7 print 'That means IDNO'
if result = 8 print 'That means ID.CLOSE'
if result = 8 print 'That means IDCLOSE'
if result = 9 print 'That means ID.HELP'
if result = 9 print 'That means IDHELP'
|
String-expression is the text that will appear in the message box above the button(s).
Caption is a string value that will be displayed as the caption for the Window.
Type is a numeric value that represents the type of message box to be displayed, including which buttons are displayed and the icon that is displayed (i.e., stop sign, question mark, exclamation mark, information icon). In the following table these value are expressed using symbolic constants:
!==========================================================
!
! Type values for the MessageBox function
!
!========================================================== |
SET | MB.OK | = 0 | ! 0x00000000L |
SET | MB.OKCANCEL | = 1 | ! 0x00000001L |
SET | MB.ABORTRETRYIGNORE | = 2 | ! 0x00000002L |
SET | MB.YESNOCANCEL | = 3 | ! 0x00000003L |
SET | MB.YESNO | = 4 | ! 0x00000004L |
SET | MB.RETRYCANCEL | = 5 | ! 0x00000005L |
|
SET | MB.ICONHAND | = 16 | ! MB.ICONSTOP |
SET | MB.ICONQUESTION | = 32 | ! 0x00000020L |
SET | MB.ICONEXCLAMATION | = 48 | ! 0x00000030L |
SET | MB.ICONASTERISK | = 64 | ! MB.ICONINFORMATION
|
|
SET | MB.USERICON | = 128 | ! 0x00000080L |
SET | MB.ICONWARNING | = 48 | ! MB.ICONEXCLAMATION |
SET | MB.ICONERROR | = 16 | ! MB.ICONHAND
|
|
SET | MB.ICONINFORMATION | = 64 | ! MB.ICONASTERISK |
SET | MB.ICONSTOP | = 16 | ! MB.ICONHAND
|
|
SET | MB.DEFBUTTON1 | = 0 | ! 0x00000000L |
SET | MB.DEFBUTTON2 | = 256 | ! 0x00000100L |
SET | MB.DEFBUTTON3 | = 512 | ! 0x00000200L |
SET | MB.DEFBUTTON4 | = 768 | ! 0x00000300L
|
|
SET | MB.APPLMODAL | = 0 | ! 0x00000000L |
SET | MB.SYSTEMMODAL | = 4096 | ! 0x00001000L |
SET | MB.TASKMODAL | = 8192 | ! 0x00002000L |
SET | MB.HELP | = 16384 | ! 0x00004000L
|
|
SET | MB.NOFOCUS | = 32768 | ! 0x00008000L |
SET | MB.SETFOREGROUND | = 65536 | ! 0x00010000L |
SET | MB.DEFAULT.DESKTOP.ONLY | = 131072 | ! 0x00020000L
|
|
SET | MB.TOPMOST | = 262144 | ! 0x00040000L |
SET | MB.RIGHT | = 524288 | ! 0x00080000L |
SET | MB.RTLREADING | = 1048576 | ! 0x00100000L
|
|
SET | MB.TYPEMASK | = 15 | ! 0x0000000FL |
SET | MB.ICONMASK | = 240 | ! 0x000000F0L |
SET | MB.DEFMASK | = 3840 | ! 0x00000F00L |
SET | MB.MODEMASK | = 12288 | ! 0x00003000L |
SET | MB.MISCMASK | = 49152 | ! 0x0000C000L
|
Example:
TYPE = MB.ABORTTETRYIGNORE + MB.ICONQUESTION
Result = MSGBOX(“Click Abort, Retry, or Ignore”,”Sample program”,TYPE)
|
-
Hex constants
Internet Basic now includes hex constants. A hex constant may be used anyplace where a decimal constant is used.
Syntax:
0xhex-value
Examples:
A = 0x7F
B = 0x7FA5
C = 0x7FA56B
SET VALUE = 0x1234
LENGTH 0x7F & LOCAL A$
LENGTH 0x10.0 & LOCAL I, J, K
LENGTH 254 & LOCAL B$(0x4B)
|
-
AND, OR, and XOR operators
Internet Basic now includes AND, OR, and XOR operators.
The AND operator performs a logical conjunction on two expressions. AND compares identically positioned bits in two numeric expressions and sets the corresponding bit in the result according to the following table:
If bit in expression1 is |
And bit in expression2 is |
Then result is |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
For example:
If A = 1010 (binary) and B = 0011 (binary), then C = 0010 (binary).
The OR operator performs a logical disjunction on two numeric expressions. OR compares identically positioned bits in two numeric expressions and sets the corresponding bit in the result according to the following table:
If bit in expression1 is |
And bit in expression2 is |
Then result is |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
For example:
If A = 1010 (binary) and B = 0011 (binary), then C = 1011 (binary).
The XOR operator performs a logical exclusion on two numeric expressions. XOR compares identically positioned bits in two numeric expressions and sets the corresponding bit in the result according to the following table:
If bit in expression1 is |
And bit in expression2 is |
Then result is |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
For example:
If A = 1010 (binary) and B = 0011 (binary), then C = 1001 (binary).
-
NOT function
The NOT function flips the bits in a numeric expression.
Example:
If A = 01010101 (binary), then B = 10101010 (binary).
-
SETBIT function
The SETBIT function sets the specified bit in a string expression.
Syntax:
Result = SETBIT(string-expression, bit-location, bit-value [,EXCP=label])
Where:
Result contains the value of the bit before it was set. Valid values are 0 and 1.
String-expression is a string value encoded in binary form.
Bit-location is a numeric value specifying the bit that is to be set.
Bits are 0-based and are ordered according to the following scheme:
If the string-expression contains 8 bits, they are ordered:
7 6 5 4 3 2 1 0
If the string-expression contains 16 bits, they are ordered:
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8
If the string-expression contains 24 bits, they are ordered:
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16
Bit-value is 0 or 1.
An exception occurs if the program attempts to set a bit beyond the declared length of the string-expression.
Example:
A$ = “@0000@”
B$ = HEXASC(A$)
Print “Before:”;B$
FOR I = 8 TO 11
J = SETBIT(A$,I,1,EXCP=9999)
Print “Bit”;I;”was”;J
NEXT I
B$ = HEXASC(A$)
Print “After”;B$
|
-
TESTBIT function
The TESTBIT function returns the value of a specified bit in a string expression.
Syntax:
Result = TESTBIT(string-expression, bit-location [,EXCP=label])
Where:
-
Result is the value (0 or 1) of the bit at the specified bit-location.
-
Bit-location follows the same ordering scheme as the SETBIT function.
-
An exception occurs if the program attempts to test a bit beyond the declared length of the string-expression.
Example:
A$ = “@7FA5@”
FOR I = 0 TO 15
Result = TESTBIT(A$,I,EXCP=9999)
Print “Bit”;I;”is”;Result
NEXT I
|
-
PAD function
The PAD function appends blanks to a string field up to the declared length of the string.
Syntax:
PAD(string-field)
Example:
-
NUM2DATE feature
The NUM2DATE function contains a new option that returns the local date and time with the hour adjustment for time zone and daylight savings time appended. The NUM2DATE option is 5, as in A$=NUM2DATE(date-serial-number,5). The function returns the date/time in the following format:
Day, DD Mon YYYY HH:MM:SS -nnnn –mmmm
Where -nnnn is the number or hours + or – different from Greenwich Mean Time (GMT), and –mmmm is the daylight savings time adjustment.
|