|
$APPTYPE |
|
[ CGI | CONSOLE | GUI ] Default is GUI
$APPTYPE is used to tell the compiler what kind of application you want generated.
Although the default is GUI, if no $APPTYPE directive is used, Rapid-Q will detect
what kind of application your program is just by looking at the source code.
To override this feature, include the $APPTYPE directive at the beginning of your source code.
Usage: $APPTYPE CONSOLE
|
|
$TYPECHECK |
|
[ OFF | ON ] Default is OFF
$TYPECHECK is used to tell the compiler whether you want the source code parsed using strict
type checking ON (all variables must be declared), or relaxed type checking OFF like traditional BASIC
where you don't need to declare your variables. Note, you can turn ON or OFF type checking at anytime, so you can type check
a portion of your code and turn it OFF afterwards.
Usage: $TYPECHECK ON
|
|
$INCLUDE |
|
[ FileName ]
Using $INCLUDE has the same effect as importing your file directly into your program at the point of call.
You can use $INCLUDE anywhere in your program, except in a SUB or FUNCTION, but is
most often included at the beginning of your source code. Enclosing the filename between quotes will search
for that file in the current directory, and specified include paths. Enclosing the filename between < and >
will search for that file in the current directory, specified include paths and the environment search paths.
Usage:
$INCLUDE "RAPIDQ.INC"
$INCLUDE <RAPIDQ.INC>
|
|
$RESOURCE |
|
Handle AS FileName
Most Windows programming languages include support for Resource files.
In Rapid-Q, this is somewhat different. In Rapid-Q, Resource files are just a collection
of graphics files. There is no such thing as resource strings in Rapid-Q.
Anyway, what's great about Resource files is that they are embedded into
your applications. So if you're using 10 different bitmaps, you don't need
to include them in your .ZIP distribution because it's already embedded into the .EXE.
Enclosing the filename between quotes will search
for that file in the current directory, and specified include paths. Enclosing the filename between < and >
will search for that file in the current directory, specified include paths and the environment search paths.
Usage:
$RESOURCE RES_BMP1 AS "CLOUDS.BMP"
$RESOURCE RES_BMP1 AS <CLOUDS.BMP>
|
|
$DEFINE |
|
NewDefinition   [OldDefinition]
When you feel like redefining or creating new keywords/tokens, use this directive.
You cannot construct a series of tokens to be redefined.
You cannot redefine operators or punctuations. $DEFINE cannot be used to define a function (like in C).
The OldDefinition parameter is optional, so you can do this just fine: $DEFINE NEWDEF
Usage: $DEFINE INT16 SHORT
|
|
$UNDEF |
|
DefName [, DefName]
To undefine a previous call of define, use $UNDEF.
You can specify multiple instances on the same line, separated with commas.
Usage: $UNDEF INT16, INT32
|
|
$IFDEF |
|
Definition
This directive is used to specify whether a piece of code should or should
not be compiled. It is used in conjunction with $DEFINE. If the Definition
has been defined, the code within the $IFDEF..$ENDIF statement will be compiled, otherwise
it is skipped entirely.
Usage:
$IFDEF INT16
' if INT16 has been defined
' compile this portion
$ELSE
' if INT16 has not been defined
' compile this portion
$ENDIF
|
|
$IFNDEF |
|
Definition
$IFNDEF has the opposite effect as $IFDEF.
Usage:
$IFNDEF INT16
' if INT16 has not been defined
' compile this portion
$ELSE
' if INT16 has been defined
' compile this portion
$ENDIF
|
|
$OPTION |
|
OptionName [Parameters]
BYREF, BYTECODE, DECIMAL, DIM, EXPLICIT, GTK, ICON, INKEY$, and WEAKTYPE are valid OptionNames.
Usage:
$OPTION BYREF
This changes the way variables are
passed. By default, Rapid-Q passes variables
by value. This option reverses that.
Use with caution.
$OPTION BYTECODE
Compile as byte code only.
$OPTION DECIMAL ","
$OPTION DECIMAL 64
This changes the default decimal
character for use in VAL.
The default decimal character is the period.
$OPTION DIM BYTE
$OPTION DIM WORD
$OPTION DIM DWORD
$OPTION DIM SHORT
$OPTION DIM INTEGER
$OPTION DIM LONG
$OPTION DIM SINGLE
$OPTION DIM DOUBLE
$OPTION DIM STRING
$OPTION DIM VARIANT
This changes the default type
for an undeclared variable.
By default, all undeclared variables are
assumed to be of type DOUBLE
if no suffix is provided.
$OPTION EXPLICIT
Same as using TYPECHECK ON
Maintained for compatibility with VB
$OPTION GTK
Uses GTK instead of XFORMS
Make sure you have the proper files
$OPTION ICON "path\file.ico"
This changes the default icon
of your executable file.
$OPTION INKEY$ DEFAULT
$OPTION INKEY$ TRAPALL
This allows INKEY$ to accept/reject
certain extended characters.
TRAPALL will trap Shift/Ctrl/Alt/Menu
as well as Caps/Num/Scroll lock.
$OPTION VBDLL ON
$OPTION VBDLL OFF
This determines how DLLs are handled.
If VBDLL is enabled (ON), your DLL
declarations in Rapid-Q will mimic VB's
such that your code can be used the
same way in both languages.
This option is OFF by default.
$OPTION WEAKTYPE ON
$OPTION WEAKTYPE OFF
WeakType is disabled (OFF) by default
WeakType allows for faster parsing
and may help in porting some VB code.
It should not generally be used,
unless you know the code is okay.
|
|
$OPTIMIZE |
|
[ OFF | ON ] Default is OFF
$OPTIMIZE can be used to reduce the byte code size by eliminating unnecessary
instructions. If you use this option, make sure it's one of the first things you call.
Usage: $OPTIMIZE ON
|
|
$ESCAPECHARS |
|
[ OFF | ON ] Default is OFF
If $ESCAPECHARS is turned ON, you can use escape sequences in your strings.
Escape sequences can either be character or numeric escapes. Note that case is sensitive.
Usage: $ESCAPECHARS ON
Escape sequence |
Details |
\a
\b
\f
\n
\r
\t
\v
\\
\"
\###
\xHH
|
Alarm bell
Backspace
Form feed
New line
Carriage return
Horizontal Tab
Vertical Tab
Backslash
Double quote
### is any number 0..255
HH is a hexidecimal value 00..FF
|
Examples:
PRINT "\""
Output is "
PRINT "\x41"
Output is A
PRINT "\t\65\66\67\t\68\69\70
Output is ABC   DEF
PRINT "Hey\r\n";
Output is Hey with newline
|
|
$MACRO |
|
MacroName[(Parameters, ...)] MacroDefinition
A Macro simply replaces a definition with another. It can be treated
like a function if you supply parameters. Rapid-Q allows Macros to be
embedded within another Macro (foward only to avoid recursion), token pasting using ##,
and even macro overloading.
You can also redefine operators and special characters except quotes.
A definition can extend to multiple lines by using the colon as a line
separator. A $MACRO directive is global if it preceeds any $INCLUDE directives.
ie. the included files have access to those Macro definitions.
A $MACRO directive only affects the module level (ie. the current file)
if used in an $INCLUDE file. So if A depends on B and B has some $MACRO
directives, then those $MACRO directives only affect B and A has no
access to them unless redeclared in module A.
Notes:
If you use the $MACRO directive, you are forcing Rapid-Q to preprocess
your code, which will prolong the compilation process. Rapid-Q normally performs
a single-pass compilation process.
Usage:
$MACRO ~ ,
This redefines the comma character
Try: ? STRING$(10 ~ "A")
$MACRO strcat(a,b) a=a+b
Implements a STRCAT function
strcat(a$,"abc") translates to a$=a$+"abc"
$MACRO VARID(x) V##x
An example of token pasting
DEFINT VARID(1) translates to DEFINT V1
$MACRO TWO_PI (2*PI)
$MACRO PI 3.14159
Embedded Macros (forward only).
Can't embed itself as a parameter.
This avoids rescanning & recursion.
$MACRO ADD(a,b,c,d) ADD(a,b)+ADD(c,d)
$MACRO ADD(x,y) x+y
$MACRO ADD(x,y,z) x+y+z
An example of macro overloading
|