symbols[]: global scope global global scope implicit__sio type int16 = int16 type uint16 = uint16 type int32 = int32 type uint32 = uint32 type int64 = int64 type uint64 = uint64 type float64 = float48 type offs = int16 type addr = uint16 type void = void type byte = int16 type ubyte = uint16 type short = int16 type ushort = uint16 type long = int32 type ulong = uint32 type int = int16 type uint = uint16 type ucs2char = enum uint16 ucs2char operator + ( ucs2char, int16 ) = opcode Add type ucs4char = enum uint32 type ucs2str = ucs2char[] ucs2str toupper ( ucs2str ) = opcode toupper ucs2str tolower ( ucs2str ) = opcode tolower ucs2str escape ( ucs2str, ucs2char leftquote ) = opcode escape ucs2str unescape ( ucs2str ) = opcode unescape type ucs4str = ucs4char[] type char = enum uint16 type bool = enum uint16 type float = float48 type str = ucs2char[] type Thread = { int16 state1, int16 state2, int16 prio, int16 prio_org, Tid next1, Tid prev1, Tid next2, Tid prev2, void* blocker, float48 time, Mutex* mutexes, uint16*[] rstack, int16[] vstack, int16* context0, int16* context1, uint16* ip, uint16** rp, int16* vp, int16* gp, int16 _errno } var int16 state1 var int16 state2 var int16 prio var int16 prio_org var Tid next1 var Tid prev1 var Tid next2 var Tid prev2 var void* blocker var float48 time var Mutex* mutexes var uint16*[] rstack var int16[] vstack var int16* context0 var int16* context1 var uint16* ip var uint16** rp var int16* vp var int16* gp var int16 _errno type Mutex = { Tid waiters, Tid owner, Mutex¢ next, Mutex¢ prev, lock ( Mutex¢ ) = opcode lock, unlock ( Mutex¢ ) = opcode unlock, trylock ( Mutex¢ ) = opcode trylock, trylock ( Mutex¢, float48 timeout ) = opcode trylock, x copy ( Mutex ) = opcode copy, x kill ( Mutex ) = opcode kill } var Tid waiters var Tid owner var Mutex¢ next var Mutex¢ prev void lock ( Mutex¢ ) = opcode lock void unlock ( Mutex¢ ) = opcode unlock bool trylock ( Mutex¢ ) = opcode trylock bool trylock ( Mutex¢, float48 timeout ) = opcode trylock Mutex copy ( Mutex ) = opcode copy Mutex kill ( Mutex ) = opcode kill type Sema = { Tid waiters, int16 count, request ( Sema¢ ) = opcode request, release ( Sema¢ ) = opcode release, tryrequest ( Sema¢ ) = opcode tryrequest, tryrequest ( Sema¢, float48 timeout ) = opcode tryrequest, copy ( Sema ) = opcode copy, kill ( Sema ) = opcode kill, clear ( Sema¢ s ) = opcode mutexclear, add ( Sema¢ s, int16 n ) = opcode release } var Tid waiters var int16 count void request ( Sema¢ ) = opcode request void release ( Sema¢ ) = opcode release bool tryrequest ( Sema¢ ) = opcode tryrequest bool tryrequest ( Sema¢, float48 timeout ) = opcode tryrequest Sema copy ( Sema ) = opcode copy Sema kill ( Sema ) = opcode kill void clear ( Sema¢ s ) = opcode mutexclear void add ( Sema¢ s, int16 n ) = opcode release type Irpt = { Tid waiters, int16 count, wait ( Irpt¢ ) = opcode wait, wait ( Irpt¢, float48 timeout ) = opcode wait, trigger ( Irpt¢ ) = opcode trigger, clear ( Irpt¢ i ) = opcode semaclear, copy ( Irpt ) = opcode copy, kill ( Irpt ) = opcode kill } var Tid waiters var int16 count void wait ( Irpt¢ ) = opcode wait void wait ( Irpt¢, float48 timeout ) = opcode wait void trigger ( Irpt¢ ) = opcode trigger void clear ( Irpt¢ i ) = opcode semaclear Irpt copy ( Irpt ) = opcode copy Irpt kill ( Irpt ) = opcode kill type Object = {} type Stream = {} type FileInfo = {} type utf8str = ucs2char[] type str_r = ucs2char[to] type Tid = Thread¢ type int8 = int16 type uint8 = uint16 type FD = { NodeType nodetype, ucs2str name, FD¢ parent, bool wide, t uint16 WIDE = 1, t uint16 DIR = 2, t uint16 FILE = 4, t uint16 BLOCK = 8, t uint16 SER = 16, t uint16 ANY = 30, t uint16 REWIND = 32, t uint16 TRUNC = 64, t uint16 EXIST = 128, t uint16 NEW = 256, t uint16 AUTO = 512, t uint16 TEST = 1024, t uint16 APPEND = 2048, isrootdir ( FD¢ ), istrashdir ( FD¢ ), contains ( FD¢, FD¢ ), str[] entries ( FD¢ ), ind ( FD¢, ucs2str¢ name ), 16 getctl ( FD¢, uint16 ctlnr ), setctl ( FD¢, uint16 ctlnr, uint16 value ), ioblocks ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e, bool wide, bool write ), writeblocks8 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ), readblocks8 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ), writeblocks16 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ), readblocks16 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ), 16 getavail ( FD¢ ), 16 getfree ( FD¢ ), 16 readbyte ( FD¢ ), writebyte ( FD¢, uint16 ), 32 read2bytes ( FD¢ ), write2bytes ( FD¢, uint32 n ), readbytes ( FD¢, uint16[]¢ ), writebytes ( FD¢, uint16[]¢ ), readbytes ( FD¢, int16[]¢ ), writebytes ( FD¢, int16[]¢ ), readdata ( FD¢, uint16[]¢ ), writedata ( FD¢, uint16[]¢ ), readdata ( FD¢, int16[]¢ ), writedata ( FD¢, int16[]¢ ), 16 read15 ( FD¢ z ), write15 ( FD¢ z, uint16 ), 16 read ( FD¢ ), write ( FD¢, uint16 ), 6 read ( FD¢ ), write ( FD¢, int16 ), 32 read24 ( FD¢ ), write24 ( FD¢, uint32 ), 32 read ( FD¢ ), write ( FD¢, uint32 ), 2 read ( FD¢ ), write ( FD¢, int32 ), t48 read ( FD¢ ), write ( FD¢, float48 ), str read ( FD¢ ), write ( FD¢, ucs2str¢ ), str getstr ( FD¢ ), putstr ( FD¢, ucs2str ), putstr ( FD¢, ucs2str¢ ), char getchar ( FD¢ ), putchar ( FD¢, uint16 ) } var NodeType nodetype var ucs2str name var FD¢ parent var bool wide const uint16 WIDE = 1 const uint16 DIR = 2 const uint16 FILE = 4 const uint16 BLOCK = 8 const uint16 SER = 16 const uint16 ANY = 30 const uint16 REWIND = 32 const uint16 TRUNC = 64 const uint16 EXIST = 128 const uint16 NEW = 256 const uint16 AUTO = 512 const uint16 TEST = 1024 const uint16 APPEND = 2048 bool isrootdir ( FD¢ ) bool istrashdir ( FD¢ ) bool contains ( FD¢, FD¢ ) ucs2str[] entries ( FD¢ ) FD find ( FD¢, ucs2str¢ name ) uint16 getctl ( FD¢, uint16 ctlnr ) void setctl ( FD¢, uint16 ctlnr, uint16 value ) void ioblocks ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e, bool wide, bool write ) void writeblocks8 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ) void readblocks8 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ) void writeblocks16 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ) void readblocks16 ( FD¢, uint32 startblock, uint16[]¢ data, uint16 a, uint16 e ) uint16 getavail ( FD¢ ) uint16 getfree ( FD¢ ) uint16 readbyte ( FD¢ ) void writebyte ( FD¢, uint16 ) uint32 read2bytes ( FD¢ ) void write2bytes ( FD¢, uint32 n ) void readbytes ( FD¢, uint16[]¢ ) void writebytes ( FD¢, uint16[]¢ ) void readbytes ( FD¢, int16[]¢ ) void writebytes ( FD¢, int16[]¢ ) void readdata ( FD¢, uint16[]¢ ) void writedata ( FD¢, uint16[]¢ ) void readdata ( FD¢, int16[]¢ ) void writedata ( FD¢, int16[]¢ ) uint16 read15 ( FD¢ z ) void write15 ( FD¢ z, uint16 ) uint16 read ( FD¢ ) void write ( FD¢, uint16 ) int16 read ( FD¢ ) void write ( FD¢, int16 ) uint32 read24 ( FD¢ ) void write24 ( FD¢, uint32 ) uint32 read ( FD¢ ) void write ( FD¢, uint32 ) int32 read ( FD¢ ) void write ( FD¢, int32 ) float48 read ( FD¢ ) void write ( FD¢, float48 ) ucs2str read ( FD¢ ) void write ( FD¢, ucs2str¢ ) ucs2str getstr ( FD¢ ) void putstr ( FD¢, ucs2str ) void putstr ( FD¢, ucs2str¢ ) ucs2char getchar ( FD¢ ) void putchar ( FD¢, uint16 ) type File = FD + {} type Dir = FD + {} type Block = {} const bool yes = 1 const bool no = 0 const bool true = 1 const bool false = 0 type Err = enum uint16 const Err ok = 0 const Err parameter_error = 1 const Err io_error = 2 const Err device_not_responding = 3 const Err device_busy = 4 const Err not_a_file = 5 const Err not_a_dir = 6 const Err not_a_filesystem = 7 const Err wrong_filetype = 8 const Err file_not_found = 9 const Err file_exists = 10 const Err no_space_left_on_device = 11 const Err end_of_file = 12 const Err dir_not_empty = 13 const Err not_same_device = 14 const Err directories_intersect = 15 const Err data_out_of_range = 16 const Err function_not_supported = 17 const Err null_pointer = 18 const Err out_of_memory = 19 var Err errno const float48 pi = 3.1415926535898 const float48 ec = 2.718281828459 void k1mc_option_procptr_in_rom () = opcode k1mc_option_procptr_in_rom void k1mc_option_procptr_in_ram () = opcode k1mc_option_procptr_in_ram void k1mc_option_return_to_rom () = opcode k1mc_option_return_to_rom void k1mc_option_return_to_ram () = opcode k1mc_option_return_to_ram void k1mc_option_proc_return_to_ram () = opcode k1mc_option_proc_return_to_ram uint32 new ( uint16 hi, uint16 lo ) = opcode nop int16 sign ( int16 ) = opcode sign int16 sign ( int32 ) = opcode sign uint16 abs ( int16 ) = opcode abs uint32 abs ( int32 ) int16 min ( int16, int16 ) = opcode min uint16 min ( uint16, uint16 ) = opcode min int32 min ( int32, int32 ) uint32 min ( uint32, uint32 ) int16 min ( int16, int16, int16 ) = opcode min uint16 min ( uint16, uint16, uint16 ) = opcode min int32 min ( int32, int32, int32 ) = opcode min uint32 min ( uint32, uint32, uint32 ) = opcode min int16 max ( int16, int16 ) = opcode max uint16 max ( uint16, uint16 ) = opcode max int32 max ( int32, int32 ) = opcode max uint32 max ( uint32, uint32 ) = opcode max int16 max ( int16, int16, int16 ) = opcode max uint16 max ( uint16, uint16, uint16 ) = opcode max int32 max ( int32, int32, int32 ) = opcode max uint32 max ( uint32, uint32, uint32 ) = opcode max int16 swap ( int16 ) = opcode swap uint16 swap ( uint16 ) = opcode swap int32 swap ( int32 ) = opcode swap uint32 swap ( uint32 ) = opcode swap int16 hilo ( int16 ) = opcode hilo uint16 hilo ( uint16 ) = opcode hilo int32 hilo ( int32 ) = opcode hilo uint32 hilo ( uint32 ) = opcode hilo int16 lohi ( int16 ) = opcode lohi uint16 lohi ( uint16 ) = opcode lohi int32 lohi ( int32 ) = opcode lohi uint32 lohi ( uint32 ) = opcode lohi uint16 flip ( uint16 ) = opcode flip uint32 flip ( uint32 ) = opcode flip int16 msbit0 ( int16 ) = opcode msbit0 int16 msbit0 ( uint16 ) = opcode msbit0 int16 msbit ( int16 ) = opcode msbit int16 msbit ( uint16 ) = opcode msbit int16 pow ( int16, int16 ) = opcode pow uint16 pow ( uint16, int16 ) = opcode pow int32 pow ( int32, int16 ) = opcode pow uint32 pow ( uint32, int16 ) = opcode pow uint16 random () uint16 random ( uint16 ) uint32 random () uint32 random ( uint32 ) uint16 mul10 ( uint16 ) = opcode Mul10 uint16 exp10 ( uint16 ) = opcode Exp10 uint16 log10 ( uint16 ) = opcode Log10 bool bit15 ( uint16 ) = opcode Bit15 int16 sign ( float48 ) float48 abs ( float48 ) float48 min ( float48, float48 ) float48 max ( float48, float48 ) float48 round ( float48 ) float48 floor ( float48 ) float48 ceil ( float48 ) float48 integ ( float48 ) float48 fract ( float48 ) float48 random () float48 random ( float48 ) float48 sin ( float48 ) float48 cos ( float48 ) float48 exp10 ( float48 ) float48 log10 ( float48 ) float48 exp2 ( float48 ) float48 log2 ( float48 ) float48 expe ( float48 ) float48 loge ( float48 ) float48 exp ( float48, float48 ) float48 log ( float48, float48 ) float48 pow ( float48, int16 ) float48 sqrt ( float48 ) bool isletter ( ucs2char ) = opcode is_letter bool isdigit2 ( ucs2char ) = opcode is_bin_digit bool isdigit10 ( ucs2char ) = opcode is_dec_digit bool isdigit16 ( ucs2char ) = opcode is_hex_digit uint16 value10 ( ucs2char ) = opcode digit_value uint16 value16 ( ucs2char ) = opcode digit_value uint16 value36 ( ucs2char ) = opcode digit_value void memcpy ( void* z, void* q, uint16 n ) = opcode memcpy void memcpy ( uint16* z, uint16* q, uint16 n ) = opcode memcpy void memcpy ( int16* z, int16* q, uint16 n ) = opcode memcpy void memcpy ( ucs2char* z, ucs2char* q, uint16 n ) = opcode memcpy void rmemcpy ( void* z, void* q, uint16 cnt ) = opcode rmemcpy void rmemcpy ( uint16* z, uint16* q, uint16 cnt ) = opcode rmemcpy void rmemcpy ( int16* z, int16* q, uint16 cnt ) = opcode rmemcpy void rmemcpy ( ucs2char* z, ucs2char* q, uint16 cnt ) = opcode rmemcpy void memmove ( void* z, void* q, uint16 cnt ) = opcode memmove void memmove ( uint16* z, uint16* q, uint16 cnt ) = opcode memmove void memmove ( int16* z, int16* q, uint16 cnt ) = opcode memmove void memmove ( ucs2char* z, ucs2char* q, uint16 cnt ) = opcode memmove void memset ( void* z, int16 q, uint16 n ) = opcode memset void memset ( ucs2char* z, ucs2char q, uint16 cnt ) = opcode memset void memset ( uint16* z, uint16 q, uint16 cnt ) = opcode memset void memset ( int16* z, int16 q, uint16 cnt ) = opcode memset void memclr ( void* z, uint16 cnt ) = opcode memclr void memclr ( ucs2char* z, uint16 cnt ) = opcode memclr void memclr ( uint16* z, uint16 cnt ) = opcode memclr void memclr ( int16* z, uint16 cnt ) = opcode memclr void copy ( uint16[]¢ q, uint16[]¢ z ) = opcode copy void copy ( uint16[]¢ q, uint16 qi, uint16[]¢ z, uint16 zi, uint16 n ) void copy ( int16[]¢ q, uint16 qi, int16[]¢ z, uint16 zi, uint16 n ) void copy ( ucs2str¢ q, uint16 qi, ucs2str¢ z, uint16 zi, uint16 n ) void memcompact () = opcode MemCompact uint16 memgetfree () = opcode MemGetFree void copy_i16_to_i8 ( uint16[]¢ q, uint16 qi, uint16[]¢ z, uint16 zi ) void copy_i8_to_i16 ( uint16[]¢ q, uint16 qi, uint16[]¢ z, uint16 zi ) void copy_i16_to_i8 ( int16[]¢ q, uint16 qi, int16[]¢ z, uint16 zi ) void copy_i8_to_i16 ( int16[]¢ q, uint16 qi, int16[]¢ z, uint16 zi ) str_r substr ( ucs2str¢ s, int16 a, int16 e ) = opcode substr str_r midstr ( ucs2str¢ s, int16 i, int16 n ) str_r midstr ( ucs2str¢ s, int16 i ) str_r leftstr ( ucs2str¢ s, int16 n ) str_r rightstr ( ucs2str¢ s, int16 n ) int16[to] substr ( int16[]¢ s, int16 a, int16 e ) int16[to] midstr ( int16[]¢ s, int16 i, int16 n ) int16[to] midstr ( int16[]¢ s, int16 i ) int16[to] leftstr ( int16[]¢ s, int16 n ) int16[to] rightstr ( int16[]¢ s, int16 n ) uint16[to] substr ( uint16[]¢ s, int16 a, int16 e ) uint16[to] midstr ( uint16[]¢ s, int16 i, int16 n ) uint16[to] midstr ( uint16[]¢ s, int16 i ) uint16[to] leftstr ( uint16[]¢ s, int16 n ) uint16[to] rightstr ( uint16[]¢ s, int16 n ) ucs2str new ( int16 n ) = opcode spacestr ucs2str spacestr ( int16 n ) = opcode spacestr ucs2str spacestr ( int16 n, ucs2char c ) = opcode spacestr ucs2str charstr ( uint16 c ) = opcode charstr ucs2char hexchar ( uint16 n ) ucs2str hexstr ( uint16 n ) ucs2str hexstr ( uint32 n ) ucs2str hexstr ( uint16 n, uint16 digits ) ucs2str hexstr ( uint32 n, uint16 digits ) ucs2str binstr ( uint16 n ) = opcode binstr ucs2str binstr ( uint32 n ) = opcode binstr ucs2str binstr ( uint16 n, uint16 digits ) = opcode binstr ucs2str binstr ( uint32 n, uint16 digits ) = opcode binstr ucs2str binstr ( uint16 n, ucs2str¢ d0, ucs2str¢ d1 ) = opcode binstr ucs2str binstr ( uint32 n, ucs2str¢ d0, ucs2str¢ d1 ) = opcode binstr ucs2str numstr ( int16 n ) ucs2str numstr ( uint16 n ) ucs2str numstr ( int32 n ) ucs2str numstr ( uint32 n ) ucs2str numstr ( float48 n ) int16 numval ( ucs2str¢ ) = opcode numval uint16 numval ( ucs2str¢ ) = opcode numval int32 numval ( ucs2str¢ ) = opcode numval uint32 numval ( ucs2str¢ ) = opcode numval float48 numval ( ucs2str¢ ) = opcode numval int16 find ( int16[]¢, int16, int16 idx ) = opcode find int16 find ( int32[]¢, int32, int16 idx ) = opcode find int16 find ( uint16[]¢, uint16, int16 idx ) = opcode find int16 find ( uint32[]¢, uint32, int16 idx ) = opcode find int16 find ( float48[]¢, float48, int16 idx ) = opcode find int16 find ( int16[]¢, int16[]¢, int16 idx ) = opcode find int16 find ( uint16[]¢, uint16[]¢, int16 idx ) = opcode find int16 rfind ( int16[]¢, int16, int16 idx ) = opcode rfind int16 rfind ( int32[]¢, int32, int16 idx ) = opcode rfind int16 rfind ( uint16[]¢, uint16, int16 idx ) = opcode rfind int16 rfind ( uint32[]¢, uint32, int16 idx ) = opcode rfind int16 rfind ( float48[]¢, float48, int16 idx ) = opcode rfind int16 rfind ( int16[]¢, int16[]¢, int16 idx ) = opcode rfind int16 rfind ( uint16[]¢, uint16[]¢, int16 idx ) = opcode rfind ucs2str min ( ucs2str, ucs2str ) = opcode min ucs2str¢ min ( ucs2str¢, ucs2str¢ ) = opcode min ucs2str max ( ucs2str, ucs2str ) = opcode max ucs2str¢ max ( ucs2str¢, ucs2str¢ ) = opcode max int16 min ( int16[]¢ ) = opcode min int32 min ( int32[]¢ ) = opcode min uint16 min ( uint16[]¢ ) = opcode min uint32 min ( uint32[]¢ ) = opcode min float48 min ( float48[]¢ ) = opcode min ucs2str¢ min ( ucs2str[]¢ ) = opcode min int16 min ( int16[to] ) = opcode min int32 min ( int32[to] ) = opcode min uint16 min ( uint16[to] ) = opcode min uint32 min ( uint32[to] ) = opcode min float48 min ( float48[to] ) = opcode min ucs2str¢ min ( ucs2str[to] ) = opcode min int16 max ( int16[]¢ ) = opcode max int32 max ( int32[]¢ ) = opcode max uint16 max ( uint16[]¢ ) = opcode max uint32 max ( uint32[]¢ ) = opcode max float48 max ( float48[]¢ ) = opcode max ucs2str¢ max ( ucs2str[]¢ ) = opcode max int16 max ( int16[to] ) = opcode max int32 max ( int32[to] ) = opcode max uint16 max ( uint16[to] ) = opcode max uint32 max ( uint32[to] ) = opcode max float48 max ( float48[to] ) = opcode max ucs2str¢ max ( ucs2str[to] ) = opcode max ucs2str join ( ucs2str[]¢, ucs2str¢ ) = opcode join ucs2str join ( ucs2str[]¢, ucs2char ) = opcode join ucs2str[] split ( ucs2str¢, ucs2str¢ ) = opcode split ucs2str[] split ( ucs2str¢, ucs2char ) = opcode split const uint16 tm_utc = 0 const uint16 tm_localtime = 1 const uint16 tm_time = 2 const uint16 tm_date = 4 const uint16 tm_timezone = 8 const uint16 tm_sec = 16 const uint16 tm_msec = 32 float48 now () = opcode now ucs2str timestr ( float48 seconds, int16 localtime ) = opcode timestr float48 timeval ( ucs2str¢, int16 localtime ) = opcode timeval Tid self () = opcode self int16 vfree () = opcode vfree int16 rfree () = opcode rfree void freeze ( bool ) = opcode freeze void termi () = opcode termi void termi ( Tid ) = opcode termi void suspend () = opcode suspend void suspend ( Tid ) = opcode suspend void resume ( Tid ) void wait () = opcode wait void wait ( float48 sec ) void shedule ( float48 when ) = opcode shedule void busywait ( uint16 usec ) = opcode busywait ucs2str errorstr ( int16 error ) = opcode errorstr ucs2str errorstr () = opcode errorstr void log_hp () = opcode LogHP void trace () = opcode Trace void tron () = opcode Tron void troff () = opcode Troff void log_cc () = opcode LogCC void log ( ucs2char ) = opcode logchar void lognum ( int16 ) = opcode lognum void log ( ucs2str ) = opcode logstr void log ( ucs2str¢ ) = opcode logstr void logmem () = opcode LogMem void OMEM () = opcode oomem void TODO () = opcode todo void abort () = opcode abort void abort ( ucs2str msg ) void IERR () = opcode abort void PANIC () = opcode panic void PANIC ( ucs2str msg ) void setledred () = opcode SetLedRed void setledyel () = opcode SetLedYel void setledgrn () = opcode SetLedGrn void clrledred () = opcode ClrLedRed void clrledyel () = opcode ClrLedYel void clrledgrn () = opcode ClrLedGrn uint16 get_hp () = opcode PshHP void select ( int16 ) = opcode select void set_intmask () = opcode SetIntMask void deselect () = opcode deselect void clear_error () type NodeType = enum uint16 const NodeType t_node = 0 const NodeType t_dir = 1 const NodeType t_file = 2 const NodeType t_block = 3 const NodeType t_ser = 4 const NodeType t_erased = 5 const NodeType t_none = 6 type Node = FD + { FDs items, str[] entries ( Node¢ ), find ( Node¢, ucs2str¢ name ), append ( Node¢, FD ), remove ( Node¢, FD¢ ) } var FDs items ucs2str[] entries ( Node¢ ) FD¢ find ( Node¢, ucs2str¢ name ) void append ( Node¢, FD ) void remove ( Node¢, FD¢ ) type FDs = FD[] void append ( FDs¢, FD ) = opcode AppendChar var Node root var FD stdin var FD stdout var FD stderr void init_devices () type DrvrData = { uint16 selectmask } var uint16 selectmask type t_getctl = uint16(DrvrData¢, uint16) type t_setctl = void(DrvrData¢, uint16, uint16) type t_getc = uint16(DrvrData¢) type t_putc = void(DrvrData¢, uint16) type t_gets = uint16(DrvrData¢, uint16[]¢, uint16, uint16) type t_puts = uint16(DrvrData¢, uint16[]¢, uint16, uint16) type t_readblocks = Err(DrvrData¢, uint32, uint16[]¢, uint16, uint16) type t_writeblocks = Err(DrvrData¢, uint32, uint16[]¢, uint16, uint16) type t_blkio = Err(DrvrData¢, uint32, uint16[]¢, uint16, uint16) type Device = FD + { uint16 flags, DrvrData¢ drvrdata, t_getctl p_getctl, t_setctl p_setctl, 16 getctl ( Device¢, uint16 ioctl_fu ), setctl ( Device¢, uint16 ioctl_fu, uint16 n ) } var uint16 flags var DrvrData¢ drvrdata var t_getctl p_getctl var t_setctl p_setctl uint16 getctl ( Device¢, uint16 ioctl_fu ) void setctl ( Device¢, uint16 ioctl_fu, uint16 n ) type SerialDevice = Device + { t_getc p_getc, t_gets p_gets, t_putc p_putc, t_gets p_puts, 16 getavail ( SerialDevice¢ ), 16 getfree ( SerialDevice¢ ), 16 readbyte ( SerialDevice¢ ), writebyte ( SerialDevice¢, uint16 ), 16 readbytes ( SerialDevice¢, uint16[]¢, uint16 a, uint16 e ), 16 writebytes ( SerialDevice¢, uint16[]¢, uint16 a, uint16 e ), 16 readbytes ( SerialDevice¢, uint16[to] ) = opcode SerialDevice__readbytes__12SerialDeviceC_6uint16AEC_6uint16_6uint16_6uint16, 16 writebytes ( SerialDevice¢, uint16[to] ) = opcode SerialDevice__writebytes__12SerialDeviceC_6uint16AEC_6uint16_6uint16_6uint16, readbytes ( SerialDevice¢, uint16[]¢ ), writebytes ( SerialDevice¢, uint16[]¢ ), writebytes ( SerialDevice¢, int16[]¢ ), readbytes ( SerialDevice¢, int16[]¢ ), readdata ( SerialDevice¢, uint16[]¢ ), writedata ( SerialDevice¢, uint16[]¢ ), writedata ( SerialDevice¢, int16[]¢ ), readdata ( SerialDevice¢, int16[]¢ ), char getchar ( SerialDevice¢ ), putchar ( SerialDevice¢, uint16 ), str getstr ( SerialDevice¢ ), putstr ( SerialDevice¢, ucs2str¢ ) } var t_getc p_getc var t_gets p_gets var t_putc p_putc var t_gets p_puts uint16 getavail ( SerialDevice¢ ) uint16 getfree ( SerialDevice¢ ) uint16 readbyte ( SerialDevice¢ ) void writebyte ( SerialDevice¢, uint16 ) uint16 readbytes ( SerialDevice¢, uint16[]¢, uint16 a, uint16 e ) uint16 writebytes ( SerialDevice¢, uint16[]¢, uint16 a, uint16 e ) uint16 readbytes ( SerialDevice¢, uint16[to] ) = opcode SerialDevice__readbytes__12SerialDeviceC_6uint16AEC_6uint16_6uint16_6uint16 uint16 writebytes ( SerialDevice¢, uint16[to] ) = opcode SerialDevice__writebytes__12SerialDeviceC_6uint16AEC_6uint16_6uint16_6uint16 void readbytes ( SerialDevice¢, uint16[]¢ ) void writebytes ( SerialDevice¢, uint16[]¢ ) void writebytes ( SerialDevice¢, int16[]¢ ) void readbytes ( SerialDevice¢, int16[]¢ ) void readdata ( SerialDevice¢, uint16[]¢ ) void writedata ( SerialDevice¢, uint16[]¢ ) void writedata ( SerialDevice¢, int16[]¢ ) void readdata ( SerialDevice¢, int16[]¢ ) ucs2char getchar ( SerialDevice¢ ) void putchar ( SerialDevice¢, uint16 ) ucs2str getstr ( SerialDevice¢ ) void putstr ( SerialDevice¢, ucs2str¢ ) SerialDevice new ( ucs2str¢ name, uint16 devclass, DrvrData¢, t_getctl, t_setctl, t_getc, t_gets, t_putc, t_gets ) var uint16* int_vector var uint16 int_mask var uint16* gdata_ptr var uint16* gcode_ptr var uint16* hp_base var uint16* sp_base var uint16* mem_data_start var uint16* mem_data_end var uint16* mem_ptr_start var uint16* mem_free_ptr var uint16* mem_end var uint32 current_time var uint32 current_microsec var uint16 microsecs_per_int var uint16 sio_getctl_proc var uint16 sio_setctl_proc var uint16 sio_getc_proc var uint16 sio_gets_proc var uint16 sio_putc_proc var uint16 sio_puts_proc var uint16 sio_irpt_proc var uint16 sio_selectmask var uint16 IMR_value var uint16 OPCR_value var uint16 null var uint16 opcode_Ret const uint16 MR0A = 0 const uint16 MR1A = 0 const uint16 MR2A = 0 const uint16 SRA = 1 const uint16 UNUSED1 = 2 const uint16 RXA = 3 const uint16 IPCR = 4 const uint16 ISR = 5 const uint16 CUR = 6 const uint16 CLR = 7 const uint16 MR0B = 8 const uint16 MR1B = 8 const uint16 MR2B = 8 const uint16 SRB = 9 const uint16 UNUSED2 = 10 const uint16 RXB = 11 const uint16 GPR = 12 const uint16 IPR = 13 const uint16 STCR = 14 const uint16 SPCR = 15 const uint16 CSRA = 1 const uint16 CRA = 2 const uint16 TXA = 3 const uint16 ACR = 4 const uint16 IMR = 5 const uint16 CTPU = 6 const uint16 CTPL = 7 const uint16 CSRB = 9 const uint16 CRB = 10 const uint16 TXB = 11 const uint16 OPCR = 13 const uint16 SOPR = 14 const uint16 ROPR = 15 const uint16 mSR_RX_ready = 1 const uint16 mSR_RX_full = 2 const uint16 mSR_TX_ready = 4 const uint16 mSR_TX_empty = 8 const uint16 mSR_RX_overrun = 16 const uint16 mSR_RX_parity = 32 const uint16 mSR_RX_framing = 64 const uint16 mSR_RX_break = 128 const uint16 mIMR_TXA_ready = 1 const uint16 mIMR_RXA_ready = 2 const uint16 mIMR_RXA_break = 4 const uint16 mIMR_CT_ready = 8 const uint16 mIMR_TXB_ready = 16 const uint16 mIMR_RXB_ready = 32 const uint16 mIMR_RXB_break = 64 const uint16 mIMR_IP_changed = 128 const uint16 mOPR_RTSA = 1 const uint16 mOPR_RTSB = 2 const uint16 mOPR_CLKA = 4 const uint16 mOPR_CLKB = 8 const uint16 mOPR_CTLA = 16 const uint16 mOPR_CTLB = 32 const uint16 mOPR_INVA = 64 const uint16 mOPR_INVB = 128 const uint16 SOPR_value = 255 const uint16 ROPR_value = 0 const uint16 ACR_value = 112 const uint16 MR0_value = 160 const uint16 MR1_value = 83 const uint16 MR2_value = 7 const uint16 obusz = 16 const uint16 ibusz = 16 const uint16 obumask = 15 const uint16 ibumask = 15 const uint16 xon = 17 const uint16 xoff = 19 const uint16 baud_9600 = 4 const uint16 baud_57k6 = 24 const uint16 c_reset = 0 const uint16 c_speed = 1 const uint16 c_hwhsk = 2 const uint16 c_swhsk = 3 const uint16 c_flushin = 4 const uint16 c_availin = 4 const uint16 c_flushout = 5 const uint16 c_availout = 5 const uint16 c_reserved = 6 const uint16 c_pinhdrctl = 7 const uint16 c_clk_hsk = 8 type SioData = { uint16 channel, bool hw_handshake, bool sw_handshake, uint16 baudrate, uint16 clk_handshake, uint16[] ibu, uint16[] obu, uint16 ibuwi, uint16 iburi, uint16 obuwi, uint16 oburi, bool xoff_received, bool xoff_sent, uint16 SR, uint16 IO, uint16 mIMR_RX_ready, uint16 mIMR_TX_ready, 16 avail_in ( SioData¢ channel ), 16 avail_out ( SioData¢ channel ), irpt ( SioData¢ this ), set_baudrate ( SioData¢ this, uint16 baudrate ), set_sw_handshake ( SioData¢ this, bool f ), set_hw_handshake ( SioData¢ this, bool f ), set_clock_handshake ( SioData¢ this, uint16 flags ) } var uint16 channel var bool hw_handshake var bool sw_handshake var uint16 baudrate var uint16 clk_handshake var uint16[] ibu var uint16[] obu var uint16 ibuwi var uint16 iburi var uint16 obuwi var uint16 oburi var bool xoff_received var bool xoff_sent var uint16 SR var uint16 IO var uint16 mIMR_RX_ready var uint16 mIMR_TX_ready uint16 avail_in ( SioData¢ channel ) uint16 avail_out ( SioData¢ channel ) void irpt ( SioData¢ this ) var uint16 c var uint16 SR var uint16 IO void set_baudrate ( SioData¢ this, uint16 baudrate ) var uint16 chx8 var uint16 i var uint16 t var uint16 v var uint16 csr_mask void set_sw_handshake ( SioData¢ this, bool f ) void set_hw_handshake ( SioData¢ this, bool f ) var uint16 chx8 void set_clock_handshake ( SioData¢ this, uint16 flags ) var uint16 ch var uint16 chx2 var SioData sio_channel_A var SioData sio_channel_B