home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / sample.seq < prev    next >
Text File  |  1990-04-03  |  2KB  |  74 lines

  1. \\ SAMPLE.SEQ        Some Sample Stuff to target Compile
  2.  
  3.     Two examples are included in this file. The first one makes a larger
  4.   .COM file and lets the compile do any needed initialization. The second
  5.   version performs the initialization in the program, and omits those
  6.   initialization operations not needed by this program. The result is a
  7.   MUCH smaller .COM file. Change the TRUE below to FALSE then enter the
  8.   second command line example to see the difference.
  9.  
  10. {
  11.  
  12.                 \ test for whether the /NOINIT option was specified
  13.                 \ and load the proper version
  14.  
  15. ?DEFINIT #IF    \ load this version if using default initialization
  16.  
  17. }
  18.  
  19.   Compile this file with the following command line:
  20.  
  21.         C:>TCOM SAMPLE /OPT <Enter>
  22. {
  23.  
  24. : MAIN          ( -- )
  25.                 ." Hello world! " ;
  26.  
  27. #ELSE   \ else load this version if the /NOINIT option was specified.
  28.  
  29. }
  30.  
  31.   Here is a similar example, that creates a smaller .COM file and only
  32.   does the initialization needed, rather than all of the normal
  33.   initialization.
  34.  
  35.   Compile this example with the following command line:
  36.  
  37.         C:>TCOM SAMPLE /OPT /NOINIT <Enter>
  38.  
  39. {
  40.  
  41. : MAIN          ( -- )
  42.                 DOSIO_INIT                      \ init EMIT, TYPE & SPACES
  43.                 ." Hello world!" ;
  44.  
  45. #THEN
  46.  
  47. }
  48.  
  49.     More notes:
  50.  
  51.     You should see in the above examples that a substantial size
  52.   difference will occur between the three possible compile variations.
  53.  
  54.         TCOM SAMPLE                     produces a 2505 byte .COM file.
  55.  
  56.         TCOM SAMPLE /OPT                produces a 2089 byte .COM file.
  57.  
  58.         TCOM SAMPLE /OPT /NOINIT        produces a 779 byte .COM file on
  59.                                         the second example.
  60.  
  61.     When you specify the /NOINIT option, in this example ONLY, the
  62.   ?DEFINIT flag is tested, and the second version of the program is
  63.   compiled that does the needed initialization.
  64.  
  65.     While it is possible to target compile the first example with the
  66.   command line of the second example and get a smaller .COM file, The
  67.   resulting program will not function.
  68.  
  69.     As you can see there are several options available while building a
  70.   program. The simplest example (without /OPT), is mostly useful when
  71.   debugging, and making listings that are easy to follow.
  72.  
  73.  
  74.