BCX Command Line Usage

Purpose: BC, typed on a command line, invokes the BCX translator, with the options specified, will translate a BCX BASIC file to a C language file.


 Usage :

 BC Infile[.bas] [,Options]

 Parameters:

  • Infile [.bas] The name of the file to be translated. The file name can have any or no extension. If no extension is given, BCX assumes the file ends in .BAS.
  • Options Please note that the order of the command line arguments is important. The options must follow the name of the file to be translated.
    • -b Build using user-defined bat file .. ex -b:c:\bat\pw.bat
    • -c Generate C++ Compatible code
    • -d: Define a constant ... ex. BC MyFile -d:MyConst[=SomeValue]

      The -d switch allows a CONST to be inserted from the command line. If BCX is invoked like so:

      bc Myfile -d:qwerty

      the following would be in the resulting C file:

      #define qwerty

      Likewise, if BCX was invoked like so:

      bc Myfile -d:qwerty=12345

      the following would be in the resulting C file:

      #define qwerty 12345

      BCX has the ability to specify multiple defines in the command line, for example,

      bc test -D:__POCC__=400 -d:OLESUPPORT

    • -e Write ERRORS to BCX.ERR file
    • -f Write C output file to specified path\filename.ext, for example,
      
       BC MyFile -f:C:\MyFiles\MyFile.c
      
      
    • -h Generate HEADER file for use with $Project. When the -h switch is used the file is created with the extension of .bh for bcx header.
    • -i Send Warnings and Errors to INFOBOX
    • -k Kill the generated BCX generated 'C' file
    • -l Create Runtime LIBRARY source and header Files
    • -m Enable embedded BCX Code in the C translation
    • -n Enable NO RUNTIME Code Generation
    • -o Output a copy of the generated C file to STDOUT
    • -q QUIET - No output to screen during translation
    • -r Update BCX Path variable in the Windows REGISTRY

      The -r switch is for setting or updating the BCX path key in the Windows Registry. The path is set to the folder in which BC.EXE is located. The BCXPATH$ function relies on the registry entry for its return value.
      When the -r switch is invoked NOTHING ELSE IS ALLOWED on the command line.

    • -s Show STATUS of translation by line number
    • -t TURBO Mode ON w/optional size. Changes the default size of the array holding the circular buffers used for temporary storage.
      
       BC MyFile -t:1024
      
      
      Note well, the array size must be a power of 2, that is, 4, 8, 16, 32, 64, 128 etc.
    • -u Turn UNICODE Support ON. This switch emits _UNICODE AND UNICODE macros before any Windows header. This is required for full support of BCX COM functions when UNICODE is defined.
    • -w Enable WARNINGS during translation
    • -x Exclude Win32 headers from the resulting C file
    • -z Exclude default headers and libraries from the resulting C file. If the BCX command line option -z is not used, the following .lib files, automatically emitted in the C code by using #pragma directives, do not have to be linked explicitly;
      
       kernel32.lib
       user32.lib
       gdi32.lib
       comctl32.lib
       advapi32.lib
       winspool.lib
       shell32.lib
       ole32.lib
       oleaut32.lib
       uuid.lib
       odbc32.lib
       odbccp32.lib
       winmm.lib
       comdlg32.lib
       imagehlp.lib
       version.lib
      
      

Remarks:

Using the BCX Translator BCX.INI file

BCX.INI provides an easy way to automatically include all your favorite types, variables, constants, and code in all your programs.

BCX.INI is a user defined BASIC source code file that must reside either in the same folder as the BCX translator(BC.EXE) or in the current folder, if it is to be used.

For example, if you create a BCX.INI that contains the following


 SUB Foo(A$)
  MSGBOX A$
 END SUB

then your main file could be the ONE LINE program :


 Foo("Hello From BCX.INI")

If BCX can translate it, you can put it in the BCX.INI, including CONST's, inline C, comments, directives, whatever.

As one's personal BCX.INI grows, one may want to consider using the CONDITIONAL COMPILATION directives: $IF, ELSE, $ELSEIF, $ENDIF to conditionally $INCLUDE other BASIC files into BCX.INI, instead of keeping them all in BCX.INI.

$NOINI directive

BCX does not require BCX.INI to function. By default, BCX will automatically include the contents of this BCX.INI each time BCX is invoked. This behavior can be disabled by placing the $NOINI directive at the beginning of your source code file, before any code or variable declarations.