Rapid-Q Documentation by William Yu (c)1999-2000 | Chapter 2

# 2. Rapid-Q Fundamentals

  Before jumping into any language, it helps to know how to use it first. This chapter will introduce you to the Rapid-Q environment, how to compile and run your programs, and what the general structure of your Rapid-Q program will look like.
  2.1 Rapid-Q environment
  Your Rapid-Q distribution should have included an IDE (integrated development environment) program (called RAPIDQ.EXE), along with the actual Rapid-Q compiler (RC.EXE). RAPIDQ32.LIB and RAPIDQCC.LIB are also required to compile any of your programs. If any of these files are missing, please report the problem to me or the webmaster of the site you downloaded Rapid-Q from. These are the main (4) programs that you will need to develop and compile your Rapid-Q source codes. The IDE is strictly optional, so if your distribution excludes this file, don't fret. If you feel more comfortable writing your programs in NotePad or whatever editor you choose, that's also fine. If that is the case, you probably want to skip the next section on Using the Rapid-Q IDE. All these files must reside in the same directory.
  2.2 Using the Rapid-Q IDE
  Unlike some IDEs that offer debugging options, the Rapid-Q IDE offers nothing more than an environment to write your programs, run them, and provide run-time command options. It has primitive error checks, I say primitive, because the IDE doesn't do the error checking at all, (RC.EXE) the compiler does all of it. It's just that the Rapid-Q IDE interfaces nicely with RC.EXE so you don't really notice that. It also provides syntax highlighting which makes using the Rapid-Q language much easier.
  What are its limitations:
  - Not all components are available in the form designer
  - When running your program, your source code is automatically saved
  - All files are compiled before they are executed
  I can't speak for everybody, but the Rapid-Q IDE is a good tool to use when starting out to learn the Rapid-Q language, but as you become more accustomed to the language, most people would switch to their favourite text editor. That is not to say that you should abandon using the Rapid-Q IDE altogether, if you feel comfortable using it, by all means, stick with it.
  2.3 Compiling and Running a Simple Application
  Wait a minute, we haven't even covered the BASICs on writing a simple application yet. Don't worry, we'll get to that, it's better to know how to compile and run it first before doing anything else. Here is a very simple GUI application that you can type in and compile for yourself.

                  DIM MainForm AS QFORM
                  MainForm.ShowModal

  If you're using the Rapid-Q IDE, just type in that code (or cut & paste if you like). Click on the Run Menu, and select Run. If all goes well, you should see an empty Window at the top left hand corner of the screen. Close it and return to your IDE. If you prefer the command line approach of compiling, then load up your favourite editor, copy the above code and save it to a file (Forms.BAS). Then to compile it, you type in:

                RC Forms.BAS

  If all goes well, you should have a Forms.EXE file in the current directory. Just type Forms to run it. If all goes well, continue reading. If not, then something is amiss, in which case, see the Trouble Shooting section.
  2.4 Command line switches for RC.EXE
  I will only discuss the 3 more important ones:

            -I[Path] Change Include Path
            -L[Path] Change Library Path
            -G[File] Icon file

  The compiler by default looks in the current directory for the .LIB files and any include files. You can override this by specifying the above command line switches. Since we're talking about C type parameters, there are a few niceties you have to know about, first, the paths should be specified like so:

            RC -Ic:/rapidq/includes

  You can use \ instead of / but there's a reason why / is preferred, consider this:

            RC -I"c:\rapidq long dir\includes\"

  If you never used C (or C++) you'll not likely see what I mean. If you prefer the above command line, you have to add an extra \ to the end (or drop it entirely), like so:

            RC -I"c:\rapidq long dir\includes\\"
      or
            RC -I"c:\rapidq long dir\includes"

  This is because C translates \" into " which is obvious to any C programmer. Also, long file names must be enclosed in quotations. Those are the catches, so now you know (or already knew).
  Now, to change the default icon for your .EXE file, you can use the -G command switch:

            RC -Gzip.ico zipview.bas

  When your ZIPVIEW.EXE file is generated, the file "zip.ico" will replace the default icon. Please note that your icon must be 32x32 and 16 colors (also 766 bytes).
  2.5 General Structure of a Rapid-Q Program
  There really is no pre-defined structure of a BASIC program, but there is a general form that most people conform to.
  Directives
  Declarations
  Global Variables
  Main Program
  This is only a general form, your Rapid-Q applications can be structured in a variety of ways. Some of which will have similar results, and some will have devasting or more customized results. For example, $INCLUDE is a directive to import a file at that position. So if you use $INCLUDE somewhere in your main program, it would have a different result than if you included it at the beginning of your program.
  2.6 How close to the BASIC Language is Rapid-Q?
  Very close, all the familiar commands like DIM, PRINT, MID$, etc. are inherited. That does not mean you'll be able to port your DOS based QBasic programs to Rapid-Q without any modification. Since Rapid-Q is Windows based, providing primitive support for CONSOLE, it's a safe bet you won't directly convert your QBasic applications to Rapid-Q without a 50-90% rewrite of your source code (depending on what the code does). Comments in Rapid-Q begin with the ' symbol, just like QBasic, or you can use REM instead. You can also separate lines by using the colon : symbol. This has the same effect as starting a new line.

                   PRINT "Hello" : PRINT "World"
               or
                   PRINT "Hello"
                   PRINT "World"

  Most BASIC programmers will become very accustomed to the language once they use it. However, Rapid-Q does not inherit the properties of Visual Basic. For example, there's no SUB MAIN procedure, nor is there any public or private identifiers used in Rapid-Q. Your entire program is considered the MAIN program. Going from Rapid-Q to Visual Basic probably requires a bit more effort than the reverse.

  Prev Chapter | Contents | Next Chapter