omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / src / toc.om
| 1 | note Omega Bridge. Apache-2.0 WITH LLVM-exception. Recovered lexer and names; typed nodes and ordered C/Python emitters. |
| 2 | global src uchar 1048576 |
| 3 | global slen ulong 1 |
| 4 | global cur ulong 1 |
| 5 | global line ulong 1 |
| 6 | global tk ulong 1 |
| 7 | global tw ulong 1 |
| 8 | global tl ulong 1 |
| 9 | global ts ulong 1 |
| 10 | global held ulong 1 |
| 11 | global outb uchar 4194304 |
| 12 | global oc ulong 1 |
| 13 | global msg uchar 64 |
| 14 | global digs uchar 24 |
| 15 | global side uchar 4096 |
| 16 | global sidec ulong 1 |
| 17 | global mc ulong 1 |
| 18 | global nf ulong 1 |
| 19 | global fn_name ulong 512 |
| 20 | global fn_off ulong 512 |
| 21 | global fn_nl ulong 512 |
| 22 | global fn_ln ulong 512 |
| 23 | global fn_ret ulong 512 |
| 24 | global fn_np ulong 512 |
| 25 | global fn_pt ulong 3072 |
| 26 | global fn_pl ulong 3072 |
| 27 | global fn_pk ulong 3072 |
| 28 | global fn_poff ulong 3072 |
| 29 | global fn_pnl ulong 3072 |
| 30 | global ng ulong 1 |
| 31 | global g_off ulong 8 |
| 32 | global g_nl ulong 8 |
| 33 | global g_ty ulong 8 |
| 34 | global g_len ulong 8 |
| 35 | global g_ro ulong 8 |
| 36 | global g_pos ulong 8 |
| 37 | global textbuf uchar 32768 |
| 38 | global textuse ulong 1 |
| 39 | global qtext ulong 1 |
| 40 | global nloc ulong 1 |
| 41 | global loc_off ulong 32 |
| 42 | global loc_nl ulong 32 |
| 43 | global loc_ty ulong 32 |
| 44 | global loc_k ulong 32 |
| 45 | global loc_len ulong 32 |
| 46 | global loc_par ulong 32 |
| 47 | global bd ulong 1 |
| 48 | global bk ulong 32 |
| 49 | global cfi ulong 1 |
| 50 | global hasmain ulong 1 |
| 51 | |
| 52 | global localuse ulong 1 |
| 53 | global target ulong 1 |
| 54 | global nn ulong 1 |
| 55 | global nk ulong 1024 |
| 56 | global nt ulong 1024 |
| 57 | global na ulong 1024 |
| 58 | global nb ulong 1024 |
| 59 | global nv ulong 1024 |
| 60 | global nx ulong 1024 |
| 61 | global ny ulong 1024 |
| 62 | global args ulong 6144 |
| 63 | global saved ulong 32 |
| 64 | global loopvar ulong 32 |
| 65 | global loopty ulong 32 |
| 66 | note Extended, separately seed-checked mode; baseline capability limits remain unchanged. |
| 67 | global seeded ulong 1 |
| 68 | global fnext ulong 1 |
| 69 | global dynview ulong 1 |
| 70 | note Freestanding runtime views share the hosted parser and ABI, not its runtime. |
| 71 | global fsview ulong 1 |
| 72 | text fsparam "struct ombr_fs_ctx *fs" |
| 73 | text fsarg "fs" |
| 74 | text fsstart "({uint64_t fs_value=(" |
| 75 | text fsend ");if(fs->code)goto fs_fail;fs_value;})" |
| 76 | text fsfail "fs_fail: __attribute__((unused));--fs->depth;return 0;\n" |
| 77 | text fspub " struct ombr_fs_ctx fs_state={0,0};struct ombr_fs_ctx *fs=&fs_state;uint64_t _result=" |
| 78 | text fsstore ";if(!fs->code)fs_put(fs,result,1,0,_result," |
| 79 | text fspend ");return fs->code;\n}\n" |
| 80 | text fsrun "/* Omega Bridge freestanding checked runtime views. GNU C11; no hosted imports. */\n#include <stdint.h>\n#include <stddef.h>\nstruct ombr_fs_ctx { unsigned code, depth; };\nstatic uint64_t fs_error(struct ombr_fs_ctx *fs,unsigned code){fs->code=code;return 0;}\nstatic uint64_t fs_leave(struct ombr_fs_ctx *fs,uint64_t v){--fs->depth;return v;}\nstatic unsigned o_width(unsigned t){static const unsigned w[]={0,1,8,16,32,64,8,16,32,64};return w[t];}\nstatic int o_valid(unsigned t,uint64_t v){unsigned w=o_width(t);if(t<6)return w==64||v<((uint64_t)1<<w);if(w==64)return 1;uint64_t m=(uint64_t)1<<(w-1);return v<m||v>=UINT64_MAX-m+1;}\nstatic uint64_t fs_cast(struct ombr_fs_ctx *fs,unsigned t,unsigned s,uint64_t a){if((s>=6&&a>>63&&t<6)||(s<6&&t>=6&&a>>63)||!o_valid(t,a))return fs_error(fs,5);return a;}\nstatic uint64_t fs_op(struct ombr_fs_ctx *fs,unsigned op,unsigned t,uint64_t a,uint64_t b){\nunsigned w=o_width(t);uint64_t mask=UINT64_MAX>>(64-w),r=0;\nif(op>=6&&op<=11){uint64_t x=t>=6?a^((uint64_t)1<<63):a,y=t>=6?b^((uint64_t)1<<63):b;switch(op){case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;default:return x>=y;}}\nif(op==12)return a&b;if(op==13)return a|b;if(op==14)return a^b;\nif(op==18)return t==1?!a:(t>=6?~a:(~a)&mask);\nif(op==15||op==16){if(b>=w)return fs_error(fs,7);if(op==16){if(t<6||!b)return a>>b;return (a>>b)|((a>>63)?(UINT64_MAX<<(64-b)):0);}if(t<6)return (a<<b)&mask;uint64_t m=(uint64_t)1<<(w-1),x=a>>63?0-a:a,lim=a>>63?m:m-1;if(x>(lim>>b))return fs_error(fs,1);return a<<b;}\nif(op==4||op==5){if(!b)return fs_error(fs,2);if(t<6)return op==4?a/b:a%b;uint64_t x=a>>63?0-a:a,y=b>>63?0-b:b;int neg=op==4?(int)((a^b)>>63):(int)(a>>63);r=op==4?x/y:x%y;if(neg)r=0-r;if(!o_valid(t,r)||(!neg&&r>>63))return fs_error(fs,1);return r;}\nif(t<6){if(op==17)return (0-a)&mask;if(op==1)return (a+b)&mask;if(op==2)return (a-b)&mask;return (a*b)&mask;}\nif(op==17){r=0-a;if(a&&r==a)return fs_error(fs,1);}\nif(op==1){r=a+b;if((~(a^b)&(a^r))>>63)return fs_error(fs,1);}\nif(op==2){r=a-b;if(((a^b)&(a^r))>>63)return fs_error(fs,1);}\nif(op==3){uint64_t x=a>>63?0-a:a,y=b>>63?0-b:b,m=(uint64_t)1<<(w-1),lim=(a^b)>>63?m:m-1;if(y&&x>lim/y)return fs_error(fs,1);r=a*b;}\nif(!o_valid(t,r))return fs_error(fs,1);return r;\n}\nstatic uint64_t fs_get(struct ombr_fs_ctx *fs,const void *p,uint64_t n,uint64_t i,unsigned t){if(i>=n)return fs_error(fs,3);unsigned w=t==11?32:t==12?64:o_width(t);const uint8_t *b=(const uint8_t*)p+i*(w/8);uint64_t v=0;if(w==8)v=b[0];else if(w==16){uint16_t x;__builtin_memcpy(&x,b,2);v=x;}else if(w==32){uint32_t x;__builtin_memcpy(&x,b,4);v=x;}else if(w==64)__builtin_memcpy(&v,b,8);if(t>=6&&t<=9&&w<64&&(v>>(w-1)))v|=UINT64_MAX<<w;return v;}\nstatic void fs_put(struct ombr_fs_ctx *fs,void *p,uint64_t n,uint64_t i,uint64_t v,unsigned t){if(i>=n){fs_error(fs,3);return;}unsigned w=t==11?32:t==12?64:o_width(t);if(t<11&&!o_valid(t,v)){fs_error(fs,5);return;}uint8_t *b=(uint8_t*)p+i*(w/8);if(w==8)b[0]=(uint8_t)v;else if(w==16){uint16_t x=(uint16_t)v;__builtin_memcpy(b,&x,2);}else if(w==32){uint32_t x=(uint32_t)v;__builtin_memcpy(b,&x,4);}else if(w==64)__builtin_memcpy(b,&v,8);}\nstatic void fs_fill(struct ombr_fs_ctx *fs,void *p,uint64_t n,uint64_t v,unsigned t){for(uint64_t i=0;i<n;i++){fs_put(fs,p,n,i,v,t);if(fs->code)return;}}\nstatic int o_buf(const void *p,uint64_t n,uint64_t want,unsigned t){uintptr_t a=(uintptr_t)p;uint64_t z=t==11?4:t==12?8:o_width(t)/8;return p&&n==want&&a%z==0&&n<=UINTPTR_MAX/z&&a<=UINTPTR_MAX-n*z;}\nstatic int o_overlap(const void *a,uint64_t an,const void *b,uint64_t bn){uintptr_t x=(uintptr_t)a,y=(uintptr_t)b;return x<y+bn&&y<x+an;}\n#define o_cast(t,s,a) ({uint64_t fs_r=fs_cast(fs,t,s,a);if(fs->code)goto fs_fail;fs_r;})\n#define o_op(op,t,a,b) ({uint64_t fs_r=fs_op(fs,op,t,a,b);if(fs->code)goto fs_fail;fs_r;})\n#define o_get(p,n,i,t) ({uint64_t fs_r=fs_get(fs,p,n,i,t);if(fs->code)goto fs_fail;fs_r;})\n#define o_put(p,n,i,v,t) do{fs_put(fs,p,n,i,v,t);if(fs->code)goto fs_fail;}while(0)\n#define o_fill(p,n,v,t) do{fs_fill(fs,p,n,v,t);if(fs->code)goto fs_fail;}while(0)\n#define o_leave(v) fs_leave(fs,(v))\n#define o_enter() do{if(fs->depth>=128){fs->code=6;return 0;}++fs->depth;}while(0)\n#define o_trap(c) do{fs->code=(c);goto fs_fail;}while(0)\nstatic uint64_t o_arg32(float v){uint32_t b;__builtin_memcpy(&b,&v,4);return b;}\nstatic uint64_t o_arg64(double v){uint64_t b;__builtin_memcpy(&b,&v,8);return b;}\n" |
| 81 | text dynmark "/* Omega Bridge runtime views: numeric extents are capacities; * is unsized. */\n" |
| 82 | text dynrun "static int o_rbuf(const void *p,uint64_t n,uint64_t want,unsigned t){uintptr_t a=(uintptr_t)p;uint64_t z=t==11?4:o_width(t)/8;if(n>UINTPTR_MAX/z)return 0;if(want&&n>want)return 0;if(!n)return 1;if(!p)return 0;return a%z==0&&a<=UINTPTR_MAX-n*z;}\nstatic int o_rover(const void *a,uint64_t an,const void *b,uint64_t bn){return an&&bn&&o_overlap(a,an,b,bn);}\n" |
| 83 | text dynbuf "o_rbuf(" |
| 84 | text dynover " if(o_rover(result," |
| 85 | text dynalias "if(o_rover(" |
| 86 | text omword "om2" |
| 87 | global fbn ulong 80 |
| 88 | global nc ulong 1 |
| 89 | global co_off ulong 1024 |
| 90 | global co_nl ulong 1024 |
| 91 | global co_ty ulong 1024 |
| 92 | global co_val ulong 1024 |
| 93 | global co_neg ulong 1024 |
| 94 | global fsgn ulong 1 |
| 95 | global fnd ulong 1 |
| 96 | global fp10 long 1 |
| 97 | global fsuf ulong 1 |
| 98 | global fg_fl ulong 1 |
| 99 | global fg_seen ulong 1 |
| 100 | global fg_ex long 1 |
| 101 | global fg_esign long 1 |
| 102 | global fg_ed ulong 1 |
| 103 | global fg_ty ulong 1 |
| 104 | global fg_e long 1 |
| 105 | global fg_q ulong 1 |
| 106 | global fg_m ulong 1 |
| 107 | global fg_stk ulong 1 |
| 108 | global fg_low ulong 1 |
| 109 | global fg_ov ulong 1 |
| 110 | global abmode ulong 1 |
| 111 | global abprov ulong 1 |
| 112 | global abx ulong 8192 |
| 113 | global abn ulong 1 |
| 114 | global abfimp ulong 512 |
| 115 | global abfexp ulong 512 |
| 116 | global abnmo ulong 1024 |
| 117 | global abnml ulong 1024 |
| 118 | global abnmn ulong 1 |
| 119 | global abtoc uchar 1048576 |
| 120 | global abk ulong 64 |
| 121 | global abh ulong 8 |
| 122 | global abv ulong 8 |
| 123 | global abw ulong 64 |
| 124 | text abkw "cabi library header lock process mutex status enum value define alias aliasguard handle pool count record size align field state cstr slots width fallback export bind arg nullable out inout commit length data import result span trap int32 uint32 int64 uint64 char ulong uchar ret end" |
| 125 | text abrs "o_ omega_ ombr_ OMBR_" |
| 126 | text abcf "/* GENERATED by omega-bridge cabi-1 from src/toc.om SHA256 @; source SHA256 @. */\n@int@unsigned int@long long@unsigned long long@typedef enum @ {\n@,\n@ @ = @\n} @;\n@typedef struct @ @} @, @ *@char *@const char *@(@void@)@OMBR_@#ifndef @\n@#define @#endif\n@\n#define @\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n@#ifdef __cplusplus\n}\n#endif\n#endif\n@{\n global:\n@ local:\n *;\n};\n@static int o_in@(uint64_t v){switch(v){@case @:@return 1;default:return 0;}}\n@struct @{uint64_t o_magic,o_index;};\nstatic struct @[@];\nstatic uint64_t o_hi@ o_d){uintptr_t a=(uintptr_t)o_d,b=(uintptr_t)@;if(a<b||a-b>=sizeof @||(a-b)%sizeof @[0])return UINT64_MAX;uint64_t i=(a-b)/sizeof @[0];return @[i].o_magic==UINT64_C(0x4f6d656761484e44)&&@[i].o_index==i?i:UINT64_MAX;}\nstatic @ o_ho@(uint64_t i){@[i].o_magic=UINT64_C(0x4f6d656761484e44);@[i].o_index=i;return &@[i];}\n@_Static_assert(sizeof(@)==@&&_Alignof(@,\"record layout\");\n@_Static_assert(offsetof(@,@static uint64_t @];\n@static uint8_t @] __attribute__((aligned(8)));\n@uint32_t @uint64_t*@uint64_t@const void*,uint64_t@void*,uint64_t@);\n@#include <pthread.h>\nstatic int o_span(uint64_t n,uint64_t o,uint64_t l){return o>n||l>n-o;}\n@static pthread_mutex_t @=PTHREAD_MUTEX_INITIALIZER;\n@static const char o_fb@[]=\"@\";\n@o_enter();\n@return o_leave((uint64_t)@));\n}\n@if(@>v@_n||v@_n-@)o_trap(3);\n@(uint64_t*)v@v@(const uint8_t*)v@(uint8_t*)v@+@,v@(uint64_t)(int64_t)(int32_t)@(uint64_t)(uint32_t)@(uint64_t)(int64_t)@(uint64_t)@o_f[@]@ @=@o_hi@!=NULL;\n@ if(@*@;\n const uint64_t o_i@ if(o_f[1]&UINT64_C(@&&(!@||@>=@))o_ok=0;\n@>UINT32_MAX@||(int64_t)@<INT32_MIN||(int64_t)@>INT32_MAX@||!o_in@>(uint64_t)@>o_i@>@memcpy(&@[o_j].@->@+o_j*@8@4@);@)*@=(@=o_ho@)memcpy(@){@}\n@)for(uint64_t o_j=0;o_j<@;o_j++){@ if(!omega_@(&o_d,o_f,@{\n uint64_t o_f[@]={@},o_d=1;int o_ok=0;\n if(pthread_mutex_lock(&@))return (@)&&!o_d&&o_in@(o_f[0])&&!(o_f[1]&~UINT64_C(@))){\n o_ok=1;\n@ }\n if(o_ok){\n@ }\n pthread_mutex_unlock(&@);\n return o_ok?(@)o_f[0]:(@;\n}\n@},o_d=1;const char *o_r=o_fb@;\n if(pthread_mutex_lock(&@))return o_fb@)&&!o_d&&o_f[0]<@&&o_f[1]<@&&!@[o_f[0]*@+o_f[1]])o_r=(const char*)@+o_f[0]*@;\n pthread_mutex_unlock(&@);\n return o_r;\n}\n@static @__attribute__((visibility(\"default\"))) @||!@-1]@if(o_span(v@_n,@))o_trap(3);\n@(const uint64_t*)v" |
| 127 | text fword "f32" |
| 128 | text f64word "f64" |
| 129 | text bcword "bitcast" |
| 130 | text absword "fabs" |
| 131 | text fcall ";o_fp(" |
| 132 | text fcvcall "o_fcv(" |
| 133 | text cntword "continue" |
| 134 | text cntc "continue;\n" |
| 135 | text volword "volatile uint64_t " |
| 136 | text frun "#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__\n#error seeded C profile requires little-endian storage\n#endif\n#include <float.h>\n#include <fenv.h>\n#if FLT_RADIX != 2 || FLT_MANT_DIG != 24 || FLT_MAX_EXP != 128 || DBL_MANT_DIG != 53 || DBL_MAX_EXP != 1024 || FLT_EVAL_METHOD != 0\n#error unsupported binary32 or binary64 environment\n#endif\n#if defined(__FAST_MATH__)\n#error fast math is not a supported Omega environment\n#endif\nstatic int o_fnan(unsigned t,uint64_t a){return t==11?((a>>23&255)==255&&(a&UINT64_C(0x7fffff))!=0):((a>>52&2047)==2047&&(a&UINT64_C(0xfffffffffffff))!=0);}\nstatic uint64_t o_fpn(unsigned t,uint64_t a,uint64_t b,uint64_t r){uint64_t q=t==11?UINT64_C(0x400000):UINT64_C(0x8000000000000);if(!o_fnan(t,r))return r;if(o_fnan(t,a)&&!(a&q))return a|q;if(o_fnan(t,b)&&!(b&q))return b|q;if(o_fnan(t,a))return a;if(o_fnan(t,b))return b;return t==11?UINT64_C(0x7fc00000):UINT64_C(0x7ff8000000000000);}\nstatic float o_sqrt32(float a){float r;\n#if defined(__aarch64__)\n__asm__(\"fsqrt %s0, %s1\":\"=w\"(r):\"w\"(a));\n#elif defined(__x86_64__)\n__asm__(\"sqrtss %1, %0\":\"=x\"(r):\"x\"(a));\n#else\n#error unsupported seeded float sqrt target\n#endif\nreturn r;}\nstatic double o_sqrt64(double a){double r;\n#if defined(__aarch64__)\n__asm__(\"fsqrt %d0, %d1\":\"=w\"(r):\"w\"(a));\n#elif defined(__x86_64__)\n__asm__(\"sqrtsd %1, %0\":\"=x\"(r):\"x\"(a));\n#else\n#error unsupported seeded float sqrt target\n#endif\nreturn r;}\nstatic uint64_t o_fp(unsigned op,unsigned t,uint64_t a,uint64_t b){if(t==11){uint32_t ua=(uint32_t)a,ub=(uint32_t)b,ur;float x,y;volatile float z;__builtin_memcpy(&x,&ua,4);__builtin_memcpy(&y,&ub,4);switch(op){case 1:z=x+y;break;case 2:z=x-y;break;case 3:z=x*y;break;case 4:z=x/y;break;case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;case 11:return x>=y;case 17:return ua^UINT32_C(0x80000000);case 19:return ua&UINT32_C(0x7fffffff);case 20:z=o_sqrt32(x);break;default:__builtin_trap();}__builtin_memcpy(&ur,(const void*)&z,4);return o_fpn(11,ua,ub,ur);}uint64_t ur;double x,y;volatile double z;__builtin_memcpy(&x,&a,8);__builtin_memcpy(&y,&b,8);switch(op){case 1:z=x+y;break;case 2:z=x-y;break;case 3:z=x*y;break;case 4:z=x/y;break;case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;case 11:return x>=y;case 17:return a^UINT64_C(0x8000000000000000);case 19:return a&UINT64_C(0x7fffffffffffffff);case 20:z=o_sqrt64(x);break;default:__builtin_trap();}__builtin_memcpy(&ur,(const void*)&z,8);return o_fpn(12,a,b,ur);}\nstatic uint64_t o_fcv(unsigned t,unsigned s,uint64_t a){uint32_t u=(uint32_t)a;float f;double x;if(s==t)return a;if(s<11){if(t==11){volatile float z=s>=6?(float)(int64_t)a:(float)a;__builtin_memcpy(&u,(const void*)&z,4);return u;}volatile double z=s>=6?(double)(int64_t)a:(double)a;__builtin_memcpy(&a,(const void*)&z,8);return a;}if(t==12){if(o_fnan(11,a))return (uint64_t)(u>>31)<<63|UINT64_C(0x7ff8000000000000)|(uint64_t)(u&UINT32_C(0x7fffff))<<29;__builtin_memcpy(&f,&u,4);volatile double z=f;__builtin_memcpy(&a,(const void*)&z,8);return a;}if(t==11){if(o_fnan(12,a))return (a>>63)<<31|UINT64_C(0x7fc00000)|(a>>29&UINT64_C(0x3fffff));__builtin_memcpy(&x,&a,8);volatile float z=(float)x;__builtin_memcpy(&u,(const void*)&z,4);return u;}if(s==11){__builtin_memcpy(&f,&u,4);x=f;}else __builtin_memcpy(&x,&a,8);if(x!=x)return 0;unsigned w=o_width(t);if(t>=6){double m=(double)((uint64_t)1<<(w-1));if(x>=m)return ((uint64_t)1<<(w-1))-1;if(x<-m)return (uint64_t)0-((uint64_t)1<<(w-1));return (uint64_t)(int64_t)x;}if(x<1.0)return 0;if(x>=(w==64?18446744073709551616.0:(double)((uint64_t)1<<w)))return w==64?UINT64_MAX:((uint64_t)1<<w)-1;return (uint64_t)x;}\n" |
| 137 | text fmarun "#if !defined(__aarch64__)\n#error next seeded fma profile requires AArch64\n#endif\nstatic uint64_t o_fma(unsigned t,uint64_t a,uint64_t b,uint64_t c){\nif(t==11){uint32_t ua=(uint32_t)a,ub=(uint32_t)b,uc=(uint32_t)c,ur;float x,y,z,r;__builtin_memcpy(&x,&ua,4);__builtin_memcpy(&y,&ub,4);__builtin_memcpy(&z,&uc,4);__asm__(\"fmadd %s0, %s1, %s2, %s3\":\"=w\"(r):\"w\"(x),\"w\"(y),\"w\"(z));__builtin_memcpy(&ur,&r,4);return ur;}\ndouble x,y,z,r;uint64_t ur;__builtin_memcpy(&x,&a,8);__builtin_memcpy(&y,&b,8);__builtin_memcpy(&z,&c,8);__asm__(\"fmadd %d0, %d1, %d2, %d3\":\"=w\"(r):\"w\"(x),\"w\"(y),\"w\"(z));__builtin_memcpy(&ur,&r,8);return ur;}\n" |
| 138 | text fmstart "({uint64_t _fa=" |
| 139 | text fmnext ";uint64_t _fb=" |
| 140 | text fmlast ";uint64_t _fc=" |
| 141 | text fmcall ";o_fma(" |
| 142 | text fmtail ",_fa,_fb,_fc);})" |
| 143 | text cword "const" |
| 144 | text kwlist " bool uchar u8 ushort u16 uint u32 ulong u64 byte i8 short i16 int i32 long i64 add sub mul div rem and or xor shl shr eq ne lt le gt ge neg not get len read write true false view edit fn to end if else while bound for ret = ( ) void global text put free exit note new break trap own \n cwd random envcnt envread chdir ftrunc stat link symlnk chmod faccess getuid geteuid getgid getegid lstat truncate chown const fchdir getppid umask fdsync memfd setsid getpgid setpgid pread pwrite getsid syncfs shutdown devctl mapnew mapdrop mapread mapwrite devcall uvmctl mapaddr mapget mapset maphold mapbind flock sockname realns execprog renames rmdir killpid pipefds getpid waitio getdnts connect bind waitpid fstat recv send sleepns argcnt argread fclose fsync fchmod fseek socknew listen accept fork dupfd monons fopen unlink makedir struct f32 f64 bitcast fsqrt fabs fmin fmax sizeof offsetof continue peercred pollfds sendmsg readlnk sockopt \n execpure qty cpufence cpurelax peername fma " |
| 145 | text bword "break" |
| 146 | text breakc "break;\n" |
| 147 | text breakp "break\n" |
| 148 | text guardc "++>=1000000)o_trap(4);\n" |
| 149 | text guardp ">=1000000: o_trap(4)\n" |
| 150 | text capmsg "unsupported bridge capability\n" |
| 151 | text z0 "/* Emitted by Omega Bridge. GNU C11, POSIX. Scalars use canonical 64-bit bits. */\n#include <stdint.h>\n#include <stddef.h>\n#include <unistd.h>\n#include <errno.h>\n#include <setjmp.h>\nstatic _Thread_local jmp_buf o_jmp;\nstatic _Thread_local int o_busy;\nstatic __attribute__((noreturn)) void o_trap(int c){if(o_busy)longjmp(o_jmp,c);_exit(100+c);}\nstatic _Thread_local unsigned o_depth;\nstatic void o_enter(void){if(++o_depth>128)o_trap(6);}\nstatic uint64_t o_leave(uint64_t v){--o_depth;return v;}\nstatic unsigned o_width(unsigned t){static const unsigned w[]={0,1,8,16,32,64,8,16,32,64};return w[t];}\nstatic __int128 o_value(unsigned t,uint64_t v){return t>=6 && v>>63 ? (__int128)v-(((__int128)1)<<64):(__int128)v;}\nstatic uint64_t o_norm(unsigned t,__int128 v,int code){unsigned w=o_width(t);if(t>=6){__int128 m=((__int128)1)<<(w-1);if(v< -m||v>=m)o_trap(code);}else {if(v<0||(__uint128_t)v>=(((__uint128_t)1)<<w))o_trap(code);}return (uint64_t)v;}\nstatic uint64_t o_cast(unsigned t,unsigned s,uint64_t a){return o_norm(t,o_value(s,a),5);}\nstatic uint64_t o_op(unsigned op,unsigned t,uint64_t a,uint64_t b){\n __int128 x=o_value(t,a),y=o_value(t,b),z=0;unsigned w=o_width(t);uint64_t mask=w==64?UINT64_MAX:(((uint64_t)1<<w)-1);\n if(op>=6&&op<=11){switch(op){case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;default:return x>=y;}}\n if(op==12)return a&b;if(op==13)return a|b;if(op==14)return a^b;\n if(op==15||op==16){if(b>=w)o_trap(7);if(op==15)return t>=6?o_norm(t,x*(((__int128)1)<<b),1):(a<<b)&mask;if(t<6)return a>>b;if(!b)return a;return (a>>b)|((a>>63)?(UINT64_MAX<<(64-b)):0);}\n if(op==17){if(t<6)return (0-a)&mask;return o_norm(t,-x,1);}if(op==18)return t==1?!a:(t>=6?~a:(~a)&mask);\n if(op==4||op==5){if(!b)o_trap(2);z=op==4?x/y:x%y;return t>=6?o_norm(t,z,1):(uint64_t)z;}\n if(t<6){if(op==1)return (a+b)&mask;if(op==2)return (a-b)&mask;return (a*b)&mask;}\n if(op==1)z=x+y;if(op==2)z=x-y;if(op==3)z=x*y;return o_norm(t,z,1);\n}\nstatic uint64_t o_get(const void *p,uint64_t n,uint64_t i,unsigned t){if(i>=n)o_trap(3);unsigned w=t==11?32:t==12?64:o_width(t);const uint8_t *b=(const uint8_t*)p+i*(w/8);uint64_t v=0;if(w==8)v=b[0];else if(w==16){uint16_t x;__builtin_memcpy(&x,b,2);v=x;}else if(w==32){uint32_t x;__builtin_memcpy(&x,b,4);v=x;}else if(w==64)__builtin_memcpy(&v,b,8);if(t>=6&&t<=9&&w<64&&(v>> (w-1)))v|=UINT64_MAX<<w;return v;}\nstatic void o_put(void *p,uint64_t n,uint64_t i,uint64_t v,unsigned t){if(i>=n)o_trap(3);unsigned w=t==11?32:t==12?64:o_width(t);if(t<11)o_norm(t,o_value(t,v),5);uint8_t *b=(uint8_t*)p+i*(w/8);if(w==8)b[0]=(uint8_t)v;else if(w==16){uint16_t x=(uint16_t)v;__builtin_memcpy(b,&x,2);}else if(w==32){uint32_t x=(uint32_t)v;__builtin_memcpy(b,&x,4);}else if(w==64)__builtin_memcpy(b,&v,8);}\nstatic void o_fill(void *p,uint64_t n,uint64_t v,unsigned t){for(uint64_t i=0;i<n;i++)o_put(p,n,i,v,t);}\nstatic uint64_t o_io(unsigned op,uint64_t fd,const void *p,uint64_t n,uint64_t off,uint64_t len){if(off>n||len>n-off)o_trap(3);int f=(int)o_value(8,fd);ssize_t r=op==1?read(f,(uint8_t*)p+off,(size_t)len):write(f,(const uint8_t*)p+off,(size_t)len);return r<0?(uint64_t)(-(int64_t)errno):(uint64_t)r;}\nstatic int o_valid(unsigned t,uint64_t v){unsigned w=o_width(t);__int128 x=o_value(t,v);__int128 m=((__int128)1)<<(t>=6?w-1:w);return t>=6?x>=-m&&x<m:x>=0&&x<m;}\nstatic int o_buf(const void *p,uint64_t n,uint64_t want,unsigned t){uintptr_t a=(uintptr_t)p;uint64_t z=t==11?4:t==12?8:o_width(t)/8;return p&&n==want&&a%z==0&&n<=UINTPTR_MAX/z&&a<=UINTPTR_MAX-n*z;}\nstatic int o_overlap(const void *a,uint64_t an,const void *b,uint64_t bn){uintptr_t x=(uintptr_t)a,y=(uintptr_t)b;return x<y+bn&&y<x+an;}\n" |
| 152 | text z1 "# Emitted by Omega Bridge. Scalar values use canonical 64-bit bits.\nimport os as _os\n_MASK = (1 << 64) - 1\n_depth = 0\n_busy = False\nclass _Trap(Exception):\n pass\ndef o_trap(c):\n if _busy: raise _Trap(c)\n _os._exit(100 + c)\ndef o_enter():\n global _depth\n _depth += 1\n if _depth > 128: o_trap(6)\ndef o_leave(v):\n global _depth\n _depth -= 1\n return v\ndef o_width(t):\n return (0,1,8,16,32,64,8,16,32,64)[t]\ndef o_value(t,v):\n return v - (1 << 64) if t >= 6 and v >> 63 else v\ndef o_norm(t,v,code):\n w = o_width(t)\n lo,hi = (-(1 << (w-1)),1 << (w-1)) if t >= 6 else (0,1 << w)\n if not lo <= v < hi: o_trap(code)\n return v & _MASK\ndef o_cast(t,s,a):\n return o_norm(t,o_value(s,a),5)\ndef o_op(op,t,a,b):\n x,y = o_value(t,a),o_value(t,b)\n w = o_width(t)\n mask = (1 << w)-1\n if 6 <= op <= 11: return int((x==y,x!=y,x<y,x<=y,x>y,x>=y)[op-6])\n if op == 12: return a & b\n if op == 13: return a | b\n if op == 14: return a ^ b\n if op in (15,16):\n if b >= w: o_trap(7)\n if op == 15: return o_norm(t,x*(1<<b),1) if t>=6 else (a<<b)&mask\n return (x >> b) & _MASK\n if op == 17: return ((-a)&mask) if t < 6 else o_norm(t,-x,1)\n if op == 18: return int(not a) if t==1 else (~a)&(_MASK if t>=6 else mask)\n if op in (4,5):\n if not b: o_trap(2)\n q = abs(x)//abs(y)\n if (x<0) != (y<0): q = -q\n z = q if op == 4 else x-q*y\n elif op == 1: z=x+y\n elif op == 2: z=x-y\n else: z=x*y\n return o_norm(t,z,1) if t>=6 else z & mask\ndef o_get(p,n,i,t):\n if i>=n: o_trap(3)\n return p[i]\ndef o_put(p,n,i,v,t):\n if i>=n: o_trap(3)\n p[i]=o_norm(t,o_value(t,v),5)\ndef o_fill(p,n,v,t):\n for i in range(n): o_put(p,n,i,v,t)\ndef o_io(op,fd,p,n,off,length):\n if off>n or length>n-off: o_trap(3)\n try:\n if op==1:\n data=_os.read(o_value(8,fd),length)\n p[off:off+len(data)]=data\n return len(data)\n return _os.write(o_value(8,fd),bytes(p[off:off+length]))\n except OSError as exc: return (-exc.errno)&_MASK\ndef o_valid(t,v):\n if type(v) is not int or not 0<=v<=_MASK: return False\n w=o_width(t)\n x=o_value(t,v)\n return -(1<<(w-1))<=x<(1<<(w-1)) if t>=6 else x<(1<<w)\ndef o_buf(p,n,want,t,edit):\n if type(n) is not int or n!=want: return False\n if t==2:\n return (type(p) is bytearray or (edit==2 and type(p) is bytes)) and len(p)==n\n return type(p) is list and len(p)==n and all(o_valid(t,x) for x in p)\n" |
| 153 | text z2 "_n" |
| 154 | text z3 " " |
| 155 | text z4 "uint64_t " |
| 156 | text z5 "ULL" |
| 157 | text z6 "o_cast(" |
| 158 | text z7 "o_get(" |
| 159 | text z8 "({uint64_t _a=" |
| 160 | text z9 ";uint64_t _b=" |
| 161 | text z10 ";o_op(" |
| 162 | text z11 "o_op(" |
| 163 | text z12 "_a,_b);})" |
| 164 | text z13 "({uint64_t _fd=" |
| 165 | text z14 ";uint64_t _off=" |
| 166 | text z15 ";uint64_t _cnt=" |
| 167 | text z16 ";o_io(" |
| 168 | text z17 "o_io(" |
| 169 | text z18 "_fd" |
| 170 | text z19 "_off,_cnt);})" |
| 171 | text z20 "int" |
| 172 | text z21 "_t " |
| 173 | text z22 "]={0};\n" |
| 174 | text z23 "=bytearray(" |
| 175 | text z24 ")\n" |
| 176 | text z25 "=[0]*" |
| 177 | text z26 "o_fill(" |
| 178 | text z27 "static uint64_t " |
| 179 | text z28 "def " |
| 180 | text z29 "void *" |
| 181 | text z129 "static const uint8_t " |
| 182 | text z130 "=bytes((" |
| 183 | text z131 "static const uint64_t " |
| 184 | text z30 "_n" |
| 185 | text z31 "void" |
| 186 | text z32 "{uint64_t _i=" |
| 187 | text z33 ";uint64_t _v=" |
| 188 | text z34 ";o_put(" |
| 189 | text z35 "o_put(" |
| 190 | text z36 "_i,_v," |
| 191 | text z37 ";}\n" |
| 192 | text z38 "{\n" |
| 193 | text z39 ":\n" |
| 194 | text z40 "pass\n" |
| 195 | text z41 "{\n" |
| 196 | text z42 "=0" |
| 197 | text z43 "=0" |
| 198 | text z44 "for(;o_op(8," |
| 199 | text z45 "while o_op(8," |
| 200 | text z46 "=o_op(1," |
| 201 | text z47 ",1))" |
| 202 | text z48 "if(" |
| 203 | text z49 "++>=1000000)o_trap(4);\n" |
| 204 | text z50 "if " |
| 205 | text z51 ">=1000000: o_trap(4)\n" |
| 206 | text z52 "+=1\n" |
| 207 | text z53 "=o_op(1," |
| 208 | text z54 ",1)\n" |
| 209 | text z55 "return o_leave(0)" |
| 210 | text z56 "}\n" |
| 211 | text z57 "}\n" |
| 212 | text z58 "}else{\n" |
| 213 | text z59 "else:\n" |
| 214 | text z60 "pass\n" |
| 215 | text z61 "if(" |
| 216 | text z62 "{\n" |
| 217 | text z63 "=0" |
| 218 | text z64 "while(" |
| 219 | text z65 "if(" |
| 220 | text z66 "++>=" |
| 221 | text z67 ")o_trap(4);\n" |
| 222 | text z68 "if " |
| 223 | text z69 ">=" |
| 224 | text z70 ": o_trap(4)\n" |
| 225 | text z71 "+=1\n" |
| 226 | text z72 "return o_leave(" |
| 227 | text z73 "_exit((int)(" |
| 228 | text z74 "_os._exit((" |
| 229 | text z75 ")&255)" |
| 230 | text z76 "{\n" |
| 231 | text z77 ":\n" |
| 232 | text z78 "o_enter()" |
| 233 | text z79 ";\n" |
| 234 | text z80 "#ifndef OMEGA_LIBRARY\nint main(void){return (int)(" |
| 235 | text z81 "()&255);}\n#endif\n" |
| 236 | text z82 "if __name__ == '__main__':\n _os._exit(" |
| 237 | text z83 "()&255)\n" |
| 238 | text z84 "({" |
| 239 | text z85 "uint64_t " |
| 240 | text z86 ";})" |
| 241 | text z87 "omega_" |
| 242 | text z88 "_n" |
| 243 | text z89 ")return 8;\n" |
| 244 | text z90 ": return (8,None)\n" |
| 245 | text z91 "if(!" |
| 246 | text z92 "if not " |
| 247 | text z93 "o_valid(" |
| 248 | text z94 "o_buf(" |
| 249 | text z95 "_n," |
| 250 | text z96 "if(o_overlap(result,8," |
| 251 | text z97 "_n*" |
| 252 | text z98 "))return 8;\n" |
| 253 | text z99 "if(o_overlap(" |
| 254 | text z100 "_n*" |
| 255 | text z101 "_n*" |
| 256 | text z102 "))return 8;\n" |
| 257 | text z103 "if " |
| 258 | text z104 " is " |
| 259 | text z105 ": return (8,None)\n" |
| 260 | text z106 "uint32_t " |
| 261 | text z107 "def " |
| 262 | text z108 "uint64_t *result" |
| 263 | text z109 "void *" |
| 264 | text z110 "uint64_t " |
| 265 | text z111 "_n" |
| 266 | text z112 "){\nif(!o_buf(result,1,1,5))return 8;\n" |
| 267 | text z113 "):\n" |
| 268 | text z114 "if(o_busy)return 9;\no_busy=1;o_depth=0;int code=setjmp(o_jmp);\nif(!code)*result=" |
| 269 | text z115 ");\no_busy=0;o_depth=0;return (uint32_t)code;\n}\n" |
| 270 | text z116 "global _busy, _depth\n" |
| 271 | text z117 "if _busy: return (9,None)\n" |
| 272 | text z118 "_busy=True\n" |
| 273 | text z119 "_depth=0\n" |
| 274 | text z120 "try:\n" |
| 275 | text z121 "return (0," |
| 276 | text z122 "))\n" |
| 277 | text z123 "except _Trap as exc:\n" |
| 278 | text z124 "return (exc.args[0],None)\n" |
| 279 | text z125 "finally:\n" |
| 280 | text z126 "_busy=False\n" |
| 281 | text z127 "_depth=0\n" |
| 282 | note The portable ABI retains the native adapter's argument/reentry status numbers. |
| 283 | text s89 ")return 32;\n" |
| 284 | text s90 ": return (32,None)\n" |
| 285 | text s98 "))return 32;\n" |
| 286 | text s105 ": return (32,None)\n" |
| 287 | text s112 "){\nif(!o_buf(result,1,1,5))return 32;\n" |
| 288 | text s114 "if(o_busy)return 33;\no_busy=1;o_depth=0;int code=setjmp(o_jmp);\nif(!code)*result=" |
| 289 | text s117 "if _busy: return (33,None)\n" |
| 290 | note Generated common runtime is deliberately shared by all bounded programs. |
| 291 | text shead "#if defined(__GNUC__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wunused-function\"\n#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n#pragma GCC diagnostic ignored \"-Wmisleading-indentation\"\n#endif\n" |
| 292 | text stail "#if defined(__GNUC__)\n#pragma GCC diagnostic pop\n#endif\n" |
| 293 | text qual "const " |
| 294 | text unused "__attribute__((unused)) " |
| 295 | fn pubrettype f ulong to ulong |
| 296 | if eq isflt get fn_ret f 1 |
| 297 | ret get fn_ret f |
| 298 | end |
| 299 | ret 5 |
| 300 | end |
| 301 | |
| 302 | text pubf32 "float " |
| 303 | text pubf64 "double " |
| 304 | text pubarg "o_arg" |
| 305 | text pubv "volatile " |
| 306 | text pubres " *result" |
| 307 | text pubchk "){\n if(!o_buf(result,1,1," |
| 308 | text pubcend "))return 32;\n" |
| 309 | text pubstart " if(o_busy)return 33;\n o_busy=1;o_depth=0;int code=setjmp(o_jmp);if(!code){uint64_t _result=" |
| 310 | text pubend ";}\n o_busy=0;return (uint32_t)code;\n}\n" |
| 311 | text pubstore ";o_put(result,1,0,_result," |
| 312 | text pubover " if(o_overlap(result," |
| 313 | text pubovend "," |
| 314 | text pubhelp "#include <string.h>\nstatic uint64_t o_arg32(float v){uint32_t b;memcpy(&b,&v,4);return b;}\nstatic uint64_t o_arg64(double v){uint64_t b;memcpy(&b,&v,8);return b;}\n" |
| 315 | |
| 316 | fn pubtype t ulong to void |
| 317 | if eq t 11 |
| 318 | for j ulong len pubf32 |
| 319 | e_b ulong get pubf32 j |
| 320 | end |
| 321 | else |
| 322 | if eq t 12 |
| 323 | for j ulong len pubf64 |
| 324 | e_b ulong get pubf64 j |
| 325 | end |
| 326 | else |
| 327 | euint |
| 328 | end |
| 329 | end |
| 330 | end |
| 331 | |
| 332 | fn pubresult f ulong to void |
| 333 | pubtype get fn_ret f |
| 334 | for j ulong len pubres |
| 335 | e_b ulong get pubres j |
| 336 | end |
| 337 | end |
| 338 | |
| 339 | fn pubvalue f ulong i ulong to void |
| 340 | s = add mul f 6 i |
| 341 | if and eq get target 0 0 and eq get fn_pk s 0 eq isflt get fn_pt s 1 |
| 342 | for j ulong len pubarg |
| 343 | e_b ulong get pubarg j |
| 344 | end |
| 345 | e_dec width get fn_pt s |
| 346 | e_b 40 |
| 347 | named 112 i |
| 348 | e_b 41 |
| 349 | else |
| 350 | named 112 i |
| 351 | end |
| 352 | end |
| 353 | |
| 354 | fn viewqual k ulong to void |
| 355 | if eq k 2 |
| 356 | for i ulong len qual |
| 357 | e_b ulong get qual i |
| 358 | end |
| 359 | end |
| 360 | end |
| 361 | |
| 362 | fn mputb b uchar to void |
| 363 | m = get mc 0 |
| 364 | put msg m b |
| 365 | put mc 0 add m 1 |
| 366 | end |
| 367 | |
| 368 | fn mputn v ulong to void |
| 369 | d = new uchar 20 0 |
| 370 | i = ulong 0 |
| 371 | x = v |
| 372 | put d 0 uchar add rem x 10 48 |
| 373 | x = div x 10 |
| 374 | i = add i 1 |
| 375 | while gt x 0 |
| 376 | put d i uchar add rem x 10 48 |
| 377 | x = div x 10 |
| 378 | i = add i 1 |
| 379 | end |
| 380 | j = i |
| 381 | while gt j 0 |
| 382 | j = sub j 1 |
| 383 | mputb get d j |
| 384 | end |
| 385 | end |
| 386 | |
| 387 | fn fail code ulong to void |
| 388 | put mc 0 0 |
| 389 | mputb 116 |
| 390 | mputb 111 |
| 391 | mputb 99 |
| 392 | mputb 58 |
| 393 | mputb 32 |
| 394 | mputb 108 |
| 395 | mputb 105 |
| 396 | mputb 110 |
| 397 | mputb 101 |
| 398 | mputb 32 |
| 399 | mputn get line 0 |
| 400 | mputb 58 |
| 401 | mputb 32 |
| 402 | mputb 101 |
| 403 | mputb 114 |
| 404 | mputb 114 |
| 405 | mputb 111 |
| 406 | mputb 114 |
| 407 | mputb 32 |
| 408 | mputn code |
| 409 | mputb 10 |
| 410 | w = write 2 msg 0 get mc 0 |
| 411 | if eq code 24 |
| 412 | w = write 2 capmsg 0 len capmsg |
| 413 | end |
| 414 | exit int code |
| 415 | end |
| 416 | |
| 417 | fn e_b c ulong to void |
| 418 | o = get oc 0 |
| 419 | if ge o 4194304 |
| 420 | fail 14 |
| 421 | end |
| 422 | put outb o uchar c |
| 423 | put oc 0 add o 1 |
| 424 | end |
| 425 | |
| 426 | fn e_src a ulong n ulong to void |
| 427 | i = ulong 0 |
| 428 | while lt i n |
| 429 | e_b ulong get src add a i |
| 430 | i = add i 1 |
| 431 | end |
| 432 | end |
| 433 | |
| 434 | fn e_s0 to void |
| 435 | e_b 32 |
| 436 | end |
| 437 | |
| 438 | fn isw w ulong to ulong |
| 439 | if and eq get tk 0 1 eq get tw 0 w |
| 440 | ret 1 |
| 441 | end |
| 442 | ret 0 |
| 443 | end |
| 444 | |
| 445 | fn tok_flt to ulong |
| 446 | for j ulong get tl 0 |
| 447 | q = get src add get ts 0 j |
| 448 | if or or eq q 46 eq q 101 eq q 69 |
| 449 | put tk 0 4 |
| 450 | ret 1 |
| 451 | end |
| 452 | end |
| 453 | ret 0 |
| 454 | end |
| 455 | |
| 456 | fn tok_num to void |
| 457 | note Only the seeded C frontend admits explicit binary32 literals. |
| 458 | v = ulong 0 |
| 459 | i = ulong 0 |
| 460 | minus = ulong 0 |
| 461 | p = get ts 0 |
| 462 | if eq tok_flt 1 |
| 463 | ret |
| 464 | end |
| 465 | if eq get src p 45 |
| 466 | minus = 1 |
| 467 | i = 1 |
| 468 | end |
| 469 | while lt i get tl 0 |
| 470 | b = get src add p i |
| 471 | v = add mul v 10 sub ulong b ulong 48 |
| 472 | i = add i 1 |
| 473 | end |
| 474 | if eq minus 1 |
| 475 | v = sub 0 v |
| 476 | end |
| 477 | put tw 0 v |
| 478 | put tk 0 2 |
| 479 | end |
| 480 | |
| 481 | note Match the seeded tok_text span rules. Decode only in a text declaration. |
| 482 | fn tok_text to void |
| 483 | put cur 0 add get cur 0 1 |
| 484 | put tw 0 get cur 0 |
| 485 | go = ulong 1 |
| 486 | while eq go 1 |
| 487 | if ge get cur 0 get slen 0 |
| 488 | fail 22 |
| 489 | end |
| 490 | b = get src get cur 0 |
| 491 | if eq b 10 |
| 492 | fail 22 |
| 493 | end |
| 494 | if eq b 34 |
| 495 | go = 0 |
| 496 | else |
| 497 | put cur 0 add get cur 0 1 |
| 498 | if eq b 92 |
| 499 | if ge get cur 0 get slen 0 |
| 500 | fail 22 |
| 501 | end |
| 502 | if eq get src get cur 0 10 |
| 503 | fail 22 |
| 504 | end |
| 505 | put cur 0 add get cur 0 1 |
| 506 | end |
| 507 | end |
| 508 | end |
| 509 | put tl 0 sub get cur 0 get tw 0 |
| 510 | put cur 0 add get cur 0 1 |
| 511 | put tk 0 5 |
| 512 | if lt get cur 0 get slen 0 |
| 513 | if gt get src get cur 0 32 |
| 514 | fail 22 |
| 515 | end |
| 516 | end |
| 517 | end |
| 518 | |
| 519 | fn tok2 c uchar to void |
| 520 | if and eq c 34 eq get qtext 0 1 |
| 521 | tok_text |
| 522 | ret |
| 523 | end |
| 524 | put ts 0 get cur 0 |
| 525 | w = ulong 0 |
| 526 | sh = ulong 0 |
| 527 | n = ulong 0 |
| 528 | go = ulong 1 |
| 529 | while eq go 1 |
| 530 | if ge get cur 0 get slen 0 |
| 531 | go = 0 |
| 532 | else |
| 533 | b = get src get cur 0 |
| 534 | if le b 32 |
| 535 | go = 0 |
| 536 | else |
| 537 | if lt n 8 |
| 538 | w = or w shl ulong b sh |
| 539 | sh = add sh 8 |
| 540 | end |
| 541 | n = add n 1 |
| 542 | put cur 0 add get cur 0 1 |
| 543 | end |
| 544 | end |
| 545 | end |
| 546 | put tw 0 w |
| 547 | put tl 0 n |
| 548 | f = get src get ts 0 |
| 549 | num = ulong 0 |
| 550 | if eq f 45 |
| 551 | num = 1 |
| 552 | end |
| 553 | if and ge f 48 le f 57 |
| 554 | num = 1 |
| 555 | end |
| 556 | if eq num 1 |
| 557 | tok_num |
| 558 | else |
| 559 | put tk 0 1 |
| 560 | end |
| 561 | end |
| 562 | |
| 563 | note Advance to the line end without tokenizing: decoded text lines, and note bodies |
| 564 | note outside cabi library modes (which parse their note directives), keep any bytes. |
| 565 | fn skipline to void |
| 566 | while lt get cur 0 get slen 0 |
| 567 | if eq get src get cur 0 10 |
| 568 | ret |
| 569 | end |
| 570 | put cur 0 add get cur 0 1 |
| 571 | end |
| 572 | end |
| 573 | |
| 574 | fn tok to void |
| 575 | if eq get held 0 1 |
| 576 | put held 0 0 |
| 577 | ret |
| 578 | end |
| 579 | go = ulong 1 |
| 580 | while eq go 1 |
| 581 | if ge get cur 0 get slen 0 |
| 582 | put tk 0 3 |
| 583 | ret |
| 584 | end |
| 585 | c = get src get cur 0 |
| 586 | if or or eq c 32 eq c 9 eq c 13 |
| 587 | put cur 0 add get cur 0 1 |
| 588 | else |
| 589 | if eq c 10 |
| 590 | put cur 0 add get cur 0 1 |
| 591 | put line 0 add get line 0 1 |
| 592 | put tk 0 0 |
| 593 | ret |
| 594 | end |
| 595 | if lt c 32 |
| 596 | fail 16 |
| 597 | end |
| 598 | tok2 c |
| 599 | if and eq isw 1702129518 1 eq get abmode 0 0 |
| 600 | skipline |
| 601 | end |
| 602 | ret |
| 603 | end |
| 604 | end |
| 605 | end |
| 606 | |
| 607 | fn ty_of w ulong to ulong |
| 608 | if and eq get seeded 0 1 eq get target 0 0 |
| 609 | fk = floatkw |
| 610 | if eq fk 1 |
| 611 | ret 11 |
| 612 | end |
| 613 | if eq fk 4 |
| 614 | ret 12 |
| 615 | end |
| 616 | end |
| 617 | if eq w 1819242338 |
| 618 | ret 1 |
| 619 | end |
| 620 | if eq w 491260502901 |
| 621 | ret 2 |
| 622 | end |
| 623 | if eq w 128034844210037 |
| 624 | ret 3 |
| 625 | end |
| 626 | if eq w 1953393013 |
| 627 | ret 4 |
| 628 | end |
| 629 | if eq w 444234427509 |
| 630 | ret 5 |
| 631 | end |
| 632 | if eq w 1702132066 |
| 633 | ret 6 |
| 634 | end |
| 635 | if eq w 500136110195 |
| 636 | ret 7 |
| 637 | end |
| 638 | if eq w 7630441 |
| 639 | ret 8 |
| 640 | end |
| 641 | if eq w 1735290732 |
| 642 | ret 9 |
| 643 | end |
| 644 | ret 0 |
| 645 | end |
| 646 | |
| 647 | fn signed t ulong to ulong |
| 648 | if and ge t 6 le t 9 |
| 649 | ret 1 |
| 650 | end |
| 651 | ret 0 |
| 652 | end |
| 653 | |
| 654 | fn same_name o ulong n ulong to ulong |
| 655 | if ne n get tl 0 |
| 656 | ret 0 |
| 657 | end |
| 658 | i = ulong 0 |
| 659 | while lt i n |
| 660 | if ne get src add o i get src add get ts 0 i |
| 661 | ret 0 |
| 662 | end |
| 663 | i = add i 1 |
| 664 | end |
| 665 | ret 1 |
| 666 | end |
| 667 | |
| 668 | fn loc_of to ulong |
| 669 | i = ulong 0 |
| 670 | while lt i get nloc 0 |
| 671 | if eq same_name get loc_off i get loc_nl i 1 |
| 672 | ret i |
| 673 | end |
| 674 | i = add i 1 |
| 675 | end |
| 676 | ret 99 |
| 677 | end |
| 678 | |
| 679 | fn glob_of to ulong |
| 680 | i = ulong 0 |
| 681 | while lt i get ng 0 |
| 682 | if eq same_name get g_off i get g_nl i 1 |
| 683 | ret i |
| 684 | end |
| 685 | i = add i 1 |
| 686 | end |
| 687 | ret 99 |
| 688 | end |
| 689 | |
| 690 | fn fn_of to ulong |
| 691 | i = ulong 0 |
| 692 | while lt i get nf 0 |
| 693 | if eq same_name get fn_off i get fn_nl i 1 |
| 694 | ret i |
| 695 | end |
| 696 | i = add i 1 |
| 697 | end |
| 698 | ret 4096 |
| 699 | end |
| 700 | |
| 701 | note Keyword tables, space-separated, in newline-separated sections. First: the pinned seed's 66 |
| 702 | note words (omc.om 29b12760 fn kw), refused 16 in every mode. Second: the 93 further words of the |
| 703 | note seeded frontend's fn kw (omega-mv e5b32567), refused 16 in seeded modes. Third: the 6 words |
| 704 | note draft-1049 (7e93ca8e) adds to fn kw, refused 16 in its modes E and J. OM-2-only words (kw2) and |
| 705 | note target-conditional words are left to the seeded frontend, which runs first in tools/bridge-seeded. |
| 706 | fn seedkw to ulong |
| 707 | n = get tl 0 |
| 708 | s = get ts 0 |
| 709 | k = len kwlist |
| 710 | i = ulong 0 |
| 711 | e = add n 1 |
| 712 | lim = add get seeded 0 get fnext 0 |
| 713 | while lt e k |
| 714 | if eq get kwlist i 10 |
| 715 | if eq lim 0 |
| 716 | ret 0 |
| 717 | end |
| 718 | lim = sub lim 1 |
| 719 | end |
| 720 | if eq get kwlist i 32 |
| 721 | if eq get kwlist e 32 |
| 722 | j = ulong 0 |
| 723 | m = ulong 1 |
| 724 | while lt j n |
| 725 | a = get kwlist add add i 1 j |
| 726 | if ne a get src add s j |
| 727 | m = ulong 0 |
| 728 | end |
| 729 | j = add j 1 |
| 730 | end |
| 731 | if eq m 1 |
| 732 | ret 1 |
| 733 | end |
| 734 | end |
| 735 | end |
| 736 | i = add i 1 |
| 737 | e = add e 1 |
| 738 | end |
| 739 | ret 0 |
| 740 | end |
| 741 | |
| 742 | fn param_dup ix ulong to ulong |
| 743 | q = ulong 0 |
| 744 | while lt q get fn_np ix |
| 745 | slot = add mul ix 6 q |
| 746 | if eq same_name get fn_poff slot get fn_pnl slot 1 |
| 747 | ret 1 |
| 748 | end |
| 749 | q = add q 1 |
| 750 | end |
| 751 | ret 0 |
| 752 | end |
| 753 | |
| 754 | fn src_eq a ulong an ulong b ulong bn ulong to ulong |
| 755 | if ne an bn |
| 756 | ret 0 |
| 757 | end |
| 758 | i = ulong 0 |
| 759 | while lt i an |
| 760 | if ne get src add a i get src add b i |
| 761 | ret 0 |
| 762 | end |
| 763 | i = add i 1 |
| 764 | end |
| 765 | ret 1 |
| 766 | end |
| 767 | |
| 768 | fn param_fn_sweep to void |
| 769 | f = ulong 0 |
| 770 | while lt f get nf 0 |
| 771 | q = ulong 0 |
| 772 | while lt q get fn_np f |
| 773 | slot = add mul f 6 q |
| 774 | g = ulong 0 |
| 775 | while lt g get nf 0 |
| 776 | if eq src_eq get fn_poff slot get fn_pnl slot get fn_off g get fn_nl g 1 |
| 777 | put line 0 get fn_ln f |
| 778 | fail 10 |
| 779 | end |
| 780 | g = add g 1 |
| 781 | end |
| 782 | q = add q 1 |
| 783 | end |
| 784 | f = add f 1 |
| 785 | end |
| 786 | end |
| 787 | |
| 788 | fn kwconst to ulong |
| 789 | if or eq get seeded 0 0 ne get tl 0 len cword |
| 790 | ret 0 |
| 791 | end |
| 792 | for i ulong len cword |
| 793 | if ne get src add get ts 0 i get cword i |
| 794 | ret 0 |
| 795 | end |
| 796 | end |
| 797 | ret 1 |
| 798 | end |
| 799 | |
| 800 | fn constof to ulong |
| 801 | i = ulong 0 |
| 802 | while lt i get nc 0 |
| 803 | if eq same_name get co_off i get co_nl i 1 |
| 804 | ret i |
| 805 | end |
| 806 | i = add i 1 |
| 807 | end |
| 808 | ret 4096 |
| 809 | end |
| 810 | |
| 811 | note A length is a literal or a previously checked unsigned numeric constant. |
| 812 | fn tokval to ulong |
| 813 | if eq get tk 0 2 |
| 814 | ret get tw 0 |
| 815 | end |
| 816 | c = constof |
| 817 | if eq c 4096 |
| 818 | fail 16 |
| 819 | end |
| 820 | if ne get co_ty c 5 |
| 821 | fail 16 |
| 822 | end |
| 823 | ret get co_val c |
| 824 | end |
| 825 | |
| 826 | fn parsecon to void |
| 827 | tok |
| 828 | if ne get tk 0 1 |
| 829 | fail 16 |
| 830 | end |
| 831 | i = get nc 0 |
| 832 | if ge i 1024 |
| 833 | fail 14 |
| 834 | end |
| 835 | if ne constof 4096 |
| 836 | fail 10 |
| 837 | end |
| 838 | put co_off i get ts 0 |
| 839 | put co_nl i get tl 0 |
| 840 | tok |
| 841 | t = ty_of get tw 0 |
| 842 | if eq t 0 |
| 843 | fail 7 |
| 844 | end |
| 845 | tok |
| 846 | if eq get tk 0 4 |
| 847 | if eq isflt t 0 |
| 848 | fail 16 |
| 849 | end |
| 850 | fparse get ts 0 get tl 0 |
| 851 | note omc e5b32567 s_const takes only an unsuffixed float literal (error 16 for 1.5f64 too). |
| 852 | if ne get fsuf 0 0 |
| 853 | fail 16 |
| 854 | end |
| 855 | put co_ty i t |
| 856 | put co_val i fbits sub t 1 |
| 857 | put co_neg i 0 |
| 858 | put nc 0 add i 1 |
| 859 | ret |
| 860 | end |
| 861 | if ne get tk 0 2 |
| 862 | fail 24 |
| 863 | end |
| 864 | note omc: an integer literal under a float constant type is error 16. |
| 865 | if eq isflt t 1 |
| 866 | fail 16 |
| 867 | end |
| 868 | negative = ulong 0 |
| 869 | if eq get src get ts 0 45 |
| 870 | negative = 1 |
| 871 | end |
| 872 | n = node 1 0 0 negative get tw 0 |
| 873 | checknum n t |
| 874 | put co_ty i t |
| 875 | put co_val i get nv n |
| 876 | put co_neg i get nb n |
| 877 | put nc 0 add i 1 |
| 878 | end |
| 879 | |
| 880 | |
| 881 | fn add_loc o ulong n ulong ty ulong k ulong ln ulong par ulong to void |
| 882 | i = get nloc 0 |
| 883 | if ge i 32 |
| 884 | fail 14 |
| 885 | end |
| 886 | put loc_off i o |
| 887 | put loc_nl i n |
| 888 | put loc_ty i ty |
| 889 | put loc_k i k |
| 890 | put loc_len i ln |
| 891 | put loc_par i par |
| 892 | put nloc 0 add i 1 |
| 893 | end |
| 894 | |
| 895 | fn caplim n ulong old ulong ext ulong code ulong to void |
| 896 | if eq get seeded 0 0 |
| 897 | if ge n old |
| 898 | fail code |
| 899 | end |
| 900 | else |
| 901 | if ge n ext |
| 902 | fail code |
| 903 | end |
| 904 | end |
| 905 | end |
| 906 | |
| 907 | fn viewlen n ulong to void |
| 908 | if eq get seeded 0 1 |
| 909 | if or eq n 0 gt n 16777216 |
| 910 | fail 23 |
| 911 | end |
| 912 | end |
| 913 | end |
| 914 | |
| 915 | fn walk_sig rec ulong to void |
| 916 | tok |
| 917 | if ne get tk 0 1 |
| 918 | fail 16 |
| 919 | end |
| 920 | caplim get tl 0 9 65 13 |
| 921 | ix = get nf 0 |
| 922 | if eq rec 1 |
| 923 | note A function name may not be a seed keyword (16) or repeat a global or text (seed error 10, either order). |
| 924 | if eq seedkw 1 |
| 925 | fail 16 |
| 926 | end |
| 927 | if ne glob_of 99 |
| 928 | fail 10 |
| 929 | end |
| 930 | end |
| 931 | if eq rec 1 |
| 932 | if ne fn_of 4096 |
| 933 | fail 10 |
| 934 | end |
| 935 | caplim ix 32 512 14 |
| 936 | put fn_name ix get tw 0 |
| 937 | put fn_off ix get ts 0 |
| 938 | put fn_nl ix get tl 0 |
| 939 | put fn_ln ix get line 0 |
| 940 | put fn_np ix 0 |
| 941 | if eq get tw 0 1852399981 |
| 942 | put hasmain 0 1 |
| 943 | end |
| 944 | put cfi 0 ix |
| 945 | else |
| 946 | put cfi 0 fn_of |
| 947 | if eq get cfi 0 4096 |
| 948 | fail 3 |
| 949 | end |
| 950 | end |
| 951 | tok |
| 952 | while eq isw 28532 0 |
| 953 | if ne get tk 0 1 |
| 954 | fail 16 |
| 955 | end |
| 956 | note Seed s_fn parameter names: at most eight bytes (13), not a keyword (16), and never a repeat (10) of |
| 957 | note another parameter or of a global or text declared above (checked while scanning, in source order), |
| 958 | note or of any function (param_fn_sweep, once namescan knows them all, in every mode). A global or |
| 959 | note text declared below is allowed. |
| 960 | if gt get tl 0 8 |
| 961 | fail 13 |
| 962 | end |
| 963 | if eq seedkw 1 |
| 964 | fail 16 |
| 965 | end |
| 966 | if eq rec 1 |
| 967 | if or eq param_dup ix 1 ne glob_of 99 |
| 968 | fail 10 |
| 969 | end |
| 970 | end |
| 971 | po = get ts 0 |
| 972 | pn = get tl 0 |
| 973 | tok |
| 974 | pk = ulong 0 |
| 975 | pty = ulong 0 |
| 976 | pln = ulong 0 |
| 977 | if eq isw 2003134838 1 |
| 978 | pk = 2 |
| 979 | end |
| 980 | if eq isw 1953064037 1 |
| 981 | pk = 3 |
| 982 | end |
| 983 | if gt pk 0 |
| 984 | tok |
| 985 | pty = ty_of get tw 0 |
| 986 | if eq pty 0 |
| 987 | fail 7 |
| 988 | end |
| 989 | tok |
| 990 | if and eq get dynview 0 1 eq isw 42 1 |
| 991 | pln = 0 |
| 992 | else |
| 993 | pln = tokval |
| 994 | viewlen pln |
| 995 | end |
| 996 | else |
| 997 | pty = ty_of get tw 0 |
| 998 | if eq pty 0 |
| 999 | fail 7 |
| 1000 | end |
| 1001 | end |
| 1002 | if eq rec 1 |
| 1003 | caplim get fn_np ix 4 6 24 |
| 1004 | slot = add mul ix 6 get fn_np ix |
| 1005 | put fn_pt slot pty |
| 1006 | put fn_pl slot pln |
| 1007 | put fn_pk slot pk |
| 1008 | put fn_poff slot po |
| 1009 | put fn_pnl slot pn |
| 1010 | put fn_np ix add get fn_np ix 1 |
| 1011 | end |
| 1012 | tok |
| 1013 | end |
| 1014 | tok |
| 1015 | rt = ulong 10 |
| 1016 | if eq isw 1684631414 0 |
| 1017 | rt = ty_of get tw 0 |
| 1018 | if eq rt 0 |
| 1019 | fail 7 |
| 1020 | end |
| 1021 | end |
| 1022 | if eq rec 1 |
| 1023 | put fn_ret ix rt |
| 1024 | put nf 0 add ix 1 |
| 1025 | end |
| 1026 | end |
| 1027 | |
| 1028 | fn parse_global to void |
| 1029 | tok |
| 1030 | if ne get tk 0 1 |
| 1031 | fail 16 |
| 1032 | end |
| 1033 | note Seed topname: at most eight bytes (13), not a keyword (16), never a repeated top-level name (10). |
| 1034 | if gt get tl 0 8 |
| 1035 | fail 13 |
| 1036 | end |
| 1037 | if eq seedkw 1 |
| 1038 | fail 16 |
| 1039 | end |
| 1040 | if or ne glob_of 99 ne fn_of 4096 |
| 1041 | fail 10 |
| 1042 | end |
| 1043 | i = get ng 0 |
| 1044 | if ge i 8 |
| 1045 | fail 14 |
| 1046 | end |
| 1047 | put g_off i get ts 0 |
| 1048 | put g_nl i get tl 0 |
| 1049 | tok |
| 1050 | ty = ty_of get tw 0 |
| 1051 | if eq ty 12 |
| 1052 | fail 24 |
| 1053 | end |
| 1054 | if eq ty 0 |
| 1055 | fail 7 |
| 1056 | end |
| 1057 | put g_ty i ty |
| 1058 | put g_ro i 0 |
| 1059 | tok |
| 1060 | if ne get tk 0 2 |
| 1061 | fail 16 |
| 1062 | end |
| 1063 | if or eq get tw 0 0 gt get tw 0 524288 |
| 1064 | fail 23 |
| 1065 | end |
| 1066 | put g_len i get tw 0 |
| 1067 | put ng 0 add i 1 |
| 1068 | tok |
| 1069 | if and ne get tk 0 3 ne get tk 0 0 |
| 1070 | fail 16 |
| 1071 | end |
| 1072 | end |
| 1073 | |
| 1074 | note Text shares the bounded global table; its bytes and length are independent. |
| 1075 | fn parse_tx to void |
| 1076 | tok |
| 1077 | if ne get tk 0 1 |
| 1078 | fail 16 |
| 1079 | end |
| 1080 | if gt get tl 0 8 |
| 1081 | fail 13 |
| 1082 | end |
| 1083 | if eq seedkw 1 |
| 1084 | fail 16 |
| 1085 | end |
| 1086 | if or ne glob_of 99 ne fn_of 4096 |
| 1087 | fail 10 |
| 1088 | end |
| 1089 | i = get ng 0 |
| 1090 | if ge i 8 |
| 1091 | fail 14 |
| 1092 | end |
| 1093 | put g_off i get ts 0 |
| 1094 | put g_nl i get tl 0 |
| 1095 | put g_ty i 2 |
| 1096 | put g_ro i 1 |
| 1097 | put g_pos i get textuse 0 |
| 1098 | put qtext 0 1 |
| 1099 | tok |
| 1100 | put qtext 0 0 |
| 1101 | if ne get tk 0 5 |
| 1102 | fail 16 |
| 1103 | end |
| 1104 | p = get tw 0 |
| 1105 | e = add p get tl 0 |
| 1106 | while lt p e |
| 1107 | b = get src p |
| 1108 | p = add p 1 |
| 1109 | if eq b 92 |
| 1110 | b = get src p |
| 1111 | p = add p 1 |
| 1112 | if eq b 110 |
| 1113 | b = uchar 10 |
| 1114 | else |
| 1115 | if eq b 116 |
| 1116 | b = uchar 9 |
| 1117 | else |
| 1118 | if and ne b 92 ne b 34 |
| 1119 | fail 22 |
| 1120 | end |
| 1121 | end |
| 1122 | end |
| 1123 | end |
| 1124 | u = get textuse 0 |
| 1125 | if ge u 32768 |
| 1126 | fail 14 |
| 1127 | end |
| 1128 | put textbuf u b |
| 1129 | put textuse 0 add u 1 |
| 1130 | end |
| 1131 | put g_len i sub get textuse 0 get g_pos i |
| 1132 | put ng 0 add i 1 |
| 1133 | tok |
| 1134 | if and ne get tk 0 3 ne get tk 0 0 |
| 1135 | fail 16 |
| 1136 | end |
| 1137 | end |
| 1138 | |
| 1139 | fn namescan to void |
| 1140 | put cur 0 1 |
| 1141 | put line 0 1 |
| 1142 | put held 0 0 |
| 1143 | tok |
| 1144 | if eq get fsview 0 1 |
| 1145 | note Preserve the default hosted fixed-count ABI unless this unit explicitly |
| 1146 | note selects the seed-validated OM-2 runtime-extent profile. |
| 1147 | if eq kwom2 1 |
| 1148 | put dynview 0 1 |
| 1149 | end |
| 1150 | end |
| 1151 | go = ulong 1 |
| 1152 | while eq go 1 |
| 1153 | if eq get tk 0 3 |
| 1154 | go = 0 |
| 1155 | else |
| 1156 | if eq get tk 0 0 |
| 1157 | tok |
| 1158 | else |
| 1159 | if eq isw 28262 1 |
| 1160 | walk_sig 1 |
| 1161 | tok |
| 1162 | else |
| 1163 | if eq isw 119165519096935 1 |
| 1164 | parse_global |
| 1165 | else |
| 1166 | if eq kwconst 1 |
| 1167 | parsecon |
| 1168 | tok |
| 1169 | else |
| 1170 | if eq isw 1954047348 1 |
| 1171 | note Seeded modes refuse text (24) before tokenizing its bytes. |
| 1172 | if eq get seeded 0 1 |
| 1173 | fail 24 |
| 1174 | end |
| 1175 | parse_tx |
| 1176 | else |
| 1177 | while and ne get tk 0 0 ne get tk 0 3 |
| 1178 | tok |
| 1179 | end |
| 1180 | tok |
| 1181 | end |
| 1182 | end |
| 1183 | end |
| 1184 | end |
| 1185 | end |
| 1186 | end |
| 1187 | end |
| 1188 | end |
| 1189 | |
| 1190 | fn e_comma to void |
| 1191 | e_b 44 |
| 1192 | e_b 32 |
| 1193 | end |
| 1194 | |
| 1195 | fn e_dec v ulong to void |
| 1196 | x = v |
| 1197 | p = ulong 0 |
| 1198 | put digs 0 uchar add rem x 10 48 |
| 1199 | x = div x 10 |
| 1200 | p = add p 1 |
| 1201 | while gt x 0 |
| 1202 | put digs p uchar add rem x 10 48 |
| 1203 | x = div x 10 |
| 1204 | p = add p 1 |
| 1205 | end |
| 1206 | while gt p 0 |
| 1207 | p = sub p 1 |
| 1208 | e_b ulong get digs p |
| 1209 | end |
| 1210 | end |
| 1211 | |
| 1212 | fn op_of w ulong to ulong |
| 1213 | if eq w 6579297 |
| 1214 | ret 1 |
| 1215 | end |
| 1216 | if eq w 6452595 |
| 1217 | ret 2 |
| 1218 | end |
| 1219 | if eq w 7107949 |
| 1220 | ret 3 |
| 1221 | end |
| 1222 | if eq w 7760228 |
| 1223 | ret 4 |
| 1224 | end |
| 1225 | if eq w 7169394 |
| 1226 | ret 5 |
| 1227 | end |
| 1228 | if eq w 29029 |
| 1229 | ret 6 |
| 1230 | end |
| 1231 | if eq w 25966 |
| 1232 | ret 7 |
| 1233 | end |
| 1234 | if eq w 29804 |
| 1235 | ret 8 |
| 1236 | end |
| 1237 | if eq w 25964 |
| 1238 | ret 9 |
| 1239 | end |
| 1240 | if eq w 29799 |
| 1241 | ret 10 |
| 1242 | end |
| 1243 | if eq w 25959 |
| 1244 | ret 11 |
| 1245 | end |
| 1246 | if eq w 6581857 |
| 1247 | ret 12 |
| 1248 | end |
| 1249 | if eq w 29295 |
| 1250 | ret 13 |
| 1251 | end |
| 1252 | ret 0 |
| 1253 | end |
| 1254 | |
| 1255 | fn span_eq a ulong an ulong b ulong bn ulong to ulong |
| 1256 | if ne an bn |
| 1257 | ret 0 |
| 1258 | end |
| 1259 | i = ulong 0 |
| 1260 | while lt i an |
| 1261 | if ne get src add a i get src add b i |
| 1262 | ret 0 |
| 1263 | end |
| 1264 | i = add i 1 |
| 1265 | end |
| 1266 | ret 1 |
| 1267 | end |
| 1268 | |
| 1269 | |
| 1270 | fn seedstr k ulong to ulong |
| 1271 | if eq k 89 |
| 1272 | for i ulong len s89 |
| 1273 | e_b ulong get s89 i |
| 1274 | end |
| 1275 | ret 1 |
| 1276 | end |
| 1277 | if eq k 90 |
| 1278 | for i ulong len s90 |
| 1279 | e_b ulong get s90 i |
| 1280 | end |
| 1281 | ret 1 |
| 1282 | end |
| 1283 | if or eq k 98 eq k 102 |
| 1284 | for i ulong len s98 |
| 1285 | e_b ulong get s98 i |
| 1286 | end |
| 1287 | ret 1 |
| 1288 | end |
| 1289 | if eq k 105 |
| 1290 | for i ulong len s105 |
| 1291 | e_b ulong get s105 i |
| 1292 | end |
| 1293 | ret 1 |
| 1294 | end |
| 1295 | if eq k 112 |
| 1296 | for i ulong len s112 |
| 1297 | e_b ulong get s112 i |
| 1298 | end |
| 1299 | ret 1 |
| 1300 | end |
| 1301 | if eq k 114 |
| 1302 | for i ulong len s114 |
| 1303 | e_b ulong get s114 i |
| 1304 | end |
| 1305 | ret 1 |
| 1306 | end |
| 1307 | if eq k 117 |
| 1308 | for i ulong len s117 |
| 1309 | e_b ulong get s117 i |
| 1310 | end |
| 1311 | ret 1 |
| 1312 | end |
| 1313 | ret 0 |
| 1314 | end |
| 1315 | |
| 1316 | fn emitstr k ulong to void |
| 1317 | if eq get fsview 0 1 |
| 1318 | if eq fsstr k 1 |
| 1319 | ret |
| 1320 | end |
| 1321 | end |
| 1322 | if eq get seeded 0 1 |
| 1323 | if eq seedstr k 1 |
| 1324 | ret |
| 1325 | end |
| 1326 | end |
| 1327 | i = ulong 0 |
| 1328 | if eq k 0 |
| 1329 | while lt i len z0 |
| 1330 | e_b ulong get z0 i |
| 1331 | i = add i 1 |
| 1332 | end |
| 1333 | ret |
| 1334 | end |
| 1335 | if eq k 1 |
| 1336 | while lt i len z1 |
| 1337 | e_b ulong get z1 i |
| 1338 | i = add i 1 |
| 1339 | end |
| 1340 | ret |
| 1341 | end |
| 1342 | if eq k 2 |
| 1343 | while lt i len z2 |
| 1344 | e_b ulong get z2 i |
| 1345 | i = add i 1 |
| 1346 | end |
| 1347 | ret |
| 1348 | end |
| 1349 | if eq k 3 |
| 1350 | while lt i len z3 |
| 1351 | e_b ulong get z3 i |
| 1352 | i = add i 1 |
| 1353 | end |
| 1354 | ret |
| 1355 | end |
| 1356 | if eq k 4 |
| 1357 | while lt i len z4 |
| 1358 | e_b ulong get z4 i |
| 1359 | i = add i 1 |
| 1360 | end |
| 1361 | ret |
| 1362 | end |
| 1363 | if eq k 5 |
| 1364 | while lt i len z5 |
| 1365 | e_b ulong get z5 i |
| 1366 | i = add i 1 |
| 1367 | end |
| 1368 | ret |
| 1369 | end |
| 1370 | if eq k 6 |
| 1371 | while lt i len z6 |
| 1372 | e_b ulong get z6 i |
| 1373 | i = add i 1 |
| 1374 | end |
| 1375 | ret |
| 1376 | end |
| 1377 | if eq k 7 |
| 1378 | while lt i len z7 |
| 1379 | e_b ulong get z7 i |
| 1380 | i = add i 1 |
| 1381 | end |
| 1382 | ret |
| 1383 | end |
| 1384 | if eq k 8 |
| 1385 | while lt i len z8 |
| 1386 | e_b ulong get z8 i |
| 1387 | i = add i 1 |
| 1388 | end |
| 1389 | ret |
| 1390 | end |
| 1391 | if eq k 9 |
| 1392 | while lt i len z9 |
| 1393 | e_b ulong get z9 i |
| 1394 | i = add i 1 |
| 1395 | end |
| 1396 | ret |
| 1397 | end |
| 1398 | if eq k 10 |
| 1399 | while lt i len z10 |
| 1400 | e_b ulong get z10 i |
| 1401 | i = add i 1 |
| 1402 | end |
| 1403 | ret |
| 1404 | end |
| 1405 | if eq k 11 |
| 1406 | while lt i len z11 |
| 1407 | e_b ulong get z11 i |
| 1408 | i = add i 1 |
| 1409 | end |
| 1410 | ret |
| 1411 | end |
| 1412 | if eq k 12 |
| 1413 | while lt i len z12 |
| 1414 | e_b ulong get z12 i |
| 1415 | i = add i 1 |
| 1416 | end |
| 1417 | ret |
| 1418 | end |
| 1419 | if eq k 13 |
| 1420 | while lt i len z13 |
| 1421 | e_b ulong get z13 i |
| 1422 | i = add i 1 |
| 1423 | end |
| 1424 | ret |
| 1425 | end |
| 1426 | if eq k 14 |
| 1427 | while lt i len z14 |
| 1428 | e_b ulong get z14 i |
| 1429 | i = add i 1 |
| 1430 | end |
| 1431 | ret |
| 1432 | end |
| 1433 | if eq k 15 |
| 1434 | while lt i len z15 |
| 1435 | e_b ulong get z15 i |
| 1436 | i = add i 1 |
| 1437 | end |
| 1438 | ret |
| 1439 | end |
| 1440 | if eq k 16 |
| 1441 | while lt i len z16 |
| 1442 | e_b ulong get z16 i |
| 1443 | i = add i 1 |
| 1444 | end |
| 1445 | ret |
| 1446 | end |
| 1447 | if eq k 17 |
| 1448 | while lt i len z17 |
| 1449 | e_b ulong get z17 i |
| 1450 | i = add i 1 |
| 1451 | end |
| 1452 | ret |
| 1453 | end |
| 1454 | if eq k 18 |
| 1455 | while lt i len z18 |
| 1456 | e_b ulong get z18 i |
| 1457 | i = add i 1 |
| 1458 | end |
| 1459 | ret |
| 1460 | end |
| 1461 | if eq k 19 |
| 1462 | while lt i len z19 |
| 1463 | e_b ulong get z19 i |
| 1464 | i = add i 1 |
| 1465 | end |
| 1466 | ret |
| 1467 | end |
| 1468 | if eq k 20 |
| 1469 | while lt i len z20 |
| 1470 | e_b ulong get z20 i |
| 1471 | i = add i 1 |
| 1472 | end |
| 1473 | ret |
| 1474 | end |
| 1475 | if eq k 21 |
| 1476 | while lt i len z21 |
| 1477 | e_b ulong get z21 i |
| 1478 | i = add i 1 |
| 1479 | end |
| 1480 | ret |
| 1481 | end |
| 1482 | if eq k 22 |
| 1483 | while lt i len z22 |
| 1484 | e_b ulong get z22 i |
| 1485 | i = add i 1 |
| 1486 | end |
| 1487 | ret |
| 1488 | end |
| 1489 | if eq k 23 |
| 1490 | while lt i len z23 |
| 1491 | e_b ulong get z23 i |
| 1492 | i = add i 1 |
| 1493 | end |
| 1494 | ret |
| 1495 | end |
| 1496 | if eq k 24 |
| 1497 | while lt i len z24 |
| 1498 | e_b ulong get z24 i |
| 1499 | i = add i 1 |
| 1500 | end |
| 1501 | ret |
| 1502 | end |
| 1503 | if eq k 25 |
| 1504 | while lt i len z25 |
| 1505 | e_b ulong get z25 i |
| 1506 | i = add i 1 |
| 1507 | end |
| 1508 | ret |
| 1509 | end |
| 1510 | if eq k 26 |
| 1511 | while lt i len z26 |
| 1512 | e_b ulong get z26 i |
| 1513 | i = add i 1 |
| 1514 | end |
| 1515 | ret |
| 1516 | end |
| 1517 | if eq k 27 |
| 1518 | while lt i len z27 |
| 1519 | e_b ulong get z27 i |
| 1520 | i = add i 1 |
| 1521 | end |
| 1522 | ret |
| 1523 | end |
| 1524 | if eq k 28 |
| 1525 | while lt i len z28 |
| 1526 | e_b ulong get z28 i |
| 1527 | i = add i 1 |
| 1528 | end |
| 1529 | ret |
| 1530 | end |
| 1531 | if eq k 29 |
| 1532 | while lt i len z29 |
| 1533 | e_b ulong get z29 i |
| 1534 | i = add i 1 |
| 1535 | end |
| 1536 | ret |
| 1537 | end |
| 1538 | if eq k 30 |
| 1539 | while lt i len z30 |
| 1540 | e_b ulong get z30 i |
| 1541 | i = add i 1 |
| 1542 | end |
| 1543 | ret |
| 1544 | end |
| 1545 | if eq k 31 |
| 1546 | while lt i len z31 |
| 1547 | e_b ulong get z31 i |
| 1548 | i = add i 1 |
| 1549 | end |
| 1550 | ret |
| 1551 | end |
| 1552 | if eq k 32 |
| 1553 | while lt i len z32 |
| 1554 | e_b ulong get z32 i |
| 1555 | i = add i 1 |
| 1556 | end |
| 1557 | ret |
| 1558 | end |
| 1559 | if eq k 33 |
| 1560 | while lt i len z33 |
| 1561 | e_b ulong get z33 i |
| 1562 | i = add i 1 |
| 1563 | end |
| 1564 | ret |
| 1565 | end |
| 1566 | if eq k 34 |
| 1567 | while lt i len z34 |
| 1568 | e_b ulong get z34 i |
| 1569 | i = add i 1 |
| 1570 | end |
| 1571 | ret |
| 1572 | end |
| 1573 | if eq k 35 |
| 1574 | while lt i len z35 |
| 1575 | e_b ulong get z35 i |
| 1576 | i = add i 1 |
| 1577 | end |
| 1578 | ret |
| 1579 | end |
| 1580 | if eq k 36 |
| 1581 | while lt i len z36 |
| 1582 | e_b ulong get z36 i |
| 1583 | i = add i 1 |
| 1584 | end |
| 1585 | ret |
| 1586 | end |
| 1587 | if eq k 37 |
| 1588 | while lt i len z37 |
| 1589 | e_b ulong get z37 i |
| 1590 | i = add i 1 |
| 1591 | end |
| 1592 | ret |
| 1593 | end |
| 1594 | if eq k 38 |
| 1595 | while lt i len z38 |
| 1596 | e_b ulong get z38 i |
| 1597 | i = add i 1 |
| 1598 | end |
| 1599 | ret |
| 1600 | end |
| 1601 | if eq k 39 |
| 1602 | while lt i len z39 |
| 1603 | e_b ulong get z39 i |
| 1604 | i = add i 1 |
| 1605 | end |
| 1606 | ret |
| 1607 | end |
| 1608 | if eq k 40 |
| 1609 | while lt i len z40 |
| 1610 | e_b ulong get z40 i |
| 1611 | i = add i 1 |
| 1612 | end |
| 1613 | ret |
| 1614 | end |
| 1615 | if eq k 41 |
| 1616 | while lt i len z41 |
| 1617 | e_b ulong get z41 i |
| 1618 | i = add i 1 |
| 1619 | end |
| 1620 | ret |
| 1621 | end |
| 1622 | if eq k 42 |
| 1623 | while lt i len z42 |
| 1624 | e_b ulong get z42 i |
| 1625 | i = add i 1 |
| 1626 | end |
| 1627 | ret |
| 1628 | end |
| 1629 | if eq k 43 |
| 1630 | while lt i len z43 |
| 1631 | e_b ulong get z43 i |
| 1632 | i = add i 1 |
| 1633 | end |
| 1634 | ret |
| 1635 | end |
| 1636 | if eq k 44 |
| 1637 | while lt i len z44 |
| 1638 | e_b ulong get z44 i |
| 1639 | i = add i 1 |
| 1640 | end |
| 1641 | ret |
| 1642 | end |
| 1643 | if eq k 45 |
| 1644 | while lt i len z45 |
| 1645 | e_b ulong get z45 i |
| 1646 | i = add i 1 |
| 1647 | end |
| 1648 | ret |
| 1649 | end |
| 1650 | if eq k 46 |
| 1651 | while lt i len z46 |
| 1652 | e_b ulong get z46 i |
| 1653 | i = add i 1 |
| 1654 | end |
| 1655 | ret |
| 1656 | end |
| 1657 | if eq k 47 |
| 1658 | while lt i len z47 |
| 1659 | e_b ulong get z47 i |
| 1660 | i = add i 1 |
| 1661 | end |
| 1662 | ret |
| 1663 | end |
| 1664 | if eq k 48 |
| 1665 | while lt i len z48 |
| 1666 | e_b ulong get z48 i |
| 1667 | i = add i 1 |
| 1668 | end |
| 1669 | ret |
| 1670 | end |
| 1671 | if eq k 49 |
| 1672 | if eq get seeded 0 1 |
| 1673 | for j ulong len guardc |
| 1674 | e_b ulong get guardc j |
| 1675 | end |
| 1676 | ret |
| 1677 | end |
| 1678 | while lt i len z49 |
| 1679 | e_b ulong get z49 i |
| 1680 | i = add i 1 |
| 1681 | end |
| 1682 | ret |
| 1683 | end |
| 1684 | if eq k 50 |
| 1685 | while lt i len z50 |
| 1686 | e_b ulong get z50 i |
| 1687 | i = add i 1 |
| 1688 | end |
| 1689 | ret |
| 1690 | end |
| 1691 | if eq k 51 |
| 1692 | if eq get seeded 0 1 |
| 1693 | for j ulong len guardp |
| 1694 | e_b ulong get guardp j |
| 1695 | end |
| 1696 | ret |
| 1697 | end |
| 1698 | while lt i len z51 |
| 1699 | e_b ulong get z51 i |
| 1700 | i = add i 1 |
| 1701 | end |
| 1702 | ret |
| 1703 | end |
| 1704 | if eq k 52 |
| 1705 | while lt i len z52 |
| 1706 | e_b ulong get z52 i |
| 1707 | i = add i 1 |
| 1708 | end |
| 1709 | ret |
| 1710 | end |
| 1711 | if eq k 53 |
| 1712 | while lt i len z53 |
| 1713 | e_b ulong get z53 i |
| 1714 | i = add i 1 |
| 1715 | end |
| 1716 | ret |
| 1717 | end |
| 1718 | if eq k 54 |
| 1719 | while lt i len z54 |
| 1720 | e_b ulong get z54 i |
| 1721 | i = add i 1 |
| 1722 | end |
| 1723 | ret |
| 1724 | end |
| 1725 | if eq k 55 |
| 1726 | while lt i len z55 |
| 1727 | e_b ulong get z55 i |
| 1728 | i = add i 1 |
| 1729 | end |
| 1730 | ret |
| 1731 | end |
| 1732 | if eq k 56 |
| 1733 | while lt i len z56 |
| 1734 | e_b ulong get z56 i |
| 1735 | i = add i 1 |
| 1736 | end |
| 1737 | ret |
| 1738 | end |
| 1739 | if eq k 57 |
| 1740 | while lt i len z57 |
| 1741 | e_b ulong get z57 i |
| 1742 | i = add i 1 |
| 1743 | end |
| 1744 | ret |
| 1745 | end |
| 1746 | if eq k 58 |
| 1747 | while lt i len z58 |
| 1748 | e_b ulong get z58 i |
| 1749 | i = add i 1 |
| 1750 | end |
| 1751 | ret |
| 1752 | end |
| 1753 | if eq k 59 |
| 1754 | while lt i len z59 |
| 1755 | e_b ulong get z59 i |
| 1756 | i = add i 1 |
| 1757 | end |
| 1758 | ret |
| 1759 | end |
| 1760 | if eq k 60 |
| 1761 | while lt i len z60 |
| 1762 | e_b ulong get z60 i |
| 1763 | i = add i 1 |
| 1764 | end |
| 1765 | ret |
| 1766 | end |
| 1767 | if eq k 61 |
| 1768 | while lt i len z61 |
| 1769 | e_b ulong get z61 i |
| 1770 | i = add i 1 |
| 1771 | end |
| 1772 | ret |
| 1773 | end |
| 1774 | if eq k 62 |
| 1775 | while lt i len z62 |
| 1776 | e_b ulong get z62 i |
| 1777 | i = add i 1 |
| 1778 | end |
| 1779 | ret |
| 1780 | end |
| 1781 | if eq k 63 |
| 1782 | while lt i len z63 |
| 1783 | e_b ulong get z63 i |
| 1784 | i = add i 1 |
| 1785 | end |
| 1786 | ret |
| 1787 | end |
| 1788 | if eq k 64 |
| 1789 | while lt i len z64 |
| 1790 | e_b ulong get z64 i |
| 1791 | i = add i 1 |
| 1792 | end |
| 1793 | ret |
| 1794 | end |
| 1795 | if eq k 65 |
| 1796 | while lt i len z65 |
| 1797 | e_b ulong get z65 i |
| 1798 | i = add i 1 |
| 1799 | end |
| 1800 | ret |
| 1801 | end |
| 1802 | if eq k 66 |
| 1803 | while lt i len z66 |
| 1804 | e_b ulong get z66 i |
| 1805 | i = add i 1 |
| 1806 | end |
| 1807 | ret |
| 1808 | end |
| 1809 | if eq k 67 |
| 1810 | while lt i len z67 |
| 1811 | e_b ulong get z67 i |
| 1812 | i = add i 1 |
| 1813 | end |
| 1814 | ret |
| 1815 | end |
| 1816 | if eq k 68 |
| 1817 | while lt i len z68 |
| 1818 | e_b ulong get z68 i |
| 1819 | i = add i 1 |
| 1820 | end |
| 1821 | ret |
| 1822 | end |
| 1823 | if eq k 69 |
| 1824 | while lt i len z69 |
| 1825 | e_b ulong get z69 i |
| 1826 | i = add i 1 |
| 1827 | end |
| 1828 | ret |
| 1829 | end |
| 1830 | if eq k 70 |
| 1831 | while lt i len z70 |
| 1832 | e_b ulong get z70 i |
| 1833 | i = add i 1 |
| 1834 | end |
| 1835 | ret |
| 1836 | end |
| 1837 | if eq k 71 |
| 1838 | while lt i len z71 |
| 1839 | e_b ulong get z71 i |
| 1840 | i = add i 1 |
| 1841 | end |
| 1842 | ret |
| 1843 | end |
| 1844 | if eq k 72 |
| 1845 | while lt i len z72 |
| 1846 | e_b ulong get z72 i |
| 1847 | i = add i 1 |
| 1848 | end |
| 1849 | ret |
| 1850 | end |
| 1851 | if eq k 73 |
| 1852 | while lt i len z73 |
| 1853 | e_b ulong get z73 i |
| 1854 | i = add i 1 |
| 1855 | end |
| 1856 | ret |
| 1857 | end |
| 1858 | if eq k 74 |
| 1859 | while lt i len z74 |
| 1860 | e_b ulong get z74 i |
| 1861 | i = add i 1 |
| 1862 | end |
| 1863 | ret |
| 1864 | end |
| 1865 | if eq k 75 |
| 1866 | while lt i len z75 |
| 1867 | e_b ulong get z75 i |
| 1868 | i = add i 1 |
| 1869 | end |
| 1870 | ret |
| 1871 | end |
| 1872 | if eq k 76 |
| 1873 | while lt i len z76 |
| 1874 | e_b ulong get z76 i |
| 1875 | i = add i 1 |
| 1876 | end |
| 1877 | ret |
| 1878 | end |
| 1879 | if eq k 77 |
| 1880 | while lt i len z77 |
| 1881 | e_b ulong get z77 i |
| 1882 | i = add i 1 |
| 1883 | end |
| 1884 | ret |
| 1885 | end |
| 1886 | if eq k 78 |
| 1887 | while lt i len z78 |
| 1888 | e_b ulong get z78 i |
| 1889 | i = add i 1 |
| 1890 | end |
| 1891 | ret |
| 1892 | end |
| 1893 | if eq k 79 |
| 1894 | while lt i len z79 |
| 1895 | e_b ulong get z79 i |
| 1896 | i = add i 1 |
| 1897 | end |
| 1898 | ret |
| 1899 | end |
| 1900 | if eq k 80 |
| 1901 | while lt i len z80 |
| 1902 | e_b ulong get z80 i |
| 1903 | i = add i 1 |
| 1904 | end |
| 1905 | ret |
| 1906 | end |
| 1907 | if eq k 81 |
| 1908 | while lt i len z81 |
| 1909 | e_b ulong get z81 i |
| 1910 | i = add i 1 |
| 1911 | end |
| 1912 | ret |
| 1913 | end |
| 1914 | if eq k 82 |
| 1915 | while lt i len z82 |
| 1916 | e_b ulong get z82 i |
| 1917 | i = add i 1 |
| 1918 | end |
| 1919 | ret |
| 1920 | end |
| 1921 | if eq k 83 |
| 1922 | while lt i len z83 |
| 1923 | e_b ulong get z83 i |
| 1924 | i = add i 1 |
| 1925 | end |
| 1926 | ret |
| 1927 | end |
| 1928 | if eq k 84 |
| 1929 | while lt i len z84 |
| 1930 | e_b ulong get z84 i |
| 1931 | i = add i 1 |
| 1932 | end |
| 1933 | ret |
| 1934 | end |
| 1935 | if eq k 85 |
| 1936 | while lt i len z85 |
| 1937 | e_b ulong get z85 i |
| 1938 | i = add i 1 |
| 1939 | end |
| 1940 | ret |
| 1941 | end |
| 1942 | if eq k 86 |
| 1943 | while lt i len z86 |
| 1944 | e_b ulong get z86 i |
| 1945 | i = add i 1 |
| 1946 | end |
| 1947 | ret |
| 1948 | end |
| 1949 | if eq k 87 |
| 1950 | while lt i len z87 |
| 1951 | e_b ulong get z87 i |
| 1952 | i = add i 1 |
| 1953 | end |
| 1954 | ret |
| 1955 | end |
| 1956 | if eq k 88 |
| 1957 | while lt i len z88 |
| 1958 | e_b ulong get z88 i |
| 1959 | i = add i 1 |
| 1960 | end |
| 1961 | ret |
| 1962 | end |
| 1963 | if eq k 89 |
| 1964 | while lt i len z89 |
| 1965 | e_b ulong get z89 i |
| 1966 | i = add i 1 |
| 1967 | end |
| 1968 | ret |
| 1969 | end |
| 1970 | if eq k 90 |
| 1971 | while lt i len z90 |
| 1972 | e_b ulong get z90 i |
| 1973 | i = add i 1 |
| 1974 | end |
| 1975 | ret |
| 1976 | end |
| 1977 | if eq k 91 |
| 1978 | while lt i len z91 |
| 1979 | e_b ulong get z91 i |
| 1980 | i = add i 1 |
| 1981 | end |
| 1982 | ret |
| 1983 | end |
| 1984 | if eq k 92 |
| 1985 | while lt i len z92 |
| 1986 | e_b ulong get z92 i |
| 1987 | i = add i 1 |
| 1988 | end |
| 1989 | ret |
| 1990 | end |
| 1991 | if eq k 93 |
| 1992 | while lt i len z93 |
| 1993 | e_b ulong get z93 i |
| 1994 | i = add i 1 |
| 1995 | end |
| 1996 | ret |
| 1997 | end |
| 1998 | if eq k 94 |
| 1999 | while lt i len z94 |
| 2000 | e_b ulong get z94 i |
| 2001 | i = add i 1 |
| 2002 | end |
| 2003 | ret |
| 2004 | end |
| 2005 | if eq k 95 |
| 2006 | while lt i len z95 |
| 2007 | e_b ulong get z95 i |
| 2008 | i = add i 1 |
| 2009 | end |
| 2010 | ret |
| 2011 | end |
| 2012 | if eq k 96 |
| 2013 | while lt i len z96 |
| 2014 | e_b ulong get z96 i |
| 2015 | i = add i 1 |
| 2016 | end |
| 2017 | ret |
| 2018 | end |
| 2019 | if eq k 97 |
| 2020 | while lt i len z97 |
| 2021 | e_b ulong get z97 i |
| 2022 | i = add i 1 |
| 2023 | end |
| 2024 | ret |
| 2025 | end |
| 2026 | if eq k 98 |
| 2027 | while lt i len z98 |
| 2028 | e_b ulong get z98 i |
| 2029 | i = add i 1 |
| 2030 | end |
| 2031 | ret |
| 2032 | end |
| 2033 | if eq k 99 |
| 2034 | while lt i len z99 |
| 2035 | e_b ulong get z99 i |
| 2036 | i = add i 1 |
| 2037 | end |
| 2038 | ret |
| 2039 | end |
| 2040 | if eq k 100 |
| 2041 | while lt i len z100 |
| 2042 | e_b ulong get z100 i |
| 2043 | i = add i 1 |
| 2044 | end |
| 2045 | ret |
| 2046 | end |
| 2047 | if eq k 101 |
| 2048 | while lt i len z101 |
| 2049 | e_b ulong get z101 i |
| 2050 | i = add i 1 |
| 2051 | end |
| 2052 | ret |
| 2053 | end |
| 2054 | if eq k 102 |
| 2055 | while lt i len z102 |
| 2056 | e_b ulong get z102 i |
| 2057 | i = add i 1 |
| 2058 | end |
| 2059 | ret |
| 2060 | end |
| 2061 | if eq k 103 |
| 2062 | while lt i len z103 |
| 2063 | e_b ulong get z103 i |
| 2064 | i = add i 1 |
| 2065 | end |
| 2066 | ret |
| 2067 | end |
| 2068 | if eq k 104 |
| 2069 | while lt i len z104 |
| 2070 | e_b ulong get z104 i |
| 2071 | i = add i 1 |
| 2072 | end |
| 2073 | ret |
| 2074 | end |
| 2075 | if eq k 105 |
| 2076 | while lt i len z105 |
| 2077 | e_b ulong get z105 i |
| 2078 | i = add i 1 |
| 2079 | end |
| 2080 | ret |
| 2081 | end |
| 2082 | if eq k 106 |
| 2083 | while lt i len z106 |
| 2084 | e_b ulong get z106 i |
| 2085 | i = add i 1 |
| 2086 | end |
| 2087 | ret |
| 2088 | end |
| 2089 | if eq k 107 |
| 2090 | while lt i len z107 |
| 2091 | e_b ulong get z107 i |
| 2092 | i = add i 1 |
| 2093 | end |
| 2094 | ret |
| 2095 | end |
| 2096 | if eq k 108 |
| 2097 | while lt i len z108 |
| 2098 | e_b ulong get z108 i |
| 2099 | i = add i 1 |
| 2100 | end |
| 2101 | ret |
| 2102 | end |
| 2103 | if eq k 109 |
| 2104 | while lt i len z109 |
| 2105 | e_b ulong get z109 i |
| 2106 | i = add i 1 |
| 2107 | end |
| 2108 | ret |
| 2109 | end |
| 2110 | if eq k 110 |
| 2111 | while lt i len z110 |
| 2112 | e_b ulong get z110 i |
| 2113 | i = add i 1 |
| 2114 | end |
| 2115 | ret |
| 2116 | end |
| 2117 | if eq k 111 |
| 2118 | while lt i len z111 |
| 2119 | e_b ulong get z111 i |
| 2120 | i = add i 1 |
| 2121 | end |
| 2122 | ret |
| 2123 | end |
| 2124 | if eq k 112 |
| 2125 | while lt i len z112 |
| 2126 | e_b ulong get z112 i |
| 2127 | i = add i 1 |
| 2128 | end |
| 2129 | ret |
| 2130 | end |
| 2131 | if eq k 113 |
| 2132 | while lt i len z113 |
| 2133 | e_b ulong get z113 i |
| 2134 | i = add i 1 |
| 2135 | end |
| 2136 | ret |
| 2137 | end |
| 2138 | if eq k 114 |
| 2139 | while lt i len z114 |
| 2140 | e_b ulong get z114 i |
| 2141 | i = add i 1 |
| 2142 | end |
| 2143 | ret |
| 2144 | end |
| 2145 | if eq k 115 |
| 2146 | while lt i len z115 |
| 2147 | e_b ulong get z115 i |
| 2148 | i = add i 1 |
| 2149 | end |
| 2150 | ret |
| 2151 | end |
| 2152 | if eq k 116 |
| 2153 | while lt i len z116 |
| 2154 | e_b ulong get z116 i |
| 2155 | i = add i 1 |
| 2156 | end |
| 2157 | ret |
| 2158 | end |
| 2159 | if eq k 117 |
| 2160 | while lt i len z117 |
| 2161 | e_b ulong get z117 i |
| 2162 | i = add i 1 |
| 2163 | end |
| 2164 | ret |
| 2165 | end |
| 2166 | if eq k 118 |
| 2167 | while lt i len z118 |
| 2168 | e_b ulong get z118 i |
| 2169 | i = add i 1 |
| 2170 | end |
| 2171 | ret |
| 2172 | end |
| 2173 | if eq k 119 |
| 2174 | while lt i len z119 |
| 2175 | e_b ulong get z119 i |
| 2176 | i = add i 1 |
| 2177 | end |
| 2178 | ret |
| 2179 | end |
| 2180 | if eq k 120 |
| 2181 | while lt i len z120 |
| 2182 | e_b ulong get z120 i |
| 2183 | i = add i 1 |
| 2184 | end |
| 2185 | ret |
| 2186 | end |
| 2187 | if eq k 121 |
| 2188 | while lt i len z121 |
| 2189 | e_b ulong get z121 i |
| 2190 | i = add i 1 |
| 2191 | end |
| 2192 | ret |
| 2193 | end |
| 2194 | if eq k 122 |
| 2195 | while lt i len z122 |
| 2196 | e_b ulong get z122 i |
| 2197 | i = add i 1 |
| 2198 | end |
| 2199 | ret |
| 2200 | end |
| 2201 | if eq k 123 |
| 2202 | while lt i len z123 |
| 2203 | e_b ulong get z123 i |
| 2204 | i = add i 1 |
| 2205 | end |
| 2206 | ret |
| 2207 | end |
| 2208 | if eq k 124 |
| 2209 | while lt i len z124 |
| 2210 | e_b ulong get z124 i |
| 2211 | i = add i 1 |
| 2212 | end |
| 2213 | ret |
| 2214 | end |
| 2215 | if eq k 125 |
| 2216 | while lt i len z125 |
| 2217 | e_b ulong get z125 i |
| 2218 | i = add i 1 |
| 2219 | end |
| 2220 | ret |
| 2221 | end |
| 2222 | if eq k 126 |
| 2223 | while lt i len z126 |
| 2224 | e_b ulong get z126 i |
| 2225 | i = add i 1 |
| 2226 | end |
| 2227 | ret |
| 2228 | end |
| 2229 | if eq k 127 |
| 2230 | while lt i len z127 |
| 2231 | e_b ulong get z127 i |
| 2232 | i = add i 1 |
| 2233 | end |
| 2234 | ret |
| 2235 | end |
| 2236 | if eq k 129 |
| 2237 | while lt i len z129 |
| 2238 | e_b ulong get z129 i |
| 2239 | i = add i 1 |
| 2240 | end |
| 2241 | ret |
| 2242 | end |
| 2243 | if eq k 130 |
| 2244 | while lt i len z130 |
| 2245 | e_b ulong get z130 i |
| 2246 | i = add i 1 |
| 2247 | end |
| 2248 | ret |
| 2249 | end |
| 2250 | if eq k 131 |
| 2251 | while lt i len z131 |
| 2252 | e_b ulong get z131 i |
| 2253 | i = add i 1 |
| 2254 | end |
| 2255 | ret |
| 2256 | end |
| 2257 | fail 24 |
| 2258 | end |
| 2259 | |
| 2260 | note Typed nodes: literal 1, local 2, op 3, cast 4, get 5, len 6, call 7, io 8. |
| 2261 | fn node k ulong t ulong a ulong b ulong v ulong to ulong |
| 2262 | n = get nn 0 |
| 2263 | if ge n 1024 |
| 2264 | fail 14 |
| 2265 | end |
| 2266 | put nk n k |
| 2267 | put nt n t |
| 2268 | put na n a |
| 2269 | put nb n b |
| 2270 | put nv n v |
| 2271 | put nn 0 add n 1 |
| 2272 | ret n |
| 2273 | end |
| 2274 | |
| 2275 | fn width t ulong to ulong |
| 2276 | if eq t 1 |
| 2277 | ret 1 |
| 2278 | end |
| 2279 | if or eq t 2 eq t 6 |
| 2280 | ret 8 |
| 2281 | end |
| 2282 | if or eq t 3 eq t 7 |
| 2283 | ret 16 |
| 2284 | end |
| 2285 | if or or eq t 4 eq t 8 eq t 11 |
| 2286 | ret 32 |
| 2287 | end |
| 2288 | ret 64 |
| 2289 | end |
| 2290 | |
| 2291 | fn checknum n ulong t ulong to void |
| 2292 | note omc: an untyped integer literal where a float is required is mixing (error 7). |
| 2293 | if eq isflt t 1 |
| 2294 | fail 7 |
| 2295 | end |
| 2296 | v = get nv n |
| 2297 | isneg = get nb n |
| 2298 | w = width t |
| 2299 | if eq signed t 1 |
| 2300 | lim = shl ulong 1 sub w 1 |
| 2301 | if eq isneg 1 |
| 2302 | if gt sub 0 v lim |
| 2303 | fail 8 |
| 2304 | end |
| 2305 | else |
| 2306 | if ge v lim |
| 2307 | fail 8 |
| 2308 | end |
| 2309 | end |
| 2310 | else |
| 2311 | if eq isneg 1 |
| 2312 | fail 8 |
| 2313 | end |
| 2314 | if lt w 64 |
| 2315 | if ge v shl ulong 1 w |
| 2316 | fail 8 |
| 2317 | end |
| 2318 | end |
| 2319 | end |
| 2320 | put nt n t |
| 2321 | end |
| 2322 | |
| 2323 | fn expect n ulong t ulong to void |
| 2324 | if eq get nt n 0 |
| 2325 | checknum n t |
| 2326 | else |
| 2327 | if ne get nt n t |
| 2328 | fail 7 |
| 2329 | end |
| 2330 | end |
| 2331 | end |
| 2332 | |
| 2333 | fn arr to ulong |
| 2334 | tok |
| 2335 | if eq get seeded 0 1 |
| 2336 | if or eq isw 2003134838 1 eq isw 1953064037 1 |
| 2337 | tok |
| 2338 | end |
| 2339 | end |
| 2340 | l = loc_of |
| 2341 | if ne l 99 |
| 2342 | if eq get loc_k l 0 |
| 2343 | fail 7 |
| 2344 | end |
| 2345 | ret l |
| 2346 | end |
| 2347 | g = glob_of |
| 2348 | if eq g 99 |
| 2349 | fail 3 |
| 2350 | end |
| 2351 | ret add 32 g |
| 2352 | end |
| 2353 | |
| 2354 | fn aty a ulong to ulong |
| 2355 | if ge a 32 |
| 2356 | ret get g_ty sub a 32 |
| 2357 | end |
| 2358 | ret get loc_ty a |
| 2359 | end |
| 2360 | |
| 2361 | fn alen a ulong to ulong |
| 2362 | if ge a 32 |
| 2363 | ret get g_len sub a 32 |
| 2364 | end |
| 2365 | ret get loc_len a |
| 2366 | end |
| 2367 | |
| 2368 | fn writable a ulong to void |
| 2369 | if ge a 32 |
| 2370 | if eq get g_ro sub a 32 1 |
| 2371 | fail 20 |
| 2372 | end |
| 2373 | else |
| 2374 | if eq get loc_k a 2 |
| 2375 | fail 20 |
| 2376 | end |
| 2377 | end |
| 2378 | end |
| 2379 | |
| 2380 | fn expr exp ulong to ulong |
| 2381 | tok |
| 2382 | if eq get tk 0 4 |
| 2383 | if or eq get seeded 0 0 ne get target 0 0 |
| 2384 | fail 24 |
| 2385 | end |
| 2386 | fparse get ts 0 get tl 0 |
| 2387 | t = ulong 0 |
| 2388 | if eq get fsuf 0 0 |
| 2389 | if eq isflt exp 1 |
| 2390 | t = exp |
| 2391 | end |
| 2392 | else |
| 2393 | t = add get fsuf 0 10 |
| 2394 | end |
| 2395 | if eq t 0 |
| 2396 | fail 24 |
| 2397 | end |
| 2398 | ret node 1 t 0 0 fbits sub t 1 |
| 2399 | end |
| 2400 | if eq get tk 0 2 |
| 2401 | negative = ulong 0 |
| 2402 | if eq get src get ts 0 45 |
| 2403 | negative = 1 |
| 2404 | end |
| 2405 | n = node 1 0 0 negative get tw 0 |
| 2406 | note An integer literal under a float expectation stays untyped: a conversion types it as long |
| 2407 | note (omc: SCVTF, error 8 beyond long), an operand context refuses it through checknum (error 7). |
| 2408 | if and gt exp 0 eq isflt exp 0 |
| 2409 | checknum n exp |
| 2410 | end |
| 2411 | ret n |
| 2412 | end |
| 2413 | if ne get tk 0 1 |
| 2414 | fail 4 |
| 2415 | end |
| 2416 | w = get tw 0 |
| 2417 | if or eq w 1702195828 eq w 435728179558 |
| 2418 | bv = ulong 0 |
| 2419 | if eq w 1702195828 |
| 2420 | bv = 1 |
| 2421 | end |
| 2422 | ret node 1 1 0 0 bv |
| 2423 | end |
| 2424 | t = ty_of w |
| 2425 | if gt t 0 |
| 2426 | bt = ulong 0 |
| 2427 | if eq isflt t 1 |
| 2428 | bt = t |
| 2429 | end |
| 2430 | a = expr bt |
| 2431 | at = get nt a |
| 2432 | if eq at 0 |
| 2433 | if eq isflt t 1 |
| 2434 | checknum a 9 |
| 2435 | else |
| 2436 | checknum a t |
| 2437 | ret a |
| 2438 | end |
| 2439 | end |
| 2440 | if or eq isflt t 1 eq isflt at 1 |
| 2441 | note omc: bool of a float is error 9, a float of a bool is error 7. |
| 2442 | if eq t 1 |
| 2443 | fail 9 |
| 2444 | end |
| 2445 | if eq at 1 |
| 2446 | fail 7 |
| 2447 | end |
| 2448 | if eq at t |
| 2449 | ret a |
| 2450 | end |
| 2451 | end |
| 2452 | ret node 4 t a 0 0 |
| 2453 | end |
| 2454 | if and eq get seeded 0 1 eq get target 0 0 |
| 2455 | fk = floatkw |
| 2456 | if eq fk 2 |
| 2457 | tok |
| 2458 | bt = ty_of get tw 0 |
| 2459 | aa = expr 0 |
| 2460 | at = get nt aa |
| 2461 | io = ulong 0 |
| 2462 | if or and eq bt 4 eq at 11 and eq bt 11 eq at 4 |
| 2463 | io = 1 |
| 2464 | end |
| 2465 | if and eq bt 12 or eq at 5 eq at 9 |
| 2466 | io = 1 |
| 2467 | end |
| 2468 | if and eq at 12 or eq bt 5 eq bt 9 |
| 2469 | io = 1 |
| 2470 | end |
| 2471 | if eq io 0 |
| 2472 | note omc: a bitcast across widths or with a bool is error 7; a same-width pair the C target |
| 2473 | note does not lower (int/long with a float) is a capability refusal. |
| 2474 | wb = width bt |
| 2475 | if eq bt 11 |
| 2476 | wb = 32 |
| 2477 | end |
| 2478 | wa = width at |
| 2479 | if eq at 11 |
| 2480 | wa = 32 |
| 2481 | end |
| 2482 | if or ne wb wa or eq bt 1 eq at 1 |
| 2483 | fail 7 |
| 2484 | end |
| 2485 | fail 24 |
| 2486 | end |
| 2487 | ret node 9 bt aa 0 0 |
| 2488 | end |
| 2489 | if eq fk 6 |
| 2490 | ret fmanode |
| 2491 | end |
| 2492 | if or eq fk 3 eq fk 5 |
| 2493 | aa = expr 0 |
| 2494 | at = get nt aa |
| 2495 | if eq isflt at 0 |
| 2496 | fail 7 |
| 2497 | end |
| 2498 | if eq fk 5 |
| 2499 | ret node 10 at aa 0 20 |
| 2500 | end |
| 2501 | ret node 10 at aa 0 19 |
| 2502 | end |
| 2503 | end |
| 2504 | if eq w 7628135 |
| 2505 | a = arr |
| 2506 | i = expr 5 |
| 2507 | expect i 5 |
| 2508 | note Length 0 marks an unsized runtime view only for locals; globals and texts are always sized. |
| 2509 | if and eq get nk i 1 or ge a 32 ne alen a 0 |
| 2510 | if ge get nv i alen a |
| 2511 | fail 21 |
| 2512 | end |
| 2513 | end |
| 2514 | ret node 5 aty a a i 0 |
| 2515 | end |
| 2516 | if eq w 7234924 |
| 2517 | a = arr |
| 2518 | ret node 6 5 a 0 0 |
| 2519 | end |
| 2520 | if or eq w 1684104562 eq w 435744764535 |
| 2521 | if eq get hasmain 0 0 |
| 2522 | fail 24 |
| 2523 | end |
| 2524 | fd = expr 8 |
| 2525 | expect fd 8 |
| 2526 | a = arr |
| 2527 | if ne aty a 2 |
| 2528 | fail 7 |
| 2529 | end |
| 2530 | if eq w 1684104562 |
| 2531 | writable a |
| 2532 | end |
| 2533 | off = expr 5 |
| 2534 | expect off 5 |
| 2535 | cnt = expr 5 |
| 2536 | expect cnt 5 |
| 2537 | io = ulong 1 |
| 2538 | if eq w 435744764535 |
| 2539 | io = 2 |
| 2540 | end |
| 2541 | p = node 8 9 fd off io |
| 2542 | put nx p cnt |
| 2543 | put ny p a |
| 2544 | ret p |
| 2545 | end |
| 2546 | op = op_of w |
| 2547 | if eq w 7499640 |
| 2548 | op = 14 |
| 2549 | end |
| 2550 | if eq w 7104627 |
| 2551 | op = 15 |
| 2552 | end |
| 2553 | if eq w 7497843 |
| 2554 | op = 16 |
| 2555 | end |
| 2556 | if eq w 6776174 |
| 2557 | op = 17 |
| 2558 | end |
| 2559 | if eq w 7630702 |
| 2560 | op = 18 |
| 2561 | end |
| 2562 | if gt op 0 |
| 2563 | a = expr 0 |
| 2564 | b = ulong 0 |
| 2565 | if lt op 17 |
| 2566 | b = expr mul isflt get nt a get nt a |
| 2567 | if and eq get nt a 0 eq get nt b 0 |
| 2568 | fail 11 |
| 2569 | end |
| 2570 | if eq get nt a 0 |
| 2571 | checknum a get nt b |
| 2572 | end |
| 2573 | if eq get nt b 0 |
| 2574 | checknum b get nt a |
| 2575 | end |
| 2576 | if and ne op 15 ne op 16 |
| 2577 | if ne get nt a get nt b |
| 2578 | fail 7 |
| 2579 | end |
| 2580 | end |
| 2581 | else |
| 2582 | if eq get nt a 0 |
| 2583 | fail 11 |
| 2584 | end |
| 2585 | end |
| 2586 | t = get nt a |
| 2587 | if eq isflt t 1 |
| 2588 | if or eq op 5 and ge op 12 ne op 17 |
| 2589 | fail 7 |
| 2590 | end |
| 2591 | end |
| 2592 | if and eq isflt t 0 lt op 17 |
| 2593 | if eq isflt get nt b 1 |
| 2594 | note omc accepts a float shift count; this converter does not lower it. |
| 2595 | if or eq op 15 eq op 16 |
| 2596 | fail 24 |
| 2597 | end |
| 2598 | fail 7 |
| 2599 | end |
| 2600 | end |
| 2601 | rt = t |
| 2602 | if and ge op 6 le op 11 |
| 2603 | rt = 1 |
| 2604 | end |
| 2605 | n = node 3 rt a b op |
| 2606 | put nx n t |
| 2607 | ret n |
| 2608 | end |
| 2609 | c = constof |
| 2610 | if ne c 4096 |
| 2611 | ret node 1 get co_ty c 0 get co_neg c get co_val c |
| 2612 | end |
| 2613 | f = fn_of |
| 2614 | if ne f 4096 |
| 2615 | ret callnode f |
| 2616 | end |
| 2617 | l = loc_of |
| 2618 | if eq l 99 |
| 2619 | fail 3 |
| 2620 | end |
| 2621 | if ne get loc_k l 0 |
| 2622 | fail 7 |
| 2623 | end |
| 2624 | ret node 2 get loc_ty l l 0 0 |
| 2625 | end |
| 2626 | |
| 2627 | fn callnode f ulong to ulong |
| 2628 | n = node 7 get fn_ret f 0 0 f |
| 2629 | i = ulong 0 |
| 2630 | while lt i get fn_np f |
| 2631 | slot = add mul f 6 i |
| 2632 | arg = ulong 0 |
| 2633 | if gt get fn_pk slot 0 |
| 2634 | arg = arr |
| 2635 | if ne aty arg get fn_pt slot |
| 2636 | fail 7 |
| 2637 | end |
| 2638 | if ne get fn_pl slot 0 |
| 2639 | if ne alen arg get fn_pl slot |
| 2640 | fail 7 |
| 2641 | end |
| 2642 | end |
| 2643 | if ge arg 32 |
| 2644 | if eq get g_ro sub arg 32 0 |
| 2645 | fail 19 |
| 2646 | end |
| 2647 | end |
| 2648 | if eq get fn_pk slot 3 |
| 2649 | writable arg |
| 2650 | end |
| 2651 | j = ulong 0 |
| 2652 | while lt j i |
| 2653 | s = add mul f 6 j |
| 2654 | if gt get fn_pk s 0 |
| 2655 | if eq get args add mul n 6 j arg |
| 2656 | fail 19 |
| 2657 | end |
| 2658 | end |
| 2659 | j = add j 1 |
| 2660 | end |
| 2661 | else |
| 2662 | arg = expr get fn_pt slot |
| 2663 | expect arg get fn_pt slot |
| 2664 | end |
| 2665 | put args add mul n 6 i arg |
| 2666 | i = add i 1 |
| 2667 | end |
| 2668 | ret n |
| 2669 | end |
| 2670 | |
| 2671 | fn named ch ulong n ulong to void |
| 2672 | e_b ch |
| 2673 | e_dec n |
| 2674 | end |
| 2675 | |
| 2676 | fn arrp a ulong to void |
| 2677 | if ge a 32 |
| 2678 | named 103 sub a 32 |
| 2679 | else |
| 2680 | named 118 a |
| 2681 | end |
| 2682 | end |
| 2683 | |
| 2684 | fn arrn a ulong to void |
| 2685 | arrp a |
| 2686 | emitstr 2 |
| 2687 | end |
| 2688 | |
| 2689 | fn indent to void |
| 2690 | if eq get target 0 1 |
| 2691 | i = ulong 0 |
| 2692 | while lt i get bd 0 |
| 2693 | emitstr 3 |
| 2694 | i = add i 1 |
| 2695 | end |
| 2696 | end |
| 2697 | end |
| 2698 | |
| 2699 | fn semi to void |
| 2700 | if eq get target 0 0 |
| 2701 | e_b 59 |
| 2702 | end |
| 2703 | e_b 10 |
| 2704 | end |
| 2705 | |
| 2706 | fn euint to void |
| 2707 | if eq get target 0 0 |
| 2708 | emitstr 4 |
| 2709 | end |
| 2710 | end |
| 2711 | |
| 2712 | fn eexpr0 n ulong to void |
| 2713 | k = get nk n |
| 2714 | t = get nt n |
| 2715 | a = get na n |
| 2716 | b = get nb n |
| 2717 | v = get nv n |
| 2718 | py = get target 0 |
| 2719 | if eq k 1 |
| 2720 | e_dec v |
| 2721 | if eq py 0 |
| 2722 | emitstr 5 |
| 2723 | end |
| 2724 | ret |
| 2725 | end |
| 2726 | if eq k 2 |
| 2727 | named 118 a |
| 2728 | ret |
| 2729 | end |
| 2730 | if eq k 6 |
| 2731 | arrn a |
| 2732 | ret |
| 2733 | end |
| 2734 | if eq k 9 |
| 2735 | eexpr a |
| 2736 | ret |
| 2737 | end |
| 2738 | if eq k 11 |
| 2739 | emitfma t a b v |
| 2740 | ret |
| 2741 | end |
| 2742 | if eq k 10 |
| 2743 | emitfloat v t a b |
| 2744 | ret |
| 2745 | end |
| 2746 | if eq k 4 |
| 2747 | if or eq isflt t 1 eq isflt get nt a 1 |
| 2748 | for j ulong len fcvcall |
| 2749 | e_b ulong get fcvcall j |
| 2750 | end |
| 2751 | else |
| 2752 | emitstr 6 |
| 2753 | end |
| 2754 | e_dec t |
| 2755 | e_comma |
| 2756 | e_dec get nt a |
| 2757 | e_comma |
| 2758 | eexpr a |
| 2759 | e_b 41 |
| 2760 | ret |
| 2761 | end |
| 2762 | if eq k 5 |
| 2763 | emitstr 7 |
| 2764 | arrp a |
| 2765 | e_comma |
| 2766 | arrn a |
| 2767 | e_comma |
| 2768 | eexpr b |
| 2769 | e_comma |
| 2770 | e_dec t |
| 2771 | e_b 41 |
| 2772 | ret |
| 2773 | end |
| 2774 | if eq k 3 |
| 2775 | if eq isflt get nx n 1 |
| 2776 | emitfloat v get nx n a b |
| 2777 | ret |
| 2778 | end |
| 2779 | if eq py 0 |
| 2780 | emitstr 8 |
| 2781 | eexpr a |
| 2782 | emitstr 9 |
| 2783 | if lt v 17 |
| 2784 | eexpr b |
| 2785 | else |
| 2786 | e_b 48 |
| 2787 | end |
| 2788 | emitstr 10 |
| 2789 | else |
| 2790 | emitstr 11 |
| 2791 | end |
| 2792 | e_dec v |
| 2793 | e_comma |
| 2794 | e_dec get nx n |
| 2795 | e_comma |
| 2796 | if eq py 0 |
| 2797 | emitstr 12 |
| 2798 | else |
| 2799 | eexpr a |
| 2800 | e_comma |
| 2801 | if lt v 17 |
| 2802 | eexpr b |
| 2803 | else |
| 2804 | e_b 48 |
| 2805 | end |
| 2806 | e_b 41 |
| 2807 | end |
| 2808 | ret |
| 2809 | end |
| 2810 | if eq k 7 |
| 2811 | ecall n |
| 2812 | ret |
| 2813 | end |
| 2814 | if eq k 8 |
| 2815 | if eq py 0 |
| 2816 | emitstr 13 |
| 2817 | eexpr a |
| 2818 | emitstr 14 |
| 2819 | eexpr b |
| 2820 | emitstr 15 |
| 2821 | eexpr get nx n |
| 2822 | emitstr 16 |
| 2823 | else |
| 2824 | emitstr 17 |
| 2825 | end |
| 2826 | e_dec v |
| 2827 | e_comma |
| 2828 | if eq py 0 |
| 2829 | emitstr 18 |
| 2830 | else |
| 2831 | eexpr a |
| 2832 | end |
| 2833 | e_comma |
| 2834 | arrp get ny n |
| 2835 | e_comma |
| 2836 | arrn get ny n |
| 2837 | e_comma |
| 2838 | if eq py 0 |
| 2839 | emitstr 19 |
| 2840 | else |
| 2841 | eexpr b |
| 2842 | e_comma |
| 2843 | eexpr get nx n |
| 2844 | e_b 41 |
| 2845 | end |
| 2846 | ret |
| 2847 | end |
| 2848 | fail 16 |
| 2849 | end |
| 2850 | |
| 2851 | fn earray a ulong n ulong t ulong init ulong to void |
| 2852 | indent |
| 2853 | if eq get target 0 0 |
| 2854 | if eq signed t 0 |
| 2855 | e_b 117 |
| 2856 | end |
| 2857 | emitstr 20 |
| 2858 | e_dec width t |
| 2859 | emitstr 21 |
| 2860 | arrp a |
| 2861 | e_b 91 |
| 2862 | e_dec n |
| 2863 | emitstr 22 |
| 2864 | else |
| 2865 | arrp a |
| 2866 | if eq t 2 |
| 2867 | emitstr 23 |
| 2868 | e_dec n |
| 2869 | emitstr 24 |
| 2870 | else |
| 2871 | emitstr 25 |
| 2872 | e_dec n |
| 2873 | e_b 10 |
| 2874 | end |
| 2875 | end |
| 2876 | indent |
| 2877 | euint |
| 2878 | arrn a |
| 2879 | e_b 61 |
| 2880 | e_dec n |
| 2881 | semi |
| 2882 | if ne init 9999 |
| 2883 | indent |
| 2884 | emitstr 26 |
| 2885 | arrp a |
| 2886 | e_comma |
| 2887 | arrn a |
| 2888 | e_comma |
| 2889 | eexpr init |
| 2890 | e_comma |
| 2891 | e_dec t |
| 2892 | e_b 41 |
| 2893 | semi |
| 2894 | end |
| 2895 | end |
| 2896 | |
| 2897 | fn signature f ulong to void |
| 2898 | if eq get target 0 0 |
| 2899 | emitstr 27 |
| 2900 | else |
| 2901 | emitstr 28 |
| 2902 | end |
| 2903 | named 102 f |
| 2904 | e_b 40 |
| 2905 | if eq get fsview 0 1 |
| 2906 | fsput 1 |
| 2907 | if gt get fn_np f 0 |
| 2908 | e_comma |
| 2909 | end |
| 2910 | end |
| 2911 | i = ulong 0 |
| 2912 | while lt i get fn_np f |
| 2913 | if gt i 0 |
| 2914 | e_comma |
| 2915 | end |
| 2916 | s = add mul f 6 i |
| 2917 | if gt get fn_pk s 0 |
| 2918 | if eq get target 0 0 |
| 2919 | viewqual get fn_pk s |
| 2920 | emitstr 29 |
| 2921 | end |
| 2922 | named 118 i |
| 2923 | e_comma |
| 2924 | euint |
| 2925 | named 118 i |
| 2926 | emitstr 30 |
| 2927 | else |
| 2928 | euint |
| 2929 | named 118 i |
| 2930 | end |
| 2931 | i = add i 1 |
| 2932 | end |
| 2933 | if and and eq get target 0 0 eq i 0 eq get fsview 0 0 |
| 2934 | emitstr 31 |
| 2935 | end |
| 2936 | e_b 41 |
| 2937 | end |
| 2938 | |
| 2939 | fn eassign to void |
| 2940 | o = get ts 0 |
| 2941 | n = get tl 0 |
| 2942 | known = loc_of |
| 2943 | if ne glob_of 99 |
| 2944 | fail 7 |
| 2945 | end |
| 2946 | if gt n 8 |
| 2947 | fail 13 |
| 2948 | end |
| 2949 | note A local named with a seed keyword is a seed error (9 or 16 by statement); refuse 16. |
| 2950 | if eq seedkw 1 |
| 2951 | fail 16 |
| 2952 | end |
| 2953 | tok |
| 2954 | if eq isw 61 1 |
| 2955 | tok |
| 2956 | end |
| 2957 | if eq isw 7824750 1 |
| 2958 | if ne known 99 |
| 2959 | fail 7 |
| 2960 | end |
| 2961 | tok |
| 2962 | t = ty_of get tw 0 |
| 2963 | if eq t 12 |
| 2964 | fail 24 |
| 2965 | end |
| 2966 | if lt t 2 |
| 2967 | fail 7 |
| 2968 | end |
| 2969 | tok |
| 2970 | if ne get tk 0 2 |
| 2971 | fail 16 |
| 2972 | end |
| 2973 | ln = get tw 0 |
| 2974 | if or eq ln 0 gt ln 524288 |
| 2975 | fail 23 |
| 2976 | end |
| 2977 | sz = mul ln div width t 8 |
| 2978 | put localuse 0 add get localuse 0 sz |
| 2979 | if eq get seeded 0 0 |
| 2980 | if gt get localuse 0 32768 |
| 2981 | fail 23 |
| 2982 | end |
| 2983 | else |
| 2984 | if gt get localuse 0 16777216 |
| 2985 | fail 23 |
| 2986 | end |
| 2987 | end |
| 2988 | v = expr t |
| 2989 | expect v t |
| 2990 | l = get nloc 0 |
| 2991 | add_loc o n t 1 ln 0 |
| 2992 | earray l ln t v |
| 2993 | else |
| 2994 | put held 0 1 |
| 2995 | t = ulong 0 |
| 2996 | if ne known 99 |
| 2997 | t = get loc_ty known |
| 2998 | end |
| 2999 | v = expr t |
| 3000 | if eq get nt v 0 |
| 3001 | fail 11 |
| 3002 | end |
| 3003 | if eq get nt v 10 |
| 3004 | fail 7 |
| 3005 | end |
| 3006 | indent |
| 3007 | if eq known 99 |
| 3008 | known = get nloc 0 |
| 3009 | add_loc o n get nt v 0 0 0 |
| 3010 | euint |
| 3011 | if and eq get target 0 0 eq get seeded 0 1 |
| 3012 | for j ulong len unused |
| 3013 | e_b ulong get unused j |
| 3014 | end |
| 3015 | end |
| 3016 | else |
| 3017 | expect v t |
| 3018 | if ne get loc_k known 0 |
| 3019 | fail 7 |
| 3020 | end |
| 3021 | end |
| 3022 | named 118 known |
| 3023 | e_b 61 |
| 3024 | eexpr v |
| 3025 | semi |
| 3026 | end |
| 3027 | end |
| 3028 | |
| 3029 | fn eput to void |
| 3030 | a = arr |
| 3031 | writable a |
| 3032 | i = expr 5 |
| 3033 | expect i 5 |
| 3034 | note A literal index past a sized array is the seed's error 21 for put as for get. |
| 3035 | if and eq get nk i 1 or ge a 32 ne alen a 0 |
| 3036 | if ge get nv i alen a |
| 3037 | fail 21 |
| 3038 | end |
| 3039 | end |
| 3040 | v = expr aty a |
| 3041 | expect v aty a |
| 3042 | indent |
| 3043 | if eq get target 0 0 |
| 3044 | emitstr 32 |
| 3045 | eexpr i |
| 3046 | emitstr 33 |
| 3047 | eexpr v |
| 3048 | emitstr 34 |
| 3049 | else |
| 3050 | emitstr 35 |
| 3051 | end |
| 3052 | arrp a |
| 3053 | e_comma |
| 3054 | arrn a |
| 3055 | e_comma |
| 3056 | if eq get target 0 0 |
| 3057 | emitstr 36 |
| 3058 | else |
| 3059 | eexpr i |
| 3060 | e_comma |
| 3061 | eexpr v |
| 3062 | e_comma |
| 3063 | end |
| 3064 | e_dec aty a |
| 3065 | e_b 41 |
| 3066 | if eq get target 0 0 |
| 3067 | emitstr 37 |
| 3068 | else |
| 3069 | e_b 10 |
| 3070 | end |
| 3071 | end |
| 3072 | |
| 3073 | fn block k ulong to void |
| 3074 | d = get bd 0 |
| 3075 | if ge d 32 |
| 3076 | fail 14 |
| 3077 | end |
| 3078 | put bk d k |
| 3079 | put saved d get nloc 0 |
| 3080 | put bd 0 add d 1 |
| 3081 | if eq get target 0 0 |
| 3082 | emitstr 38 |
| 3083 | else |
| 3084 | emitstr 39 |
| 3085 | indent |
| 3086 | emitstr 40 |
| 3087 | end |
| 3088 | end |
| 3089 | |
| 3090 | fn efor to void |
| 3091 | tok |
| 3092 | o = get ts 0 |
| 3093 | n = get tl 0 |
| 3094 | tok |
| 3095 | t = ty_of get tw 0 |
| 3096 | if lt t 2 |
| 3097 | fail 7 |
| 3098 | end |
| 3099 | v = expr t |
| 3100 | expect v t |
| 3101 | d = get bd 0 |
| 3102 | l = get nloc 0 |
| 3103 | if eq get target 0 0 |
| 3104 | emitstr 41 |
| 3105 | end |
| 3106 | put saved d l |
| 3107 | add_loc o n t 0 0 0 |
| 3108 | indent |
| 3109 | euint |
| 3110 | named 118 l |
| 3111 | emitstr 42 |
| 3112 | semi |
| 3113 | lim = get nk v |
| 3114 | if ne lim 2 |
| 3115 | indent |
| 3116 | euint |
| 3117 | named 107 d |
| 3118 | e_b 61 |
| 3119 | eexpr v |
| 3120 | semi |
| 3121 | end |
| 3122 | if ne lim 1 |
| 3123 | indent |
| 3124 | euint |
| 3125 | named 99 d |
| 3126 | emitstr 43 |
| 3127 | semi |
| 3128 | end |
| 3129 | indent |
| 3130 | if eq get target 0 0 |
| 3131 | emitstr 44 |
| 3132 | else |
| 3133 | emitstr 45 |
| 3134 | end |
| 3135 | e_dec t |
| 3136 | e_comma |
| 3137 | named 118 l |
| 3138 | e_comma |
| 3139 | if eq lim 2 |
| 3140 | eexpr v |
| 3141 | else |
| 3142 | named 107 d |
| 3143 | end |
| 3144 | e_b 41 |
| 3145 | if eq get target 0 0 |
| 3146 | e_b 59 |
| 3147 | named 118 l |
| 3148 | emitstr 46 |
| 3149 | e_dec t |
| 3150 | e_comma |
| 3151 | named 118 l |
| 3152 | emitstr 47 |
| 3153 | end |
| 3154 | block 5 |
| 3155 | put saved d l |
| 3156 | put loopvar d l |
| 3157 | put loopty d t |
| 3158 | if ne lim 1 |
| 3159 | indent |
| 3160 | if eq get target 0 0 |
| 3161 | emitstr 48 |
| 3162 | named 99 d |
| 3163 | emitstr 49 |
| 3164 | else |
| 3165 | emitstr 50 |
| 3166 | named 99 d |
| 3167 | emitstr 51 |
| 3168 | indent |
| 3169 | named 99 d |
| 3170 | emitstr 52 |
| 3171 | end |
| 3172 | end |
| 3173 | end |
| 3174 | |
| 3175 | fn kwbreak to ulong |
| 3176 | if or eq get seeded 0 0 ne get tl 0 len bword |
| 3177 | ret 0 |
| 3178 | end |
| 3179 | for i ulong len bword |
| 3180 | if ne get src add get ts 0 i get bword i |
| 3181 | ret 0 |
| 3182 | end |
| 3183 | end |
| 3184 | ret 1 |
| 3185 | end |
| 3186 | |
| 3187 | fn ebreak to void |
| 3188 | d = get bd 0 |
| 3189 | found = ulong 0 |
| 3190 | while gt d 0 |
| 3191 | d = sub d 1 |
| 3192 | if or eq get bk d 4 eq get bk d 5 |
| 3193 | found = 1 |
| 3194 | end |
| 3195 | end |
| 3196 | if eq found 0 |
| 3197 | fail 15 |
| 3198 | end |
| 3199 | indent |
| 3200 | if eq get target 0 0 |
| 3201 | for i ulong len breakc |
| 3202 | e_b ulong get breakc i |
| 3203 | end |
| 3204 | else |
| 3205 | for i ulong len breakp |
| 3206 | e_b ulong get breakp i |
| 3207 | end |
| 3208 | end |
| 3209 | end |
| 3210 | |
| 3211 | fn eone to ulong |
| 3212 | w = get tw 0 |
| 3213 | if eq kwcont 1 |
| 3214 | econt |
| 3215 | ret 1 |
| 3216 | end |
| 3217 | if eq kwbreak 1 |
| 3218 | ebreak |
| 3219 | ret 1 |
| 3220 | end |
| 3221 | if eq w 1702129518 |
| 3222 | while and ne get tk 0 0 ne get tk 0 3 |
| 3223 | tok |
| 3224 | end |
| 3225 | put held 0 1 |
| 3226 | ret 1 |
| 3227 | end |
| 3228 | if eq w 6581861 |
| 3229 | d = sub get bd 0 1 |
| 3230 | if and eq get target 0 1 eq get bk d 5 |
| 3231 | indent |
| 3232 | named 118 get loopvar d |
| 3233 | emitstr 53 |
| 3234 | e_dec get loopty d |
| 3235 | e_comma |
| 3236 | named 118 get loopvar d |
| 3237 | emitstr 54 |
| 3238 | end |
| 3239 | if eq d 0 |
| 3240 | if eq get fn_ret get cfi 0 10 |
| 3241 | indent |
| 3242 | emitstr 55 |
| 3243 | semi |
| 3244 | end |
| 3245 | end |
| 3246 | put bd 0 d |
| 3247 | put nloc 0 get saved d |
| 3248 | if eq get target 0 0 |
| 3249 | if and eq d 0 eq get fsview 0 1 |
| 3250 | fsput 5 |
| 3251 | end |
| 3252 | emitstr 56 |
| 3253 | if or eq get bk d 4 eq get bk d 5 |
| 3254 | emitstr 57 |
| 3255 | end |
| 3256 | end |
| 3257 | if eq d 0 |
| 3258 | ret 0 |
| 3259 | end |
| 3260 | ret 1 |
| 3261 | end |
| 3262 | if eq w 1702063205 |
| 3263 | d = sub get bd 0 1 |
| 3264 | if ne get bk d 2 |
| 3265 | fail 15 |
| 3266 | end |
| 3267 | put nloc 0 get saved d |
| 3268 | put bd 0 d |
| 3269 | indent |
| 3270 | if eq get target 0 0 |
| 3271 | emitstr 58 |
| 3272 | else |
| 3273 | emitstr 59 |
| 3274 | end |
| 3275 | put bd 0 add d 1 |
| 3276 | put bk d 3 |
| 3277 | indent |
| 3278 | if eq get target 0 1 |
| 3279 | emitstr 60 |
| 3280 | end |
| 3281 | ret 1 |
| 3282 | end |
| 3283 | if eq w 26217 |
| 3284 | v = expr 1 |
| 3285 | expect v 1 |
| 3286 | indent |
| 3287 | emitstr 61 |
| 3288 | eexpr v |
| 3289 | e_b 41 |
| 3290 | block 2 |
| 3291 | ret 1 |
| 3292 | end |
| 3293 | if eq w 435610544247 |
| 3294 | v = expr 1 |
| 3295 | expect v 1 |
| 3296 | limit = ulong 1000000 |
| 3297 | tok |
| 3298 | if eq isw 431349919586 1 |
| 3299 | tok |
| 3300 | if ne get tk 0 2 |
| 3301 | fail 16 |
| 3302 | end |
| 3303 | limit = get tw 0 |
| 3304 | else |
| 3305 | put held 0 1 |
| 3306 | end |
| 3307 | d = get bd 0 |
| 3308 | if eq get target 0 0 |
| 3309 | emitstr 62 |
| 3310 | end |
| 3311 | indent |
| 3312 | euint |
| 3313 | named 99 d |
| 3314 | emitstr 63 |
| 3315 | semi |
| 3316 | indent |
| 3317 | emitstr 64 |
| 3318 | eexpr v |
| 3319 | e_b 41 |
| 3320 | block 4 |
| 3321 | indent |
| 3322 | if eq get target 0 0 |
| 3323 | emitstr 65 |
| 3324 | named 99 d |
| 3325 | emitstr 66 |
| 3326 | e_dec limit |
| 3327 | emitstr 67 |
| 3328 | else |
| 3329 | emitstr 68 |
| 3330 | named 99 d |
| 3331 | emitstr 69 |
| 3332 | e_dec limit |
| 3333 | emitstr 70 |
| 3334 | indent |
| 3335 | named 99 d |
| 3336 | emitstr 71 |
| 3337 | end |
| 3338 | ret 1 |
| 3339 | end |
| 3340 | if eq w 7499622 |
| 3341 | efor |
| 3342 | ret 1 |
| 3343 | end |
| 3344 | if eq w 7628146 |
| 3345 | t = get fn_ret get cfi 0 |
| 3346 | v = ulong 0 |
| 3347 | if ne t 10 |
| 3348 | v = expr t |
| 3349 | expect v t |
| 3350 | end |
| 3351 | indent |
| 3352 | emitstr 72 |
| 3353 | if eq t 10 |
| 3354 | e_b 48 |
| 3355 | else |
| 3356 | eexpr v |
| 3357 | end |
| 3358 | e_b 41 |
| 3359 | semi |
| 3360 | ret 1 |
| 3361 | end |
| 3362 | if eq w 1953069157 |
| 3363 | if eq get hasmain 0 0 |
| 3364 | fail 24 |
| 3365 | end |
| 3366 | v = expr 8 |
| 3367 | expect v 8 |
| 3368 | indent |
| 3369 | if eq get target 0 0 |
| 3370 | emitstr 73 |
| 3371 | else |
| 3372 | emitstr 74 |
| 3373 | end |
| 3374 | eexpr v |
| 3375 | emitstr 75 |
| 3376 | semi |
| 3377 | ret 1 |
| 3378 | end |
| 3379 | if eq w 7632240 |
| 3380 | eput |
| 3381 | ret 1 |
| 3382 | end |
| 3383 | f = fn_of |
| 3384 | if ne f 4096 |
| 3385 | if ne get fn_ret f 10 |
| 3386 | fail 7 |
| 3387 | end |
| 3388 | put held 0 1 |
| 3389 | v = expr 0 |
| 3390 | indent |
| 3391 | eexpr v |
| 3392 | semi |
| 3393 | ret 1 |
| 3394 | end |
| 3395 | eassign |
| 3396 | ret 1 |
| 3397 | end |
| 3398 | |
| 3399 | fn efn to void |
| 3400 | walk_sig 0 |
| 3401 | f = get cfi 0 |
| 3402 | signature f |
| 3403 | if eq get target 0 0 |
| 3404 | emitstr 76 |
| 3405 | else |
| 3406 | emitstr 77 |
| 3407 | end |
| 3408 | if ne get abmode 0 0 |
| 3409 | if ne get abfimp f 0 |
| 3410 | ab_thunk f |
| 3411 | ret |
| 3412 | end |
| 3413 | end |
| 3414 | put nloc 0 0 |
| 3415 | put localuse 0 0 |
| 3416 | i = ulong 0 |
| 3417 | while lt i get fn_np f |
| 3418 | s = add mul f 6 i |
| 3419 | add_loc get fn_poff s get fn_pnl s get fn_pt s get fn_pk s get fn_pl s 1 |
| 3420 | i = add i 1 |
| 3421 | end |
| 3422 | put bd 0 1 |
| 3423 | indent |
| 3424 | emitstr 78 |
| 3425 | semi |
| 3426 | go = ulong 1 |
| 3427 | while eq go 1 |
| 3428 | tok |
| 3429 | if eq get tk 0 3 |
| 3430 | fail 15 |
| 3431 | end |
| 3432 | if ne get tk 0 0 |
| 3433 | put nn 0 0 |
| 3434 | go = eone |
| 3435 | tok |
| 3436 | if and ne get tk 0 0 ne get tk 0 3 |
| 3437 | fail 16 |
| 3438 | end |
| 3439 | put held 0 1 |
| 3440 | end |
| 3441 | end |
| 3442 | end |
| 3443 | |
| 3444 | note Numeric byte initializers cannot inject target syntax or merge hex escapes. |
| 3445 | fn etext i ulong to void |
| 3446 | n = get g_len i |
| 3447 | if eq get target 0 0 |
| 3448 | emitstr 129 |
| 3449 | arrp add 32 i |
| 3450 | e_b 91 |
| 3451 | if eq n 0 |
| 3452 | e_b 49 |
| 3453 | else |
| 3454 | e_dec n |
| 3455 | end |
| 3456 | e_b 93 |
| 3457 | e_b 61 |
| 3458 | e_b 123 |
| 3459 | else |
| 3460 | arrp add 32 i |
| 3461 | emitstr 130 |
| 3462 | end |
| 3463 | j = ulong 0 |
| 3464 | while lt j n |
| 3465 | e_dec ulong get textbuf add get g_pos i j |
| 3466 | e_b 44 |
| 3467 | j = add j 1 |
| 3468 | end |
| 3469 | if eq get target 0 0 |
| 3470 | if eq n 0 |
| 3471 | e_b 48 |
| 3472 | end |
| 3473 | e_b 125 |
| 3474 | else |
| 3475 | e_b 41 |
| 3476 | e_b 41 |
| 3477 | end |
| 3478 | semi |
| 3479 | if eq get target 0 0 |
| 3480 | emitstr 131 |
| 3481 | end |
| 3482 | arrn add 32 i |
| 3483 | e_b 61 |
| 3484 | e_dec n |
| 3485 | semi |
| 3486 | end |
| 3487 | |
| 3488 | fn generate to void |
| 3489 | put oc 0 0 |
| 3490 | put bd 0 0 |
| 3491 | if eq get abmode 0 1 |
| 3492 | ab_prov |
| 3493 | end |
| 3494 | if eq get target 0 0 |
| 3495 | if eq get seeded 0 1 |
| 3496 | for j ulong len shead |
| 3497 | e_b ulong get shead j |
| 3498 | end |
| 3499 | end |
| 3500 | emitstr 0 |
| 3501 | if eq get dynview 0 1 |
| 3502 | for j ulong len dynmark |
| 3503 | e_b ulong get dynmark j |
| 3504 | end |
| 3505 | for j ulong len dynrun |
| 3506 | e_b ulong get dynrun j |
| 3507 | end |
| 3508 | end |
| 3509 | if and eq get seeded 0 1 eq get fsview 0 0 |
| 3510 | for j ulong len frun |
| 3511 | e_b ulong get frun j |
| 3512 | end |
| 3513 | for j ulong len pubhelp |
| 3514 | e_b ulong get pubhelp j |
| 3515 | end |
| 3516 | if eq get fnext 0 1 |
| 3517 | for j ulong len fmarun |
| 3518 | e_b ulong get fmarun j |
| 3519 | end |
| 3520 | end |
| 3521 | end |
| 3522 | if eq get abmode 0 1 |
| 3523 | ab_pre |
| 3524 | end |
| 3525 | else |
| 3526 | emitstr 1 |
| 3527 | end |
| 3528 | i = ulong 0 |
| 3529 | while lt i get nf 0 |
| 3530 | if eq get target 0 0 |
| 3531 | signature i |
| 3532 | emitstr 79 |
| 3533 | end |
| 3534 | i = add i 1 |
| 3535 | end |
| 3536 | i = ulong 0 |
| 3537 | while lt i get ng 0 |
| 3538 | if eq get g_ro i 1 |
| 3539 | etext i |
| 3540 | else |
| 3541 | earray add 32 i get g_len i get g_ty i 9999 |
| 3542 | end |
| 3543 | i = add i 1 |
| 3544 | end |
| 3545 | put cur 0 1 |
| 3546 | put line 0 1 |
| 3547 | put held 0 0 |
| 3548 | tok |
| 3549 | while ne get tk 0 3 |
| 3550 | if eq isw 28262 1 |
| 3551 | efn |
| 3552 | else |
| 3553 | if or eq isw 119165519096935 1 eq kwconst 1 |
| 3554 | while and ne get tk 0 0 ne get tk 0 3 |
| 3555 | tok |
| 3556 | end |
| 3557 | else |
| 3558 | if and eq isw 1954047348 1 eq get seeded 0 0 |
| 3559 | skipline |
| 3560 | else |
| 3561 | if eq isw 1702129518 1 |
| 3562 | while and ne get tk 0 0 ne get tk 0 3 |
| 3563 | tok |
| 3564 | end |
| 3565 | else |
| 3566 | if eq kwom2 1 |
| 3567 | tok |
| 3568 | if ne get tk 0 0 |
| 3569 | fail 24 |
| 3570 | end |
| 3571 | else |
| 3572 | if ne get tk 0 0 |
| 3573 | fail 24 |
| 3574 | end |
| 3575 | end |
| 3576 | end |
| 3577 | end |
| 3578 | end |
| 3579 | end |
| 3580 | tok |
| 3581 | end |
| 3582 | if and eq get hasmain 0 0 eq get abmode 0 0 |
| 3583 | i = ulong 0 |
| 3584 | if eq get seeded 0 1 |
| 3585 | i = sub get nf 0 1 |
| 3586 | end |
| 3587 | while lt i get nf 0 |
| 3588 | exportfn i |
| 3589 | i = add i 1 |
| 3590 | end |
| 3591 | end |
| 3592 | if eq get hasmain 0 1 |
| 3593 | i = ulong 0 |
| 3594 | while lt i get nf 0 |
| 3595 | if eq get fn_name i 1852399981 |
| 3596 | if eq get target 0 0 |
| 3597 | emitstr 80 |
| 3598 | named 102 i |
| 3599 | emitstr 81 |
| 3600 | else |
| 3601 | emitstr 82 |
| 3602 | named 102 i |
| 3603 | emitstr 83 |
| 3604 | end |
| 3605 | end |
| 3606 | i = add i 1 |
| 3607 | end |
| 3608 | end |
| 3609 | if eq get abmode 0 1 |
| 3610 | ab_post |
| 3611 | end |
| 3612 | if and eq get seeded 0 1 eq get target 0 0 |
| 3613 | for j ulong len stail |
| 3614 | e_b ulong get stail j |
| 3615 | end |
| 3616 | end |
| 3617 | end |
| 3618 | |
| 3619 | fn main to int |
| 3620 | off = ulong 0 |
| 3621 | go = ulong 1 |
| 3622 | while eq go 1 |
| 3623 | n = read 0 src off sub 1048576 off |
| 3624 | if lt n 0 |
| 3625 | fail 1 |
| 3626 | end |
| 3627 | if eq n 0 |
| 3628 | go = 0 |
| 3629 | else |
| 3630 | off = add off ulong n |
| 3631 | if ge off 1048576 |
| 3632 | fail 14 |
| 3633 | end |
| 3634 | end |
| 3635 | end |
| 3636 | put slen 0 off |
| 3637 | put line 0 1 |
| 3638 | mode = get src 0 |
| 3639 | if or eq mode 87 eq mode 89 |
| 3640 | put fsview 0 1 |
| 3641 | put seeded 0 1 |
| 3642 | put dynview 0 0 |
| 3643 | end |
| 3644 | if or eq mode 82 eq mode 83 |
| 3645 | put seeded 0 1 |
| 3646 | put dynview 0 1 |
| 3647 | end |
| 3648 | if or eq mode 69 eq mode 74 |
| 3649 | put seeded 0 1 |
| 3650 | put fnext 0 1 |
| 3651 | end |
| 3652 | if or or eq mode 76 eq mode 77 eq mode 86 |
| 3653 | put seeded 0 1 |
| 3654 | put abmode 0 1 |
| 3655 | if eq mode 77 |
| 3656 | put abmode 0 2 |
| 3657 | end |
| 3658 | if eq mode 86 |
| 3659 | put abmode 0 3 |
| 3660 | end |
| 3661 | ab_provck |
| 3662 | end |
| 3663 | if or or eq mode 68 eq mode 81 eq mode 72 |
| 3664 | put seeded 0 1 |
| 3665 | end |
| 3666 | if or eq mode 80 eq mode 81 |
| 3667 | put target 0 1 |
| 3668 | else |
| 3669 | if and and ne mode 67 ne mode 68 ne mode 72 |
| 3670 | if and and and ne mode 69 ne mode 74 and ne mode 82 ne mode 83 and ne mode 87 ne mode 89 |
| 3671 | if and and ne mode 76 ne mode 77 ne mode 86 |
| 3672 | fail 24 |
| 3673 | end |
| 3674 | end |
| 3675 | end |
| 3676 | end |
| 3677 | namescan |
| 3678 | param_fn_sweep |
| 3679 | if eq get fsview 0 1 |
| 3680 | fscheck |
| 3681 | end |
| 3682 | if and eq get dynview 0 1 ne get hasmain 0 0 |
| 3683 | fail 24 |
| 3684 | end |
| 3685 | if eq get nf 0 0 |
| 3686 | fail 16 |
| 3687 | end |
| 3688 | if ne get abmode 0 0 |
| 3689 | ab_lib_main |
| 3690 | end |
| 3691 | if gt get abmode 0 1 |
| 3692 | put oc 0 0 |
| 3693 | if eq get abmode 0 2 |
| 3694 | ab_header |
| 3695 | else |
| 3696 | ab_map |
| 3697 | end |
| 3698 | else |
| 3699 | if or or or eq mode 72 eq mode 74 eq mode 83 eq mode 89 |
| 3700 | generate |
| 3701 | put oc 0 0 |
| 3702 | genhead |
| 3703 | else |
| 3704 | generate |
| 3705 | end |
| 3706 | end |
| 3707 | w = write 1 outb 0 get oc 0 |
| 3708 | if ne w long get oc 0 |
| 3709 | ret 1 |
| 3710 | end |
| 3711 | ret 0 |
| 3712 | end |
| 3713 | |
| 3714 | fn ecall n ulong to void |
| 3715 | py = get target 0 |
| 3716 | v = get nv n |
| 3717 | f = v |
| 3718 | if eq py 0 |
| 3719 | emitstr 84 |
| 3720 | i = ulong 0 |
| 3721 | while lt i get fn_np f |
| 3722 | slot = add mul f 6 i |
| 3723 | if eq get fn_pk slot 0 |
| 3724 | emitstr 85 |
| 3725 | named 112 i |
| 3726 | e_b 61 |
| 3727 | eexpr get args add mul n 6 i |
| 3728 | e_b 59 |
| 3729 | end |
| 3730 | i = add i 1 |
| 3731 | end |
| 3732 | end |
| 3733 | named 102 f |
| 3734 | e_b 40 |
| 3735 | if eq get fsview 0 1 |
| 3736 | fsput 2 |
| 3737 | if gt get fn_np f 0 |
| 3738 | e_comma |
| 3739 | end |
| 3740 | end |
| 3741 | i = ulong 0 |
| 3742 | while lt i get fn_np f |
| 3743 | if gt i 0 |
| 3744 | e_comma |
| 3745 | end |
| 3746 | slot = add mul f 6 i |
| 3747 | arg = get args add mul n 6 i |
| 3748 | if gt get fn_pk slot 0 |
| 3749 | arrp arg |
| 3750 | e_comma |
| 3751 | arrn arg |
| 3752 | else |
| 3753 | if eq py 0 |
| 3754 | named 112 i |
| 3755 | else |
| 3756 | eexpr arg |
| 3757 | end |
| 3758 | end |
| 3759 | i = add i 1 |
| 3760 | end |
| 3761 | e_b 41 |
| 3762 | if eq py 0 |
| 3763 | emitstr 86 |
| 3764 | end |
| 3765 | ret |
| 3766 | end |
| 3767 | |
| 3768 | fn exname f ulong to void |
| 3769 | emitstr 87 |
| 3770 | e_src get fn_off f get fn_nl f |
| 3771 | end |
| 3772 | |
| 3773 | fn exargs f ulong to void |
| 3774 | i = ulong 0 |
| 3775 | while lt i get fn_np f |
| 3776 | if gt i 0 |
| 3777 | e_comma |
| 3778 | end |
| 3779 | pubvalue f i |
| 3780 | s = add mul f 6 i |
| 3781 | if gt get fn_pk s 0 |
| 3782 | e_comma |
| 3783 | named 112 i |
| 3784 | emitstr 88 |
| 3785 | end |
| 3786 | i = add i 1 |
| 3787 | end |
| 3788 | end |
| 3789 | |
| 3790 | fn invalid to void |
| 3791 | if eq get target 0 0 |
| 3792 | emitstr 89 |
| 3793 | else |
| 3794 | emitstr 90 |
| 3795 | end |
| 3796 | end |
| 3797 | |
| 3798 | fn excheck f ulong i ulong to void |
| 3799 | s = add mul f 6 i |
| 3800 | indent |
| 3801 | if eq get target 0 0 |
| 3802 | emitstr 91 |
| 3803 | else |
| 3804 | emitstr 92 |
| 3805 | end |
| 3806 | if eq get fn_pk s 0 |
| 3807 | if eq isflt get fn_pt s 1 |
| 3808 | e_b 49 |
| 3809 | else |
| 3810 | emitstr 93 |
| 3811 | e_dec get fn_pt s |
| 3812 | e_comma |
| 3813 | named 112 i |
| 3814 | e_b 41 |
| 3815 | end |
| 3816 | else |
| 3817 | t = get fn_pt s |
| 3818 | if and and and ne t 2 ne t 3 ne t 4 and ne t 5 ne t 11 |
| 3819 | fail 24 |
| 3820 | end |
| 3821 | if and ne t 2 ne t 5 |
| 3822 | if or eq get seeded 0 0 eq get target 0 1 |
| 3823 | fail 24 |
| 3824 | end |
| 3825 | end |
| 3826 | if eq get dynview 0 1 |
| 3827 | for j ulong len dynbuf |
| 3828 | e_b ulong get dynbuf j |
| 3829 | end |
| 3830 | else |
| 3831 | emitstr 94 |
| 3832 | end |
| 3833 | named 112 i |
| 3834 | e_comma |
| 3835 | named 112 i |
| 3836 | emitstr 95 |
| 3837 | e_dec get fn_pl s |
| 3838 | e_comma |
| 3839 | e_dec t |
| 3840 | if eq get target 0 1 |
| 3841 | e_comma |
| 3842 | e_dec get fn_pk s |
| 3843 | end |
| 3844 | e_b 41 |
| 3845 | end |
| 3846 | invalid |
| 3847 | if and eq get target 0 0 gt get fn_pk s 0 |
| 3848 | if eq get dynview 0 1 |
| 3849 | for j ulong len dynover |
| 3850 | e_b ulong get dynover j |
| 3851 | end |
| 3852 | else |
| 3853 | for j ulong len pubover |
| 3854 | e_b ulong get pubover j |
| 3855 | end |
| 3856 | end |
| 3857 | e_dec div width pubrettype f 8 |
| 3858 | for j ulong len pubovend |
| 3859 | e_b ulong get pubovend j |
| 3860 | end |
| 3861 | named 112 i |
| 3862 | e_comma |
| 3863 | named 112 i |
| 3864 | emitstr 97 |
| 3865 | e_dec div width get fn_pt s 8 |
| 3866 | emitstr 98 |
| 3867 | end |
| 3868 | end |
| 3869 | |
| 3870 | fn exalias f ulong i ulong j ulong to void |
| 3871 | s = add mul f 6 i |
| 3872 | r = add mul f 6 j |
| 3873 | if and gt get fn_pk s 0 gt get fn_pk r 0 |
| 3874 | if or eq get fn_pk s 3 eq get fn_pk r 3 |
| 3875 | indent |
| 3876 | if eq get target 0 0 |
| 3877 | if eq get dynview 0 1 |
| 3878 | for k ulong len dynalias |
| 3879 | e_b ulong get dynalias k |
| 3880 | end |
| 3881 | else |
| 3882 | emitstr 99 |
| 3883 | end |
| 3884 | named 112 i |
| 3885 | e_comma |
| 3886 | named 112 i |
| 3887 | emitstr 100 |
| 3888 | e_dec div width get fn_pt s 8 |
| 3889 | e_comma |
| 3890 | named 112 j |
| 3891 | e_comma |
| 3892 | named 112 j |
| 3893 | emitstr 101 |
| 3894 | e_dec div width get fn_pt r 8 |
| 3895 | emitstr 102 |
| 3896 | else |
| 3897 | emitstr 103 |
| 3898 | named 112 i |
| 3899 | emitstr 104 |
| 3900 | named 112 j |
| 3901 | emitstr 105 |
| 3902 | end |
| 3903 | end |
| 3904 | end |
| 3905 | end |
| 3906 | |
| 3907 | fn genhead to void |
| 3908 | if ne get hasmain 0 0 |
| 3909 | fail 24 |
| 3910 | end |
| 3911 | put oc 0 0 |
| 3912 | if eq get dynview 0 1 |
| 3913 | for j ulong len dynmark |
| 3914 | e_b ulong get dynmark j |
| 3915 | end |
| 3916 | end |
| 3917 | f = sub get nf 0 1 |
| 3918 | emitstr 106 |
| 3919 | exname f |
| 3920 | e_b 40 |
| 3921 | pubresult f |
| 3922 | i = ulong 0 |
| 3923 | while lt i get fn_np f |
| 3924 | s = add mul f 6 i |
| 3925 | e_comma |
| 3926 | if gt get fn_pk s 0 |
| 3927 | viewqual get fn_pk s |
| 3928 | emitstr 109 |
| 3929 | else |
| 3930 | pubtype get fn_pt s |
| 3931 | end |
| 3932 | named 112 i |
| 3933 | if gt get fn_pk s 0 |
| 3934 | e_comma |
| 3935 | euint |
| 3936 | named 112 i |
| 3937 | emitstr 111 |
| 3938 | end |
| 3939 | i = add i 1 |
| 3940 | end |
| 3941 | e_b 41 |
| 3942 | e_b 59 |
| 3943 | e_b 10 |
| 3944 | end |
| 3945 | |
| 3946 | fn exportfn f ulong to void |
| 3947 | py = get target 0 |
| 3948 | put bd 0 0 |
| 3949 | if eq py 0 |
| 3950 | emitstr 106 |
| 3951 | else |
| 3952 | emitstr 107 |
| 3953 | end |
| 3954 | exname f |
| 3955 | e_b 40 |
| 3956 | if eq py 0 |
| 3957 | pubresult f |
| 3958 | end |
| 3959 | i = ulong 0 |
| 3960 | while lt i get fn_np f |
| 3961 | s = add mul f 6 i |
| 3962 | if or eq py 0 gt i 0 |
| 3963 | e_comma |
| 3964 | end |
| 3965 | if eq py 0 |
| 3966 | if gt get fn_pk s 0 |
| 3967 | viewqual get fn_pk s |
| 3968 | emitstr 109 |
| 3969 | else |
| 3970 | for j ulong len pubv |
| 3971 | e_b ulong get pubv j |
| 3972 | end |
| 3973 | pubtype get fn_pt s |
| 3974 | end |
| 3975 | end |
| 3976 | named 112 i |
| 3977 | if gt get fn_pk s 0 |
| 3978 | e_comma |
| 3979 | if eq get dynview 0 1 |
| 3980 | for j ulong len pubv |
| 3981 | e_b ulong get pubv j |
| 3982 | end |
| 3983 | end |
| 3984 | euint |
| 3985 | named 112 i |
| 3986 | emitstr 111 |
| 3987 | end |
| 3988 | i = add i 1 |
| 3989 | end |
| 3990 | if eq py 0 |
| 3991 | for j ulong len pubchk |
| 3992 | e_b ulong get pubchk j |
| 3993 | end |
| 3994 | e_dec pubrettype f |
| 3995 | for j ulong len pubcend |
| 3996 | e_b ulong get pubcend j |
| 3997 | end |
| 3998 | else |
| 3999 | emitstr 113 |
| 4000 | end |
| 4001 | put bd 0 1 |
| 4002 | i = ulong 0 |
| 4003 | while lt i get fn_np f |
| 4004 | excheck f i |
| 4005 | j = ulong 0 |
| 4006 | while lt j i |
| 4007 | exalias f i j |
| 4008 | j = add j 1 |
| 4009 | end |
| 4010 | i = add i 1 |
| 4011 | end |
| 4012 | if eq py 0 |
| 4013 | if eq get fsview 0 1 |
| 4014 | fsput 6 |
| 4015 | named 102 f |
| 4016 | e_b 40 |
| 4017 | fsput 2 |
| 4018 | if gt get fn_np f 0 |
| 4019 | e_comma |
| 4020 | end |
| 4021 | exargs f |
| 4022 | e_b 41 |
| 4023 | fsput 7 |
| 4024 | e_dec pubrettype f |
| 4025 | fsput 8 |
| 4026 | else |
| 4027 | for j ulong len pubstart |
| 4028 | e_b ulong get pubstart j |
| 4029 | end |
| 4030 | named 102 f |
| 4031 | e_b 40 |
| 4032 | exargs f |
| 4033 | e_b 41 |
| 4034 | for j ulong len pubstore |
| 4035 | e_b ulong get pubstore j |
| 4036 | end |
| 4037 | e_dec pubrettype f |
| 4038 | e_b 41 |
| 4039 | for j ulong len pubend |
| 4040 | e_b ulong get pubend j |
| 4041 | end |
| 4042 | end |
| 4043 | else |
| 4044 | indent |
| 4045 | emitstr 116 |
| 4046 | indent |
| 4047 | emitstr 117 |
| 4048 | indent |
| 4049 | emitstr 118 |
| 4050 | indent |
| 4051 | emitstr 119 |
| 4052 | indent |
| 4053 | emitstr 120 |
| 4054 | put bd 0 2 |
| 4055 | indent |
| 4056 | emitstr 121 |
| 4057 | named 102 f |
| 4058 | e_b 40 |
| 4059 | exargs f |
| 4060 | emitstr 122 |
| 4061 | put bd 0 1 |
| 4062 | indent |
| 4063 | emitstr 123 |
| 4064 | put bd 0 2 |
| 4065 | indent |
| 4066 | emitstr 124 |
| 4067 | put bd 0 1 |
| 4068 | indent |
| 4069 | emitstr 125 |
| 4070 | put bd 0 2 |
| 4071 | indent |
| 4072 | emitstr 126 |
| 4073 | indent |
| 4074 | emitstr 127 |
| 4075 | end |
| 4076 | put bd 0 0 |
| 4077 | end |
| 4078 | |
| 4079 | note Literal conversion copied from omega e5b32567 seed/omc/omc.om lines1811-2116; unchanged algorithm, input buffer renamed. |
| 4080 | note ---- float literals: a token is the decimal value fsgn * fnd * 10^fp10, fsuf 0 none / 1 f32 / 2 f64. |
| 4081 | note fg_* hold the working state of the one literal being converted (see fparse/fbits/fnorm/fgen). |
| 4082 | |
| 4083 | note ======== float literals: decimal text to IEEE-754 binary32/binary64 ======== |
| 4084 | note The literal is fnd * 10^fp10. The converter normalizes fnd to a 64-bit significand, applies the |
| 4085 | note decimal scale one factor of ten at a time (fmul10/fdiv10) while folding lost bits into one sticky |
| 4086 | note flag, then rounds once (froundsh) and packs (fpack). It covers the full IEEE range, subnormals |
| 4087 | note included, and refuses (error 8) only a value that rounds to infinity or whose digits do not fit |
| 4088 | note in 2^63-1. |
| 4089 | |
| 4090 | note blen: bits needed for x (0 for zero) |
| 4091 | fn blen x ulong to ulong |
| 4092 | n = ulong 0 |
| 4093 | while ne x 0 |
| 4094 | x = shr x 1 |
| 4095 | n = add n 1 |
| 4096 | end |
| 4097 | ret n |
| 4098 | end |
| 4099 | |
| 4100 | note fparse: read the literal text inp[pos, pos+len) into fsgn, fnd, fp10, fsuf (0 none, 1 f32, 2 f64). |
| 4101 | note Grammar: [-]digits[.digits][(e|E)[+|-]digits][f32|f64]. At most 2^63-1 significant digits |
| 4102 | note (error 8), a dot with no digit after it is error 6, |exponent| <= 999 (error 8). |
| 4103 | fn fparse pos ulong ln ulong to void |
| 4104 | p = pos |
| 4105 | e = add pos ln |
| 4106 | put fsgn 0 0 |
| 4107 | put fsuf 0 0 |
| 4108 | put fnd 0 0 |
| 4109 | put fg_fl 0 0 |
| 4110 | put fg_seen 0 0 |
| 4111 | if eq get src p 45 |
| 4112 | put fsgn 0 1 |
| 4113 | p = add p 1 |
| 4114 | end |
| 4115 | go = true |
| 4116 | while and go lt p e |
| 4117 | b = get src p |
| 4118 | d = sub ulong b 48 |
| 4119 | if le d 9 |
| 4120 | if gt get fnd 0 922337203685477580 |
| 4121 | fail 8 |
| 4122 | end |
| 4123 | if and eq get fnd 0 922337203685477580 gt d 7 |
| 4124 | fail 8 |
| 4125 | end |
| 4126 | put fnd 0 add mul get fnd 0 10 d |
| 4127 | if ne get fg_seen 0 0 |
| 4128 | put fg_fl 0 add get fg_fl 0 1 |
| 4129 | end |
| 4130 | p = add p 1 |
| 4131 | else |
| 4132 | if and eq b 46 eq get fg_seen 0 0 |
| 4133 | put fg_seen 0 1 |
| 4134 | p = add p 1 |
| 4135 | else |
| 4136 | go = false |
| 4137 | end |
| 4138 | end |
| 4139 | end |
| 4140 | if and ne get fg_seen 0 0 eq get fg_fl 0 0 |
| 4141 | fail 6 |
| 4142 | end |
| 4143 | p = fexp p e |
| 4144 | p = fsufx p e |
| 4145 | if ne p e |
| 4146 | fail 6 |
| 4147 | end |
| 4148 | x = mul get fg_esign 0 get fg_ex 0 |
| 4149 | put fp10 0 sub x long get fg_fl 0 |
| 4150 | end |
| 4151 | |
| 4152 | note fexp: the exponent of the literal, if present: fg_ex, fg_esign, fg_ed. Returns the new position. |
| 4153 | fn fexp p ulong e ulong to ulong |
| 4154 | put fg_ex 0 0 |
| 4155 | put fg_esign 0 1 |
| 4156 | if and lt p e or eq get src p 101 eq get src p 69 |
| 4157 | p = add p 1 |
| 4158 | if lt p e |
| 4159 | if or eq get src p 43 eq get src p 45 |
| 4160 | if eq get src p 45 |
| 4161 | put fg_esign 0 -1 |
| 4162 | end |
| 4163 | p = add p 1 |
| 4164 | end |
| 4165 | end |
| 4166 | put fg_ed 0 0 |
| 4167 | go = true |
| 4168 | while and go lt p e |
| 4169 | d = sub ulong get src p 48 |
| 4170 | if gt d 9 |
| 4171 | go = false |
| 4172 | else |
| 4173 | put fg_ex 0 add mul get fg_ex 0 10 long d |
| 4174 | if gt get fg_ex 0 999 |
| 4175 | fail 8 |
| 4176 | end |
| 4177 | put fg_ed 0 add get fg_ed 0 1 |
| 4178 | p = add p 1 |
| 4179 | end |
| 4180 | end |
| 4181 | if eq get fg_ed 0 0 |
| 4182 | fail 6 |
| 4183 | end |
| 4184 | end |
| 4185 | ret p |
| 4186 | end |
| 4187 | |
| 4188 | note fsufx: the optional f32/f64 suffix: fsuf 1 or 2. Returns the new position. |
| 4189 | fn fsufx p ulong e ulong to ulong |
| 4190 | if lt p e |
| 4191 | r = sub e p |
| 4192 | if ne r 3 |
| 4193 | fail 6 |
| 4194 | end |
| 4195 | if ne get src p 102 |
| 4196 | fail 6 |
| 4197 | end |
| 4198 | if and eq get src add p 1 51 eq get src add p 2 50 |
| 4199 | put fsuf 0 1 |
| 4200 | else |
| 4201 | if and eq get src add p 1 54 eq get src add p 2 52 |
| 4202 | put fsuf 0 2 |
| 4203 | else |
| 4204 | fail 6 |
| 4205 | end |
| 4206 | end |
| 4207 | p = add p 3 |
| 4208 | end |
| 4209 | ret p |
| 4210 | end |
| 4211 | |
| 4212 | note fbits: the parsed literal as IEEE bits of type ty (10 f32, 11 f64). Zero keeps the sign (-0.0). |
| 4213 | note fmul10 / fdiv10: one exact decimal step on the normalized significand fg_m (value = fg_m * 2^fg_e), |
| 4214 | note keeping fg_m in [2^63, 2^64) and folding every lost bit into fg_stk. No rounding happens here. |
| 4215 | fn fmul10 to void |
| 4216 | m = get fg_m 0 |
| 4217 | hi = shr m 32 |
| 4218 | lo = and m 4294967295 |
| 4219 | p0 = mul lo 10 |
| 4220 | p1 = mul hi 10 |
| 4221 | hi2 = add p1 shr p0 32 |
| 4222 | put fg_low 0 or shl and hi2 4294967295 32 and p0 4294967295 |
| 4223 | put fg_ov 0 shr hi2 32 |
| 4224 | fmn10 |
| 4225 | end |
| 4226 | |
| 4227 | fn fmn10 to void |
| 4228 | ov = get fg_ov 0 |
| 4229 | low = get fg_low 0 |
| 4230 | s = blen ov |
| 4231 | if ne s 0 |
| 4232 | st = or get fg_stk 0 and low sub shl 1 s 1 |
| 4233 | put fg_stk 0 st |
| 4234 | put fg_m 0 or shl ov sub 64 s shr low s |
| 4235 | put fg_e 0 add get fg_e 0 long s |
| 4236 | else |
| 4237 | put fg_m 0 low |
| 4238 | end |
| 4239 | end |
| 4240 | |
| 4241 | fn fdiv10 to void |
| 4242 | m = get fg_m 0 |
| 4243 | q = div m 10 |
| 4244 | if ne rem m 10 0 |
| 4245 | put fg_stk 0 1 |
| 4246 | end |
| 4247 | s = ulong 0 |
| 4248 | while lt q 9223372036854775808 |
| 4249 | q = shl q 1 |
| 4250 | s = add s 1 |
| 4251 | end |
| 4252 | put fg_m 0 q |
| 4253 | put fg_e 0 sub get fg_e 0 long s |
| 4254 | end |
| 4255 | |
| 4256 | note froundsh: round fg_m right by sh bits to fg_q, nearest even; the guard and every lower bit |
| 4257 | note (plus fg_stk) decide. sh may be 64 (then q is zero and bit 63 is the guard). |
| 4258 | fn froundsh sh ulong to void |
| 4259 | m = get fg_m 0 |
| 4260 | q = ulong 0 |
| 4261 | guard = ulong 0 |
| 4262 | lost = ulong 0 |
| 4263 | if eq sh 0 |
| 4264 | q = m |
| 4265 | else |
| 4266 | if ge sh 64 |
| 4267 | guard = shr m 63 |
| 4268 | lost = and m 9223372036854775807 |
| 4269 | else |
| 4270 | q = shr m sh |
| 4271 | guard = and shr m sub sh 1 1 |
| 4272 | if gt sub sh 1 0 |
| 4273 | lost = and m sub shl 1 sub sh 1 1 |
| 4274 | end |
| 4275 | end |
| 4276 | end |
| 4277 | sticky = or get fg_stk 0 lost |
| 4278 | if ne guard 0 |
| 4279 | if or ne sticky 0 eq and q 1 1 |
| 4280 | q = add q 1 |
| 4281 | end |
| 4282 | end |
| 4283 | put fg_q 0 q |
| 4284 | end |
| 4285 | |
| 4286 | note fpack: fg_m/fg_e to IEEE bits of fg_ty, including subnormals; a literal that rounds to infinity |
| 4287 | note is refused (error 8). |
| 4288 | fn fpack to ulong |
| 4289 | p = ulong 53 |
| 4290 | bias = long 1023 |
| 4291 | maxe = long 2047 |
| 4292 | emin = long -1022 |
| 4293 | mb = ulong 52 |
| 4294 | w = ulong 64 |
| 4295 | if eq get fg_ty 0 10 |
| 4296 | p = ulong 24 |
| 4297 | bias = long 127 |
| 4298 | maxe = long 255 |
| 4299 | emin = long -126 |
| 4300 | mb = ulong 23 |
| 4301 | w = ulong 32 |
| 4302 | end |
| 4303 | e = add get fg_e 0 63 |
| 4304 | if ge e emin |
| 4305 | sh = sub 64 p |
| 4306 | froundsh sh |
| 4307 | q = get fg_q 0 |
| 4308 | if eq q shl 1 p |
| 4309 | q = shr q 1 |
| 4310 | e = add e 1 |
| 4311 | end |
| 4312 | E = add e bias |
| 4313 | if ge E maxe |
| 4314 | fail 8 |
| 4315 | end |
| 4316 | q = and q sub shl 1 sub p 1 1 |
| 4317 | q = or q shl ulong E mb |
| 4318 | q = or q shl get fsgn 0 sub w 1 |
| 4319 | ret q |
| 4320 | end |
| 4321 | k = ulong sub emin e |
| 4322 | sh = add sub 64 p k |
| 4323 | if gt sh 64 |
| 4324 | ret shl get fsgn 0 sub w 1 |
| 4325 | end |
| 4326 | froundsh sh |
| 4327 | q = get fg_q 0 |
| 4328 | q = or q shl get fsgn 0 sub w 1 |
| 4329 | ret q |
| 4330 | end |
| 4331 | |
| 4332 | fn fbits ty ulong to ulong |
| 4333 | if eq get fnext 0 1 |
| 4334 | ret fexact ty |
| 4335 | end |
| 4336 | put fg_ty 0 ty |
| 4337 | put fg_stk 0 0 |
| 4338 | if eq get fnd 0 0 |
| 4339 | w = ulong 64 |
| 4340 | if eq ty 10 |
| 4341 | w = ulong 32 |
| 4342 | end |
| 4343 | b = ulong 0 |
| 4344 | if ne get fsgn 0 0 |
| 4345 | b = shl ulong 1 sub w 1 |
| 4346 | end |
| 4347 | ret b |
| 4348 | end |
| 4349 | b = blen get fnd 0 |
| 4350 | sh = sub 64 b |
| 4351 | put fg_m 0 shl get fnd 0 sh |
| 4352 | put fg_e 0 sub 0 long sh |
| 4353 | p = get fp10 0 |
| 4354 | if gt p 0 |
| 4355 | i = ulong 0 |
| 4356 | n = ulong p |
| 4357 | while lt i n |
| 4358 | fmul10 |
| 4359 | i = add i 1 |
| 4360 | end |
| 4361 | else |
| 4362 | if lt p 0 |
| 4363 | i = ulong 0 |
| 4364 | n = ulong sub 0 p |
| 4365 | while lt i n |
| 4366 | fdiv10 |
| 4367 | i = add i 1 |
| 4368 | end |
| 4369 | end |
| 4370 | end |
| 4371 | ret fpack |
| 4372 | end |
| 4373 | |
| 4374 | fn floatkw to ulong |
| 4375 | if eq get tl 0 len fword |
| 4376 | ok = true |
| 4377 | for i ulong len fword |
| 4378 | if ne get src add get ts 0 i get fword i |
| 4379 | ok = false |
| 4380 | end |
| 4381 | end |
| 4382 | if ok |
| 4383 | ret 1 |
| 4384 | end |
| 4385 | end |
| 4386 | if eq get tl 0 len bcword |
| 4387 | ok = true |
| 4388 | for i ulong len bcword |
| 4389 | if ne get src add get ts 0 i get bcword i |
| 4390 | ok = false |
| 4391 | end |
| 4392 | end |
| 4393 | if ok |
| 4394 | ret 2 |
| 4395 | end |
| 4396 | end |
| 4397 | if eq get tl 0 len absword |
| 4398 | ok = true |
| 4399 | for i ulong len absword |
| 4400 | if ne get src add get ts 0 i get absword i |
| 4401 | ok = false |
| 4402 | end |
| 4403 | end |
| 4404 | if ok |
| 4405 | ret 3 |
| 4406 | end |
| 4407 | end |
| 4408 | if eq get tl 0 len f64word |
| 4409 | ok = true |
| 4410 | for i ulong len f64word |
| 4411 | if ne get src add get ts 0 i get f64word i |
| 4412 | ok = false |
| 4413 | end |
| 4414 | end |
| 4415 | if ok |
| 4416 | ret 4 |
| 4417 | end |
| 4418 | end |
| 4419 | if eq isw 500136244070 1 |
| 4420 | ret 5 |
| 4421 | end |
| 4422 | if and eq get fnext 0 1 eq isw 6384998 1 |
| 4423 | ret 6 |
| 4424 | end |
| 4425 | ret 0 |
| 4426 | end |
| 4427 | |
| 4428 | note isflt: 1 for the seeded C float types f32 (11) and f64 (12). |
| 4429 | fn isflt t ulong to ulong |
| 4430 | if or eq t 11 eq t 12 |
| 4431 | ret 1 |
| 4432 | end |
| 4433 | ret 0 |
| 4434 | end |
| 4435 | |
| 4436 | note emitfloat: o_fp(op, t, a, b) with the toc operator code (19 fabs); unary 17/19 pass b as 0. |
| 4437 | fn emitfloat op ulong t ulong a ulong b ulong to void |
| 4438 | emitstr 8 |
| 4439 | eexpr a |
| 4440 | emitstr 9 |
| 4441 | if ge op 17 |
| 4442 | e_b 48 |
| 4443 | else |
| 4444 | eexpr b |
| 4445 | end |
| 4446 | for i ulong len fcall |
| 4447 | e_b ulong get fcall i |
| 4448 | end |
| 4449 | e_dec op |
| 4450 | e_comma |
| 4451 | e_dec t |
| 4452 | e_comma |
| 4453 | emitstr 12 |
| 4454 | end |
| 4455 | |
| 4456 | fn kwcont to ulong |
| 4457 | if or eq get seeded 0 0 ne get target 0 0 |
| 4458 | ret 0 |
| 4459 | end |
| 4460 | if ne get tl 0 len cntword |
| 4461 | ret 0 |
| 4462 | end |
| 4463 | for i ulong len cntword |
| 4464 | if ne get src add get ts 0 i get cntword i |
| 4465 | ret 0 |
| 4466 | end |
| 4467 | end |
| 4468 | ret 1 |
| 4469 | end |
| 4470 | |
| 4471 | fn econt to void |
| 4472 | d = get bd 0 |
| 4473 | found = false |
| 4474 | while gt d 0 |
| 4475 | d = sub d 1 |
| 4476 | if or eq get bk d 4 eq get bk d 5 |
| 4477 | found = true |
| 4478 | end |
| 4479 | end |
| 4480 | if not found |
| 4481 | fail 15 |
| 4482 | end |
| 4483 | indent |
| 4484 | for i ulong len cntc |
| 4485 | e_b ulong get cntc i |
| 4486 | end |
| 4487 | end |
| 4488 | |
| 4489 | note Exact conversion adapted unchanged from omega-mv draft1049, 7e93ca8e, seed/omc/omc.om. |
| 4490 | note e5 profile keeps fbits scaling above; only the explicit next profile calls fexact. |
| 4491 | note fbmul: limbs fbn[o, o+40) times k (k < 2^32, so each limb step fits 64 bits); the product must fit |
| 4492 | note in 40 limbs. Returns its bit length, so fbmul o 1 only measures. |
| 4493 | fn fbmul o ulong k ulong to ulong |
| 4494 | c = ulong 0 |
| 4495 | t = ulong 0 |
| 4496 | i = ulong 0 |
| 4497 | while lt i 40 |
| 4498 | j = add o i |
| 4499 | v = add mul get fbn j k c |
| 4500 | put fbn j and v 4294967295 |
| 4501 | c = shr v 32 |
| 4502 | if ne and v 4294967295 0 |
| 4503 | t = add mul i 32 blen and v 4294967295 |
| 4504 | end |
| 4505 | i = add i 1 |
| 4506 | end |
| 4507 | ret t |
| 4508 | end |
| 4509 | |
| 4510 | note fbpow: fbn[o, o+40) times b^n (b 2 or 10), in factors that stay below 2^32. |
| 4511 | fn fbpow o ulong b ulong n ulong to void |
| 4512 | while gt n 0 |
| 4513 | m = ulong 1 |
| 4514 | c = ulong 0 |
| 4515 | while and lt c n le mul m b 4294967295 |
| 4516 | m = mul m b |
| 4517 | c = add c 1 |
| 4518 | end |
| 4519 | t = fbmul o m |
| 4520 | n = sub n c |
| 4521 | end |
| 4522 | end |
| 4523 | |
| 4524 | note fbsub: one restoring-division step. If A >= D then A = A - D and 1, else A is kept and 0. |
| 4525 | fn fbsub to ulong |
| 4526 | r = ulong 2 |
| 4527 | i = ulong 40 |
| 4528 | while and gt i 0 eq r 2 |
| 4529 | i = sub i 1 |
| 4530 | a = get fbn i |
| 4531 | d = get fbn add i 40 |
| 4532 | if lt a d |
| 4533 | r = ulong 0 |
| 4534 | end |
| 4535 | if gt a d |
| 4536 | r = ulong 1 |
| 4537 | end |
| 4538 | end |
| 4539 | if eq r 0 |
| 4540 | ret 0 |
| 4541 | end |
| 4542 | b = ulong 0 |
| 4543 | i = ulong 0 |
| 4544 | while lt i 40 |
| 4545 | v = sub sub get fbn i get fbn add i 40 b |
| 4546 | put fbn i and v 4294967295 |
| 4547 | b = shr v 63 |
| 4548 | i = add i 1 |
| 4549 | end |
| 4550 | ret 1 |
| 4551 | end |
| 4552 | |
| 4553 | note fbits: the parsed literal as IEEE bits of type ty (10 f32, 11 f64). Zero keeps the sign (-0.0). |
| 4554 | fn fexact ty ulong to ulong |
| 4555 | put fg_ty 0 ty |
| 4556 | p = get fp10 0 |
| 4557 | if or eq get fnd 0 0 lt p -343 |
| 4558 | w = ulong 64 |
| 4559 | if eq ty 10 |
| 4560 | w = ulong 32 |
| 4561 | end |
| 4562 | b = ulong 0 |
| 4563 | if ne get fsgn 0 0 |
| 4564 | b = shl ulong 1 sub w 1 |
| 4565 | end |
| 4566 | ret b |
| 4567 | end |
| 4568 | if gt p 308 |
| 4569 | fail 8 |
| 4570 | end |
| 4571 | i = ulong 0 |
| 4572 | while lt i 80 |
| 4573 | put fbn i 0 |
| 4574 | i = add i 1 |
| 4575 | end |
| 4576 | put fbn 0 and get fnd 0 4294967295 |
| 4577 | put fbn 1 shr get fnd 0 32 |
| 4578 | put fbn 40 1 |
| 4579 | if gt p 0 |
| 4580 | fbpow 0 10 ulong p |
| 4581 | else |
| 4582 | fbpow 40 10 ulong sub 0 p |
| 4583 | end |
| 4584 | a = fbmul 0 1 |
| 4585 | d = fbmul 40 1 |
| 4586 | e = long 0 |
| 4587 | if lt a d |
| 4588 | fbpow 0 2 sub d a |
| 4589 | e = sub 0 long sub d a |
| 4590 | else |
| 4591 | fbpow 40 2 sub a d |
| 4592 | e = long sub a d |
| 4593 | end |
| 4594 | q = ulong 0 |
| 4595 | while lt q 9223372036854775808 |
| 4596 | q = or shl q 1 fbsub |
| 4597 | a = fbmul 0 2 |
| 4598 | e = sub e 1 |
| 4599 | end |
| 4600 | put fg_m 0 q |
| 4601 | put fg_e 0 add e 1 |
| 4602 | put fg_stk 0 fbmul 0 1 |
| 4603 | ret fpack |
| 4604 | end |
| 4605 | |
| 4606 | fn fmanode to ulong |
| 4607 | a = expr 0 |
| 4608 | t = get nt a |
| 4609 | if eq isflt t 0 |
| 4610 | fail 7 |
| 4611 | end |
| 4612 | b = expr t |
| 4613 | expect b t |
| 4614 | c = expr t |
| 4615 | expect c t |
| 4616 | ret node 11 t a b c |
| 4617 | end |
| 4618 | fn emitfma t ulong a ulong b ulong c ulong to void |
| 4619 | for j ulong len fmstart |
| 4620 | e_b ulong get fmstart j |
| 4621 | end |
| 4622 | eexpr a |
| 4623 | for j ulong len fmnext |
| 4624 | e_b ulong get fmnext j |
| 4625 | end |
| 4626 | eexpr b |
| 4627 | for j ulong len fmlast |
| 4628 | e_b ulong get fmlast j |
| 4629 | end |
| 4630 | eexpr c |
| 4631 | for j ulong len fmcall |
| 4632 | e_b ulong get fmcall j |
| 4633 | end |
| 4634 | e_dec t |
| 4635 | for j ulong len fmtail |
| 4636 | e_b ulong get fmtail j |
| 4637 | end |
| 4638 | end |
| 4639 | |
| 4640 | note Only the seeded runtime profile admits the already seed-checked OM-2 header. |
| 4641 | fn kwom2 to ulong |
| 4642 | if or and eq get dynview 0 0 eq get fsview 0 0 ne get tl 0 len omword |
| 4643 | ret 0 |
| 4644 | end |
| 4645 | for j ulong len omword |
| 4646 | if ne get src add get ts 0 j get omword j |
| 4647 | ret 0 |
| 4648 | end |
| 4649 | end |
| 4650 | ret 1 |
| 4651 | end |
| 4652 | |
| 4653 | note Internal-call expressions propagate the explicit status to their caller. |
| 4654 | note Primitive macros already unwind locally before any later operand or write. |
| 4655 | fn eexpr n ulong to void |
| 4656 | if and eq get fsview 0 1 eq get nk n 7 |
| 4657 | fsput 3 |
| 4658 | end |
| 4659 | eexpr0 n |
| 4660 | if and eq get fsview 0 1 eq get nk n 7 |
| 4661 | fsput 4 |
| 4662 | end |
| 4663 | end |
| 4664 | |
| 4665 | fn fsput k ulong to void |
| 4666 | if eq k 0 |
| 4667 | for i ulong len fsrun |
| 4668 | e_b ulong get fsrun i |
| 4669 | end |
| 4670 | end |
| 4671 | if eq k 1 |
| 4672 | for i ulong len fsparam |
| 4673 | e_b ulong get fsparam i |
| 4674 | end |
| 4675 | end |
| 4676 | if eq k 2 |
| 4677 | for i ulong len fsarg |
| 4678 | e_b ulong get fsarg i |
| 4679 | end |
| 4680 | end |
| 4681 | if eq k 3 |
| 4682 | for i ulong len fsstart |
| 4683 | e_b ulong get fsstart i |
| 4684 | end |
| 4685 | end |
| 4686 | if eq k 4 |
| 4687 | for i ulong len fsend |
| 4688 | e_b ulong get fsend i |
| 4689 | end |
| 4690 | end |
| 4691 | if eq k 5 |
| 4692 | for i ulong len fsfail |
| 4693 | e_b ulong get fsfail i |
| 4694 | end |
| 4695 | end |
| 4696 | if eq k 6 |
| 4697 | for i ulong len fspub |
| 4698 | e_b ulong get fspub i |
| 4699 | end |
| 4700 | end |
| 4701 | if eq k 7 |
| 4702 | for i ulong len fsstore |
| 4703 | e_b ulong get fsstore i |
| 4704 | end |
| 4705 | end |
| 4706 | if eq k 8 |
| 4707 | for i ulong len fspend |
| 4708 | e_b ulong get fspend i |
| 4709 | end |
| 4710 | end |
| 4711 | end |
| 4712 | |
| 4713 | fn fsstr k ulong to ulong |
| 4714 | if eq k 0 |
| 4715 | fsput 0 |
| 4716 | for i ulong len frun |
| 4717 | e_b ulong get frun i |
| 4718 | end |
| 4719 | ret 1 |
| 4720 | end |
| 4721 | if eq k 22 |
| 4722 | note Every local array is filled explicitly; do not zero it twice or emit memset. |
| 4723 | e_b 93 |
| 4724 | e_b 59 |
| 4725 | e_b 10 |
| 4726 | ret 1 |
| 4727 | end |
| 4728 | ret 0 |
| 4729 | end |
| 4730 | |
| 4731 | note Exit 25 is private dispatch: no borrowed signature, use the unchanged scalar |
| 4732 | note profile. A view-bearing unit never retries another profile after a refusal. |
| 4733 | fn fscheck to void |
| 4734 | found = false |
| 4735 | for f ulong get nf 0 |
| 4736 | for i ulong get fn_np f |
| 4737 | if gt get fn_pk add mul f 6 i 0 |
| 4738 | found = true |
| 4739 | end |
| 4740 | end |
| 4741 | end |
| 4742 | if not found |
| 4743 | exit 25 |
| 4744 | end |
| 4745 | if or ne get ng 0 0 ne get hasmain 0 0 |
| 4746 | fail 24 |
| 4747 | end |
| 4748 | end |
| 4749 | |
| 4750 | note ---- C ABI library mode (cabi-1): tools/bridge-seeded lib-c|lib-h|lib-map ---- |
| 4751 | note Declarations are `note cabi ...` lines; see docs/CAPABILITIES.md "C ABI library mode". |
| 4752 | note Item table abx: 16 fields per item. Field 0 kind (directive keyword id, 60 import |
| 4753 | note item), 1 source line, 2/3 name span; the remaining fields are kind specific. |
| 4754 | note Fragments `ab_ce K` index the @-separated text abcf. |
| 4755 | |
| 4756 | fn ab_cg i ulong k ulong to ulong |
| 4757 | ret get abx add mul i 16 k |
| 4758 | end |
| 4759 | |
| 4760 | fn ab_cs i ulong k ulong v ulong to void |
| 4761 | put abx add mul i 16 k v |
| 4762 | end |
| 4763 | |
| 4764 | fn ab_bad code ulong i ulong to void |
| 4765 | put line 0 ab_cg i 1 |
| 4766 | fail code |
| 4767 | end |
| 4768 | |
| 4769 | fn ab_ce k ulong to void |
| 4770 | n = ulong len abcf |
| 4771 | c = ulong 0 |
| 4772 | i = ulong 0 |
| 4773 | while lt i n |
| 4774 | q = ulong get abcf i |
| 4775 | if eq q 64 |
| 4776 | c = add c 1 |
| 4777 | if gt c k |
| 4778 | ret |
| 4779 | end |
| 4780 | else |
| 4781 | if eq c k |
| 4782 | e_b q |
| 4783 | end |
| 4784 | end |
| 4785 | i = add i 1 |
| 4786 | end |
| 4787 | end |
| 4788 | |
| 4789 | fn ab_nm i ulong to void |
| 4790 | e_src ab_cg i 2 ab_cg i 3 |
| 4791 | end |
| 4792 | |
| 4793 | fn ab_nm2 i ulong k ulong to void |
| 4794 | e_src ab_cg i k ab_cg i add k 1 |
| 4795 | end |
| 4796 | |
| 4797 | fn ab_alpha c ulong to ulong |
| 4798 | if and ge c 65 le c 90 |
| 4799 | ret 1 |
| 4800 | end |
| 4801 | if and ge c 97 le c 122 |
| 4802 | ret 1 |
| 4803 | end |
| 4804 | if eq c 95 |
| 4805 | ret 1 |
| 4806 | end |
| 4807 | ret 0 |
| 4808 | end |
| 4809 | |
| 4810 | fn ab_digit c ulong to ulong |
| 4811 | if and ge c 48 le c 57 |
| 4812 | ret 1 |
| 4813 | end |
| 4814 | ret 0 |
| 4815 | end |
| 4816 | |
| 4817 | fn ab_chok c ulong s ulong to ulong |
| 4818 | if eq s 2 |
| 4819 | if or lt c 32 gt c 126 |
| 4820 | ret 0 |
| 4821 | end |
| 4822 | if or eq c 34 or eq c 92 eq c 63 |
| 4823 | ret 0 |
| 4824 | end |
| 4825 | ret 1 |
| 4826 | end |
| 4827 | if or eq ab_alpha c 1 eq ab_digit c 1 |
| 4828 | ret 1 |
| 4829 | end |
| 4830 | if eq c 45 |
| 4831 | ret 1 |
| 4832 | end |
| 4833 | if eq s 0 |
| 4834 | if eq c 46 |
| 4835 | ret 1 |
| 4836 | end |
| 4837 | ret 0 |
| 4838 | end |
| 4839 | if or eq c 40 eq c 41 |
| 4840 | ret 1 |
| 4841 | end |
| 4842 | ret 0 |
| 4843 | end |
| 4844 | |
| 4845 | fn ab_wordat t ulong s ulong n ulong o ulong m ulong to ulong |
| 4846 | if gt n m |
| 4847 | ret 0 |
| 4848 | end |
| 4849 | for j ulong n |
| 4850 | if eq t 0 |
| 4851 | if ne get abkw add s j get src add o j |
| 4852 | ret 0 |
| 4853 | end |
| 4854 | else |
| 4855 | if ne get abrs add s j get src add o j |
| 4856 | ret 0 |
| 4857 | end |
| 4858 | end |
| 4859 | end |
| 4860 | ret 1 |
| 4861 | end |
| 4862 | |
| 4863 | fn ab_kwid to ulong |
| 4864 | if ne get tk 0 1 |
| 4865 | ret 0 |
| 4866 | end |
| 4867 | n = ulong len abkw |
| 4868 | k = ulong 1 |
| 4869 | s = ulong 0 |
| 4870 | i = ulong 0 |
| 4871 | while le i n |
| 4872 | e = ulong 0 |
| 4873 | if eq i n |
| 4874 | e = 1 |
| 4875 | else |
| 4876 | if eq get abkw i 32 |
| 4877 | e = 1 |
| 4878 | end |
| 4879 | end |
| 4880 | if eq e 1 |
| 4881 | w = sub i s |
| 4882 | if eq w get tl 0 |
| 4883 | if eq ab_wordat 0 s w get ts 0 w 1 |
| 4884 | ret k |
| 4885 | end |
| 4886 | end |
| 4887 | k = add k 1 |
| 4888 | s = add i 1 |
| 4889 | end |
| 4890 | i = add i 1 |
| 4891 | end |
| 4892 | ret 0 |
| 4893 | end |
| 4894 | |
| 4895 | fn ab_rsv o ulong n ulong to ulong |
| 4896 | m = ulong len abrs |
| 4897 | s = ulong 0 |
| 4898 | i = ulong 0 |
| 4899 | while le i m |
| 4900 | e = ulong 0 |
| 4901 | if eq i m |
| 4902 | e = 1 |
| 4903 | else |
| 4904 | if eq get abrs i 32 |
| 4905 | e = 1 |
| 4906 | end |
| 4907 | end |
| 4908 | if eq e 1 |
| 4909 | if eq ab_wordat 1 s sub i s o n 1 |
| 4910 | ret 1 |
| 4911 | end |
| 4912 | s = add i 1 |
| 4913 | end |
| 4914 | i = add i 1 |
| 4915 | end |
| 4916 | ret 0 |
| 4917 | end |
| 4918 | |
| 4919 | fn ab_gen o ulong n ulong to ulong |
| 4920 | c = ulong get src o |
| 4921 | if and and ne c 102 ne c 103 and ne c 112 ne c 118 |
| 4922 | ret 0 |
| 4923 | end |
| 4924 | if lt n 2 |
| 4925 | ret 0 |
| 4926 | end |
| 4927 | for j ulong sub n 1 |
| 4928 | if eq ab_digit ulong get src add o add j 1 0 |
| 4929 | ret 0 |
| 4930 | end |
| 4931 | end |
| 4932 | ret 1 |
| 4933 | end |
| 4934 | |
| 4935 | fn ab_next to void |
| 4936 | tok |
| 4937 | if or eq get tk 0 0 eq get tk 0 3 |
| 4938 | fail 40 |
| 4939 | end |
| 4940 | end |
| 4941 | |
| 4942 | fn ab_word to ulong |
| 4943 | ab_next |
| 4944 | ret ab_kwid |
| 4945 | end |
| 4946 | |
| 4947 | fn ab_want k ulong to void |
| 4948 | if ne ab_word k |
| 4949 | fail 40 |
| 4950 | end |
| 4951 | end |
| 4952 | |
| 4953 | fn ab_end to void |
| 4954 | tok |
| 4955 | if and ne get tk 0 0 ne get tk 0 3 |
| 4956 | fail 40 |
| 4957 | end |
| 4958 | put held 0 1 |
| 4959 | end |
| 4960 | |
| 4961 | fn ab_more to ulong |
| 4962 | tok |
| 4963 | if or eq get tk 0 0 eq get tk 0 3 |
| 4964 | put held 0 1 |
| 4965 | ret 0 |
| 4966 | end |
| 4967 | ret 1 |
| 4968 | end |
| 4969 | |
| 4970 | fn ab_ident to void |
| 4971 | ab_next |
| 4972 | ab_idchk 0 |
| 4973 | end |
| 4974 | |
| 4975 | fn ab_omclash o ulong n ulong to void |
| 4976 | i = ulong 0 |
| 4977 | while lt i get nf 0 |
| 4978 | if eq ab_speq get fn_off i get fn_nl i add o 6 sub n 6 1 |
| 4979 | fail 41 |
| 4980 | end |
| 4981 | i = add i 1 |
| 4982 | end |
| 4983 | end |
| 4984 | |
| 4985 | fn ab_idchk om ulong to void |
| 4986 | o = get ts 0 |
| 4987 | n = get tl 0 |
| 4988 | if gt n 63 |
| 4989 | fail 40 |
| 4990 | end |
| 4991 | if eq ab_alpha ulong get src o 0 |
| 4992 | fail 40 |
| 4993 | end |
| 4994 | for j ulong n |
| 4995 | c = ulong get src add o j |
| 4996 | if and eq ab_alpha c 0 eq ab_digit c 0 |
| 4997 | fail 40 |
| 4998 | end |
| 4999 | end |
| 5000 | if eq om 1 |
| 5001 | if eq ab_wordat 1 3 6 o n 1 |
| 5002 | ab_omclash o n |
| 5003 | ret |
| 5004 | end |
| 5005 | end |
| 5006 | if eq ab_rsv o n 1 |
| 5007 | fail 40 |
| 5008 | end |
| 5009 | if eq ab_gen o n 1 |
| 5010 | fail 40 |
| 5011 | end |
| 5012 | end |
| 5013 | |
| 5014 | fn ab_num to ulong |
| 5015 | ab_next |
| 5016 | o = get ts 0 |
| 5017 | n = get tl 0 |
| 5018 | if gt n 18 |
| 5019 | fail 40 |
| 5020 | end |
| 5021 | v = ulong 0 |
| 5022 | for j ulong n |
| 5023 | c = ulong get src add o j |
| 5024 | if eq ab_digit c 0 |
| 5025 | fail 40 |
| 5026 | end |
| 5027 | v = add mul v 10 sub c 48 |
| 5028 | end |
| 5029 | ret v |
| 5030 | end |
| 5031 | |
| 5032 | fn ab_range v ulong lo ulong hi ulong code ulong to void |
| 5033 | if or lt v lo gt v hi |
| 5034 | fail code |
| 5035 | end |
| 5036 | end |
| 5037 | |
| 5038 | fn ab_speq a ulong m ulong b ulong n ulong to ulong |
| 5039 | if ne m n |
| 5040 | ret 0 |
| 5041 | end |
| 5042 | for j ulong n |
| 5043 | if ne get src add a j get src add b j |
| 5044 | ret 0 |
| 5045 | end |
| 5046 | end |
| 5047 | ret 1 |
| 5048 | end |
| 5049 | |
| 5050 | fn ab_name to void |
| 5051 | o = get ts 0 |
| 5052 | n = get tl 0 |
| 5053 | i = ulong 0 |
| 5054 | while lt i get abnmn 0 |
| 5055 | if eq ab_speq get abnmo i get abnml i o n 1 |
| 5056 | fail 41 |
| 5057 | end |
| 5058 | i = add i 1 |
| 5059 | end |
| 5060 | if ge i 1024 |
| 5061 | fail 14 |
| 5062 | end |
| 5063 | put abnmo i o |
| 5064 | put abnml i n |
| 5065 | put abnmn 0 add i 1 |
| 5066 | end |
| 5067 | |
| 5068 | fn ab_setn i ulong k ulong to void |
| 5069 | ab_cs i k get ts 0 |
| 5070 | ab_cs i add k 1 get tl 0 |
| 5071 | end |
| 5072 | |
| 5073 | fn ab_decl i ulong k ulong to void |
| 5074 | ab_ident |
| 5075 | ab_name |
| 5076 | ab_setn i k |
| 5077 | end |
| 5078 | |
| 5079 | fn ab_find k ulong to ulong |
| 5080 | i = ulong 0 |
| 5081 | while lt i get abn 0 |
| 5082 | if eq ab_cg i 0 k |
| 5083 | if eq same_name ab_cg i 2 ab_cg i 3 1 |
| 5084 | ret i |
| 5085 | end |
| 5086 | end |
| 5087 | i = add i 1 |
| 5088 | end |
| 5089 | ret 4096 |
| 5090 | end |
| 5091 | |
| 5092 | fn ab_ref k ulong to ulong |
| 5093 | ab_next |
| 5094 | r = ab_find k |
| 5095 | if eq r 4096 |
| 5096 | fail 42 |
| 5097 | end |
| 5098 | ret r |
| 5099 | end |
| 5100 | |
| 5101 | fn ab_new k ulong to ulong |
| 5102 | i = get abn 0 |
| 5103 | if ge i 511 |
| 5104 | fail 14 |
| 5105 | end |
| 5106 | for j ulong 16 |
| 5107 | ab_cs i j 0 |
| 5108 | end |
| 5109 | ab_cs i 0 k |
| 5110 | ab_cs i 1 get line 0 |
| 5111 | put abn 0 add i 1 |
| 5112 | ret i |
| 5113 | end |
| 5114 | |
| 5115 | fn ab_param f ulong to ulong |
| 5116 | i = ulong 0 |
| 5117 | while lt i get fn_np f |
| 5118 | s = add mul f 6 i |
| 5119 | if eq same_name get fn_poff s get fn_pnl s 1 |
| 5120 | ret i |
| 5121 | end |
| 5122 | i = add i 1 |
| 5123 | end |
| 5124 | ret 4096 |
| 5125 | end |
| 5126 | |
| 5127 | note ---- declaration parsers ---- |
| 5128 | |
| 5129 | fn ab_file i ulong k ulong to void |
| 5130 | ab_next |
| 5131 | o = get ts 0 |
| 5132 | n = get tl 0 |
| 5133 | if gt n 63 |
| 5134 | fail 40 |
| 5135 | end |
| 5136 | c = ulong get src o |
| 5137 | if or eq c 46 eq c 45 |
| 5138 | fail 40 |
| 5139 | end |
| 5140 | for j ulong n |
| 5141 | c = ulong get src add o j |
| 5142 | if eq ab_chok c 0 0 |
| 5143 | fail 40 |
| 5144 | end |
| 5145 | end |
| 5146 | ab_setn i k |
| 5147 | end |
| 5148 | |
| 5149 | fn ab_lib i ulong to void |
| 5150 | if ne ab_count 2 1 |
| 5151 | fail 41 |
| 5152 | end |
| 5153 | ab_file i 2 |
| 5154 | ab_want 3 |
| 5155 | ab_file i 4 |
| 5156 | end |
| 5157 | |
| 5158 | fn ab_count k ulong to ulong |
| 5159 | c = ulong 0 |
| 5160 | i = ulong 0 |
| 5161 | while lt i get abn 0 |
| 5162 | if eq ab_cg i 0 k |
| 5163 | c = add c 1 |
| 5164 | end |
| 5165 | i = add i 1 |
| 5166 | end |
| 5167 | ret c |
| 5168 | end |
| 5169 | |
| 5170 | fn ab_lock i ulong to void |
| 5171 | ab_decl i 2 |
| 5172 | ab_want 5 |
| 5173 | ab_want 6 |
| 5174 | end |
| 5175 | |
| 5176 | fn ab_status i ulong to void |
| 5177 | ab_decl i 2 |
| 5178 | ab_decl i 4 |
| 5179 | ab_want 38 |
| 5180 | ab_want 37 |
| 5181 | v = ab_num |
| 5182 | ab_range v 0 2147483647 40 |
| 5183 | ab_cs i 6 v |
| 5184 | end |
| 5185 | |
| 5186 | fn ab_enum i ulong to void |
| 5187 | ab_decl i 2 |
| 5188 | ab_decl i 4 |
| 5189 | ab_want 39 |
| 5190 | end |
| 5191 | |
| 5192 | fn ab_value i ulong to void |
| 5193 | ab_next |
| 5194 | t = ab_find 7 |
| 5195 | if eq t 4096 |
| 5196 | t = ab_find 8 |
| 5197 | end |
| 5198 | if eq t 4096 |
| 5199 | fail 42 |
| 5200 | end |
| 5201 | ab_cs i 4 t |
| 5202 | ab_decl i 2 |
| 5203 | v = ab_num |
| 5204 | ab_range v 0 2147483647 40 |
| 5205 | j = ulong 0 |
| 5206 | while lt j i |
| 5207 | if and eq ab_cg j 0 9 eq ab_cg j 4 t |
| 5208 | if eq ab_cg j 6 v |
| 5209 | fail 41 |
| 5210 | end |
| 5211 | end |
| 5212 | j = add j 1 |
| 5213 | end |
| 5214 | ab_cs i 6 v |
| 5215 | end |
| 5216 | |
| 5217 | fn ab_define i ulong to void |
| 5218 | ab_decl i 2 |
| 5219 | ab_next |
| 5220 | o = get ts 0 |
| 5221 | n = get tl 0 |
| 5222 | if gt n 63 |
| 5223 | fail 40 |
| 5224 | end |
| 5225 | for j ulong n |
| 5226 | c = ulong get src add o j |
| 5227 | if eq ab_chok c 1 0 |
| 5228 | fail 40 |
| 5229 | end |
| 5230 | end |
| 5231 | ab_setn i 4 |
| 5232 | end |
| 5233 | |
| 5234 | fn ab_alias i ulong to void |
| 5235 | ab_decl i 2 |
| 5236 | ab_ident |
| 5237 | ab_setn i 4 |
| 5238 | end |
| 5239 | |
| 5240 | fn ab_aguard i ulong to void |
| 5241 | if ne ab_count 12 1 |
| 5242 | fail 41 |
| 5243 | end |
| 5244 | ab_decl i 2 |
| 5245 | end |
| 5246 | |
| 5247 | fn ab_handle i ulong to void |
| 5248 | ab_decl i 2 |
| 5249 | ab_decl i 4 |
| 5250 | ab_want 14 |
| 5251 | ab_decl i 6 |
| 5252 | ab_want 15 |
| 5253 | n = ab_num |
| 5254 | ab_range n 1 64 40 |
| 5255 | ab_cs i 8 n |
| 5256 | ab_want 4 |
| 5257 | ab_cs i 9 ab_ref 4 |
| 5258 | end |
| 5259 | |
| 5260 | fn ab_record i ulong to void |
| 5261 | ab_decl i 2 |
| 5262 | ab_decl i 4 |
| 5263 | ab_want 17 |
| 5264 | s = ab_num |
| 5265 | ab_range s 1 65536 44 |
| 5266 | ab_cs i 6 s |
| 5267 | ab_want 18 |
| 5268 | a = ab_num |
| 5269 | if and and ne a 1 ne a 2 and ne a 4 ne a 8 |
| 5270 | fail 44 |
| 5271 | end |
| 5272 | ab_cs i 7 a |
| 5273 | ab_cs i 11 1 |
| 5274 | if eq ab_more 1 |
| 5275 | if ne ab_kwid 11 |
| 5276 | fail 40 |
| 5277 | end |
| 5278 | ab_decl i 8 |
| 5279 | end |
| 5280 | end |
| 5281 | |
| 5282 | fn ab_field i ulong to void |
| 5283 | r = ab_ref 16 |
| 5284 | ab_ident |
| 5285 | j = ulong 0 |
| 5286 | while lt j i |
| 5287 | if and eq ab_cg j 0 19 eq ab_cg j 4 r |
| 5288 | if eq same_name ab_cg j 2 ab_cg j 3 1 |
| 5289 | fail 41 |
| 5290 | end |
| 5291 | end |
| 5292 | j = add j 1 |
| 5293 | end |
| 5294 | ab_setn i 2 |
| 5295 | ab_cs i 4 r |
| 5296 | w = ab_word |
| 5297 | ab_range w 38 41 40 |
| 5298 | ab_cs i 5 w |
| 5299 | z = ulong 4 |
| 5300 | if ge w 40 |
| 5301 | z = 8 |
| 5302 | end |
| 5303 | o = ab_num |
| 5304 | e = ab_cg r 10 |
| 5305 | nat = mul div add e sub z 1 z z |
| 5306 | if ne o nat |
| 5307 | fail 44 |
| 5308 | end |
| 5309 | ab_cs i 6 o |
| 5310 | ab_cs r 10 add o z |
| 5311 | if gt z ab_cg r 11 |
| 5312 | ab_cs r 11 z |
| 5313 | end |
| 5314 | ab_cs r 12 add ab_cg r 12 1 |
| 5315 | end |
| 5316 | |
| 5317 | fn ab_state i ulong to void |
| 5318 | ab_decl i 2 |
| 5319 | w = ab_word |
| 5320 | t = ulong 0 |
| 5321 | if eq w 43 |
| 5322 | t = 5 |
| 5323 | end |
| 5324 | if eq w 44 |
| 5325 | t = 2 |
| 5326 | end |
| 5327 | if eq t 0 |
| 5328 | fail 40 |
| 5329 | end |
| 5330 | ab_cs i 4 t |
| 5331 | n = ab_num |
| 5332 | ab_range n 1 16777216 40 |
| 5333 | ab_cs i 5 n |
| 5334 | ab_want 5 |
| 5335 | ab_want 4 |
| 5336 | ab_cs i 6 ab_ref 4 |
| 5337 | end |
| 5338 | |
| 5339 | fn ab_quote i ulong to void |
| 5340 | ab_next |
| 5341 | o = get ts 0 |
| 5342 | if ne get src o 34 |
| 5343 | fail 40 |
| 5344 | end |
| 5345 | e = add o sub get tl 0 1 |
| 5346 | go = ulong 1 |
| 5347 | if and gt get tl 0 1 eq get src e 34 |
| 5348 | go = 0 |
| 5349 | end |
| 5350 | while eq go 1 |
| 5351 | ab_next |
| 5352 | e = add get ts 0 sub get tl 0 1 |
| 5353 | if eq get src e 34 |
| 5354 | go = 0 |
| 5355 | end |
| 5356 | end |
| 5357 | s = add o 1 |
| 5358 | if le e s |
| 5359 | fail 40 |
| 5360 | end |
| 5361 | j = s |
| 5362 | while lt j e |
| 5363 | c = ulong get src j |
| 5364 | if eq ab_chok c 2 0 |
| 5365 | fail 40 |
| 5366 | end |
| 5367 | j = add j 1 |
| 5368 | end |
| 5369 | ab_cs i 7 s |
| 5370 | ab_cs i 8 sub e s |
| 5371 | end |
| 5372 | |
| 5373 | fn ab_cstr i ulong to void |
| 5374 | s = ab_ref 20 |
| 5375 | if ne ab_cg s 4 2 |
| 5376 | fail 48 |
| 5377 | end |
| 5378 | j = ulong 0 |
| 5379 | while lt j i |
| 5380 | if and eq ab_cg j 0 21 eq ab_cg j 4 s |
| 5381 | fail 41 |
| 5382 | end |
| 5383 | j = add j 1 |
| 5384 | end |
| 5385 | ab_cs i 4 s |
| 5386 | ab_cs i 2 ab_cg s 2 |
| 5387 | ab_cs i 3 ab_cg s 3 |
| 5388 | ab_want 22 |
| 5389 | n = ab_num |
| 5390 | ab_range n 1 256 40 |
| 5391 | ab_cs i 5 n |
| 5392 | ab_want 23 |
| 5393 | w = ab_num |
| 5394 | ab_range w 2 65536 40 |
| 5395 | ab_cs i 6 w |
| 5396 | if ne mul n w ab_cg s 5 |
| 5397 | fail 48 |
| 5398 | end |
| 5399 | ab_want 24 |
| 5400 | ab_quote i |
| 5401 | ab_want 4 |
| 5402 | l = ab_ref 4 |
| 5403 | if ne l ab_cg s 6 |
| 5404 | fail 48 |
| 5405 | end |
| 5406 | ab_cs i 9 l |
| 5407 | end |
| 5408 | |
| 5409 | fn ab_export i ulong to void |
| 5410 | ab_decl i 2 |
| 5411 | ab_next |
| 5412 | f = fn_of |
| 5413 | if eq f 4096 |
| 5414 | fail 42 |
| 5415 | end |
| 5416 | if ne get abfexp f 0 |
| 5417 | fail 41 |
| 5418 | end |
| 5419 | if ne get abfimp f 0 |
| 5420 | fail 49 |
| 5421 | end |
| 5422 | put abfexp f add i 1 |
| 5423 | ab_cs i 4 f |
| 5424 | w = ab_word |
| 5425 | r = ulong 0 |
| 5426 | if eq w 7 |
| 5427 | r = 1 |
| 5428 | ab_cs i 6 ab_ref 7 |
| 5429 | end |
| 5430 | if eq w 21 |
| 5431 | r = 2 |
| 5432 | ab_next |
| 5433 | c = ab_find 21 |
| 5434 | if eq c 4096 |
| 5435 | fail 48 |
| 5436 | end |
| 5437 | ab_cs i 6 c |
| 5438 | end |
| 5439 | if eq r 0 |
| 5440 | fail 46 |
| 5441 | end |
| 5442 | ab_cs i 5 r |
| 5443 | ab_want 4 |
| 5444 | l = ab_ref 4 |
| 5445 | ab_cs i 7 l |
| 5446 | if eq r 2 |
| 5447 | if ne l ab_cg ab_cg i 6 9 |
| 5448 | fail 45 |
| 5449 | end |
| 5450 | end |
| 5451 | ab_cs i 8 2 |
| 5452 | end |
| 5453 | |
| 5454 | fn ab_edit q ulong t ulong x ulong to ulong |
| 5455 | if ne get fn_pk q 3 |
| 5456 | ret 0 |
| 5457 | end |
| 5458 | if ne get fn_pt q t |
| 5459 | ret 0 |
| 5460 | end |
| 5461 | if ne get fn_pl q x |
| 5462 | ret 0 |
| 5463 | end |
| 5464 | ret 1 |
| 5465 | end |
| 5466 | |
| 5467 | fn ab_bind i ulong to void |
| 5468 | e = ab_ref 25 |
| 5469 | f = ab_cg e 4 |
| 5470 | ab_next |
| 5471 | p = ab_param f |
| 5472 | if eq p 4096 |
| 5473 | fail 42 |
| 5474 | end |
| 5475 | if eq p 0 |
| 5476 | fail 45 |
| 5477 | end |
| 5478 | s = ab_ref 20 |
| 5479 | j = ulong 0 |
| 5480 | while lt j i |
| 5481 | if and eq ab_cg j 0 26 eq ab_cg j 4 e |
| 5482 | if or eq ab_cg j 6 p eq ab_cg j 5 s |
| 5483 | fail 41 |
| 5484 | end |
| 5485 | end |
| 5486 | j = add j 1 |
| 5487 | end |
| 5488 | if eq ab_edit add mul f 6 p ab_cg s 4 ab_cg s 5 0 |
| 5489 | fail 45 |
| 5490 | end |
| 5491 | if ne ab_cg s 6 ab_cg e 7 |
| 5492 | fail 45 |
| 5493 | end |
| 5494 | ab_cs i 4 e |
| 5495 | ab_cs i 5 s |
| 5496 | ab_cs i 6 p |
| 5497 | end |
| 5498 | |
| 5499 | fn ab_type to ulong |
| 5500 | w = ab_kwid |
| 5501 | if and ge w 38 le w 42 |
| 5502 | ret add 1000 w |
| 5503 | end |
| 5504 | t = ab_find 7 |
| 5505 | if eq t 4096 |
| 5506 | t = ab_find 8 |
| 5507 | end |
| 5508 | if eq t 4096 |
| 5509 | t = ab_find 13 |
| 5510 | end |
| 5511 | if eq t 4096 |
| 5512 | t = ab_find 16 |
| 5513 | end |
| 5514 | if eq t 4096 |
| 5515 | fail 42 |
| 5516 | end |
| 5517 | ret t |
| 5518 | end |
| 5519 | |
| 5520 | fn ab_tcat t ulong to ulong |
| 5521 | if ge t 1000 |
| 5522 | if eq t 1042 |
| 5523 | ret 2 |
| 5524 | end |
| 5525 | ret 1 |
| 5526 | end |
| 5527 | k = ab_cg t 0 |
| 5528 | if eq k 13 |
| 5529 | ret 4 |
| 5530 | end |
| 5531 | if eq k 16 |
| 5532 | ret 5 |
| 5533 | end |
| 5534 | ret 3 |
| 5535 | end |
| 5536 | |
| 5537 | fn ab_slots i ulong e ulong n ulong to void |
| 5538 | ab_cs i 11 ab_cg e 8 |
| 5539 | ab_cs e 8 add ab_cg e 8 n |
| 5540 | end |
| 5541 | |
| 5542 | fn ab_arg i ulong to void |
| 5543 | e = ab_ref 25 |
| 5544 | ab_ident |
| 5545 | j = ulong 0 |
| 5546 | while lt j i |
| 5547 | if and eq ab_cg j 0 27 eq ab_cg j 4 e |
| 5548 | if eq same_name ab_cg j 2 ab_cg j 3 1 |
| 5549 | fail 41 |
| 5550 | end |
| 5551 | end |
| 5552 | j = add j 1 |
| 5553 | end |
| 5554 | ab_setn i 2 |
| 5555 | ab_cs i 4 e |
| 5556 | ab_next |
| 5557 | w = ab_kwid |
| 5558 | d = ulong 0 |
| 5559 | if eq w 28 |
| 5560 | w = ab_word |
| 5561 | if eq w 29 |
| 5562 | d = 1 |
| 5563 | end |
| 5564 | if eq w 30 |
| 5565 | d = 2 |
| 5566 | end |
| 5567 | if eq d 0 |
| 5568 | fail 43 |
| 5569 | end |
| 5570 | ab_next |
| 5571 | else |
| 5572 | if or eq w 29 eq w 30 |
| 5573 | fail 43 |
| 5574 | end |
| 5575 | end |
| 5576 | t = ab_type |
| 5577 | ab_cs i 6 t |
| 5578 | ab_cs i 13 d |
| 5579 | if eq d 0 |
| 5580 | ab_argin i e t |
| 5581 | else |
| 5582 | if eq ab_cg e 5 2 |
| 5583 | fail 46 |
| 5584 | end |
| 5585 | ab_argout i e t d |
| 5586 | end |
| 5587 | end |
| 5588 | |
| 5589 | fn ab_argin i ulong e ulong t ulong to void |
| 5590 | c = ab_tcat t |
| 5591 | k = ulong 0 |
| 5592 | if or eq c 1 eq c 3 |
| 5593 | k = 1 |
| 5594 | end |
| 5595 | if eq c 4 |
| 5596 | if ne ab_cg t 9 ab_cg e 7 |
| 5597 | fail 45 |
| 5598 | end |
| 5599 | k = 2 |
| 5600 | end |
| 5601 | if eq k 0 |
| 5602 | fail 46 |
| 5603 | end |
| 5604 | ab_cs i 5 k |
| 5605 | ab_slots i e 1 |
| 5606 | end |
| 5607 | |
| 5608 | fn ab_argout i ulong e ulong t ulong d ulong to void |
| 5609 | c = ab_tcat t |
| 5610 | k = ulong 0 |
| 5611 | if or eq c 1 eq c 3 |
| 5612 | k = 3 |
| 5613 | if eq d 2 |
| 5614 | k = 4 |
| 5615 | end |
| 5616 | end |
| 5617 | if and gt c 1 ne c 3 |
| 5618 | if eq d 2 |
| 5619 | fail 40 |
| 5620 | end |
| 5621 | end |
| 5622 | if eq c 4 |
| 5623 | if ne ab_cg t 9 ab_cg e 7 |
| 5624 | fail 45 |
| 5625 | end |
| 5626 | k = 5 |
| 5627 | end |
| 5628 | w = ab_word |
| 5629 | if eq c 2 |
| 5630 | k = 6 |
| 5631 | if ne w 32 |
| 5632 | fail 47 |
| 5633 | end |
| 5634 | ab_next |
| 5635 | ab_setn i 14 |
| 5636 | w = ab_word |
| 5637 | end |
| 5638 | if eq c 5 |
| 5639 | k = 7 |
| 5640 | if eq w 15 |
| 5641 | k = 8 |
| 5642 | ab_next |
| 5643 | ab_setn i 14 |
| 5644 | w = ab_word |
| 5645 | end |
| 5646 | end |
| 5647 | ab_cs i 5 k |
| 5648 | if ne w 31 |
| 5649 | fail 40 |
| 5650 | end |
| 5651 | ab_commit i e |
| 5652 | n = ulong 2 |
| 5653 | if eq k 7 |
| 5654 | n = 1 |
| 5655 | end |
| 5656 | ab_slots i e n |
| 5657 | if ge k 6 |
| 5658 | ab_data i t |
| 5659 | end |
| 5660 | end |
| 5661 | |
| 5662 | fn ab_commit i ulong e ulong to void |
| 5663 | b = ab_num |
| 5664 | ab_range b 0 61 40 |
| 5665 | j = ulong 0 |
| 5666 | while lt j i |
| 5667 | if and eq ab_cg j 0 27 eq ab_cg j 4 e |
| 5668 | if and ge ab_cg j 5 3 eq ab_cg j 7 b |
| 5669 | fail 41 |
| 5670 | end |
| 5671 | end |
| 5672 | j = add j 1 |
| 5673 | end |
| 5674 | ab_cs i 7 b |
| 5675 | end |
| 5676 | |
| 5677 | fn ab_data i ulong t ulong to void |
| 5678 | if ne ab_word 33 |
| 5679 | fail 47 |
| 5680 | end |
| 5681 | s = ab_ref 20 |
| 5682 | if ne ab_cg s 4 2 |
| 5683 | fail 47 |
| 5684 | end |
| 5685 | o = ab_num |
| 5686 | x = ab_cg s 5 |
| 5687 | if ge o x |
| 5688 | fail 47 |
| 5689 | end |
| 5690 | if eq ab_cg i 5 7 |
| 5691 | if gt add o ab_cg t 6 x |
| 5692 | fail 47 |
| 5693 | end |
| 5694 | end |
| 5695 | ab_cs i 9 s |
| 5696 | ab_cs i 10 o |
| 5697 | end |
| 5698 | |
| 5699 | fn ab_import i ulong to void |
| 5700 | ab_next |
| 5701 | f = fn_of |
| 5702 | if eq f 4096 |
| 5703 | fail 42 |
| 5704 | end |
| 5705 | if ne get abfexp f 0 |
| 5706 | fail 49 |
| 5707 | end |
| 5708 | if ne get abfimp f 0 |
| 5709 | fail 41 |
| 5710 | end |
| 5711 | if ne get fn_ret f 5 |
| 5712 | fail 49 |
| 5713 | end |
| 5714 | put abfimp f add i 1 |
| 5715 | ab_cs i 4 f |
| 5716 | ab_cs i 2 get fn_off f |
| 5717 | ab_cs i 3 get fn_nl f |
| 5718 | ab_next |
| 5719 | ab_idchk 1 |
| 5720 | ab_name |
| 5721 | ab_setn i 5 |
| 5722 | r = ulong 0 |
| 5723 | while eq ab_more 1 |
| 5724 | w = ab_kwid |
| 5725 | if eq w 35 |
| 5726 | r = add r 1 |
| 5727 | end |
| 5728 | ab_item i f w |
| 5729 | end |
| 5730 | if gt r 1 |
| 5731 | fail 41 |
| 5732 | end |
| 5733 | end |
| 5734 | |
| 5735 | fn ab_iparam f ulong to ulong |
| 5736 | ab_next |
| 5737 | p = ab_param f |
| 5738 | if eq p 4096 |
| 5739 | fail 49 |
| 5740 | end |
| 5741 | ret p |
| 5742 | end |
| 5743 | |
| 5744 | fn ab_item i ulong f ulong w ulong to void |
| 5745 | u = ab_new 60 |
| 5746 | ab_cs u 4 i |
| 5747 | ab_cs u 5 w |
| 5748 | p = ab_iparam f |
| 5749 | ab_cs u 6 p |
| 5750 | q = add mul f 6 p |
| 5751 | k = get fn_pk q |
| 5752 | t = get fn_pt q |
| 5753 | if eq w 35 |
| 5754 | if or ne k 3 ne t 5 |
| 5755 | fail 49 |
| 5756 | end |
| 5757 | ret |
| 5758 | end |
| 5759 | if eq w 9 |
| 5760 | if ne k 0 |
| 5761 | fail 49 |
| 5762 | end |
| 5763 | ret |
| 5764 | end |
| 5765 | if ne w 36 |
| 5766 | fail 40 |
| 5767 | end |
| 5768 | if or eq k 0 and ne t 2 ne t 5 |
| 5769 | fail 49 |
| 5770 | end |
| 5771 | o = ab_num |
| 5772 | if gt o get fn_pl q |
| 5773 | fail 49 |
| 5774 | end |
| 5775 | ab_cs u 7 o |
| 5776 | l = ab_iparam f |
| 5777 | if ne get fn_pk add mul f 6 l 0 |
| 5778 | fail 49 |
| 5779 | end |
| 5780 | ab_cs u 8 l |
| 5781 | end |
| 5782 | |
| 5783 | fn ab_line to void |
| 5784 | d = ab_word |
| 5785 | i = ab_new d |
| 5786 | ok = ulong 1 |
| 5787 | if eq d 2 |
| 5788 | ab_lib i |
| 5789 | else |
| 5790 | if eq d 4 |
| 5791 | ab_lock i |
| 5792 | else |
| 5793 | if eq d 7 |
| 5794 | ab_status i |
| 5795 | else |
| 5796 | if eq d 8 |
| 5797 | ab_enum i |
| 5798 | else |
| 5799 | ok = ab_line2 d i |
| 5800 | end |
| 5801 | end |
| 5802 | end |
| 5803 | end |
| 5804 | if eq ok 0 |
| 5805 | fail 40 |
| 5806 | end |
| 5807 | ab_end |
| 5808 | end |
| 5809 | |
| 5810 | fn ab_line2 d ulong i ulong to ulong |
| 5811 | if eq d 9 |
| 5812 | ab_value i |
| 5813 | ret 1 |
| 5814 | end |
| 5815 | if eq d 10 |
| 5816 | ab_define i |
| 5817 | ret 1 |
| 5818 | end |
| 5819 | if eq d 11 |
| 5820 | ab_alias i |
| 5821 | ret 1 |
| 5822 | end |
| 5823 | if eq d 12 |
| 5824 | ab_aguard i |
| 5825 | ret 1 |
| 5826 | end |
| 5827 | if eq d 13 |
| 5828 | ab_handle i |
| 5829 | ret 1 |
| 5830 | end |
| 5831 | if eq d 16 |
| 5832 | ab_record i |
| 5833 | ret 1 |
| 5834 | end |
| 5835 | if eq d 19 |
| 5836 | ab_field i |
| 5837 | ret 1 |
| 5838 | end |
| 5839 | ret ab_line3 d i |
| 5840 | end |
| 5841 | |
| 5842 | fn ab_line3 d ulong i ulong to ulong |
| 5843 | if eq d 20 |
| 5844 | ab_state i |
| 5845 | ret 1 |
| 5846 | end |
| 5847 | if eq d 21 |
| 5848 | ab_cstr i |
| 5849 | ret 1 |
| 5850 | end |
| 5851 | if eq d 25 |
| 5852 | ab_export i |
| 5853 | ret 1 |
| 5854 | end |
| 5855 | if eq d 26 |
| 5856 | ab_bind i |
| 5857 | ret 1 |
| 5858 | end |
| 5859 | if eq d 27 |
| 5860 | ab_arg i |
| 5861 | ret 1 |
| 5862 | end |
| 5863 | if eq d 34 |
| 5864 | ab_import i |
| 5865 | ret 1 |
| 5866 | end |
| 5867 | ret 0 |
| 5868 | end |
| 5869 | |
| 5870 | fn ab_scan to void |
| 5871 | put cur 0 1 |
| 5872 | put line 0 1 |
| 5873 | put held 0 0 |
| 5874 | put abn 0 0 |
| 5875 | put abnmn 0 0 |
| 5876 | tok |
| 5877 | while ne get tk 0 3 |
| 5878 | if eq isw 1702129518 1 |
| 5879 | tok |
| 5880 | if eq ab_kwid 1 |
| 5881 | ab_line |
| 5882 | end |
| 5883 | end |
| 5884 | while and ne get tk 0 0 ne get tk 0 3 |
| 5885 | tok |
| 5886 | end |
| 5887 | tok |
| 5888 | end |
| 5889 | end |
| 5890 | |
| 5891 | note ---- whole-declaration validation ---- |
| 5892 | |
| 5893 | fn ab_hasval t ulong v ulong to ulong |
| 5894 | c = ulong 0 |
| 5895 | i = ulong 0 |
| 5896 | while lt i get abn 0 |
| 5897 | if and eq ab_cg i 0 9 eq ab_cg i 4 t |
| 5898 | c = add c 1 |
| 5899 | if eq ab_cg i 6 v |
| 5900 | ret 2 |
| 5901 | end |
| 5902 | end |
| 5903 | i = add i 1 |
| 5904 | end |
| 5905 | if gt c 0 |
| 5906 | ret 1 |
| 5907 | end |
| 5908 | ret 0 |
| 5909 | end |
| 5910 | |
| 5911 | fn ab_reccheck r ulong to void |
| 5912 | a = ab_cg r 11 |
| 5913 | e = ab_cg r 10 |
| 5914 | if eq ab_cg r 12 0 |
| 5915 | ab_bad 44 r |
| 5916 | end |
| 5917 | if ne ab_cg r 6 mul div add e sub a 1 a a |
| 5918 | ab_bad 44 r |
| 5919 | end |
| 5920 | if ne ab_cg r 7 a |
| 5921 | ab_bad 44 r |
| 5922 | end |
| 5923 | end |
| 5924 | |
| 5925 | fn ab_bound e ulong p ulong to ulong |
| 5926 | i = ulong 0 |
| 5927 | while lt i get abn 0 |
| 5928 | if and eq ab_cg i 0 26 eq ab_cg i 4 e |
| 5929 | if eq ab_cg i 6 p |
| 5930 | ret ab_cg i 5 |
| 5931 | end |
| 5932 | end |
| 5933 | i = add i 1 |
| 5934 | end |
| 5935 | ret 4096 |
| 5936 | end |
| 5937 | |
| 5938 | fn ab_expcheck e ulong to void |
| 5939 | f = ab_cg e 4 |
| 5940 | if ne get fn_ret f 5 |
| 5941 | ab_bad 45 e |
| 5942 | end |
| 5943 | if eq ab_edit mul f 6 5 ab_cg e 8 0 |
| 5944 | ab_bad 45 e |
| 5945 | end |
| 5946 | p = ulong 1 |
| 5947 | while lt p get fn_np f |
| 5948 | if eq ab_bound e p 4096 |
| 5949 | ab_bad 45 e |
| 5950 | end |
| 5951 | p = add p 1 |
| 5952 | end |
| 5953 | end |
| 5954 | |
| 5955 | fn ab_argref a ulong to ulong |
| 5956 | e = ab_cg a 4 |
| 5957 | i = ulong 0 |
| 5958 | while lt i get abn 0 |
| 5959 | if and eq ab_cg i 0 27 eq ab_cg i 4 e |
| 5960 | if eq ab_speq ab_cg i 2 ab_cg i 3 ab_cg a 14 ab_cg a 15 1 |
| 5961 | ret i |
| 5962 | end |
| 5963 | end |
| 5964 | i = add i 1 |
| 5965 | end |
| 5966 | ab_bad 42 a |
| 5967 | ret 0 |
| 5968 | end |
| 5969 | |
| 5970 | fn ab_argcheck a ulong to void |
| 5971 | k = ab_cg a 5 |
| 5972 | if lt k 6 |
| 5973 | ret |
| 5974 | end |
| 5975 | e = ab_cg a 4 |
| 5976 | s = ab_cg a 9 |
| 5977 | f = ulong 0 |
| 5978 | i = ulong 1 |
| 5979 | while lt i get fn_np ab_cg e 4 |
| 5980 | if eq ab_bound e i s |
| 5981 | f = 1 |
| 5982 | end |
| 5983 | i = add i 1 |
| 5984 | end |
| 5985 | if eq f 0 |
| 5986 | ab_bad 45 a |
| 5987 | end |
| 5988 | if eq k 7 |
| 5989 | ret |
| 5990 | end |
| 5991 | r = ab_argref a |
| 5992 | t = ab_cg r 6 |
| 5993 | if and ne t 1039 ne t 1041 |
| 5994 | ab_bad 47 a |
| 5995 | end |
| 5996 | w = ulong 1 |
| 5997 | if eq k 8 |
| 5998 | w = 4 |
| 5999 | end |
| 6000 | if ne ab_cg r 5 w |
| 6001 | ab_bad 47 a |
| 6002 | end |
| 6003 | ab_cs a 8 r |
| 6004 | end |
| 6005 | |
| 6006 | fn ab_alcheck a ulong to void |
| 6007 | i = ulong 0 |
| 6008 | while lt i get abn 0 |
| 6009 | if eq ab_cg i 0 25 |
| 6010 | if eq ab_speq ab_cg i 2 ab_cg i 3 ab_cg a 4 ab_cg a 5 1 |
| 6011 | ab_cs a 6 i |
| 6012 | ret |
| 6013 | end |
| 6014 | end |
| 6015 | i = add i 1 |
| 6016 | end |
| 6017 | ab_bad 42 a |
| 6018 | end |
| 6019 | |
| 6020 | fn ab_resolve to void |
| 6021 | i = ulong 0 |
| 6022 | while lt i get abn 0 |
| 6023 | k = ab_cg i 0 |
| 6024 | if eq k 16 |
| 6025 | ab_reccheck i |
| 6026 | end |
| 6027 | if eq k 7 |
| 6028 | if ne ab_hasval i ab_cg i 6 2 |
| 6029 | ab_bad 40 i |
| 6030 | end |
| 6031 | end |
| 6032 | if eq k 8 |
| 6033 | if eq ab_hasval i 4294967296 0 |
| 6034 | ab_bad 40 i |
| 6035 | end |
| 6036 | end |
| 6037 | if eq k 25 |
| 6038 | ab_expcheck i |
| 6039 | end |
| 6040 | if eq k 27 |
| 6041 | ab_argcheck i |
| 6042 | end |
| 6043 | if eq k 11 |
| 6044 | ab_alcheck i |
| 6045 | end |
| 6046 | i = add i 1 |
| 6047 | end |
| 6048 | put line 0 1 |
| 6049 | if ne ab_count 2 1 |
| 6050 | fail 50 |
| 6051 | end |
| 6052 | if eq ab_count 25 0 |
| 6053 | fail 50 |
| 6054 | end |
| 6055 | end |
| 6056 | |
| 6057 | note ---- shared C emission ---- |
| 6058 | |
| 6059 | fn ab_prov to void |
| 6060 | p = get abprov 0 |
| 6061 | ab_ce 0 |
| 6062 | e_src add p 1 64 |
| 6063 | ab_ce 1 |
| 6064 | e_src add p 66 64 |
| 6065 | ab_ce 2 |
| 6066 | end |
| 6067 | |
| 6068 | fn ab_ctype w ulong to void |
| 6069 | if eq w 38 |
| 6070 | ab_ce 3 |
| 6071 | end |
| 6072 | if eq w 39 |
| 6073 | ab_ce 4 |
| 6074 | end |
| 6075 | if eq w 40 |
| 6076 | ab_ce 5 |
| 6077 | end |
| 6078 | if eq w 41 |
| 6079 | ab_ce 6 |
| 6080 | end |
| 6081 | end |
| 6082 | |
| 6083 | fn ab_tyname t ulong to void |
| 6084 | if ge t 1000 |
| 6085 | ab_ctype sub t 1000 |
| 6086 | else |
| 6087 | ab_nm t |
| 6088 | end |
| 6089 | end |
| 6090 | |
| 6091 | fn ab_enumty t ulong to void |
| 6092 | ab_ce 7 |
| 6093 | ab_nm2 t 4 |
| 6094 | ab_ce 8 |
| 6095 | n = ab_hasval t 4294967296 |
| 6096 | c = ulong 0 |
| 6097 | i = ulong 0 |
| 6098 | while lt i get abn 0 |
| 6099 | if and eq ab_cg i 0 9 eq ab_cg i 4 t |
| 6100 | if gt c 0 |
| 6101 | ab_ce 9 |
| 6102 | end |
| 6103 | ab_ce 10 |
| 6104 | ab_nm i |
| 6105 | ab_ce 11 |
| 6106 | e_dec ab_cg i 6 |
| 6107 | c = add c 1 |
| 6108 | end |
| 6109 | i = add i 1 |
| 6110 | end |
| 6111 | ab_ce 12 |
| 6112 | ab_nm t |
| 6113 | ab_ce 13 |
| 6114 | end |
| 6115 | |
| 6116 | fn ab_recty r ulong to void |
| 6117 | ab_ce 14 |
| 6118 | ab_nm2 r 4 |
| 6119 | ab_ce 8 |
| 6120 | i = ulong 0 |
| 6121 | while lt i get abn 0 |
| 6122 | if and eq ab_cg i 0 19 eq ab_cg i 4 r |
| 6123 | ab_ce 10 |
| 6124 | ab_ctype ab_cg i 5 |
| 6125 | ab_ce 15 |
| 6126 | ab_nm i |
| 6127 | ab_ce 13 |
| 6128 | end |
| 6129 | i = add i 1 |
| 6130 | end |
| 6131 | ab_ce 16 |
| 6132 | ab_nm r |
| 6133 | if gt ab_cg r 9 0 |
| 6134 | ab_ce 17 |
| 6135 | ab_nm2 r 8 |
| 6136 | end |
| 6137 | ab_ce 13 |
| 6138 | end |
| 6139 | |
| 6140 | fn ab_types to void |
| 6141 | i = ulong 0 |
| 6142 | while lt i get abn 0 |
| 6143 | k = ab_cg i 0 |
| 6144 | if eq k 13 |
| 6145 | ab_ce 14 |
| 6146 | ab_nm2 i 4 |
| 6147 | ab_ce 18 |
| 6148 | ab_nm i |
| 6149 | ab_ce 13 |
| 6150 | end |
| 6151 | if eq k 16 |
| 6152 | ab_recty i |
| 6153 | end |
| 6154 | if or eq k 7 eq k 8 |
| 6155 | ab_enumty i |
| 6156 | end |
| 6157 | i = add i 1 |
| 6158 | end |
| 6159 | end |
| 6160 | |
| 6161 | fn ab_argdecl a ulong to void |
| 6162 | k = ab_cg a 5 |
| 6163 | if eq k 6 |
| 6164 | ab_ce 19 |
| 6165 | else |
| 6166 | ab_tyname ab_cg a 6 |
| 6167 | if le k 2 |
| 6168 | ab_ce 15 |
| 6169 | else |
| 6170 | ab_ce 18 |
| 6171 | end |
| 6172 | end |
| 6173 | ab_nm a |
| 6174 | end |
| 6175 | |
| 6176 | fn ab_proto e ulong to void |
| 6177 | if eq ab_cg e 5 1 |
| 6178 | ab_nm ab_cg e 6 |
| 6179 | ab_ce 15 |
| 6180 | else |
| 6181 | ab_ce 20 |
| 6182 | end |
| 6183 | ab_nm e |
| 6184 | ab_ce 21 |
| 6185 | c = ulong 0 |
| 6186 | i = ulong 0 |
| 6187 | while lt i get abn 0 |
| 6188 | if and eq ab_cg i 0 27 eq ab_cg i 4 e |
| 6189 | if gt c 0 |
| 6190 | ab_ce 17 |
| 6191 | end |
| 6192 | ab_argdecl i |
| 6193 | c = add c 1 |
| 6194 | end |
| 6195 | i = add i 1 |
| 6196 | end |
| 6197 | if eq c 0 |
| 6198 | ab_ce 22 |
| 6199 | end |
| 6200 | ab_ce 23 |
| 6201 | end |
| 6202 | |
| 6203 | note ---- header (lib-h) and version script (lib-map) ---- |
| 6204 | |
| 6205 | fn ab_guard to void |
| 6206 | l = ab_find_kind 2 |
| 6207 | ab_ce 24 |
| 6208 | o = ab_cg l 4 |
| 6209 | for j ulong ab_cg l 5 |
| 6210 | c = ulong get src add o j |
| 6211 | if and ge c 97 le c 122 |
| 6212 | c = sub c 32 |
| 6213 | end |
| 6214 | if and eq ab_alpha c 0 eq ab_digit c 0 |
| 6215 | c = 95 |
| 6216 | end |
| 6217 | e_b c |
| 6218 | end |
| 6219 | end |
| 6220 | |
| 6221 | fn ab_find_kind k ulong to ulong |
| 6222 | i = ulong 0 |
| 6223 | while lt i get abn 0 |
| 6224 | if eq ab_cg i 0 k |
| 6225 | ret i |
| 6226 | end |
| 6227 | i = add i 1 |
| 6228 | end |
| 6229 | ret 4096 |
| 6230 | end |
| 6231 | |
| 6232 | fn ab_aliases to void |
| 6233 | if eq ab_count 11 0 |
| 6234 | ret |
| 6235 | end |
| 6236 | g = ab_find_kind 12 |
| 6237 | if ne g 4096 |
| 6238 | ab_ce 25 |
| 6239 | ab_nm g |
| 6240 | ab_ce 26 |
| 6241 | end |
| 6242 | i = ulong 0 |
| 6243 | while lt i get abn 0 |
| 6244 | if eq ab_cg i 0 11 |
| 6245 | ab_ce 27 |
| 6246 | ab_nm i |
| 6247 | ab_ce 15 |
| 6248 | ab_nm2 i 4 |
| 6249 | ab_ce 26 |
| 6250 | end |
| 6251 | i = add i 1 |
| 6252 | end |
| 6253 | if ne g 4096 |
| 6254 | ab_ce 28 |
| 6255 | end |
| 6256 | end |
| 6257 | |
| 6258 | fn ab_header to void |
| 6259 | ab_prov |
| 6260 | ab_ce 25 |
| 6261 | ab_guard |
| 6262 | ab_ce 29 |
| 6263 | ab_guard |
| 6264 | ab_ce 30 |
| 6265 | ab_aliases |
| 6266 | i = ulong 0 |
| 6267 | while lt i get abn 0 |
| 6268 | if eq ab_cg i 0 10 |
| 6269 | ab_ce 27 |
| 6270 | ab_nm i |
| 6271 | ab_ce 15 |
| 6272 | ab_nm2 i 4 |
| 6273 | ab_ce 26 |
| 6274 | end |
| 6275 | i = add i 1 |
| 6276 | end |
| 6277 | ab_types |
| 6278 | i = 0 |
| 6279 | while lt i get abn 0 |
| 6280 | if eq ab_cg i 0 25 |
| 6281 | ab_proto i |
| 6282 | ab_ce 13 |
| 6283 | end |
| 6284 | i = add i 1 |
| 6285 | end |
| 6286 | ab_ce 31 |
| 6287 | end |
| 6288 | |
| 6289 | fn ab_map to void |
| 6290 | ab_prov |
| 6291 | ab_ce 32 |
| 6292 | i = ulong 0 |
| 6293 | while lt i get abn 0 |
| 6294 | if eq ab_cg i 0 25 |
| 6295 | ab_ce 10 |
| 6296 | ab_nm i |
| 6297 | ab_ce 13 |
| 6298 | end |
| 6299 | i = add i 1 |
| 6300 | end |
| 6301 | ab_ce 33 |
| 6302 | end |
| 6303 | |
| 6304 | note ---- library C (lib-c): declarations after the runtime ---- |
| 6305 | |
| 6306 | fn ab_inset t ulong to void |
| 6307 | ab_ce 34 |
| 6308 | e_dec t |
| 6309 | ab_ce 35 |
| 6310 | i = ulong 0 |
| 6311 | while lt i get abn 0 |
| 6312 | if and eq ab_cg i 0 9 eq ab_cg i 4 t |
| 6313 | ab_ce 36 |
| 6314 | e_dec ab_cg i 6 |
| 6315 | ab_ce 37 |
| 6316 | end |
| 6317 | i = add i 1 |
| 6318 | end |
| 6319 | ab_ce 38 |
| 6320 | end |
| 6321 | |
| 6322 | fn ab_pool h ulong to void |
| 6323 | ab_ce 39 |
| 6324 | ab_nm2 h 4 |
| 6325 | ab_ce 40 |
| 6326 | ab_nm2 h 4 |
| 6327 | ab_ce 15 |
| 6328 | ab_nm2 h 6 |
| 6329 | ab_ce 41 |
| 6330 | e_dec ab_cg h 8 |
| 6331 | ab_ce 42 |
| 6332 | e_dec h |
| 6333 | ab_ce 21 |
| 6334 | ab_nm h |
| 6335 | ab_ce 43 |
| 6336 | ab_nm2 h 6 |
| 6337 | ab_ce 44 |
| 6338 | ab_nm2 h 6 |
| 6339 | ab_ce 45 |
| 6340 | ab_nm2 h 6 |
| 6341 | ab_ce 46 |
| 6342 | ab_nm2 h 6 |
| 6343 | ab_ce 47 |
| 6344 | ab_nm2 h 6 |
| 6345 | ab_ce 48 |
| 6346 | ab_nm2 h 6 |
| 6347 | ab_ce 49 |
| 6348 | ab_nm h |
| 6349 | ab_ce 50 |
| 6350 | e_dec h |
| 6351 | ab_ce 51 |
| 6352 | ab_nm2 h 6 |
| 6353 | ab_ce 52 |
| 6354 | ab_nm2 h 6 |
| 6355 | ab_ce 53 |
| 6356 | ab_nm2 h 6 |
| 6357 | ab_ce 54 |
| 6358 | end |
| 6359 | |
| 6360 | fn ab_recasrt r ulong to void |
| 6361 | ab_ce 55 |
| 6362 | ab_nm r |
| 6363 | ab_ce 56 |
| 6364 | e_dec ab_cg r 6 |
| 6365 | ab_ce 57 |
| 6366 | ab_nm r |
| 6367 | ab_ce 56 |
| 6368 | e_dec ab_cg r 7 |
| 6369 | ab_ce 58 |
| 6370 | end |
| 6371 | |
| 6372 | fn ab_fldasrt i ulong to void |
| 6373 | ab_ce 59 |
| 6374 | ab_nm ab_cg i 4 |
| 6375 | ab_ce 60 |
| 6376 | ab_nm i |
| 6377 | ab_ce 56 |
| 6378 | e_dec ab_cg i 6 |
| 6379 | ab_ce 58 |
| 6380 | end |
| 6381 | |
| 6382 | fn ab_stdecl s ulong to void |
| 6383 | if eq ab_cg s 4 5 |
| 6384 | ab_ce 61 |
| 6385 | ab_nm s |
| 6386 | ab_ce 41 |
| 6387 | e_dec ab_cg s 5 |
| 6388 | ab_ce 62 |
| 6389 | else |
| 6390 | ab_ce 63 |
| 6391 | ab_nm s |
| 6392 | ab_ce 41 |
| 6393 | e_dec ab_cg s 5 |
| 6394 | ab_ce 64 |
| 6395 | end |
| 6396 | end |
| 6397 | |
| 6398 | fn ab_impdecl m ulong to void |
| 6399 | f = ab_cg m 4 |
| 6400 | ab_ce 65 |
| 6401 | ab_nm2 m 5 |
| 6402 | ab_ce 21 |
| 6403 | c = ulong 0 |
| 6404 | i = ulong 0 |
| 6405 | while lt i get abn 0 |
| 6406 | if and eq ab_cg i 0 60 eq ab_cg i 4 m |
| 6407 | if gt c 0 |
| 6408 | ab_ce 60 |
| 6409 | end |
| 6410 | w = ab_cg i 5 |
| 6411 | if eq w 35 |
| 6412 | ab_ce 66 |
| 6413 | end |
| 6414 | if eq w 9 |
| 6415 | ab_ce 67 |
| 6416 | end |
| 6417 | if eq w 36 |
| 6418 | if eq get fn_pk add mul f 6 ab_cg i 6 2 |
| 6419 | ab_ce 68 |
| 6420 | else |
| 6421 | ab_ce 69 |
| 6422 | end |
| 6423 | end |
| 6424 | c = add c 1 |
| 6425 | end |
| 6426 | i = add i 1 |
| 6427 | end |
| 6428 | if eq c 0 |
| 6429 | ab_ce 22 |
| 6430 | end |
| 6431 | ab_ce 70 |
| 6432 | end |
| 6433 | |
| 6434 | fn ab_pre to void |
| 6435 | ab_ce 71 |
| 6436 | ab_types |
| 6437 | i = ulong 0 |
| 6438 | while lt i get abn 0 |
| 6439 | k = ab_cg i 0 |
| 6440 | if eq k 13 |
| 6441 | ab_pool i |
| 6442 | end |
| 6443 | if eq k 16 |
| 6444 | ab_recasrt i |
| 6445 | end |
| 6446 | if eq k 19 |
| 6447 | ab_fldasrt i |
| 6448 | end |
| 6449 | if or eq k 7 eq k 8 |
| 6450 | ab_inset i |
| 6451 | end |
| 6452 | ab_pre2 i k |
| 6453 | i = add i 1 |
| 6454 | end |
| 6455 | end |
| 6456 | |
| 6457 | fn ab_pre2 i ulong k ulong to void |
| 6458 | if eq k 4 |
| 6459 | ab_ce 72 |
| 6460 | ab_nm i |
| 6461 | ab_ce 73 |
| 6462 | end |
| 6463 | if eq k 20 |
| 6464 | ab_stdecl i |
| 6465 | end |
| 6466 | if eq k 21 |
| 6467 | ab_ce 74 |
| 6468 | e_dec i |
| 6469 | ab_ce 75 |
| 6470 | e_src ab_cg i 7 ab_cg i 8 |
| 6471 | ab_ce 76 |
| 6472 | end |
| 6473 | if eq k 34 |
| 6474 | ab_impdecl i |
| 6475 | end |
| 6476 | end |
| 6477 | |
| 6478 | note ---- import stub lowering inside efn ---- |
| 6479 | |
| 6480 | fn ab_skipnl to void |
| 6481 | tok |
| 6482 | while eq get tk 0 0 |
| 6483 | tok |
| 6484 | end |
| 6485 | end |
| 6486 | |
| 6487 | fn ab_thunk f ulong to void |
| 6488 | tok |
| 6489 | if ne get tk 0 0 |
| 6490 | fail 49 |
| 6491 | end |
| 6492 | ab_skipnl |
| 6493 | if ne ab_kwid 45 |
| 6494 | fail 49 |
| 6495 | end |
| 6496 | tok |
| 6497 | if ne get tk 0 2 |
| 6498 | fail 49 |
| 6499 | end |
| 6500 | tok |
| 6501 | if ne get tk 0 0 |
| 6502 | fail 49 |
| 6503 | end |
| 6504 | ab_skipnl |
| 6505 | if ne ab_kwid 46 |
| 6506 | fail 49 |
| 6507 | end |
| 6508 | tok |
| 6509 | if and ne get tk 0 0 ne get tk 0 3 |
| 6510 | fail 49 |
| 6511 | end |
| 6512 | put held 0 1 |
| 6513 | m = sub get abfimp f 1 |
| 6514 | ab_ce 77 |
| 6515 | i = ulong 0 |
| 6516 | while lt i get abn 0 |
| 6517 | if and eq ab_cg i 0 60 eq ab_cg i 4 m |
| 6518 | if eq ab_cg i 5 36 |
| 6519 | ab_spanck i |
| 6520 | end |
| 6521 | end |
| 6522 | i = add i 1 |
| 6523 | end |
| 6524 | ab_ce 78 |
| 6525 | ab_nm2 m 5 |
| 6526 | ab_ce 21 |
| 6527 | ab_thargs m f |
| 6528 | ab_ce 79 |
| 6529 | end |
| 6530 | |
| 6531 | fn ab_spanck i ulong to void |
| 6532 | p = ab_cg i 6 |
| 6533 | o = ab_cg i 7 |
| 6534 | ab_ce 161 |
| 6535 | e_dec p |
| 6536 | ab_ce 162 |
| 6537 | e_dec o |
| 6538 | ab_ce 90 |
| 6539 | e_dec ab_cg i 8 |
| 6540 | ab_ce 163 |
| 6541 | end |
| 6542 | |
| 6543 | fn ab_thargs m ulong f ulong to void |
| 6544 | c = ulong 0 |
| 6545 | i = ulong 0 |
| 6546 | while lt i get abn 0 |
| 6547 | if and eq ab_cg i 0 60 eq ab_cg i 4 m |
| 6548 | if gt c 0 |
| 6549 | ab_ce 60 |
| 6550 | end |
| 6551 | w = ab_cg i 5 |
| 6552 | p = ab_cg i 6 |
| 6553 | t = get fn_pt add mul f 6 p |
| 6554 | if eq w 35 |
| 6555 | ab_ce 85 |
| 6556 | e_dec p |
| 6557 | end |
| 6558 | if eq w 9 |
| 6559 | ab_ce 86 |
| 6560 | e_dec p |
| 6561 | end |
| 6562 | if eq w 36 |
| 6563 | if eq t 5 |
| 6564 | if eq get fn_pk add mul f 6 p 2 |
| 6565 | ab_ce 164 |
| 6566 | else |
| 6567 | ab_ce 85 |
| 6568 | end |
| 6569 | else |
| 6570 | if eq get fn_pk add mul f 6 p 2 |
| 6571 | ab_ce 87 |
| 6572 | else |
| 6573 | ab_ce 88 |
| 6574 | end |
| 6575 | end |
| 6576 | e_dec p |
| 6577 | ab_ce 89 |
| 6578 | e_dec ab_cg i 7 |
| 6579 | ab_ce 90 |
| 6580 | e_dec ab_cg i 8 |
| 6581 | end |
| 6582 | c = add c 1 |
| 6583 | end |
| 6584 | i = add i 1 |
| 6585 | end |
| 6586 | end |
| 6587 | |
| 6588 | note ---- exported wrappers ---- |
| 6589 | |
| 6590 | fn ab_pow k ulong to ulong |
| 6591 | v = ulong 1 |
| 6592 | for j ulong k |
| 6593 | v = mul v 2 |
| 6594 | end |
| 6595 | ret v |
| 6596 | end |
| 6597 | |
| 6598 | fn ab_conv t ulong to void |
| 6599 | c = t |
| 6600 | if lt t 1000 |
| 6601 | if eq ab_cg t 0 7 |
| 6602 | c = 1038 |
| 6603 | else |
| 6604 | c = 1039 |
| 6605 | end |
| 6606 | end |
| 6607 | if eq c 1038 |
| 6608 | ab_ce 91 |
| 6609 | end |
| 6610 | if eq c 1039 |
| 6611 | ab_ce 92 |
| 6612 | end |
| 6613 | if eq c 1040 |
| 6614 | ab_ce 93 |
| 6615 | end |
| 6616 | if eq c 1041 |
| 6617 | ab_ce 94 |
| 6618 | end |
| 6619 | end |
| 6620 | |
| 6621 | fn ab_slot k ulong to void |
| 6622 | ab_ce 95 |
| 6623 | e_dec k |
| 6624 | ab_ce 96 |
| 6625 | end |
| 6626 | |
| 6627 | fn ab_fill a ulong to void |
| 6628 | k = ab_cg a 5 |
| 6629 | s = ab_cg a 11 |
| 6630 | ab_ce 97 |
| 6631 | ab_slot s |
| 6632 | ab_ce 98 |
| 6633 | if eq k 1 |
| 6634 | ab_conv ab_cg a 6 |
| 6635 | ab_nm a |
| 6636 | ab_ce 13 |
| 6637 | ret |
| 6638 | end |
| 6639 | if eq k 2 |
| 6640 | ab_ce 99 |
| 6641 | e_dec ab_cg a 6 |
| 6642 | ab_ce 21 |
| 6643 | ab_nm a |
| 6644 | ab_ce 70 |
| 6645 | ret |
| 6646 | end |
| 6647 | ab_nm a |
| 6648 | ab_ce 100 |
| 6649 | if eq k 4 |
| 6650 | ab_ce 101 |
| 6651 | ab_nm a |
| 6652 | ab_ce 23 |
| 6653 | ab_slot add s 1 |
| 6654 | ab_ce 98 |
| 6655 | ab_conv ab_cg a 6 |
| 6656 | ab_ce 102 |
| 6657 | ab_nm a |
| 6658 | ab_ce 103 |
| 6659 | e_dec s |
| 6660 | ab_ce 98 |
| 6661 | ab_slot add s 1 |
| 6662 | ab_ce 13 |
| 6663 | end |
| 6664 | end |
| 6665 | |
| 6666 | fn ab_bit a ulong to void |
| 6667 | ab_ce 104 |
| 6668 | e_dec ab_pow ab_cg a 7 |
| 6669 | ab_ce 23 |
| 6670 | end |
| 6671 | |
| 6672 | fn ab_check a ulong to void |
| 6673 | k = ab_cg a 5 |
| 6674 | if lt k 3 |
| 6675 | ret |
| 6676 | end |
| 6677 | s = add ab_cg a 11 1 |
| 6678 | t = ab_cg a 6 |
| 6679 | ab_bit a |
| 6680 | ab_ce 105 |
| 6681 | ab_nm a |
| 6682 | if le k 4 |
| 6683 | ab_range32 t s |
| 6684 | end |
| 6685 | if eq k 5 |
| 6686 | ab_ce 106 |
| 6687 | ab_slot s |
| 6688 | ab_ce 107 |
| 6689 | e_dec ab_cg t 8 |
| 6690 | end |
| 6691 | if ge k 6 |
| 6692 | ab_spanlim a s |
| 6693 | end |
| 6694 | ab_ce 108 |
| 6695 | end |
| 6696 | |
| 6697 | fn ab_range32 t ulong s ulong to void |
| 6698 | if eq t 1039 |
| 6699 | ab_ce 106 |
| 6700 | ab_slot s |
| 6701 | ab_ce 109 |
| 6702 | end |
| 6703 | if eq t 1038 |
| 6704 | ab_ce 110 |
| 6705 | ab_slot s |
| 6706 | ab_ce 111 |
| 6707 | ab_slot s |
| 6708 | ab_ce 112 |
| 6709 | end |
| 6710 | if lt t 1000 |
| 6711 | ab_ce 113 |
| 6712 | e_dec t |
| 6713 | ab_ce 21 |
| 6714 | ab_slot s |
| 6715 | ab_ce 23 |
| 6716 | end |
| 6717 | end |
| 6718 | |
| 6719 | fn ab_spanlim a ulong s ulong to void |
| 6720 | k = ab_cg a 5 |
| 6721 | if eq k 7 |
| 6722 | ret |
| 6723 | end |
| 6724 | x = sub ab_cg ab_cg a 9 5 ab_cg a 10 |
| 6725 | r = ab_cg a 8 |
| 6726 | ab_ce 106 |
| 6727 | ab_slot s |
| 6728 | if eq k 6 |
| 6729 | ab_ce 114 |
| 6730 | ab_nm r |
| 6731 | else |
| 6732 | ab_ce 115 |
| 6733 | e_dec ab_cg r 11 |
| 6734 | x = div x ab_cg ab_cg a 6 6 |
| 6735 | end |
| 6736 | ab_ce 106 |
| 6737 | ab_slot s |
| 6738 | ab_ce 116 |
| 6739 | e_dec x |
| 6740 | if eq k 6 |
| 6741 | ab_ce 159 |
| 6742 | ab_slot s |
| 6743 | ab_ce 106 |
| 6744 | ab_nm ab_cg a 9 |
| 6745 | ab_ce 41 |
| 6746 | e_dec ab_cg a 10 |
| 6747 | ab_ce 89 |
| 6748 | ab_slot s |
| 6749 | ab_ce 160 |
| 6750 | end |
| 6751 | end |
| 6752 | |
| 6753 | fn ab_copy a ulong i ulong ar ulong to void |
| 6754 | ab_ce 117 |
| 6755 | ab_nm a |
| 6756 | if eq ar 1 |
| 6757 | ab_ce 118 |
| 6758 | else |
| 6759 | ab_ce 119 |
| 6760 | end |
| 6761 | ab_nm i |
| 6762 | ab_ce 60 |
| 6763 | ab_nm ab_cg a 9 |
| 6764 | ab_ce 89 |
| 6765 | e_dec add ab_cg a 10 ab_cg i 6 |
| 6766 | if eq ar 1 |
| 6767 | ab_ce 120 |
| 6768 | e_dec ab_cg ab_cg a 6 6 |
| 6769 | end |
| 6770 | ab_ce 60 |
| 6771 | if ge ab_cg i 5 40 |
| 6772 | ab_ce 121 |
| 6773 | else |
| 6774 | ab_ce 122 |
| 6775 | end |
| 6776 | ab_ce 123 |
| 6777 | end |
| 6778 | |
| 6779 | fn ab_fields a ulong ar ulong to void |
| 6780 | r = ab_cg a 6 |
| 6781 | i = ulong 0 |
| 6782 | while lt i get abn 0 |
| 6783 | if and eq ab_cg i 0 19 eq ab_cg i 4 r |
| 6784 | ab_copy a i ar |
| 6785 | end |
| 6786 | i = add i 1 |
| 6787 | end |
| 6788 | end |
| 6789 | |
| 6790 | fn ab_pub a ulong to void |
| 6791 | k = ab_cg a 5 |
| 6792 | if lt k 3 |
| 6793 | ret |
| 6794 | end |
| 6795 | s = add ab_cg a 11 1 |
| 6796 | ab_bit a |
| 6797 | if le k 4 |
| 6798 | ab_ce 124 |
| 6799 | ab_nm a |
| 6800 | ab_ce 125 |
| 6801 | ab_tyname ab_cg a 6 |
| 6802 | ab_ce 23 |
| 6803 | ab_slot s |
| 6804 | ab_ce 13 |
| 6805 | end |
| 6806 | if eq k 5 |
| 6807 | ab_ce 124 |
| 6808 | ab_nm a |
| 6809 | ab_ce 126 |
| 6810 | e_dec ab_cg a 6 |
| 6811 | ab_ce 21 |
| 6812 | ab_slot s |
| 6813 | ab_ce 70 |
| 6814 | end |
| 6815 | if eq k 6 |
| 6816 | ab_ce 127 |
| 6817 | ab_nm a |
| 6818 | ab_ce 60 |
| 6819 | ab_nm ab_cg a 9 |
| 6820 | ab_ce 89 |
| 6821 | e_dec ab_cg a 10 |
| 6822 | ab_ce 60 |
| 6823 | ab_slot s |
| 6824 | ab_ce 70 |
| 6825 | end |
| 6826 | if eq k 7 |
| 6827 | ab_ce 128 |
| 6828 | ab_fields a 0 |
| 6829 | ab_ce 129 |
| 6830 | end |
| 6831 | if eq k 8 |
| 6832 | ab_ce 130 |
| 6833 | ab_slot s |
| 6834 | ab_ce 131 |
| 6835 | ab_fields a 1 |
| 6836 | ab_ce 129 |
| 6837 | end |
| 6838 | end |
| 6839 | |
| 6840 | fn ab_mask e ulong to ulong |
| 6841 | m = ulong 0 |
| 6842 | i = ulong 0 |
| 6843 | while lt i get abn 0 |
| 6844 | if and eq ab_cg i 0 27 eq ab_cg i 4 e |
| 6845 | if ge ab_cg i 5 3 |
| 6846 | m = add m ab_pow ab_cg i 7 |
| 6847 | end |
| 6848 | end |
| 6849 | i = add i 1 |
| 6850 | end |
| 6851 | ret m |
| 6852 | end |
| 6853 | |
| 6854 | fn ab_args e ulong pass ulong to void |
| 6855 | i = ulong 0 |
| 6856 | while lt i get abn 0 |
| 6857 | if and eq ab_cg i 0 27 eq ab_cg i 4 e |
| 6858 | if eq pass 0 |
| 6859 | ab_fill i |
| 6860 | end |
| 6861 | if eq pass 1 |
| 6862 | ab_check i |
| 6863 | end |
| 6864 | if eq pass 2 |
| 6865 | ab_pub i |
| 6866 | end |
| 6867 | end |
| 6868 | i = add i 1 |
| 6869 | end |
| 6870 | end |
| 6871 | |
| 6872 | fn ab_call e ulong to void |
| 6873 | f = ab_cg e 4 |
| 6874 | ab_ce 132 |
| 6875 | e_src get fn_off f get fn_nl f |
| 6876 | ab_ce 133 |
| 6877 | e_dec ab_cg e 8 |
| 6878 | p = ulong 1 |
| 6879 | while lt p get fn_np f |
| 6880 | s = ab_bound e p |
| 6881 | ab_ce 60 |
| 6882 | ab_nm s |
| 6883 | ab_ce 60 |
| 6884 | e_dec ab_cg s 5 |
| 6885 | p = add p 1 |
| 6886 | end |
| 6887 | end |
| 6888 | |
| 6889 | fn ab_wstat e ulong to void |
| 6890 | t = ab_cg e 6 |
| 6891 | v = ab_cg t 6 |
| 6892 | ab_ce 134 |
| 6893 | e_dec ab_cg e 8 |
| 6894 | ab_ce 135 |
| 6895 | e_dec v |
| 6896 | ab_ce 136 |
| 6897 | ab_nm ab_cg e 7 |
| 6898 | ab_ce 137 |
| 6899 | ab_nm t |
| 6900 | ab_ce 23 |
| 6901 | e_dec v |
| 6902 | ab_ce 13 |
| 6903 | ab_args e 0 |
| 6904 | ab_call e |
| 6905 | ab_ce 138 |
| 6906 | e_dec t |
| 6907 | ab_ce 139 |
| 6908 | e_dec ab_mask e |
| 6909 | ab_ce 140 |
| 6910 | ab_args e 1 |
| 6911 | ab_ce 141 |
| 6912 | ab_args e 2 |
| 6913 | ab_ce 142 |
| 6914 | ab_nm ab_cg e 7 |
| 6915 | ab_ce 143 |
| 6916 | ab_nm t |
| 6917 | ab_ce 144 |
| 6918 | ab_nm t |
| 6919 | ab_ce 23 |
| 6920 | e_dec v |
| 6921 | ab_ce 145 |
| 6922 | end |
| 6923 | |
| 6924 | fn ab_wcstr e ulong to void |
| 6925 | c = ab_cg e 6 |
| 6926 | s = ab_cg c 4 |
| 6927 | w = ab_cg c 6 |
| 6928 | ab_ce 134 |
| 6929 | e_dec ab_cg e 8 |
| 6930 | ab_ce 135 |
| 6931 | e_dec ab_cg c 5 |
| 6932 | ab_ce 146 |
| 6933 | e_dec c |
| 6934 | ab_ce 147 |
| 6935 | ab_nm ab_cg e 7 |
| 6936 | ab_ce 148 |
| 6937 | e_dec c |
| 6938 | ab_ce 13 |
| 6939 | ab_args e 0 |
| 6940 | ab_call e |
| 6941 | ab_ce 149 |
| 6942 | e_dec ab_cg c 5 |
| 6943 | ab_ce 150 |
| 6944 | e_dec w |
| 6945 | ab_ce 151 |
| 6946 | ab_nm s |
| 6947 | ab_ce 152 |
| 6948 | e_dec w |
| 6949 | ab_ce 153 |
| 6950 | ab_nm s |
| 6951 | ab_ce 154 |
| 6952 | e_dec w |
| 6953 | ab_ce 155 |
| 6954 | ab_nm ab_cg e 7 |
| 6955 | ab_ce 156 |
| 6956 | end |
| 6957 | |
| 6958 | fn ab_post to void |
| 6959 | i = ulong 0 |
| 6960 | while lt i get abn 0 |
| 6961 | if eq ab_cg i 0 25 |
| 6962 | ab_ce 157 |
| 6963 | exportfn ab_cg i 4 |
| 6964 | ab_ce 158 |
| 6965 | ab_proto i |
| 6966 | if eq ab_cg i 5 1 |
| 6967 | ab_wstat i |
| 6968 | else |
| 6969 | ab_wcstr i |
| 6970 | end |
| 6971 | end |
| 6972 | i = add i 1 |
| 6973 | end |
| 6974 | end |
| 6975 | |
| 6976 | note ---- provenance trailer appended by tools/bridge-seeded ---- |
| 6977 | |
| 6978 | fn ab_hex c ulong to ulong |
| 6979 | if and ge c 48 le c 57 |
| 6980 | ret 1 |
| 6981 | end |
| 6982 | if and ge c 97 le c 102 |
| 6983 | ret 1 |
| 6984 | end |
| 6985 | ret 0 |
| 6986 | end |
| 6987 | |
| 6988 | fn ab_provck to void |
| 6989 | n = get slen 0 |
| 6990 | if lt n 132 |
| 6991 | fail 52 |
| 6992 | end |
| 6993 | p = sub n 131 |
| 6994 | if ne get src p 10 |
| 6995 | fail 52 |
| 6996 | end |
| 6997 | if ne get src add p 65 32 |
| 6998 | fail 52 |
| 6999 | end |
| 7000 | if ne get src add p 130 10 |
| 7001 | fail 52 |
| 7002 | end |
| 7003 | for j ulong 64 |
| 7004 | if eq ab_hex ulong get src add p add j 1 0 |
| 7005 | fail 52 |
| 7006 | end |
| 7007 | if eq ab_hex ulong get src add p add j 66 0 |
| 7008 | fail 52 |
| 7009 | end |
| 7010 | end |
| 7011 | put abprov 0 p |
| 7012 | put slen 0 add p 1 |
| 7013 | end |
| 7014 | |
| 7015 | note SHA-256 (FIPS 180-4) of the cabi-1 provenance inputs. K and H were computed with Wolfram Language: |
| 7016 | note Floor[FractionalPart[Prime[i]^(1/3)]*2^32] for i 1..64 and Floor[FractionalPart[Sqrt[Prime[i]]]*2^32] for i 1..8. |
| 7017 | fn ab_kinit to void |
| 7018 | put abk 0 1116352408 |
| 7019 | put abk 1 1899447441 |
| 7020 | put abk 2 3049323471 |
| 7021 | put abk 3 3921009573 |
| 7022 | put abk 4 961987163 |
| 7023 | put abk 5 1508970993 |
| 7024 | put abk 6 2453635748 |
| 7025 | put abk 7 2870763221 |
| 7026 | put abk 8 3624381080 |
| 7027 | put abk 9 310598401 |
| 7028 | put abk 10 607225278 |
| 7029 | put abk 11 1426881987 |
| 7030 | put abk 12 1925078388 |
| 7031 | put abk 13 2162078206 |
| 7032 | put abk 14 2614888103 |
| 7033 | put abk 15 3248222580 |
| 7034 | put abk 16 3835390401 |
| 7035 | put abk 17 4022224774 |
| 7036 | put abk 18 264347078 |
| 7037 | put abk 19 604807628 |
| 7038 | put abk 20 770255983 |
| 7039 | put abk 21 1249150122 |
| 7040 | put abk 22 1555081692 |
| 7041 | put abk 23 1996064986 |
| 7042 | put abk 24 2554220882 |
| 7043 | put abk 25 2821834349 |
| 7044 | put abk 26 2952996808 |
| 7045 | put abk 27 3210313671 |
| 7046 | put abk 28 3336571891 |
| 7047 | put abk 29 3584528711 |
| 7048 | put abk 30 113926993 |
| 7049 | put abk 31 338241895 |
| 7050 | put abk 32 666307205 |
| 7051 | put abk 33 773529912 |
| 7052 | put abk 34 1294757372 |
| 7053 | put abk 35 1396182291 |
| 7054 | put abk 36 1695183700 |
| 7055 | put abk 37 1986661051 |
| 7056 | put abk 38 2177026350 |
| 7057 | put abk 39 2456956037 |
| 7058 | put abk 40 2730485921 |
| 7059 | put abk 41 2820302411 |
| 7060 | put abk 42 3259730800 |
| 7061 | put abk 43 3345764771 |
| 7062 | put abk 44 3516065817 |
| 7063 | put abk 45 3600352804 |
| 7064 | put abk 46 4094571909 |
| 7065 | put abk 47 275423344 |
| 7066 | put abk 48 430227734 |
| 7067 | put abk 49 506948616 |
| 7068 | put abk 50 659060556 |
| 7069 | put abk 51 883997877 |
| 7070 | put abk 52 958139571 |
| 7071 | put abk 53 1322822218 |
| 7072 | put abk 54 1537002063 |
| 7073 | put abk 55 1747873779 |
| 7074 | put abk 56 1955562222 |
| 7075 | put abk 57 2024104815 |
| 7076 | put abk 58 2227730452 |
| 7077 | put abk 59 2361852424 |
| 7078 | put abk 60 2428436474 |
| 7079 | put abk 61 2756734187 |
| 7080 | put abk 62 3204031479 |
| 7081 | put abk 63 3329325298 |
| 7082 | end |
| 7083 | |
| 7084 | fn ab_shainit to void |
| 7085 | put abh 0 1779033703 |
| 7086 | put abh 1 3144134277 |
| 7087 | put abh 2 1013904242 |
| 7088 | put abh 3 2773480762 |
| 7089 | put abh 4 1359893119 |
| 7090 | put abh 5 2600822924 |
| 7091 | put abh 6 528734635 |
| 7092 | put abh 7 1541459225 |
| 7093 | end |
| 7094 | |
| 7095 | fn ab_rotr x ulong r ulong to ulong |
| 7096 | hi = shr x r |
| 7097 | lo = and shl x sub 32 r 4294967295 |
| 7098 | ret or hi lo |
| 7099 | end |
| 7100 | |
| 7101 | fn ab_bsig x ulong p ulong q ulong r ulong to ulong |
| 7102 | r1 = ab_rotr x p |
| 7103 | r2 = ab_rotr x q |
| 7104 | r3 = ab_rotr x r |
| 7105 | ret xor xor r1 r2 r3 |
| 7106 | end |
| 7107 | |
| 7108 | fn ab_ssig x ulong p ulong q ulong s ulong to ulong |
| 7109 | r1 = ab_rotr x p |
| 7110 | r2 = ab_rotr x q |
| 7111 | ret xor xor r1 r2 shr x s |
| 7112 | end |
| 7113 | |
| 7114 | note Message byte i: sel 0 is the source after the mode letter, sel 1 the generator source read from fd 3. |
| 7115 | fn ab_mb sel ulong i ulong to ulong |
| 7116 | if eq sel 0 |
| 7117 | ret ulong get src add i 1 |
| 7118 | end |
| 7119 | ret ulong get abtoc i |
| 7120 | end |
| 7121 | |
| 7122 | fn ab_pad sel ulong n ulong i ulong to ulong |
| 7123 | if lt i n |
| 7124 | ret ab_mb sel i |
| 7125 | end |
| 7126 | if eq i n |
| 7127 | ret 128 |
| 7128 | end |
| 7129 | tot = mul div add n 72 64 64 |
| 7130 | st = sub tot 8 |
| 7131 | if lt i st |
| 7132 | ret 0 |
| 7133 | end |
| 7134 | bits = mul n 8 |
| 7135 | sh = mul sub 7 sub i st 8 |
| 7136 | ret and shr bits sh 255 |
| 7137 | end |
| 7138 | |
| 7139 | fn ab_sched sel ulong n ulong blk ulong to void |
| 7140 | base = mul blk 64 |
| 7141 | for t ulong 16 |
| 7142 | w = ulong 0 |
| 7143 | for b ulong 4 |
| 7144 | i = add base add mul t 4 b |
| 7145 | pb = ab_pad sel n i |
| 7146 | w = or shl w 8 pb |
| 7147 | end |
| 7148 | put abw t w |
| 7149 | end |
| 7150 | ab_expand |
| 7151 | end |
| 7152 | |
| 7153 | fn ab_expand to void |
| 7154 | for u ulong 48 |
| 7155 | j = add u 16 |
| 7156 | s0 = ab_ssig get abw sub j 15 7 18 3 |
| 7157 | s1 = ab_ssig get abw sub j 2 17 19 10 |
| 7158 | v = add get abw sub j 16 s0 |
| 7159 | v = add v add get abw sub j 7 s1 |
| 7160 | put abw j and v 4294967295 |
| 7161 | end |
| 7162 | end |
| 7163 | |
| 7164 | fn ab_t1 t ulong to ulong |
| 7165 | e = get abv 4 |
| 7166 | s1 = ab_bsig e 6 11 25 |
| 7167 | c1 = and e get abv 5 |
| 7168 | c2 = and xor e 4294967295 get abv 6 |
| 7169 | v = add get abv 7 s1 |
| 7170 | v = add v xor c1 c2 |
| 7171 | v = add v get abk t |
| 7172 | v = add v get abw t |
| 7173 | ret and v 4294967295 |
| 7174 | end |
| 7175 | |
| 7176 | fn ab_t2 to ulong |
| 7177 | a = get abv 0 |
| 7178 | b = get abv 1 |
| 7179 | c = get abv 2 |
| 7180 | s0 = ab_bsig a 2 13 22 |
| 7181 | m1 = xor and a b and a c |
| 7182 | m1 = xor m1 and b c |
| 7183 | ret and add s0 m1 4294967295 |
| 7184 | end |
| 7185 | |
| 7186 | fn ab_round t ulong to void |
| 7187 | t1 = ab_t1 t |
| 7188 | t2 = ab_t2 |
| 7189 | put abv 7 get abv 6 |
| 7190 | put abv 6 get abv 5 |
| 7191 | put abv 5 get abv 4 |
| 7192 | put abv 4 and add get abv 3 t1 4294967295 |
| 7193 | put abv 3 get abv 2 |
| 7194 | put abv 2 get abv 1 |
| 7195 | put abv 1 get abv 0 |
| 7196 | put abv 0 and add t1 t2 4294967295 |
| 7197 | end |
| 7198 | |
| 7199 | fn ab_sha sel ulong n ulong to void |
| 7200 | ab_shainit |
| 7201 | nblk = div add n 72 64 |
| 7202 | blk = ulong 0 |
| 7203 | while lt blk nblk |
| 7204 | ab_sched sel n blk |
| 7205 | for i ulong 8 |
| 7206 | put abv i get abh i |
| 7207 | end |
| 7208 | for r ulong 64 |
| 7209 | ab_round r |
| 7210 | end |
| 7211 | for q ulong 8 |
| 7212 | put abh q and add get abh q get abv q 4294967295 |
| 7213 | end |
| 7214 | blk = add blk 1 |
| 7215 | end |
| 7216 | end |
| 7217 | |
| 7218 | fn ab_hexc v ulong to ulong |
| 7219 | if lt v 10 |
| 7220 | ret add v 48 |
| 7221 | end |
| 7222 | ret add v 87 |
| 7223 | end |
| 7224 | |
| 7225 | note 1 when the 64 lowercase hex digits at src[pos] spell the digest in abh. |
| 7226 | fn ab_dgeq pos ulong to ulong |
| 7227 | for i ulong 32 |
| 7228 | v = get abh div i 4 |
| 7229 | sh = mul sub 3 rem i 4 8 |
| 7230 | bv = and shr v sh 255 |
| 7231 | o = add pos mul i 2 |
| 7232 | hc = ab_hexc shr bv 4 |
| 7233 | if ne ulong get src o hc |
| 7234 | ret 0 |
| 7235 | end |
| 7236 | lc = ab_hexc and bv 15 |
| 7237 | if ne ulong get src add o 1 lc |
| 7238 | ret 0 |
| 7239 | end |
| 7240 | end |
| 7241 | ret 1 |
| 7242 | end |
| 7243 | |
| 7244 | note The trailer digests must equal SHA-256 of the generator source on fd 3 (tools/bridge-seeded |
| 7245 | note opens src/toc.om there) and of the source bytes before the trailer; anything else is error 52. |
| 7246 | fn ab_provsum to void |
| 7247 | ab_kinit |
| 7248 | p = get abprov 0 |
| 7249 | off = ulong 0 |
| 7250 | go = ulong 1 |
| 7251 | while eq go 1 |
| 7252 | r = read 3 abtoc off sub 1048576 off |
| 7253 | if lt r 0 |
| 7254 | fail 52 |
| 7255 | end |
| 7256 | if eq r 0 |
| 7257 | go = 0 |
| 7258 | else |
| 7259 | off = add off ulong r |
| 7260 | if ge off 1048576 |
| 7261 | fail 52 |
| 7262 | end |
| 7263 | end |
| 7264 | end |
| 7265 | if eq off 0 |
| 7266 | fail 52 |
| 7267 | end |
| 7268 | ab_sha 1 off |
| 7269 | if eq ab_dgeq add p 1 0 |
| 7270 | fail 52 |
| 7271 | end |
| 7272 | ab_sha 0 sub p 1 |
| 7273 | if eq ab_dgeq add p 66 0 |
| 7274 | fail 52 |
| 7275 | end |
| 7276 | end |
| 7277 | |
| 7278 | fn ab_lib_main to void |
| 7279 | if ne get hasmain 0 0 |
| 7280 | fail 50 |
| 7281 | end |
| 7282 | if ne get ng 0 0 |
| 7283 | fail 51 |
| 7284 | end |
| 7285 | ab_provsum |
| 7286 | ab_scan |
| 7287 | ab_resolve |
| 7288 | end |