Subject: v001SRC069: coff (OMF Disassembler) 04/09 Newsgroups: comp.sources.apple2 Approved: jac@paul.rutgers.edu Submitted-by: Albert Chin-A-Young (26285659t@servax.fiu.edu) Posting-number: Volume 1, Source:69 Archive-name: utility/gs/disassem/coff/part04 Architecture: ONLY_2gs Version-number: 1.1 =env.h.s -* environment defines -* -* 1992, tao Developer Project - -ORCA_ENV equ %00000001 ;if compiling for ORCA environment -GNO_ENV equ %00000010 ;if compiling for GNO environment -MERLIN_ENV equ %00000100 ;if compiling for MERLIN environment -ENV equ MERLIN_ENV ;default environment to compile for - -LINEFEED_CHAR equ $0a ;linefeed character -RETURN_CHAR equ $0d ;return character =env.mac.s -* environment macros -* -* 1992, tao Developer Project - -put_cr mac ;environment specific carriage return - do ENV&ORCA_ENV ;orca environment requires cr/lf - pea #RETURN_CHAR - _WriteChar - pea #LINEFEED_CHAR - _WriteChar - fin - do ENV&GNO_ENV ;gno environment requires cr/lf - pea #RETURN_CHAR - _WriteChar - pea #LINEFEED_CHAR - _WriteChar - fin - do ENV&MERLIN_ENV ;merlin environment requires cr - pea #RETURN_CHAR - _WriteChar - fin - eom =getopt.h.s -* UNIX getopt library -* declarations for getopt -* -* albert chin-a-young ... 26285659t@servax.fiu.edu - - -* For communication from 'getopt' to the caller. -* When 'getopt' finds an option that takes an argument, -* the argument value is returned here. -* Also, when 'ordering' is RETURN_IN_ORDER, -* each non-option ARGV-element is returned here. - -optarg ext - -* Index in ARGV of the next element to be scanned. -* This is used for communication to and from the caller -* and for communication between successive calls to 'getopt'. -* -* On entry to 'getopt', zero means this is the first call; initialize. -* -* When 'getopt' returns EOF, this is the index of the first of the -* non-option elements that the caller should itself scan. -* -* Otherwise, 'optind' communicates from one call to the next -* how much of ARGV has been scanned so far. - -optind ext - -* Callers store zero here to inhibit the error message 'getopt' prints -* for unrecognized options. - -opterr ext - -* If nonzero, '-' can introduce long-named options. -* Set by getopt_long_only. - -_getopt_long_only ext - -* The index in GETOPT_LONG_OPTIONS of the long-named option found. -* Only valid when a long-named option has been found by the most -* recent call to 'getopt'. - -option_index ext - -* function calls -* -init_getopt ext ;initialize command-line arguments -getopt ext -getopt_long ext -getopt_long_only ext -envopt ext - -argc ext ;number of command-line options -argv ext ;array of pointers to command-line options - -;option data structure offsets -`has_arg equ $00 ;if option has arguments -`flag equ `has_arg+2 ;pointer to variable to set -`val equ `flag+4 ;default value of option -`name equ `val+2 ;long name of option - -;argv data structure offsets -`lo equ $00 ;handle to array of command-line -`hi equ $04 ;options =getopt.mac.s -* UNIX getopt library -* macros -* -* 1992, tao Developer Project - -* Describe the long-named options requested by the application. -* _GETOPT_LONG_OPTIONS is a vector of 'struct option' terminated by an -* element containing a name which is zero. -* -* The field 'has_arg' is: -* 0 if the option does not take an argument, -* 1 if the option requires an argument, -* 2 if the option takes an optional argument. -* -* If the field 'flag' is nonzero, it points to a variable that is set -* to the value given in the field 'val' when the option is found, but -* left unchanged if the option is not found. -* -* To have a long-named option do something other than set an 'int' to -* a compiled-in constant, such as set a value from 'optarg', set the -* option's 'flag' field to zero and its 'val' field to a nonzero -* value (the equivalent single-letter option character, if there is -* one). For long options that have a zero 'flag' field, 'getopt' -* returns the contents of the 'val' field. - -option mac - dw ]2 ;if option has arguments - adrl ]3 ;flags - dw ]4 ;value of variable if no option assigned - if N,]1 ;if at last label (NULL) - db 0 - else - pStr ]1 ;name of option - fin - eom + END OF ARCHIVE