omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / protocol / synapse / map / src / 99-main.om
| 1 | note ======== entry ======== |
| 2 | text tcimport "import" |
| 3 | text tcindex "index" |
| 4 | text tcwhere "where" |
| 5 | text tctree "tree" |
| 6 | text tccheck "check" |
| 7 | text tcnew "new" |
| 8 | text tchelp "--help" |
| 9 | text tch "-h" |
| 10 | text tdot "." |
| 11 | |
| 12 | note sm_bindir: directory of argv[0] into the pool (".", when argv[0] has no '/') |
| 13 | fn sm_bindir to void |
| 14 | o = sm_ao 0 |
| 15 | n = sm_al 0 |
| 16 | s = n |
| 17 | for i ulong n |
| 18 | if eq get gab add o i 47 |
| 19 | s = i |
| 20 | end |
| 21 | end |
| 22 | if eq s n |
| 23 | p = sm_pt tdot |
| 24 | put gst SBINO p |
| 25 | put gst SBINL 1 |
| 26 | ret |
| 27 | end |
| 28 | p = sm_apool 0 |
| 29 | put gst SBINO p |
| 30 | put gst SBINL s |
| 31 | end |
| 32 | |
| 33 | note sm_ahome: "--home DIR COMMAND ..." becomes "COMMAND --home DIR ...", so argument 1 is the command |
| 34 | fn sm_ahome to void |
| 35 | if lt get gst SARGC 4 |
| 36 | ret |
| 37 | end |
| 38 | if not sm_aeq 1 tfhome |
| 39 | ret |
| 40 | end |
| 41 | ho = get gao 2 |
| 42 | hl = get gao 3 |
| 43 | vo = get gao 4 |
| 44 | vl = get gao 5 |
| 45 | put gao 2 get gao 6 |
| 46 | put gao 3 get gao 7 |
| 47 | put gao 4 ho |
| 48 | put gao 5 hl |
| 49 | put gao 6 vo |
| 50 | put gao 7 vl |
| 51 | end |
| 52 | |
| 53 | fn main to int |
| 54 | x = sm_args |
| 55 | if lt x 0 |
| 56 | sm_usage |
| 57 | end |
| 58 | sm_ahome |
| 59 | if lt get gst SARGC 2 |
| 60 | sm_usage |
| 61 | end |
| 62 | if or sm_aeq 1 tchelp sm_aeq 1 tch |
| 63 | sm_err tusage |
| 64 | ret 0 |
| 65 | end |
| 66 | put gst SXIP 2130706433 |
| 67 | put gst SXPORT 9200 |
| 68 | o = sm_pt tdefidx |
| 69 | put gst SIDXO o |
| 70 | put gst SIDXL len tdefidx |
| 71 | o = sm_pt tdeforg |
| 72 | put gst SORGO o |
| 73 | put gst SORGL len tdeforg |
| 74 | sm_bindir |
| 75 | c = int 0 |
| 76 | if sm_aeq 1 tcimport |
| 77 | c = sm_cimport |
| 78 | end |
| 79 | if sm_aeq 1 tcindex |
| 80 | c = sm_cindex |
| 81 | end |
| 82 | if sm_aeq 1 tcwhere |
| 83 | c = sm_cwhere |
| 84 | end |
| 85 | if sm_aeq 1 tctree |
| 86 | c = sm_ctree |
| 87 | end |
| 88 | if sm_aeq 1 tccheck |
| 89 | c = sm_ccheck |
| 90 | end |
| 91 | if sm_aeq 1 tcnew |
| 92 | c = sm_cnew |
| 93 | end |
| 94 | if not or sm_aeq 1 tcimport or sm_aeq 1 tcindex or sm_aeq 1 tcwhere or sm_aeq 1 tctree or sm_aeq 1 tccheck sm_aeq 1 tcnew |
| 95 | sm_usage |
| 96 | end |
| 97 | sm_die c |
| 98 | ret c |
| 99 | end |