words[]: type FD = { } ; const bool yes = 1 , no = 0 ; const bool true = 1 , false = 0 ; extern { uint8 msbit ( uint16 ) ; uint8 msbit ( uint32 ) ; int sign ( int16 ) ; int sign ( int32 ) ; uint16 abs ( int16 ) ; uint32 abs ( int32 ) ; uint16 swap_bytes ( uint16 ) ; uint32 revert_bytes ( uint32 ) ; uint32 swap_words ( uint32 ) ; uint16 random ( ) ; uint32 mul_wwl ( uint16 , uint16 ) ; void flip ( int8 [ to ] ) = opcode flip ; void rol ( int8 [ to ] ) = opcode rol ; void ror ( int8 [ to ] ) = opcode ror ; void sort ( int8 [ to ] ) = opcode sort ; void rsort ( int8 [ to ] ) = opcode rsort ; void shuffle ( int8 [ to ] ) = opcode shuffle ; void revert ( int8 [ to ] ) = opcode revert ; int8 [ ] join ( int8 [ ] [ ] ¢ , int8 ) = opcode join ; int8 [ ] join ( int8 [ ] [ ] ¢ , int8 [ ] ¢ ) = opcode join ; int8 [ ] [ ] split ( int8 [ ] ¢ , int8 ) = opcode split ; int8 [ ] [ ] split ( int8 [ ] ¢ , int8 [ ] ¢ ) = opcode split ; int8 min ( int8 , int8 ) ; int8 min ( int8 , int8 , int8 ) ; int8 min ( int8 [ to ] ) ; int8 max ( int8 , int8 ) ; int8 max ( int8 , int8 , int8 ) ; int8 max ( int8 [ to ] ) ; uint find ( int8 [ to ] , int8 ) = opcode find ; uint find ( int8 [ to ] , int8 [ ] ¢ ) = opcode find ; uint rfind ( int8 [ to ] , int8 ) = opcode rfind ; uint rfind ( int8 [ to ] , int8 [ ] ¢ ) = opcode rfind ; void shrinktofit ( int8 [ ] & ) ; int8 [ to ] substr ( int8 [ ] ¢ , uint a , uint e ) ; int8 [ to ] midstr ( int8 [ ] ¢ , uint i , uint n ) ; int8 [ to ] leftstr ( int8 [ ] ¢ , uint n ) ; int8 [ to ] rightstr ( int8 [ ] ¢ , uint n ) ; int8 numval ( utf8str ¢ ) ; int8 numval ( ucs1str ¢ ) ; int8 numval ( ucs2str ¢ ) ; void flip ( uint8 [ to ] ) = opcode flip ; void rol ( uint8 [ to ] ) = opcode rol ; void ror ( uint8 [ to ] ) = opcode ror ; void sort ( uint8 [ to ] ) = opcode sort ; void rsort ( uint8 [ to ] ) = opcode rsort ; void shuffle ( uint8 [ to ] ) = opcode shuffle ; void revert ( uint8 [ to ] ) = opcode revert ; uint8 [ ] join ( uint8 [ ] [ ] ¢ , uint8 ) = opcode join ; uint8 [ ] join ( uint8 [ ] [ ] ¢ , uint8 [ ] ¢ ) = opcode join ; uint8 [ ] [ ] split ( uint8 [ ] ¢ , uint8 ) = opcode split ; uint8 [ ] [ ] split ( uint8 [ ] ¢ , uint8 [ ] ¢ ) = opcode split ; uint8 min ( uint8 , uint8 ) ; uint8 min ( uint8 , uint8 , uint8 ) ; uint8 min ( uint8 [ to ] ) ; uint8 max ( uint8 , uint8 ) ; uint8 max ( uint8 , uint8 , uint8 ) ; uint8 max ( uint8 [ to ] ) ; uint find ( uint8 [ to ] , uint8 ) = opcode find ; uint find ( uint8 [ to ] , uint8 [ ] ¢ ) = opcode find ; uint rfind ( uint8 [ to ] , uint8 ) = opcode rfind ; uint rfind ( uint8 [ to ] , uint8 [ ] ¢ ) = opcode rfind ; void shrinktofit ( uint8 [ ] & ) ; uint8 [ to ] substr ( uint8 [ ] ¢ , uint a , uint e ) ; uint8 [ to ] midstr ( uint8 [ ] ¢ , uint i , uint n ) ; uint8 [ to ] leftstr ( uint8 [ ] ¢ , uint n ) ; uint8 [ to ] rightstr ( uint8 [ ] ¢ , uint n ) ; uint8 numval ( utf8str ¢ ) ; uint8 numval ( ucs1str ¢ ) ; uint8 numval ( ucs2str ¢ ) ; void flip ( int16 [ to ] ) = opcode flip ; void rol ( int16 [ to ] ) = opcode rol ; void ror ( int16 [ to ] ) = opcode ror ; void sort ( int16 [ to ] ) = opcode sort ; void rsort ( int16 [ to ] ) = opcode rsort ; void shuffle ( int16 [ to ] ) = opcode shuffle ; void revert ( int16 [ to ] ) = opcode revert ; int16 [ ] join ( int16 [ ] [ ] ¢ , int16 ) = opcode join ; int16 [ ] join ( int16 [ ] [ ] ¢ , int16 [ ] ¢ ) = opcode join ; int16 [ ] [ ] split ( int16 [ ] ¢ , int16 ) = opcode split ; int16 [ ] [ ] split ( int16 [ ] ¢ , int16 [ ] ¢ ) = opcode split ; int16 min ( int16 , int16 ) ; int16 min ( int16 , int16 , int16 ) ; int16 min ( int16 [ to ] ) ; int16 max ( int16 , int16 ) ; int16 max ( int16 , int16 , int16 ) ; int16 max ( int16 [ to ] ) ; uint find ( int16 [ to ] , int16 ) = opcode find ; uint find ( int16 [ to ] , int16 [ ] ¢ ) = opcode find ; uint rfind ( int16 [ to ] , int16 ) = opcode rfind ; uint rfind ( int16 [ to ] , int16 [ ] ¢ ) = opcode rfind ; void shrinktofit ( int16 [ ] & ) ; int16 [ to ] substr ( int16 [ ] ¢ , uint a , uint e ) ; int16 [ to ] midstr ( int16 [ ] ¢ , uint i , uint n ) ; int16 [ to ] leftstr ( int16 [ ] ¢ , uint n ) ; int16 [ to ] rightstr ( int16 [ ] ¢ , uint n ) ; int16 numval ( utf8str ¢ ) ; int16 numval ( ucs1str ¢ ) ; int16 numval ( ucs2str ¢ ) ; void flip ( uint16 [ to ] ) = opcode flip ; void rol ( uint16 [ to ] ) = opcode rol ; void ror ( uint16 [ to ] ) = opcode ror ; void sort ( uint16 [ to ] ) = opcode sort ; void rsort ( uint16 [ to ] ) = opcode rsort ; void shuffle ( uint16 [ to ] ) = opcode shuffle ; void revert ( uint16 [ to ] ) = opcode revert ; uint16 [ ] join ( uint16 [ ] [ ] ¢ , uint16 ) = opcode join ; uint16 [ ] join ( uint16 [ ] [ ] ¢ , uint16 [ ] ¢ ) = opcode join ; uint16 [ ] [ ] split ( uint16 [ ] ¢ , uint16 ) = opcode split ; uint16 [ ] [ ] split ( uint16 [ ] ¢ , uint16 [ ] ¢ ) = opcode split ; uint16 min ( uint16 , uint16 ) ; uint16 min ( uint16 , uint16 , uint16 ) ; uint16 min ( uint16 [ to ] ) ; uint16 max ( uint16 , uint16 ) ; uint16 max ( uint16 , uint16 , uint16 ) ; uint16 max ( uint16 [ to ] ) ; uint find ( uint16 [ to ] , uint16 ) = opcode find ; uint find ( uint16 [ to ] , uint16 [ ] ¢ ) = opcode find ; uint rfind ( uint16 [ to ] , uint16 ) = opcode rfind ; uint rfind ( uint16 [ to ] , uint16 [ ] ¢ ) = opcode rfind ; void shrinktofit ( uint16 [ ] & ) ; uint16 [ to ] substr ( uint16 [ ] ¢ , uint a , uint e ) ; uint16 [ to ] midstr ( uint16 [ ] ¢ , uint i , uint n ) ; uint16 [ to ] leftstr ( uint16 [ ] ¢ , uint n ) ; uint16 [ to ] rightstr ( uint16 [ ] ¢ , uint n ) ; uint16 numval ( utf8str ¢ ) ; uint16 numval ( ucs1str ¢ ) ; uint16 numval ( ucs2str ¢ ) ; void flip ( int32 [ to ] ) = opcode flip ; void rol ( int32 [ to ] ) = opcode rol ; void ror ( int32 [ to ] ) = opcode ror ; void sort ( int32 [ to ] ) = opcode sort ; void rsort ( int32 [ to ] ) = opcode rsort ; void shuffle ( int32 [ to ] ) = opcode shuffle ; void revert ( int32 [ to ] ) = opcode revert ; int32 [ ] join ( int32 [ ] [ ] ¢ , int32 ) = opcode join ; int32 [ ] join ( int32 [ ] [ ] ¢ , int32 [ ] ¢ ) = opcode join ; int32 [ ] [ ] split ( int32 [ ] ¢ , int32 ) = opcode split ; int32 [ ] [ ] split ( int32 [ ] ¢ , int32 [ ] ¢ ) = opcode split ; int32 min ( int32 , int32 ) ; int32 min ( int32 , int32 , int32 ) ; int32 min ( int32 [ to ] ) ; int32 max ( int32 , int32 ) ; int32 max ( int32 , int32 , int32 ) ; int32 max ( int32 [ to ] ) ; uint find ( int32 [ to ] , int32 ) = opcode find ; uint find ( int32 [ to ] , int32 [ ] ¢ ) = opcode find ; uint rfind ( int32 [ to ] , int32 ) = opcode rfind ; uint rfind ( int32 [ to ] , int32 [ ] ¢ ) = opcode rfind ; void shrinktofit ( int32 [ ] & ) ; int32 [ to ] substr ( int32 [ ] ¢ , uint a , uint e ) ; int32 [ to ] midstr ( int32 [ ] ¢ , uint i , uint n ) ; int32 [ to ] leftstr ( int32 [ ] ¢ , uint n ) ; int32 [ to ] rightstr ( int32 [ ] ¢ , uint n ) ; int32 numval ( utf8str ¢ ) ; int32 numval ( ucs1str ¢ ) ; int32 numval ( ucs2str ¢ ) ; void flip ( uint32 [ to ] ) = opcode flip ; void rol ( uint32 [ to ] ) = opcode rol ; void ror ( uint32 [ to ] ) = opcode ror ; void sort ( uint32 [ to ] ) = opcode sort ; void rsort ( uint32 [ to ] ) = opcode rsort ; void shuffle ( uint32 [ to ] ) = opcode shuffle ; void revert ( uint32 [ to ] ) = opcode revert ; uint32 [ ] join ( uint32 [ ] [ ] ¢ , uint32 ) = opcode join ; uint32 [ ] join ( uint32 [ ] [ ] ¢ , uint32 [ ] ¢ ) = opcode join ; uint32 [ ] [ ] split ( uint32 [ ] ¢ , uint32 ) = opcode split ; uint32 [ ] [ ] split ( uint32 [ ] ¢ , uint32 [ ] ¢ ) = opcode split ; uint32 min ( uint32 , uint32 ) ; uint32 min ( uint32 , uint32 , uint32 ) ; uint32 min ( uint32 [ to ] ) ; uint32 max ( uint32 , uint32 ) ; uint32 max ( uint32 , uint32 , uint32 ) ; uint32 max ( uint32 [ to ] ) ; uint find ( uint32 [ to ] , uint32 ) = opcode find ; uint find ( uint32 [ to ] , uint32 [ ] ¢ ) = opcode find ; uint rfind ( uint32 [ to ] , uint32 ) = opcode rfind ; uint rfind ( uint32 [ to ] , uint32 [ ] ¢ ) = opcode rfind ; void shrinktofit ( uint32 [ ] & ) ; uint32 [ to ] substr ( uint32 [ ] ¢ , uint a , uint e ) ; uint32 [ to ] midstr ( uint32 [ ] ¢ , uint i , uint n ) ; uint32 [ to ] leftstr ( uint32 [ ] ¢ , uint n ) ; uint32 [ to ] rightstr ( uint32 [ ] ¢ , uint n ) ; uint32 numval ( utf8str ¢ ) ; uint32 numval ( ucs1str ¢ ) ; uint32 numval ( ucs2str ¢ ) ; void flip ( utf8char [ to ] ) = opcode flip ; void rol ( utf8char [ to ] ) = opcode rol ; void ror ( utf8char [ to ] ) = opcode ror ; void sort ( utf8char [ to ] ) = opcode sort ; void rsort ( utf8char [ to ] ) = opcode rsort ; void shuffle ( utf8char [ to ] ) = opcode shuffle ; void revert ( utf8char [ to ] ) = opcode revert ; utf8char [ ] join ( utf8char [ ] [ ] ¢ , utf8char ) = opcode join ; utf8char [ ] join ( utf8char [ ] [ ] ¢ , utf8char [ ] ¢ ) = opcode join ; utf8char [ ] [ ] split ( utf8char [ ] ¢ , utf8char ) = opcode split ; utf8char [ ] [ ] split ( utf8char [ ] ¢ , utf8char [ ] ¢ ) = opcode split ; utf8char min ( utf8char , utf8char ) ; utf8char min ( utf8char , utf8char , utf8char ) ; utf8char min ( utf8char [ to ] ) ; utf8char max ( utf8char , utf8char ) ; utf8char max ( utf8char , utf8char , utf8char ) ; utf8char max ( utf8char [ to ] ) ; uint find ( utf8char [ to ] , utf8char ) = opcode find ; uint find ( utf8char [ to ] , utf8char [ ] ¢ ) = opcode find ; uint rfind ( utf8char [ to ] , utf8char ) = opcode rfind ; uint rfind ( utf8char [ to ] , utf8char [ ] ¢ ) = opcode rfind ; void shrinktofit ( utf8char [ ] & ) ; utf8char [ to ] substr ( utf8char [ ] ¢ , uint a , uint e ) ; utf8char [ to ] midstr ( utf8char [ ] ¢ , uint i , uint n ) ; utf8char [ to ] leftstr ( utf8char [ ] ¢ , uint n ) ; utf8char [ to ] rightstr ( utf8char [ ] ¢ , uint n ) ; utf8char numval ( utf8str ¢ ) ; utf8char numval ( ucs1str ¢ ) ; utf8char numval ( ucs2str ¢ ) ; void flip ( ucs1char [ to ] ) = opcode flip ; void rol ( ucs1char [ to ] ) = opcode rol ; void ror ( ucs1char [ to ] ) = opcode ror ; void sort ( ucs1char [ to ] ) = opcode sort ; void rsort ( ucs1char [ to ] ) = opcode rsort ; void shuffle ( ucs1char [ to ] ) = opcode shuffle ; void revert ( ucs1char [ to ] ) = opcode revert ; ucs1char [ ] join ( ucs1char [ ] [ ] ¢ , ucs1char ) = opcode join ; ucs1char [ ] join ( ucs1char [ ] [ ] ¢ , ucs1char [ ] ¢ ) = opcode join ; ucs1char [ ] [ ] split ( ucs1char [ ] ¢ , ucs1char ) = opcode split ; ucs1char [ ] [ ] split ( ucs1char [ ] ¢ , ucs1char [ ] ¢ ) = opcode split ; ucs1char min ( ucs1char , ucs1char ) ; ucs1char min ( ucs1char , ucs1char , ucs1char ) ; ucs1char min ( ucs1char [ to ] ) ; ucs1char max ( ucs1char , ucs1char ) ; ucs1char max ( ucs1char , ucs1char , ucs1char ) ; ucs1char max ( ucs1char [ to ] ) ; uint find ( ucs1char [ to ] , ucs1char ) = opcode find ; uint find ( ucs1char [ to ] , ucs1char [ ] ¢ ) = opcode find ; uint rfind ( ucs1char [ to ] , ucs1char ) = opcode rfind ; uint rfind ( ucs1char [ to ] , ucs1char [ ] ¢ ) = opcode rfind ; void shrinktofit ( ucs1char [ ] & ) ; ucs1char [ to ] substr ( ucs1char [ ] ¢ , uint a , uint e ) ; ucs1char [ to ] midstr ( ucs1char [ ] ¢ , uint i , uint n ) ; ucs1char [ to ] leftstr ( ucs1char [ ] ¢ , uint n ) ; ucs1char [ to ] rightstr ( ucs1char [ ] ¢ , uint n ) ; ucs1char numval ( utf8str ¢ ) ; ucs1char numval ( ucs1str ¢ ) ; ucs1char numval ( ucs2str ¢ ) ; void flip ( ucs2char [ to ] ) = opcode flip ; void rol ( ucs2char [ to ] ) = opcode rol ; void ror ( ucs2char [ to ] ) = opcode ror ; void sort ( ucs2char [ to ] ) = opcode sort ; void rsort ( ucs2char [ to ] ) = opcode rsort ; void shuffle ( ucs2char [ to ] ) = opcode shuffle ; void revert ( ucs2char [ to ] ) = opcode revert ; ucs2char [ ] join ( ucs2char [ ] [ ] ¢ , ucs2char ) = opcode join ; ucs2char [ ] join ( ucs2char [ ] [ ] ¢ , ucs2char [ ] ¢ ) = opcode join ; ucs2char [ ] [ ] split ( ucs2char [ ] ¢ , ucs2char ) = opcode split ; ucs2char [ ] [ ] split ( ucs2char [ ] ¢ , ucs2char [ ] ¢ ) = opcode split ; ucs2char min ( ucs2char , ucs2char ) ; ucs2char min ( ucs2char , ucs2char , ucs2char ) ; ucs2char min ( ucs2char [ to ] ) ; ucs2char max ( ucs2char , ucs2char ) ; ucs2char max ( ucs2char , ucs2char , ucs2char ) ; ucs2char max ( ucs2char [ to ] ) ; uint find ( ucs2char [ to ] , ucs2char ) = opcode find ; uint find ( ucs2char [ to ] , ucs2char [ ] ¢ ) = opcode find ; uint rfind ( ucs2char [ to ] , ucs2char ) = opcode rfind ; uint rfind ( ucs2char [ to ] , ucs2char [ ] ¢ ) = opcode rfind ; void shrinktofit ( ucs2char [ ] & ) ; ucs2char [ to ] substr ( ucs2char [ ] ¢ , uint a , uint e ) ; ucs2char [ to ] midstr ( ucs2char [ ] ¢ , uint i , uint n ) ; ucs2char [ to ] leftstr ( ucs2char [ ] ¢ , uint n ) ; ucs2char [ to ] rightstr ( ucs2char [ ] ¢ , uint n ) ; ucs2char numval ( utf8str ¢ ) ; ucs2char numval ( ucs1str ¢ ) ; ucs2char numval ( ucs2str ¢ ) ; bool is_letter ( char ) ; bool is_bin_digit ( char ) ; bool is_dec_digit ( char ) ; bool is_hex_digit ( char ) ; uint digit_value ( char ) ; } ; float64 round ( float64 ) ; float64 floor ( float64 ) ; float64 ceil ( float64 ) ; float64 integ ( float64 ) ; float64 fract ( float64 ) ; int sign ( float64 ) ; float64 abs ( float64 ) ; float64 min ( float64 , float64 ) ; float64 max ( float64 , float64 ) ; float64 min ( float64 , float64 , float64 ) ; float64 max ( float64 , float64 , float64 ) ; float64 random ( ) ; float64 random ( float64 ) ; float64 sin ( float64 ) ; float64 cos ( float64 ) ; float64 tan ( float64 ) ; float64 asin ( float64 ) ; float64 acos ( float64 ) ; float64 atan ( float64 ) ; float64 sinh ( float64 ) ; float64 cosh ( float64 ) ; float64 tanh ( float64 ) ; float64 exp10 ( float64 ) ; float64 log10 ( float64 ) ; float64 exp2 ( float64 ) ; float64 log2 ( float64 ) ; float64 expe ( float64 ) ; float64 loge ( float64 ) ; float64 exp ( float64 , float64 ) ; float64 log ( float64 , float64 ) ; float64 pow ( float64 , int ) ; float64 sqrt ( float64 ) ; str numstr ( float64 ) ; float64 numval ( str ¢ ) ; float64 min ( float64 [ ] ¢ ) ; float64 min ( float64 [ to ] ) ; float64 max ( float64 [ ] ¢ ) ; float64 max ( float64 [ to ] ) ; scope ucs2str { ucs2char [ ] spacestr ( uint ) ucs2char [ ] spacestr ( uint , ucs2char ) ucs2char [ ] charstr ( uint ) ucs2char hexchar ( uint ) ucs2char [ ] hexstr ( uint8 ) ucs2char [ ] hexstr ( uint16 ) ucs2char [ ] hexstr ( uint32 ) ucs2char [ ] hexstr ( uint , uint digits ) ucs2char [ ] hexstr ( ulong , uint digits ) ucs2char [ ] binstr ( uint8 ) ucs2char [ ] binstr ( uint16 ) ucs2char [ ] binstr ( uint32 ) ucs2char [ ] binstr ( uint , uint digits ) ucs2char [ ] binstr ( ulong , uint digits ) ucs2char [ ] binstr ( uint , ucs2char [ ] ¢ o , ucs2char [ ] ¢ l ) ucs2char [ ] binstr ( ulong , ucs2char [ ] ¢ o , ucs2char [ ] ¢ l ) ucs2char [ ] numstr ( int ) ucs2char [ ] numstr ( uint ) ucs2char [ ] numstr ( long ) ucs2char [ ] numstr ( ulong ) ucs2char [ ] toupper ( ucs2char [ ] ¢ ) ucs2char [ ] tolower ( ucs2char [ ] ¢ ) ucs2char [ ] escape ( ucs2char [ ] ¢ , ucs2char leftquote ) ucs2char [ ] unescape ( ucs2char [ ] ¢ ) ucs2char [ ] urlencode ( ucs2char [ ] ¢ ) ucs2char [ ] urldecode ( ucs2char [ ] ¢ ) ucs2char [ ] entab ( ucs2char [ ] ¢ , uint tabwidth ) ucs2char [ ] detab ( ucs2char [ ] ¢ , uint tabwidth ) ucs2char [ ] toupper ( ucs2char [ to ] ) ucs2char [ ] tolower ( ucs2char [ to ] ) ucs2char [ ] escape ( ucs2char [ to ] , ucs2char leftquote ) ucs2char [ ] unescape ( ucs2char [ to ] ) ucs2char [ ] urlencode ( ucs2char [ to ] ) ucs2char [ ] urldecode ( ucs2char [ to ] ) ucs2char [ ] entab ( ucs2char [ to ] , uint tabwidth ) ucs2char [ ] detab ( ucs2char [ to ] , uint tabwidth ) ucs1str toucs1 ( ucs2char [ ] ¢ ) ucs2str toucs2 ( ucs2char [ ] ¢ ) utf8str toutf8 ( ucs2char [ ] ¢ ) ucs1str toucs1 ( ucs2char [ to ] ) ucs2str toucs2 ( ucs2char [ to ] ) utf8str toutf8 ( ucs2char [ to ] ) ucs2char [ ] min ( ucs2char [ ] , ucs2char [ ] ) ucs2char [ ] min ( ucs2char [ ] , ucs2char [ ] ¢ ) ucs2char [ ] min ( ucs2char [ ] ¢ , ucs2char [ ] ) ucs2char [ ] ¢ min ( ucs2char [ ] ¢ , ucs2char [ ] ¢ ) ucs2char [ ] ¢ min ( ucs2char [ ] [ ] ¢ ) ucs2char [ ] ¢ min ( ucs2char [ ] [ to ] ) ucs2char [ ] max ( ucs2char [ ] , ucs2char [ ] ) ucs2char [ ] max ( ucs2char [ ] , ucs2char [ ] ¢ ) ucs2char [ ] max ( ucs2char [ ] ¢ , ucs2char [ ] ) ucs2char [ ] ¢ max ( ucs2char [ ] ¢ , ucs2char [ ] ¢ ) ucs2char [ ] ¢ max ( ucs2char [ ] [ ] ¢ ) ucs2char [ ] ¢ max ( ucs2char [ ] [ to ] ) void flip ( ucs2char [ ] [ to ] ) void rol ( ucs2char [ ] [ to ] ) void ror ( ucs2char [ ] [ to ] ) void sort ( ucs2char [ ] [ to ] ) void rsort ( ucs2char [ ] [ to ] ) void shuffle ( ucs2char [ ] [ to ] ) void revert ( ucs2char [ ] [ to ] ) } scope ucs1str { ucs1char [ ] spacestr ( uint ) ucs1char [ ] spacestr ( uint , ucs1char ) ucs1char [ ] charstr ( uint ) ucs1char hexchar ( uint ) ucs1char [ ] hexstr ( uint8 ) ucs1char [ ] hexstr ( uint16 ) ucs1char [ ] hexstr ( uint32 ) ucs1char [ ] hexstr ( uint , uint digits ) ucs1char [ ] hexstr ( ulong , uint digits ) ucs1char [ ] binstr ( uint8 ) ucs1char [ ] binstr ( uint16 ) ucs1char [ ] binstr ( uint32 ) ucs1char [ ] binstr ( uint , uint digits ) ucs1char [ ] binstr ( ulong , uint digits ) ucs1char [ ] binstr ( uint , ucs1char [ ] ¢ o , ucs1char [ ] ¢ l ) ucs1char [ ] binstr ( ulong , ucs1char [ ] ¢ o , ucs1char [ ] ¢ l ) ucs1char [ ] numstr ( int ) ucs1char [ ] numstr ( uint ) ucs1char [ ] numstr ( long ) ucs1char [ ] numstr ( ulong ) ucs1char [ ] toupper ( ucs1char [ ] ¢ ) ucs1char [ ] tolower ( ucs1char [ ] ¢ ) ucs1char [ ] escape ( ucs1char [ ] ¢ , ucs1char leftquote ) ucs1char [ ] unescape ( ucs1char [ ] ¢ ) ucs1char [ ] urlencode ( ucs1char [ ] ¢ ) ucs1char [ ] urldecode ( ucs1char [ ] ¢ ) ucs1char [ ] entab ( ucs1char [ ] ¢ , uint tabwidth ) ucs1char [ ] detab ( ucs1char [ ] ¢ , uint tabwidth ) ucs1char [ ] toupper ( ucs1char [ to ] ) ucs1char [ ] tolower ( ucs1char [ to ] ) ucs1char [ ] escape ( ucs1char [ to ] , ucs1char leftquote ) ucs1char [ ] unescape ( ucs1char [ to ] ) ucs1char [ ] urlencode ( ucs1char [ to ] ) ucs1char [ ] urldecode ( ucs1char [ to ] ) ucs1char [ ] entab ( ucs1char [ to ] , uint tabwidth ) ucs1char [ ] detab ( ucs1char [ to ] , uint tabwidth ) ucs1str toucs1 ( ucs1char [ ] ¢ ) ucs2str toucs2 ( ucs1char [ ] ¢ ) utf8str toutf8 ( ucs1char [ ] ¢ ) ucs1str toucs1 ( ucs1char [ to ] ) ucs2str toucs2 ( ucs1char [ to ] ) utf8str toutf8 ( ucs1char [ to ] ) ucs1char [ ] min ( ucs1char [ ] , ucs1char [ ] ) ucs1char [ ] min ( ucs1char [ ] , ucs1char [ ] ¢ ) ucs1char [ ] min ( ucs1char [ ] ¢ , ucs1char [ ] ) ucs1char [ ] ¢ min ( ucs1char [ ] ¢ , ucs1char [ ] ¢ ) ucs1char [ ] ¢ min ( ucs1char [ ] [ ] ¢ ) ucs1char [ ] ¢ min ( ucs1char [ ] [ to ] ) ucs1char [ ] max ( ucs1char [ ] , ucs1char [ ] ) ucs1char [ ] max ( ucs1char [ ] , ucs1char [ ] ¢ ) ucs1char [ ] max ( ucs1char [ ] ¢ , ucs1char [ ] ) ucs1char [ ] ¢ max ( ucs1char [ ] ¢ , ucs1char [ ] ¢ ) ucs1char [ ] ¢ max ( ucs1char [ ] [ ] ¢ ) ucs1char [ ] ¢ max ( ucs1char [ ] [ to ] ) void flip ( ucs1char [ ] [ to ] ) void rol ( ucs1char [ ] [ to ] ) void ror ( ucs1char [ ] [ to ] ) void sort ( ucs1char [ ] [ to ] ) void rsort ( ucs1char [ ] [ to ] ) void shuffle ( ucs1char [ ] [ to ] ) void revert ( ucs1char [ ] [ to ] ) } scope utf8str { utf8char [ ] spacestr ( uint ) utf8char [ ] spacestr ( uint , utf8char ) utf8char [ ] charstr ( uint ) char hexchar ( uint ) utf8char [ ] hexstr ( uint8 ) utf8char [ ] hexstr ( uint16 ) utf8char [ ] hexstr ( uint32 ) utf8char [ ] hexstr ( uint , uint digits ) utf8char [ ] hexstr ( ulong , uint digits ) utf8char [ ] binstr ( uint8 ) utf8char [ ] binstr ( uint16 ) utf8char [ ] binstr ( uint32 ) utf8char [ ] binstr ( uint , uint digits ) utf8char [ ] binstr ( ulong , uint digits ) utf8char [ ] binstr ( uint , utf8char [ ] ¢ o , utf8char [ ] ¢ l ) utf8char [ ] binstr ( ulong , utf8char [ ] ¢ o , utf8char [ ] ¢ l ) utf8char [ ] numstr ( int ) utf8char [ ] numstr ( uint ) utf8char [ ] numstr ( long ) utf8char [ ] numstr ( ulong ) utf8char [ ] toupper ( utf8char [ ] ¢ ) utf8char [ ] tolower ( utf8char [ ] ¢ ) utf8char [ ] escape ( utf8char [ ] ¢ , char leftquote ) utf8char [ ] unescape ( utf8char [ ] ¢ ) utf8char [ ] urlencode ( utf8char [ ] ¢ ) utf8char [ ] urldecode ( utf8char [ ] ¢ ) utf8char [ ] entab ( utf8char [ ] ¢ , uint tabwidth ) utf8char [ ] detab ( utf8char [ ] ¢ , uint tabwidth ) utf8char [ ] toupper ( utf8char [ to ] ) utf8char [ ] tolower ( utf8char [ to ] ) utf8char [ ] escape ( utf8char [ to ] , char leftquote ) utf8char [ ] unescape ( utf8char [ to ] ) utf8char [ ] urlencode ( utf8char [ to ] ) utf8char [ ] urldecode ( utf8char [ to ] ) utf8char [ ] entab ( utf8char [ to ] , uint tabwidth ) utf8char [ ] detab ( utf8char [ to ] , uint tabwidth ) ucs1str toucs1 ( utf8char [ ] ¢ ) ucs2str toucs2 ( utf8char [ ] ¢ ) utf8str toutf8 ( utf8char [ ] ¢ ) ucs1str toucs1 ( utf8char [ to ] ) ucs2str toucs2 ( utf8char [ to ] ) utf8str toutf8 ( utf8char [ to ] ) utf8char [ ] min ( utf8char [ ] , utf8char [ ] ) utf8char [ ] min ( utf8char [ ] , utf8char [ ] ¢ ) utf8char [ ] min ( utf8char [ ] ¢ , utf8char [ ] ) utf8char [ ] ¢ min ( utf8char [ ] ¢ , utf8char [ ] ¢ ) utf8char [ ] ¢ min ( utf8char [ ] [ ] ¢ ) utf8char [ ] ¢ min ( utf8char [ ] [ to ] ) utf8char [ ] max ( utf8char [ ] , utf8char [ ] ) utf8char [ ] max ( utf8char [ ] , utf8char [ ] ¢ ) utf8char [ ] max ( utf8char [ ] ¢ , utf8char [ ] ) utf8char [ ] ¢ max ( utf8char [ ] ¢ , utf8char [ ] ¢ ) utf8char [ ] ¢ max ( utf8char [ ] [ ] ¢ ) utf8char [ ] ¢ max ( utf8char [ ] [ to ] ) void flip ( utf8char [ ] [ to ] ) void rol ( utf8char [ ] [ to ] ) void ror ( utf8char [ ] [ to ] ) void sort ( utf8char [ ] [ to ] ) void rsort ( utf8char [ ] [ to ] ) void shuffle ( utf8char [ ] [ to ] ) void revert ( utf8char [ ] [ to ] ) } ucs1char [ ] spacestr ( uint ) ucs1char [ ] spacestr ( uint , ucs1char ) ucs1char [ ] charstr ( uint ) ucs1char hexchar ( uint ) ucs1char [ ] hexstr ( uint8 ) ucs1char [ ] hexstr ( uint16 ) ucs1char [ ] hexstr ( uint32 ) ucs1char [ ] hexstr ( uint , uint digits ) ucs1char [ ] hexstr ( ulong , uint digits ) ucs1char [ ] binstr ( uint8 ) ucs1char [ ] binstr ( uint16 ) ucs1char [ ] binstr ( uint32 ) ucs1char [ ] binstr ( uint , uint digits ) ucs1char [ ] binstr ( ulong , uint digits ) ucs1char [ ] binstr ( uint , ucs1char [ ] ¢ o , ucs1char [ ] ¢ l ) ucs1char [ ] binstr ( ulong , ucs1char [ ] ¢ o , ucs1char [ ] ¢ l ) ucs1char [ ] numstr ( int ) ucs1char [ ] numstr ( uint ) ucs1char [ ] numstr ( long ) ucs1char [ ] numstr ( ulong ) ucs1char [ ] toupper ( ucs1char [ ] ¢ ) ucs1char [ ] tolower ( ucs1char [ ] ¢ ) ucs1char [ ] escape ( ucs1char [ ] ¢ , ucs1char leftquote ) ucs1char [ ] unescape ( ucs1char [ ] ¢ ) ucs1char [ ] urlencode ( ucs1char [ ] ¢ ) ucs1char [ ] urldecode ( ucs1char [ ] ¢ ) ucs1char [ ] entab ( ucs1char [ ] ¢ , uint tabwidth ) ucs1char [ ] detab ( ucs1char [ ] ¢ , uint tabwidth ) ucs1char [ ] toupper ( ucs1char [ to ] ) ucs1char [ ] tolower ( ucs1char [ to ] ) ucs1char [ ] escape ( ucs1char [ to ] , ucs1char leftquote ) ucs1char [ ] unescape ( ucs1char [ to ] ) ucs1char [ ] urlencode ( ucs1char [ to ] ) ucs1char [ ] urldecode ( ucs1char [ to ] ) ucs1char [ ] entab ( ucs1char [ to ] , uint tabwidth ) ucs1char [ ] detab ( ucs1char [ to ] , uint tabwidth ) ucs1str toucs1 ( ucs1char [ ] ¢ ) ucs2str toucs2 ( ucs1char [ ] ¢ ) utf8str toutf8 ( ucs1char [ ] ¢ ) ucs1str toucs1 ( ucs1char [ to ] ) ucs2str toucs2 ( ucs1char [ to ] ) utf8str toutf8 ( ucs1char [ to ] ) ucs1char [ ] min ( ucs1char [ ] , ucs1char [ ] ) ucs1char [ ] min ( ucs1char [ ] , ucs1char [ ] ¢ ) ucs1char [ ] min ( ucs1char [ ] ¢ , ucs1char [ ] ) ucs1char [ ] ¢ min ( ucs1char [ ] ¢ , ucs1char [ ] ¢ ) ucs1char [ ] ¢ min ( ucs1char [ ] [ ] ¢ ) ucs1char [ ] ¢ min ( ucs1char [ ] [ to ] ) ucs1char [ ] max ( ucs1char [ ] , ucs1char [ ] ) ucs1char [ ] max ( ucs1char [ ] , ucs1char [ ] ¢ ) ucs1char [ ] max ( ucs1char [ ] ¢ , ucs1char [ ] ) ucs1char [ ] ¢ max ( ucs1char [ ] ¢ , ucs1char [ ] ¢ ) ucs1char [ ] ¢ max ( ucs1char [ ] [ ] ¢ ) ucs1char [ ] ¢ max ( ucs1char [ ] [ to ] ) void flip ( ucs1char [ ] [ to ] ) void rol ( ucs1char [ ] [ to ] ) void ror ( ucs1char [ ] [ to ] ) void sort ( ucs1char [ ] [ to ] ) void rsort ( ucs1char [ ] [ to ] ) void shuffle ( ucs1char [ ] [ to ] ) void revert ( ucs1char [ ] [ to ] ) enum { tm_utc = 0 , tm_localtime = 1 , tm_time = 2 , tm_date = 4 , tm_timezone = 8 , tm_sec = 16 , tm_msec = 32 } extern { float now ( ) ; str timestr ( float seconds , uint flags ) ; float timeval ( str ¢ , uint flags ) ; } enum uint8 { c_reset = 0 , c_speed = 1 , c_hwhsk = 2 , c_swhsk = 3 , c_flushin = 4 , c_availin = 4 , c_flushout = 5 , c_availout = 5 , c_clk_hsk = 6 , c_log2blocksize = 7 , c_totalblocks_lo = 8 , c_totalblocks_hi = 9 , c_reserved2 = 10 } ; enum uint8 OSErr = { ok = 0 , parameter_error = 1 , function_not_supported = 1 , io_error = 2 , device_not_responding = 3 , file_error , filesystem_invalid , device_not_found , directory_not_found , file_not_found , not_a_directory , is_a_directory , file_already_open_for_writing , file_already_open , file_exists , file_not_writable , end_of_file , disk_full , directory_corrupted , filesystem_corrupted } ; extern { OSErr errno ; OSErr error ( ) ; void clear_error ( ) ; void set_error ( OSErr ) ; bool yes_with_error ( OSErr ) ; void * null_with_error ( OSErr ) ; } enum uint8 NodeType = { t_endmarker = 0 , t_file = 1 , t_dir = 2 , t_ser = 3 , t_block = 4 , m_erased = 128 } ; scope NodeType { NodeType operator | ( NodeType , NodeType ) = opcode operator | ; NodeType operator & ( NodeType , NodeType ) = opcode operator & ; } type FD_Handlers = { uint ( FD ¢ , uint8 fu ) getctl ; void ( FD ¢ , uint8 fu , uint ) setctl ; uint ( FD ¢ ) avail_in ; uint ( FD ¢ ) avail_out ; char ( FD ¢ ) getc ; void ( FD ¢ , char ) putc ; bool ( FD ¢ , uint8 [ to ] ) read ; bool ( FD ¢ , uint8 [ to ] ) write ; bool ( FD ¢ , uint32 , uint8 [ ] ¢ ) read_block ; bool ( FD ¢ , uint32 , uint8 [ ] ¢ ) write_block ; void ( FD ¢ ) kill ; ulong ( FD ¢ ) getfpos ; bool ( FD ¢ , ulong fpos ) setfpos ; } extern { uint no_avail_in ( FD ¢ ) uint no_avail_out ( FD ¢ ) = no_avail_in ; char no_getc ( FD ¢ ) = no_avail_in ; void no_putc ( FD ¢ , char ) ulong no_getfpos ( FD ¢ ) bool no_setfpos ( FD ¢ , ulong ) bool no_read ( FD ¢ , uint8 [ to ] ) bool no_write ( FD ¢ , uint8 [ to ] ) = no_read ; bool no_read_block ( FD ¢ , uint32 , uint8 [ ] ¢ ) bool no_write_block ( FD ¢ , uint32 , uint8 [ ] ¢ ) = no_read_block ; } type FD = { FD_Handlers ¢ handlers ; NodeType nodetype ; str name ; } extern { uint avail_in ( ) ; uint avail_out ( ) ; const uint delimiters = 1 << 0 + 1 << 4 + 1 << 10 + 1 << 12 + 1 << 13 ; char getc ( ) ; void putc ( char c ) ; str gets ( uint delimiters ) ; void puts ( str ¢ ) ; void puts ( str ) ; void putnum ( uint ) ; void putnum ( int ) ; bool read ( uint8 [ to ] ) ; bool write ( uint8 [ to ] ) ; } scope FD { extern { void init ( FD ¢ , NodeType , str ¢ name , FD_Handlers ¢ ) ; void kill ( FD ¢ ) ; FD kill ( FD ) ; uint getctl ( FD ¢ , uint8 fu ) void setctl ( FD ¢ , uint8 fu , uint n ) uint avail_in ( FD ¢ ) ; uint avail_out ( FD ¢ ) ; char getc ( FD ¢ ) ; void putc ( FD ¢ , char c ) ; str gets ( FD ¢ , uint delimiters ) ; void puts ( FD ¢ , str ¢ ) ; void puts ( FD ¢ , str ) ; void putnum ( FD ¢ , uint ) ; void putnum ( FD ¢ , int ) ; bool read ( FD ¢ , uint8 [ to ] ) bool write ( FD ¢ , uint8 [ to ] ) bool read_block ( FD ¢ , uint32 blk , uint8 [ ] ¢ ) ; bool write_block ( FD ¢ , uint32 blk , uint8 [ ] ¢ ) ; ulong getfpos ( FD ¢ ) bool setfpos ( FD ¢ , ulong fpos ) bool is_dir ( FD ¢ ) ; bool is_file ( FD ¢ ) ; } } extern const { bool option_a5 = true ; uint8 bSIO_SELECT = 1 ; uint8 bIDE_SELECT = 2 ; uint8 mSIO_SELECT = 255 - 1 << bSIO_SELECT ; uint8 mIDE_SELECT = 255 - 2 << bSIO_SELECT ; } ; type FD = { } ; type BlockDevice = { } ; type IdeBlockDevice = { } ; type I2cBlockDevice = { } ; type SerialDevice = { } ; type Range = { } ; type File = { } ; type FD_Handlers = { } ; extern { uint8 k1_irpt_mask ; uint8 sysflags ; uint32 systemtime ; uint16 period ; uint32 timestamp ; uint16 tsmsec ; char * romdate ; char * romtime ; FD [ ] devs ; File [ ] fds ; FD stdin ; FD stdout ; SerialDevice sio1A ; SerialDevice sio1B ; IdeBlockDevice ide2A ; IdeBlockDevice ide2B ; I2cBlockDevice sio1rom ; I2cBlockDevice ide2rom ; OSErr errno ; void di ( ) void ei ( ) ; void ei_all ( ) ; void select ( uint8 ) uint8 in ( uint8 ) void out ( uint8 , uint8 ) void wait ( ) void memcpy ( void * z , void * q , uint cnt ) void memset ( void * z , uint c , uint cnt ) void memclr ( void * z , uint cnt ) void set_red_led ( ) ; void set_yellow_led ( ) ; void set_both_leds ( ) ; void clear_both_leds ( ) ; OSErr lock_eeprom ( ) ; OSErr unlock_eeprom ( ) ; void write_eeprom ( void * q , void * z , uint16 cnt ) ; void download_firmware ( ) ; void abort ( ) = opcode abort ; void panic ( uint8 blinkcode ) ; void assert1 ( bool ) ; void assert0 ( bool ) ; uint mem_get_free ( ) ; uint mem_get_free_total ( ) ; void download_firmware ( ) ; uint8 fd_function_not_supported ( ) ; void sio_init_channel ( SerialDevice ¢ , str ¢ name , uint8 devselbit , uint8 ch ) ; void ide_init_blockdevice ( BlockDevice ¢ ) ; void i2c_init_blockdevice ( BlockDevice ¢ ) ; } ; type File = { } ; type BlockDevice = FD + { uint blocksize ; uint blockmask ; uint8 log2blocksize ; uint32 totalblocks ; bool wide ; File [ ] open_files ; } ; scope BlockDevice { extern void init ( BlockDevice ¢ , NodeType , str ¢ name , FD_Handlers ¢ , uint8 log2blksz , uint32 totalblocks ) ; extern void kill ( BlockDevice ¢ ) = void FD . kill ( FD ¢ ) ; extern uint getctl ( BlockDevice ¢ fd , uint8 fu ) ; extern void setctl ( BlockDevice ¢ fd , uint8 fu , uint n ) ; } ; type I2cBlockDevice = BlockDevice + { uint8 select_mask ; } ; extern I2cBlockDevice new ( uint8 select_mask , str ¢ name ) ; scope I2cBlockDevice { extern { I2cBlockDevice kill ( I2cBlockDevice ) = FD FD . kill ( FD ) ; uint8 readbyte ( bool lastbyteflag ) ; bool writebyte ( uint8 byte ) ; bool waitendwriting ( ) ; bool start_writing ( uint16 addr ) ; bool start_reading ( uint16 addr ) ; void send_end ( ) ; uint getctl ( I2cBlockDevice ¢ , uint8 fu ) = BlockDevice . getctl ; void setctl ( I2cBlockDevice ¢ , uint8 fu , uint n ) = BlockDevice . setctl ; bool read_block ( I2cBlockDevice ¢ , uint32 blk , uint8 [ ] ¢ ) ; bool write_block ( I2cBlockDevice ¢ , uint32 blk , uint8 [ ] ¢ ) ; } } ; const log2pagesize = 6 ; const pagesize = 64 ; FD_Handlers new_i2c_handlers ( ) = asm { # assert FD_Handlers . getctl == 0 # assert FD_Handlers . setctl == 2 # assert FD_Handlers . avail_in == 4 # assert FD_Handlers . avail_out == 6 # assert FD_Handlers . getc == 8 # assert FD_Handlers . putc == 10 # assert FD_Handlers . read == 12 # assert FD_Handlers . write == 14 # assert FD_Handlers . read_block == 16 # assert FD_Handlers . write_block == 18 # assert FD_Handlers . kill == 20 # assert FD_Handlers . getfpos == 22 # assert FD_Handlers . setfpos == 24 p_enter dw ISTR dw 26 dw BlockDevice . getctl__11BlockDeviceC_5uint8_6uint16 dw BlockDevice . setctl__11BlockDeviceC_5uint8_6uint16_ dw no_avail_in__2FDC_6uint16 dw no_avail_in__2FDC_6uint16 ; avail_out dw no_avail_in__2FDC_6uint16 ; no_getc__2FDC_8ucs1char dw no_putc__2FDC_8ucs1char_ dw no_read__2FDC_5uint8ATOE_4bool dw no_read__2FDC_5uint8ATOE_4bool ; write dw I2cBlockDevice . read_block__14I2cBlockDeviceC_6uint32_5uint8AEC_4bool dw I2cBlockDevice . write_block__14I2cBlockDeviceC_6uint32_5uint8AEC_4bool dw FD . kill__2FDC_ dw no_getfpos__2FDC_6uint32 dw no_setfpos__2FDC_6uint32_4bool dw RETURN } FD_Handlers i2c_handlers = new_i2c_handlers ( ) ; I2cBlockDevice new ( uint8 select_mask , str ¢ name ) { select ( select_mask ) ; if ( I2cBlockDevice . start_reading ( 0 ) ) { ei ( ) ; return null ; } I2cBlockDevice . send_end ( ) ; ei ( ) ; I2cBlockDevice this = alloc I2cBlockDevice ( ) ; BlockDevice . init ( this , t_block , name , i2c_handlers , 6 , 32768 >> 6 ) ; this . select_mask = select_mask ; return this ; } scope I2cBlockDevice { bool read_block ( I2cBlockDevice ¢ fd , uint32 blk , uint8 [ ] ¢ bu ) { uint fpos = blk . lo << fd . log2blocksize ; uint a = 0 ; uint e = bu . count ( ) - 1 ; select ( fd . select_mask ) ; if ( start_reading ( fpos ) ) { ei ( ) ; return yes_with_error ( device_not_responding ) ; } else { do { bu [ a ++ ] = readbyte ( a == e ) ; while a <= e ; } ei ( ) ; return no ; } } bool write_block ( I2cBlockDevice ¢ fd , uint32 blk , uint8 [ ] ¢ bu ) { uint fpos = blk . lo << fd . log2blocksize ; uint a = 0 ; uint e = bu . count ( ) ; do { while a < e ; select ( fd . select_mask ) ; if ( start_writing ( fpos ) ) { ei ( ) ; return yes_with_error ( device_not_responding ) ; } uint8 n = min ( fd . blocksize , e - a ) ; fpos += n ; do { if ( writebyte ( bu [ a ++ ] ) ) { ei ( ) ; return yes_with_error ( io_error ) ; } while -- n ; } send_end ( ) ; ei ( ) ; } return no ; } } ""