1 # Copyright (C) 2006-2008, The Perl Foundation.
6 src/wmlsstdlibs.pir - WMLScript standard libraries
10 See "WMLScript Standard Libraries Specification".
14 =item * Lang : F<languages/WMLScript/runtime/wmlslang.pir>
16 =item * Float : F<languages/WMLScript/runtime/wmlsfloat.pir>
18 =item * String : F<languages/WMLScript/runtime/wmlsstring.pir>
20 =item * Console : F<languages/WMLScript/runtime/wmlsconsole.pir>
27 .HLL 'WMLScript', 'wmls_group'
29 .sub '__onload' :load :anon
30 # print "__onload (wmlsstdlibs.pir)\n"
31 load_bytecode 'languages/WMLScript/runtime/wmlslang.pbc'
32 load_bytecode 'languages/WMLScript/runtime/wmlsfloat.pbc'
33 load_bytecode 'languages/WMLScript/runtime/wmlsstring.pbc'
34 load_bytecode 'languages/WMLScript/runtime/wmlsconsole.pbc'
46 set_hll_global '@stdlibs', $P0
49 .sub 'not_implemented'
57 =item C<find_lib(int lindex, int findex)>
59 helper for CALL_LIB* opcodes.
66 $P0 = get_hll_global '@stdlibs'
72 .const .Sub not_implemented = 'not_implemented'
73 .return (not_implemented)
76 =item C<find_lib_url(string url, string function)>
78 helper for CALL_URL* opcodes.
84 .param string function
86 content = load_script(url)
87 unless content goto L1
90 new loader, 'WmlsBytecode'
92 script = loader.'load'(content)
93 script['filename'] = url
95 gen_pir = script.'translate'()
98 pir_comp = compreg 'PIR'
99 pbc_out = pir_comp(gen_pir)
108 entry = get_hll_global $S0
109 if_null entry, _handler_2
114 .get_results (e, msg)
117 $S0 = "verification failed (can't translate '"
122 $S0 = "external function '"
124 $S0 .= "' not found in '"
129 die "unable to load compilation unit"
133 .param string filename
135 .local string content
138 content = pio.'slurp'(filename)
141 print "Can't slurp '"
152 .param string pbc_out
153 .param string filename
156 output = concat filename, '.pbc'
157 fh = open output, '>'
174 .param string gen_pir
175 .param string filename
178 output = concat filename, '.pir'
179 fh = open output, '>'
207 # vim: expandtab shiftwidth=4 ft=pir: