Re: sequence
- Posted by jbrown105 at speedymail.org Jun 19, 2002
- 439 views
K here is a big internal.e file with all bultin functions wrapped. jbrown On 0, I wrote: > Good idea Alexa. I'll write one up and post it to this list soon. > > jbrown > > On 0, alexione at EUnet.yu wrote: > > > > >------------ > > > function BIpower(object x, object y) > > > return power(x,y) > > > end function > > > without warning > > > function power(object x, object y) > > > return BIpower(x,y) > > > end function > > > with warning > > > > > > constant r = routine_id("power") > > >-------------- > > > > > >Of course, it would be a lot more simple (for us users of the product) to > > >allow taking the routine_id of a built_in function/procedure. However, I > > >realise that the internal architecture of Euphoria actually makes this a > > >non-trivial exercise. > > > > > >---------- > > >Derek. > > > > Why not making internal.e which would come with standard EU, containing, > > "wrappers" to internal functions/procedures with some prefix in name, like: > > > > ---- internal.e ---- > > global function _power(object x, objext y) > > return power(x, y) > > end function > > > > ... > > ---- end of internal.e ---- > > > > This way, you can still use power to refere internal function, and have only > > one > > auxiliary function-call when you use call(routine_id("_power"), {x, y}) > > > > Alexa > > > ----------------------------------------------------------------------------- -- wrappers for builtins -- based on wrappers in eu.ex ----------------------------------------------------------------------------- global procedure qprint( object o ) ? o end procedure ----------------------------------------------------------------------------- global procedure abort_( integer i ) abort(i) end procedure ----------------------------------------------------------------------------- global function and_bits_( object x1, object x2 ) return and_bits( x1, x2 ) end function ----------------------------------------------------------------------------- global function append_( sequence s1, object x ) return append( s1, x ) end function ----------------------------------------------------------------------------- global function arctan_( object x1 ) return arctan( x1 ) end function ----------------------------------------------------------------------------- global function atom_( object x ) return atom( x ) end function ----------------------------------------------------------------------------- global procedure call_( atom a ) call( a ) end procedure ----------------------------------------------------------------------------- global function c_func_( atom i, sequence s ) return c_func( i, s ) end function ----------------------------------------------------------------------------- global procedure c_proc_( atom i, sequence s ) c_proc( i, s ) end procedure ----------------------------------------------------------------------------- global function call_func_( integer i, sequence s ) return call_func(i, s) end function ----------------------------------------------------------------------------- global procedure call_proc_( integer i, sequence s ) call_proc(i, s) end procedure ----------------------------------------------------------------------------- global procedure clear_screen_() clear_screen() end procedure ----------------------------------------------------------------------------- global procedure close_( integer fn ) close( fn ) end procedure ----------------------------------------------------------------------------- global function command_line_() return command_line() end function ----------------------------------------------------------------------------- global function compare_( object x1, object x2 ) return compare( x1, x2 ) end function ----------------------------------------------------------------------------- global function cos_( object x1 ) return cos( x1 ) end function ----------------------------------------------------------------------------- global function date_() return date() end function ----------------------------------------------------------------------------- global function equal_( object x1, object x2 ) return equal( x1, x2 ) end function ----------------------------------------------------------------------------- global function find_( object x, sequence s ) return find( x, s ) end function ----------------------------------------------------------------------------- global function floor_( object x1 ) return floor( x1 ) end function ----------------------------------------------------------------------------- global function get_key_() return get_key() end function ----------------------------------------------------------------------------- global function get_pixel_( sequence s ) return get_pixel( s ) end function ----------------------------------------------------------------------------- global function getc_( integer fn ) return getc( fn ) end function ----------------------------------------------------------------------------- global function getenv_( sequence s ) return getenv( s ) end function ----------------------------------------------------------------------------- global function gets_( integer fn ) return gets( fn ) end function ----------------------------------------------------------------------------- global function integer_( object x ) return integer( x ) end function ----------------------------------------------------------------------------- global function length_( sequence s ) return length( s ) end function ----------------------------------------------------------------------------- global function log_( object x1 ) return log( x1 ) end function ----------------------------------------------------------------------------- global function machine_func_( atom a, object x ) return machine_func( a, x ) end function ----------------------------------------------------------------------------- global procedure machine_proc_( atom a, object x ) machine_proc( a, x ) end procedure ----------------------------------------------------------------------------- global function match_( sequence s1, sequence s2 ) return match( s1, s2 ) end function ----------------------------------------------------------------------------- global procedure mem_copy_( atom a1, atom a2, integer i ) mem_copy( a1, a2, i ) end procedure ----------------------------------------------------------------------------- global procedure mem_set_( atom a1, atom a2, integer i ) mem_set( a1, a2, i ) end procedure ----------------------------------------------------------------------------- global function not_bits_( object x1 ) return not_bits( x1 ) end function ----------------------------------------------------------------------------- global function object_( object x ) return object( x ) end function ----------------------------------------------------------------------------- global function open_( sequence st1, sequence st2 ) return open( st1, st2 ) end function ----------------------------------------------------------------------------- global function or_bits_( object x1, object x2 ) return or_bits( x1, x2 ) end function ----------------------------------------------------------------------------- global function peek_( object a ) return peek( a ) end function ----------------------------------------------------------------------------- global function peek4s_( object a ) return peek4s( a ) end function ----------------------------------------------------------------------------- global function peek4u_( object a ) return peek4u( a ) end function ----------------------------------------------------------------------------- global procedure pixel_( object x1, object s ) pixel( x1, s ) end procedure ----------------------------------------------------------------------------- global procedure poke_( atom a, object x ) poke( a, x ) end procedure ----------------------------------------------------------------------------- global procedure poke4_( atom a, object x ) poke4( a, x ) end procedure ----------------------------------------------------------------------------- global procedure position_( integer i1, integer i2 ) position( i1, i2 ) end procedure ----------------------------------------------------------------------------- global function power_( object x1, object x2 ) return power( x1, x2 ) end function ----------------------------------------------------------------------------- global function prepend_( sequence s1, object x2 ) return prepend( s1, x2 ) end function ----------------------------------------------------------------------------- global procedure print_( integer fn, object o ) print( fn, o ) end procedure ----------------------------------------------------------------------------- global procedure printf_( integer fn, sequence st, object x ) printf( fn, st, x ) end procedure ----------------------------------------------------------------------------- global procedure profile_( integer i ) profile( i ) end procedure ----------------------------------------------------------------------------- global procedure puts_( integer fn, object x ) puts( fn, x ) end procedure ----------------------------------------------------------------------------- global function rand_( object x1 ) return rand( x1 ) end function ----------------------------------------------------------------------------- global function remainder_( object x1, object x2 ) return remainder( x1, x2 ) end function ----------------------------------------------------------------------------- global function repeat_( object x, atom a ) return repeat( x, a ) end function ----------------------------------------------------------------------------- global function routine_id_( sequence st ) -- this will *not* work, for obvious reasons return routine_id( st ) end function ----------------------------------------------------------------------------- global function sequence_( object x ) return sequence( x ) end function ----------------------------------------------------------------------------- global function sin_( object x1 ) return sin(x1) end function ----------------------------------------------------------------------------- global function sprintf_( sequence st, object x ) return sprintf( st, x ) end function ----------------------------------------------------------------------------- global function sqrt_( object x1 ) return sqrt(x1) end function ----------------------------------------------------------------------------- global procedure system_( sequence st, integer i ) system(st,i) end procedure ----------------------------------------------------------------------------- global function system_exec_( sequence st, integer i ) return system_exec(st,i) end function ----------------------------------------------------------------------------- global function tan_( object x1 ) return tan(x1) end function ----------------------------------------------------------------------------- global function time_() return time() end function ----------------------------------------------------------------------------- global procedure trace_( integer i ) trace(i) end procedure ----------------------------------------------------------------------------- global function xor_bits_( object x1, object x2 ) return xor_bits( x1, x2 ) end function ----------------------------------------------------------------------------- global function platform_() return platform() end function ----------------------------------------------------------------------------- constant PROC = 1, FUNC = 0 global constant builtin = { { "?", PROC, 1, routine_id("qprint") }, -- 1 { "abort", PROC, 1, routine_id("abort_") }, -- 2 { "and_bits", FUNC, 2, routine_id("and_bits_") }, -- 3 { "append", FUNC, 2, routine_id("append_") }, -- 4 { "arctan", FUNC, 1, routine_id("arctan_") }, -- 5 { "atom", FUNC, 1, routine_id("atom_") }, -- 6 { "call", PROC, 1, routine_id("call_") }, -- 7 { "c_func", FUNC, 2, routine_id("c_func_") }, -- 8 { "c_proc", PROC, 2, routine_id("c_proc_") }, -- 9 { "call_func", FUNC, 2, routine_id("call_func_") }, -- 10 { "call_proc", PROC, 2, routine_id("call_proc_") }, -- 11 { "clear_screen", PROC, 0, routine_id("clear_screen_") }, -- 12 { "close", PROC, 1, routine_id("close_") }, -- 13 { "command_line", FUNC, 0, routine_id("command_line_") }, -- 14 { "compare", FUNC, 2, routine_id("compare_") }, -- 15 { "cos", FUNC, 1, routine_id("cos_") }, -- 16 { "date", FUNC, 0, routine_id("date_") }, -- 17 { "equal", FUNC, 2, routine_id("equal_") }, -- 18 { "find", FUNC, 2, routine_id("find_") }, -- 19 { "floor", FUNC, 1, routine_id("floor_") }, -- 20 { "get_key", FUNC, 0, routine_id("get_key_") }, -- 21 { "get_pixel", FUNC, 1, routine_id("get_pixel_") }, -- 22 { "getc", FUNC, 1, routine_id("getc_") }, -- 23 { "getenv", FUNC, 1, routine_id("getenv_") }, -- 24 { "gets", FUNC, 1, routine_id("gets_") }, -- 25 { "integer", FUNC, 1, routine_id("integer_") }, -- 26 { "length", FUNC, 1, routine_id("length_") }, -- 27 { "log", FUNC, 1, routine_id("log_") }, -- 28 { "machine_func", FUNC, 2, routine_id("machine_func_") }, -- 29 { "machine_proc", PROC, 2, routine_id("machine_proc_") }, -- 30 { "match", FUNC, 2, routine_id("match_") }, -- 31 { "mem_copy", PROC, 3, routine_id("mem_copy_") }, -- 32 { "mem_set", PROC, 3, routine_id("mem_set_") }, -- 33 { "not_bits", FUNC, 1, routine_id("not_bits_") }, -- 34 { "object", FUNC, 1, routine_id("object_") }, -- 35 { "open", FUNC, 2, routine_id("open_") }, -- 36 { "or_bits", FUNC, 2, routine_id("or_bits_") }, -- 37 { "peek", FUNC, 1, routine_id("peek_") }, -- 38 { "peek4s", FUNC, 1, routine_id("peek4s_") }, -- 39 { "peek4u", FUNC, 1, routine_id("peek4u_") }, -- 40 { "pixel", PROC, 2, routine_id("pixel_") }, -- 41 { "poke", PROC, 2, routine_id("poke_") }, -- 42 { "poke4", PROC, 2, routine_id("poke4_") }, -- 43 { "position", PROC, 2, routine_id("position_") }, -- 44 { "power", FUNC, 2, routine_id("power_") }, -- 45 { "prepend", FUNC, 2, routine_id("prepend_") }, -- 46 { "print", PROC, 2, routine_id("print_") }, -- 47 { "printf", PROC, 3, routine_id("printf_") }, -- 48 { "profile", PROC, 1, routine_id("profile_") }, -- 49 { "puts", PROC, 2, routine_id("puts_") }, -- 50 { "rand", FUNC, 1, routine_id("rand_") }, -- 51 { "remainder", FUNC, 2, routine_id("remainder_") }, -- 52 { "repeat", FUNC, 2, routine_id("repeat_") }, -- 53 { "routine_id", FUNC, 1, routine_id("routine_id_") }, -- 54 { "sequence", FUNC, 1, routine_id("sequence_") }, -- 55 { "sin", FUNC, 1, routine_id("sin_") }, -- 56 { "sprintf", FUNC, 2, routine_id("sprintf_") }, -- 57 { "sqrt", FUNC, 1, routine_id("sqrt_") }, -- 58 { "system", PROC, 2, routine_id("system_") }, -- 59 { "system_exec", FUNC, 2, routine_id("system_exec_") }, -- 60 { "tan", FUNC, 1, routine_id("tan_") }, -- 61 { "time", FUNC, 0, routine_id("time_") }, -- 62 { "trace", PROC, 1, routine_id("trace_") }, -- 63 { "xor_bits", FUNC, 2, routine_id("xor_bits_") }, -- 64 { "platform", FUNC, 0, routine_id("platform_") }} -- http://fastmail.fm - You've just been FastMailed!