interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / protocol / synapse / map / src / 99-main.om

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