divert(-1)dnl

#--------------------------------------------------------------
#
# M4 macro's to convert BaCon code from uppercase to lowercase.
#
# Usage: m4 lower.m4 <prog.bac>
#
#--------------------------------------------------------------

# Avoid name clash with M4 builtin macros
undefine(`decr')
undefine(`eval')
undefine(`incr')
undefine(`include')
undefine(`index')
undefine(`len')

# Avoid M4 changing text in string literals
changecom(`"',`"')

define(ABS,`abs($@)')
define(ACCEPT,`accept($@)')
define(ACOS,`acos($@)')
define(ADDRESS,`address($@)')
define(ALARM,`alarm')
define(ALIAS,`alias')
define(ALIGN,`align($@)')
define(AMOUNT,`amount($@)')
define(AND,`and')
define(APPEND,`ifelse($#,0,append,append($@))')
define(APPENDING,`appending')
define(ARGUMENT,`argument')
define(ARRAY,`array')
define(AS,`as')
define(ASC,`asc($@)')
define(ASIN,`asin($@)')
define(ASSOC,`assoc')
define(ATN2,`atn2($@)')
define(ATN,`atn($@)')
define(B64DEC,`b64dec($@)')
define(B64ENC,`b64enc($@)')
define(BACK,`back')
define(BAPPEND,`bappend')
define(BASE,`base')
define(BASENAME,`basename')
define(BETWEEN,`between')
define(BG,`bg')
define(BIN,`bin($@)')
define(BIT,`bit($@)')
define(BLACK,`black')
define(BLINK,`blink')
define(BLOAD,`bload($@)')
define(BLUE,`blue')
define(BOLD,`bold')
define(BREAK,`break')
define(BROADCAST,`broadcast')
define(BSAVE,`bsave')
define(BY,`by')
define(BYTELEN,`bytelen($@)')
define(CA,`ca')
define(CALL,`call')
define(CASE,`case')
define(CATCH,`catch')
define(CEIL,`ceil($@)')
define(CERTIFICATE,`certificate')
define(CHANGE,`change')
define(CHANGEDIR,`changedir')
define(CHOP,`chop')
define(CHR,`chr')
define(CHUNK,`chunk')
define(CIPHER,`cipher')
define(CLASS,`class')
define(CL,`cl')
define(CLEAR,`clear')
define(CLOSE,`close')
define(CMDLINE,`cmdline($@)')
define(CMODE,`cmode')
define(CN,`cn')
define(COIL,`coil')
define(COLLAPSE,`ifelse($#,0,collapse,collapse($@))')
define(COLLECT,`collect')
define(COLOR,`color')
define(COLUMNS,`columns')
define(COMPARE,`compare')
define(COMPILER,`compiler')
define(CONCAT,`concat')
define(CONST,`const')
define(CONTINUE,`continue')
define(COPY,`copy')
define(COS,`cos($@)')
define(COUNT,`count($@)')
define(CR,`cr')
define(CURDIR,`curdir')
define(CURRENT,`current')
define(CURSOR,`cursor')
define(CUT,`cut')
define(CYAN,`cyan')
define(DATA,`data')
define(DAY,`day($@)')
define(DEC,`dec($@)')
define(DECLARE,`declare')
define(DECR,`decr')
define(DEFAULT,`default')
define(DEF,`def')
define(DEG,`deg($@)')
define(DEL,`del')
define(DELETE,`delete')
define(DELIM,`ifelse($#,0,delim,delim($@))')
define(DEVICE,`device')
define(DIRECTORY,`directory')
define(DIRNAME,`dirname')
define(DLE,`dle')
define(DO,`do')
define(DONE,`done')
define(DOTIMES,`dotimes')
define(DOWN,`down')
define(DOWNTO,`downto')
define(DQ,`dq')
define(EL,`el')
define(ELIF,`elif')
define(ELSE,`else')
define(ENDCLASS,`endclass')
define(END,`end')
define(ENDENUM,`endenum')
define(ENDFILE,`endfile($@)')
define(ENDFORK,`endfork')
define(ENDFUNCTION,`endfunction')
define(ENDFUNC,`endfunc')
define(ENDIF,`endif')
define(ENDRECORD,`endrecord')
define(ENDSELECT,`endselect')
define(ENDSUB,`endsub')
define(ENDUSEC,`endusec')
define(ENDUSEH,`enduseh')
define(ENDWITH,`endwith')
define(ENUM,`enum')
define(EPRINT,`eprint')
define(EQ,`eq')
define(EQUAL,`equal($@)')
define(ERR,`err')
define(ERROR,`error')
define(ESC,`esc')
define(ESCAPE,`escape')
define(EVAL,`eval($@)')
define(EVEN,`even($@)')
define(EXCHANGE,`exchange')
define(EXCL,`excl')
define(EXEC,`exec')
define(EXIT,`exit')
define(EXP,`exp($@)')
define(EXPLICIT,`explicit')
define(EXPLODE,`explode')
define(EXTRACT,`extract')
define(FALSE,`false')
define(FG,`fg')
define(FI,`fi')
define(FILEEXISTS,`fileexists($@)')
define(FILE,`file')
define(FILELEN,`filelen($@)')
define(FILETIME,`filetime($@)')
define(FILETYPE,`filetype($@)')
define(FILL,`fill')
define(FIND,`find($@)')
define(FIRST,`first')
define(FLATTEN,`flatten')
define(FLOATING,`floating')
define(FLOOR,`floor($@)')
define(FN,`fn')
define(FOR,`for')
define(FORK,`fork')
define(FORMAT,`format')
define(FORWARD,`forward')
define(FP,`fp($@)')
define(FRAMEWORK,`framework')
define(FREE,`free')
define(FROM,`from')
define(FUNC,`func')
define(FUNCTION,`function')
define(GE,`ge')
define(GETBYTE,`getbyte')
define(GETENVIRON,`getenviron')
define(GETFILE,`getfile')
define(GETKEY,`getkey')
define(GETLINE,`getline')
define(GETPEER,`getpeer')
define(GETX,`getx')
define(GETY,`gety')
define(GUI,`gui')
define(GUIFN,`guifn($@)')
define(GUIDEFINE,`guidefine($@)')
define(GUIEVENT,`guievent')
define(GUIGET,`guiget($@)')
define(GUISET,`guiset($@)')
define(GUIWIDGET,`guiwidget($@)')
define(GLOBAL,`global')
define(GOSUB,`gosub')
define(GOTO,`goto')
define(GOTOXY,`gotoxy')
define(GREEN,`green')
define(GT,`gt')
define(HASDELIM,`hasdelim($@)')
define(HASH,`hash($@)')
define(HEAD,`head')
define(HEX,`hex')
define(HOST,`host')
define(HOSTNAME,`hostname')
define(HOUR,`hour($@)')
define(IF,`if')
define(IIF,`ifelse($#,0,iif,iif($@))')
define(IMODE,`imode')
define(IMPORT,`import')
define(INBETWEEN,`inbetween')
define(INCLUDE,`include')
define(INCR,`incr')
define(IN,`in')
define(INDEX,`ifelse($#,0,index,index($@))')
define(INPUT,`input')
define(INSERT,`insert')
define(INSTR,`instr($@)')
define(INSTRREV,`instrrev($@)')
define(INTENSE,`intense')
define(INTERNATIONAL,`international')
define(INTL,`intl')
define(INVERSE,`inverse')
define(INVERT,`invert($@)')
define(ISASCII,`isascii($@)')
define(ISFALSE,`isfalse($@)')
define(IS,`is')
define(ISKEY,`iskey($@)')
define(ISNOT,`isnot')
define(ISTOKEN,`istoken($@)')
define(ISTRUE,`istrue($@)')
define(ISUTF8,`isutf8($@)')
define(ITALIC,`italic')
define(JOIN,`join')
define(LABEL,`label')
define(LAST,`last')
define(LCASE,`lcase')
define(LDFLAGS,`ldflags')
define(LEFT,`left')
define(LE,`le')
define(LEN,`len($@)')
define(LET,`let')
define(LIBRARY,`library')
define(LINENO,`lineno')
define(LMODE,`lmode')
define(LOAD,`load')
define(LOCAL,`local')
define(LOG,`log($@)')
define(LOOKUP,`lookup')
define(LOOP,`loop')
define(LT,`lt')
define(MAGENTA,`magenta')
define(MAKEDIR,`makedir')
define(MAP,`map')
define(MATCH,`match($@)')
define(MAX,`ifelse($#,0,max,max($@))')
define(MAXNUM,`maxnum($@)')
define(MAXRANDOM,`maxrandom')
define(MEMCHECK,`memcheck($@)')
define(ME,`me')
define(MEMORY,`memory($@)')
define(MEMREWIND,`memrewind')
define(MEMSTREAM,`memstream')
define(MEMTELL,`memtell($@)')
define(MEMTYPE,`memtype')
define(MERGE,`merge')
define(MID,`mid')
define(MIN,`ifelse($#,0,min,min($@))')
define(MINUTE,`minute($@)')
define(MOD,`mod($@)')
define(MONITOR,`monitor')
define(MONTH,`ifelse($#,0,month,month($@))')
define(MULTICAST,`multicast')
define(MYPID,`mypid')
define(NE,`ne')
define(NETWORK,`network')
define(NEXT,`next')
define(NL,`nl')
define(NNTL,`nntl')
define(NODE,`node')
define(NORMAL,`normal')
define(NOT,`not($@)')
define(NOW,`now')
define(NRKEYS,`nrkeys($@)')
define(NUMBER,`number')
define(OBTAIN,`obtain')
define(ODD,`odd($@)')
define(OFF,`off')
define(OFFSET,`offset')
define(OMODE,`omode')
define(ON,`on')
define(OPEN,`open')
define(OPTION,`option')
define(OPTIONS,`options')
define(OR,`or')
define(OS,`os')
define(OTHER,`other')
define(OUTBETWEEN,`outbetween')
define(PARSE,`parse')
define(PEEK,`peek($@)')
define(PI,`pi')
define(POKE,`poke')
define(POW,`pow($@)')
define(PRAGMA,`pragma')
define(PRINT,`print')
define(PROPER,`proper')
define(PROTO,`proto')
define(PULL,`pull')
define(PUSH,`push')
define(PUTBYTE,`putbyte')
define(PUTLINE,`putline')
define(QUOTED,`quoted')
define(RAD,`rad($@)')
define(RANDOM,`random($@)')
define(READING,`reading')
define(READLN,`readln')
define(READ,`read')
define(READWRITE,`readwrite')
define(REALPATH,`realpath')
define(REAP,`reap')
define(RECEIVE,`receive')
define(RECORD,`record')
define(RECURSIVE,`recursive')
define(REDIM,`redim')
define(RED,`red')
define(REGEX,`regex($@)')
define(REGLEN,`reglen')
define(RELATE,`relate')
define(REM,`rem')
define(RENAME,`rename')
define(REPEAT,`repeat')
define(REPLACE,`replace')
define(RE,`re')
define(RESET,`reset')
define(RESIZE,`resize')
define(RESTORE,`restore')
define(RESUME,`resume')
define(RETURN,`return')
define(RETVAL,`retval')
define(REVERSE,`reverse')
define(REV,`rev')
define(REWIND,`rewind')
define(RIGHT,`right')
define(RIP,`rip')
define(RND,`rnd')
define(ROL,`rol($@)')
define(ROR,`ror($@)')
define(ROTATE,`rotate')
define(ROUND,`round($@)')
define(ROWS,`rows')
define(RUN,`ifelse($#,0,run,run($@))')
define(SAVE,`save')
define(SCREEN,`screen')
define(SCROLL,`scroll')
define(SCTP,`sctp')
define(SEARCH,`search($@)')
define(SECOND,`second($@)')
define(SEED,`seed')
define(SEEK,`seek')
define(SELECT,`select')
define(SEND,`send')
define(SERVER,`server')
define(SET,`set')
define(SETENVIRON,`setenviron')
define(SETSERIAL,`setserial')
define(SGN,`sgn($@)')
define(SIGNAL,`signal')
define(SIN,`sin($@)')
define(SIZEOF,`sizeof($@)')
define(SIZE,`size')
define(SLEEP,`sleep')
define(SOCKET,`socket')
define(SORT,`ifelse($#,0,sort,sort($@))')
define(SOURCE,`source')
define(SP,`sp')
define(SPC,`spc')
define(SPEED,`speed')
define(SPLIT,`split')
define(SQR,`sqr($@)')
define(STARTPOINT,`startpoint')
define(START,`start')
define(STEP,`step')
define(STOP,`stop')
define(STRIKE,`strike')
define(STRING,`string')
define(STR,`str')
define(SUB,`sub')
define(SUMF,`sumf($@)')
define(SUM,`sum($@)')
define(SWAP,`swap')
define(SYSTEM,`system')
define(TAB,`tab')
define(TAIL,`tail')
define(TALLY,`tally($@)')
define(TAN,`tan($@)')
define(TCP,`tcp')
define(TELL,`tell($@)')
define(TEXTDOMAIN,`textdomain')
define(THEN,`then')
define(TIMER,`timer')
define(TIMEVALUE,`timevalue($@)')
define(TLS,`tls')
define(TOASCII,`toascii($@)')
define(TOKEN,`token')
define(TO,`to')
define(TRACE,`trace')
define(TRAP,`trap')
define(TREE,`tree')
define(TRUE,`true')
define(TYPEOF,`typeof')
define(TYPE,`type')
define(UCASE,`ucase')
define(UBOUND,`ubound($@)')
define(UCS,`ucs($@)')
define(UDP,`udp')
define(ULEN,`ulen($@)')
define(UNDERLINE,`underline')
define(UNESCAPE,`unescape')
define(UNFLATTEN,`unflatten')
define(UNIQ,`uniq')
define(UNSET,`unset')
define(UNTIL,`until')
define(UP,`up')
define(USEC,`usec')
define(USEH,`useh')
define(UTF8,`ifelse($#,0,utf8,utf8($@))')
define(VAL,`val($@)')
define(VARTYPE,`vartype')
define(VAR,`var')
define(VERIFY,`verify($@)')
define(VERSION,`version')
define(WAIT,`wait($@)')
define(WALK,`walk')
define(WEEKDAY,`weekday')
define(WEEK,`week($@)')
define(WEND,`wend')
define(WHENCE,`whence')
define(WHERE,`where($@)')
define(WHILE,`while')
define(WHITE,`white')
define(WITH,`with')
define(WRITELN,`writeln')
define(WRITING,`writing')
define(YEAR,`year($@)')
define(YELLOW,`yellow')

divert(0)dnl
