Using Same Source to CHAIN When Both Interpreted and Compiled (34291)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0

This article was previously published under Q34291

SUMMARY

The following information applies to the Microsoft QuickBASIC Compiler Version 1.00 for the Apple Macintosh.

It is possible to write a QuickBASIC program that CHAINs both in the interpreter environment and in a compiled application without changes to the source file. The first method uses the $IGNORE metacommand, while the second uses the SYSTEM(4) function. The REM $IGNORE ON metacommand instructs the compiler to ignore the following statements until a REM $IGNORE OFF is encountered. The SYSTEM(4) function returns 1 in a compiled program and 0 in an interpreted program.

MORE INFORMATION

Let us assume that we have a program "proga" which CHAINs to "progb". The following is the listing for "progb":
   PRINT "inside progb"
   END
				
When you compile the "progb" source file, the compiler names the compiled application "progb apl" by default.

The following is the listing for "proga" using the first (REM $IGNORE ON/OFF) method:
  CLS
  PRINT "inside proga"
  ext$ = " Apl"
  nxtprog$ = "progb"
  REM $IGNORE ON
  ext$ = ""
  REM $IGNORE OFF
  nxtprog$ = nxtprog$ + ext$
  CHAIN nxtprog$
				
The following is the listing for "proga" using the second [i.e., SYSTEM(4)] method:
  CLS
  PRINT "inside proga"
  ext$ = " Apl"   ' Compiler appends " Apl" to application names.
  nxtprog$ = "progb"
  ' When SYSTEM(4) returns 0, we're inside environment:
  IF SYSTEM(4) = 0 THEN ext$ = ""
  nxtprog$ = nxtprog$ + ext$
  CHAIN nxtprog$
				

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB34291