MISCELLANEOUS Statements
Updated: June 2, 2005

DEC(MyVar[,amount])
INC(MyVar[,amount])

  Can use real numbers and fractional values for INC/DEC amount.

  The second optional operand in INC/DEC statements (amount) can be a
  numeric expression.  Thus, we can write:

    INC(i, j+k)

  or 

    INC(i, INSTR(s$,t$))

  INC/DEC are optimized to autodetect non-float values.

    INC(i,10): DEC(j,2)

  is faster than

    i = i + 10: j = j - 2

DOEVENTS + gives up remaining time in application time slice for
  processing of messages in $APPTYPE GUI.

END terminates program; same as Application.Terminate; not same as end
  of source code.

ENVIRON string; string is {variable}={value}; e.g, ENVIRON "TEMP=C:\temp"

FREECONSOLE "frees console window".  Typically used in GUI applications
  after SHOWCONSOLE, if no more console display or PRINT's are wanted.

GOTO label; jumps to code at label.

INITARRAY array; clears array data.

  DIM dat(99) As LONG
  'code
  INITARRAY dat

  INITARRAY is *not* needed at program startup for any array.

LPRINT string; sends string expression to lpt1

  LPRINT "hello world"+crlf  'prints one line
  mystring.loadfromfile("myfile.txt")
  LPRINT mystring  'prints entire file
  MyVar = RETFUNC  'optionally retrieve number of bytes sent to lpt1

  Note: LPRINT supported in PentHouse registered version.

OUT addr, integer; write byte value integer to I/O port address.

OUTW addr, integer; write word value integer to I/O port address.

POPUP integer + displays popup menu where integer is a POPUPMENU handle.

  POPUP MyPopUpMenu.handle  'POPUPMENU is an alias for MAINMENU

  POPUP may show a POPUPMENU under program control or in GUI event
  procedures, as response to user input or other event (hotpopup.bas).

RANDOMIZE integer; sets RND function seed value; e.g., RANDOMIZE TIMER

REDIM array(subscripts); redefine subscript usage and/or size of an array.

  Decreasing overall array size will not erase previous data or reduce
  its ram allocation.  Array item size or type cannot be changed.

  DIM dat(99) As LONG
  'code
  REDIM dat(9,19)

RUN string; string = command line (executable pathname and arguments);
  does not block application.

SHELL string; string = command line (executable pathname and arguments);
  blocks application while shelled program runs.

  If pipe symbols are used in string, then "command.com /c" or "cmd.exe /c"
  may have to be added as a prefix to the argument string.

SHELL1 string; same as SHELL but starts executable with "detached console".

  Application.ErrorLevel after SHELL/SHELL1 retrieves error level value. 
  SHELL and SHELL1 may also be used as numeric functions (hotnum).

SHOWCONSOLE   Please see description in CONSOLE section.

SHOWMESSAGE string; string = message.

SLEEP number

  number is seconds with millisecond resolution; suspends application.
  Use SLEEP to save CPU time if application is waiting for an input or
  event.  E.g., SLEEP 0.05 '50 milliseconds for 20/second frame rate.

SWAP MyVar1, MyVar2; exchanges values for 2 or 4 byte variables.

  MyVars should be the same size: WORD, SHORT, SINGLE, DWORD, LONG, INTEGER

WITH string; string is object or type name.

  E.g., WITH FPU: .load x: .load y: .mul: END WITH

  WITH may be used with destination values located first in a statement
  or preceding an "=" character.


+ Penthouse (registered) version

Copyright 2003-2005 James J Keene PhD
Original Publication: Oct 8, 2003
