diff --git a/tags/ONYX_4_3_1/devroot/.cvsignore b/tags/ONYX_4_3_1/devroot/.cvsignore new file mode 100644 index 000000000..7f246bd3b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/.cvsignore @@ -0,0 +1,9 @@ +aclocal.m4 +configure +config.log +Cookfile.list +config.cache +config.status +config.stamp +Cookfile +Cookfile.inc diff --git a/tags/ONYX_4_3_1/devroot/CHANGES.onyx b/tags/ONYX_4_3_1/devroot/CHANGES.onyx new file mode 100644 index 000000000..b7d85edb1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/CHANGES.onyx @@ -0,0 +1,895 @@ +2003-02-15 : Jason Evans + + * Onyx 4.3.1 released. + +2003-02-09 : Jason Evans + + * lib/libonyx/src/systemdict.c:systemdict_foreach() : Make a snapshot + for stack iteration and iterate over the snapshot, in order to avoid + crashes if the application removes stack objects during iteration. + + * lib/libonyx/src/systemdict.c:systemdict_repeat() : Re-order some code + to avoid popping objects off ostack until they are no longer needed. + + * lib/libonyx/include/libonyx/nxo_stack.h and + lib/libonyx/src/nxo_stack.c : Add debug code to overwrite cached stack + object containers, in order to make erroneous access of invalid + objects more apparent. + +2003-02-08 : Jason Evans + + * lib/libonyx/include/libonyx/nxo_dict_l.h:nxoe_l_dict_delete() : Make + the embedded dch non-shrinkable to avoid rehashes during finalization, + in order to avoid accessing already-finalized objects. This was a + regression that has existed since the 4.0.0 release. + + * lib/libonyx/src/dch.c : Add dch_shrinkable_[gs]et(). + + * lib/libonyx/src/nxo_dict.c:nxoe_p_dict_def() : Initialize the dch + before inserting the contents of the array into it. This bug could + cause memory corruption and/or crashes if a dict grew from 7-->8-->9 + (assuming CW_LIBONYX_DICT_SIZE == 9). This was a regression that has + existed since the 4.0.0 release. + +2003-02-01 : Jason Evans + + * Onyx 4.3.0 released. + +2003-01-30 : Jason Evans + + * configure.in : Add --with-host-cc and --with-target-cc to make + cross compiling possible. + + Cookfile.inc.in : Use HCC and TCC rather than CC to invoke the + compiler. + +2003-01-29 : Jason Evans + + * lib/libonyx/include/libonyx/libonyx.h:cw_bool_t : Fix cw_bool_t to + always work both with C and C++ code. The change on 2002-12-15 was + not adequate. + + * Modify the mod operator to handle any combination of integers and + reals. Submitted by Zeljko Vrba. + + * Modify the cvds operator to handle negative precision. + + * Add operators (submitted by Zeljko Vrba): + + exp + + sinh + + asin + + asinh + + cosh + + acos + + acosh + + tan + + tanh + + atan + + atanh + + * Rename the exp operator to pow. + + * Rename the atan operator to atan2. + +2002-12-15 : Jason Evans + + * Onyx 4.2.1 released. + + * Cast (cw_uint8_t *) to (char *) for strlen() calls. Submitted by + Zeljko Vrba. + + * lib/libonyx/include/libonyx/qr.h : Add a_type parameter to qr_meld() + and qr_split(), since C++ does not allow mixing (void *) assignments + with typed variables. Reported by Zeljko Vrba. + + * lib/libonyx/include/libonyx/nxo_stack.h : Add casts to fix comparisons + between cw_sint32_t and cw_uint32_t. Submitted by Zeljko Vrba. + + * lib/libonyx/include/libonyx/nxo.h:cw_nxo_t : Rename the operator field + to oper in order to avoid a collision with the C++ keyword. Reported + by Zeljko Vrba. + + * lib/libonyx/include/libonyx/libonyx.h:cw_bool_t : Use the C++ bool + type and true/false when C++ is being used, in order to reduce + conflicts with other libraries. Submitted by Zeljko Vrba. + +2002-12-01 : Jason Evans + + * Onyx 4.2.0 released. + +2002-11-30 : Jason Evans + + * Add operators: + + regsub + + subst + +2002-11-29 : Jason Evans + + * Add operators: + + regex + + match + + submatch + + offset + + split + +2002-11-27 : Jason Evans + + * lib/libonyx/include/libonyx/nxa.h : Add nxa_realloc() (bug fix). + +2002-11-15 : Jason Evans + + * Add the regexerror error. + + * lib/libonyx/include/libonyx/nxa_l.h:nxa_l_count_adjust() : Add. + +2002-11-03 : Jason Evans + + * lib/libonyx/src/nxo_dict.c:nxo_p_dict_hash() : Add case for NXOT_REAL + (bug fix). + + * lib/libonyx/src/nxo_thread.c:nxo_thread_loop() : Add case for + NXOT_REAL (bug fix). + + * lib/libonyx/src/systemdic.c:systemdict_lcheck() : Add case for + NXOT_REAL (bug fix). + +2002-09-08 : Jason Evans + + * Onyx 4.1.0 released. + +2002-09-07 : Jason Evans + + * Treat evaluatable names specially when binding (don't bind them), in + order to make it possible to force dynamic lookup of names, without + having to resort to using the load operator on literal names. + + This required a language syntax change so that evaluatable names can + be created in deferred execution mode. The possibilities for + specifying an evaluatable name were $$$name, $#name, or adding a new + special character. Since neither of the backward compatible syntax + changes were very palatable, two new special characters were added. + !name creates an evaluatable name, and the former $$name syntax is now + written as ~name for consistency. + +2002-09-06 : Jason Evans + + * Onyx 4.0.0 released. + +2002-09-05 : Jason Evans + + * Use the following in the build system, rather than using PREFIX + directly, so that individual paths can be set during configuration + and/or installation: + + BINDIR + + DATADIR + + LIBDIR + + INCLUDEDIR + + MANDIR + +2002-09-02 : Jason Evans + + * Add operators: + + bindsocket + + listen + + accept + + send + + recv + +2002-08-16 : Jason Evans + + * Add the --disable-socket configure option. + +2002-08-11 : Jason Evans + + * bin/onyx_config : Add onyx_config, which aids in building software + that uses libonyx. + +2002-08-04 : Jason Evans + + * lib/libonyx/src/nxo_string.c:nxo_string_cstring() : Handle name + objects as well as string objects. + + * Add operators: + + serviceport + + sockname + + peername + + sockopt + + setsockopt + +2002-08-02 : Jason Evans + + * Add the neterror error. + +2002-07-17 : Jason Evans + + * Add the --disable-modules configure option. + +2002-07-14 : Jason Evans + + * Add the ncat operator. + + * lib/libonyx/src/nxa.c : Restructure code for reference iteration and + deletion so that type-specific functions can be inlined, rather than + using the function pointer table behind nxoe_l_ref_iter() and + nxoe_l_delete(). + + * lib/libonyx/src/nxo.c : Remove nxoe_l_ref_iter() and nxoe_l_delete(), + since the only callers of those functions were in nxa.c. + + * lib/libonyx/src/nxo_dict.c : Use an embedded array rather than a dch + for small dict sizes. This reduces the memory overhead of small dicts + without a significant performance impact. + +2002-07-13 : Jason Evans + + * Remove the fork operator and replace it with the forkexec operator. + Doing anything between fork() and exec() in a multi-threaded + application risks hanging. + + * bin/onyx/src/batch.nx.in : Redefine stop in errordict, not in + currenterror. This bug has existed since before Onyx 1.0.0. + + * bin/onyx/src/onyx.c:nx_write() : Keep writing until all data are + written, even in the face of EINTR. + +2002-07-12 : Jason Evans + + * mod/modprompt/src/modprompt.c : Implement terminal-related signal + handling on so that suspending, resizing, interrupting, etc. work + correctly. + + * Revise string and pointer hashing functions to marginally improve + performance. + + * lib/libonyx/include/libonyx/ch.h : Add CW_CH_COUNT and CW_CH_VERBOSE. + + * lib/libonyx/include/libonyx/dch.h : Add CW_DCH_COUNT and + CW_DCH_VERBOSE. + + * lib/libonyx/include/libonyx/libonyx_defs.h.in : Add CW_P_INLINE and + use it instead of CW_INLINE for private functions. + +2002-07-09 : Jason Evans + + * Significantly revamp the xep code to adopt the semantics of C++ + exceptions. Remove xep_finally. Fix volatility bugs. Improve + performance by avoiding longjmp() calls in the common case. + +2002-07-07 : Jason Evans + + * Add operators: + + socket + + socketpair + + connect + + * Add the argcheck error. + +2002-06-22 : Jason Evans + + * Add support for GNU pth (--enable-pth). + +2002-06-19 : Jason Evans + + * lib/libonyx/include/libonyx/libonyx.h : Add cw_offsetof(). + +2002-06-02 : Jason Evans + + * Add operators: + + nonblocking + + setnonblocking + + * Modify the write operator to return whether a write was partial or + not. This is necessary for non-blocking files. + + * lib/libonyx/src/nxo_file.c : + + nxo_file_write() : Add the r_count parameter to support partial + writes. + + nxo_file_nonblocking_[gs]et() : Add. + +2002-06-01 : Jason Evans + + * Change language syntax. The / special character is now $. + +2002-05-25 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_realloc_e() : Cast from unsigned to signed + before subtraction, rather than after. This fixes an off-by-2^32 + error for the garbage collector allocation statistics. + +2002-04-27 : Jason Evans + + * Modify the mkdir operator such that specifying the mode is optional. + +2002-04-27 : Jason Evans + + * Add operators: + + chroot + + mkfifo + + pipe + + readlink + + umask + + * lib/libonyx/src/systemdict.c : Optimize operators to take advantage of + nxo_stack_remove(). + + * lib/libonyx/src/poll.c : Implement poll() emulation based on select(). + This is necessary to make the poll operator portable to OS X. + +2002-04-21 : Jason Evans + + * configure.in : Remove --enable-profile. + + * lib/libonyx/include/libonyx/mb.h : Convert mb_write() to a nop, but in + such a way that the compiler cannot re-order instructions around + mb_write(). This improves interpreter performance by a factor of + approximately 2.5. + + * Remove "fast" operator support, since it wasn't very fast. + Performance without fast operators is +-3% of what it was with fast + operator support, for typical programs. + + * Remove dstackunderflow as an error. With the addition of the + threaddstack operator, it is possible for a program to directly + manipulate dstack in ways that would thwart dstackunderflow checking, + and it is undesirable to prevent applications from being able to take + advantage of the possibilities afforded. On the down side, this makes + it easier to accidentally get the interpreter into an unusable state. + + * Add operators: + + inc, dec + + while, until + + * Remove operators: + + cleardstack + +2002-04-20 : Jason Evans + + * lib/libonyx/include/libonyx/nx.h : Add nx_threadsdict_get(). + + * Change language syntax: + + Radix integers are @ instead of #. + + Comments start with #, not %. + + Add special characters in strings: + - `\0' : Nul character (nul), equivalent to `\x00'. + - `\cC' : Control C, where C is [A-Za-z]. + - `\a' : Alarm (bel). + - `\e' : Escape (ec). + + * Add operators: + + threadsdict + + threaddstack, threadestack, threadistack, threadostack + + * Remove operators: + + #! + + !# + +2002-04-17 : Jason Evans + + * lib/libonyx/src/systemdict.c : + + Add operators: + + rot, srot + + adn, aup + + saup, sadn + + Rename/replace operators: + + push --> adn + + npush/nbpush --> rot + + snpush/snbpush --> srot + + Remove operators: + + push + + * lib/libonyx/include/libonyx/nxo_stack.h: Add nxo_stack_rot(). + +2002-04-06 : Jason Evans + + * lib/libonyx/src/systemdict.c : Add operators: + + bpop, nbpop, ipop, nip, tuck, under, over, up, nup, dn, ndn, bdup, + ibdup, ibpop, bpush + + sbpop, snbpop, sipop, snip, stuck, sunder, sover, sup, snup, sdn, + sndn, sndup, snpop, sbdup, sibdup, sibpop, sbpush + + * lib/libonyx/include/libonyx/nxo_stack.h : Add functions: + + nxo_stack_bget() + + nxo_stack_nbget() + + nxo_stack_up_get() + + nxo_stack_bpop() + + nxo_stack_nbpop() + + nxo_stack_remove() + + nxo_stack_bpush() + + * Rename operators: + + index --> idup + + sindex --> sidup + +2002-04-04 : Jason Evans + + * Add operators: + + poll + + gstdin, gstdout, gstderr + + setstdin, setstdout, setstderr + + setgstdin, setgstdout, setgstderr + + * lib/libonyx/src/nx.c : Add nx_stdin_set(), nx_stdout_set(), and + nx_stderr_set(). + + * lib/libonyx/src/nxo_thread.c : Add nxo_thread_stdin_set(), + nxo_thread_stdout_set(), and nxo_thread_stderr_set(). + +2002-03-31 : Jason Evans + + * Add optional mode argument to the open operator. + + * lib/libonyx/src/nxo_file.c:nxo_file_open() : Add the a_mode argument, + so that file creation mode can be specified. + + * lib/libonyx/src/systemdict.c:systemdict_test() : Use macros + (S_ISDIR(), S_ISREG(), etc.) for non-standardized portions of struct + stat's st_mode field. This fixes various false positives on Linux. + +2002-03-30 : Jason Evans + + * Onyx 3.0.2 released. + + * lib/libonyx/src/systemdict.c:systemdict_dirforeach() : Use strlen() + rather than the reclen field of struct dirent if there is no namlen + field. (Reported by John Liles.) + + * bin/onyx/src/onyx.c:batch_run() : Specify '+' as the first character + of the options string to getopt() on systems that use GNU libc, since + they will otherwise permute the arguments and leave unknown ones at + the end. This fixes #! magic handling in the case when options are + passed to the script that are also used by the onyx binary (for + example, -e). + +2002-03-27 : Jason Evans + + * Rename the catenate operator to cat. + +2002-03-23 : Jason Evans + + * Onyx 3.0.1 released. + +2002-03-22 : Jason Evans + + * lib/libonyx/src/systemdict.c:systemdict_rand() : Fix the way random() + is used and really generate 63 bits of randomness for the rand + operator. + +2002-03-17 : Jason Evans + + * lib/libonyx/src/nxo_name.c : Re-register name objects that are already + registered, in order to remove a race condition. + + * lib/libonyx/include/libonyx/mb.h : Implement write memory barriers. + Memory barriers are critical for threaded versions of Onyx, and they + are used in nxo_dup(), nxo_p_new(), nxo_p_type_set(), and + nxo_stack_roll(). + +2002-03-16 : Jason Evans + + * lib/libonyx/src/thd.c : Significantly rework the generic + suspend/resume code to use two signals (SIGUSR1 and SIGUSR2) rather + than just one. This allows the removal of some questionable code that + may not work on MP systems that use partial store ordering, and also + removes the need for resume interlocking. + + Fix lock order reversal deadlock potential in thd_suspend() and + thd_trysuspend(). + +2002-03-09 : Jason Evans + + * lib/libonyx/src/thd.c:thd_p_start_func() : Set the thd->pthread field + before inserting the thd into the ring. pthread_create() also sets + it, but if only one place sets it, then there is a race between one + thread setting thd->pthread and the other using it. + +2002-02-10 : Jason Evans + + * Onyx 3.0.0 released. + +2002-02-07 : Jason Evans + + * Add --with-libedit-prefix and --with-libpcre-prefix, which make it + possible to get rpath right if there are multiple copies of the + libraries installed. + +2002-02-06 : Jason Evans + + * Add --enable-autogen, so that the automatic rebuilding of configure + output is disabled by default. autogen.sh always passes this flag. + +2002-02-04 : Jason Evans + + * Move command line editing support from the onyx binary to modprompt. + This avoids the overhead of loading the libedit library for + non-interactive invocations of onyx. + + * Remove libedit from the source tree, and depend instead on an + installed copy of libedit. + +2002-02-02 : Jason Evans + + * lib/libonyx/src/systemdict.c:systemdict_dirforeach() : Don't report + "." and "..", which always exist, in order to make directory recursion + easier. + +2002-01-30 : Jason Evans + + * bin/onyx/src/onyx.c : Add command line support for #! magic when + --disable-posix-file is specified. This is necessary in order for onyx + to bootstrap itself when configured as such. + +2002-01-29 : Jason Evans + + * Cookfile.inc.in : Move the contents of Cookfile.in to Cookfile.inc.in, + so that cook's #include-cooked can re-read it if reconfiguration occurs. + + Add rules to cause reconfiguration if any .in files are modified. + +2002-01-28 : Jason Evans + + * Move require and mrequire from onyx to libonyx. Also, clean up the + searching mechanisms. + + * Add onyxdict. + +2002-01-25 : Jason Evans + + * Add a bootstrap phase to the build, so that the Onyx code that gets + embedded in the interpreter is customized to match the configuration + parameters. + +2002-01-22 : Jason Evans + + * Generate embedded onyx code during the build using a bootstrap onyx + interpreter (bonyx) so that the generated code corresponds to the + configuration flags. + +2002-01-20 : Jason Evans + + * Restructure the build system to place more logic in the configuration + phase and less in the Cookfiles. + + Change paths and binary names to incorporate version numbers, so that + multiple installations (different versions) can coexist in the same + tree. + + Change installation paths for modules and Onyx code. + + Reorganize documentation in order to support building multiple manuals. + +2002-01-13 : Jason Evans + + * Add support for reals, which are double precision floating point + numbers. This includes modifications to the scanner, the addition of + the nxo_real class, and several new operators: cvds, cves, ceiling, + floor, round, trunc, sqrt, ln, log, idiv, sin, cos, and atan. Also, + many operators and other portions of code were modified to handle the + mixture of reals and integers. + + * configure.in : Add the --disable-real configure flag. + +2002-01-04 : Jason Evans + + * bin/onyx/src/onyx.c:prompt() : Fix an out-of-bounds memory access. + +2001-12-24 : Jason Evans + + * Onyx 2.3.1 released. + +2001-12-23 : Jason Evans + + * lib/libonyx/include/libonyx/nx_l.h:nx_l_ref_iter() : Don't skip over + gcdict during root set iteration. This bug caused threadsdict to be the + first object returned during root set iteration, which obscured the bug + in nxa_p_roots(), mentioned below. + + * lib/libonyx/src/nxa.c:nxa_p_roots() : Iterate over the entire root + set, rather than short-circuiting after finding the first root. + +2001-12-21 : Jason Evans + + * Onyx 2.3.0 released. + + * Cookfile.in : Strip leading and trailing whitespace from CC, CPPFLAGS, + CFLAGS, and LDFLAGS in order to avoid argument splitting confusion. + + Make PREFIX over-ridable. + +2001-12-15 : Jason Evans + + * doc/latex/onyx_lang.tex : Document search. + +2001-12-08 : Jason Evans + + * Convert _cw_ to cw_ and _CW_ to CW_ in order to follow the ANSI C + standard for namespace reservation. + +2001-12-07 : Jason Evans + + * Move the modload operator from the onyx program to libonyx. + +2001-11-17 : Jason Evans + + * lib/libonyx/src/mem.c : Allocate copies of the filenames that are + passed in for debugging, so that leaks in dlopen()ed code that has been + unloaded won't cause the leak reporting to segfault. + + * configure.in : Do not specify CFLAGS unless none were passed in the + environment. + + Add the --disable-onyx and --disable-slate flags. + +2001-11-13 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_p_sweep() : Fix sweep iteration problems + when deferred deletion is encountered. + + * bin/onyx/src/onyx_ops.c:(onyx_ops_modload_sym_delete() : Increase the + GC sweep iteration for module unloading. + +2001-11-10 : Jason Evans + + * lib/libonyx/src/nx_nxcode.nx : Print errors to stderr rather than + stdout in systemdict's throw. + + * lib/libonyx/src/nxo_thread_nxcode.nx : Print errors to stderr rather + than stdout in errordict's handleerror. + +2001-11-09 : Jason Evans + + * configure.in : Add the --with-docs flag to cleanly avoid building + documentation in the common case. + +2001-11-04 : Jason Evans + + * Onyx 2.2.0 released. + + * lib/libonyx/src/nxa.c : Rename nxa_new() and nxa_delete() to + nxa_l_new() and nxa_l_delete(), since the functions are not part of the + public API. + + * Cookfile.in : Allow CC, CPPFLAGS, CFLAGS, and LDFLAGS to be overridden + on the command line. Also protect cook-special characters such as '=' + so that, for example, CFLAGS can contain -march=i386. + +2001-11-03 : Jason Evans + + * lib/libonyx/src/systemdict.c:systemdict_exec() : Throw a rangecheck + error if the argument array is empty. + + * lib/libonyx/src/nx_nxcode.nx : Redefine throw rather than handleerror + in the child process. Do type checking for the argument. + + * lib/libonyx/test/thd_a.c : Fix a race condition in the test. + +2001-10-31 : Jason Evans + + * lib/libonyx/src/mem.c : Use size_t instead of cw_uint32_t where + appropriate to avoid warnings and the possibility of varargs sizeof + mismatches for future ports. + + * lib/libonyx/src/nx.c:nx_delete() : Fix a circular dependency during + deletion that could cause a destroyed mutex to be referenced. + + * Port to Darwin (Apple OS X). + +2001-10-07 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_p_sweep() : Implement multiple sweep passes, + in order to support ordering the deletion of dependent objects. + + * lib/libonyx/src/systemdict.c:systemdict_bind() : Bind to hooks, just + as operators are bound to. + + * bin/onyx/src/onyx_ops.c:onyx_ops_modload() : The hook evaluated by + onyx_ops_modload() now calls dlclose() when deleted, which means that + all objects in a module must maintain a reference to the hook. + +2001-10-04 : Jason Evans + + * lib/libonyx/src/systemdict.c:systemdict_iobuf() : Add. + + systemdict_setiobuf() : Add. + + * bin/onyx/src/onyx.c:signal_handle() : Reset the terminal before + exiting due to a signal. + +2001-09-22 : Jason Evans + + * Onyx 2.1.0 released. + +2001-09-21 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_p_gc_entry() : Only do periodic collection + if there has been allocation activity since the last collection. Before + this fix, the code was doing periodic collection if there had been no + allocation since the last periodic check. + +2001-09-16 : Jason Evans + + * lib/libonyx/src/nxo_string.c:nxo_string_cstring() : Add. + +2001-09-15 : Jason Evans + + * lib/libonyx/src/nxo_thread.c:nxo_threade_nxn() : Remove. + + nxo_thread_error() : Remove. + + nxo_thread_nerror() : Add. + + nxo_thread_serror() : Add. + + * Generalize the error mechanism to support errors of any name. + + * Rename the manual from manual.{ps,pdf,html} to onyx.{ps,pdf,html}. + +2001-08-28 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_realloc_e() : Add. + +2001-08-21 : Jason Evans + + * Onyx 2.0.0 released. + + * Maintain the current number of bytes allocated by the interpreter and + use this count for threshold-based collection. + + * API additions: nxa_nx_get(). + + * API modifications: cw_opaque_dealloc_t, _cw_opaque_dealloc(), + mem_free_e(), nxa_free(), nxa_free_e(), nxa_stats_get(), and gcdict's + stats operator. + +2001-08-20 : Jason Evans + + * lib/libonyx/src/nxo_file.c : Clean up the internals of onyx file + objects and rename nxo_file_interactive() to nxo_file_synthetic() (with + API changes). As a result of the cleanup, the API for + nxo_file_readline() and nxo_file_buffer_size_set() have also changed. + +2001-08-19 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_p_roots() : Don't iterate through objects + once a root object is found; nxa_p_mark() does that just fine. + + * Add the --disable-posix-file configure option. This option disables + standard onyx file object operations, and requires that all file objects + be "interactive". + + * Fold libstash into libonyx. + + * lib/libonyx/src/nxo_file.c : Remove nxo_file_output() and + nxo_file_output_n(), which were not used anywhere. + +2001-08-17 : Jason Evans + + * Add the --disable-posix configure option. This option disables + significant functionality in order to make onyx more easily embeddable + in applications that to not have libc available. + + * Add the --disable-threads configure option. This option disables + significant functionality in order to run without threads. + +2001-08-13 : Jason Evans + + * Add the --disable-libedit configure option, and implement rudimentary + interactive command line editing that does not use libedit. + +2001-08-01 : Jason Evans + + * Onyx 1.1.0 released. + +2001-07-30 : Jason Evans + + * lib/libonyx/src/systemdict.c : Change the API of the following + operators to not leave the input stack on ostack: spush, scount, + scounttomark, sdup, sindex, sexch, sroll, spop, sclear, and + scleartomark. + + * configure.in : Check for the unsetenv() function, which Solaris does + not have. + + * doc/latex/onyx.tex : Document unsafeness of removing objects from a + concurrently accessed stack. + +2001-07-29 : Jason Evans + + * lib/libonyx/src/nxo_thread.c:nxoe_p_thread_name_accept() : When the + result of immediate name evaluation is an executable array, set the + evaluatable attribute. + + * Add an additional attribute. Objects are now literal, executable, or + evaluatable. The addition of the evaluatable attribute allows the bind + operator to replace executable names with associated executable arrays + by converting the executable arrays to evaluatable arrays. + + * lib/libonyx/src/systemdict.c : Add the cve and echeck operators. + + * src/nxa.c : Add nxa_malloc_e() and nxa_free_e(). + +2001-07-27 : Jason Evans + + * lib/libonyx/src/nxo_dict.c:nxoe_l_dict_delete() : Don't leak the + internal dch. + + * lib/libonyx/src/nxa.c : Track number of bytes of memory allocation + rather than number of object allocations in order to provide more + predictable threshold-triggered collection. + + * lib/libonyx/src/systemdict.c:systemdict_copy() : Pop the source + dictionary off ostack before returning. + +2001-07-26 : Jason Evans + + * lib/libonyx/src/nxa.c:nxa_p_mark() : Ignored unregistered objects, + rather than asserting that all objects are registered. + +2001-07-24 : Jason Evans + + * doc/latex/onyx.tex (section{Interpreter recursion}): Document tail + call conversion. + +2001-07-23 : Jason Evans + + * lib/libonyx/src/systemdict.c : Add the following operators: pid, ppid, + uid, euid, gid, egid, setuid, seteuid, setgid, and setegid. + + * bin/onyx/src/onyx.c:cl_read() : Retry if there is an error in + el_gets(). This should fix intermittent deadlocks when onyx is run + interactively. + +2001-07-22 : Jason Evans + + * lib/libonyx/src/systemdict.c : Add the ndup and npop operators. + + * lib/libonyx/include/libonyx/nxo_stack.h:NXO_STACK_NPOP() : Add a + missing ")". + + * lib/libonyx/src/systemdict.c : Add the setenv and unsetenv operators, + since direct modifications to envdict will not be visible to programs + such as ps. + +2001-07-21 : Jason Evans + + * lib/libonyx/src/nx_nxcode_gen.nx : Generate a temporary dictionary of + short names that is used to compact the onyx bootstrapping code. + +2001-07-20 : Jason Evans + + * lib/libonyx/src/nx_nxcode.nx : Implement outputsdict, outputs and + output. + + * lib/libonyx/src/systemdict.c:systemdict_cvrs() : Treat integer as + signed rather than unsigned. + +2001-07-19 : Jason Evans + + * lib/libonyx/src/systemdict.c:systemdict_hooktag() : Add. + + * lib/libonyx/include/libonyx/nx.h : Remove sprintdict, which is + replaced by sprintsdict. + + * lib/libonyx/src/nx_nxcode.nx : Implement sprintsdict and sprints. + Re-define sprint in terms of sprints. + + * lib/libonyx/src/systemdict.c:systemdict_cvs() : Convert a string to a + syntactically valid equivalent. Strings were previously left alone. + +2001-07-18 : Jason Evans + + * Onyx 1.0.2 released. + + * doc/Cookfile.inc : Add -local_icons flag to latex2html invocation so + that icons will be included in the distribution. + + * Onyx 1.0.1 released (retracted). + + * Onyx 1.0.0 released. + +2001-07-13 : Jason Evans + + * Install in [prefix]/share/onyx/* instead of + [prefix]/share/canonware/onyx/*. diff --git a/tags/ONYX_4_3_1/devroot/COPYING b/tags/ONYX_4_3_1/devroot/COPYING new file mode 100644 index 000000000..a0d53e7f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/COPYING @@ -0,0 +1,7 @@ +Unless otherwise specified, the files in the Canonware Onyx distribution are +subject to the following license: + +-------------------------------------------------------------------------------- + + +-------------------------------------------------------------------------------- diff --git a/tags/ONYX_4_3_1/devroot/Cookfile.in b/tags/ONYX_4_3_1/devroot/Cookfile.in new file mode 100644 index 000000000..b3c9f7263 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/Cookfile.in @@ -0,0 +1,16 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Master Cookfile. Most of the top level build system logic is in + * Cookfile.inc.in, so that cook can re-read it if config.status needs to + * regenerate it. + * + ******************************************************************************/ + +#include-cooked @objroot@/Cookfile.inc diff --git a/tags/ONYX_4_3_1/devroot/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/Cookfile.inc.in new file mode 100644 index 000000000..cd4a74f17 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/Cookfile.inc.in @@ -0,0 +1,211 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Cooked master Cookfile. + * + ******************************************************************************/ + +/* + * Make sure file timestamps are at least 1 second apart for all adjacent + * dependency nodes. + */ +set time-adjust; + +/* + * Standard definitions. + */ + +/* Installation prefixes. */ +if [not [defined PREFIX]] then +{ + PREFIX = [split " " [strip "@PREFIX@"]]; + + if [not [defined BINDIR]] then + BINDIR = [split " " [strip "@BINDIR@"]]; + + if [not [defined DATADIR]] then + DATADIR = [split " " [strip "@DATADIR@"]]; + + if [not [defined LIBDIR]] then + LIBDIR = [split " " [strip "@LIBDIR@"]]; + + if [not [defined INCLUDEDIR]] then + INCLUDEDIR = [split " " [strip "@INCLUDEDIR@"]]; + + if [not [defined MANDIR]] then + MANDIR = [split " " [strip "@MANDIR@"]]; +} +else +{ + /* Implicitly override all installation paths using [PREFIX], but take + * care to still honor explicit overrides. */ + if [not [defined BINDIR]] then + BINDIR = [PREFIX]/bin; + + if [not [defined DATADIR]] then + DATADIR = [PREFIX]/share; + + if [not [defined LIBDIR]] then + LIBDIR = [PREFIX]/lib; + + if [not [defined INCLUDEDIR]] then + INCLUDEDIR = [PREFIX]/include; + + if [not [defined MANDIR]] then + MANDIR = [PREFIX]/man; +} + +/* Paths to programs used by the build system. */ +SHELL = /bin/sh; +if [not [defined HCC]] then + HCC = [split " " [strip "@HCC@"]]; +if [not [defined TCC]] then + TCC = [split " " [strip "@TCC@"]]; + +/* Build parameters. */ +if [not [defined CPPFLAGS]] then + CPPFLAGS = [split " " [strip "@CPPFLAGS@"]]; +CPPDEFS = -D_REENTRANT; + +if [not [defined CFLAGS]] then + CFLAGS = [split " " [strip "@CFLAGS@"]]; +A_CFLAGS = [CFLAGS]; +S_CFLAGS = [CFLAGS] -fPIC -DPIC +#if [matches macho @abi@] + -dynamic +#endif + ; + +if [not [defined LDFLAGS]] then + LDFLAGS = [split " " [strip "@LDFLAGS@"]]; + +#if @enable_autogen@ +/* + * Re-configuration rules. + */ +@srcroot@/aclocal.m4 : @srcroot@/acinclude.m4 +{ + cd @srcroot@/\; @ACLOCAL@; +} + +@srcroot@/configure : @srcroot@/configure.in @srcroot@/aclocal.m4 +{ + cd @srcroot@/\; @AUTOCONF@; +} + +@objroot@/config.status : @srcroot@/configure +{ + @objroot@/config.status --recheck; +} + +@srcroot@/config.stamp.in : @srcroot@/configure.in @srcroot@/aclocal.m4 +{ + cd @srcroot@/\; @AUTOHEADER@; + echo stamp > @srcroot@/config.stamp.in; +} + +[fromto %0% @srcroot@/%0%.in @cfghdrs@] : @srcroot@/config.stamp.in; + +@objroot@/config.stamp : [fromto %0% @srcroot@/%0%.in @cfghdrs@] + @objroot@/config.status +{ + @objroot@/config.status; +} + +[addprefix @objroot@/ @cfgoutputs@] : [prepost @srcroot@/ .in @cfgoutputs@] + @objroot@/config.status +{ + @objroot@/config.status; +} +#endif + +/* Documentation. */ +#include-cooked @objroot@/doc/Cookfile.inc + +/* Tests. */ +#include-cooked @objroot@/test/Cookfile.inc + +/* Binaries. */ +#include-cooked @objroot@/bin/Cookfile.inc + +/* Libraries. */ +#include-cooked @objroot@/lib/Cookfile.inc + +/* Modules. */ +#include-cooked @objroot@/mod/Cookfile.inc + +/* + * User targets. + */ + +/* + * Leave tests out, since they aren't generally necessary when building and + * installing. + */ +all : libs mods bins docs + set default +; + +bootstrap : [addsuffix _bootstrap bins libs]; + +release : docs; + +install : [addsuffix _install bins mods libs docs]; + +uninstall : [addsuffix _uninstall bins mods libs docs]; + +clean : [addsuffix _clean docs tests bins mods libs] +{ + /* + * Delete .cook.fp files from the source tree and object tree. + * Delete Cookfile.list files from the object tree. + */ + [SHELL] -e; +data +#![SHELL] + +for i in `find @srcroot@ -type f -name .cook.fp` ; do + echo rm $i; + rm $i; +done +for i in `find @objroot@ -type f -name .cook.fp` ; do + echo rm $i; + rm $i; +done +for i in `find @objroot@ -type f -name Cookfile.list` ; do + echo rm $i; + rm $i; +done +dataend +} + +distclean : clean [addsuffix _distclean tests bins mods libs] +{ + rm -f @objroot@/config.log; + rm -f @objroot@/config.status; + rm -f @objroot@/config.stamp; + rm -f @cfghdrs@; + rm -f @cfgoutputs@; +} + +relclean : distclean [addsuffix _relclean docs] +{ + rm -f @objroot@/aclocal.m4; + rm -f @objroot@/configure; +} + +/* + * Rule for generation of C code from Onyx code. This rule assumes a stylized + * file naming convention, which all the pertinent source files conform to. + */ +@objroot@/%0%_nxcode.c : @objroot@/%0%.nx @srcroot@/%0%_gen.nx [BONYX] + set mkdir +{ + cat @objroot@/%0%.nx | [BONYX] @srcroot@/%0%_gen.nx > [target]; +} diff --git a/tags/ONYX_4_3_1/devroot/INSTALL b/tags/ONYX_4_3_1/devroot/INSTALL new file mode 100644 index 000000000..6ee4212e8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/INSTALL @@ -0,0 +1,347 @@ +################################################################################ +# +# Version: +# +# Building and installation instructions for the Canonware Onyx distribution. +# +################################################################################ + +This software depends on the excellent 'cook' program for building. 'cook' is +freely available (GPLed), and runs on many platforms. For more information, +see: + + http://www.canb.auug.org.au/~millerp/cook/cook.html + +Optional: Regular expression support in Onyx depends on the pcre library. pcre +is distributed separately, and needs to be installed before building the +software: + + ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ + +Optional: Interactive command line editing is implemented in modprompt, which +relies on libedit. libedit is distributed separately, and needs to be installed +before building this software: + + http://www.canonware.com/download/libedit/ + +Optional: Running the regression tests requires perl. + +Optional: Rebuilding the documentation requires LaTeX (teTeX distribution), +transfig, latex2html, and perl. However, the source distribution should come +with the documentation already built, so you should not need to do so unless +making documentation modifications. + +Optional: Regenerating the configure script requires GNU autoconf and GNU +automake. + +Building this distribution in many cases is as simple as typing the following +while in the root directory of the source tree: + + ./configure + cook + +To install, do the above, then type: + + cook install + +Additional build targets of finer granularity include: + + bins + + libs + libs_[as] + + mods + + tests + examples + +Additional install targets of finer granularity include: + + {bins,libs,mods,docs}_install + _bins_install + libs_install_[ias]; + _libs_install + _libs_install_[ias] + _mods_install + docs_install_{ps,pdf,html} + +Uninstall targets include: + + uninstall + {bins,libs,mods,docs}_uninstall + _uninstall + _uninstall + _uninstall + +Cleanup targets include: + + clean + distclean + relclean + +Targets that depend on optional supporting software include: + + docs + docs_{ps,pdf,html} + release + check + check_update + +The build system is capable of building in a different directory than the +source, so that no files are written to the source tree. In order to use this +feature, run 'configure' and 'cook' while in the directory that you want to +build the software in. + +Optionally, pass any of the following (not a definitive list) arguments to +'configure': + +--prefix= + Set the base directory in which to install. For example: + + ./configure --prefix=/usr/local + + will cause files to be installed into /usr/local/bin, /usr/local/man, + /usr/local/include, /usr/local/lib, and /usr/local/share. + +--disable-threads + Do not support threads. Specifying this option disables significant + functionality. The documentation does not mention the effects of this + option -- UTSL. + +--enable-pth + Use the GNU pth cooperative threading library rather than POSIX + threads. This has some minor impacts on the available functionality. + For example, periodic garbage collection is not available, and garbage + collection is synchronous rather than asynchronous. The documentation + does not mention the effects of this option -- UTSL. + + To build pth such that it works correctly for libonyx, use something + like the following to build it: + + ./configure --enable-syscall-hard + make + make install + +--disable-real + Do not include the "real" Onyx type, which supports double precision + floating point operations. The documentation does not mention the + effects of this option -- UTSL. + +--disable-regex + Do not use include support for regular expressions. This excludes the + "regex" and "regsub" Onyx types and associated operators. The + documentation does not mention the effects of this option -- UTSL. + + Regular expression support is provided by the PCRE library package, + which is open source software, written by Philip Hazel, and copyright + by the University of Cambridge, England. + + Onyx's garbage collector tracks memory allocation to trigger collection, + but as of PCRE 3.9, there is no reasonable way to get all the needed + memory allocation information from PCRE. The following patch addresses + this problem. Although nothing will break if this patch is not applied + to PCRE, without it, the Onyx interpreter will not have a 100% accurate + picture of memory usage. + +-------------------------------------------------------------------------------- +diff -ru pcre-3.9/doc/pcre.3 pcre-3.9-extra/doc/pcre.3 +--- pcre-3.9/doc/pcre.3 Wed Jan 2 07:57:58 2002 ++++ pcre-3.9-extra/doc/pcre.3 Sat Nov 23 16:10:00 2002 +@@ -426,6 +426,13 @@ + it is used to pass back information about the first character of any matched + string (see PCRE_INFO_FIRSTCHAR above). + ++ PCRE_INFO_EXTRASIZE ++ ++Return the size of the pcre_extra data (if any), that is, the value that was ++passed as the argument to \fBpcre_malloc()\fR when PCRE was getting memory in ++which to place the information created by \fBpcre_study()\fR. The fourth ++argument should point to a \fBsize_t\fR variable. ++ + + .SH MATCHING A PATTERN + The function \fBpcre_exec()\fR is called to match a subject string against a +diff -ru pcre-3.9/pcre.c pcre-3.9-extra/pcre.c +--- pcre-3.9/pcre.c Wed Jan 2 07:57:57 2002 ++++ pcre-3.9-extra/pcre.c Sat Nov 23 16:07:59 2002 +@@ -436,6 +436,10 @@ + ((re->options & PCRE_REQCHSET) != 0)? re->req_char : -1; + break; + ++ case PCRE_INFO_EXTRASIZE: ++ *((size_t *)where) = (study != NULL) ? sizeof(real_pcre_extra) : 0; ++ break; ++ + default: return PCRE_ERROR_BADOPTION; + } + +diff -ru pcre-3.9/pcre.in pcre-3.9-extra/pcre.in +--- pcre-3.9/pcre.in Wed Jan 2 07:57:58 2002 ++++ pcre-3.9-extra/pcre.in Sat Nov 23 16:05:48 2002 +@@ -71,6 +71,7 @@ + #define PCRE_INFO_FIRSTCHAR 4 + #define PCRE_INFO_FIRSTTABLE 5 + #define PCRE_INFO_LASTLITERAL 6 ++#define PCRE_INFO_EXTRASIZE 7 + + /* Types */ +-------------------------------------------------------------------------------- + +--disable-posix + As much as reasonably possible, avoid using any external library + functions (disjoint from --disable-threads option). This option is + useful when embedding onyx in an application where libc isn't available. + Specifying this option disables significant functionality. The + documentation does not mention the effects of this option -- UTSL. + +--disable-posix-file + As much as possible, avoid using POSIX file operations (open(), close(), + read(), write()). This option is incompatible with the posix option, so + implies --disable-posix. This option is useful when embedding onyx in + an application that does not have complete I/O capabilities. With the + exception of calls to printf() and fprintf(stderr, ...) in debug + versions of libonyx, no POSIX file operations are used. The + documentation does not mention the effects of this option -- UTSL. + +--disable-socket + Do not include networking socket support. The socket support relies on + POSIX functionality, so this option is automatically disabled if the + --disable-posix option is set. The documentation does not mention the + effects of this option -- UTSL. + +--disable-inlines + Do not use inline functions. This reduces the size of binaries at the + expense of performance. + +--disable-libonyx + Use an installed copy of libonyx rather than building it. + +--disable-modules + Do not include support for dynamically loadable modules. This leaves + out modload, require, and mrequire. The documentation does not mention + the effects of this option -- UTSL. + +--disable-modprompt + Do not build the prompt module, which provides command line editing + functionality for interactive invocations of onyx. There is little + benefit to disabling modprompt under normal circumstances, since there + is virtually no overhead involved for non-interactive invocations of + onyx (less than 50 bytes). The documentation does not mention the + effects of this option. + +--disable-onyx + Use an installed copy of onyx rather than building it. + +--disable-slate + Do not build slate. + +--enable-autogen + Include dependency rules in the build system to automatically regenerate + files created by configure when their sources are newer. This is + only of interest when making modifications to the source code. + +--enable-debug + Build debugging code and turn assertions on (controlled by the CW_ASSERT + cpp macro). The resulting libraries and modules will not be binary + compatible with ones that were compiled without this option, so + specifying this option and installing the results for general use is not + recommended. + +--with-docs + Enable build system rules to build the documentation. Unless this + option is specified, the build system assumes that pre-built + documentation resides in the source directory (which is the case for all + Onyx distributions). Note that the documentation lands in the objdir, + so in order to completely empty the objdir, the relclean target must be + used. This option is only useful when modifications have been made to + the documentation source. + +--with-pcre-prefix= + If specified, libonyx will be built using the copy of pcre in . + Specifically, /bin/pcre-config will be used to determine the + appropriate compiler and linker flags. + + This option should only be necessary when /bin is not in the + shell's PATH. This option does not provide a mechanism to choose + between multiple installations of pcre. + +--with-libedit-prefix= + If specified, modprompt will be built using the copy of libedit in + . Specifically, the following will be used when compiling and + linking modprompt: + + * Compiling: -I/include + * Linking: -L/lib + + In addition, if building on a system that requires that the library + search path be encoded in modprompt, the link line will also include + something like: + + -Wl,-rpath,/lib + + This option should only be necessary when there are multiple versions of + libedit installed on the system, and the desired version does not come + first in the default library search path, or if the library is not in + the default library search path. + +Optionally, define environment variables when invoking configure, including (not +exclusively): + +CFLAGS="?" + Pass these flags to the compiler. You probably shouldn't define this + unless you know what you are doing. + +CPPFLAGS="?" + Pass these flags to the C preprocessor. Note that CFLAGS is not passed + to 'cpp' when 'configure' is looking for include files, so you must use + CPPFLAGS instead if you need to help 'configure' find header files. + +LD_LIBRARY_PATH="?" + 'ld' uses this colon-separated list to find libraries. + +LDFLAGS="?" + Pass these flags when linking. + +PATH="?" + 'configure' uses this to find programs. + +Optionally, define cook variables when invoking cook, including (not +exclusively): + +PREFIX="?" + Use this as the installation prefix. + +BINDIR="?" + Use this as the installation prefix for programs. + +DATADIR="?" + Use this as the installation prefix for modules and documentation. + +LIBDIR="?" + Use this as the installation prefix for libraries. + +INCLUDEDIR="?" + Use this as the installation prefix for header files. + +MANDIR="?" + Use this as the installation prefix for man pages. + +HCC="?" + Use this to invoke the host C compiler (used for building a bootstrap + interpreter). + +TCC="?" + Use this to invoke the target C compiler. + +CPPDEFS="?" + Pass these flags to the C preprocessor. + +CFLAGS="?" + Pass these flags to the compiler. + +LDFLAGS="?" + Pass these flags when linking. + +PATH="?" + Use this to search for programs used during configuration and building. diff --git a/tags/ONYX_4_3_1/devroot/PLATFORMS b/tags/ONYX_4_3_1/devroot/PLATFORMS new file mode 100644 index 000000000..c59c0cd65 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/PLATFORMS @@ -0,0 +1,30 @@ +################################################################################ +# +# Version: +# +# Supported platforms and platform-specific information. +# +################################################################################ + +* FreeBSD 4.7. + +* Red Hat Linux 7.2. + +* Sun Solaris 2.6. + +* NetBSD 1.5. + + - POSIX threading does not work due to NetBSD's lack of pthreads. However, + GNU pth threading should work. + +* Apple OS X 10.2. + + - OS X uses the Mach-O binary format rather than ELF. Therefore, dlopen() and + friends do not natively exist. Dynamically loadable modules and the modload + and mrequire operators are not supported unless a libdl compatibility shim + is installed. One can be obtained from Apple's cvs repository, but even + then, the shim does not work 100% compatibly. Specifically, dlsym() does + not implicitly search for symbols with a "_" prefixed. The solution is + either to modify the shim or modify scripts to explicitly include the "_" + prefix. The module(s) included with the distribution assume that symbols + with "_" prefixes are implicitly searched for. diff --git a/tags/ONYX_4_3_1/devroot/README b/tags/ONYX_4_3_1/devroot/README new file mode 100644 index 000000000..e8a2e3e1a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/README @@ -0,0 +1,19 @@ +################################################################################ +# +# Version: +# +################################################################################ + +The following files may be of direct interest to the user: + +* COPYING - Copyright and redistribution information. + +* INSTALL - Installation information. + +* PLATFORMS - Supported platforms and platform-specific information. + +* doc/html/onyx/onyx.html - Manual in html format. + +* doc/ps/onyx/onyx.ps - Manual in PostScript format. + +* doc/pdf/onyx/onyx.pdf - Manual in Portable Document Format. diff --git a/tags/ONYX_4_3_1/devroot/acinclude.m4 b/tags/ONYX_4_3_1/devroot/acinclude.m4 new file mode 100644 index 000000000..6a7c9ae4c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/acinclude.m4 @@ -0,0 +1,102 @@ +dnl CW_BUILD_LIB(lib, var) +dnl lib : Name of library. +dnl var : Name of variable to substitute in configure output. +AC_DEFUN(CW_BUILD_LIB, +[ +AC_MSG_CHECKING(whether to include $1 in build) +if test -d "$srcroot/lib/$1" ; then + build_$1="yes" + $2=1 + cfgoutputs="$cfgoutputs lib/$1/Cookfile.inc" + if test -f "$srcroot/lib/$1/doc/latex/manual.tex.in" ; then + mkdir -p "$objroot/lib/$1/doc/latex" + cfgoutputs="$cfgoutputs lib/$1/doc/latex/manual.tex" + fi + mkdir -p "$objroot/lib/$1/include/$1" + cfghdrs="$cfghdrs $objroot/lib/$1/include/$1/$1_defs.h" + libs="$libs $1" +else + build_$1="no" + $2=0 +fi +AC_MSG_RESULT($build_$1) +AC_SUBST($2) +]) + +dnl CW_BUILD_MOD(mod, var) +dnl mod : Name of module. +dnl var : Name of variable to substitute in configure output. +AC_DEFUN(CW_BUILD_MOD, +[ +AC_MSG_CHECKING(whether to include $1 in build) +if test -d "$srcroot/mod/$1" ; then + build_$1="yes" + $2=1 + cfgoutputs="$cfgoutputs mod/$1/Cookfile.inc mod/$1/nx/$1/$1_defs.nx" + if test -f "$srcroot/mod/$1/doc/latex/manual.tex.in" ; then + mkdir -p "$objroot/mod/$1/doc/latex" + cfgoutputs="$cfgoutputs mod/$1/doc/latex/manual.tex" + fi + mkdir -p "$objroot/mod/$1/include" + cfghdrs="$cfghdrs $objroot/mod/$1/include/$1_defs.h" + mods="$mods $1" +else + build_$1="no" + $2=0 +fi +AC_MSG_RESULT($build_$1) +AC_SUBST($2) +]) + +dnl CW_BUILD_BIN(bin, var) +dnl bin : Name of binary. +dnl var : Name of variable to substitute in configure output. +AC_DEFUN(CW_BUILD_BIN, +[ +AC_MSG_CHECKING(whether to include $1 in build) +if test -d "$srcroot/bin/$1" ; then + build_$1="yes" + $2=1 + cfgoutputs="$cfgoutputs bin/$1/Cookfile.inc" + if test -f "$srcroot/bin/$1/doc/latex/manual.tex.in" ; then + mkdir -p "$objroot/bin/$1/doc/latex" + cfgoutputs="$cfgoutputs bin/$1/doc/latex/manual.tex" + fi + if test -f "$srcroot/bin/$1/man/man1/$1.1.in" ; then + mkdir -p "$objroot/bin/$1/man/man1" + cfgoutputs="$cfgoutputs bin/$1/man/man1/$1.1" + fi + if test -f "$srcroot/bin/$1/include/$1_defs.h.in" ; then + mkdir -p "$objroot/bin/$1/include" + cfghdrs="$cfghdrs $objroot/bin/$1/include/$1_defs.h" + fi + bins="$bins $1" +else + build_$1="no" + $2=0 +fi +AC_MSG_RESULT($build_$1) +AC_SUBST($2) +]) + +dnl CW_BUILD_DOC(doc, var) +dnl bin : Name of document. +dnl var : Name of variable to substitute in configure output. +AC_DEFUN(CW_BUILD_DOC, +[ +AC_MSG_CHECKING(whether to include $1 document in build) +if test -d "$srcroot/doc/latex/$1" ; then + build_$1="yes" + $2=1 + if test -f "$srcroot/doc/latex/$1/$1.tex.in" ; then + mkdir -p "$objroot/doc/latex/$1" + cfgoutputs="$cfgoutputs doc/latex/$1/$1.tex doc/latex/$1/Cookfile.inc" + fi + docs="$docs $1" +else + build_$1="no" + $2=0 +fi +AC_MSG_RESULT($build_$1) +AC_SUBST($2) +]) diff --git a/tags/ONYX_4_3_1/devroot/autogen.sh b/tags/ONYX_4_3_1/devroot/autogen.sh new file mode 100755 index 000000000..b49c1a38a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/autogen.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +for i in aclocal autoconf; do + echo "$i" + $i + if [ $? -ne 0 ]; then + echo "Error $? in $i" + exit 1 + fi +done + +echo "./configure --enable-autogen $@" +./configure --enable-autogen $@ +if [ $? -ne 0 ]; then + echo "Error $? in ./configure" + exit 1 +fi diff --git a/tags/ONYX_4_3_1/devroot/bin/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/.cvsignore new file mode 100644 index 000000000..82d4687e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/.cvsignore @@ -0,0 +1,2 @@ +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/bin/Cookfile b/tags/ONYX_4_3_1/devroot/bin/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/bin/Cookfile.inc.in new file mode 100644 index 000000000..33d1cb852 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/Cookfile.inc.in @@ -0,0 +1,65 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Top level Cookfile for building binaries. + * + ******************************************************************************/ + +#include-cooked [fromto % @objroot@/bin/%/Cookfile.inc @bins@] + +/* + * Targets. + */ +bins : @bins@; + +bins_bootstrap : [addsuffix _bins_bootstrap @bins@]; + +bins_tests : [addsuffix _bins_tests @bins@]; +bins_check : [addsuffix _bins_check @bins@]; +bins_check_update : [addsuffix _bins_check_update @bins@]; + +bins_install : [addsuffix _bins_install @bins@]; + +bins_uninstall : [addsuffix _bins_uninstall @bins@]; + +bins_clean : [addsuffix _bins_clean @bins@]; + +bins_distclean : [addsuffix _bins_clean @bins@]; + +/* + * Build rules for binary C files --> object files. + */ +@objroot@/bin/%0src/%1.o_a : @srcroot@/bin/%0src/%1.c + set mkdir +{ + [TCC] [A_CFLAGS] [CPPFLAGS] + -I@srcroot@/bin/%0include -I@objroot@/bin/%0include + [CPPDEFS] -c @srcroot@/bin/%0src/%1.c -o [target]; + + c_incl [CPPFLAGS] -I@srcroot@/bin/%0include -I@objroot@/bin/%0include + --no-cache -Absent_Local_Ignore -No_System @srcroot@/bin/%0src/%1.c + "--prefix='"[target]" : "@srcroot@/bin/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto bin/%0src/%1.o_a bin/%0src/%1.d_a [target]]; +} + +/* For generated C files. */ +@objroot@/bin/%0src/%1.o_a : @objroot@/bin/%0src/%1.c + set mkdir +{ + [TCC] [A_CFLAGS] [CPPFLAGS] + -I@srcroot@/bin/%0include -I@objroot@/bin/%0include + [CPPDEFS] -c @objroot@/bin/%0src/%1.c -o [target]; + + c_incl [CPPFLAGS] -I@srcroot@/bin/%0include -I@objroot@/bin/%0include + --no-cache -Absent_Local_Ignore -No_System @objroot@/bin/%0src/%1.c + "--prefix='"[target]" : "@objroot@/bin/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto bin/%0src/%1.o_a bin/%0src/%1.d_a [target]]; +} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx/.cvsignore new file mode 100644 index 000000000..a405988a5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/.cvsignore @@ -0,0 +1,3 @@ +bin +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/bin/onyx/Cookfile.inc.in new file mode 100644 index 000000000..6897a0bb0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/Cookfile.inc.in @@ -0,0 +1,410 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Cookfile for onyx. + * + ******************************************************************************/ + +/* Include generated dependency files. */ +#include-cooked [glob @objroot@/bin/onyx/src/"*.d_*"] + +/* + * File lists. + */ + +TONYX_SRCS = tonyx.c; +TONYX_SRCS = [addprefix @srcroot@/bin/onyx/src/ [TONYX_SRCS]]; + +/* Source files common to onyx and bonyx. */ +ONYX_COMMON_SRCS = [addprefix @srcroot@/bin/onyx/src/ + onyx.c + ]; + +/* Onyx source files that are used to generate C code. */ +ONYX_NSRCS = [addprefix @srcroot@/bin/onyx/src/ + batch.nx.in interactive.nx.in + ]; + +/* bonyx-only source files. */ +BONYX_ONLY_SRCS = [fromto %0%.nx.in %0%_bootstrap.c [ONYX_NSRCS]]; + +/* onyx-only source files. */ +ONYX_ONLY_SRCS = [fromto @srcroot@/%0%.nx.in @objroot@/%0%_nxcode.c + [ONYX_NSRCS]]; + +/* + * Onyx tests. + */ +ONYX_OTESTS = +#if [and @enable_threads@ @enable_posix@] + + name_unsweep.nx.in setgstderr_a.nx.in setgstderr_b.nx.in + setgstderr_c.nx.in setgstdin_a.nx.in setgstdin_b.nx.in + setgstdin_c.nx.in setgstdout_a.nx.in setgstdout_b.nx.in + setgstdout_c.nx.in + +#endif +#if @enable_threads@ + + gc_roll.nx.in gstderr_a.nx.in gstdin_a.nx.in gstdout_a.nx.in + monitor_a.nx.in monitor_b.nx.in monitor_c.nx.in + threadsdict_a.nx.in + +#endif +#if @enable_real@ + + abs_d.nx.in add_e.nx.in atan2_a.nx.in atan2_b.nx.in atan2_c.nx.in + atan2_d.nx.in ceiling_a.nx.in ceiling_b.nx.in ceiling_c.nx.in + cos_a.nx.in cos_b.nx.in cos_c.nx.in cvds_a.nx.in cvds_b.nx.in + cvds_c.nx.in cvds_d.nx.in cves_a.nx.in cves_b.nx.in cves_c.nx.in + cves_d.nx.in cvs_c.nx.in dec_c.nx.in div_a.nx.in div_b.nx.in + div_c.nx.in div_d.nx.in div_e.nx.in eq_c.nx.in floor_a.nx.in + floor_b.nx.in floor_c.nx.in ge_i.nx.in gt_i.nx.in inc_c.nx.in + le_i.nx.in ln_a.nx.in ln_b.nx.in ln_c.nx.in ln_d.nx.in log_a.nx.in + log_b.nx.in log_c.nx.in log_d.nx.in lt_i.nx.in mul_e.nx.in + ne_c.nx.in neg_d.nx.in output_b.nx.in pow_e.nx.in round_a.nx.in + round_b.nx.in round_c.nx.in sin_a.nx.in sin_b.nx.in sin_c.nx.in + sprint_b.nx.in sqrt_a.nx.in sqrt_b.nx.in sqrt_c.nx.in sqrt_d.nx.in + sub_e.nx.in trunc_a.nx.in trunc_b.nx.in trunc_c.nx.in + +#endif +#if @enable_regex@ + + match_a.nx.in match_b.nx.in match_c.nx.in match_d.nx.in + match_e.nx.in match_f.nx.in match_g.nx.in match_h.nx.in + match_i.nx.in match_j.nx.in match_k.nx.in match_l.nx.in + match_m.nx.in match_n.nx.in offset_a.nx.in offset_b.nx.in + offset_c.nx.in offset_d.nx.in offset_e.nx.in offset_f.nx.in + offset_g.nx.in offset_h.nx.in regex_a.nx.in regex_b.nx.in + regex_c.nx.in regex_d.nx.in regex_e.nx.in regex_f.nx.in + regex_g.nx.in regex_h.nx.in regex_i.nx.in regex_j.nx.in + regsub_a.nx.in regsub_b.nx.in regsub_c.nx.in regsub_d.nx.in + regsub_e.nx.in regsub_f.nx.in regsub_g.nx.in regsub_h.nx.in + regsub_i.nx.in regsub_j.nx.in regsub_k.nx.in regsub_l.nx.in + split_a.nx.in split_b.nx.in split_c.nx.in split_d.nx.in + split_e.nx.in split_f.nx.in split_g.nx.in split_h.nx.in + split_i.nx.in split_j.nx.in split_k.nx.in split_l.nx.in + split_m.nx.in split_n.nx.in submatch_a.nx.in submatch_b.nx.in + submatch_c.nx.in subst_a.nx.in subst_b.nx.in subst_c.nx.in + subst_d.nx.in subst_e.nx.in subst_f.nx.in subst_g.nx.in + subst_h.nx.in subst_i.nx.in subst_j.nx.in subst_k.nx.in + subst_l.nx.in subst_m.nx.in subst_n.nx.in subst_o.nx.in + subst_p.nx.in subst_q.nx.in + +#endif +#if @enable_posix@ + + argv_a.nx.in argv_b.nx.in chroot_a.nx.in chroot_b.nx.in + dirforeach_a.nx.in dirforeach_b.nx.in dirforeach_c.nx.in + mkfifo_a.nx.in mkfifo_b.nx.in mkfifo_c.nx.in mkfifo_d.nx.in + mkfifo_e.nx.in nsleep_a.nx.in nsleep_b.nx.in nsleep_c.nx.in + nsleep_d.nx.in pipe_a.nx.in poll_a.nx.in poll_b.nx.in poll_c.nx.in + poll_d.nx.in poll_e.nx.in poll_f.nx.in poll_g.nx.in poll_h.nx.in + poll_i.nx.in poll_j.nx.in rand_a.nx.in readlink_a.nx.in + readlink_b.nx.in readlink_c.nx.in readlink_d.nx.in setenv_a.nx.in + setenv_b.nx.in setenv_c.nx.in srand_a.nx.in srand_b.nx.in + srand_c.nx.in srand_d.nx.in truncate_a.nx.in truncate_b.nx.in + truncate_c.nx.in truncate_d.nx.in truncate_e.nx.in umask_a.nx.in + umask_b.nx.in umask_c.nx.in unsetenv_a.nx.in unsetenv_b.nx.in + +#endif + + abs_a.nx.in abs_b.nx.in abs_c.nx.in add_a.nx.in add_b.nx.in + add_c.nx.in add_d.nx.in adn_a.nx.in adn_b.nx.in and_a.nx.in + and_b.nx.in and_c.nx.in and_d.nx.in and_e.nx.in and_f.nx.in + aup_a.nx.in aup_b.nx.in bdup_a.nx.in bdup_b.nx.in begin_a.nx.in + begin_b.nx.in begin_c.nx.in bind_a.nx.in bpop_a.nx.in bpop_b.nx.in + cat_a.nx.in cat_b.nx.in cat_c.nx.in cat_d.nx.in clear_a.nx.in + cleartomark_a.nx.in copy_a.nx.in copy_b.nx.in copy_c.nx.in + copy_d.nx.in copy_e.nx.in copy_f.nx.in copy_g.nx.in count_a.nx.in + countdstack_a.nx.in countestack_a.nx.in counttomark_a.nx.in + counttomark_b.nx.in counttomark_c.nx.in cve_a.nx.in cve_b.nx.in + cvlit_a.nx.in cvlit_b.nx.in cvn_a.nx.in cvn_b.nx.in cvn_c.nx.in + cvrs_a.nx.in cvrs_b.nx.in cvrs_c.nx.in cvrs_d.nx.in cvrs_e.nx.in + cvrs_f.nx.in cvs_a.nx.in cvs_b.nx.in cvx_a.nx.in cvx_b.nx.in + dec_a.nx.in dec_b.nx.in dec_d.nx.in def_a.nx.in def_b.nx.in + dict_a.nx.in dn_a.nx.in dn_b.nx.in dstack_a.nx.in dup_a.nx.in + dup_b.nx.in end_a.nx.in eq_a.nx.in eq_b.nx.in eval.nx.in + eval_a.nx.in eval_b.nx.in exch_a.nx.in exch_b.nx.in exch_c.nx.in + exit_a.nx.in for_a.nx.in for_b.nx.in for_c.nx.in for_d.nx.in + for_e.nx.in foreach_a.nx.in foreach_b.nx.in foreach_c.nx.in + foreach_d.nx.in gc_dict_finalize.nx.in ge_a.nx.in ge_b.nx.in + ge_c.nx.in ge_d.nx.in ge_e.nx.in ge_f.nx.in ge_g.nx.in ge_h.nx.in + get_a.nx.in get_b.nx.in get_c.nx.in get_d.nx.in get_e.nx.in + get_f.nx.in get_g.nx.in get_h.nx.in getinterval_a.nx.in + getinterval_b.nx.in getinterval_c.nx.in getinterval_d.nx.in + getinterval_e.nx.in getinterval_f.nx.in getinterval_g.nx.in + getinterval_h.nx.in getinterval_i.nx.in gt_a.nx.in gt_b.nx.in + gt_c.nx.in gt_d.nx.in gt_e.nx.in gt_f.nx.in gt_g.nx.in gt_h.nx.in + hello.nx.in ibdup_a.nx.in ibdup_b.nx.in ibdup_c.nx.in + ibdup_d.nx.in ibdup_e.nx.in ibdup_f.nx.in ibpop_a.nx.in + ibpop_b.nx.in ibpop_c.nx.in ibpop_d.nx.in ibpop_e.nx.in + ibpop_f.nx.in idiv_a.nx.in idiv_b.nx.in idiv_c.nx.in idiv_d.nx.in + idiv_e.nx.in idup_a.nx.in idup_b.nx.in idup_c.nx.in idup_d.nx.in + idup_e.nx.in idup_f.nx.in if_a.nx.in if_b.nx.in if_c.nx.in + ifelse_a.nx.in ifelse_b.nx.in ifelse_c.nx.in immediate_a.nx.in + immediate_b.nx.in inc_a.nx.in inc_b.nx.in inc_d.nx.in + integer.nx.in integer_a.nx.in integer_b.nx.in integer_c.nx.in + integer_d.nx.in ipop_a.nx.in ipop_b.nx.in ipop_c.nx.in + ipop_d.nx.in ipop_e.nx.in known_a.nx.in known_b.nx.in + known_c.nx.in le_a.nx.in le_b.nx.in le_c.nx.in le_d.nx.in + le_e.nx.in le_f.nx.in le_g.nx.in le_h.nx.in length_a.nx.in + length_b.nx.in length_c.nx.in loop_a.nx.in loop_b.nx.in lt_a.nx.in + lt_b.nx.in lt_c.nx.in lt_d.nx.in lt_e.nx.in lt_f.nx.in lt_g.nx.in + lt_h.nx.in mark_a.nx.in mod_a.nx.in mod_b.nx.in mod_c.nx.in + mod_d.nx.in mod_e.nx.in mul_a.nx.in mul_b.nx.in mul_c.nx.in + mul_d.nx.in nbpop_a.nx.in nbpop_b.nx.in nbpop_c.nx.in + nbpop_d.nx.in nbpop_e.nx.in ncat_a.nx.in ncat_b.nx.in ncat_c.nx.in + ncat_d.nx.in ncat_e.nx.in ncat_f.nx.in ncat_g.nx.in ncat_h.nx.in + ncat_i.nx.in ncat_j.nx.in ncat_k.nx.in ndn_a.nx.in ndn_b.nx.in + ndn_c.nx.in ndn_d.nx.in ndn_e.nx.in ndn_f.nx.in ndup_a.nx.in + ndup_b.nx.in ndup_c.nx.in ndup_d.nx.in ndup_e.nx.in ne_a.nx.in + ne_b.nx.in neg_a.nx.in neg_b.nx.in neg_c.nx.in nip_a.nx.in + nip_b.nx.in not_a.nx.in not_b.nx.in not_c.nx.in npop_a.nx.in + npop_b.nx.in npop_c.nx.in npop_d.nx.in npop_e.nx.in nup_a.nx.in + nup_b.nx.in nup_c.nx.in nup_d.nx.in nup_e.nx.in nup_f.nx.in + or_a.nx.in or_b.nx.in or_c.nx.in or_d.nx.in or_e.nx.in or_f.nx.in + output_a.nx.in over_a.nx.in over_b.nx.in pop_a.nx.in pop_b.nx.in + pow_a.nx.in pow_b.nx.in pow_c.nx.in pow_d.nx.in put_a.nx.in + put_b.nx.in put_c.nx.in put_d.nx.in put_e.nx.in put_f.nx.in + put_g.nx.in put_h.nx.in put_i.nx.in putinterval_a.nx.in + putinterval_b.nx.in putinterval_c.nx.in putinterval_d.nx.in + putinterval_e.nx.in putinterval_f.nx.in putinterval_g.nx.in + putinterval_h.nx.in putinterval_i.nx.in repeat_a.nx.in + repeat_b.nx.in repeat_c.nx.in repeat_d.nx.in roll_a.nx.in + roll_b.nx.in roll_c.nx.in roll_d.nx.in roll_e.nx.in roll_f.nx.in + roll_g.nx.in rot_a.nx.in rot_b.nx.in rot_c.nx.in rot_d.nx.in + sadn_a.nx.in sadn_b.nx.in sadn_c.nx.in sadn_d.nx.in saup_a.nx.in + saup_b.nx.in saup_c.nx.in saup_d.nx.in sclear_a.nx.in + sbdup_a.nx.in sbdup_b.nx.in sbdup_c.nx.in sbdup_d.nx.in + sbpop_a.nx.in sbpop_b.nx.in sbpop_c.nx.in sbpop_d.nx.in + sbpush_a.nx.in sbpush_b.nx.in sbpush_c.nx.in sbpush_d.nx.in + sclear_b.nx.in sclear_c.nx.in scleartomark_a.nx.in + scleartomark_b.nx.in scleartomark_c.nx.in scleartomark_d.nx.in + scount_a.nx.in scount_b.nx.in scount_c.nx.in scounttomark_a.nx.in + scounttomark_b.nx.in scounttomark_c.nx.in sdn_a.nx.in sdn_b.nx.in + sdn_c.nx.in sdn_d.nx.in sdup_a.nx.in sdup_b.nx.in sdup_c.nx.in + sdup_d.nx.in search.nx.in setstderr_a.nx.in setstderr_b.nx.in + setstderr_c.nx.in setstdin_a.nx.in setstdin_b.nx.in + setstdin_c.nx.in setstdout_a.nx.in setstdout_b.nx.in + setstdout_c.nx.in sexch_a.nx.in sexch_b.nx.in sexch_c.nx.in + sexch_d.nx.in shift_a.nx.in shift_b.nx.in shift_c.nx.in + shift_d.nx.in sibdup_a.nx.in sibdup_b.nx.in sibdup_c.nx.in + sibdup_d.nx.in sibdup_e.nx.in sidup_a.nx.in sidup_b.nx.in + sidup_c.nx.in sidup_d.nx.in sidup_e.nx.in sidup_f.nx.in + sidup_g.nx.in sibpop_a.nx.in sibpop_b.nx.in sibpop_c.nx.in + sibpop_d.nx.in sibpop_e.nx.in sibpop_f.nx.in sibpop_g.nx.in + sipop_a.nx.in sipop_b.nx.in sipop_c.nx.in sipop_d.nx.in + sipop_e.nx.in sipop_f.nx.in sipop_g.nx.in snbpop_a.nx.in + snbpop_b.nx.in snbpop_c.nx.in snbpop_d.nx.in snbpop_e.nx.in + snbpop_f.nx.in snbpop_g.nx.in sndn_a.nx.in sndn_b.nx.in + sndn_c.nx.in sndn_d.nx.in sndup_a.nx.in sndup_b.nx.in + sndup_c.nx.in sndup_d.nx.in sndup_e.nx.in snip_a.nx.in + snip_b.nx.in snip_c.nx.in snip_d.nx.in snpop_a.nx.in snpop_b.nx.in + snpop_c.nx.in snpop_d.nx.in snpop_e.nx.in snpop_f.nx.in + snpop_g.nx.in snup_a.nx.in snup_b.nx.in snup_c.nx.in snup_d.nx.in + sover_a.nx.in sover_b.nx.in sover_c.nx.in sover_d.nx.in + sover_e.nx.in spop_a.nx.in spop_b.nx.in spop_c.nx.in spop_d.nx.in + sprint_a.nx.in spush_a.nx.in spush_b.nx.in spush_c.nx.in + spush_d.nx.in sroll_a.nx.in sroll_b.nx.in sroll_c.nx.in + sroll_d.nx.in sroll_e.nx.in sroll_f.nx.in sroll_g.nx.in + sroll_h.nx.in sroll_i.nx.in srot_a.nx.in srot_b.nx.in srot_c.nx.in + srot_d.nx.in srot_e.nx.in stack_a.nx.in start_a.nx.in + start_b.nx.in stderr_a.nx.in stdin_a.nx.in stdout_a.nx.in + stopped_a.nx.in stopped_b.nx.in stopped_c.nx.in string_a.nx.in + string_b.nx.in string_c.nx.in string_d.nx.in string_e.nx.in + stuck_a.nx.in stuck_b.nx.in stuck_c.nx.in stuck_d.nx.in + stuck_e.nx.in sub_a.nx.in sub_b.nx.in sub_c.nx.in sub_d.nx.in + sunder_a.nx.in sunder_b.nx.in sunder_c.nx.in sunder_d.nx.in + sunder_e.nx.in sup_a.nx.in sup_b.nx.in sup_c.nx.in sup_d.nx.in + sym_lp_a.nx.in sym_gt_a.nx.in sym_gt_b.nx.in sym_gt_c.nx.in + sym_lt_a.nx.in sym_rp_a.nx.in sym_rp_b.nx.in syntaxerror_a.nx.in + syntaxerror_b.nx.in syntaxerror_c.nx.in syntaxerror_d.nx.in + syntaxerror_e.nx.in syntaxerror_f.nx.in syntaxerror_g.nx.in + syntaxerror_h.nx.in syntaxerror_i.nx.in syntaxerror_j.nx.in + syntaxerror_k.nx.in syntaxerror_l.nx.in syntaxerror_m.nx.in + syntaxerror_n.nx.in syntaxerror_o.nx.in syntaxerror_p.nx.in + syntaxerror_q.nx.in syntaxerror_r.nx.in syntaxerror_s.nx.in + threaddstack_a.nx.in threaddstack_b.nx.in threaddstack_c.nx.in + threadestack_a.nx.in threadestack_b.nx.in threadestack_c.nx.in + threadistack_a.nx.in threadistack_b.nx.in threadistack_c.nx.in + threadostack_a.nx.in threadostack_b.nx.in threadostack_c.nx.in + throw_a.nx.in throw_b.nx.in throw_c.nx.in token_a.nx.in + token_b.nx.in token_c.nx.in tuck_a.nx.in tuck_b.nx.in tuck_c.nx.in + type_a.nx.in type_b.nx.in undef_a.nx.in undef_b.nx.in + undef_c.nx.in under_a.nx.in under_b.nx.in until_a.nx.in + until_b.nx.in until_c.nx.in until_d.nx.in up_a.nx.in up_b.nx.in + where_a.nx.in where_b.nx.in while_a.nx.in while_b.nx.in + while_c.nx.in while_d.nx.in xcheck_a.nx.in xcheck_b.nx.in + xor_a.nx.in xor_b.nx.in xor_c.nx.in xor_d.nx.in xor_e.nx.in + xor_f.nx.in + + ; + +ONYX_OTESTS = [addprefix @srcroot@/bin/onyx/test/ [ONYX_OTESTS]]; + +/* + * Back end scripts driven by Onyx tests. + */ +ONYX_BTESTS = [addprefix @srcroot@/bin/onyx/test/ +#if @enable_posix@ + b_argv_b.nx.in +#endif + ]; + +/* LaTeX source files. */ +ONYX_TEX_SRCS += @objroot@/bin/onyx/doc/latex/manual.tex; + +/* Binaries. */ +ONYX = @objroot@/bin/onyx/bin/onyx; +BONYX = @objroot@/bin/onyx/bin/bonyx; +TONYX = @objroot@/bin/onyx/bin/tonyx; + +[TONYX] : [ONYX]; + +/* + * User cook'ables. + */ + +tonyx : [TONYX]; +bonyx : [BONYX]; +onyx : [ONYX]; + +onyx_bins_bootstrap : [BONYX] +{ + loop local f = [fromto @srcroot@/bin/onyx/src/%.nx.in % [ONYX_NSRCS]] + { + cat @objroot@/bin/onyx/src/[f].nx + | [BONYX] @srcroot@/bin/onyx/src/[f]_gen.nx + > @srcroot@/bin/onyx/src/[f]_bootstrap.c; + } +} + +onyx_bins_tests : [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx + [ONYX_OTESTS] [ONYX_BTESTS]]; + +onyx_bins_check : onyx_bins_tests [TONYX] +{ +#if [count [ONYX_OTESTS]] + @VERIFY@ -s @srcroot@ -o @objroot@ + [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx [ONYX_OTESTS]]; +#endif +} + +onyx_bins_check_update : onyx_bins_tests [TONYX] +{ +#if [count [ONYX_OTESTS]] + @VERIFY@ -u -s @srcroot@ -o @objroot@ + [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx [ONYX_OTESTS]]; +#endif +} + +onyx_bins_install : [ONYX] mods_install +#if @enable_libonyx@ + libonyx_libs_install_s +#endif +{ + @INSTALL@ -d [BINDIR]; + + [TCC] [A_CFLAGS] -o [BINDIR]/onyx-@onyx_version@ + [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [ONYX_COMMON_SRCS]] + [fromto %0%.c %0%.o_a [ONYX_ONLY_SRCS]] +#if @enable_libonyx@ +#if [count @RPATH@] + @RPATH@[LIBDIR] +#endif +#endif + [LDFLAGS] -lonyx @LIBS@; + chmod 0755 [BINDIR]/onyx-@onyx_version@; + rm -f [BINDIR]/onyx; + ln -s onyx-@onyx_version@ [BINDIR]/onyx; + + @INSTALL@ -d [MANDIR]/man1; + @INSTALL@ -m 0444 @objroot@/bin/onyx/man/man1/onyx.1 [MANDIR]/man1; + + @INSTALL@ -d [DATADIR]; + rm -f [DATADIR]/onyx; + ln -s onyx-@onyx_version@ [DATADIR]/onyx; +} + +onyx_bins_uninstall : +{ + rm -f [BINDIR]/onyx-@onyx_version@; + rm -f [BINDIR]/onyx; + rm -f [MANDIR]/man1/onyx.1; + rm -f [DATADIR]/onyx; +} + +onyx_bins_clean : +{ + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_a + [ONYX_COMMON_SRCS] [BONYX_ONLY_SRCS] [TONYX_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_a + [ONYX_COMMON_SRCS] [BONYX_ONLY_SRCS] [TONYX_SRCS]]; + + rm -f [fromto @objroot@/%0%.c @objroot@/%0%.d_a [ONYX_ONLY_SRCS]]; + rm -f [fromto @objroot@/%0%.c @objroot@/%0%.o_a [ONYX_ONLY_SRCS]]; + + rm -f [ONYX_ONLY_SRCS]; + +#if [count [ONYX_OTESTS]] + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx.out [ONYX_OTESTS]]; + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx.diff [ONYX_OTESTS]]; + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx [ONYX_OTESTS]]; +#endif + +#if [count [ONYX_BTESTS]] + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx [ONYX_BTESTS]]; +#endif + + rm -f [ONYX] [BONYX] [TONYX]; +} + +onyx_bins_distclean : +{ + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx.perf [ONYX_OTESTS]]; + + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx ONYX_NSRCS]; +} + +/* + * Dependencies. + */ + +[TONYX] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [TONYX_SRCS]] +#if @enable_modprompt@ + modprompt +#endif + set mkdir +{ + [TCC] [A_CFLAGS] -o [target] + [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [TONYX_SRCS]]; +} + +[BONYX] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [ONYX_COMMON_SRCS]] + [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [BONYX_ONLY_SRCS]] + [LIBBONYX_A] + set mkdir +{ + [TCC] [A_CFLAGS] -o [target] [need] [LDFLAGS] @LIBS@; +} + +[ONYX] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [ONYX_COMMON_SRCS]] + [fromto @objroot@/%0%.c @objroot@/%0%.o_a [ONYX_ONLY_SRCS]] + libonyx_libs_s + set mkdir +{ + [TCC] [A_CFLAGS] -o [target] + [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [ONYX_COMMON_SRCS]] + [fromto @objroot@/%0%.c @objroot@/%0%.o_a [ONYX_ONLY_SRCS]] +#if [count @RPATH@] + @RPATH@@abs_objroot@/lib/libonyx/lib +#endif + [LDFLAGS] -lonyx @LIBS@; +} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/doc/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/.cvsignore new file mode 100644 index 000000000..d4f9179c4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/.cvsignore @@ -0,0 +1 @@ +manual.tex diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/manual.tex.in b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/manual.tex.in new file mode 100644 index 000000000..f539f50d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/doc/latex/manual.tex.in @@ -0,0 +1,77 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% Onyx portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\clearemptydoublepage +\chapter{The onyx program} +\label{onyxprog} + +\binname{onyx} is a stand-alone Onyx interpreter, with an integrated command +line editor. The Onyx language is documented in a separate +\htmlref{chapter}{onyxlang}, so this chapter documents only the differences from +the main Onyx language documentation. + +\section{Usage} +\binname{onyx} -h + +\binname{onyx} -V + +\binname{onyx} -e {\lt}expr{\gt} + +\binname{onyx} {\lt}file{\gt} [{\lt}args{\gt}] + +\subsection{Options} +\begin{description} +\item[-e {\lt}expr{\gt}: ] Execute {\lt}expr{\gt} as Onyx code. +\item[-h: ] Display usage information and exit. +\item[-V: ] Display the version number and exit. +\end{description} + +\section{Environment variables} +\begin{description} +\item[ONYX\_EDITOR: ] By default, the command line editor uses emacs key +bindings. Use this variable to explicitly set the key bindings to either +``emacs'' or ``vi''. +\end{description} + +\section{Language differences} +\label{sec:onyx_lang_diffs} +If \binname{onyx} is being run interactively: +\begin{itemize} +\label{onyx_interactive:stop} +\index{stop@\onyxop{}{stop}{}} +\item{The name ``stop'' is redefined in the initial thread's errordict to +recursively execute the stdin file in a stopped context in order to keep the +interpreter from exiting on error. It is possible (though generally unlikely, +since the user must type a very long line of code) for buffering of stdin to +cause strange things to occur; any additional program execution after an error +is a result of this.} +\label{onyx_interactive:resume} +\index{resume@\onyxop{}{resume}{}} +\item{The name ``resume'' is defined in the initial thread's threaddict as an +alias to the stop operator. Thus, when an error occurs, when the user is ready +to continue running after addressing any issues the error caused, resume can be +called as a more intuitive name for resuming.} +\label{onyx_interactive:promptstring} +\index{promptstring@\onyxop{}{promptstring}{}} +\item{The name ``promptstring'' is defined in systemdict; it takes no arguments +and returns a string. The return string is used as the interactive prompt.} +\end{itemize} + +If \binname{onyx} is being run non-interactively: +\begin{itemize} +\label{onyx_batch:stop} +\index{stop@\onyxop{}{stop}{}} +\item{The name ``stop'' in errordict is redefined to call the die operator +with an argument of 1.} +\end{itemize} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/include/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx/include/.cvsignore new file mode 100644 index 000000000..6fafb0efd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/include/.cvsignore @@ -0,0 +1,2 @@ +onyx_defs.h +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/include/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/include/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/include/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/include/onyx.h b/tags/ONYX_4_3_1/devroot/bin/onyx/include/onyx.h new file mode 100644 index 000000000..c5f973e89 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/include/onyx.h @@ -0,0 +1,14 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "onyx_defs.h" + +#include diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/include/onyx_defs.h.in b/tags/ONYX_4_3_1/devroot/bin/onyx/include/onyx_defs.h.in new file mode 100644 index 000000000..ec38d687e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/include/onyx_defs.h.in @@ -0,0 +1,17 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#undef CW_USE_MODPROMPT + +/* Used for tonyx. */ +#undef CW_TONYX_ONYX +#undef CW_TONYX_RPATH +#undef CW_TONYX_MPATH diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/man/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/man/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/man/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/.cvsignore new file mode 100644 index 000000000..fae2359cd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/.cvsignore @@ -0,0 +1 @@ +onyx.1 diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/onyx.1.in b/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/onyx.1.in new file mode 100644 index 000000000..4990ccd1b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/man/man1/onyx.1.in @@ -0,0 +1,53 @@ +.ig \" -*-mode:nroff-*- + + + + +Version: Onyx +.. +.TH onyx 1 "onyx, version Onyx " +.hy 1 +.SH NAME +onyx - stand-alone Onyx language interpreter +.SH SYNOPSIS +.B onyx \-h +.br +.B onyx \-V +.br +.B onyx \-e +.I +.br +.B onyx +.I +.RI [ ] +.SH DESCRIPTION +The +.B onyx +program is a stand-alone Onyx language interpreter, with an integrated command +line editor. +This manual page only documents the command line usage for +.BR onyx ; +much more extensive documentation is available in HTML, PostScript, and PDF +formats. See the FILES section below. +.SS Command line flags: +.IP \-e +.I +.RS +Execute +.I +as Onyx code. +.RE +.PP +.IP \-h +Display usage information and exit. +.PP +.IP \-V +Display the version number and exit. +.SH FILES +@prefix@/share/onyx/doc/html/onyx.html +.br +@prefix@/share/onyx/doc/ps/onyx.ps +.br +@prefix@/share/onyx/doc/pdf/onyx.pdf +.SH HISTORY +Written by Jason Evans . diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx/src/.cvsignore new file mode 100644 index 000000000..84f302d74 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/.cvsignore @@ -0,0 +1,6 @@ +*.[do]_[a] +Cookfile.list +batch.nx +interactive.nx +batch_nxcode.c +interactive_nxcode.c diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/src/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch.nx.in new file mode 100644 index 000000000..3fe39a394 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch.nx.in @@ -0,0 +1,45 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# This file is processed by batch_gen.nx to produce a more compact embedded +# version in batch_nxcode.c (normal build) and batch_bootstrap.c (development +# bootstrap). In order to make changes to this file take effect in the +# bootstrap interpreter, either type: +# +# cook bootstrap +# +# or +# +# cat batch.nx | onyx batch_gen.nx > batch_boostrap.c +# +# The end result of executing this file is a procedure (executable array). In +# order to support output that differs according to configuration options, a +# string is constructed, then evaluated. +# +# The output of running sprints on the procedure must be evaluatable, which +# means that certain language features such as immediate evaluation must be +# avoided. +# +################################################################################ + +# Initial string with an opening brace to defer execution, to which other +# strings are catenated. +`{' + +` +# Die with an exit code of 1 on error. +errordict begin + $stop { + 1 die + } def +end +' cat + +# Final closing brace. +`}' cat cvx eval diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch_bootstrap.c b/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch_bootstrap.c new file mode 100644 index 000000000..354887452 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch_bootstrap.c @@ -0,0 +1,20 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "onyx.h" + +void +batch_nxcode(cw_nxo_t *a_thread) +{ + cw_onyx_code(a_thread, "{errordict begin $stop {1 die} def end}bind eval"); +} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch_gen.nx b/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch_gen.nx new file mode 100644 index 000000000..957fbf528 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/batch_gen.nx @@ -0,0 +1,47 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# Read onyx code from stdin and output a compacted version to stdout. +# +# This program is run by the 'bootstrap' build system target. +# +################################################################################ + +# Output the header. +`/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "onyx.h" + +void +batch_nxcode(cw_nxo_t *a_thread) +{ + cw_onyx_code(a_thread, "' print + +# Read in the code. +stdin cvx eval + +# Output the procedure, using a recursion depth large enough to meet or exceed +# the depth of nested braces in the code. +1000 sprints print + +# Output the footer. +`bind eval"); +} +' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive.nx.in new file mode 100644 index 000000000..7f893c5eb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive.nx.in @@ -0,0 +1,74 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# This file is processed by interactive_gen.nx to produce a more compact +# embedded version in interactive_nxcode.c (normal build) and +# interactive_bootstrap.c (development bootstrap). In order to make changes to +# this file take effect in the bootstrap interpreter, either type: +# +# cook bootstrap +# +# or +# +# cat interactive.nx | onyx interactive_gen.nx > interactive_boostrap.c +# +# The end result of executing this file is a procedure (executable array). In +# order to support output that differs according to configuration options, a +# string is constructed, then evaluated. +# +# The output of running sprints on the procedure must be evaluatable, which +# means that certain language features such as immediate evaluation must be +# avoided. +# +################################################################################ + + +# Initial string with an opening brace to defer execution, to which other +# strings are catenated. +`{' + +` +# Define promptstring in systemdict. +systemdict begin +# - promptstring #string +$promptstring { + count cvs `onyx:' exch cat `> ' cat +} bind def +end + +# Define resume in threaddict to continue after an error. +threaddict begin +$resume $stop load def +end + +# Do not stop on error. Instead, recursively evaluate stdin. File bufferring +# can cause strange behavior, but at least the error will get handled first. +errordict begin + $stop { + stdin cvx stopped pop + } bind def +end + +# Print the product and version info. +product print `, version ' print version print `.\n' print flush +' cat +@enable_modprompt@ 1 eq { + ` + `modprompt/modprompt.nx' require + ' cat +} if +` +# Push an executable stdin on ostack to prepare for the start operator. This +# must be done after loading modprompt, so that if stdin was replaced, we will +# get the new version. +stdin cvx +' cat + +# Final closing brace. +`}' cat cvx eval diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive_bootstrap.c b/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive_bootstrap.c new file mode 100644 index 000000000..428cbdda4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive_bootstrap.c @@ -0,0 +1,20 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "onyx.h" + +void +interactive_nxcode(cw_nxo_t *a_thread) +{ + cw_onyx_code(a_thread, "{systemdict begin $promptstring {count cvs `onyx:' exch cat `> ' cat} bind def end threaddict begin $resume $stop load def end errordict begin $stop {stdin cvx stopped pop} bind def end product print `, version ' print version print `.\n' print flush `modprompt/modprompt.nx' require stdin cvx}bind eval"); +} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive_gen.nx b/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive_gen.nx new file mode 100644 index 000000000..de57329c1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/interactive_gen.nx @@ -0,0 +1,47 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# Read onyx code from stdin and output a compacted version to stdout. +# +# This program is run by the 'bootstrap' build system target. +# +################################################################################ + +# Output the header. +`/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "onyx.h" + +void +interactive_nxcode(cw_nxo_t *a_thread) +{ + cw_onyx_code(a_thread, "' print + +# Read in the code. +stdin cvx eval + +# Output the procedure, using a recursion depth large enough to meet or exceed +# the depth of nested braces in the code. +1000 sprints print + +# Output the footer. +`bind eval"); +} +' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/onyx.c b/tags/ONYX_4_3_1/devroot/bin/onyx/src/onyx.c new file mode 100644 index 000000000..164b8c717 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/onyx.c @@ -0,0 +1,542 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "../include/onyx.h" + +/* Prototypes for generated code. */ +void +batch_nxcode(cw_nxo_t *a_thread); +void +interactive_nxcode(cw_nxo_t *a_thread); + +#define CW_PROMPT_STRLEN 80 +#define CW_BUFFER_SIZE 512 + +#if (!defined(CW_POSIX_FILE) || !defined(CW_USE_MODPROMPT)) +struct nx_read_arg_s +{ + int fd; + cw_nxo_t *thread; + cw_bool_t interactive; + cw_uint8_t *buffer; + cw_uint32_t buffer_size; + cw_uint32_t buffer_count; +}; + +struct nx_write_arg_s +{ + int fd; +}; +#endif + +/* Globals. These are global due to the libedit API not providing a way to pass + * them to the prompt function. */ +cw_nxo_t thread; +cw_nxo_threadp_t threadp; +#ifdef CW_USE_LIBEDIT +EditLine *el; +History *hist; +cw_uint8_t prompt_str[CW_PROMPT_STRLEN]; +#endif + +/* Function prototypes. */ +void +usage(void); + +int +interactive_run(int argc, char **argv, char **envp); + +int +batch_run(int argc, char **argv, char **envp); + +#if (!defined(CW_POSIX_FILE) || !defined(CW_USE_MODPROMPT)) +void +stdin_init(cw_nx_t *a_nx, cw_bool_t a_interactive); + +cw_sint32_t +nx_read(void *a_arg, cw_nxo_t *a_file, cw_uint32_t a_len, cw_uint8_t *r_str); + +void +nx_read_shutdown(void *a_arg, cw_nx_t *a_nx); +#endif + +#ifndef CW_POSIX_FILE +void +stdout_init(cw_nx_t *a_nx); + +void +stderr_init(cw_nx_t *a_nx); + +cw_bool_t +nx_write(void *a_arg, cw_nxo_t *a_file, const cw_uint8_t *a_str, + cw_uint32_t a_len); +#endif + +int +main(int argc, char **argv, char **envp) +{ + int retval; + + libonyx_init(); + + /* Run differently, depending on whether this is an interactive session. */ + if (isatty(0) && argc == 1) + { + retval = interactive_run(argc, argv, envp); + } + else + { + retval = batch_run(argc, argv, envp); + } + + libonyx_shutdown(); + return retval; +} + +void +usage(void) +{ + printf("onyx usage:\n" + " onyx\n" + " onyx -h\n" + " onyx -V\n" + " onyx -e \n" + " onyx []\n" + "\n" + " Option | Description\n" + " ----------+------------------------------------\n" + " -h | Print usage and exit.\n" + " -V | Print version information and exit.\n" + " -e | Execute as Onyx code.\n"); +} + +int +interactive_run(int argc, char **argv, char **envp) +{ + cw_nx_t nx; + + /* Initialize the interpreter. */ + nx_new(&nx, NULL, argc, argv, envp); + + /* Make sure that stdin is always synthetic, so that the prompt will be + * printed. */ +#ifndef CW_USE_MODPROMPT + stdin_init(&nx, TRUE); +#endif +#ifndef CW_POSIX_FILE + stdout_init(&nx); + stderr_init(&nx); +#endif + + /* Now that the files have been wrapped, create the initial thread. */ + nxo_thread_new(&thread, &nx); + + /* Run embedded initialization code specific to interactive execution. */ + interactive_nxcode(&thread); + + /* Run the interpreter such that it will not exit on errors. */ + nxo_thread_start(&thread); + + nx_delete(&nx); + return 0; +} + +int +batch_run(int argc, char **argv, char **envp) +{ + int retval; + cw_nxo_t *file; + int c; + cw_bool_t opt_version = FALSE; + cw_uint8_t *opt_expression = NULL; + cw_nx_t nx; + + /* Parse command line arguments, but postpone taking any actions that + * require the onyx interpreter to be up and running. This is necessary + * because we need to know how much of argv to pass to nx_new(). */ + c = getopt(argc, argv, +#ifdef _GNU_SOURCE + /* Without this, glibc will permute unknown options to the end of + * the argument list. */ + "+" +#endif + "hVe:"); + switch (c) + { + case 'h': + { + usage(); + retval = 0; + goto CLERROR; + } + case 'V': + { + opt_version = TRUE; + break; + } + case 'e': + { + if (argc != 3) + { + fprintf(stderr, "onyx: Incorrect number of arguments\n"); + usage(); + retval = 1; + goto CLERROR; + } + + opt_expression = optarg; + break; + } + case -1: + { + break; + } + default: + { + fprintf(stderr, "onyx: Unrecognized option\n"); + usage(); + retval = 1; + goto CLERROR; + } + } + + /* Do additional command line argument error checking. */ + if ((optind < argc && (opt_expression != NULL || opt_version)) + || (opt_version && opt_expression != NULL)) + { + fprintf(stderr, "onyx: Incorrect number of arguments\n"); + usage(); + retval = 1; + goto CLERROR; + } + + /* Since this is a non-interactive invocation, don't include all elements of + * argv. */ + nx_new(&nx, NULL, argc - optind, &argv[optind], envp); +#ifndef CW_POSIX_FILE + stdin_init(&nx, FALSE); + stdout_init(&nx); + stderr_init(&nx); +#endif + nxo_thread_new(&thread, &nx); + nxo_threadp_new(&threadp); + + /* Run embedded initialization code specific to non-interactive + * execution. */ + batch_nxcode(&thread); + + /* Act on the command line arguments, now that the interpreter is + * initialized. */ + if (opt_version) + { + static const cw_uint8_t version[] + = "product print `, version ' print version print" + " `.\n' print flush"; + + /* Print the version and exit. */ + nxo_thread_interpret(&thread, &threadp, version, sizeof(version) - 1); + nxo_thread_flush(&thread, &threadp); + retval = 0; + goto RETURN; + } + else if (opt_expression != NULL) + { + cw_nxo_t *string; + cw_uint8_t *str; + + /* Push the string onto the execution stack. */ + string = nxo_stack_push(nxo_thread_ostack_get(&thread)); + nxo_string_new(string, &nx, FALSE, strlen((char *) opt_expression)); + nxo_attr_set(string, NXOA_EXECUTABLE); + str = nxo_string_get(string); + memcpy(str, opt_expression, nxo_string_len_get(string)); + } + else if (optind < argc) +#ifdef CW_POSIX_FILE + { + int src_fd; + + /* Remaining command line arguments should be the name of a source file, + * followed by optional arguments. Open the source file, wrap it in an + * onyx file object, and push it onto the execution stack. */ + src_fd = open(argv[optind], O_RDONLY); + if (src_fd == -1) + { + fprintf(stderr, + "onyx: Error in open(\"%s\", O_RDONLY): %s\n", argv[optind], + strerror(errno)); + retval = 1; + goto RETURN; + } + file = nxo_stack_push(nxo_thread_ostack_get(&thread)); + nxo_file_new(file, &nx, FALSE); + nxo_attr_set(file, NXOA_EXECUTABLE); + + nxo_file_fd_wrap(file, src_fd); + } +#else + { + int src_fd; + static struct nx_read_arg_s src_arg; + + /* Remaining command line arguments should be the name of a source file, + * followed by optional arguments. Open the source file, wrap it in an + * onyx file object, and push it onto the execution stack. */ + src_fd = open(argv[optind], O_RDONLY); + if (src_fd == -1) + { + fprintf(stderr, + "onyx: Error in open(\"%s\", O_RDONLY): %s\n", argv[optind], + strerror(errno)); + retval = 1; + goto RETURN; + } + file = nxo_stack_push(nxo_thread_ostack_get(&thread)); + nxo_file_new(file, &nx, FALSE); + nxo_attr_set(file, NXOA_EXECUTABLE); + + /* Initialize the src argument structure. */ + src_arg.fd = src_fd; + src_arg.thread = &thread; + src_arg.buffer = NULL; + src_arg.buffer_size = 0; + src_arg.buffer_count = 0; + + nxo_file_synthetic(file, nx_read, NULL, NULL, nx_read_shutdown, + (void *) &src_arg); + } +#endif + else + { + /* No source file specified (or not supported), and there there was no + * -e expression specified either, so treat stdin as the source. */ + file = nxo_stack_push(nxo_thread_ostack_get(&thread)); + nxo_dup(file, nx_stdin_get(&nx)); + nxo_attr_set(file, NXOA_EXECUTABLE); + } + + /* Run the interpreter non-interactively. */ + nxo_thread_start(&thread); + + retval = 0; + RETURN: + nxo_threadp_delete(&threadp, &thread); + nx_delete(&nx); + CLERROR: + return retval; +} + +#if (!defined(CW_POSIX_FILE) || !defined(CW_USE_MODPROMPT)) +void +stdin_init(cw_nx_t *a_nx, cw_bool_t a_interactive) +{ + cw_nxo_t *nxo; + static struct nx_read_arg_s stdin_arg; + + /* Add a synthetic wrapper for stdin, since normal files can't be + * used. */ + stdin_arg.fd = 0; + stdin_arg.thread = &thread; + stdin_arg.interactive = a_interactive; + stdin_arg.buffer = NULL; + stdin_arg.buffer_size = 0; + stdin_arg.buffer_count = 0; + + nxo = nx_stdin_get(a_nx); + nxo_file_new(nxo, a_nx, TRUE); + nxo_file_synthetic(nxo, nx_read, NULL, NULL, nx_read_shutdown, + (void *) &stdin_arg); +} + +cw_sint32_t +nx_read(void *a_arg, cw_nxo_t *a_file, cw_uint32_t a_len, cw_uint8_t *r_str) +{ + cw_sint32_t retval; + struct nx_read_arg_s *arg = (struct nx_read_arg_s *) a_arg; + + cw_assert(a_len > 0); + + if (arg->buffer_count == 0) + { + /* Print the prompt if interactive and not in deferred execution mode. + * + * This code assumes that only the initial thread reads from stdin. Bad + * things (likely crashes) will happen if that assumption is broken. + * There isn' really a simple way to solve this, and it probably + * isn't worthwhile, considering that it's a degenerate case of a + * non-standard configuration. */ + if ((arg->interactive) + && (nxo_thread_deferred(arg->thread) == FALSE) + && (nxo_thread_state(arg->thread) == THREADTS_START)) + { + cw_onyx_code(arg->thread, "promptstring print flush"); + } + + /* Read data until there are no more. */ + while ((retval = read(arg->fd, r_str, a_len)) == -1 && errno == EINTR) + { + /* Interrupted system call, probably due to garbage collection. */ + } + if (retval == -1) + { + /* EOF. */ + retval = 0; + } + else + { + if (retval == a_len) + { + cw_sint32_t count; + + /* There may be more data available. Store any available data + * in a buffer. */ + if (arg->buffer == NULL) + { + /* Initialize the buffer. */ + arg->buffer = (cw_uint8_t *) cw_malloc(CW_BUFFER_SIZE); + arg->buffer_size = CW_BUFFER_SIZE; + arg->buffer_count = 0; + } + + for (;;) + { + while ((count + = read(arg->fd, &arg->buffer[arg->buffer_count], + arg->buffer_size - arg->buffer_count)) + == -1 + && errno == EINTR) + { + /* Interrupted system call, probably due to garbage + * collection. */ + } + if (count <= 0) + { + /* EOF or no more data buffered by stdin. */ + break; + } + + arg->buffer_count += count; + if (arg->buffer_count == arg->buffer_size) + { + /* Expand the buffer. */ + arg->buffer + = (cw_uint8_t *) cw_realloc(arg->buffer, + arg->buffer_size * 2); + arg->buffer_size *= 2; + } + } + } + } + } + else + { + /* Return as much of the buffered data as possible. */ + if (arg->buffer_count > a_len) + { + /* There are more data than we can return. */ + retval = a_len; + memcpy(r_str, arg->buffer, a_len); + arg->buffer_count -= a_len; + memmove(arg->buffer, &arg->buffer[a_len], arg->buffer_count); + } + else + { + /* Return all the data. */ + retval = arg->buffer_count; + memcpy(r_str, arg->buffer, arg->buffer_count); + arg->buffer_count = 0; + } + } + + return retval; +} + +void +nx_read_shutdown(void *a_arg, cw_nx_t *a_nx) +{ + struct nx_read_arg_s *arg = (struct nx_read_arg_s *) a_arg; + + if (arg->buffer != NULL) + { + cw_free(arg->buffer); + } +} +#endif + +#ifndef CW_POSIX_FILE +void +stdout_init(cw_nx_t *a_nx) +{ + cw_nxo_t *nxo; + static struct nx_write_arg_s stdout_arg; + + /* Initialize the stdout argument structure. */ + stdout_arg.fd = 1; + + nxo = nx_stdout_get(a_nx); + nxo_file_new(nxo, a_nx, TRUE); + nxo_file_synthetic(nxo, NULL, nx_write, NULL, NULL, (void *) &stdout_arg); +} + +void +stderr_init(cw_nx_t *a_nx) +{ + cw_nxo_t *nxo; + static struct nx_write_arg_s stderr_arg; + + /* Initialize the stderr argument structure. */ + stderr_arg.fd = 2; + + nxo = nx_stderr_get(a_nx); + nxo_file_new(nxo, a_nx, TRUE); + nxo_file_synthetic(nxo, NULL, nx_write, NULL, NULL, (void *) &stderr_arg); +} + +cw_bool_t +nx_write(void *a_arg, cw_nxo_t *a_file, const cw_uint8_t *a_str, + cw_uint32_t a_len) +{ + cw_bool_t retval; + struct nx_write_arg_s *arg = (struct nx_write_arg_s *) a_arg; + ssize_t nwritten, cwritten; + + for (nwritten = 0; + nwritten < a_len; + ) + { + cwritten = write(arg->fd, &a_str[nwritten], a_len - nwritten); + if (cwritten == -1) + { + if (errno != EINTR) + { + retval = TRUE; + goto RETURN; + } + } + else + { + nwritten += cwritten; + } + } + + retval = FALSE; + RETURN: + return retval; +} +#endif diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/src/tonyx.c b/tags/ONYX_4_3_1/devroot/bin/onyx/src/tonyx.c new file mode 100644 index 000000000..70f9bc11a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/src/tonyx.c @@ -0,0 +1,55 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Wrapper program that sets ONYX_MPATH and ONYX_RPATH appropriately for running + * onyx in the source tree. This must be a binary executable rather than a + * shell script due to how nested #! magic is (not) handled by the OS. + * + ******************************************************************************/ + +#include +#include + +#include "../include/onyx_defs.h" + +int +main(int argc, char **argv) +{ + char **arg; + int i; + + if (putenv(CW_TONYX_RPATH) == -1) + { + goto RETURN; + } + if (putenv(CW_TONYX_MPATH) == -1) + { + goto RETURN; + } + + arg = (char **)malloc((argc + 1) * sizeof(char *)); + if (arg == NULL) + { + goto RETURN; + } + + arg[0] = CW_TONYX_ONYX; + for (i = 1; i < argc; i++) + { + arg[i] = argv[i]; + } + arg[i] = NULL; + + execv(CW_TONYX_ONYX, arg); + /* Not reached. */ + + RETURN: + return 1; +} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx/test/.cvsignore new file mode 100644 index 000000000..39505043a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/.cvsignore @@ -0,0 +1,5 @@ +*.out +*.diff +*.perf +*.nx +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx/test/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_a.nx.exp new file mode 100644 index 000000000..27f2c7205 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +`0 abs' +0 +`5 abs' +5 +`-5 abs' +5 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_a.nx.in new file mode 100644 index 000000000..bfd1d60a3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 abs' + `5 abs' + `-5 abs' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_b.nx.exp new file mode 100644 index 000000000..e192c3dbf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --abs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_b.nx.in new file mode 100644 index 000000000..a38571af6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +abs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_c.nx.exp new file mode 100644 index 000000000..bbb253db8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --abs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_c.nx.in new file mode 100644 index 000000000..17d5ff19c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark abs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_d.nx.exp new file mode 100644 index 000000000..4c92c97ae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +`0.0 abs' +0.000000e+00 +`5.0 abs' +5.000000e+00 +`-5.0 abs' +5.000000e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_d.nx.in new file mode 100644 index 000000000..97635e874 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/abs_d.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0.0 abs' + `5.0 abs' + `-5.0 abs' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_a.nx.exp new file mode 100644 index 000000000..6a14f754c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_a.nx.exp @@ -0,0 +1,12 @@ +Test begin +`0 0 add' +0 +`0 -1 add' +-1 +`-1 0 add' +-1 +`1 1 add' +2 +`-1 -1 add' +-2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_a.nx.in new file mode 100644 index 000000000..e5145bf61 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 add' + `0 -1 add' + `-1 0 add' + `1 1 add' + `-1 -1 add' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_b.nx.exp new file mode 100644 index 000000000..f7093b115 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --add-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_b.nx.in new file mode 100644 index 000000000..b9c18d3bf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 add + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_c.nx.exp new file mode 100644 index 000000000..9c5406278 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --add-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_c.nx.in new file mode 100644 index 000000000..9efcdb3f0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark add + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_d.nx.exp new file mode 100644 index 000000000..13d8c6443 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --add-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_d.nx.in new file mode 100644 index 000000000..99fcf1bf0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 add + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_e.nx.exp new file mode 100644 index 000000000..20a2f1091 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_e.nx.exp @@ -0,0 +1,32 @@ +Test begin +`0.0 0 add' +0.000000e+00 +`0.0 -1 add' +-1.000000e+00 +`-1.0 0 add' +-1.000000e+00 +`1.0 1 add' +2.000000e+00 +`-1.0 -1 add' +-2.000000e+00 +`0 0.0 add' +0.000000e+00 +`0 -1.0 add' +-1.000000e+00 +`-1 0.0 add' +-1.000000e+00 +`1 1.0 add' +2.000000e+00 +`-1 -1.0 add' +-2.000000e+00 +`0.0 0.0 add' +0.000000e+00 +`0.0 -1.0 add' +-1.000000e+00 +`-1.0 0.0 add' +-1.000000e+00 +`1.0 1.0 add' +2.000000e+00 +`-1.0 -1.0 add' +-2.000000e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_e.nx.in new file mode 100644 index 000000000..13ca31282 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/add_e.nx.in @@ -0,0 +1,40 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0.0 0 add' + `0.0 -1 add' + `-1.0 0 add' + `1.0 1 add' + `-1.0 -1 add' + + `0 0.0 add' + `0 -1.0 add' + `-1 0.0 add' + `1 1.0 add' + `-1 -1.0 add' + + `0.0 0.0 add' + `0.0 -1.0 add' + `-1.0 0.0 add' + `1.0 1.0 add' + `-1.0 -1.0 add' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_a.nx.exp new file mode 100644 index 000000000..c0b7bb159 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_a.nx.exp @@ -0,0 +1,11 @@ +Test begin +`0 adn' +0 +`0 1 adn' +0 +1 +`0 1 mark adn' +0 +-mark- +1 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_a.nx.in new file mode 100644 index 000000000..38d20490f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_a.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 adn' + `0 1 adn' + `0 1 mark adn' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_b.nx.exp new file mode 100644 index 000000000..8ad729e4e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --adn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_b.nx.in new file mode 100644 index 000000000..22da4b1da --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/adn_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +adn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_a.nx.exp new file mode 100644 index 000000000..e943bbae8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_a.nx.exp @@ -0,0 +1,22 @@ +Test begin +`false false' +false +`true true' +true +`false true' +false +`true false' +false +`0 0' +0 +`16@7fffffffffffffff 16@7fffffffffffffff' +9223372036854775807 +`16@0 16@7fffffffffffffff' +0 +`16@7fffffffffffffff 16@0' +0 +`2@0101010101010101010101010101010101010101010101010101010101010101\n\t2@0101010101010101010101010101010101010101010101010101010101010101' +6148914691236517205 +`2@0101010101010101010101010101010101010101010101010101010101010101\n\t2@0010101010101010101010101010101010101010101010101010101010101010' +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_a.nx.in new file mode 100644 index 000000000..f0ba3a2ff --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `false false' + `true true' + `false true' + `true false' + + `0 0' + `16@7fffffffffffffff 16@7fffffffffffffff' + `16@0 16@7fffffffffffffff' + `16@7fffffffffffffff 16@0' + + `2@0101010101010101010101010101010101010101010101010101010101010101 + 2@0101010101010101010101010101010101010101010101010101010101010101' + + `2@0101010101010101010101010101010101010101010101010101010101010101 + 2@0010101010101010101010101010101010101010101010101010101010101010' +]{ + dup 1 sprint + cvx eval + and + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_b.nx.exp new file mode 100644 index 000000000..cd0ad9a24 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --and-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_b.nx.in new file mode 100644 index 000000000..e1e779a9a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 and + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_c.nx.exp new file mode 100644 index 000000000..06655ac76 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --and-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_c.nx.in new file mode 100644 index 000000000..72b5a2cad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 and + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_d.nx.exp new file mode 100644 index 000000000..cb82edfb1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --and-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_d.nx.in new file mode 100644 index 000000000..a6371a453 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark and + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_e.nx.exp new file mode 100644 index 000000000..f492dc165 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 true) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --and-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_e.nx.in new file mode 100644 index 000000000..5f99d5e1a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 true and + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_f.nx.exp new file mode 100644 index 000000000..90406bee0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (true 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --and-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_f.nx.in new file mode 100644 index 000000000..a2fb21917 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/and_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true 1 and + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_a.nx.exp new file mode 100644 index 000000000..770108024 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +Number of arguments: 3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_a.nx.in new file mode 100644 index 000000000..d645df5cf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +# verify should always pass two arguments, which means argv should have 3 +# elements. +`Number of arguments: ' print +argv length 1 sprint + +# Make sure that both arguments are directories. +argv 1 2 getinterval { + dup `d' test { + # Yes, it's a directory. + pop + }{ + # No, it's not a directory. The test should fail. + `Not a directory: ' print 1 sprint + } ifelse +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_b.nx.exp new file mode 100644 index 000000000..cba08bf25 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_b.nx.exp @@ -0,0 +1,7 @@ +Test begin +b_argv_b.nx begin +`-e' +`1 2 3 pstack' +b_argv_b.nx end +Termination status: 0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_b.nx.in new file mode 100644 index 000000000..5ec0c5dd9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/argv_b.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + argv 2 get `/' cat `b_argv_b.nx' cat + `-e' + `1 2 3 pstack' +] system + +`Termination status: ' print 1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_a.nx.exp new file mode 100644 index 000000000..1d3a89871 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_a.nx.exp @@ -0,0 +1,74 @@ +Test begin +`-1 -1' +-2.356194e+00 +`0 -1' +3.141593e+00 +`1 -1' +2.356194e+00 +`1 0' +1.570796e+00 +`1 1' +7.853982e-01 +`0 0' +0.000000e+00 +`0 1' +0.000000e+00 +`-1 1' +-7.853982e-01 +`-1 0' +-1.570796e+00 +`-1.0 -1' +-2.356194e+00 +`0.0 -1' +3.141593e+00 +`1.0 -1' +2.356194e+00 +`1.0 0' +1.570796e+00 +`1.0 1' +7.853982e-01 +`0.0 0' +0.000000e+00 +`0.0 1' +0.000000e+00 +`-1.0 1' +-7.853982e-01 +`-1.0 0' +-1.570796e+00 +`-1 -1.0' +-2.356194e+00 +`0 -1.0' +3.141593e+00 +`1 -1.0' +2.356194e+00 +`1 0.0' +1.570796e+00 +`1 1.0' +7.853982e-01 +`0 0.0' +0.000000e+00 +`0 1.0' +0.000000e+00 +`-1 1.0' +-7.853982e-01 +`-1 0.0' +-1.570796e+00 +`-1.0 -1.0' +-2.356194e+00 +`0.0 -1.0' +3.141593e+00 +`1.0 -1.0' +2.356194e+00 +`1.0 0.0' +1.570796e+00 +`1.0 1.0' +7.853982e-01 +`0.0 0.0' +0.000000e+00 +`0.0 1.0' +0.000000e+00 +`-1.0 1.0' +-7.853982e-01 +`-1.0 0.0' +-1.570796e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_a.nx.in new file mode 100644 index 000000000..c33f69324 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_a.nx.in @@ -0,0 +1,62 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-1 -1' + `0 -1' + `1 -1' + `1 0' + `1 1' + `0 0' + `0 1' + `-1 1' + `-1 0' + + `-1.0 -1' + `0.0 -1' + `1.0 -1' + `1.0 0' + `1.0 1' + `0.0 0' + `0.0 1' + `-1.0 1' + `-1.0 0' + + `-1 -1.0' + `0 -1.0' + `1 -1.0' + `1 0.0' + `1 1.0' + `0 0.0' + `0 1.0' + `-1 1.0' + `-1 0.0' + + `-1.0 -1.0' + `0.0 -1.0' + `1.0 -1.0' + `1.0 0.0' + `1.0 1.0' + `0.0 0.0' + `0.0 1.0' + `-1.0 1.0' + `-1.0 0.0' +]{ + dup 1 sprint + cvx eval atan2 + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_b.nx.exp new file mode 100644 index 000000000..3fcbf1866 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (5) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --atan2-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_b.nx.in new file mode 100644 index 000000000..6fbd5a9d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +5 atan2 + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_c.nx.exp new file mode 100644 index 000000000..45a43649b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --atan2-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_c.nx.in new file mode 100644 index 000000000..f786423a7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark atan2 + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_d.nx.exp new file mode 100644 index 000000000..ad4d6b47f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --atan2-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_d.nx.in new file mode 100644 index 000000000..4344e03f9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/atan2_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 atan2 + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_a.nx.exp new file mode 100644 index 000000000..19e640a66 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_a.nx.exp @@ -0,0 +1,11 @@ +Test begin +`0 aup' +0 +`0 1 aup' +0 +1 +`0 1 mark aup' +1 +0 +-mark- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_a.nx.in new file mode 100644 index 000000000..c2353b3f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_a.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 aup' + `0 1 aup' + `0 1 mark aup' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_b.nx.exp new file mode 100644 index 000000000..62bdd31d6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --aup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_b.nx.in new file mode 100644 index 000000000..d540be322 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/aup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +aup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/b_argv_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/b_argv_b.nx.in new file mode 100644 index 000000000..86b0095c1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/b_argv_b.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# argv should be: [`@objroot@/bin/onyx/test/b_argv_b.nx' `-e' `1 2 3 pstack'] + +`b_argv_b.nx begin\n' print flush + +argv 0 get `f' test not { + `Not a file: ' print argv 0 get 1 sprint + 1 die +} if + +argv 1 2 getinterval { + 1 sprint +} foreach + +`b_argv_b.nx end\n' print +pstack \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_a.nx.exp new file mode 100644 index 000000000..fb666a61c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_a.nx.exp @@ -0,0 +1,14 @@ +Test begin +`0 bdup' +0 +0 +`0 1 bdup' +0 +1 +0 +`mark 0 1 bdup' +-mark- +1 +0 +-mark- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_a.nx.in new file mode 100644 index 000000000..9231581d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_a.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 bdup' + `0 1 bdup' + `mark 0 1 bdup' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_b.nx.exp new file mode 100644 index 000000000..180c380fd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --bdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_b.nx.in new file mode 100644 index 000000000..ee40e695d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bdup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +bdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_a.nx.exp new file mode 100644 index 000000000..47b438bf1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +`foo' +`FOO' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_a.nx.in new file mode 100644 index 000000000..728c4d0f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_a.nx.in @@ -0,0 +1,21 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<$foo `foo'> begin +foo 1 sprint + +<$foo `FOO'> begin +foo 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_b.nx.exp new file mode 100644 index 000000000..ea08bfa67 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --begin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_b.nx.in new file mode 100644 index 000000000..b74474ee4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +begin + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_c.nx.exp new file mode 100644 index 000000000..f550eb5a6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --begin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_c.nx.in new file mode 100644 index 000000000..5336cb7db --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/begin_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark begin + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bind_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bind_a.nx.exp new file mode 100644 index 000000000..214ba7e51 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bind_a.nx.exp @@ -0,0 +1,6 @@ +Test begin +{product pop countdstack true globaldict !userdict {product pop countdstack true globaldict !userdict}} +{`Canonware Onyx' --pop-- --countdstack-- true <> !userdict {`Canonware Onyx' --pop-- --countdstack-- true -dict- !userdict}} +[product pop countdstack true globaldict $userdict {product pop countdstack true globaldict !userdict}] +[`Canonware Onyx' --pop-- --countdstack-- true <> $userdict {`Canonware Onyx' --pop-- --countdstack-- true -dict- !userdict}] +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bind_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bind_a.nx.in new file mode 100644 index 000000000..481675dad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bind_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{ + product pop countdstack true globaldict !userdict + {product pop countdstack true globaldict !userdict} +} +dup 2 sprint +bind 2 sprint + +{ + product pop countdstack true globaldict !userdict + {product pop countdstack true globaldict !userdict} +} +dup dup 5 get cvlit 5 exch put +cvlit +dup 2 sprint +bind 2 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_a.nx.exp new file mode 100644 index 000000000..003781c79 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_a.nx.in new file mode 100644 index 000000000..c17fd5501 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_a.nx.in @@ -0,0 +1,21 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 2 +bpop +pstack +bpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_b.nx.exp new file mode 100644 index 000000000..a0730e3f9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --bpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_b.nx.in new file mode 100644 index 000000000..7f08a80a0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +bpop + +`Test end\n' print +pstack \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_a.nx.exp new file mode 100644 index 000000000..242e02240 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_a.nx.exp @@ -0,0 +1,11 @@ +Test begin +`0 bpush' +0 +`0 1 bpush' +0 +1 +`0 1 mark bpush' +1 +0 +-mark- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_a.nx.in new file mode 100644 index 000000000..489cf9c94 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_a.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 bpush' + `0 1 bpush' + `0 1 mark bpush' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_b.nx.exp new file mode 100644 index 000000000..8c8f55f11 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error /stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --bpush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_b.nx.in new file mode 100644 index 000000000..08b088947 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/bpush_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +bpush + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_a.nx.exp new file mode 100644 index 000000000..cc549a77a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_a.nx.exp @@ -0,0 +1,12 @@ +`ab' +(`a' `b') +[`a' `b'] +`a' +(`a') +[`a'] +`b' +(`b') +[`b'] +`' +() +[] diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_a.nx.in new file mode 100644 index 000000000..810ebc955 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_a.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +[] [] cat +() () cat +`' `' cat + +[] [`b'] cat +() (`b') cat +`' `b' cat + +[`a'] [] cat +(`a') () cat +`a' `' cat + +[`a'] [`b'] cat +(`a') (`b') cat +`a' `b' cat +pstack \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_b.nx.exp new file mode 100644 index 000000000..66cc44d85 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_b.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (-stack- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_b.nx.in new file mode 100644 index 000000000..0d06abbe3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(`a') [`b'] cat diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_c.nx.exp new file mode 100644 index 000000000..abef43780 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (-mark- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_c.nx.in new file mode 100644 index 000000000..176a9590f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +mark mark cat diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_d.nx.exp new file mode 100644 index 000000000..96a1bfc29 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_d.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (`a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_d.nx.in new file mode 100644 index 000000000..46de4815c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cat_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`a' cat diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_a.nx.exp new file mode 100644 index 000000000..ef44d9615 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_a.nx.exp @@ -0,0 +1,56 @@ +Test begin +`-1 ceiling' +-1 +`0 ceiling' +0 +`1 ceiling' +1 +`-1.0 ceiling' +-1 +`0.0 ceiling' +0 +`1.0 ceiling' +1 +`-2.9 ceiling' +-2 +`-2.6 ceiling' +-2 +`-2.5 ceiling' +-2 +`-2.4 ceiling' +-2 +`-2.1 ceiling' +-2 +`-1.9 ceiling' +-1 +`-1.6 ceiling' +-1 +`-1.5 ceiling' +-1 +`-1.4 ceiling' +-1 +`-1.1 ceiling' +-1 +`0.0 ceiling' +0 +`1.1 ceiling' +2 +`1.4 ceiling' +2 +`1.5 ceiling' +2 +`1.6 ceiling' +2 +`1.9 ceiling' +2 +`2.1 ceiling' +3 +`2.4 ceiling' +3 +`2.5 ceiling' +3 +`2.6 ceiling' +3 +`2.9 ceiling' +3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_a.nx.in new file mode 100644 index 000000000..990e707fc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_a.nx.in @@ -0,0 +1,56 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-1 ceiling' + `0 ceiling' + `1 ceiling' + + `-1.0 ceiling' + `0.0 ceiling' + `1.0 ceiling' + + `-2.9 ceiling' + `-2.6 ceiling' + `-2.5 ceiling' + `-2.4 ceiling' + `-2.1 ceiling' + + `-1.9 ceiling' + `-1.6 ceiling' + `-1.5 ceiling' + `-1.4 ceiling' + `-1.1 ceiling' + + `0.0 ceiling' + + `1.1 ceiling' + `1.4 ceiling' + `1.5 ceiling' + `1.6 ceiling' + `1.9 ceiling' + + `2.1 ceiling' + `2.4 ceiling' + `2.5 ceiling' + `2.6 ceiling' + `2.9 ceiling' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_b.nx.exp new file mode 100644 index 000000000..45c0a258e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ceiling-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_b.nx.in new file mode 100644 index 000000000..a3edad52e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ceiling + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_c.nx.exp new file mode 100644 index 000000000..dd40cacc3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ceiling-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_c.nx.in new file mode 100644 index 000000000..6f85a551c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ceiling_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark ceiling + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_a.nx.exp new file mode 100644 index 000000000..b8ceea4e7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --chroot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_a.nx.in new file mode 100644 index 000000000..dcc312507 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +chroot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_b.nx.exp new file mode 100644 index 000000000..8af92da63 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --chroot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_b.nx.in new file mode 100644 index 000000000..c5286c4f4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/chroot_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark chroot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/clear_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/clear_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/clear_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/clear_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/clear_a.nx.in new file mode 100644 index 000000000..a08bdde05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/clear_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +clear pstack +1 clear pstack +1 2 clear pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cleartomark_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cleartomark_a.nx.exp new file mode 100644 index 000000000..1d49e499f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cleartomark_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +`mark cleartomark' +`mark 0 cleartomark' +`1 mark cleartomark' +1 +`2 mark 0 cleartomark' +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cleartomark_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cleartomark_a.nx.in new file mode 100644 index 000000000..4789463e7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cleartomark_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `mark cleartomark' + `mark 0 cleartomark' + `1 mark cleartomark' + `2 mark 0 cleartomark' +]{ + dup 1 sprint cvx eval pstack clear +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_a.nx.exp new file mode 100644 index 000000000..b0c5523b3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_a.nx.exp @@ -0,0 +1,22 @@ +[null null null null null null null null null null] +[1 2 3 4 5 6 7 8 9 10] +[1 2 3 4 5 6 7 8 9 10] +--- +[1 2 3 4 5 6 7 8 9 10] +[1 2 3 4 5 6 7 8 9 10] +--- +[1 2 3 4 5 6 7 8 9 10] dup 3 5 getinterval exch +vvvv +[1 2 3 4 5 6 7 8 9 10] +[4 5 6 7 8] +^^^^ +copy +vvvv +[4 5 6 7 8] +^^^^ +--- +[11 12 13 14 15 16 17 18 19 20] +[1 2 3 4 5] +--- +[1 2 3 4 5] +--- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_a.nx.in new file mode 100644 index 000000000..0a4ec6ac6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_a.nx.in @@ -0,0 +1,43 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# +# Test 'copy' on arrays. +# + +[1 2 3 4 5 6 7 8 9 10] +dup +10 array +pstack `---\n' print +copy +pstack `---\n' print clear + +################ +`[1 2 3 4 5 6 7 8 9 10] dup 3 5 getinterval exch\n' print +[1 2 3 4 5 6 7 8 9 10] dup 3 5 getinterval exch +`vvvv\n' print pstack `^^^^\n' print + +copy +`copy\n' print +`vvvv\n' print pstack `^^^^\n' print + +clear +################ + +pstack `---\n' print +#[1 2 3 4 5 6 7 8 9 10] +[1 2 3 4 5] 0 5 getinterval +[11 12 13 14 15 16 17 18 19 20] +pstack `---\n' print +copy +pstack `---\n' print +clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_b.nx.exp new file mode 100644 index 000000000..307bde674 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_b.nx.exp @@ -0,0 +1,30 @@ +Test begin +`[] []' +[] +`[] [\`a\']' +[] +`[\`a\'] [\`b\']' +[`a'] +`[\`a\'] [\`b\' \`c\']' +[`a'] +`<$foo \`foo\'> <$bar \`bar\'>' +<$bar `bar' $foo `foo'> +`<$foo \`foo\'> <$foo \`FOO\' $bar \`bar\'>' +<$bar `bar' $foo `foo'> +`() ()' +() +`(1 2) ()' +(1 2) +`() (3 4)' +(3 4) +`(1 2) (3 4)' +(3 4 1 2) +`\`\' \`\'' +`' +`\`\' \`a\'' +`' +`\`a\' \`b\'' +`a' +`\`a\' \`bc\'' +`a' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_b.nx.in new file mode 100644 index 000000000..ca8282a7b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_b.nx.in @@ -0,0 +1,37 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[] []' + `[] [`a']' + `[`a'] [`b']' + `[`a'] [`b' `c']' + `<$foo `foo'> <$bar `bar'>' + `<$foo `foo'> <$foo `FOO' $bar `bar'>' + `() ()' + `(1 2) ()' + `() (3 4)' + `(1 2) (3 4)' + ``' `'' + ``' `a'' + ``a' `b'' + ``a' `bc'' +]{ + dup 1 sprint + cvx eval + copy 1 sprint +} foreach + +pstack +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_c.nx.exp new file mode 100644 index 000000000..60988204a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --copy-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_c.nx.in new file mode 100644 index 000000000..98dfeadc5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +copy + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_d.nx.exp new file mode 100644 index 000000000..50f0990ca --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-dict- -stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --copy-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_d.nx.in new file mode 100644 index 000000000..433ab9250 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<$foo `foo'> (1 2) copy + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_e.nx.exp new file mode 100644 index 000000000..0c026b1ed --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --copy-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_e.nx.in new file mode 100644 index 000000000..ea955ee47 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' [`a'] copy + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_f.nx.exp new file mode 100644 index 000000000..ac05faf0f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --copy-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_f.nx.in new file mode 100644 index 000000000..0333d0686 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a' `b'] [`c'] copy + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_g.nx.exp new file mode 100644 index 000000000..5510f66c2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`ab' `c') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --copy-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_g.nx.in new file mode 100644 index 000000000..fa2506f9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/copy_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`ab' `c' copy + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_a.nx.exp new file mode 100644 index 000000000..a38d3d19a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_a.nx.exp @@ -0,0 +1,58 @@ +Test begin +`-7' +7.539023e-01 +`-6' +9.601703e-01 +`-5' +2.836622e-01 +`-4' +-6.536436e-01 +`-3' +-9.899925e-01 +`-2' +-4.161468e-01 +`-1' +5.403023e-01 +`0' +1.000000e+00 +`1' +5.403023e-01 +`2' +-4.161468e-01 +`3' +-9.899925e-01 +`4' +-6.536436e-01 +`5' +2.836622e-01 +`6' +9.601703e-01 +`7' +7.539023e-01 +`-7.1415' +6.537137e-01 +`-6.1415' +9.899794e-01 +`-5.1415' +4.160626e-01 +`-4.1415' +-5.403803e-01 +`-2.1415' +-5.402243e-01 +`-1.1415' +4.162311e-01 +`0.1415' +9.900056e-01 +`1.1415' +4.162311e-01 +`2.1415' +-5.402243e-01 +`4.1415' +-5.403803e-01 +`5.1415' +4.160626e-01 +`6.1415' +9.899794e-01 +`7.1415' +6.537137e-01 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_a.nx.in new file mode 100644 index 000000000..e521b22ad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_a.nx.in @@ -0,0 +1,56 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-7' + `-6' + `-5' + `-4' + `-3' + `-2' + `-1' + `0' + `1' + `2' + `3' + `4' + `5' + `6' + `7' + + `-7.1415' + `-6.1415' + `-5.1415' + `-4.1415' + # Various systems produce exponents of +00 or -00, so don't check this. + # `-3.1415' + `-2.1415' + `-1.1415' + `0.1415' + `1.1415' + `2.1415' + # Various systems produce exponents of +00 or -00, so don't check this. + # `3.1415' + `4.1415' + `5.1415' + `6.1415' + `7.1415' +]{ + dup 1 sprint + cvx eval cos + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_b.nx.exp new file mode 100644 index 000000000..9321a563f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cos-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_b.nx.in new file mode 100644 index 000000000..dd2bdbbfb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +cos + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_c.nx.exp new file mode 100644 index 000000000..21744266d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cos-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_c.nx.in new file mode 100644 index 000000000..a0ce1a0dd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cos_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark cos + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/count_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/count_a.nx.exp new file mode 100644 index 000000000..7c9f1bddc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/count_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`count pstack clear' +0 +`1 count pstack clear' +1 +1 +`1 2 count pstack clear' +2 +2 +1 +`1 2 3 count pstack clear' +3 +3 +2 +1 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/count_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/count_a.nx.in new file mode 100644 index 000000000..7ecb9b898 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/count_a.nx.in @@ -0,0 +1,20 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`count pstack clear' dup 1 sprint cvx eval +`1 count pstack clear' dup 1 sprint cvx eval +`1 2 count pstack clear' dup 1 sprint cvx eval +`1 2 3 count pstack clear' dup 1 sprint cvx eval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/countdstack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countdstack_a.nx.exp new file mode 100644 index 000000000..849744963 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countdstack_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +4 +5 +4 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/countdstack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countdstack_a.nx.in new file mode 100644 index 000000000..5a7c7c925 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countdstack_a.nx.in @@ -0,0 +1,21 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +countdstack 1 sprint +<> begin +countdstack 1 sprint +end +countdstack 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/countestack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countestack_a.nx.exp new file mode 100644 index 000000000..d9595600d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countestack_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/countestack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countestack_a.nx.in new file mode 100644 index 000000000..e3427b243 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/countestack_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +countestack 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_a.nx.exp new file mode 100644 index 000000000..80e6742aa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_a.nx.exp @@ -0,0 +1,10 @@ +Test begin +`mark' +0 +`mark mark' +0 +`3 2 mark 0' +1 +`mark 2 1 0' +3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_a.nx.in new file mode 100644 index 000000000..a7bd7e17c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `mark' + `mark mark' + `3 2 mark 0' + `mark 2 1 0' +]{ + dup 1 sprint cvx eval counttomark 1 sprint clear +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_b.nx.exp new file mode 100644 index 000000000..3a3059f7f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $unmatchedmark +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --counttomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_b.nx.in new file mode 100644 index 000000000..9957bcf14 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +counttomark + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_c.nx.exp new file mode 100644 index 000000000..7362f8914 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $unmatchedmark +ostack: (-fino- null true) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --counttomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_c.nx.in new file mode 100644 index 000000000..45db41448 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/counttomark_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +( null true counttomark + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_a.nx.exp new file mode 100644 index 000000000..b075d1ae0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_a.nx.exp @@ -0,0 +1,92 @@ +Test begin +`0999.9' +`999.9' +`999.9' +`999.9' +`999.9' +`999.9' +`1e+03' +`1e+03' +`1e+03' +`1000' +`999.9' +`999.90' +`999.900' +`999.9000' +`999.90000' +`999.900000' +`999.9000000' +`999.90000000' +`42.5' +`42.5' +`42.5' +`42.5' +`42.5' +`42.5' +`42.5' +`42' +`4e+01' +`42' +`42.5' +`42.50' +`42.500' +`42.5000' +`42.50000' +`42.500000' +`42.5000000' +`42.50000000' +`0.0' +`0' +`0' +`0' +`0' +`0' +`0' +`0' +`0' +`0' +`0.0' +`0.00' +`0.000' +`0.0000' +`0.00000' +`0.000000' +`0.0000000' +`0.00000000' +`-55.9' +`-55.9' +`-55.9' +`-55.9' +`-55.9' +`-55.9' +`-55.9' +`-56' +`-6e+01' +`-56' +`-55.9' +`-55.90' +`-55.900' +`-55.9000' +`-55.90000' +`-55.900000' +`-55.9000000' +`-55.90000000' +`666.66666666' +`666.66667' +`666.6667' +`666.667' +`666.67' +`666.7' +`667' +`6.7e+02' +`7e+02' +`667' +`666.7' +`666.67' +`666.667' +`666.6667' +`666.66667' +`666.666667' +`666.6666667' +`666.66666666' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_a.nx.in new file mode 100644 index 000000000..ba3710bfc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_a.nx.in @@ -0,0 +1,33 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0999.9' + `42.5' + `0.0' + `-55.9' + `666.66666666' +]{ + dup 1 sprint + cvx eval + -8 1 8 { + 1 idup exch + cvds + 1 sprint + } for + pop +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_b.nx.exp new file mode 100644 index 000000000..7c9c5e549 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (10) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvds-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_b.nx.in new file mode 100644 index 000000000..b05553311 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +10 cvds + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_c.nx.exp new file mode 100644 index 000000000..46ecf42b9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (5.000000e+00 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvds-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_c.nx.in new file mode 100644 index 000000000..47dc07919 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +5.0 mark cvds + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_d.nx.exp new file mode 100644 index 000000000..f3323b635 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 5) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvds-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_d.nx.in new file mode 100644 index 000000000..c6098af86 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvds_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 5 cvds + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_a.nx.exp new file mode 100644 index 000000000..b16636974 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_a.nx.exp @@ -0,0 +1,28 @@ +Test begin +`{1 2 3}' +true +`[1 2 3]' +true +`true' +true +`<$foo \`foo\' $bar \`bar\'>' +true +`stdin' +true +`(' +true +`42' +true +`mark' +true +`$foo' +true +`null' +true +`~pop' +true +`(1 2 3)' +true +`\`foo\'' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_a.nx.in new file mode 100644 index 000000000..b1382a5dc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `{1 2 3}' + `[1 2 3]' + `true' + `<$foo `foo' $bar `bar'>' + `stdin' + `(' + `42' + `mark' + `$foo' + `null' + `~pop' + `(1 2 3)' + ``foo'' +]{ + dup 1 sprint + cvx eval + cve echeck + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_b.nx.exp new file mode 100644 index 000000000..39fbc9109 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cve-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_b.nx.in new file mode 100644 index 000000000..734186882 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cve_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +cve + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_a.nx.exp new file mode 100644 index 000000000..93838c31b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_a.nx.exp @@ -0,0 +1,57 @@ +Test begin +`0999.9' +`9.999000e+02' +`1e+03' +`1.0e+03' +`1.00e+03' +`9.999e+02' +`9.9990e+02' +`9.99900e+02' +`9.999000e+02' +`9.9990000e+02' +`9.99900000e+02' +`42.5' +`4.250000e+01' +`4e+01' +`4.2e+01' +`4.25e+01' +`4.250e+01' +`4.2500e+01' +`4.25000e+01' +`4.250000e+01' +`4.2500000e+01' +`4.25000000e+01' +`0.0' +`0.000000e+00' +`0e+00' +`0.0e+00' +`0.00e+00' +`0.000e+00' +`0.0000e+00' +`0.00000e+00' +`0.000000e+00' +`0.0000000e+00' +`0.00000000e+00' +`-55.9' +`-5.590000e+01' +`-6e+01' +`-5.6e+01' +`-5.59e+01' +`-5.590e+01' +`-5.5900e+01' +`-5.59000e+01' +`-5.590000e+01' +`-5.5900000e+01' +`-5.59000000e+01' +`666.66666666' +`6.666667e+02' +`7e+02' +`6.7e+02' +`6.67e+02' +`6.667e+02' +`6.6667e+02' +`6.66667e+02' +`6.666667e+02' +`6.6666667e+02' +`6.66666667e+02' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_a.nx.in new file mode 100644 index 000000000..826a3412a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_a.nx.in @@ -0,0 +1,33 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0999.9' + `42.5' + `0.0' + `-55.9' + `666.66666666' +]{ + dup 1 sprint + cvx eval + -1 1 8 { + 1 idup exch + cves + 1 sprint + } for + pop +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_b.nx.exp new file mode 100644 index 000000000..dc5bacc50 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (10) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cves-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_b.nx.in new file mode 100644 index 000000000..6d391a2d4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +10 cves + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_c.nx.exp new file mode 100644 index 000000000..7ab51e13e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (5.000000e+00 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cves-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_c.nx.in new file mode 100644 index 000000000..6bfbccc16 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +5.0 mark cves + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_d.nx.exp new file mode 100644 index 000000000..5f89a5fac --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 5) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cves-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_d.nx.in new file mode 100644 index 000000000..3294a3e68 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cves_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 5 cves + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_a.nx.exp new file mode 100644 index 000000000..43dadfd37 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_a.nx.exp @@ -0,0 +1,28 @@ +Test begin +`{1 2 3}' +false +`[1 2 3]' +false +`true' +false +`<$foo \`foo\' $bar \`bar\'>' +false +`stdin' +false +`(' +false +`42' +false +`mark' +false +`$foo' +false +`null' +false +`~pop' +false +`(1 2 3)' +false +`\`foo\'' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_a.nx.in new file mode 100644 index 000000000..dfcf9ede3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `{1 2 3}' + `[1 2 3]' + `true' + `<$foo `foo' $bar `bar'>' + `stdin' + `(' + `42' + `mark' + `$foo' + `null' + `~pop' + `(1 2 3)' + ``foo'' +]{ + dup 1 sprint + cvx eval + cvlit xcheck + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_b.nx.exp new file mode 100644 index 000000000..5ea87dfb1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvlit-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_b.nx.in new file mode 100644 index 000000000..75aae3bb8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvlit_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +cvlit + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_a.nx.exp new file mode 100644 index 000000000..1014da224 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +$foo +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_a.nx.in new file mode 100644 index 000000000..b5a91d4bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`foo' cvn 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_b.nx.exp new file mode 100644 index 000000000..92b50cadd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_b.nx.in new file mode 100644 index 000000000..e17d36299 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +cvn + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_c.nx.exp new file mode 100644 index 000000000..28de73d92 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_c.nx.in new file mode 100644 index 000000000..3c0182b2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvn_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark cvn + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_a.nx.exp new file mode 100644 index 000000000..df9d556e1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_a.nx.exp @@ -0,0 +1,142 @@ +Test begin +2 +`101010' +3 +`1120' +4 +`222' +5 +`132' +6 +`110' +7 +`60' +8 +`52' +9 +`46' +10 +`42' +11 +`39' +12 +`36' +13 +`33' +14 +`30' +15 +`2c' +16 +`2a' +17 +`28' +18 +`26' +19 +`24' +20 +`22' +21 +`20' +22 +`1k' +23 +`1j' +24 +`1i' +25 +`1h' +26 +`1g' +27 +`1f' +28 +`1e' +29 +`1d' +30 +`1c' +31 +`1b' +32 +`1a' +33 +`19' +34 +`18' +35 +`17' +36 +`16' +2 +`-101010' +3 +`-1120' +4 +`-222' +5 +`-132' +6 +`-110' +7 +`-60' +8 +`-52' +9 +`-46' +10 +`-42' +11 +`-39' +12 +`-36' +13 +`-33' +14 +`-30' +15 +`-2c' +16 +`-2a' +17 +`-28' +18 +`-26' +19 +`-24' +20 +`-22' +21 +`-20' +22 +`-1k' +23 +`-1j' +24 +`-1i' +25 +`-1h' +26 +`-1g' +27 +`-1f' +28 +`-1e' +29 +`-1d' +30 +`-1c' +31 +`-1b' +32 +`-1a' +33 +`-19' +34 +`-18' +35 +`-17' +36 +`-16' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_a.nx.in new file mode 100644 index 000000000..ddea4b11f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_a.nx.in @@ -0,0 +1,23 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +2 1 36 { + dup 1 sprint 42 exch cvrs 1 sprint +} for + +2 1 36 { + dup 1 sprint -42 exch cvrs 1 sprint +} for + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_b.nx.exp new file mode 100644 index 000000000..512b4fc08 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (10) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvrs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_b.nx.in new file mode 100644 index 000000000..a89a983b1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +10 cvrs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_c.nx.exp new file mode 100644 index 000000000..0b4a3a27d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (10 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvrs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_c.nx.in new file mode 100644 index 000000000..ce06ca1ad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +10 mark cvrs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_d.nx.exp new file mode 100644 index 000000000..46043a3a1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 10) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvrs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_d.nx.in new file mode 100644 index 000000000..21b897bef --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 10 cvrs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_e.nx.exp new file mode 100644 index 000000000..1d1283f11 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (42 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvrs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_e.nx.in new file mode 100644 index 000000000..2d41cd133 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +42 1 cvrs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_f.nx.exp new file mode 100644 index 000000000..5b7ac9998 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (42 37) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvrs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_f.nx.in new file mode 100644 index 000000000..f743695d5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvrs_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +42 37 cvrs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_a.nx.exp new file mode 100644 index 000000000..3207f710e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_a.nx.exp @@ -0,0 +1,30 @@ +Test begin +`false' +`false' +`true' +`true' +`42' +`42' +`-55' +`-55' +`$foo' +`foo' +`~pop' +`pop' +`\`foo\'' +`\`foo\'' +`[]' +`--nostringval--' +`<>' +`--nostringval--' +`stdin' +`--nostringval--' +`(' +`--nostringval--' +`mark' +`--nostringval--' +`null' +`--nostringval--' +`()' +`--nostringval--' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_a.nx.in new file mode 100644 index 000000000..92546e28c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `false' + `true' + `42' + `-55' + `$foo' + `~pop' + ``foo'' + `[]' + `<>' + `stdin' + `(' + `mark' + `null' + `()' + +]{ + dup 1 sprint + cvx eval + cvs + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_b.nx.exp new file mode 100644 index 000000000..e0ec935da --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvs-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_b.nx.in new file mode 100644 index 000000000..7807f6712 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +cvs + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_c.nx.exp new file mode 100644 index 000000000..fc3ab55c4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_c.nx.exp @@ -0,0 +1,10 @@ +Test begin +`42.0' +`4.200000e+01' +`-33.' +`-3.300000e+01' +`3.1415e0' +`3.141500e+00' +`6.022E+23' +`6.022000e+23' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_c.nx.in new file mode 100644 index 000000000..a21c2e029 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvs_c.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `42.0' + `-33.' + `3.1415e0' + `6.022E+23' +]{ + dup 1 sprint + cvx eval + cvs + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_a.nx.exp new file mode 100644 index 000000000..b16636974 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_a.nx.exp @@ -0,0 +1,28 @@ +Test begin +`{1 2 3}' +true +`[1 2 3]' +true +`true' +true +`<$foo \`foo\' $bar \`bar\'>' +true +`stdin' +true +`(' +true +`42' +true +`mark' +true +`$foo' +true +`null' +true +`~pop' +true +`(1 2 3)' +true +`\`foo\'' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_a.nx.in new file mode 100644 index 000000000..cb29af99a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `{1 2 3}' + `[1 2 3]' + `true' + `<$foo `foo' $bar `bar'>' + `stdin' + `(' + `42' + `mark' + `$foo' + `null' + `~pop' + `(1 2 3)' + ``foo'' +]{ + dup 1 sprint + cvx eval + cvx xcheck + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_b.nx.exp new file mode 100644 index 000000000..e9b03f284 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --cvx-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_b.nx.in new file mode 100644 index 000000000..86c7d54bb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/cvx_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +cvx + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_a.nx.exp new file mode 100644 index 000000000..48eaf73a1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +-2 --> -3 +-1 --> -2 +0 --> -1 +1 --> 0 +2 --> 1 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_a.nx.in new file mode 100644 index 000000000..8aef74823 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + -2 + -1 + 0 + 1 + 2 +]{ + dup 1 sprints print + ` --> ' print + + dec + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_b.nx.exp new file mode 100644 index 000000000..0558cc544 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dec-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_b.nx.in new file mode 100644 index 000000000..c87377d0f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +dec + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_c.nx.exp new file mode 100644 index 000000000..185b7f722 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1.000000e+00) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dec-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_c.nx.in new file mode 100644 index 000000000..8c39804cb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1.0 dec + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_d.nx.exp new file mode 100644 index 000000000..160bbaa46 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dec-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_d.nx.in new file mode 100644 index 000000000..798083b6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dec_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark dec + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_a.nx.exp new file mode 100644 index 000000000..47b438bf1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +`foo' +`FOO' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_a.nx.in new file mode 100644 index 000000000..f65c26a22 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_a.nx.in @@ -0,0 +1,20 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$foo `foo' def +foo 1 sprint +$foo `FOO' def +foo 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_b.nx.exp new file mode 100644 index 000000000..87524ace3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: ($foo) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --def-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_b.nx.in new file mode 100644 index 000000000..a29029362 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/def_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$foo def + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dict_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dict_a.nx.exp new file mode 100644 index 000000000..5ffcd332a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dict_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +<> +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dict_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dict_a.nx.in new file mode 100644 index 000000000..e6d07d173 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dict_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +dict 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_a.nx.in new file mode 100644 index 000000000..55dfd5456 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_a.nx.in @@ -0,0 +1,110 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# Populate a subdirectory with files. +# +# #dirname #nfiles subfiles - +$subfiles { + 1 1 3 2 roll { + 1 idup `/' cat exch cvs cat + `w' open + dup `content\n' write pop + close + } for + pop +} def + +# Create a subdirectory with files in it. +# +# #dirname subdir - +$subdir { + dup 8@755 mkdir + 5 subfiles +} def + +# Recursively print directories and files in a directory tree. +# +# #dirname printtree - +$printtree { + dup { + 1 idup `/' cat exch cat + dup 1 sprint + dup `f' test { +# `file\n' print flush + pop + }{ dup `d' test { +# `directory\n' print flush + printtree + }{ + `unknown\n' print flush + } ifelse + } ifelse + } dirforeach + pop +} def + +# Recursively delete directories and files in a directory tree. +# +# #dirname deltree - +$deltree { + dup { + 1 idup `/' cat exch cat +# dup 1 sprint + dup `f' test { +# `file\n' print flush + unlink + }{ dup `d' test { +# `directory\n' print flush + deltree + }{ + `unknown\n' print flush + } ifelse + } ifelse + } dirforeach + rmdir +} def + +# +# Begin main program. +# + +`Test begin\n' print flush + +# Clean up the directory tree if it already exists. +argv 2 get `/dirforeach_a' cat `d' test { + argv 2 get `/dirforeach_a' cat deltree +} if +argv 2 get `/dirforeach_a' cat `d' test { + `Directory tree already existed, and was not completely deletable:\n' print + argv 2 get `/dirforeach_a' cat printtree + 1 die +} if + +# Create a directory tree and contents. +argv 2 get `/dirforeach_a' cat subdir +argv 2 get `/dirforeach_a/dir_a' cat subdir +argv 2 get `/dirforeach_a/dir_b' cat subdir +argv 2 get `/dirforeach_a/dir_b/dir_c' cat subdir + +# Do a depth first traversal and deletion of the directory tree. +#argv 2 get `/dirforeach_a' cat printtree +argv 2 get `/dirforeach_a' cat deltree + +# Make sure the directory tree is gone. +argv 2 get `/dirforeach_a' cat `d' test { + `Directory tree not completeley deleted:\n' print + argv 2 get `/dirforeach_a' cat printtree + 1 die +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_b.nx.exp new file mode 100644 index 000000000..7a7da40ae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dirforeach-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_b.nx.in new file mode 100644 index 000000000..c1f4f4e82 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark {} dirforeach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_c.nx.exp new file mode 100644 index 000000000..1f54d8444 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $invalidaccess +ostack: (`/dev/null' -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dirforeach-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_c.nx.in new file mode 100644 index 000000000..f979bdf80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dirforeach_c.nx.in @@ -0,0 +1,21 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +#argv 1 get `/dirforeach_c.nx.in' cat +`/dev/null' { + `Somehow managed to iterate on a file: ' print 1 sprint +} dirforeach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_a.nx.exp new file mode 100644 index 000000000..83ac6bc0d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_a.nx.exp @@ -0,0 +1,50 @@ +Test begin +`0 1 div' +0.000000e+00 +`4 2 div' +2.000000e+00 +`5 2 div' +2.500000e+00 +`5 -3 div' +-1.666667e+00 +`-5 3 div' +-1.666667e+00 +`-5 -3 div' +1.666667e+00 +`0 1.0 div' +0.000000e+00 +`4 2.0 div' +2.000000e+00 +`5 2.0 div' +2.500000e+00 +`5 -3.0 div' +-1.666667e+00 +`-5 3.0 div' +-1.666667e+00 +`-5 -3.0 div' +1.666667e+00 +`0.0 1 div' +0.000000e+00 +`4.0 2 div' +2.000000e+00 +`5.0 2 div' +2.500000e+00 +`5.0 -3 div' +-1.666667e+00 +`-5.0 3 div' +-1.666667e+00 +`-5.0 -3 div' +1.666667e+00 +`0.0 1.0 div' +0.000000e+00 +`4.0 2.0 div' +2.000000e+00 +`5.0 2.0 div' +2.500000e+00 +`5.0 -3.0 div' +-1.666667e+00 +`-5.0 3.0 div' +-1.666667e+00 +`-5.0 -3.0 div' +1.666667e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_a.nx.in new file mode 100644 index 000000000..bf6004d23 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_a.nx.in @@ -0,0 +1,49 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 div' + `4 2 div' + `5 2 div' + `5 -3 div' + `-5 3 div' + `-5 -3 div' + + `0 1.0 div' + `4 2.0 div' + `5 2.0 div' + `5 -3.0 div' + `-5 3.0 div' + `-5 -3.0 div' + + `0.0 1 div' + `4.0 2 div' + `5.0 2 div' + `5.0 -3 div' + `-5.0 3 div' + `-5.0 -3 div' + + `0.0 1.0 div' + `4.0 2.0 div' + `5.0 2.0 div' + `5.0 -3.0 div' + `-5.0 3.0 div' + `-5.0 -3.0 div' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_b.nx.exp new file mode 100644 index 000000000..1e664dbb9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --div-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_b.nx.in new file mode 100644 index 000000000..6312de531 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 div + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_c.nx.exp new file mode 100644 index 000000000..7bfb5b28a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --div-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_c.nx.in new file mode 100644 index 000000000..8d0ab0638 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark div + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_d.nx.exp new file mode 100644 index 000000000..267c2bff6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --div-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_d.nx.in new file mode 100644 index 000000000..b4e44f89c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 div + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_e.nx.exp new file mode 100644 index 000000000..2a0bede3b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefinedresult +ostack: (1 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --div-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_e.nx.in new file mode 100644 index 000000000..ed1cbfaa7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/div_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 0 div + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_a.nx.exp new file mode 100644 index 000000000..4ef36fd06 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_a.nx.exp @@ -0,0 +1,44 @@ +Test begin +`0 1 2' +First: +0 +2 +1 +Second: +1 +0 +2 +Third: +2 +1 +0 +`() [] {}' +First: +() +{} +[] +Second: +[] +() +{} +Third: +{} +[] +() +`0 1 2 3' +First: +1 +3 +2 +0 +Second: +2 +1 +3 +0 +Third: +3 +2 +1 +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_a.nx.in new file mode 100644 index 000000000..1ca47e352 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 2' + `() [] {}' + `0 1 2 3' +]{ + dup 1 sprint + cvx eval + `First:\n' print + dn pstack + `Second:\n' print + dn pstack + `Third:\n' print + dn pstack + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_b.nx.exp new file mode 100644 index 000000000..b4f1756f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_b.nx.in new file mode 100644 index 000000000..6fd94cbc5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dn_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 dn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dstack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dstack_a.nx.exp new file mode 100644 index 000000000..a7074854b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dstack_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +(-dict- -dict- -dict- -dict-) +(-dict- -dict- -dict- -dict- -dict-) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dstack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dstack_a.nx.in new file mode 100644 index 000000000..e1e42d397 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dstack_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +dstack 1 sprint +dict begin +dstack 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_a.nx.exp new file mode 100644 index 000000000..a56483ec9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_a.nx.exp @@ -0,0 +1,9 @@ +Test begin +`1' +1 +1 +`1 2' +2 +2 +1 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_a.nx.in new file mode 100644 index 000000000..a57bd5b29 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_a.nx.in @@ -0,0 +1,22 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1' + `1 2' +]{ + dup 1 sprint cvx eval dup pstack clear +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_b.nx.exp new file mode 100644 index 000000000..cb5090974 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --dup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_b.nx.in new file mode 100644 index 000000000..25dd8cb6a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/dup_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +dup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/end_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/end_a.nx.exp new file mode 100644 index 000000000..06620d068 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/end_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +`foo' +`FOO' +(-dict- -dict- -dict- -dict- -dict- -dict-) +`foo' +(-dict- -dict- -dict- -dict- -dict-) +(-dict- -dict- -dict- -dict-) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/end_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/end_a.nx.in new file mode 100644 index 000000000..b77547571 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/end_a.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<$foo `foo'> begin +foo 1 sprint + +<$foo `FOO'> begin +foo 1 sprint + +dstack 1 sprint +end +foo 1 sprint +dstack 1 sprint +end +dstack 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_a.nx.exp new file mode 100644 index 000000000..8c7f55678 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_a.nx.exp @@ -0,0 +1,64 @@ +Test begin +`-1 -1' +true +`0 0' +true +`1 1' +true +`-2 -1' +false +`-1 0' +false +`0 1' +false +`1 2' +false +`-1 1' +false +`-1 -2' +false +`0 -1' +false +`1 0' +false +`2 1' +false +`1 -1' +false +`\`abc\' \`abc\'' +true +`\`abc\' \`abd\'' +false +`\`abd\' \`abc\'' +false +`dict dict' +false +`dict stack' +false +`~pop ~spop' +false +`~pop ~roll' +false +`$foo $bar' +false +`$foo \`bar\'' +false +`true false' +false +`false true' +false +`stack dup' +true +`~pop ~pop' +true +`$foo $foo' +true +`$foo \`foo\'' +true +`\`foo\' $foo' +true +`true dup' +true +`false dup' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_a.nx.in new file mode 100644 index 000000000..cdbe22e86 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_a.nx.in @@ -0,0 +1,69 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1 -1' + `0 0' + `1 1' + + # Less than. + `-2 -1' + `-1 0' + `0 1' + `1 2' + `-1 1' + + # Greater than. + `-1 -2' + `0 -1' + `1 0' + `2 1' + `1 -1' + + # Equal. + ``abc' `abc'' + + # Less than. + ``abc' `abd'' + + # Greater than. + ``abd' `abc'' + + # Not equal. + `dict dict' + `dict stack' + `~pop ~spop' + `~pop ~roll' + `$foo $bar' + `$foo `bar'' + `true false' + `false true' + + # Equal. + `stack dup' + `~pop ~pop' + `$foo $foo' + `$foo `foo'' + ``foo' $foo' + `true dup' + `false dup' +]{ + dup 1 sprint + cvx eval + eq + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_b.nx.exp new file mode 100644 index 000000000..55bb12878 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --eq-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_b.nx.in new file mode 100644 index 000000000..a41018d07 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 eq + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_c.nx.exp new file mode 100644 index 000000000..717c33c4c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_c.nx.exp @@ -0,0 +1,80 @@ +Test begin +`-1.0 -1' +true +`0.0 0' +true +`1.0 1' +true +`-1 -1.0' +true +`0 0.0' +true +`1 1.0' +true +`-1.0 -1.0' +true +`0.0 0.0' +true +`1.0 1.0' +true +`-2.0 -1' +false +`-1.0 0' +false +`0.0 1' +false +`1.0 2' +false +`-1.0 1' +false +`-2 -1.0' +false +`-1 0.0' +false +`0 1.0' +false +`1 2.0' +false +`-1 1.0' +false +`-2.0 -1.0' +false +`-1.0 0.0' +false +`0.0 1.0' +false +`1.0 2.0' +false +`-1.0 1.0' +false +`-1.0 -2' +false +`0.0 -1' +false +`1.0 0' +false +`2.0 1' +false +`1.0 -1' +false +`-1 -2.0' +false +`0 -1.0' +false +`1 0.0' +false +`2 1.0' +false +`1 -1.0' +false +`-1.0 -2.0' +false +`0.0 -1.0' +false +`1.0 0.0' +false +`2.0 1.0' +false +`1.0 -1.0' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_c.nx.in new file mode 100644 index 000000000..eee6f551e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eq_c.nx.in @@ -0,0 +1,73 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1.0 -1' + `0.0 0' + `1.0 1' + + `-1 -1.0' + `0 0.0' + `1 1.0' + + `-1.0 -1.0' + `0.0 0.0' + `1.0 1.0' + + # Less than. + `-2.0 -1' + `-1.0 0' + `0.0 1' + `1.0 2' + `-1.0 1' + + `-2 -1.0' + `-1 0.0' + `0 1.0' + `1 2.0' + `-1 1.0' + + `-2.0 -1.0' + `-1.0 0.0' + `0.0 1.0' + `1.0 2.0' + `-1.0 1.0' + + # Greater than. + `-1.0 -2' + `0.0 -1' + `1.0 0' + `2.0 1' + `1.0 -1' + + `-1 -2.0' + `0 -1.0' + `1 0.0' + `2 1.0' + `1 -1.0' + + `-1.0 -2.0' + `0.0 -1.0' + `1.0 0.0' + `2.0 1.0' + `1.0 -1.0' +]{ + dup 1 sprint + cvx eval + eq + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval.nx.exp new file mode 100644 index 000000000..80f9e4b68 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval.nx.exp @@ -0,0 +1,4 @@ +Test begin +`hi' +`bye' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval.nx.in new file mode 100644 index 000000000..37c492959 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval.nx.in @@ -0,0 +1,21 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# Test the eval operator. + +`Test begin\n' print flush + +``hi' 1 sprint' cvx eval +``bye' 1 sprint' cvx eval + +pstack # Make sure the stack is empty. +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_a.nx.exp new file mode 100644 index 000000000..5c001f8f2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_a.nx.exp @@ -0,0 +1,29 @@ +Test begin +`[1]' +[1] +1 +`true' +true +true +`<$foo \`foo\'>' +<$foo `foo'> +<$foo `foo'> +`42' +42 +42 +`mark' +-mark- +-mark- +`$count' +$count +0 +`~count' +--count-- +0 +`(1)' +(1) +(1) +`\`count\'' +`count' +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_a.nx.in new file mode 100644 index 000000000..c394fad77 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_a.nx.in @@ -0,0 +1,41 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[1]' + `true' + `<$foo `foo'>' + `42' + `mark' + `$count' + `~count' + `(1)' + ``count'' +]{ + dup 1 sprint + cvx + # Literal. + dup eval cvlit eval + 1 sprint + + # Executable. + eval cvx eval + 1 sprint +} foreach + +# Make sure that an executable null is discarded. +null cvx eval +pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_b.nx.exp new file mode 100644 index 000000000..d51e5e5bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --eval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_b.nx.in new file mode 100644 index 000000000..64a787dbc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/eval_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +eval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_a.nx.exp new file mode 100644 index 000000000..fb767e36c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +1 +0 +2 +0 +1 +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_a.nx.in new file mode 100644 index 000000000..473b2e359 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +2 1 0 exch pstack +exch pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_b.nx.exp new file mode 100644 index 000000000..3b38e8be3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --exch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_b.nx.in new file mode 100644 index 000000000..d3fb2ceb0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +exch + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_c.nx.exp new file mode 100644 index 000000000..3d5acade5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --exch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_c.nx.in new file mode 100644 index 000000000..cf19ffcf5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exch_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 exch + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exit_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exit_a.nx.exp new file mode 100644 index 000000000..26f833de1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exit_a.nx.exp @@ -0,0 +1,15 @@ +Test begin +`0 1 1000 {dup 1 sprint 3 eq {exit} if} for' +0 +1 +2 +3 +`10 {\`hi\' 1 sprint exit \`bye\' 1 sprint} repeat' +`hi' +`{\`hi\' 1 sprint exit \`bye\' 1 sprint} loop' +`hi' +`[1 2 3 4 5 6] {dup 1 sprint 3 eq {exit} if} foreach' +1 +2 +3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/exit_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exit_a.nx.in new file mode 100644 index 000000000..c97f09b57 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/exit_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 1000 {dup 1 sprint 3 eq {exit} if} for' + `10 {`hi' 1 sprint exit `bye' 1 sprint} repeat' + `{`hi' 1 sprint exit `bye' 1 sprint} loop' + `[1 2 3 4 5 6] {dup 1 sprint 3 eq {exit} if} foreach' +]{ + dup 1 sprint + cvx eval +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_a.nx.exp new file mode 100644 index 000000000..d7978a2f5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_a.nx.exp @@ -0,0 +1,56 @@ +Test begin +`-1 floor' +-1 +`0 floor' +0 +`1 floor' +1 +`-1.0 floor' +-1 +`0.0 floor' +0 +`1.0 floor' +1 +`-2.9 floor' +-3 +`-2.6 floor' +-3 +`-2.5 floor' +-3 +`-2.4 floor' +-3 +`-2.1 floor' +-3 +`-1.9 floor' +-2 +`-1.6 floor' +-2 +`-1.5 floor' +-2 +`-1.4 floor' +-2 +`-1.1 floor' +-2 +`0.0 floor' +0 +`1.1 floor' +1 +`1.4 floor' +1 +`1.5 floor' +1 +`1.6 floor' +1 +`1.9 floor' +1 +`2.1 floor' +2 +`2.4 floor' +2 +`2.5 floor' +2 +`2.6 floor' +2 +`2.9 floor' +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_a.nx.in new file mode 100644 index 000000000..33e83e5b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_a.nx.in @@ -0,0 +1,56 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-1 floor' + `0 floor' + `1 floor' + + `-1.0 floor' + `0.0 floor' + `1.0 floor' + + `-2.9 floor' + `-2.6 floor' + `-2.5 floor' + `-2.4 floor' + `-2.1 floor' + + `-1.9 floor' + `-1.6 floor' + `-1.5 floor' + `-1.4 floor' + `-1.1 floor' + + `0.0 floor' + + `1.1 floor' + `1.4 floor' + `1.5 floor' + `1.6 floor' + `1.9 floor' + + `2.1 floor' + `2.4 floor' + `2.5 floor' + `2.6 floor' + `2.9 floor' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_b.nx.exp new file mode 100644 index 000000000..9234f2b5e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --floor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_b.nx.in new file mode 100644 index 000000000..ad8ef992a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +floor + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_c.nx.exp new file mode 100644 index 000000000..6691ee5b3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --floor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_c.nx.in new file mode 100644 index 000000000..b27f64401 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/floor_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark floor + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_a.nx.exp new file mode 100644 index 000000000..40651a8c7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_a.nx.exp @@ -0,0 +1,35 @@ +Test begin +`0 1 0 {1 sprint} for' +0 +`0 1 5 {1 sprint} for' +0 +1 +2 +3 +4 +5 +`0 2 5 {1 sprint} for' +0 +2 +4 +`5 -1 0 {1 sprint} for' +5 +4 +3 +2 +1 +0 +`5 -2 0 {1 sprint} for' +5 +3 +1 +`5 -2 -5 {1 sprint} for' +5 +3 +1 +-1 +-3 +-5 +`0 1 5 {1 sprint exit} for' +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_a.nx.in new file mode 100644 index 000000000..9a351e8c0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_a.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 0 {1 sprint} for' + `0 1 5 {1 sprint} for' + `0 2 5 {1 sprint} for' + `5 -1 0 {1 sprint} for' + `5 -2 0 {1 sprint} for' + `5 -2 -5 {1 sprint} for' + `0 1 5 {1 sprint exit} for' +]{ + dup 1 sprint + cvx eval +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_b.nx.exp new file mode 100644 index 000000000..63057bfda --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1 1 -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --for-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_b.nx.in new file mode 100644 index 000000000..24912999a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 1 {} for + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_c.nx.exp new file mode 100644 index 000000000..15675df46 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1 1 -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --for-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_c.nx.in new file mode 100644 index 000000000..4318de7a1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 1 {} for + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_d.nx.exp new file mode 100644 index 000000000..022b4366e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark- 1 -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --for-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_d.nx.in new file mode 100644 index 000000000..948c58c6b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark 1 {} for + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_e.nx.exp new file mode 100644 index 000000000..e4bb9d24a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 1 -mark- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --for-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_e.nx.in new file mode 100644 index 000000000..63994026d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/for_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 1 mark {} for + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_a.nx.exp new file mode 100644 index 000000000..f73679544 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_a.nx.exp @@ -0,0 +1,38 @@ +Test begin +`[]' +`[1]' +1 +`[1 2]' +1 +2 +`<>' +`<$foo \`foo\'>' +`foo' +$foo +`<$foo \`foo\' $bar \`bar\'>' +`bar' +$bar +`foo' +$foo +`()' +`(1)' +1 +`(1 2)' +2 +1 +`\`\'' +`\`a\'' +97 +`\`ab\'' +97 +98 +`[1 2]' +1 +`<$foo \`foo\' $bar \`bar\'>' +`bar' +$bar +`(1 2)' +2 +`\`ab\'' +97 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_a.nx.in new file mode 100644 index 000000000..63a186ce9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_a.nx.in @@ -0,0 +1,44 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[]' + `[1]' + `[1 2]' + `<>' +# `<$foo `foo'' + `<$foo `foo'>' + `<$foo `foo' $bar `bar'>' + `()' + `(1)' + `(1 2)' + ``'' + ``a'' + ``ab'' +]{ + dup 1 sprint + cvx eval {pstack clear} foreach +} foreach + +[ + `[1 2]' + `<$foo `foo' $bar `bar'>' + `(1 2)' + ``ab'' +]{ + dup 1 sprint + cvx eval {pstack clear exit} foreach +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_b.nx.exp new file mode 100644 index 000000000..3e083662a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --foreach-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_b.nx.in new file mode 100644 index 000000000..7e9f386a7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_c.nx.exp new file mode 100644 index 000000000..3afb3bd12 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --foreach-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_c.nx.in new file mode 100644 index 000000000..c258dbdc7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark mark foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_d.nx.exp new file mode 100644 index 000000000..325285725 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_d.nx.exp @@ -0,0 +1,22 @@ +Test begin +`j' +(`a' `b' `c' `d' `e' `f' `g' `h' `i') +`i' +(`a' `b' `c' `d' `e' `f' `g' `h') +`h' +(`a' `b' `c' `d' `e' `f' `g') +`g' +(`a' `b' `c' `d' `e' `f') +`f' +(`a' `b' `c' `d' `e') +`e' +(`a' `b' `c' `d') +`d' +(`a' `b' `c') +`c' +(`a' `b') +`b' +(`a') +`a' +() +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_d.nx.in new file mode 100644 index 000000000..fa7465dbb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/foreach_d.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# Make sure that removing stack objects during foreach iteration doesn't cause +# accesses to dead or cached stack object containers. + +`Test begin\n' print flush + +$foo (`a' `b' `c' `d' `e' `f' `g' `h' `i' `j' + `k' `l' `m' `n' `o' `p' `q' `r' `s' `t' + `u' `v' `w' `x' `y' `z' + ) def + +foo 16 snpop pop + +foo { + 1 sprint + foo spop pop foo 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_dict_finalize.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_dict_finalize.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_dict_finalize.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_dict_finalize.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_dict_finalize.nx.in new file mode 100644 index 000000000..6f896119f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_dict_finalize.nx.in @@ -0,0 +1,34 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +# 1) Create strings, 2) create a dict, and 3) insert the strings into the dict, +# so that the GC sweeper will happen to finalize the strings before the dict. +# If the dict finalizer tries to access the strings, this test will blow up. + +$pre_count 64 def + +[ + 0 1 pre_count dec { + cvs + } for +] + +<> exch { + under dup put +} foreach + +pop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_roll.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_roll.nx.exp new file mode 100644 index 000000000..8d8ed361a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_roll.nx.exp @@ -0,0 +1,3 @@ +Test begin +.................................................. +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_roll.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_roll.nx.in new file mode 100644 index 000000000..d1a0b5a20 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gc_roll.nx.in @@ -0,0 +1,37 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# +# Test the GC with lots of rolls going on. +# + +`Test begin\n' print flush + +# Push 10 strings onto the stack. +0 10 {1 add dup cvs exch} repeat pop + +50 { + 100 { + 100 { + # Roll by increasing amounts. + -10 1 10 { + 5 exch roll + } for + } repeat + + gcdict $collect get eval + } repeat + `.' print flush +} bind repeat +`\n' print + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_a.nx.exp new file mode 100644 index 000000000..eafb6ddbc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_a.nx.exp @@ -0,0 +1,34 @@ +Test begin +`-1 -1' +true +`0 0' +true +`1 1' +true +`-2 -1' +false +`-1 0' +false +`0 1' +false +`1 2' +false +`-1 1' +false +`-1 -2' +true +`0 -1' +true +`1 0' +true +`2 1' +true +`1 -1' +true +`\`abc\' \`abc\'' +true +`\`abc\' \`abd\'' +false +`\`abd\' \`abc\'' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_a.nx.in new file mode 100644 index 000000000..5842cfce6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_a.nx.in @@ -0,0 +1,50 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1 -1' + `0 0' + `1 1' + + # Less than. + `-2 -1' + `-1 0' + `0 1' + `1 2' + `-1 1' + + # Greater than. + `-1 -2' + `0 -1' + `1 0' + `2 1' + `1 -1' + + # Equal. + ``abc' `abc'' + + # Less than. + ``abc' `abd'' + + # Greater than. + ``abd' `abc'' +]{ + dup 1 sprint + cvx eval + ge + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_b.nx.exp new file mode 100644 index 000000000..7e3aeccf8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_b.nx.in new file mode 100644 index 000000000..118328999 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_c.nx.exp new file mode 100644 index 000000000..7f2d1370e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_c.nx.in new file mode 100644 index 000000000..fad61e326 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_d.nx.exp new file mode 100644 index 000000000..68466d010 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_d.nx.in new file mode 100644 index 000000000..0efbf4129 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_e.nx.exp new file mode 100644 index 000000000..089198f80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_e.nx.in new file mode 100644 index 000000000..052710b68 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' mark ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_f.nx.exp new file mode 100644 index 000000000..a0c5cbe6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_f.nx.in new file mode 100644 index 000000000..85fc2cc76 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `a' ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_g.nx.exp new file mode 100644 index 000000000..2c13fb7b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_g.nx.in new file mode 100644 index 000000000..5a77937e4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 `a' ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_h.nx.exp new file mode 100644 index 000000000..c2a127c79 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ge-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_h.nx.in new file mode 100644 index 000000000..a6ff091b8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 ge + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_i.nx.exp new file mode 100644 index 000000000..401a67721 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_i.nx.exp @@ -0,0 +1,80 @@ +Test begin +`-1.0 -1' +true +`0.0 0' +true +`1.0 1' +true +`-1 -1.0' +true +`0 0.0' +true +`1 1.0' +true +`-1.0 -1.0' +true +`0.0 0.0' +true +`1.0 1.0' +true +`-2.0 -1' +false +`-1.0 0' +false +`0.0 1' +false +`1.0 2' +false +`-1.0 1' +false +`-2 -1.0' +false +`-1 0.0' +false +`0 1.0' +false +`1 2.0' +false +`-1 1.0' +false +`-2.0 -1.0' +false +`-1.0 0.0' +false +`0.0 1.0' +false +`1.0 2.0' +false +`-1.0 1.0' +false +`-1.0 -2' +true +`0.0 -1' +true +`1.0 0' +true +`2.0 1' +true +`1.0 -1' +true +`-1 -2.0' +true +`0 -1.0' +true +`1 0.0' +true +`2 1.0' +true +`1 -1.0' +true +`-1.0 -2.0' +true +`0.0 -1.0' +true +`1.0 0.0' +true +`2.0 1.0' +true +`1.0 -1.0' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_i.nx.in new file mode 100644 index 000000000..6e259f2f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ge_i.nx.in @@ -0,0 +1,73 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1.0 -1' + `0.0 0' + `1.0 1' + + `-1 -1.0' + `0 0.0' + `1 1.0' + + `-1.0 -1.0' + `0.0 0.0' + `1.0 1.0' + + # Less than. + `-2.0 -1' + `-1.0 0' + `0.0 1' + `1.0 2' + `-1.0 1' + + `-2 -1.0' + `-1 0.0' + `0 1.0' + `1 2.0' + `-1 1.0' + + `-2.0 -1.0' + `-1.0 0.0' + `0.0 1.0' + `1.0 2.0' + `-1.0 1.0' + + # Greater than. + `-1.0 -2' + `0.0 -1' + `1.0 0' + `2.0 1' + `1.0 -1' + + `-1 -2.0' + `0 -1.0' + `1 0.0' + `2 1.0' + `1 -1.0' + + `-1.0 -2.0' + `0.0 -1.0' + `1.0 0.0' + `2.0 1.0' + `1.0 -1.0' +]{ + dup 1 sprint + cvx eval + ge + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_a.nx.exp new file mode 100644 index 000000000..3443cafc0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_a.nx.exp @@ -0,0 +1,24 @@ +Test begin +`[\`a\'] 0 get' +`a' +`[\`a\' \`b\'] 1 get' +`b' +`[\`a\' \`b\' \`c\'] 1 get' +`b' +`[\`a\' \`b\' \`c\'] 2 get' +`c' +`<$foo \`foo\' $bar \`bar\'> $foo get' +`foo' +`<$foo \`foo\' $bar \`bar\'> $bar get' +`bar' +`\`a\' 0 get' +97 +`\`ab\' 0 get' +97 +`\`ab\' 1 get' +98 +`\`abc\' 1 get' +98 +`\`abc\' 2 get' +99 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_a.nx.in new file mode 100644 index 000000000..3a11ffe4a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[`a'] 0 get' + `[`a' `b'] 1 get' + `[`a' `b' `c'] 1 get' + `[`a' `b' `c'] 2 get' + `<$foo `foo' $bar `bar'> $foo get' + `<$foo `foo' $bar `bar'> $bar get' + ``a' 0 get' + ``ab' 0 get' + ``ab' 1 get' + ``abc' 1 get' + ``abc' 2 get' +]{ + dup 1 sprint + cvx eval 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_b.nx.exp new file mode 100644 index 000000000..8a03762d8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_b.nx.in new file mode 100644 index 000000000..925229c0c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_c.nx.exp new file mode 100644 index 000000000..5da438840 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_c.nx.in new file mode 100644 index 000000000..3176cd4df --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[1] mark get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_d.nx.exp new file mode 100644 index 000000000..6c869af5f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefined +ostack: (-dict- $bar) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_d.nx.in new file mode 100644 index 000000000..5c2887b20 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<$foo `foo'> $bar get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_e.nx.exp new file mode 100644 index 000000000..bd8e2d7a6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_e.nx.in new file mode 100644 index 000000000..3c5f9bbe2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' mark get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_f.nx.exp new file mode 100644 index 000000000..9cf0e131d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_f.nx.in new file mode 100644 index 000000000..33dc1bddd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a'] 1 get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_g.nx.exp new file mode 100644 index 000000000..127119474 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`a' 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_g.nx.in new file mode 100644 index 000000000..f8ed00b68 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_h.nx.exp new file mode 100644 index 000000000..0251766fb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --get-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_h.nx.in new file mode 100644 index 000000000..8df64d1f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/get_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a'] -1 get + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_a.nx.exp new file mode 100644 index 000000000..92ef1671f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_a.nx.exp @@ -0,0 +1,44 @@ +Test begin +`[0] 0 1 getinterval' +[0] +`[0 1] 0 1 getinterval' +[0] +`[0 1] 1 1 getinterval' +[1] +`[0 1] 0 2 getinterval' +[0 1] +`[0 1 2 3] 0 2 getinterval' +[0 1] +`[0 1 2 3] 0 3 getinterval' +[0 1 2] +`[0 1 2 3] 0 4 getinterval' +[0 1 2 3] +`[0 1 2 3] 1 2 getinterval' +[1 2] +`[0 1 2 3] 1 3 getinterval' +[1 2 3] +`[0 1 2 3] 2 2 getinterval' +[2 3] +`[0 1 2 3] 3 1 getinterval' +[3] +`\`a\' 0 1 getinterval' +`a' +`\`ab\' 0 1 getinterval' +`a' +`\`ab\' 1 1 getinterval' +`b' +`\`abcd\' 0 2 getinterval' +`ab' +`\`abcd\' 0 3 getinterval' +`abc' +`\`abcd\' 0 4 getinterval' +`abcd' +`\`abcd\' 1 2 getinterval' +`bc' +`\`abcd\' 1 3 getinterval' +`bcd' +`\`abcd\' 2 2 getinterval' +`cd' +`\`abcd\' 3 1 getinterval' +`d' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_a.nx.in new file mode 100644 index 000000000..7e2dd807e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_a.nx.in @@ -0,0 +1,44 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[0] 0 1 getinterval' + `[0 1] 0 1 getinterval' + `[0 1] 1 1 getinterval' + `[0 1] 0 2 getinterval' + `[0 1 2 3] 0 2 getinterval' + `[0 1 2 3] 0 3 getinterval' + `[0 1 2 3] 0 4 getinterval' + `[0 1 2 3] 1 2 getinterval' + `[0 1 2 3] 1 3 getinterval' + `[0 1 2 3] 2 2 getinterval' + `[0 1 2 3] 3 1 getinterval' + + ``a' 0 1 getinterval' + ``ab' 0 1 getinterval' + ``ab' 1 1 getinterval' + ``abcd' 0 2 getinterval' + ``abcd' 0 3 getinterval' + ``abcd' 0 4 getinterval' + ``abcd' 1 2 getinterval' + ``abcd' 1 3 getinterval' + ``abcd' 2 2 getinterval' + ``abcd' 3 1 getinterval' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_b.nx.exp new file mode 100644 index 000000000..b9c71ab03 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_b.nx.in new file mode 100644 index 000000000..345b7e920 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 1 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_c.nx.exp new file mode 100644 index 000000000..ab23917e0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_c.nx.in new file mode 100644 index 000000000..320ae2dda --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 1 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_d.nx.exp new file mode 100644 index 000000000..c995ab839 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- -mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_d.nx.in new file mode 100644 index 000000000..fc0529ee5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a'] mark 1 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_e.nx.exp new file mode 100644 index 000000000..2ac1b9f6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- 1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_e.nx.in new file mode 100644 index 000000000..5b87010f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a'] 1 mark getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_f.nx.exp new file mode 100644 index 000000000..e7af63bf5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- 1 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_f.nx.in new file mode 100644 index 000000000..76e935f0e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a' `b' `c'] 1 3 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_g.nx.exp new file mode 100644 index 000000000..c65f68786 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`abc' 1 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_g.nx.in new file mode 100644 index 000000000..5c51cf5cc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`abc' 1 3 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_h.nx.exp new file mode 100644 index 000000000..3c20a8341 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- -1 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_h.nx.in new file mode 100644 index 000000000..a6b24386e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a' `b' `c'] -1 3 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_i.nx.exp new file mode 100644 index 000000000..52373577f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`abc' 0 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --getinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_i.nx.in new file mode 100644 index 000000000..d16b69a6d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/getinterval_i.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`abc' 0 -1 getinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstderr_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstderr_a.nx.exp new file mode 100644 index 000000000..bf378e01e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstderr_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +-file- +Written to gstderr +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstderr_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstderr_a.nx.in new file mode 100644 index 000000000..e48e219ec --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstderr_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +gstderr 1 sprint +gstderr `Written to gstderr\n' write pop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdin_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdin_a.nx.exp new file mode 100644 index 000000000..c0f1cef39 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdin_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-file- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdin_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdin_a.nx.in new file mode 100644 index 000000000..e9efe54ec --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdin_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +gstdin 1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdout_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdout_a.nx.exp new file mode 100644 index 000000000..261b0fa67 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdout_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +-file- +Written to gstdout +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdout_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdout_a.nx.in new file mode 100644 index 000000000..e19b414f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gstdout_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +gstdout 1 sprint +gstdout `Written to gstdout\n' write pop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_a.nx.exp new file mode 100644 index 000000000..fd87a4f37 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_a.nx.exp @@ -0,0 +1,34 @@ +Test begin +`-1 -1' +false +`0 0' +false +`1 1' +false +`-2 -1' +false +`-1 0' +false +`0 1' +false +`1 2' +false +`-1 1' +false +`-1 -2' +true +`0 -1' +true +`1 0' +true +`2 1' +true +`1 -1' +true +`\`abc\' \`abc\'' +false +`\`abc\' \`abd\'' +false +`\`abd\' \`abc\'' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_a.nx.in new file mode 100644 index 000000000..2e6636e63 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_a.nx.in @@ -0,0 +1,50 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1 -1' + `0 0' + `1 1' + + # Less than. + `-2 -1' + `-1 0' + `0 1' + `1 2' + `-1 1' + + # Greater than. + `-1 -2' + `0 -1' + `1 0' + `2 1' + `1 -1' + + # Equal. + ``abc' `abc'' + + # Less than. + ``abc' `abd'' + + # Greater than. + ``abd' `abc'' +]{ + dup 1 sprint + cvx eval + gt + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_b.nx.exp new file mode 100644 index 000000000..1c22720f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_b.nx.in new file mode 100644 index 000000000..88b754ce3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_c.nx.exp new file mode 100644 index 000000000..5efe8e9be --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_c.nx.in new file mode 100644 index 000000000..009ee502e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_d.nx.exp new file mode 100644 index 000000000..f64e27022 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_d.nx.in new file mode 100644 index 000000000..f8da793ee --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_e.nx.exp new file mode 100644 index 000000000..7a3bb7304 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_e.nx.in new file mode 100644 index 000000000..eb323a1bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' mark gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_f.nx.exp new file mode 100644 index 000000000..c1d1d5a1b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_f.nx.in new file mode 100644 index 000000000..9c89b04f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `a' gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_g.nx.exp new file mode 100644 index 000000000..222484259 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_g.nx.in new file mode 100644 index 000000000..e06bd3f36 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 `a' gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_h.nx.exp new file mode 100644 index 000000000..571545ba6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --gt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_h.nx.in new file mode 100644 index 000000000..c6482d81a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 gt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_i.nx.exp new file mode 100644 index 000000000..c52c2029f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_i.nx.exp @@ -0,0 +1,80 @@ +Test begin +`-1.0 -1' +false +`0.0 0' +false +`1.0 1' +false +`-1 -1.0' +false +`0 0.0' +false +`1 1.0' +false +`-1.0 -1.0' +false +`0.0 0.0' +false +`1.0 1.0' +false +`-2.0 -1' +false +`-1.0 0' +false +`0.0 1' +false +`1.0 2' +false +`-1.0 1' +false +`-2 -1.0' +false +`-1 0.0' +false +`0 1.0' +false +`1 2.0' +false +`-1 1.0' +false +`-2.0 -1.0' +false +`-1.0 0.0' +false +`0.0 1.0' +false +`1.0 2.0' +false +`-1.0 1.0' +false +`-1.0 -2' +true +`0.0 -1' +true +`1.0 0' +true +`2.0 1' +true +`1.0 -1' +true +`-1 -2.0' +true +`0 -1.0' +true +`1 0.0' +true +`2 1.0' +true +`1 -1.0' +true +`-1.0 -2.0' +true +`0.0 -1.0' +true +`1.0 0.0' +true +`2.0 1.0' +true +`1.0 -1.0' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_i.nx.in new file mode 100644 index 000000000..4b2b3c030 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/gt_i.nx.in @@ -0,0 +1,73 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1.0 -1' + `0.0 0' + `1.0 1' + + `-1 -1.0' + `0 0.0' + `1 1.0' + + `-1.0 -1.0' + `0.0 0.0' + `1.0 1.0' + + # Less than. + `-2.0 -1' + `-1.0 0' + `0.0 1' + `1.0 2' + `-1.0 1' + + `-2 -1.0' + `-1 0.0' + `0 1.0' + `1 2.0' + `-1 1.0' + + `-2.0 -1.0' + `-1.0 0.0' + `0.0 1.0' + `1.0 2.0' + `-1.0 1.0' + + # Greater than. + `-1.0 -2' + `0.0 -1' + `1.0 0' + `2.0 1' + `1.0 -1' + + `-1 -2.0' + `0 -1.0' + `1 0.0' + `2 1.0' + `1 -1.0' + + `-1.0 -2.0' + `0.0 -1.0' + `1.0 0.0' + `2.0 1.0' + `1.0 -1.0' +]{ + dup 1 sprint + cvx eval + gt + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/hello.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/hello.nx.exp new file mode 100644 index 000000000..cd0875583 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/hello.nx.exp @@ -0,0 +1 @@ +Hello world! diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/hello.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/hello.nx.in new file mode 100644 index 000000000..d278a675e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/hello.nx.in @@ -0,0 +1,14 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# Canonical "Hello world". +`Hello world!\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_a.nx.exp new file mode 100644 index 000000000..f601abb85 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_a.nx.exp @@ -0,0 +1,28 @@ +Test begin +`0 0 ibdup' +0 +0 +`0 1 0 ibdup' +0 +1 +0 +`0 1 1 ibdup' +1 +1 +0 +`0 1 2 0 ibdup' +0 +2 +1 +0 +`0 1 2 1 ibdup' +1 +2 +1 +0 +`0 1 2 2 ibdup' +2 +2 +1 +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_a.nx.in new file mode 100644 index 000000000..c3a9961b3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 ibdup' + `0 1 0 ibdup' + `0 1 1 ibdup' + `0 1 2 0 ibdup' + `0 1 2 1 ibdup' + `0 1 2 2 ibdup' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_b.nx.exp new file mode 100644 index 000000000..609add5e3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_b.nx.in new file mode 100644 index 000000000..17f4284b2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_c.nx.exp new file mode 100644 index 000000000..aaa528ac8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_c.nx.in new file mode 100644 index 000000000..6372414dc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 ibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_d.nx.exp new file mode 100644 index 000000000..cd0b78ba2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (0 1 2 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_d.nx.in new file mode 100644 index 000000000..4c6d658ea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 2 -1 ibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_e.nx.exp new file mode 100644 index 000000000..f3f0b0b95 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (0 1 2 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_e.nx.in new file mode 100644 index 000000000..9b294667e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 2 mark ibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_f.nx.exp new file mode 100644 index 000000000..26b04d326 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0 1 2 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_f.nx.in new file mode 100644 index 000000000..d1b578686 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibdup_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 2 3 ibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_a.nx.exp new file mode 100644 index 000000000..c6a7ff200 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`0 0 ibpop' +`0 1 0 ibpop' +1 +`0 1 1 ibpop' +0 +`0 1 2 0 ibpop' +2 +1 +`0 1 2 1 ibpop' +2 +0 +`0 1 2 2 ibpop' +1 +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_a.nx.in new file mode 100644 index 000000000..9526febef --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 ibpop' + `0 1 0 ibpop' + `0 1 1 ibpop' + `0 1 2 0 ibpop' + `0 1 2 1 ibpop' + `0 1 2 2 ibpop' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_b.nx.exp new file mode 100644 index 000000000..e23922e40 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_b.nx.in new file mode 100644 index 000000000..ace5d9473 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_c.nx.exp new file mode 100644 index 000000000..a64cab407 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_c.nx.in new file mode 100644 index 000000000..6d6191315 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 ibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_d.nx.exp new file mode 100644 index 000000000..4a447ee80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (0 1 2 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_d.nx.in new file mode 100644 index 000000000..fa37398ea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 2 -1 ibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_e.nx.exp new file mode 100644 index 000000000..8d430638c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0 1 2 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_e.nx.in new file mode 100644 index 000000000..a5b06b980 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 2 3 ibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_f.nx.exp new file mode 100644 index 000000000..cfa0741db --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (0 1 2 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_f.nx.in new file mode 100644 index 000000000..83f0a5e2e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ibpop_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 2 mark ibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_a.nx.exp new file mode 100644 index 000000000..1787329dc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_a.nx.exp @@ -0,0 +1,14 @@ +Test begin +`0 1 idiv' +0 +`4 2 idiv' +2 +`5 2 idiv' +2 +`5 -3 idiv' +-1 +`-5 3 idiv' +-1 +`-5 -3 idiv' +1 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_a.nx.in new file mode 100644 index 000000000..71e9042a2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_a.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 idiv' + `4 2 idiv' + `5 2 idiv' + `5 -3 idiv' + `-5 3 idiv' + `-5 -3 idiv' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_b.nx.exp new file mode 100644 index 000000000..fb50281f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idiv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_b.nx.in new file mode 100644 index 000000000..00c091284 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 idiv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_c.nx.exp new file mode 100644 index 000000000..13821d5be --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idiv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_c.nx.in new file mode 100644 index 000000000..575be0f64 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark idiv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_d.nx.exp new file mode 100644 index 000000000..23b52ad99 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idiv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_d.nx.in new file mode 100644 index 000000000..4897f12dc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 idiv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_e.nx.exp new file mode 100644 index 000000000..cefb49ebf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefinedresult +ostack: (1 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idiv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_e.nx.in new file mode 100644 index 000000000..2fbd1dbe1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idiv_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 0 idiv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_a.nx.exp new file mode 100644 index 000000000..370f1afcd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_a.nx.exp @@ -0,0 +1,10 @@ +Test begin +`0 0 idup' +0 +`1 0 1 idup' +1 +`2 1 0 1 idup' +1 +`2 1 0 2 idup' +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_a.nx.in new file mode 100644 index 000000000..4077589e2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 idup' + `1 0 1 idup' + `2 1 0 1 idup' + `2 1 0 2 idup' +]{ + dup 1 sprint cvx eval 1 sprint clear +} foreach + + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_b.nx.exp new file mode 100644 index 000000000..33868ba79 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_b.nx.in new file mode 100644 index 000000000..2df88ab4f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +idup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_c.nx.exp new file mode 100644 index 000000000..eeeff5ec6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_c.nx.in new file mode 100644 index 000000000..644fa023c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' idup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_d.nx.exp new file mode 100644 index 000000000..e77a92edd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_d.nx.in new file mode 100644 index 000000000..0ee236f74 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1 idup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_e.nx.exp new file mode 100644 index 000000000..bf429e051 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_e.nx.in new file mode 100644 index 000000000..5f743e3c4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 idup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_f.nx.exp new file mode 100644 index 000000000..31e05b2da --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_f.nx.in new file mode 100644 index 000000000..067a3e987 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/idup_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 idup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_a.nx.exp new file mode 100644 index 000000000..7c5821d7b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +`true' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_a.nx.in new file mode 100644 index 000000000..1ea6430c0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true {`true' 1 sprint} if +false {`false' 1 sprint} if + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_b.nx.exp new file mode 100644 index 000000000..5f794b315 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (true) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --if-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_b.nx.in new file mode 100644 index 000000000..306a8451d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true if + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_c.nx.exp new file mode 100644 index 000000000..a7dd9294b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --if-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_c.nx.in new file mode 100644 index 000000000..cd75ee6f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/if_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark {`mark' 1 sprint} if + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_a.nx.exp new file mode 100644 index 000000000..3b8749c6a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +`yes' +`no' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_a.nx.in new file mode 100644 index 000000000..454559fbf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true {`yes'}{`no'} ifelse 1 sprint +false {`yes'}{`no'} ifelse 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_b.nx.exp new file mode 100644 index 000000000..cacb89848 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (true true) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ifelse-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_b.nx.in new file mode 100644 index 000000000..c4a2f0002 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true true ifelse + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_c.nx.exp new file mode 100644 index 000000000..987098934 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -array- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ifelse-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_c.nx.in new file mode 100644 index 000000000..dbe5cd808 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ifelse_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark {}{} ifelse + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_a.nx.exp new file mode 100644 index 000000000..8afe8e449 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +Error $undefined +ostack: ($foo) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_a.nx.in new file mode 100644 index 000000000..9c9990c58 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +~foo + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_b.nx.exp new file mode 100644 index 000000000..ddc16c366 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_b.nx.exp @@ -0,0 +1,7 @@ +Test begin +Error $undefined +ostack: (-pmark- $foo) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_b.nx.in new file mode 100644 index 000000000..f9e5c3269 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/immediate_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{~foo} + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_a.nx.exp new file mode 100644 index 000000000..a45384710 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +-2 --> -1 +-1 --> 0 +0 --> 1 +1 --> 2 +2 --> 3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_a.nx.in new file mode 100644 index 000000000..a9e0ff8df --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + -2 + -1 + 0 + 1 + 2 +]{ + dup 1 sprints print + ` --> ' print + + inc + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_b.nx.exp new file mode 100644 index 000000000..f320271e1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --inc-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_b.nx.in new file mode 100644 index 000000000..3eb04bebf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +inc + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_c.nx.exp new file mode 100644 index 000000000..7700b8371 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1.000000e+00) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --inc-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_c.nx.in new file mode 100644 index 000000000..0f2951a09 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1.0 inc + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_d.nx.exp new file mode 100644 index 000000000..aa1f5c40f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --inc-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_d.nx.in new file mode 100644 index 000000000..ead95cf47 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/inc_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark inc + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer.nx.exp new file mode 100644 index 000000000..b04993123 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer.nx.exp @@ -0,0 +1,8 @@ +0 0 add 1 sprint +0 +3 0 add 1 sprint +3 +3 4 add 1 sprint +7 +-5 5 add 1 sprint +0 diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer.nx.in new file mode 100644 index 000000000..24509e0aa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# Test basic integer operations. +`0 0 add 1 sprint\n' dup print cvx eval +`3 0 add 1 sprint\n' dup print cvx eval +`3 4 add 1 sprint\n' dup print cvx eval +`-5 5 add 1 sprint\n' dup print cvx eval diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_a.nx.exp new file mode 100644 index 000000000..1f8d2e308 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_a.nx.exp @@ -0,0 +1,13 @@ +Test begin +333338 +81985529216486895 +81985529216486895 +5 +-9223372036854775808 +9223372036854775807 +0 +0 +7897 +-52431 +234 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_a.nx.in new file mode 100644 index 000000000..bd2dca580 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +234 +-52431 ++7897 +0 +-0 + +9223372036854775807 # Maximum integer +-9223372036854775808 # Minimum integer + +2@101 +16@0123456789abcdef +16@0123456789ABCDEF +35@7r3x + +pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_b.nx.exp new file mode 100644 index 000000000..c1bc29777 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: 9223372036854775808 +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_b.nx.in new file mode 100644 index 000000000..79e46f1d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +9223372036854775808 + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_c.nx.exp new file mode 100644 index 000000000..0ecafab57 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: -9223372036854775809 +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_c.nx.in new file mode 100644 index 000000000..5639ffb33 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-9223372036854775809 + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_d.nx.exp new file mode 100644 index 000000000..d80dbf518 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: 16@abcdefg +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_d.nx.in new file mode 100644 index 000000000..ac5d2d644 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/integer_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +16@abcdefg + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_a.nx.exp new file mode 100644 index 000000000..0e7e677b9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`0 0 ipop' +`1 0 0 ipop' +1 +`1 0 1 ipop' +0 +`2 1 0 0 ipop' +1 +2 +`2 1 0 1 ipop' +0 +2 +`2 1 0 2 ipop' +0 +1 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_a.nx.in new file mode 100644 index 000000000..1712453f9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 ipop' + `1 0 0 ipop' + `1 0 1 ipop' + `2 1 0 0 ipop' + `2 1 0 1 ipop' + `2 1 0 2 ipop' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_b.nx.exp new file mode 100644 index 000000000..00c4f06b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_b.nx.in new file mode 100644 index 000000000..dfc1c3dc7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_c.nx.exp new file mode 100644 index 000000000..d550d6df6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_c.nx.in new file mode 100644 index 000000000..7b62173fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark ipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_d.nx.exp new file mode 100644 index 000000000..3bd84f96a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (0 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_d.nx.in new file mode 100644 index 000000000..4c7c8b993 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 -1 ipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_e.nx.exp new file mode 100644 index 000000000..8c3a34f58 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1 0 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_e.nx.in new file mode 100644 index 000000000..5d4f29dbc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ipop_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 0 2 ipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_a.nx.exp new file mode 100644 index 000000000..f92715b50 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_a.nx.exp @@ -0,0 +1,10 @@ +Test begin +`currentdict $foo' +false +`userdict $bar' +false +`systemdict $pop' +true +`threaddict $pop' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_a.nx.in new file mode 100644 index 000000000..bb3cd722e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `currentdict $foo' + `userdict $bar' + `systemdict $pop' + `threaddict $pop' +]{ + dup 1 sprint cvx eval known 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_b.nx.exp new file mode 100644 index 000000000..246b096ea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --known-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_b.nx.in new file mode 100644 index 000000000..c1c50f7d9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +currentdict known + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_c.nx.exp new file mode 100644 index 000000000..fc7117fa3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --known-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_c.nx.in new file mode 100644 index 000000000..deea4405d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/known_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark mark known + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_a.nx.exp new file mode 100644 index 000000000..c004b00e4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_a.nx.exp @@ -0,0 +1,34 @@ +Test begin +`-1 -1' +true +`0 0' +true +`1 1' +true +`-2 -1' +true +`-1 0' +true +`0 1' +true +`1 2' +true +`-1 1' +true +`-1 -2' +false +`0 -1' +false +`1 0' +false +`2 1' +false +`1 -1' +false +`\`abc\' \`abc\'' +true +`\`abc\' \`abd\'' +true +`\`abd\' \`abc\'' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_a.nx.in new file mode 100644 index 000000000..4d1f82e89 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_a.nx.in @@ -0,0 +1,50 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1 -1' + `0 0' + `1 1' + + # Less than. + `-2 -1' + `-1 0' + `0 1' + `1 2' + `-1 1' + + # Greater than. + `-1 -2' + `0 -1' + `1 0' + `2 1' + `1 -1' + + # Equal. + ``abc' `abc'' + + # Less than. + ``abc' `abd'' + + # Greater than. + ``abd' `abc'' +]{ + dup 1 sprint + cvx eval + le + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_b.nx.exp new file mode 100644 index 000000000..77d60803c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_b.nx.in new file mode 100644 index 000000000..3356fdd3e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_c.nx.exp new file mode 100644 index 000000000..4578ab48c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_c.nx.in new file mode 100644 index 000000000..488b3c29e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_d.nx.exp new file mode 100644 index 000000000..3be695834 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_d.nx.in new file mode 100644 index 000000000..5a7c8ac1b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_e.nx.exp new file mode 100644 index 000000000..7b70b0aaf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_e.nx.in new file mode 100644 index 000000000..663306bb3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' mark le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_f.nx.exp new file mode 100644 index 000000000..f1c5cb544 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_f.nx.in new file mode 100644 index 000000000..55edc8a98 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `a' le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_g.nx.exp new file mode 100644 index 000000000..139ab97ee --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_g.nx.in new file mode 100644 index 000000000..59f5c2880 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 `a' le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_h.nx.exp new file mode 100644 index 000000000..7de7d14ab --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --le-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_h.nx.in new file mode 100644 index 000000000..15441251f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 le + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_i.nx.exp new file mode 100644 index 000000000..3f2c2805a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_i.nx.exp @@ -0,0 +1,80 @@ +Test begin +`-1.0 -1' +true +`0.0 0' +true +`1.0 1' +true +`-1 -1.0' +true +`0 0.0' +true +`1 1.0' +true +`-1.0 -1.0' +true +`0.0 0.0' +true +`1.0 1.0' +true +`-2.0 -1' +true +`-1.0 0' +true +`0.0 1' +true +`1.0 2' +true +`-1.0 1' +true +`-2 -1.0' +true +`-1 0.0' +true +`0 1.0' +true +`1 2.0' +true +`-1 1.0' +true +`-2.0 -1.0' +true +`-1.0 0.0' +true +`0.0 1.0' +true +`1.0 2.0' +true +`-1.0 1.0' +true +`-1.0 -2' +false +`0.0 -1' +false +`1.0 0' +false +`2.0 1' +false +`1.0 -1' +false +`-1 -2.0' +false +`0 -1.0' +false +`1 0.0' +false +`2 1.0' +false +`1 -1.0' +false +`-1.0 -2.0' +false +`0.0 -1.0' +false +`1.0 0.0' +false +`2.0 1.0' +false +`1.0 -1.0' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_i.nx.in new file mode 100644 index 000000000..24d67d025 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/le_i.nx.in @@ -0,0 +1,73 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1.0 -1' + `0.0 0' + `1.0 1' + + `-1 -1.0' + `0 0.0' + `1 1.0' + + `-1.0 -1.0' + `0.0 0.0' + `1.0 1.0' + + # Less than. + `-2.0 -1' + `-1.0 0' + `0.0 1' + `1.0 2' + `-1.0 1' + + `-2 -1.0' + `-1 0.0' + `0 1.0' + `1 2.0' + `-1 1.0' + + `-2.0 -1.0' + `-1.0 0.0' + `0.0 1.0' + `1.0 2.0' + `-1.0 1.0' + + # Greater than. + `-1.0 -2' + `0.0 -1' + `1.0 0' + `2.0 1' + `1.0 -1' + + `-1 -2.0' + `0 -1.0' + `1 0.0' + `2 1.0' + `1 -1.0' + + `-1.0 -2.0' + `0.0 -1.0' + `1.0 0.0' + `2.0 1.0' + `1.0 -1.0' +]{ + dup 1 sprint + cvx eval + le + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_a.nx.exp new file mode 100644 index 000000000..5c267d457 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_a.nx.exp @@ -0,0 +1,18 @@ +Test begin +`[]' +0 +`[1]' +1 +`[1 2]' +2 +`<>' +0 +`<$foo \`foo\' $bar \`bar\'>' +2 +`$foo' +3 +`\`\'' +0 +`\`foo\'' +3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_a.nx.in new file mode 100644 index 000000000..17dfcb317 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[]' + `[1]' + `[1 2]' + `<>' + `<$foo `foo' $bar `bar'>' + `$foo' + ``'' + ``foo'' +]{ + dup 1 sprint + cvx eval length 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_b.nx.exp new file mode 100644 index 000000000..92e85bbd7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --length-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_b.nx.in new file mode 100644 index 000000000..dd4b4925d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +length + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_c.nx.exp new file mode 100644 index 000000000..a30caff4d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --length-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_c.nx.in new file mode 100644 index 000000000..ba9a9c370 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/length_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark length + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_a.nx.exp new file mode 100644 index 000000000..e379f6f2c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`1' +0.000000e+00 +`2' +6.931472e-01 +`3' +1.098612e+00 +`0.5' +-6.931472e-01 +`1.5' +4.054651e-01 +`2.5' +9.162907e-01 +`3.5' +1.252763e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_a.nx.in new file mode 100644 index 000000000..eda671bf1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1' + `2' + `3' + + `0.5' + `1.5' + `2.5' + `3.5' +]{ + dup 1 sprint + cvx eval ln + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_b.nx.exp new file mode 100644 index 000000000..7bd1327c3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ln-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_b.nx.in new file mode 100644 index 000000000..3081ae8b2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ln + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_c.nx.exp new file mode 100644 index 000000000..717d87dcf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ln-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_c.nx.in new file mode 100644 index 000000000..1dae832c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark ln + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_d.nx.exp new file mode 100644 index 000000000..97e60b59c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (0.000000e+00) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ln-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_d.nx.in new file mode 100644 index 000000000..410f28b2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ln_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0.0 ln + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_a.nx.exp new file mode 100644 index 000000000..8645362f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`1' +0.000000e+00 +`2' +3.010300e-01 +`3' +4.771213e-01 +`0.5' +-3.010300e-01 +`1.5' +1.760913e-01 +`2.5' +3.979400e-01 +`3.5' +5.440680e-01 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_a.nx.in new file mode 100644 index 000000000..e0aa5735c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1' + `2' + `3' + + `0.5' + `1.5' + `2.5' + `3.5' +]{ + dup 1 sprint + cvx eval log + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_b.nx.exp new file mode 100644 index 000000000..a641c444c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --log-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_b.nx.in new file mode 100644 index 000000000..31b6107e7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +log + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_c.nx.exp new file mode 100644 index 000000000..a0a233da5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --log-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_c.nx.in new file mode 100644 index 000000000..79d64a2e3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark log + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_d.nx.exp new file mode 100644 index 000000000..fe6a09656 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (0.000000e+00) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --log-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_d.nx.in new file mode 100644 index 000000000..901887174 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/log_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0.0 log + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_a.nx.exp new file mode 100644 index 000000000..1be6bd16f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_a.nx.exp @@ -0,0 +1,9 @@ +Test begin +`{\`hi\' 1 sprint exit \`bye\' 1 sprint} loop' +`hi' +`0 {1 add dup 1 sprint dup 3 eq {pop exit} if} loop' +1 +2 +3 +`~exit loop' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_a.nx.in new file mode 100644 index 000000000..a3307ecae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `{`hi' 1 sprint exit `bye' 1 sprint} loop' + `0 {1 add dup 1 sprint dup 3 eq {pop exit} if} loop' + `~exit loop' +]{ + dup 1 sprint + cvx eval +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_b.nx.exp new file mode 100644 index 000000000..98cd15a75 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --loop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_b.nx.in new file mode 100644 index 000000000..bd82250ad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/loop_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +loop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_a.nx.exp new file mode 100644 index 000000000..ea29482e7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_a.nx.exp @@ -0,0 +1,34 @@ +Test begin +`-1 -1' +false +`0 0' +false +`1 1' +false +`-2 -1' +true +`-1 0' +true +`0 1' +true +`1 2' +true +`-1 1' +true +`-1 -2' +false +`0 -1' +false +`1 0' +false +`2 1' +false +`1 -1' +false +`\`abc\' \`abc\'' +false +`\`abc\' \`abd\'' +true +`\`abd\' \`abc\'' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_a.nx.in new file mode 100644 index 000000000..fe5c783eb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_a.nx.in @@ -0,0 +1,50 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1 -1' + `0 0' + `1 1' + + # Less than. + `-2 -1' + `-1 0' + `0 1' + `1 2' + `-1 1' + + # Greater than. + `-1 -2' + `0 -1' + `1 0' + `2 1' + `1 -1' + + # Equal. + ``abc' `abc'' + + # Less than. + ``abc' `abd'' + + # Greater than. + ``abd' `abc'' +]{ + dup 1 sprint + cvx eval + lt + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_b.nx.exp new file mode 100644 index 000000000..ae2bd120b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_b.nx.in new file mode 100644 index 000000000..375b1007f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_c.nx.exp new file mode 100644 index 000000000..83fc473d4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_c.nx.in new file mode 100644 index 000000000..a1a1506a0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_d.nx.exp new file mode 100644 index 000000000..92695da65 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_d.nx.in new file mode 100644 index 000000000..7439ad1c0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_e.nx.exp new file mode 100644 index 000000000..5edb243b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_e.nx.in new file mode 100644 index 000000000..1fad60dd9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' mark lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_f.nx.exp new file mode 100644 index 000000000..8b04c612b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_f.nx.in new file mode 100644 index 000000000..162a08408 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `a' lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_g.nx.exp new file mode 100644 index 000000000..933a30adf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_g.nx.in new file mode 100644 index 000000000..1ba20a104 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 `a' lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_h.nx.exp new file mode 100644 index 000000000..55b308d3b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --lt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_h.nx.in new file mode 100644 index 000000000..f428cc083 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 lt + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_i.nx.exp new file mode 100644 index 000000000..c1cb3eb24 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_i.nx.exp @@ -0,0 +1,80 @@ +Test begin +`-1.0 -1' +false +`0.0 0' +false +`1.0 1' +false +`-1 -1.0' +false +`0 0.0' +false +`1 1.0' +false +`-1.0 -1.0' +false +`0.0 0.0' +false +`1.0 1.0' +false +`-2.0 -1' +true +`-1.0 0' +true +`0.0 1' +true +`1.0 2' +true +`-1.0 1' +true +`-2 -1.0' +true +`-1 0.0' +true +`0 1.0' +true +`1 2.0' +true +`-1 1.0' +true +`-2.0 -1.0' +true +`-1.0 0.0' +true +`0.0 1.0' +true +`1.0 2.0' +true +`-1.0 1.0' +true +`-1.0 -2' +false +`0.0 -1' +false +`1.0 0' +false +`2.0 1' +false +`1.0 -1' +false +`-1 -2.0' +false +`0 -1.0' +false +`1 0.0' +false +`2 1.0' +false +`1 -1.0' +false +`-1.0 -2.0' +false +`0.0 -1.0' +false +`1.0 0.0' +false +`2.0 1.0' +false +`1.0 -1.0' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_i.nx.in new file mode 100644 index 000000000..99ac77af0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/lt_i.nx.in @@ -0,0 +1,73 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1.0 -1' + `0.0 0' + `1.0 1' + + `-1 -1.0' + `0 0.0' + `1 1.0' + + `-1.0 -1.0' + `0.0 0.0' + `1.0 1.0' + + # Less than. + `-2.0 -1' + `-1.0 0' + `0.0 1' + `1.0 2' + `-1.0 1' + + `-2 -1.0' + `-1 0.0' + `0 1.0' + `1 2.0' + `-1 1.0' + + `-2.0 -1.0' + `-1.0 0.0' + `0.0 1.0' + `1.0 2.0' + `-1.0 1.0' + + # Greater than. + `-1.0 -2' + `0.0 -1' + `1.0 0' + `2.0 1' + `1.0 -1' + + `-1 -2.0' + `0 -1.0' + `1 0.0' + `2 1.0' + `1 -1.0' + + `-1.0 -2.0' + `0.0 -1.0' + `1.0 0.0' + `2.0 1.0' + `1.0 -1.0' +]{ + dup 1 sprint + cvx eval + lt + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mark_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mark_a.nx.exp new file mode 100644 index 000000000..de9ae7039 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mark_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-mark- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mark_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mark_a.nx.in new file mode 100644 index 000000000..555ea4d4d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mark_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_a.nx.exp new file mode 100644 index 000000000..ac97b429d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_a.nx.exp @@ -0,0 +1,64 @@ +Test begin +{`' `.' < > match pstack clear} +false +{`' `.' < > regex match pstack clear} +false +{`' `.' match pstack clear} +false +{`' `.' regex match pstack clear} +false +{`Some input text.' `.' < > match 1 sprint 0 submatch 1 sprint} +true +`S' +{`Some input text.' `.' < > regex match 1 sprint 0 submatch 1 sprint} +true +`S' +{`Some input text.' `.' match 1 sprint 0 submatch 1 sprint} +true +`S' +{`Some input text.' `.' regex match 1 sprint 0 submatch 1 sprint} +true +`S' +{`INPUT Input input' `input' < $g true > -array- -array- while 3 npop} +`input' +{`INPUT Input input' `input' < $g true > regex -array- -array- while 2 npop} +`input' +{`INPUT Input input' `input' < $g true $i true > -array- -array- while 3 npop} +`INPUT' +`Input' +`input' +{`INPUT Input input' `input' < $g true $i true > regex -array- -array- while 2 npop} +`INPUT' +`Input' +`input' +{`Some multiline\ninput text.' `^\\w+' < $g true > -array- -array- while 3 npop} +`Some' +{`Some multiline\ninput text.' `^\\w+' < $g true > regex -array- -array- while 2 npop} +`Some' +{`Some multiline\ninput text.' `^\\w+' < $g true $m true > -array- -array- while 3 npop} +`Some' +`input' +{`Some multiline\ninput text.' `^\\w+' < $g true $m true > regex -array- -array- while 2 npop} +`Some' +`input' +{`Some multiline\ninput text.' `\\w+.' < $g true > -array- -array- while 3 npop} +`Some ' +`multiline' +`input ' +`text.' +{`Some multiline\ninput text.' `\\w+.' < $g true > regex -array- -array- while 2 npop} +`Some ' +`multiline' +`input ' +`text.' +{`Some multiline\ninput text.' `\\w+.' < $g true $s true > -array- -array- while 3 npop} +`Some ' +`multiline\n' +`input ' +`text.' +{`Some multiline\ninput text.' `\\w+.' < $g true $s true > regex -array- -array- while 2 npop} +`Some ' +`multiline\n' +`input ' +`text.' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_a.nx.in new file mode 100644 index 000000000..ac0b15f3d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_a.nx.in @@ -0,0 +1,130 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`' `.' <> match pstack clear} + {`' `.' <> regex match pstack clear} + {`' `.' match pstack clear} + {`' `.' regex match pstack clear} + + {`Some input text.' `.' <> match 1 sprint 0 submatch 1 sprint} + {`Some input text.' `.' <> regex match 1 sprint 0 submatch 1 sprint} + {`Some input text.' `.' match 1 sprint 0 submatch 1 sprint} + {`Some input text.' `.' regex match 1 sprint 0 submatch 1 sprint} + + { + `INPUT Input input' `input' <$g true> + + {3 ndup match}{ + 0 submatch 1 sprint + } while + 3 npop + } + { + `INPUT Input input' `input' <$g true> regex + + {2 ndup match}{ + 0 submatch 1 sprint + } while + 2 npop + } + { + `INPUT Input input' `input' <$g true $i true> + + {3 ndup match}{ + 0 submatch 1 sprint + } while + 3 npop + } + { + `INPUT Input input' `input' <$g true $i true> regex + + {2 ndup match}{ + 0 submatch 1 sprint + } while + 2 npop + } + + { + `Some multiline\ninput text.' `^\w+' <$g true> + + {3 ndup match}{ + 0 submatch 1 sprint + } while + 3 npop + } + { + `Some multiline\ninput text.' `^\w+' <$g true> regex + + {2 ndup match}{ + 0 submatch 1 sprint + } while + 2 npop + } + { + `Some multiline\ninput text.' `^\w+' <$g true $m true> + + {3 ndup match}{ + 0 submatch 1 sprint + } while + 3 npop + } + { + `Some multiline\ninput text.' `^\w+' <$g true $m true> regex + + {2 ndup match}{ + 0 submatch 1 sprint + } while + 2 npop + } + + { + `Some multiline\ninput text.' `\w+.' <$g true> + + {3 ndup match}{ + 0 submatch 1 sprint + } while + 3 npop + } + { + `Some multiline\ninput text.' `\w+.' <$g true> regex + + {2 ndup match}{ + 0 submatch 1 sprint + } while + 2 npop + } + { + `Some multiline\ninput text.' `\w+.' <$g true $s true> + + {3 ndup match}{ + 0 submatch 1 sprint + } while + 3 npop + } + { + `Some multiline\ninput text.' `\w+.' <$g true $s true> regex + + {2 ndup match}{ + 0 submatch 1 sprint + } while + 2 npop + } +]{ + dup 1 sprint + eval +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_b.nx.exp new file mode 100644 index 000000000..ed8119e0a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_b.nx.in new file mode 100644 index 000000000..61d19a9d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`pattern' <> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_c.nx.exp new file mode 100644 index 000000000..7ab1c34c7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`pattern') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_c.nx.in new file mode 100644 index 000000000..0ea338901 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`pattern' match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_d.nx.exp new file mode 100644 index 000000000..de493af6d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_d.nx.in new file mode 100644 index 000000000..801a920b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_e.nx.exp new file mode 100644 index 000000000..c4a937742 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_e.nx.in new file mode 100644 index 000000000..34564d6a8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_f.nx.exp new file mode 100644 index 000000000..5d7c98ed9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_f.nx.in new file mode 100644 index 000000000..de44fab5f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' mark match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_g.nx.exp new file mode 100644 index 000000000..da51348bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' -mark- -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_g.nx.in new file mode 100644 index 000000000..7565ae97d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' mark <> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_h.nx.exp new file mode 100644 index 000000000..79bcf1aaf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_h.nx.in new file mode 100644 index 000000000..633f11a27 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `pattern' <> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_i.nx.exp new file mode 100644 index 000000000..75c45620e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_i.nx.in new file mode 100644 index 000000000..5d8e917a1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$i 0> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_j.nx.exp new file mode 100644 index 000000000..75c45620e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_j.nx.in new file mode 100644 index 000000000..b6aa23e3b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$m 0> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_k.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_k.nx.exp new file mode 100644 index 000000000..75c45620e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_k.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_k.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_k.nx.in new file mode 100644 index 000000000..de8ab5584 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_k.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$c 0> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_l.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_l.nx.exp new file mode 100644 index 000000000..75c45620e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_l.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_l.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_l.nx.in new file mode 100644 index 000000000..0fa535dcc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_l.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$s 0> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_m.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_m.nx.exp new file mode 100644 index 000000000..75c45620e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_m.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_m.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_m.nx.in new file mode 100644 index 000000000..9c2896fe0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_m.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$g 0> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_n.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_n.nx.exp new file mode 100644 index 000000000..9d7c3672b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_n.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $regexerror +ostack: (`input' `(pattern' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --match-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_n.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_n.nx.in new file mode 100644 index 000000000..21f6148e9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/match_n.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `(pattern' <> match + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_a.nx.in new file mode 100644 index 000000000..364b53e06 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$fifo_name argv 2 get `/mkfifo_a' cat def + +fifo_name `p' test { + fifo_name unlink +} if + +fifo_name mkfifo +fifo_name `p' test { + fifo_name unlink +}{ + `fifo does not exist (1)\n' print +} ifelse + +fifo_name 8@444 mkfifo +fifo_name `p' test { + fifo_name unlink +}{ + `fifo does not exist (2)\n' print +} ifelse + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_b.nx.exp new file mode 100644 index 000000000..37400134f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mkfifo-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_b.nx.in new file mode 100644 index 000000000..2dfee26ff --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mkfifo + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_c.nx.exp new file mode 100644 index 000000000..1ca33491c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mkfifo-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_c.nx.in new file mode 100644 index 000000000..7ac25a20b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark mkfifo + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_d.nx.exp new file mode 100644 index 000000000..b622f02a0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 365) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mkfifo-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_d.nx.in new file mode 100644 index 000000000..d65fe99ef --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 8@555 mkfifo + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_e.nx.exp new file mode 100644 index 000000000..a57f2b572 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (365) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mkfifo-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_e.nx.in new file mode 100644 index 000000000..2023c63aa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mkfifo_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +8@555 mkfifo + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_a.nx.exp new file mode 100644 index 000000000..7bf70d007 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_a.nx.exp @@ -0,0 +1,14 @@ +Test begin +`0 1 mod' +0 +`4 2 mod' +0 +`5 2 mod' +1 +`5 -3 mod' +2 +`-5 3 mod' +-2 +`-5 -3 mod' +-2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_a.nx.in new file mode 100644 index 000000000..70bf9a905 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_a.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 mod' + `4 2 mod' + `5 2 mod' + `5 -3 mod' + `-5 3 mod' + `-5 -3 mod' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_b.nx.exp new file mode 100644 index 000000000..66fdddced --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mod-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_b.nx.in new file mode 100644 index 000000000..cd1c9ab41 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mod + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_c.nx.exp new file mode 100644 index 000000000..53611e7cc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mod-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_c.nx.in new file mode 100644 index 000000000..605ae261e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark mod + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_d.nx.exp new file mode 100644 index 000000000..77c943d10 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mod-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_d.nx.in new file mode 100644 index 000000000..a926f9dfb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 mod + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_e.nx.exp new file mode 100644 index 000000000..25aae074f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefinedresult +ostack: (1 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mod-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_e.nx.in new file mode 100644 index 000000000..b39f0ca43 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mod_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 0 mod + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_a.nx.exp new file mode 100644 index 000000000..11458b8f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_a.nx.exp @@ -0,0 +1,25 @@ +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello +hello diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_a.nx.in new file mode 100644 index 000000000..24766be8b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +$iterations 25 def + +$thread_entry { + {`hello\n' print flush} monitor +} bind def + +mutex +iterations { + dup stack dup 3 2 roll spush $thread_entry load thread exch +} repeat +pop + +iterations { + join +} repeat diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_b.nx.exp new file mode 100644 index 000000000..59c0bb5fb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_b.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (-mark- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --monitor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_b.nx.in new file mode 100644 index 000000000..04cda7bee --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +mark {`hello\n' print} monitor diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_c.nx.exp new file mode 100644 index 000000000..854dcb335 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_c.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (-array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --monitor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_c.nx.in new file mode 100644 index 000000000..df2b6eeb7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/monitor_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +{`hello\n' print} monitor diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_a.nx.exp new file mode 100644 index 000000000..f8c216bdd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`0 0 mul' +0 +`0 5 mul' +0 +`5 0 mul' +0 +`5 -3 mul' +-15 +`-5 3 mul' +-15 +`7 13 mul' +91 +`-7 -13 mul' +91 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_a.nx.in new file mode 100644 index 000000000..8166ef4ae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 mul' + `0 5 mul' + `5 0 mul' + `5 -3 mul' + `-5 3 mul' + `7 13 mul' + `-7 -13 mul' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_b.nx.exp new file mode 100644 index 000000000..1d9d9489f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mul-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_b.nx.in new file mode 100644 index 000000000..7ac5aedb2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mul + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_c.nx.exp new file mode 100644 index 000000000..dea1e1bfe --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mul-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_c.nx.in new file mode 100644 index 000000000..6d11b08b4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark mul + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_d.nx.exp new file mode 100644 index 000000000..b9d93ddc1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mul-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_d.nx.in new file mode 100644 index 000000000..f2ff0ac5b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 mul + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_e.nx.exp new file mode 100644 index 000000000..6adfaec39 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_e.nx.exp @@ -0,0 +1,44 @@ +Test begin +`0.0 0 mul' +0.000000e+00 +`0.0 5 mul' +0.000000e+00 +`5.0 0 mul' +0.000000e+00 +`5.0 -3 mul' +-1.500000e+01 +`-5.0 3 mul' +-1.500000e+01 +`7.0 13 mul' +9.100000e+01 +`-7.0 -13 mul' +9.100000e+01 +`0 0.0 mul' +0.000000e+00 +`0 5.0 mul' +0.000000e+00 +`5 0.0 mul' +0.000000e+00 +`5 -3.0 mul' +-1.500000e+01 +`-5 3.0 mul' +-1.500000e+01 +`7 13.0 mul' +9.100000e+01 +`-7 -13.0 mul' +9.100000e+01 +`0.0 0.0 mul' +0.000000e+00 +`0.0 5.0 mul' +0.000000e+00 +`5.0 0.0 mul' +0.000000e+00 +`5.0 -3.0 mul' +-1.500000e+01 +`-5.0 3.0 mul' +-1.500000e+01 +`7.0 13.0 mul' +9.100000e+01 +`-7.0 -13.0 mul' +9.100000e+01 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_e.nx.in new file mode 100644 index 000000000..db3c21040 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/mul_e.nx.in @@ -0,0 +1,45 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0.0 0 mul' + `0.0 5 mul' + `5.0 0 mul' + `5.0 -3 mul' + `-5.0 3 mul' + `7.0 13 mul' + `-7.0 -13 mul' + + `0 0.0 mul' + `0 5.0 mul' + `5 0.0 mul' + `5 -3.0 mul' + `-5 3.0 mul' + `7 13.0 mul' + `-7 -13.0 mul' + + `0.0 0.0 mul' + `0.0 5.0 mul' + `5.0 0.0 mul' + `5.0 -3.0 mul' + `-5.0 3.0 mul' + `7.0 13.0 mul' + `-7.0 -13.0 mul' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep.nx.exp new file mode 100644 index 000000000..6f4f33456 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep.nx.exp @@ -0,0 +1,3 @@ +Test begin +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep.nx.in new file mode 100644 index 000000000..161e339eb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep.nx.in @@ -0,0 +1,129 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# It was discovered in Onyx 3.0.0 that there was a race in the name object code. +# The following chain of events culminated in sweepin $_s, even though there +# were valid references to it: +# +# 1) $_s is created in the bootstrap code that is embedded in libonyx. +# +# 2) All references are discarded, making $_s collectible. +# +# 3) The garbage collector runs the mark phase, and $_s is set aside for +# sweeping. +# +# 4) A new $_s object is created, and it uses the existing entry in the name +# hash. +# +# 5) The garbage collector sweeps $_s. +# +# 6) The reference to $_s that was created in step 4 is dereferenced, resulting +# in a crash. +# +# Unfortunately, the timing conditions that allow this to happen appear to be +# rather atypical. This race existed for every released version of Onyx through +# and including 3.0.0, and it was not detected until the release test suite was +# run on a dual 1.6 GHz Athlon system, along with other system load besides the +# test suite. Even then, it only happens sometimes. There is no way to make +# this test always fail if the race is present, but if the test does fail, there +# is definitely a problem. +# +# The actual code in this test is based on the bootstrapping infrastructure for +# libonyx. +# +################################################################################ + +`Test begin\n' print flush + + +# Create an encoding dictionary for various operators. The values must not +# correspond to an existing name in dstack. +$_encdict < + $cat $a # 19 + $cvx $b # 13 + $def $c # ~21 + $dup $d # ~37 + $eval $e # 14 + $exch $f # ~57 + $false $g # 5 + $flush $h # 3 + $getinterval $i # 4 + $ifelse $j # 20 + $idup $k # ~57 + $known $l # 8 + $load $m # 9 + $pop $n # ~69 + $putinterval $o # 3 + $roll $p # 16 + $scount $q # 3 + $spop $r # 7 + $sub $s # 15 + $true $t # 4 + $type $u # >= 17 + $xcheck $v # 3 + $ostack $w # 3 +> def + +# #proc _encarr - +$_encarr { + 0 1 2 idup length 1 sub { + # #proc #i + 1 idup 1 idup get + # #proc #i #el + dup type $nametype eq { + dup xcheck { + # Executable Name. Try to replace. + _encdict 1 idup known { + _encdict exch get cvx + # #proc #i #e + 2 idup 3 1 roll + # #proc #proc #i #e + put + }{ + pop pop + } ifelse + }{ + pop pop + } ifelse + }{ + dup type $arraytype eq { + # Array. Recurse. + _encarr + pop + }{ + # Other. Do nothing. + pop pop + } ifelse + } ifelse + # #proc + } for + pop +} def + +100 { + # Read in the code. + argv 1 get `/name_unsweep_data.nx.in' cat `r' open + cvx dup eval exch close + + # We now have an array of code. Recursively iterate through the elements of + # the array and replace executable names with their equivalents in the + # temporary shorthand dictionary. + dup _encarr + + # Output the procedure, using a recursion depth large enough to meet or + # exceed the depth of nested braces in the code. + 1000 sprints pop + + `+' print flush +} repeat +`\n' print + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep_data.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep_data.nx.in new file mode 100644 index 000000000..6aefd4752 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/name_unsweep_data.nx.in @@ -0,0 +1,996 @@ +################################################################################ +# +# Copyright (C) 1996-2002 Jason Evans . +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice(s), this list of conditions and the following disclaimer +# unmodified other than the allowable addition of one or more +# copyright notices. +# 2. Redistributions in binary form must reproduce the above copyright +# notice(s), this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################ +# +# Version: Onyx 3.0.0 +# +# This file is processed by nx_gen.nx to produce a more compact embedded version +# in nx_nxcode.c (normal build) and nx_bootstrap.c (development bootstrap). In +# order to make changes to this file take effect in the bootstrap interpreter, +# either type: +# +# cook bootstrap +# +# or +# +# cat nx.nx | onyx nx_gen.nx > nx_boostrap.c +# +# The end result of executing this file is a procedure (executable array). In +# order to support output that differs according to configuration options, a +# string is constructed, then evaluated. +# +# The output of running sprints on the procedure must be evaluatable, which +# means that certain language features such as immediate evaluation must be +# avoided. +# +################################################################################ + +# Initial string with an opening brace to defer execution, to which other +# strings are catenated. +`{' + +` +systemdict begin + +# +# sprintsdict implements syntactic printing to strings for every type. +# +$sprintsdict < + $arraytype { + # #array #depth + dup 0 gt { + 1 idup dup echeck { + pop + `_{' + }{ + xcheck { + `{' + }{ + `[' + } ifelse + } ifelse + + # #array #depth #accum + 2 idup length 1 gt { + # #array #depth #accum + 0 1 4 idup length 2 sub { + # #array #depth #accum #i + 3 idup exch get + 2 idup 1 sub + # #array #depth #accum #el #rdepth + 1 idup type sprintsdict exch get eval + cat + # #array #depth #accum #el #rdepth + ` ' cat + } for + } if + # #array #depth #accum + + 2 idup length 0 gt { + 2 idup dup length 1 sub get + 2 idup 1 sub + # #array #depth #accum #el #rdepth + 1 idup type sprintsdict exch get eval + cat + } if + # #array #depth #accum + + exch pop + # #array #accum + exch dup echeck { + pop + `}_' + }{ + xcheck { + `}' + }{ + `]' + } ifelse + } ifelse + cat + # #accum + }{ + pop pop + `-array-' + } ifelse + } + $booleantype { + pop + cvs + } +' cat +1 1 eq { + ` + $conditiontype { + pop pop + `-condition-' + } + ' cat +} if +` + $dicttype { + # #dict #depth + dup 0 gt { + # Update recursion depth. + 1 sub + + 0 + `<' + + # #dict #rdepth #i #accum + 3 idup { + # #dict #rdepth #i #accum #key #value + exch 4 idup + # #dict #rdepth #i #accum #value #key #rdepth + 1 idup type sprintsdict exch get eval + ` ' cat + # #dict #rdepth #accum #i #value #keystr + exch 4 idup + # #dict #rdepth #i #accum #keystr #value #rdepth + 1 idup type sprintsdict exch get eval + # #dict #rdepth #i #accum #keystr #valstr + cat cat + # #dict #rdepth #i #accum + + # Update counter. + exch 1 add dup 4 idup length lt { + # #dict #rdepth #accum #i + exch + ` ' cat + # #dict #rdepth #i #accum + }{ + # Last element. + exch + # #dict #rdepth #accum + } ifelse + } foreach + # #dict #rdepth #i #accum + + 4 1 roll pop pop pop + # #accum + `>' + cat + # #accum + }{ + pop pop + `-dict-' + } ifelse + } + $filetype { + pop pop + `-file-' + } + $finotype { + pop pop + `-fino-' + } + $hooktype { + # #hook #depth + exch hooktag + # #depth #tag + dup type $nulltype ne { + exch 1 sub + # #tag #rdepth + 1 idup type sprintsdict exch get eval + # #tagstr + `=' exch cat + `=' cat + }{ + pop pop + `-hook-' + } ifelse + } + $integertype { + pop + cvs + } + $marktype { + pop pop + `-mark-' + } +' cat +1 1 eq { + ` + $mutextype { + pop pop + `-mutex-' + } + ' cat +} if +` + $nametype { + pop + dup cvs + exch xcheck not { + `$' exch cat + } if + } + $nulltype { + pop pop + `null' + } + $operatortype { + pop + cvs + dup `-operator-' ne { + `--' dup 3 1 roll + cat cat + } if + } + $pmarktype { + pop pop + `-pmark-' + } +' cat + +1 1 eq { + ` + $realtype { + pop + cvs + } + ' cat +} if +` + $stacktype { + # #stack #depth + dup 0 gt { + `(' + + # #stack #depth #accum + 2 idup scount 1 gt { + # #stack #depth #accum + 2 idup scount 1 sub -1 1 { + # #stack #depth #accum #i + 3 idup dup 3 2 roll sidup spop + 2 idup 1 sub + # #stack #depth #accum #el #rdepth + 1 idup type sprintsdict exch get eval + cat + # #stack #depth #accum #el #rdepth + ` ' cat + } for + } if + # #stack #depth #accum + + 2 idup scount 0 gt { + 2 idup dup sdup spop + 2 idup 1 sub + # #stack #depth #accum #el #rdepth + 1 idup type sprintsdict exch get eval + cat + } if + # #stack #depth #accum + + 3 1 roll pop pop + # #accum + `)' + cat + # #accum + }{ + pop pop + `-stack-' + } ifelse + } + $stringtype { + pop + cvs + } + $threadtype { + pop pop + `-thread-' + } +> def + +# #object #depth sprints #string +$sprints { + 1 idup type sprintsdict exch get eval +} def + +$sprint { + sprints print + `\n' print flush +} def + +# +# outputsdict implements formatted output to strings for every type. +# +$outputsdict < + $integertype { + # #int #flags + + # Get the base. + dup $b known { + dup $b get + }{ + 10 + } ifelse + # #int #flags #base + + 2 idup exch cvrs + # #int #flags #str + + # Prepend the sign if necessary. + 1 idup $s known { + 1 idup $s get $+ eq { + 2 idup 0 ge { + `+' exch cat + } if + } if + } if + # #int #flags #str + 3 2 roll pop + # #flags #str + exch + # #str #flags + outputsdict $stringtype get eval + # #str + } +' cat +1 1 eq { + ` + $realtype { + # #real #flags + + # Determine precision past decimal point. + dup $d known { + dup $d get + }{ + 6 + } ifelse + # #real #flags #precision + + # Determine whether to use decimal or exponential notation. + 1 idup $e known { + 1 idup $e get + }{ + false + } ifelse + # #real #flags #precision #exp? + + 3 idup 3 1 roll + # #real #flags #real #precision #exp? + { + # Use exponential notation. + cves + }{ + # Use decimal notation. + cvds + } ifelse + # #real #flags #str + + # Prepend the sign if necessary. + 1 idup $s known { + 1 idup $s get $+ eq { + 2 idup 0 ge { + `+' exch cat + } if + } if + } if + # #real #flags #str + 3 2 roll pop exch + # #str #flags + + outputsdict $stringtype get eval + # #str + } + ' cat +} if +` + # Temporarily define. + $_s { + # Check for $w flag. $w takes precedence over $n. + dup $w known { + # Get padding character. + dup $p known { + dup $p get + }{ + ` ' + } ifelse + # #str #flags #pad + + 1 idup $w get + # #str #flags #pad #width + 3 idup length + # #str #flags #pad #width #len + + dup 2 idup le { + # Pad string. + # #str #flags #pad #width #len + + 1 idup string + # #str #flags #pad #width #len #pstr + + # Fill #pstr with #pad. + 0 1 4 idup 1 sub { + 1 idup exch 5 idup putinterval + } for + # #str #flags #pad #width #len #pstr + 4 3 roll pop + # #str #flags #width #len #pstr + + # Get the justification. + 3 idup $j known { + 3 idup $j get + }{ + $r + } ifelse + # #str #flags #width #len #pstr #just + + dup $r eq { + pop + # Right justify. + # #str #flags #width #len #pstr + 3 1 roll sub + }{ + $l eq { + # Left justify. + # #str #flags #width #len #pstr + 3 1 roll pop pop + 0 + }{ + # Center. + # #str #flags #width #len #pstr + 3 1 roll sub 2 idiv + } ifelse + } ifelse + # #str #flags #pstr #offset + + 1 idup exch + # #str #flags #pstr #pstr #offset + 5 4 roll + # #flags #pstr #pstr #offset #str + putinterval + # #flags #pstr + exch + # #pstr #flags + }{ + # No padding necessary. + pop pop pop + } ifelse + # #str #flags + }{ + # #str #flags + dup $n known { + # Truncate the string if it is too long. + 1 idup length + 1 idup $n get + # #str #flags #len #max + dup 2 idup lt { + # Truncate. + exch pop + dup string + # #str #flags #max #nstr + dup + # #str #flags #max #nstr #nstr + 5 4 roll + # #flags #max #nstr #nstr #str + 4 3 roll + # #flags #nstr #nstr #str #max + 0 exch getinterval + # #flags #nstr #nstr #substr + 0 exch putinterval + # #flags #nstr + exch + }{ + pop pop + } ifelse + # #nstr #flags + } if + # #str #flags + } ifelse + # #str #flags + + pop + # #str + } def + $stringtype $_s load + + # Most types can be handled identically. The following code uses the + # same procedure body for all of those types. + # + # The following block of code looks scary because it avoids deferred + # execution in order to "bind" things correctly (we cannot use immediate + # evaluation in this file). + [ + # #object #flags + + # Get recursion depth. + $dup cvx $r $known cvx [ + $dup cvx $r $get cvx + ] cvx [ + 1 + ] cvx $ifelse cvx + # #object #flags #rdepth + + 3 2 $roll cvx $exch cvx + # #flags #object #rdepth + $sprints cvx $exch cvx + # #str #flags + $_s load cve + # #str + ] cvx bind + [ + $arraytype + $booleantype +' cat +1 1 eq { + ` + $conditiontype + ' cat +} if +` + $dicttype + $filetype + $finotype + $hooktype + $marktype +' cat +1 1 eq { + ` + $mutextype + ' cat +} if +` + $nametype + $nulltype + $operatortype + $pmarktype + $stacktype + $threadtype + ]{ + # #proc #name + exch dup + # #name #proc #proc + } foreach + # Get rid of the extra copy of #proc. + pop + + # Now that we are done using _s, undef it. + currentdict $_s undef +> def + +# +# Formatted output to a string. Supported flags: +# +# All types: +# +# $n : maximum width +# : #integer +# $w : minimum width +# : #integer +# $j : justification +# : $l, $c, $r +# $p : padding character +# : `?' +# $r : recursion depth +# : 0..n +# +# Integers only: +# +# $b : base +# : 2..36 +# $s : sign +# : $+ $- +# +# Reals only: +# +# $d : digits of precision past decimal +# : #integer (default 6) +# $e : exponential notation +# : #boolean (default false) +# +# #obj #flags outputs #string +$outputs { + dup type $dicttype ne { + $typecheck throw + } if + 1 idup type + # #obj #flags #type + outputsdict exch get eval +} def + +#obj #flags output - +$output { + outputs print +} def + +# - product #string +$product `Canonware Onyx' def + +$pstack { + ostack { + 1 sprint + } foreach + flush +} def + +# +# #string #pattern search #post #pattern #pre true +# #string #pattern search #string false +# +$search { + # Make sure the arguments are strings. + # Pattern. + dup type $stringtype ne { + $typecheck throw + } if + # String. + 1 idup type $stringtype ne { + $typecheck throw + } if + + # Make sure substring is not longer than string. + dup length 2 idup length le { + # Use a nested looping algorithm. The outer loop advances the + # offset #s_i at which to start the search in the string #s, + # and the inner loop compares byte by byte with the pattern #p. + # + # Take care not to cause a rangecheck error. + 0 1 3 idup length 3 idup length sub { + # #s #p #s_i + + # Create a substring #s_sub of #s that is the same + # length as #p, starting at #s_i. + dup 3 idup exch 3 idup length getinterval + + # #s #p #s_i #s_sub + dup length 1 sub 0 1 + 3 2 roll + { + # #s #p #s_i #s_sub #offset + dup 2 idup exch get + exch 4 idup exch get + ne { + # Not equal. Exit the inner loop. + false exit + } if + } for + + # Check to see if the substring match failed. + dup type $booleantype eq { + # #s #p #s_i #s_sub# false + # Failure. Clean up. + pop pop pop + }{ + # #s #p #s_i #s_sub + # Success. + 3 2 roll pop + # #s #s_i# #s_sub + + # Contstruct pre string #s_pre. + 3 1 roll dup 2 idup exch 0 exch + # #s_sub #s #s_i #s 0 #s_i + getinterval + # #s_sub #s #s_i #s_pre + 3 1 roll + # #s_sub #s_pre #s #s_i + + # Contstruct post string #s_post. + 3 idup length add dup + 2 idup length exch sub + getinterval + # #s_sub #s_pre #s_post + 3 1 roll + + true + # #s_post #s_sub #s_pre true + exit + } ifelse + } for + + # Check to see if we succeeded. If not, set up the stack to + # return failure. + dup type $booleantype ne { + # Failure. + pop false + } if + }{ + # Substring is too long. + pop false + } ifelse +} def +' cat +1 1 eq { + ` +# [`' `'...] system #exit_code +$system { + # Make sure argument is an array. + dup type $arraytype ne { + $typecheck throw + } if + # Make sure array is non-empty. + dup length 0 eq { + $rangecheck throw + } if + # Make sure array elements are strings. + dup { + { + type $stringtype ne { + stop + } if + } foreach + } stopped { + $typecheck throw + } if + + fork + dup 0 eq { + # Child. + systemdict begin + $throw {1 die} def + end + pop exec + }{ + # Parent. + exch pop waitpid + } ifelse +} def + +# Define require and mrequire configuration parameters in onyxdict. By default, +# the search order is: +# +# 1) Absolute path: `'. +# 2) Relative path: `.'. +# 3) $ONYX_[MR]PATH: Colon-separated string in envdict. +# 4) `/usr/local/share/3.0.0/nx[m]': Standard installation location. +onyxdict begin +$rpath_pre [`' `.'] def +$rpath_post [`/usr/local/share/onyx-3.0.0/nx'] def + +$mpath_pre [`' `.'] def +$mpath_post [`/usr/local/share/onyx-3.0.0/nxm'] def +end # onyxdict. + +# #filename require - +$require { + # Make sure the argument is a string. + dup type $stringtype ne { + $typecheck throw + } if + + { + [ + onyxdict $rpath_pre get + + envdict $ONYX_RPATH 2 ndup known { + get + + # Push mark that denotes start of array. + [ exch + { + # [ ... #cpath + `:' search { + # #post `:' #dir + exch pop exch + # [ ... #dir #post + }{ + # Last path component. + # #dir + exit + } ifelse + } loop + # Create array. + ] + }{ + 2 npop + } ifelse + + onyxdict $rpath_post get + ]{ + # #filename #path + { + # #filename #dir + `/' cat + 1 idup cat + # #filename #full_path + dup `f' test { + # Found. + # #filename #full_path + `r' open cvx eval + # #filename + pop + stop # Success. + }{ + # Not found. + # #filename #full_path + pop + } ifelse + } foreach + } foreach + } stopped not { + # Failure. + $undefinedfilename throw + } if + 1 pop # X X X Avoid tail call optimization. +} def + +# #filename #symbol mrequire - +$mrequire { + # Make sure the arguments are strings. + 1 idup type $stringtype ne { + $typecheck throw + } if + dup type $stringtype ne { + $typecheck throw + } if + + exch + # #symbol #filename + { + [ + onyxdict $mpath_pre get + + envdict $ONYX_MPATH 2 ndup known { + get + + # Push mark that denotes start of array. + [ exch + { + # [ ... #cpath + `:' search { + # #post `:' #dir + exch pop exch + # [ ... #dir #post + }{ + # Last path component. + # #dir + exit + } ifelse + } loop + # Create array. + ] + }{ + 2 npop + } ifelse + + onyxdict $mpath_post get + ]{ + # #symbol #filename #path + { + # #symbol #filename #dir + `/' cat + 1 idup cat + # #symbol #filename #full_path + dup `f' test { + # Found. + # #symbol #filename #full_path + 3 2 roll modload + # #filename + pop + stop # Success. + }{ + # Not found. + # #symbol #filename #full_path + pop + } ifelse + } foreach + } foreach + } stopped not { + # Failure. + # #symbol #filename + exch + $undefinedfilename throw + } if +} def + ' cat +} if +` +# $errorname throw - +$throw { + # Do some sanity checking, to try to avoid going infinitely recursive + # in the error handling machinery. + { + {$errordict where {pop true}{false} ifelse} + {$errordict load $handleerror known} + {$errordict load $stop known} + {$currenterror where {pop true}{false} ifelse} + }{ + eval not { + stderr `Onyx: Missing errordict or currenterror defs\n' + write + + # Print stack dumps. + stderr `ostack: ' write + ostack 2 sprints stderr exch write + + stderr `\ndstack: ' write + stderr dstack 2 sprints write + + stderr `\nestack: ' write + stderr estack 2 sprints write + + stderr `\nistack: ' write + stderr istack 2 sprints write + + stderr `\nOnyx: dieing\n' write + 1 die + } if + } foreach + + # Make sure the argument is a name. + dup type $nametype ne { + $typecheck $systemdict load $throw get eval + } if + + $currenterror load begin + + # Set newerror to true to indicate there is an error. It is up to the + # application to clear this afterwards if it wants to make newerror + # meaningful in the face of multiple errors. + $newerror true def + + # Set errorname to the argument passed in. + dup $errorname exch cvlit def + + # ostack. Get rid of $errorname in the snapshot. Ordering is important + # to keep from polluting the snapshot. + ostack dup spop pop $ostack exch def + + # dstack. Do not include the top element, which is the copy of + # currenterror that we pushed. + $dstack dstack dup spop pop def + + # estack. Remove this procedure from the snapshot. + $estack estack dup spop pop def + + # istack. Remove this procedure from the snapshot. + $istack istack dup spop pop def + + # Push the offending object onto ostack. + $estack load dup sdup spop + exch + # #object #errorname + + end # currenterror. + + # If there is an error handler for the error name, call it. Otherwise, + # call the errordict handleerror, then call the errordict stop. + $errordict load + # #object #errorname #errordict + dup 2 idup known { + # Call error handler. + exch get eval + }{ + # No error handler. + exch pop + dup $handleerror get eval + $stop get eval + } ifelse +} def + +# - version #string +$version `' def + +end # systemdict. +' cat + +# Final closing brace. +`}' cat cvx eval diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_a.nx.exp new file mode 100644 index 000000000..855c4fcce --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +`0 nbpop' +`\`a\' 1 nbpop' +`\`a\' \`b\' 1 nbpop' +`b' +`\`a\' \`b\' \`c\' 3 nbpop' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_a.nx.in new file mode 100644 index 000000000..eedbec1d7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 nbpop' + ``a' 1 nbpop' + ``a' `b' 1 nbpop' + ``a' `b' `c' 3 nbpop' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_b.nx.exp new file mode 100644 index 000000000..984d6f24d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_b.nx.in new file mode 100644 index 000000000..61d091ccf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +nbpop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_c.nx.exp new file mode 100644 index 000000000..26095241e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_c.nx.in new file mode 100644 index 000000000..554b60dc1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark nbpop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_d.nx.exp new file mode 100644 index 000000000..8d47d6b02 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (1 2 3 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_d.nx.in new file mode 100644 index 000000000..671e55a04 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 2 3 -1 nbpop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_e.nx.exp new file mode 100644 index 000000000..a54bf2078 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`a' 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_e.nx.in new file mode 100644 index 000000000..34cad5cec --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nbpop_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 2 nbpop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_a.nx.exp new file mode 100644 index 000000000..fd87c8343 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_a.nx.exp @@ -0,0 +1,70 @@ +Test begin +In: `0 ncat' +Out: +In: `[$a] 0 ncat' +Out: [$a] + +In: `[] 1 ncat' +Out: [] + +In: `[$a] 1 ncat' +Out: [$a] + +In: `[] [] 2 ncat' +Out: [] + +In: `[] [$c $d] 2 ncat' +Out: [$c $d] + +In: `[$a $b] [] 2 ncat' +Out: [$a $b] + +In: `[$a $b] [$c $d] 2 ncat' +Out: [$a $b $c $d] + +In: `[$a $b] [$c $d] [$e $f] 3 ncat' +Out: [$a $b $c $d $e $f] + +In: `() 1 ncat' +Out: () + +In: `($a) 1 ncat' +Out: ($a) + +In: `() () 2 ncat' +Out: () + +In: `() ($c $d) 2 ncat' +Out: ($c $d) + +In: `($a $b) () 2 ncat' +Out: ($a $b) + +In: `($a $b) ($c $d) 2 ncat' +Out: ($a $b $c $d) + +In: `($a $b) ($c $d) ($e $f) 3 ncat' +Out: ($a $b $c $d $e $f) + +In: `\`\' 1 ncat' +Out: `' + +In: `\`a\' 1 ncat' +Out: `a' + +In: `\`\' \`\' 2 ncat' +Out: `' + +In: `\`\' \`cd\' 2 ncat' +Out: `cd' + +In: `\`ab\' \`\' 2 ncat' +Out: `ab' + +In: `\`ab\' \`cd\' 2 ncat' +Out: `abcd' + +In: `\`ab\' \`cd\' \`ef\' 3 ncat' +Out: `abcdef' + +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_a.nx.in new file mode 100644 index 000000000..37c769f97 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_a.nx.in @@ -0,0 +1,52 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 ncat' + `[$a] 0 ncat' + `[] 1 ncat' + `[$a] 1 ncat' + `[] [] 2 ncat' + `[] [$c $d] 2 ncat' + `[$a $b] [] 2 ncat' + `[$a $b] [$c $d] 2 ncat' + `[$a $b] [$c $d] [$e $f] 3 ncat' + + `() 1 ncat' + `($a) 1 ncat' + `() () 2 ncat' + `() ($c $d) 2 ncat' + `($a $b) () 2 ncat' + `($a $b) ($c $d) 2 ncat' + `($a $b) ($c $d) ($e $f) 3 ncat' + + ``' 1 ncat' + ``a' 1 ncat' + ``' `' 2 ncat' + ``' `cd' 2 ncat' + ``ab' `' 2 ncat' + ``ab' `cd' 2 ncat' + ``ab' `cd' `ef' 3 ncat' + +]{ + `In: ' print + dup 1 sprint + cvx eval + `Out: ' print + pstack clear + `\n' print +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_b.nx.exp new file mode 100644 index 000000000..68dd1526d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_b.nx.in new file mode 100644 index 000000000..ebd3b04ee --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_c.nx.exp new file mode 100644 index 000000000..c8027be9a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_c.nx.in new file mode 100644 index 000000000..f1dcc72ea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_d.nx.exp new file mode 100644 index 000000000..d46b7a104 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_d.nx.in new file mode 100644 index 000000000..dcba389e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_e.nx.exp new file mode 100644 index 000000000..4f33aee4d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- -array- 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_e.nx.in new file mode 100644 index 000000000..9bb2b5706 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() [] 2 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_f.nx.exp new file mode 100644 index 000000000..128e12dc8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- `' 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_f.nx.in new file mode 100644 index 000000000..fd5106324 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() `' 2 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_g.nx.exp new file mode 100644 index 000000000..9948891fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- -stack- 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_g.nx.in new file mode 100644 index 000000000..9151fa786 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[] (`a') 2 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_h.nx.exp new file mode 100644 index 000000000..3e4ad781c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- -stack- -stack- 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_h.nx.in new file mode 100644 index 000000000..6f5ba79e7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[] (`a') (`b') 3 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_i.nx.exp new file mode 100644 index 000000000..91ea9d854 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-array- 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_i.nx.in new file mode 100644 index 000000000..fdf4d870a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[] 2 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_j.nx.exp new file mode 100644 index 000000000..4f13950b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`' 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_j.nx.in new file mode 100644 index 000000000..1fd16193b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' 2 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_k.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_k.nx.exp new file mode 100644 index 000000000..662ad29c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_k.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- -stack- 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ncat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_k.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_k.nx.in new file mode 100644 index 000000000..650249d97 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ncat_k.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +($a) ($b) 3 ncat + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_a.nx.exp new file mode 100644 index 000000000..d50434b74 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_a.nx.exp @@ -0,0 +1,23 @@ +Test begin +0 ndn: {} --> () +0 ndn: {0} --> (0) +1 ndn: {0} --> (0) +0 ndn: {1 0} --> (1 0) +1 ndn: {1 0} --> (1 0) +2 ndn: {1 0} --> (0 1) +0 ndn: {2 1 0} --> (2 1 0) +1 ndn: {2 1 0} --> (2 1 0) +2 ndn: {2 1 0} --> (2 0 1) +3 ndn: {2 1 0} --> (1 0 2) +0 ndn: {3 2 1 0} --> (3 2 1 0) +1 ndn: {3 2 1 0} --> (3 2 1 0) +2 ndn: {3 2 1 0} --> (3 2 0 1) +3 ndn: {3 2 1 0} --> (3 1 0 2) +4 ndn: {3 2 1 0} --> (2 1 0 3) +0 ndn: {4 3 2 1 0} --> (4 3 2 1 0) +1 ndn: {4 3 2 1 0} --> (4 3 2 1 0) +2 ndn: {4 3 2 1 0} --> (4 3 2 0 1) +3 ndn: {4 3 2 1 0} --> (4 3 1 0 2) +4 ndn: {4 3 2 1 0} --> (4 2 1 0 3) +5 ndn: {4 3 2 1 0} --> (3 2 1 0 4) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_a.nx.in new file mode 100644 index 000000000..708113ef2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {} + {0} + {1 0} + {2 1 0} + {3 2 1 0} + {4 3 2 1 0} +]{ + $proc exch def + 0 1 $proc load length { + dup cvs print + ` ndn: ' print + $proc load 1 sprints print + ` --> ' print + + proc + adn ndn + ostack 1 sprint + clear + } for +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_b.nx.exp new file mode 100644 index 000000000..4d2e09fcd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_b.nx.in new file mode 100644 index 000000000..c20e19e39 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_c.nx.exp new file mode 100644 index 000000000..84f2797ef --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_c.nx.in new file mode 100644 index 000000000..a15a596af --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark ndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_d.nx.exp new file mode 100644 index 000000000..85a81e87f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_d.nx.in new file mode 100644 index 000000000..89a8e5ee7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1 ndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_e.nx.exp new file mode 100644 index 000000000..c72102e75 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_e.nx.in new file mode 100644 index 000000000..7c4b2bd77 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 ndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_f.nx.exp new file mode 100644 index 000000000..7f3708688 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1 0 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_f.nx.in new file mode 100644 index 000000000..4b0b55666 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndn_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 0 3 ndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_a.nx.exp new file mode 100644 index 000000000..e5b0f5985 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_a.nx.exp @@ -0,0 +1,15 @@ +Test begin +`First:\n' +`Second:\n' +`a' +`a' +`Third:\n' +`b' +`b' +`a' +`Fourth:\n' +`b' +`a' +`b' +`a' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_a.nx.in new file mode 100644 index 000000000..6c1dfe0c4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 ndup +`First:\n' +pstack clear + +`a' 1 ndup +`Second:\n' +pstack clear + +`a' `b' 1 ndup +`Third:\n' +pstack clear + +`a' `b' 2 ndup +`Fourth:\n' +pstack clear + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_b.nx.exp new file mode 100644 index 000000000..6b16d90ae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_b.nx.in new file mode 100644 index 000000000..95a316e14 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +ndup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_c.nx.exp new file mode 100644 index 000000000..c837dcd5e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_c.nx.in new file mode 100644 index 000000000..42bdb4dca --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 ndup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_d.nx.exp new file mode 100644 index 000000000..48ad7b36a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (1 2 3 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_d.nx.in new file mode 100644 index 000000000..fcceb3e57 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 2 3 -1 ndup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_e.nx.exp new file mode 100644 index 000000000..ffe860da7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_e.nx.in new file mode 100644 index 000000000..7affd0124 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ndup_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark ndup + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_a.nx.exp new file mode 100644 index 000000000..213b3ef10 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_a.nx.exp @@ -0,0 +1,64 @@ +Test begin +`-1 -1' +false +`0 0' +false +`1 1' +false +`-2 -1' +true +`-1 0' +true +`0 1' +true +`1 2' +true +`-1 1' +true +`-1 -2' +true +`0 -1' +true +`1 0' +true +`2 1' +true +`1 -1' +true +`\`abc\' \`abc\'' +false +`\`abc\' \`abd\'' +true +`\`abd\' \`abc\'' +true +`dict dict' +true +`dict stack' +true +`~pop ~spop' +true +`~pop ~roll' +true +`$foo $bar' +true +`$foo \`bar\'' +true +`true false' +true +`false true' +true +`stack dup' +false +`~pop ~pop' +false +`$foo $foo' +false +`$foo \`foo\'' +false +`\`foo\' $foo' +false +`true dup' +false +`false dup' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_a.nx.in new file mode 100644 index 000000000..41a02a4ff --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_a.nx.in @@ -0,0 +1,69 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1 -1' + `0 0' + `1 1' + + # Less than. + `-2 -1' + `-1 0' + `0 1' + `1 2' + `-1 1' + + # Greater than. + `-1 -2' + `0 -1' + `1 0' + `2 1' + `1 -1' + + # Equal. + ``abc' `abc'' + + # Less than. + ``abc' `abd'' + + # Greater than. + ``abd' `abc'' + + # Not equal. + `dict dict' + `dict stack' + `~pop ~spop' + `~pop ~roll' + `$foo $bar' + `$foo `bar'' + `true false' + `false true' + + # Equal. + `stack dup' + `~pop ~pop' + `$foo $foo' + `$foo `foo'' + ``foo' $foo' + `true dup' + `false dup' +]{ + dup 1 sprint + cvx eval + ne + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_b.nx.exp new file mode 100644 index 000000000..ff1ecf9d8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --ne-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_b.nx.in new file mode 100644 index 000000000..c16dde319 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 ne + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_c.nx.exp new file mode 100644 index 000000000..7124f857a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_c.nx.exp @@ -0,0 +1,80 @@ +Test begin +`-1.0 -1' +false +`0.0 0' +false +`1.0 1' +false +`-1 -1.0' +false +`0 0.0' +false +`1 1.0' +false +`-1.0 -1.0' +false +`0.0 0.0' +false +`1.0 1.0' +false +`-2.0 -1' +true +`-1.0 0' +true +`0.0 1' +true +`1.0 2' +true +`-1.0 1' +true +`-2 -1.0' +true +`-1 0.0' +true +`0 1.0' +true +`1 2.0' +true +`-1 1.0' +true +`-2.0 -1.0' +true +`-1.0 0.0' +true +`0.0 1.0' +true +`1.0 2.0' +true +`-1.0 1.0' +true +`-1.0 -2' +true +`0.0 -1' +true +`1.0 0' +true +`2.0 1' +true +`1.0 -1' +true +`-1 -2.0' +true +`0 -1.0' +true +`1 0.0' +true +`2 1.0' +true +`1 -1.0' +true +`-1.0 -2.0' +true +`0.0 -1.0' +true +`1.0 0.0' +true +`2.0 1.0' +true +`1.0 -1.0' +true +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_c.nx.in new file mode 100644 index 000000000..d7ac54e55 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/ne_c.nx.in @@ -0,0 +1,73 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + # Equal. + `-1.0 -1' + `0.0 0' + `1.0 1' + + `-1 -1.0' + `0 0.0' + `1 1.0' + + `-1.0 -1.0' + `0.0 0.0' + `1.0 1.0' + + # Less than. + `-2.0 -1' + `-1.0 0' + `0.0 1' + `1.0 2' + `-1.0 1' + + `-2 -1.0' + `-1 0.0' + `0 1.0' + `1 2.0' + `-1 1.0' + + `-2.0 -1.0' + `-1.0 0.0' + `0.0 1.0' + `1.0 2.0' + `-1.0 1.0' + + # Greater than. + `-1.0 -2' + `0.0 -1' + `1.0 0' + `2.0 1' + `1.0 -1' + + `-1 -2.0' + `0 -1.0' + `1 0.0' + `2 1.0' + `1 -1.0' + + `-1.0 -2.0' + `0.0 -1.0' + `1.0 0.0' + `2.0 1.0' + `1.0 -1.0' +]{ + dup 1 sprint + cvx eval + ne + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_a.nx.exp new file mode 100644 index 000000000..94e339ff9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +`0 neg' +0 +`5 neg' +-5 +`-5 neg' +5 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_a.nx.in new file mode 100644 index 000000000..0dce6c7e1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 neg' + `5 neg' + `-5 neg' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_b.nx.exp new file mode 100644 index 000000000..80461c2d0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --neg-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_b.nx.in new file mode 100644 index 000000000..3b22e5845 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +neg + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_c.nx.exp new file mode 100644 index 000000000..5f06b156f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --neg-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_c.nx.in new file mode 100644 index 000000000..d72aab9cf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark neg + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_d.nx.exp new file mode 100644 index 000000000..beeb768f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +`0.0 neg neg' +0.000000e+00 +`5.0 neg' +-5.000000e+00 +`-5.0 neg' +5.000000e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_d.nx.in new file mode 100644 index 000000000..db0de5085 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/neg_d.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0.0 neg neg' + `5.0 neg' + `-5.0 neg' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_a.nx.exp new file mode 100644 index 000000000..cf379278e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +`1 0 nip' +0 +`2 1 0 nip' +0 +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_a.nx.in new file mode 100644 index 000000000..ae082f6bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1 0 nip' + `2 1 0 nip' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_b.nx.exp new file mode 100644 index 000000000..9031fdf38 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nip-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_b.nx.in new file mode 100644 index 000000000..7b6920671 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nip_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 nip + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_a.nx.exp new file mode 100644 index 000000000..56a43a58a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +`false' +true +`true' +false +`0' +-1 +`1' +-2 +`16@7fffffffffffffff' +-9223372036854775808 +`2@0101010101010101010101010101010101010101010101010101010101010101' +-6148914691236517206 +`2@0010101010101010101010101010101010101010101010101010101010101010' +-3074457345618258603 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_a.nx.in new file mode 100644 index 000000000..a17771c32 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `false' + `true' + + `0' + `1' + `16@7fffffffffffffff' + `2@0101010101010101010101010101010101010101010101010101010101010101' + `2@0010101010101010101010101010101010101010101010101010101010101010' +]{ + dup 1 sprint + cvx eval + not + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_b.nx.exp new file mode 100644 index 000000000..32a5ac49e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --not-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_b.nx.in new file mode 100644 index 000000000..eba4e8f83 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +not + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_c.nx.exp new file mode 100644 index 000000000..511351753 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --not-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_c.nx.in new file mode 100644 index 000000000..676e568ac --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/not_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark not + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_a.nx.exp new file mode 100644 index 000000000..6656c0eeb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +First: +Second: +Third: +`a' +Fourth: +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_a.nx.in new file mode 100644 index 000000000..0a80e862a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 npop +`First:\n' print +pstack clear + +`a' 1 npop +`Second:\n' print +pstack clear + +`a' `b' 1 npop +`Third:\n' print +pstack clear + +`a' `b' `c' 3 npop +`Fourth:\n' print +pstack clear + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_b.nx.exp new file mode 100644 index 000000000..7c9b23af6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --npop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_b.nx.in new file mode 100644 index 000000000..52b361cda --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +npop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_c.nx.exp new file mode 100644 index 000000000..fef721478 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --npop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_c.nx.in new file mode 100644 index 000000000..91c8f9300 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark npop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_d.nx.exp new file mode 100644 index 000000000..ebf3b3baf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (1 2 3 -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --npop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_d.nx.in new file mode 100644 index 000000000..663ebec21 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 2 3 -1 npop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_e.nx.exp new file mode 100644 index 000000000..adff11b09 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`a' 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --npop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_e.nx.in new file mode 100644 index 000000000..65e4af3a1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/npop_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 2 npop + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_a.nx.in new file mode 100644 index 000000000..ce6c78b00 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_a.nx.in @@ -0,0 +1,34 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +# Check that we're really sleeping long enough. + +`Test begin\n' print flush + +$sleepinterval 100000000 def + +10 { + realtime + sleepinterval nsleep + realtime exch sub # Actual interval slept. + dup sleepinterval lt { + `Didn\'t sleep long enough: ' print + cvs print + ` vs ' print + sleepinterval cvs print + `\n' print + }{ + pop + } ifelse +} repeat + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_b.nx.exp new file mode 100644 index 000000000..e647df676 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nsleep-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_b.nx.in new file mode 100644 index 000000000..c7b8ee731 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +nsleep diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_c.nx.exp new file mode 100644 index 000000000..752c826f0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (`a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nsleep-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_c.nx.in new file mode 100644 index 000000000..1434b35b5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`a' nsleep diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_d.nx.exp new file mode 100644 index 000000000..4117cdbcf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_d.nx.exp @@ -0,0 +1,7 @@ +Error $rangecheck +ostack: (0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nsleep-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_d.nx.in new file mode 100644 index 000000000..cfa08befe --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nsleep_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +0 nsleep diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_a.nx.exp new file mode 100644 index 000000000..ae8b16ba6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_a.nx.exp @@ -0,0 +1,23 @@ +Test begin +0 nup: {} --> () +0 nup: {0} --> (0) +1 nup: {0} --> (0) +0 nup: {1 0} --> (1 0) +1 nup: {1 0} --> (1 0) +2 nup: {1 0} --> (0 1) +0 nup: {2 1 0} --> (2 1 0) +1 nup: {2 1 0} --> (2 1 0) +2 nup: {2 1 0} --> (2 0 1) +3 nup: {2 1 0} --> (0 2 1) +0 nup: {3 2 1 0} --> (3 2 1 0) +1 nup: {3 2 1 0} --> (3 2 1 0) +2 nup: {3 2 1 0} --> (3 2 0 1) +3 nup: {3 2 1 0} --> (3 0 2 1) +4 nup: {3 2 1 0} --> (0 3 2 1) +0 nup: {4 3 2 1 0} --> (4 3 2 1 0) +1 nup: {4 3 2 1 0} --> (4 3 2 1 0) +2 nup: {4 3 2 1 0} --> (4 3 2 0 1) +3 nup: {4 3 2 1 0} --> (4 3 0 2 1) +4 nup: {4 3 2 1 0} --> (4 0 3 2 1) +5 nup: {4 3 2 1 0} --> (0 4 3 2 1) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_a.nx.in new file mode 100644 index 000000000..6eece50d8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {} + {0} + {1 0} + {2 1 0} + {3 2 1 0} + {4 3 2 1 0} +]{ + $proc exch def + 0 1 $proc load length { + dup cvs print + ` nup: ' print + $proc load 1 sprints print + ` --> ' print + + proc + adn nup + ostack 1 sprint + clear + } for +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_b.nx.exp new file mode 100644 index 000000000..f5c64247c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_b.nx.in new file mode 100644 index 000000000..d719e2aa9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +nup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_c.nx.exp new file mode 100644 index 000000000..6533e5b7d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_c.nx.in new file mode 100644 index 000000000..3a8203ac8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark nup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_d.nx.exp new file mode 100644 index 000000000..70a4d10a9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_d.nx.in new file mode 100644 index 000000000..dcebc2bb8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1 nup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_e.nx.exp new file mode 100644 index 000000000..49063c743 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_e.nx.in new file mode 100644 index 000000000..476d7b338 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 nup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_f.nx.exp new file mode 100644 index 000000000..7e7e26600 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1 0 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --nup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_f.nx.in new file mode 100644 index 000000000..b81b96d05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/nup_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 0 3 nup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_a.nx.exp new file mode 100644 index 000000000..3df361ecc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_a.nx.exp @@ -0,0 +1,18 @@ +Test begin +{`Input string of words' `.'} +true +`I' +0 +{`Input string of words' `string'} +true +`string' +6 +{`Input string of words' `\\w+$'} +true +`words' +16 +{`Input string of words' `\\w+'} +true +`Input' +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_a.nx.in new file mode 100644 index 000000000..ea9c6a229 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_a.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`Input string of words' `.'} + {`Input string of words' `string'} + {`Input string of words' `\w+$'} + {`Input string of words' `\w+'} +]{ + dup 1 sprint + eval under match 1 sprint + 0 submatch dup 1 sprint + offset 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_b.nx.exp new file mode 100644 index 000000000..6093ecfc5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`string') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --offset-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_b.nx.in new file mode 100644 index 000000000..cb1fb2ffc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`string' offset + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_c.nx.exp new file mode 100644 index 000000000..b2dd4e706 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --offset-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_c.nx.in new file mode 100644 index 000000000..0195dce35 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +offset + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_d.nx.exp new file mode 100644 index 000000000..61ab1665a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --offset-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_d.nx.in new file mode 100644 index 000000000..0371e9688 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' mark offset + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_e.nx.exp new file mode 100644 index 000000000..e8673a3bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --offset-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_e.nx.in new file mode 100644 index 000000000..4b5eec974 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `' offset + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_f.nx.exp new file mode 100644 index 000000000..989eda0cc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`input' `non-substring') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --offset-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_f.nx.in new file mode 100644 index 000000000..41cd8f518 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `non-substring' offset + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_g.nx.exp new file mode 100644 index 000000000..8c53c7d8d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`in' `input') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --offset-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_g.nx.in new file mode 100644 index 000000000..e7e9a93b1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' dup 0 2 getinterval exch offset + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_h.nx.exp new file mode 100644 index 000000000..0cc10cadb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_h.nx.exp @@ -0,0 +1,4 @@ +Test begin +0 +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_h.nx.in new file mode 100644 index 000000000..980839539 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/offset_h.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' dup 0 5 getinterval offset 1 sprint +`input' dup 0 5 getinterval exch offset 1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_a.nx.exp new file mode 100644 index 000000000..bc0f9c409 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_a.nx.exp @@ -0,0 +1,22 @@ +Test begin +`false false' +false +`true true' +true +`false true' +true +`true false' +true +`0 0' +0 +`16@7fffffffffffffff 16@7fffffffffffffff' +9223372036854775807 +`16@0 16@7fffffffffffffff' +9223372036854775807 +`16@7fffffffffffffff 16@0' +9223372036854775807 +`2@0101010101010101010101010101010101010101010101010101010101010101\n\t2@0101010101010101010101010101010101010101010101010101010101010101' +6148914691236517205 +`2@0101010101010101010101010101010101010101010101010101010101010101\n\t2@0010101010101010101010101010101010101010101010101010101010101010' +9223372036854775807 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_a.nx.in new file mode 100644 index 000000000..a9a0315d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `false false' + `true true' + `false true' + `true false' + + `0 0' + `16@7fffffffffffffff 16@7fffffffffffffff' + `16@0 16@7fffffffffffffff' + `16@7fffffffffffffff 16@0' + + `2@0101010101010101010101010101010101010101010101010101010101010101 + 2@0101010101010101010101010101010101010101010101010101010101010101' + + `2@0101010101010101010101010101010101010101010101010101010101010101 + 2@0010101010101010101010101010101010101010101010101010101010101010' +]{ + dup 1 sprint + cvx eval + or + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_b.nx.exp new file mode 100644 index 000000000..d235a7613 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --or-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_b.nx.in new file mode 100644 index 000000000..c760c7de2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 or + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_c.nx.exp new file mode 100644 index 000000000..17a4691d9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --or-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_c.nx.in new file mode 100644 index 000000000..e96a2aa70 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 or + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_d.nx.exp new file mode 100644 index 000000000..c02bd11a3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --or-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_d.nx.in new file mode 100644 index 000000000..8f7bb25ca --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark or + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_e.nx.exp new file mode 100644 index 000000000..45b715b9e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 true) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --or-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_e.nx.in new file mode 100644 index 000000000..f0298b22c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 true or + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_f.nx.exp new file mode 100644 index 000000000..a7e004148 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (true 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --or-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_f.nx.in new file mode 100644 index 000000000..eb6c712c1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/or_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true 1 or + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_a.nx.exp new file mode 100644 index 000000000..99c722090 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_a.nx.exp @@ -0,0 +1,38 @@ +Test begin +-array-_________ +[1 -array- 4]___ +[1 [2 3] 4]_____ +___false +_false__ +false___ +____true +__true__ +true____ ++42 +-42 +42 +-42 +42 +-42 + 42 +____42 +____42 +__42__ +42____ +12345 +12345 +1234 +123 +12 +1 + +__$foo +_$foo_ +$foo__ +___foo +_foo__ +foo___ +____string +__string__ +string____ +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_a.nx.in new file mode 100644 index 000000000..e830e1a7c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_a.nx.in @@ -0,0 +1,60 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[1 [2 3] 4] <$w 16 $p `_' $j $l $r 0> output `\n' print +[1 [2 3] 4] <$w 16 $p `_' $j $l $r 1> output `\n' print +[1 [2 3] 4] <$w 16 $p `_' $j $l $r 2> output `\n' print + +false <$w 8 $p `_' $j $r> output `\n' print +false <$w 8 $p `_' $j $c> output `\n' print +false <$w 8 $p `_' $j $l> output `\n' print +true <$w 8 $p `_' $j $r> output `\n' print +true <$w 8 $p `_' $j $c> output `\n' print +true <$w 8 $p `_' $j $l> output `\n' print + +42 <$s $+> output `\n' print +-42 <$s $+> output `\n' print +42 <$s $-> output `\n' print +-42 <$s $-> output `\n' print +42 <> output `\n' print +-42 <> output `\n' print + +42 <$w 6> output `\n' print +42 <$w 6 $p `_'> output `\n' print +42 <$w 6 $p `_' $j $r> output `\n' print +42 <$w 6 $p `_' $j $c> output `\n' print +42 <$w 6 $p `_' $j $l> output `\n' print + +12345 <$n 6> output `\n' print +12345 <$n 5> output `\n' print +12345 <$n 4> output `\n' print +12345 <$n 3> output `\n' print +12345 <$n 2> output `\n' print +12345 <$n 1> output `\n' print +12345 <$n 0> output `\n' print + +$foo <$w 6 $p `_' $j $r> output `\n' print +$foo <$w 6 $p `_' $j $c> output `\n' print +$foo <$w 6 $p `_' $j $l> output `\n' print +$foo cvx <$w 6 $p `_' $j $r> output `\n' print +$foo cvx <$w 6 $p `_' $j $c> output `\n' print +$foo cvx <$w 6 $p `_' $j $l> output `\n' print + +`string' <$w 10 $p `_' $j $r> output `\n' print +`string' <$w 10 $p `_' $j $c> output `\n' print +`string' <$w 10 $p `_' $j $l> output `\n' print + +pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_b.nx.exp new file mode 100644 index 000000000..a810f57fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_b.nx.exp @@ -0,0 +1,40 @@ +Test begin ++42.500000 +-42.500000 +42.500000 +-42.500000 +42.500000 +-42.500000 + 42.500000 +___42.500000 +___42.500000 +_42.500000__ +42.500000___ +12345.600000 +12345.60000 +12345.6000 +12345.600 +12345.60 +12345.6 +12346 +1e+04 ++4.250000e+01 +-4.250000e+01 +4.250000e+01 +-4.250000e+01 +4.250000e+01 +-4.250000e+01 + 4.250000e+01 +___4.250000e+01 +___4.250000e+01 +_4.250000e+01__ +4.250000e+01___ +1.234560e+04 +1.23456e+04 +1.2346e+04 +1.235e+04 +1.23e+04 +1.2e+04 +1e+04 +1.234560e+04 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_b.nx.in new file mode 100644 index 000000000..66518c5b7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/output_b.nx.in @@ -0,0 +1,62 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +# Decimal notation. +42.5 <$s $+ $e false> output `\n' print +-42.5 <$s $+ $e false> output `\n' print +42.5 <$s $-> output `\n' print +-42.5 <$s $-> output `\n' print +42.5 <> output `\n' print +-42.5 <> output `\n' print + +42.5 <$w 12> output `\n' print +42.5 <$w 12 $p `_'> output `\n' print +42.5 <$w 12 $p `_' $j $r> output `\n' print +42.5 <$w 12 $p `_' $j $c> output `\n' print +42.5 <$w 12 $p `_' $j $l> output `\n' print + +12345.6 <$d 6> output `\n' print +12345.6 <$d 5> output `\n' print +12345.6 <$d 4> output `\n' print +12345.6 <$d 3> output `\n' print +12345.6 <$d 2> output `\n' print +12345.6 <$d 1> output `\n' print +12345.6 <$d 0> output `\n' print +12345.6 <$d -1> output `\n' print + +# Exponential notation. +42.5 <$s $+ $e true> output `\n' print +-42.5 <$s $+ $e true> output `\n' print +42.5 <$s $- $e true> output `\n' print +-42.5 <$s $- $e true> output `\n' print +42.5 <$e true> output `\n' print +-42.5 <$e true> output `\n' print + +42.5 <$w 15 $e true> output `\n' print +42.5 <$w 15 $p `_' $e true> output `\n' print +42.5 <$w 15 $p `_' $j $r $e true> output `\n' print +42.5 <$w 15 $p `_' $j $c $e true> output `\n' print +42.5 <$w 15 $p `_' $j $l $e true> output `\n' print + +12345.6 <$d 6 $e true> output `\n' print +12345.6 <$d 5 $e true> output `\n' print +12345.6 <$d 4 $e true> output `\n' print +12345.6 <$d 3 $e true> output `\n' print +12345.6 <$d 2 $e true> output `\n' print +12345.6 <$d 1 $e true> output `\n' print +12345.6 <$d 0 $e true> output `\n' print +12345.6 <$d -1 $e true> output `\n' print + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_a.nx.exp new file mode 100644 index 000000000..deb9f2642 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +0 1 --> (0 1 0) +0 1 2 --> (0 1 2 1) +0 1 2 3 --> (0 1 2 3 2) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_a.nx.in new file mode 100644 index 000000000..0091d5632 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1' + `0 1 2' + `0 1 2 3' +]{ + dup print + ` --> ' print + + cvx eval + over + + ostack 1 sprint + + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_b.nx.exp new file mode 100644 index 000000000..79c46e9d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --over-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_b.nx.in new file mode 100644 index 000000000..7c89e9267 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/over_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 over + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pipe_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pipe_a.nx.exp new file mode 100644 index 000000000..dc35038ab --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pipe_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +`foo' +`bar' +`biz' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pipe_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pipe_a.nx.in new file mode 100644 index 000000000..600a23bcc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pipe_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +pipe +$wfile exch def +$rfile exch def +wfile `foo\nbar\nbiz\n' write pop +wfile flushfile +rfile readline pop 1 sprint +rfile readline pop 1 sprint +rfile readline pop 1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_a.nx.exp new file mode 100644 index 000000000..21f73f1f5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_a.nx.exp @@ -0,0 +1,37 @@ +Test begin +in: +<-file- <$POLLWRNORM false $POLLOUT false>> +out: +[-file-] +<-file- <$POLLWRNORM true $POLLOUT true>> +in: +<-file- <$POLLWRNORM false $POLLOUT false> -file- <$POLLWRNORM false $POLLOUT false>> +out: +[-file- -file-] +<-file- <$POLLWRNORM true $POLLOUT true> -file- <$POLLWRNORM true $POLLOUT true>> +in: +<-file- <$POLLWRNORM false $POLLOUT false>> +out: +[-file-] +<-file- <$POLLWRNORM true $POLLOUT true>> +in: +<-file- <$garbage `ignore me' $POLLWRNORM true $POLLOUT true>> +out: +[-file-] +<-file- <$garbage `ignore me' $POLLWRNORM true $POLLOUT true>> +in: +<-file- <$POLLWRNORM false $POLLOUT false $POLLRDNORM false $POLLIN false>> +out: +[-file-] +<-file- <$POLLWRNORM true $POLLOUT true $POLLRDNORM true $POLLIN true>> +in: +<-file- <$POLLWRNORM true $POLLOUT true $POLLRDNORM true $POLLIN true>> +out: +[-file-] +<-file- <$POLLWRNORM true $POLLOUT true $POLLRDNORM true $POLLIN true>> +in: +<-file- <$POLLWRNORM false $POLLOUT false $POLLRDNORM false $POLLIN false> -file- <$POLLWRNORM false $POLLOUT false $POLLRDNORM false $POLLIN false>> +out: +[-file- -file-] +<-file- <$POLLWRNORM true $POLLOUT true $POLLRDNORM true $POLLIN true> -file- <$POLLWRNORM true $POLLOUT true $POLLRDNORM true $POLLIN true>> +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_a.nx.in new file mode 100644 index 000000000..881d61355 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_a.nx.in @@ -0,0 +1,62 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + > + < + stdout <$POLLOUT false $POLLWRNORM false> + stderr <$POLLOUT false $POLLWRNORM false> + > + > + > + < + stdout < + $POLLIN false + $POLLRDNORM false + $POLLOUT false + $POLLWRNORM false + > + > + < + stdout < + $POLLIN true + $POLLRDNORM true + $POLLOUT true + $POLLWRNORM true + > + > + < + stdout < + $POLLIN false + $POLLRDNORM false + $POLLOUT false + $POLLWRNORM false + > + stderr < + $POLLIN false + $POLLRDNORM false + $POLLOUT false + $POLLWRNORM false + > + > +]{ + `in:\n' print + dup 2 sprint + dup 0 poll + `out:\n' print + 1 sprint 2 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_b.nx.exp new file mode 100644 index 000000000..de20787bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1000) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_b.nx.in new file mode 100644 index 000000000..70524a7f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1000 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_c.nx.exp new file mode 100644 index 000000000..82919cdbc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-dict- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_c.nx.in new file mode 100644 index 000000000..b8f71bbad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +> mark poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_d.nx.exp new file mode 100644 index 000000000..4cce4f282 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1000) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_d.nx.in new file mode 100644 index 000000000..d44664a01 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1000 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_e.nx.exp new file mode 100644 index 000000000..457e0e26c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-dict- -2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_e.nx.in new file mode 100644 index 000000000..6d54e61e8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +> -2 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_f.nx.exp new file mode 100644 index 000000000..01407444a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-dict- 2147483648) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_f.nx.in new file mode 100644 index 000000000..fecd517ab --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +> 2 31 pow poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_g.nx.exp new file mode 100644 index 000000000..c1ef5ace2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_g.nx.in new file mode 100644 index 000000000..9ad789938 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<> 0 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_h.nx.exp new file mode 100644 index 000000000..88ec4f84c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_h.nx.in new file mode 100644 index 000000000..08780eda4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<$foo <$POLLOUT false>> 0 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_i.nx.exp new file mode 100644 index 000000000..88ec4f84c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_i.nx.in new file mode 100644 index 000000000..92e29ed99 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + + stderr $foo> 0 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_j.nx.exp new file mode 100644 index 000000000..c1ef5ace2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --poll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_j.nx.in new file mode 100644 index 000000000..e968d25f5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/poll_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +> 0 poll + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_a.nx.in new file mode 100644 index 000000000..602f36e16 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_a.nx.in @@ -0,0 +1,15 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush +1 2 pop pop +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_b.nx.exp new file mode 100644 index 000000000..1d6124f52 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --pop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_b.nx.in new file mode 100644 index 000000000..e89b47e6b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pop_b.nx.in @@ -0,0 +1,15 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush +pop +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_a.nx.exp new file mode 100644 index 000000000..7ad51c89a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_a.nx.exp @@ -0,0 +1,20 @@ +Test begin +`0 0 pow' +1 +`4 0 pow' +1 +`4 1 pow' +4 +`4 2 pow' +16 +`4 3 pow' +64 +`5 3 pow' +125 +`-5 1 pow' +-5 +`-5 2 pow' +25 +`-5 3 pow' +-125 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_a.nx.in new file mode 100644 index 000000000..84e84aad7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 pow' + `4 0 pow' + `4 1 pow' + `4 2 pow' + `4 3 pow' + `5 3 pow' + `-5 1 pow' + `-5 2 pow' + `-5 3 pow' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_b.nx.exp new file mode 100644 index 000000000..76f17cf80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --pow-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_b.nx.in new file mode 100644 index 000000000..742b5a0f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 pow + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_c.nx.exp new file mode 100644 index 000000000..21b3bf633 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --pow-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_c.nx.in new file mode 100644 index 000000000..3abd7551b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark pow + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_d.nx.exp new file mode 100644 index 000000000..441e29882 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --pow-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_d.nx.in new file mode 100644 index 000000000..f502ac3b9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 pow + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_e.nx.exp new file mode 100644 index 000000000..c81949430 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_e.nx.exp @@ -0,0 +1,82 @@ +Test begin +`0 0 pow' +1 +`4 0 pow' +1 +`4 1 pow' +4 +`4 2 pow' +16 +`4 3 pow' +64 +`5 3 pow' +125 +`-5 1 pow' +-5 +`-5 2 pow' +25 +`-5 3 pow' +-125 +`3 -1 pow' +3.333333e-01 +`0.0 0 pow' +1.000000e+00 +`4.0 0 pow' +1.000000e+00 +`4.0 1 pow' +4.000000e+00 +`4.0 2 pow' +1.600000e+01 +`4.0 3 pow' +6.400000e+01 +`5.0 3 pow' +1.250000e+02 +`-5.0 1 pow' +-5.000000e+00 +`-5.0 2 pow' +2.500000e+01 +`-5.0 3 pow' +-1.250000e+02 +`3.0 -1 pow' +3.333333e-01 +`0 0.0 pow' +1.000000e+00 +`4 0.0 pow' +1.000000e+00 +`4 1.0 pow' +4.000000e+00 +`4 2.0 pow' +1.600000e+01 +`4 3.0 pow' +6.400000e+01 +`5 3.0 pow' +1.250000e+02 +`-5 1.0 pow' +-5.000000e+00 +`-5 2.0 pow' +2.500000e+01 +`-5 3.0 pow' +-1.250000e+02 +`3 -1.0 pow' +3.333333e-01 +`0 0.0 pow' +1.000000e+00 +`4 0.0 pow' +1.000000e+00 +`4 1.0 pow' +4.000000e+00 +`4 2.0 pow' +1.600000e+01 +`4 3.0 pow' +6.400000e+01 +`5 3.0 pow' +1.250000e+02 +`-5 1.0 pow' +-5.000000e+00 +`-5 2.0 pow' +2.500000e+01 +`-5 3.0 pow' +-1.250000e+02 +`3 -1.0 pow' +3.333333e-01 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_e.nx.in new file mode 100644 index 000000000..58ca3df1e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/pow_e.nx.in @@ -0,0 +1,65 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 pow' + `4 0 pow' + `4 1 pow' + `4 2 pow' + `4 3 pow' + `5 3 pow' + `-5 1 pow' + `-5 2 pow' + `-5 3 pow' + `3 -1 pow' + + `0.0 0 pow' + `4.0 0 pow' + `4.0 1 pow' + `4.0 2 pow' + `4.0 3 pow' + `5.0 3 pow' + `-5.0 1 pow' + `-5.0 2 pow' + `-5.0 3 pow' + `3.0 -1 pow' + + `0 0.0 pow' + `4 0.0 pow' + `4 1.0 pow' + `4 2.0 pow' + `4 3.0 pow' + `5 3.0 pow' + `-5 1.0 pow' + `-5 2.0 pow' + `-5 3.0 pow' + `3 -1.0 pow' + + `0 0.0 pow' + `4 0.0 pow' + `4 1.0 pow' + `4 2.0 pow' + `4 3.0 pow' + `5 3.0 pow' + `-5 1.0 pow' + `-5 2.0 pow' + `-5 3.0 pow' + `3 -1.0 pow' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_a.nx.exp new file mode 100644 index 000000000..b46236165 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_a.nx.exp @@ -0,0 +1,32 @@ +Test begin +`1 array dup 0 \`a\' put' +[`a'] +`2 array dup 0 \`a\' put' +[`a' null] +`2 array dup 1 \`a\' put' +[null `a'] +`3 array dup 0 \`a\' put' +[`a' null null] +`3 array dup 1 \`a\' put' +[null `a' null] +`3 array dup 2 \`a\' put' +[null null `a'] +`dict dup $foo \`foo\' put' +<$foo `foo'> +`<$foo \`foo\'> dup $foo \`FOO\' put' +<$foo `FOO'> +`<$foo \`foo\'> dup $bar \`bar\' put' +<$foo `foo' $bar `bar'> +`\` \' dup 0 97 put' +`a' +`\` \' dup 0 97 put' +`a ' +`\` \' dup 1 97 put' +` a' +`\` \' dup 0 97 put' +`a ' +`\` \' dup 1 97 put' +` a ' +`\` \' dup 2 97 put' +` a' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_a.nx.in new file mode 100644 index 000000000..451f3df75 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_a.nx.in @@ -0,0 +1,39 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1 array dup 0 `a' put' + `2 array dup 0 `a' put' + `2 array dup 1 `a' put' + `3 array dup 0 `a' put' + `3 array dup 1 `a' put' + `3 array dup 2 `a' put' + + `dict dup $foo `foo' put' + `<$foo `foo'> dup $foo `FOO' put' + `<$foo `foo'> dup $bar `bar' put' + + `` ' dup 0 97 put' + `` ' dup 0 97 put' + `` ' dup 1 97 put' + `` ' dup 0 97 put' + `` ' dup 1 97 put' + `` ' dup 2 97 put' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_b.nx.exp new file mode 100644 index 000000000..4517a3336 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_b.nx.in new file mode 100644 index 000000000..c496dae06 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 mark put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_c.nx.exp new file mode 100644 index 000000000..344543fc5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- -mark- 4) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_c.nx.in new file mode 100644 index 000000000..58bc8d6b4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[1 2 3] mark 4 put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_d.nx.exp new file mode 100644 index 000000000..e28719a63 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`abc' -mark- 100) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_d.nx.in new file mode 100644 index 000000000..aa2eb66be --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`abc' mark 100 put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_e.nx.exp new file mode 100644 index 000000000..bc7e6a006 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`abc' 1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_e.nx.in new file mode 100644 index 000000000..881e7f7dd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`abc' 1 mark put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_f.nx.exp new file mode 100644 index 000000000..89c6fd616 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- 3 null) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_f.nx.in new file mode 100644 index 000000000..0dcb4361a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[1 2 3] 3 null put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_g.nx.exp new file mode 100644 index 000000000..d2cb4402a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`abc' 3 100) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_g.nx.in new file mode 100644 index 000000000..f172681e0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`abc' 3 100 put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_h.nx.exp new file mode 100644 index 000000000..ba87e7fbf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- -1 `d') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --put-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_h.nx.in new file mode 100644 index 000000000..cf71f02f5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a' `b' `c'] -1 `d' put + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_i.nx.exp new file mode 100644 index 000000000..479b282c2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_i.nx.exp @@ -0,0 +1,3 @@ +Test begin +<0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63> +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_i.nx.in new file mode 100644 index 000000000..3928b8e96 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/put_i.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +# Insert enough objects into a dict to cause conversion from an embedded array +# to a dch. + +<> +0 1 63 { + under dup put +} for + +1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_a.nx.exp new file mode 100644 index 000000000..dcee00cdc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_a.nx.exp @@ -0,0 +1,34 @@ +Test begin +`1 array dup 0 [\`a\'] putinterval' +[`a'] +`2 array dup 0 [\`a\'] putinterval' +[`a' null] +`2 array dup 1 [\`a\'] putinterval' +[null `a'] +`3 array dup 0 [\`a\'] putinterval' +[`a' null null] +`3 array dup 1 [\`a\'] putinterval' +[null `a' null] +`3 array dup 2 [\`a\'] putinterval' +[null null `a'] +`3 array dup 0 [\`a\' \`b\'] putinterval' +[`a' `b' null] +`3 array dup 1 [\`a\' \`b\'] putinterval' +[null `a' `b'] +`1 string dup 0 \`a\' putinterval' +`a' +`2 string dup 0 \`a\' putinterval' +`a\0' +`2 string dup 1 \`a\' putinterval' +`\0a' +`3 string dup 0 \`a\' putinterval' +`a\0\0' +`3 string dup 1 \`a\' putinterval' +`\0a\0' +`3 string dup 2 \`a\' putinterval' +`\0\0a' +`3 string dup 0 \`ab\' putinterval' +`ab\0' +`3 string dup 1 \`ab\' putinterval' +`\0ab' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_a.nx.in new file mode 100644 index 000000000..83f6d52a9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_a.nx.in @@ -0,0 +1,39 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1 array dup 0 [`a'] putinterval' + `2 array dup 0 [`a'] putinterval' + `2 array dup 1 [`a'] putinterval' + `3 array dup 0 [`a'] putinterval' + `3 array dup 1 [`a'] putinterval' + `3 array dup 2 [`a'] putinterval' + `3 array dup 0 [`a' `b'] putinterval' + `3 array dup 1 [`a' `b'] putinterval' + + `1 string dup 0 `a' putinterval' + `2 string dup 0 `a' putinterval' + `2 string dup 1 `a' putinterval' + `3 string dup 0 `a' putinterval' + `3 string dup 1 `a' putinterval' + `3 string dup 2 `a' putinterval' + `3 string dup 0 `ab' putinterval' + `3 string dup 1 `ab' putinterval' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_b.nx.exp new file mode 100644 index 000000000..f82dcb4bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1 `a') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_b.nx.in new file mode 100644 index 000000000..d06642b60 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 `a' putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_c.nx.exp new file mode 100644 index 000000000..593e99dd5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- -mark- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_c.nx.in new file mode 100644 index 000000000..67226799b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a' `b' `c'] mark [`d'] putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_d.nx.exp new file mode 100644 index 000000000..141d8e107 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 0 `d') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_d.nx.in new file mode 100644 index 000000000..b0596bade --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 0 `d' putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_e.nx.exp new file mode 100644 index 000000000..56c69d1a8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-array- 0 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_e.nx.in new file mode 100644 index 000000000..4fd714052 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a'] 0 mark putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_f.nx.exp new file mode 100644 index 000000000..b5c33c174 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' 0 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_f.nx.in new file mode 100644 index 000000000..510825ec5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 0 mark putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_g.nx.exp new file mode 100644 index 000000000..0a505912e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- 1 -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_g.nx.in new file mode 100644 index 000000000..f733ec6cf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a'] 1 [`b'] putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_h.nx.exp new file mode 100644 index 000000000..fdddfb0e2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`a' 1 `b') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_h.nx.in new file mode 100644 index 000000000..fa9ff87e1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_h.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 `b' putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_i.nx.exp new file mode 100644 index 000000000..e12573794 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-array- -1 -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --putinterval-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_i.nx.in new file mode 100644 index 000000000..ab57e5588 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/putinterval_i.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[`a' `b'] -1 [`c'] putinterval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rand_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rand_a.nx.exp new file mode 100644 index 000000000..cf9345844 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rand_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +`Equal' +`Equal' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rand_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rand_a.nx.in new file mode 100644 index 000000000..c2af82196 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rand_a.nx.in @@ -0,0 +1,33 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 srand rand +0 srand rand +eq { + `Equal' +}{ + `Not equal' +} ifelse +1 sprint + +42 srand rand +42 srand rand +eq { + `Equal' +}{ + `Not equal' +} ifelse +1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_a.nx.exp new file mode 100644 index 000000000..2193de060 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +`foobar' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_a.nx.in new file mode 100644 index 000000000..2605ace87 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_a.nx.in @@ -0,0 +1,30 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$symlink_name argv 2 get `/readlink_a' cat def + +# Remove the symlink if it already exists. +symlink_name `L' test { + symlink_name unlink +} if + +`foobar' symlink_name symlink + +symlink_name readlink +1 sprint + +symlink_name unlink + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_b.nx.exp new file mode 100644 index 000000000..84c50afb0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --readlink-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_b.nx.in new file mode 100644 index 000000000..26c55d0c0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +readlink + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_c.nx.exp new file mode 100644 index 000000000..a5862da0f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --readlink-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_c.nx.in new file mode 100644 index 000000000..1f10f5ae0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark readlink + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_d.nx.exp new file mode 100644 index 000000000..ab8dc0b29 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $undefinedfilename +ostack: (`Let us hope that this name does not exist.') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --readlink-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_d.nx.in new file mode 100644 index 000000000..ac6df05e8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/readlink_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`Let us hope that this name does not exist.' readlink + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_a.nx.exp new file mode 100644 index 000000000..bd2c654e3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_a.nx.exp @@ -0,0 +1,10 @@ +Test begin +{`.'} +-regex- +{`.' < >} +-regex- +{`.' < $c true $g true $i true $m true $s true >} +-regex- +{`([a-z]+)'} +-regex- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_a.nx.in new file mode 100644 index 000000000..0ea1e6646 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`.'} + {`.' <>} + {`.' <$c true $g true $i true $m true $s true>} + {`([a-z]+)'} +]{ + dup 1 sprint + eval regex + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_b.nx.exp new file mode 100644 index 000000000..0d9ae2a0c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_b.nx.in new file mode 100644 index 000000000..d7556cb4d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_c.nx.exp new file mode 100644 index 000000000..636782876 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`.' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_c.nx.in new file mode 100644 index 000000000..2394f1d16 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`.' mark regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_d.nx.exp new file mode 100644 index 000000000..334f9804d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_d.nx.in new file mode 100644 index 000000000..9988edb46 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark <> regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_e.nx.exp new file mode 100644 index 000000000..7193a0b7a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`.' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_e.nx.in new file mode 100644 index 000000000..3578b986a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`.' <$i 0> regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_f.nx.exp new file mode 100644 index 000000000..7193a0b7a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`.' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_f.nx.in new file mode 100644 index 000000000..4b376e409 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`.' <$c 0> regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_g.nx.exp new file mode 100644 index 000000000..7193a0b7a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`.' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_g.nx.in new file mode 100644 index 000000000..3a6484057 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`.' <$m 0> regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_h.nx.exp new file mode 100644 index 000000000..7193a0b7a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`.' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_h.nx.in new file mode 100644 index 000000000..bed1abe77 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`.' <$s 0> regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_i.nx.exp new file mode 100644 index 000000000..7193a0b7a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`.' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_i.nx.in new file mode 100644 index 000000000..90b769220 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`.' <$g 0> regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_j.nx.exp new file mode 100644 index 000000000..98c7dd136 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $regexerror +ostack: (`(') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regex-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_j.nx.in new file mode 100644 index 000000000..bca082d29 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regex_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`(' regex + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_a.nx.exp new file mode 100644 index 000000000..026d31526 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_a.nx.exp @@ -0,0 +1,16 @@ +Test begin +{`' `'} +-regsub- +{`.' `'} +-regsub- +{`.' `' < >} +-regsub- +{`.' `' < $g true $i true $m true $s true >} +-regsub- +{`([a-z]+)' `\\1\\2'} +-regsub- +{`([a-z]+)' `\\1\\2' < $g true $i true $m true $s true >} +-regsub- +{`([a-z]+)' `\\\\1\\2'} +-regsub- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_a.nx.in new file mode 100644 index 000000000..cabec852a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_a.nx.in @@ -0,0 +1,30 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`' `'} + {`.' `'} + {`.' `' <>} + {`.' `' <$g true $i true $m true $s true>} + {`([a-z]+)' `\1\2'} + {`([a-z]+)' `\1\2' <$g true $i true $m true $s true>} + {`([a-z]+)' `\\\1\2'} +]{ + dup 1 sprint + eval regsub + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_b.nx.exp new file mode 100644 index 000000000..2b0dc9a9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_b.nx.in new file mode 100644 index 000000000..ca6ce21f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_c.nx.exp new file mode 100644 index 000000000..356eb4538 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_c.nx.in new file mode 100644 index 000000000..1e9ed9b3e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_d.nx.exp new file mode 100644 index 000000000..712b2b4e6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_d.nx.in new file mode 100644 index 000000000..45e1e5763 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' <> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_e.nx.exp new file mode 100644 index 000000000..68810943e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_e.nx.in new file mode 100644 index 000000000..c431b3475 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' mark regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_f.nx.exp new file mode 100644 index 000000000..92bae8384 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' -mark- -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_f.nx.in new file mode 100644 index 000000000..c67669702 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' mark <> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_g.nx.exp new file mode 100644 index 000000000..6258ec976 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_g.nx.in new file mode 100644 index 000000000..c22c2f70f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `' <> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_h.nx.exp new file mode 100644 index 000000000..c3fe19fc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_h.nx.in new file mode 100644 index 000000000..072e52993 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' <$g 0> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_i.nx.exp new file mode 100644 index 000000000..c3fe19fc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_i.nx.in new file mode 100644 index 000000000..8592a10c8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' <$i 0> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_j.nx.exp new file mode 100644 index 000000000..c3fe19fc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_j.nx.in new file mode 100644 index 000000000..e327cfb27 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' <$m 0> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_k.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_k.nx.exp new file mode 100644 index 000000000..c3fe19fc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_k.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_k.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_k.nx.in new file mode 100644 index 000000000..085957b02 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_k.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' <$s 0> regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_l.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_l.nx.exp new file mode 100644 index 000000000..bf2390d21 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_l.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $regexerror +ostack: (`(pattern' `') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --regsub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_l.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_l.nx.in new file mode 100644 index 000000000..5c2d7503c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/regsub_l.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`(pattern' `' regsub + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_a.nx.exp new file mode 100644 index 000000000..abaa7a8bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_a.nx.exp @@ -0,0 +1,11 @@ +Test begin +`0 {\`hi\' 1 sprint} repeat' +`1 {\`hi\' 1 sprint} repeat' +`hi' +`5 {\`hi\' 1 sprint} repeat' +`hi' +`hi' +`hi' +`hi' +`hi' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_a.nx.in new file mode 100644 index 000000000..fe0cbbe7e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 {`hi' 1 sprint} repeat' + `1 {`hi' 1 sprint} repeat' + `5 {`hi' 1 sprint} repeat' +]{ + dup 1 sprint + cvx eval +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_b.nx.exp new file mode 100644 index 000000000..729952155 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --repeat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_b.nx.in new file mode 100644 index 000000000..02f6d0048 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{} repeat + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_c.nx.exp new file mode 100644 index 000000000..7fa597ae3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --repeat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_c.nx.in new file mode 100644 index 000000000..f39f46a53 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark {} repeat + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_d.nx.exp new file mode 100644 index 000000000..5379ee32a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1 -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --repeat-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_d.nx.in new file mode 100644 index 000000000..afca88f59 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/repeat_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1 {`hi' 1 sprint} repeat + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_a.nx.exp new file mode 100644 index 000000000..4de9bfb91 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_a.nx.exp @@ -0,0 +1,107 @@ +Test begin +1 2 3 4 1 0 roll pstack clear +4 +3 +2 +1 +1 2 3 4 1 1 roll pstack clear +4 +3 +2 +1 +1 2 3 4 1 2 roll pstack clear +4 +3 +2 +1 +1 2 3 4 2 0 roll pstack clear +4 +3 +2 +1 +1 2 3 4 2 1 roll pstack clear +3 +4 +2 +1 +1 2 3 4 2 2 roll pstack clear +4 +3 +2 +1 +1 2 3 4 3 1 roll pstack clear +3 +2 +4 +1 +1 2 3 4 3 2 roll pstack clear +2 +4 +3 +1 +1 2 3 4 3 -1 roll pstack clear +2 +4 +3 +1 +1 2 3 4 3 -2 roll pstack clear +3 +2 +4 +1 +1 2 3 4 3 3 roll pstack clear +4 +3 +2 +1 +1 2 3 4 4 -4 roll pstack clear +4 +3 +2 +1 +1 2 3 4 4 -3 roll pstack clear +3 +2 +1 +4 +1 2 3 4 4 -2 roll pstack clear +2 +1 +4 +3 +1 2 3 4 4 -1 roll pstack clear +1 +4 +3 +2 +1 2 3 4 4 0 roll pstack clear +4 +3 +2 +1 +1 2 3 4 4 1 roll pstack clear +3 +2 +1 +4 +1 2 3 4 4 2 roll pstack clear +2 +1 +4 +3 +1 2 3 4 4 3 roll pstack clear +1 +4 +3 +2 +1 2 3 4 4 4 roll pstack clear +4 +3 +2 +1 +1 2 3 4 4 5 roll pstack clear +3 +2 +1 +4 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_a.nx.in new file mode 100644 index 000000000..074979c00 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_a.nx.in @@ -0,0 +1,37 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`1 2 3 4 1 0 roll pstack clear\n' dup print cvx eval +`1 2 3 4 1 1 roll pstack clear\n' dup print cvx eval +`1 2 3 4 1 2 roll pstack clear\n' dup print cvx eval +`1 2 3 4 2 0 roll pstack clear\n' dup print cvx eval +`1 2 3 4 2 1 roll pstack clear\n' dup print cvx eval +`1 2 3 4 2 2 roll pstack clear\n' dup print cvx eval +`1 2 3 4 3 1 roll pstack clear\n' dup print cvx eval +`1 2 3 4 3 2 roll pstack clear\n' dup print cvx eval +`1 2 3 4 3 -1 roll pstack clear\n' dup print cvx eval +`1 2 3 4 3 -2 roll pstack clear\n' dup print cvx eval +`1 2 3 4 3 3 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 -4 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 -3 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 -2 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 -1 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 0 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 1 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 2 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 3 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 4 roll pstack clear\n' dup print cvx eval +`1 2 3 4 4 5 roll pstack clear\n' dup print cvx eval + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_b.nx.exp new file mode 100644 index 000000000..5ac0dbd2e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --roll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_b.nx.in new file mode 100644 index 000000000..982ad26f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +roll + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_c.nx.exp new file mode 100644 index 000000000..d2d62806a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --roll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_c.nx.in new file mode 100644 index 000000000..85626532f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 roll + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_d.nx.exp new file mode 100644 index 000000000..0afcc6b2c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`a' 2 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --roll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_d.nx.in new file mode 100644 index 000000000..b693e650c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 2 1 roll + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_e.nx.exp new file mode 100644 index 000000000..57c71ae49 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`a' 0 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --roll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_e.nx.in new file mode 100644 index 000000000..494d2440d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 0 1 roll + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_f.nx.exp new file mode 100644 index 000000000..afd6123f8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' `b' 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --roll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_f.nx.in new file mode 100644 index 000000000..74370dae8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' `b' 1 roll + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_g.nx.exp new file mode 100644 index 000000000..887141a4e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`a' 1 `b') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --roll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_g.nx.in new file mode 100644 index 000000000..71a065614 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/roll_g.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`a' 1 `b' roll + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_a.nx.exp new file mode 100644 index 000000000..bd58313a9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_a.nx.exp @@ -0,0 +1,65 @@ +Test begin +-1 rot: {1} --> (1) + 0 rot: {1} --> (1) + 1 rot: {1} --> (1) +-2 rot: {1 2} --> (1 2) +-1 rot: {1 2} --> (2 1) + 0 rot: {1 2} --> (1 2) + 1 rot: {1 2} --> (2 1) + 2 rot: {1 2} --> (1 2) +-3 rot: {1 2 3} --> (1 2 3) +-2 rot: {1 2 3} --> (3 1 2) +-1 rot: {1 2 3} --> (2 3 1) + 0 rot: {1 2 3} --> (1 2 3) + 1 rot: {1 2 3} --> (3 1 2) + 2 rot: {1 2 3} --> (2 3 1) + 3 rot: {1 2 3} --> (1 2 3) +-4 rot: {1 2 3 4} --> (1 2 3 4) +-3 rot: {1 2 3 4} --> (4 1 2 3) +-2 rot: {1 2 3 4} --> (3 4 1 2) +-1 rot: {1 2 3 4} --> (2 3 4 1) + 0 rot: {1 2 3 4} --> (1 2 3 4) + 1 rot: {1 2 3 4} --> (4 1 2 3) + 2 rot: {1 2 3 4} --> (3 4 1 2) + 3 rot: {1 2 3 4} --> (2 3 4 1) + 4 rot: {1 2 3 4} --> (1 2 3 4) +-5 rot: {1 2 3 4 5} --> (1 2 3 4 5) +-4 rot: {1 2 3 4 5} --> (5 1 2 3 4) +-3 rot: {1 2 3 4 5} --> (4 5 1 2 3) +-2 rot: {1 2 3 4 5} --> (3 4 5 1 2) +-1 rot: {1 2 3 4 5} --> (2 3 4 5 1) + 0 rot: {1 2 3 4 5} --> (1 2 3 4 5) + 1 rot: {1 2 3 4 5} --> (5 1 2 3 4) + 2 rot: {1 2 3 4 5} --> (4 5 1 2 3) + 3 rot: {1 2 3 4 5} --> (3 4 5 1 2) + 4 rot: {1 2 3 4 5} --> (2 3 4 5 1) + 5 rot: {1 2 3 4 5} --> (1 2 3 4 5) +-6 rot: {1 2 3 4 5 6} --> (1 2 3 4 5 6) +-5 rot: {1 2 3 4 5 6} --> (6 1 2 3 4 5) +-4 rot: {1 2 3 4 5 6} --> (5 6 1 2 3 4) +-3 rot: {1 2 3 4 5 6} --> (4 5 6 1 2 3) +-2 rot: {1 2 3 4 5 6} --> (3 4 5 6 1 2) +-1 rot: {1 2 3 4 5 6} --> (2 3 4 5 6 1) + 0 rot: {1 2 3 4 5 6} --> (1 2 3 4 5 6) + 1 rot: {1 2 3 4 5 6} --> (6 1 2 3 4 5) + 2 rot: {1 2 3 4 5 6} --> (5 6 1 2 3 4) + 3 rot: {1 2 3 4 5 6} --> (4 5 6 1 2 3) + 4 rot: {1 2 3 4 5 6} --> (3 4 5 6 1 2) + 5 rot: {1 2 3 4 5 6} --> (2 3 4 5 6 1) + 6 rot: {1 2 3 4 5 6} --> (1 2 3 4 5 6) +-7 rot: {1 2 3 4 5 6 7} --> (1 2 3 4 5 6 7) +-6 rot: {1 2 3 4 5 6 7} --> (7 1 2 3 4 5 6) +-5 rot: {1 2 3 4 5 6 7} --> (6 7 1 2 3 4 5) +-4 rot: {1 2 3 4 5 6 7} --> (5 6 7 1 2 3 4) +-3 rot: {1 2 3 4 5 6 7} --> (4 5 6 7 1 2 3) +-2 rot: {1 2 3 4 5 6 7} --> (3 4 5 6 7 1 2) +-1 rot: {1 2 3 4 5 6 7} --> (2 3 4 5 6 7 1) + 0 rot: {1 2 3 4 5 6 7} --> (1 2 3 4 5 6 7) + 1 rot: {1 2 3 4 5 6 7} --> (7 1 2 3 4 5 6) + 2 rot: {1 2 3 4 5 6 7} --> (6 7 1 2 3 4 5) + 3 rot: {1 2 3 4 5 6 7} --> (5 6 7 1 2 3 4) + 4 rot: {1 2 3 4 5 6 7} --> (4 5 6 7 1 2 3) + 5 rot: {1 2 3 4 5 6 7} --> (3 4 5 6 7 1 2) + 6 rot: {1 2 3 4 5 6 7} --> (2 3 4 5 6 7 1) + 7 rot: {1 2 3 4 5 6 7} --> (1 2 3 4 5 6 7) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_a.nx.in new file mode 100644 index 000000000..d8e969514 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_a.nx.in @@ -0,0 +1,41 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {1} + {1 2} + {1 2 3} + {1 2 3 4} + {1 2 3 4 5} + {1 2 3 4 5 6} + {1 2 3 4 5 6 7} +]{ + $proc exch def + $proc load length + dup neg 1 dn { + dup <$w 2> output + ` rot: ' print + $proc load 1 sprints print + ` --> ' print flush + + proc adn + rot + ostack 1 sprint + + clear + } for +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_b.nx.exp new file mode 100644 index 000000000..23c6775c1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --rot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_b.nx.in new file mode 100644 index 000000000..c8db4fe75 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +rot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_c.nx.exp new file mode 100644 index 000000000..7aafb7b06 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --rot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_c.nx.in new file mode 100644 index 000000000..42bc18ff1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark rot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_d.nx.exp new file mode 100644 index 000000000..485316f1e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --rot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_d.nx.in new file mode 100644 index 000000000..0b10e5d5e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/rot_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 rot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_a.nx.exp new file mode 100644 index 000000000..130de0120 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_a.nx.exp @@ -0,0 +1,56 @@ +Test begin +`-1 round' +-1 +`0 round' +0 +`1 round' +1 +`-1.0 round' +-1 +`0.0 round' +0 +`1.0 round' +1 +`-2.9 round' +-3 +`-2.6 round' +-3 +`-2.5 round' +-2 +`-2.4 round' +-2 +`-2.1 round' +-2 +`-1.9 round' +-2 +`-1.6 round' +-2 +`-1.5 round' +-2 +`-1.4 round' +-1 +`-1.1 round' +-1 +`0.0 round' +0 +`1.1 round' +1 +`1.4 round' +1 +`1.5 round' +2 +`1.6 round' +2 +`1.9 round' +2 +`2.1 round' +2 +`2.4 round' +2 +`2.5 round' +2 +`2.6 round' +3 +`2.9 round' +3 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_a.nx.in new file mode 100644 index 000000000..d8effbebc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_a.nx.in @@ -0,0 +1,56 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-1 round' + `0 round' + `1 round' + + `-1.0 round' + `0.0 round' + `1.0 round' + + `-2.9 round' + `-2.6 round' + `-2.5 round' + `-2.4 round' + `-2.1 round' + + `-1.9 round' + `-1.6 round' + `-1.5 round' + `-1.4 round' + `-1.1 round' + + `0.0 round' + + `1.1 round' + `1.4 round' + `1.5 round' + `1.6 round' + `1.9 round' + + `2.1 round' + `2.4 round' + `2.5 round' + `2.6 round' + `2.9 round' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_b.nx.exp new file mode 100644 index 000000000..d3037191b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --round-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_b.nx.in new file mode 100644 index 000000000..d47e2ec2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +round + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_c.nx.exp new file mode 100644 index 000000000..e0772a0e3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --round-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_c.nx.in new file mode 100644 index 000000000..76f0e2b60 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/round_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark round + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_a.nx.exp new file mode 100644 index 000000000..b36da6624 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_a.nx.exp @@ -0,0 +1,9 @@ +Test begin +(1) sadn --> (1) +(1 2) sadn --> (2 1) +(1 2 3) sadn --> (2 3 1) +(1 2 3 4) sadn --> (2 3 4 1) +(1 2 3 4 5) sadn --> (2 3 4 5 1) +(1 2 3 4 5 6) sadn --> (2 3 4 5 6 1) +(1 2 3 4 5 6 7) sadn --> (2 3 4 5 6 7 1) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_a.nx.in new file mode 100644 index 000000000..b42fc9f89 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_a.nx.in @@ -0,0 +1,33 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (1) + (1 2) + (1 2 3) + (1 2 3 4) + (1 2 3 4 5) + (1 2 3 4 5 6) + (1 2 3 4 5 6 7) +]{ + dup 1 sprints print + ` sadn --> ' print + + dup sadn + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_b.nx.exp new file mode 100644 index 000000000..aff6dddb8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sadn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_b.nx.in new file mode 100644 index 000000000..1c9b51706 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sadn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_c.nx.exp new file mode 100644 index 000000000..c8a03ee33 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sadn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_c.nx.in new file mode 100644 index 000000000..f04839485 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sadn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_d.nx.exp new file mode 100644 index 000000000..afe54ac14 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sadn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_d.nx.in new file mode 100644 index 000000000..a91cf46be --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sadn_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() sadn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_a.nx.exp new file mode 100644 index 000000000..ab4bb9356 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_a.nx.exp @@ -0,0 +1,9 @@ +Test begin +(1) saup --> (1) +(1 2) saup --> (2 1) +(1 2 3) saup --> (3 1 2) +(1 2 3 4) saup --> (4 1 2 3) +(1 2 3 4 5) saup --> (5 1 2 3 4) +(1 2 3 4 5 6) saup --> (6 1 2 3 4 5) +(1 2 3 4 5 6 7) saup --> (7 1 2 3 4 5 6) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_a.nx.in new file mode 100644 index 000000000..2f005eaf4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_a.nx.in @@ -0,0 +1,33 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (1) + (1 2) + (1 2 3) + (1 2 3 4) + (1 2 3 4 5) + (1 2 3 4 5 6) + (1 2 3 4 5 6 7) +]{ + dup 1 sprints print + ` saup --> ' print + + dup saup + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_b.nx.exp new file mode 100644 index 000000000..fa4215d3f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --saup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_b.nx.in new file mode 100644 index 000000000..113a0b21a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +saup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_c.nx.exp new file mode 100644 index 000000000..85bd3543c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --saup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_c.nx.in new file mode 100644 index 000000000..62e0f75ae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark saup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_d.nx.exp new file mode 100644 index 000000000..026a5df99 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --saup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_d.nx.in new file mode 100644 index 000000000..b41888ffb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/saup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() saup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_a.nx.exp new file mode 100644 index 000000000..6eb98b979 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +(1 1) +(1 2 1) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_a.nx.in new file mode 100644 index 000000000..ccc9cd8c2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) dup sbdup pstack clear +(1 2) dup sbdup pstack clear + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_b.nx.exp new file mode 100644 index 000000000..8cf711875 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_b.nx.in new file mode 100644 index 000000000..b75fd5f21 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sbdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_c.nx.exp new file mode 100644 index 000000000..35973e9c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_c.nx.in new file mode 100644 index 000000000..bbff8be4a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sbdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_d.nx.exp new file mode 100644 index 000000000..bf34f1c76 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_d.nx.in new file mode 100644 index 000000000..cd603b13a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbdup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() sbdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_a.nx.exp new file mode 100644 index 000000000..fcae90a03 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_a.nx.exp @@ -0,0 +1,6 @@ +1 +() +1 +(2) +1 +(2 3) diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_a.nx.in new file mode 100644 index 000000000..340b14afc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_a.nx.in @@ -0,0 +1,15 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(1) dup sbpop pstack clear +(1 2) dup sbpop pstack clear +(1 2 3) dup sbpop pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_b.nx.exp new file mode 100644 index 000000000..d34fb836e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_b.nx.in new file mode 100644 index 000000000..40445eb12 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +sbpop diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_c.nx.exp new file mode 100644 index 000000000..f7c3a98b1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_c.nx.in new file mode 100644 index 000000000..7ca88fc75 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 sbpop diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_d.nx.exp new file mode 100644 index 000000000..6b9f57f2d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_d.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_d.nx.in new file mode 100644 index 000000000..783c495f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpop_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() spop diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_a.nx.exp new file mode 100644 index 000000000..9c57ca232 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +(`hi' -stack- --pop-- null $foo -mark- 1 -fino- -dict- -array- true) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_a.nx.in new file mode 100644 index 000000000..bdffb4b05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() + +[ + `true' + `[]' + `<>' + `(' + `1' + `mark' + `$foo' + `null' + `~pop' + `()' + ``hi'' +]{ + cvx eval + over exch sbpush +} foreach + +pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_b.nx.exp new file mode 100644 index 000000000..59a8197e8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbpush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_b.nx.in new file mode 100644 index 000000000..27f6f0fc3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +sbpush diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_c.nx.exp new file mode 100644 index 000000000..985da8fc1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_c.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbpush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_c.nx.in new file mode 100644 index 000000000..17697a031 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 sbpush diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_d.nx.exp new file mode 100644 index 000000000..67b91418d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_d.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sbpush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_d.nx.in new file mode 100644 index 000000000..fcf1e2e0d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sbpush_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 2 sbpush diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_a.nx.exp new file mode 100644 index 000000000..ef4a0ac86 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_a.nx.exp @@ -0,0 +1,4 @@ +() +() +(1 2 3) +() diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_a.nx.in new file mode 100644 index 000000000..5bd1b19bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_a.nx.in @@ -0,0 +1,16 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() pstack +dup sclear pstack clear +(1 2 3) pstack +dup sclear pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_b.nx.exp new file mode 100644 index 000000000..32c115202 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sclear-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_b.nx.in new file mode 100644 index 000000000..0e10ae809 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +sclear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_c.nx.exp new file mode 100644 index 000000000..6f10f5691 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1 2 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sclear-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_c.nx.in new file mode 100644 index 000000000..5314b30a2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sclear_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 2 3 sclear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_a.nx.exp new file mode 100644 index 000000000..ad06b52d0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_a.nx.exp @@ -0,0 +1,5 @@ +(-mark- 1 2 -mark- 3 4 5 -mark- -mark-) +(-mark- 1 2 -mark- 3 4 5 -mark-) +(-mark- 1 2 -mark- 3 4 5) +(-mark- 1 2) +() diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_a.nx.in new file mode 100644 index 000000000..396053b07 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(mark 1 2 mark 3 4 5 mark mark) pstack +dup scleartomark pstack +dup scleartomark pstack +dup scleartomark pstack +dup scleartomark pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_b.nx.exp new file mode 100644 index 000000000..fd84d7605 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scleartomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_b.nx.in new file mode 100644 index 000000000..b48d75b1a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +scleartomark diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_c.nx.exp new file mode 100644 index 000000000..7632905e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scleartomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_c.nx.in new file mode 100644 index 000000000..83763fa38 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 scleartomark diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_d.nx.exp new file mode 100644 index 000000000..2df8e5158 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_d.nx.exp @@ -0,0 +1,7 @@ +Error $unmatchedmark +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scleartomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_d.nx.in new file mode 100644 index 000000000..50e1b576c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scleartomark_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(1 2 3) scleartomark diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_a.nx.exp new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_a.nx.exp @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_a.nx.in new file mode 100644 index 000000000..669e3e003 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_a.nx.in @@ -0,0 +1,16 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() scount pstack clear +(1) scount pstack clear +(1 2) scount pstack clear +(1 2 3) scount pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_b.nx.exp new file mode 100644 index 000000000..f63a4c0fc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scount-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_b.nx.in new file mode 100644 index 000000000..1e9968fb4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +scount diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_c.nx.exp new file mode 100644 index 000000000..7508cfe51 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scount-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_c.nx.in new file mode 100644 index 000000000..738262948 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scount_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 scount diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_a.nx.exp new file mode 100644 index 000000000..e2b500bdc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_a.nx.exp @@ -0,0 +1,5 @@ +0 +1 +0 +1 +2 diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_a.nx.in new file mode 100644 index 000000000..3eb02028f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(mark) scounttomark pstack clear +(mark 1) scounttomark pstack clear +(mark 1 mark) scounttomark pstack clear +(mark 1 mark 2) scounttomark pstack clear +(mark 1 mark 2 3) scounttomark pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_b.nx.exp new file mode 100644 index 000000000..2cc068943 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scounttomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_b.nx.in new file mode 100644 index 000000000..466dfb541 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +scounttomark diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_c.nx.exp new file mode 100644 index 000000000..a6c044caf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --scounttomark-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_c.nx.in new file mode 100644 index 000000000..a03df2cf6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/scounttomark_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 scounttomark diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_a.nx.exp new file mode 100644 index 000000000..4cd116c6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +(2 1 0) --> (1 0 2) +(3 2 1 0) --> (3 1 0 2) +(4 3 2 1 0) --> (4 3 1 0 2) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_a.nx.in new file mode 100644 index 000000000..d135258d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (2 1 0) + (3 2 1 0) + (4 3 2 1 0) +]{ + dup 1 sprints print + ` --> ' print + + dup sdn + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_b.nx.exp new file mode 100644 index 000000000..2be43631e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sdn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_b.nx.in new file mode 100644 index 000000000..b1d6d9fbf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sdn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_c.nx.exp new file mode 100644 index 000000000..411403a3d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sdn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_c.nx.in new file mode 100644 index 000000000..21976265f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sdn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_d.nx.exp new file mode 100644 index 000000000..d236eda60 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sdn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_d.nx.in new file mode 100644 index 000000000..75f855566 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdn_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1 0) sdn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_a.nx.exp new file mode 100644 index 000000000..0b0cec4bb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_a.nx.exp @@ -0,0 +1,2 @@ +(1 1) +(1 2 2) diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_a.nx.in new file mode 100644 index 000000000..f6a7717af --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_a.nx.in @@ -0,0 +1,14 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(1) dup sdup pstack clear +(1 2) dup sdup pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_b.nx.exp new file mode 100644 index 000000000..7e4723784 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_b.nx.in new file mode 100644 index 000000000..e68fe5a9b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +sdup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_c.nx.exp new file mode 100644 index 000000000..563057772 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_c.nx.in new file mode 100644 index 000000000..49ad054bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 sdup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_d.nx.exp new file mode 100644 index 000000000..55438b263 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_d.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_d.nx.in new file mode 100644 index 000000000..a104b07e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sdup_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() sdup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/search.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/search.nx.exp new file mode 100644 index 000000000..0428b9dd7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/search.nx.exp @@ -0,0 +1,28 @@ +Test begin +s> `a' `bc' search +false +`a' +s> `abcdefghij' `bcd' search +true +`a' +`bcd' +`efghij' +s> `abbc' `ab' search +true +`' +`ab' +`bc' +s> `abbc' `bb' search +true +`a' +`bb' +`c' +s> `abbc' `bc' search +true +`ab' +`bc' +`' +s> `abbc' `B' search +false +`abbc' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/search.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/search.nx.in new file mode 100644 index 000000000..8478168f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/search.nx.in @@ -0,0 +1,28 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + ``a' `bc' search' + ``abcdefghij' `bcd' search' + ``abbc' `ab' search' + ``abbc' `bb' search' + ``abbc' `bc' search' + ``abbc' `B' search' +] { + dup `s> ' print print `\n' print + cvx eval + pstack clear +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_a.nx.exp new file mode 100644 index 000000000..13da1e4e2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +true +`foo' +false +true +`42' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_a.nx.in new file mode 100644 index 000000000..ab6c5b577 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$foo `foo' setenv +envdict $foo known 1 sprint +envdict $foo get 1 sprint +$foo unsetenv +envdict $foo known 1 sprint + +$foo 42 setenv +envdict $foo known 1 sprint +envdict $foo get 1 sprint +$foo unsetenv +envdict $foo known 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_b.nx.exp new file mode 100644 index 000000000..e9d0cb455 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: ($foo) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setenv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_b.nx.in new file mode 100644 index 000000000..ad468b366 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$foo setenv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_c.nx.exp new file mode 100644 index 000000000..603be7c76 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `foo') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setenv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_c.nx.in new file mode 100644 index 000000000..e0751bd6e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setenv_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `foo' setenv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_a.nx.in new file mode 100644 index 000000000..45e920bde --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +gstderr + +gstdout setgstderr +gstderr gstdout ne { + `gstderr and gstdout are not equal\n' print +} if + +gstderr eq { + `gstderr did not really change\n' print +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_b.nx.exp new file mode 100644 index 000000000..d06c8a9c7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setgstderr-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_b.nx.in new file mode 100644 index 000000000..801ccb0dd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +setgstderr + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_c.nx.exp new file mode 100644 index 000000000..cb9fa97eb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setgstderr-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_c.nx.in new file mode 100644 index 000000000..f522be4e0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstderr_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark setgstderr + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_a.nx.in new file mode 100644 index 000000000..2a7c830fb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +gstdin + +gstdout setgstdin +gstdin gstdout ne { + `gstdin and gstdout are not equal\n' print +} if + +gstdin eq { + `gstdin did not really change\n' print +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_b.nx.exp new file mode 100644 index 000000000..e89814b2b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setgstdin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_b.nx.in new file mode 100644 index 000000000..852cb887a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +setgstdin + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_c.nx.exp new file mode 100644 index 000000000..02a8ef5c2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setgstdin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_c.nx.in new file mode 100644 index 000000000..1d07b41b5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdin_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark setgstdin + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_a.nx.in new file mode 100644 index 000000000..3f1413328 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +gstdout + +gstderr setgstdout +gstdout gstderr ne { + `gstdout and gstderr are not equal\n' print +} if + +gstdout eq { + `gstdout did not really change\n' print +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_b.nx.exp new file mode 100644 index 000000000..57398f25e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setgstdout-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_b.nx.in new file mode 100644 index 000000000..12b94aa07 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +setgstdout + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_c.nx.exp new file mode 100644 index 000000000..babad439b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setgstdout-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_c.nx.in new file mode 100644 index 000000000..33921299b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setgstdout_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark setgstdout + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_a.nx.in new file mode 100644 index 000000000..b30c5a63c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stderr + +stdout setstderr +stderr stdout ne { + `stderr and stdout are not equal\n' print +} if + +stderr eq { + `stderr did not really change\n' print +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_b.nx.exp new file mode 100644 index 000000000..0de5d3ce6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setstderr-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_b.nx.in new file mode 100644 index 000000000..a83879103 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +setstderr + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_c.nx.exp new file mode 100644 index 000000000..228ef5e72 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setstderr-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_c.nx.in new file mode 100644 index 000000000..5758a09e8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstderr_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark setstderr + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_a.nx.in new file mode 100644 index 000000000..fc279b2b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stdin + +stdout setstdin +stdin stdout ne { + `stdin and stdout are not equal\n' print +} if + +stdin eq { + `stdin did not really change\n' print +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_b.nx.exp new file mode 100644 index 000000000..5e82059cb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setstdin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_b.nx.in new file mode 100644 index 000000000..849e2c879 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +setstdin + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_c.nx.exp new file mode 100644 index 000000000..88f12c1aa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setstdin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_c.nx.in new file mode 100644 index 000000000..14e9bd327 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdin_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark setstdin + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_a.nx.in new file mode 100644 index 000000000..7506ac298 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stdout + +stderr setstdout +stdout stderr ne { + `stdout and stderr are not equal\n' print +} if + +stdout eq { + `stdout did not really change\n' print +} if + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_b.nx.exp new file mode 100644 index 000000000..87b969d2b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setstdout-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_b.nx.in new file mode 100644 index 000000000..ebc2bc40c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +setstdout + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_c.nx.exp new file mode 100644 index 000000000..4a688de7b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --setstdout-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_c.nx.in new file mode 100644 index 000000000..f153560ec --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/setstdout_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark setstdout + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_a.nx.exp new file mode 100644 index 000000000..736d2eb83 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +(1 3 2) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_a.nx.in new file mode 100644 index 000000000..c1ad38c72 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1 2 3) dup sexch 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_b.nx.exp new file mode 100644 index 000000000..7e2674a43 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sexch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_b.nx.in new file mode 100644 index 000000000..be4ef708d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sexch + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_c.nx.exp new file mode 100644 index 000000000..32372c2b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sexch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_c.nx.in new file mode 100644 index 000000000..1087ce090 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +3 sexch + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_d.nx.exp new file mode 100644 index 000000000..52bed2a92 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sexch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_d.nx.in new file mode 100644 index 000000000..51c013f97 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sexch_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) sexch + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_a.nx.exp new file mode 100644 index 000000000..f0c02323e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_a.nx.exp @@ -0,0 +1,22 @@ +Test begin +`0 0' +0 +`1 0' +1 +`16@7fffffffffffffff -62' +1 +`16@7fffffffffffffff -63' +0 +`16@7fffffffffffffff -64' +0 +`16@7fffffffffffffff -65' +0 +`1 62' +4611686018427387904 +`1 63' +-9223372036854775808 +`1 64' +0 +`1 65' +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_a.nx.in new file mode 100644 index 000000000..35daa6c55 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_a.nx.in @@ -0,0 +1,33 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0' + `1 0' + `16@7fffffffffffffff -62' + `16@7fffffffffffffff -63' + `16@7fffffffffffffff -64' + `16@7fffffffffffffff -65' + `1 62' + `1 63' + `1 64' + `1 65' +]{ + dup 1 sprint + cvx eval + shift + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_b.nx.exp new file mode 100644 index 000000000..fdf32bd54 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --shift-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_b.nx.in new file mode 100644 index 000000000..537553483 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 shift + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_c.nx.exp new file mode 100644 index 000000000..6c61066e4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --shift-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_c.nx.in new file mode 100644 index 000000000..9d72acba6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark shift + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_d.nx.exp new file mode 100644 index 000000000..27c0231b8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --shift-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_d.nx.in new file mode 100644 index 000000000..62c9f96b7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/shift_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 shift + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_a.nx.exp new file mode 100644 index 000000000..fde35f9bf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +(`a' `b' `c' `a') +(`a' `b' `c' `b') +(`a' `b' `c' `c') +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_a.nx.in new file mode 100644 index 000000000..cb496bd02 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_a.nx.in @@ -0,0 +1,20 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(`a' `b' `c') dup 0 sibdup pstack clear +(`a' `b' `c') dup 1 sibdup pstack clear +(`a' `b' `c') dup 2 sibdup pstack clear + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_b.nx.exp new file mode 100644 index 000000000..c932fd800 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_b.nx.in new file mode 100644 index 000000000..cf6f244a4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 sibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_c.nx.exp new file mode 100644 index 000000000..e3db63676 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_c.nx.in new file mode 100644 index 000000000..ed807af0a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(2 1 0) -1 sibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_d.nx.exp new file mode 100644 index 000000000..2487ef869 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_d.nx.in new file mode 100644 index 000000000..78c72e08a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 0 sibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_e.nx.exp new file mode 100644 index 000000000..28371a7ac --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibdup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_e.nx.in new file mode 100644 index 000000000..c0dad1375 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibdup_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(2 1 0) 3 sibdup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_a.nx.exp new file mode 100644 index 000000000..4b2ac7d62 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_a.nx.exp @@ -0,0 +1,20 @@ +Test begin +`(0) dup 0 sibpop' +0 +() +`(0 1) dup 0 sibpop' +0 +(1) +`(0 1) dup 1 sibpop' +1 +(0) +`(0 1 2) dup 0 sibpop' +0 +(1 2) +`(0 1 2) dup 1 sibpop' +1 +(0 2) +`(0 1 2) dup 2 sibpop' +2 +(0 1) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_a.nx.in new file mode 100644 index 000000000..6d90f50c4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `(0) dup 0 sibpop' + `(0 1) dup 0 sibpop' + `(0 1) dup 1 sibpop' + `(0 1 2) dup 0 sibpop' + `(0 1 2) dup 1 sibpop' + `(0 1 2) dup 2 sibpop' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_b.nx.exp new file mode 100644 index 000000000..ac78ab2d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_b.nx.in new file mode 100644 index 000000000..91c688406 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 sibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_c.nx.exp new file mode 100644 index 000000000..6cefe2a3d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_c.nx.in new file mode 100644 index 000000000..6f70de521 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() mark sibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_d.nx.exp new file mode 100644 index 000000000..124d2788a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_d.nx.in new file mode 100644 index 000000000..09a7d94ca --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 sibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_e.nx.exp new file mode 100644 index 000000000..16f3214f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_e.nx.in new file mode 100644 index 000000000..1236c7875 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) -1 sibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_f.nx.exp new file mode 100644 index 000000000..bd0581116 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_f.nx.in new file mode 100644 index 000000000..9a0ccca41 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 0 sibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_g.nx.exp new file mode 100644 index 000000000..7c6e0a26b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sibpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_g.nx.in new file mode 100644 index 000000000..924cb5ce4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sibpop_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) 1 sibpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_a.nx.exp new file mode 100644 index 000000000..c83ad1cf7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_a.nx.exp @@ -0,0 +1,3 @@ +(`a' `b' `c' `c') +(`a' `b' `c' `b') +(`a' `b' `c' `a') diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_a.nx.in new file mode 100644 index 000000000..b4d3e0427 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_a.nx.in @@ -0,0 +1,15 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(`a' `b' `c') dup 0 sidup pstack clear +(`a' `b' `c') dup 1 sidup pstack clear +(`a' `b' `c') dup 2 sidup pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_b.nx.exp new file mode 100644 index 000000000..c352e5fad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sidup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_b.nx.in new file mode 100644 index 000000000..efb2d8efc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +sidup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_c.nx.exp new file mode 100644 index 000000000..0b7f4eed2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_c.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sidup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_c.nx.in new file mode 100644 index 000000000..aa4b0881d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 sidup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_d.nx.exp new file mode 100644 index 000000000..28650d67f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_d.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sidup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_d.nx.in new file mode 100644 index 000000000..56ac774fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 mark sidup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_e.nx.exp new file mode 100644 index 000000000..19a9da10f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_e.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sidup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_e.nx.in new file mode 100644 index 000000000..16736994c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_e.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +mark 1 sidup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_f.nx.exp new file mode 100644 index 000000000..937352b07 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_f.nx.exp @@ -0,0 +1,7 @@ +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sidup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_f.nx.in new file mode 100644 index 000000000..992e2240f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_f.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() -1 sidup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_g.nx.exp new file mode 100644 index 000000000..cc059a1f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_g.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (-stack- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sidup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_g.nx.in new file mode 100644 index 000000000..d7787443f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sidup_g.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() 0 sidup diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_a.nx.exp new file mode 100644 index 000000000..d5a70a072 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_a.nx.exp @@ -0,0 +1,62 @@ +Test begin +`-7' +-6.569866e-01 +`-6' +2.794155e-01 +`-5' +9.589243e-01 +`-4' +7.568025e-01 +`-3' +-1.411200e-01 +`-2' +-9.092974e-01 +`-1' +-8.414710e-01 +`0' +0.000000e+00 +`1' +8.414710e-01 +`2' +9.092974e-01 +`3' +1.411200e-01 +`4' +-7.568025e-01 +`5' +-9.589243e-01 +`6' +-2.794155e-01 +`7' +6.569866e-01 +`-7.1415' +-7.567419e-01 +`-6.1415' +1.412117e-01 +`-5.1415' +9.093360e-01 +`-4.1415' +8.414209e-01 +`-3.1415' +-9.265359e-05 +`-2.1415' +-8.415210e-01 +`-1.1415' +-9.092589e-01 +`0.1415' +1.410283e-01 +`1.1415' +9.092589e-01 +`2.1415' +8.415210e-01 +`3.1415' +9.265359e-05 +`4.1415' +-8.414209e-01 +`5.1415' +-9.093360e-01 +`6.1415' +-1.412117e-01 +`7.1415' +7.567419e-01 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_a.nx.in new file mode 100644 index 000000000..f35b1a102 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_a.nx.in @@ -0,0 +1,54 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-7' + `-6' + `-5' + `-4' + `-3' + `-2' + `-1' + `0' + `1' + `2' + `3' + `4' + `5' + `6' + `7' + + `-7.1415' + `-6.1415' + `-5.1415' + `-4.1415' + `-3.1415' + `-2.1415' + `-1.1415' + `0.1415' + `1.1415' + `2.1415' + `3.1415' + `4.1415' + `5.1415' + `6.1415' + `7.1415' +]{ + dup 1 sprint + cvx eval sin + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_b.nx.exp new file mode 100644 index 000000000..94ee812cd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_b.nx.in new file mode 100644 index 000000000..231b932f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sin + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_c.nx.exp new file mode 100644 index 000000000..044418adc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sin-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_c.nx.in new file mode 100644 index 000000000..18caed1f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sin_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sin + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_a.nx.exp new file mode 100644 index 000000000..538f3d8a7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_a.nx.exp @@ -0,0 +1,20 @@ +Test begin +`(0) dup 0 sipop' +0 +() +`(1 0) dup 0 sipop' +0 +(1) +`(1 0) dup 1 sipop' +1 +(0) +`(2 1 0) dup 0 sipop' +0 +(2 1) +`(2 1 0) dup 1 sipop' +1 +(2 0) +`(2 1 0) dup 2 sipop' +2 +(1 0) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_a.nx.in new file mode 100644 index 000000000..af49c10f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `(0) dup 0 sipop' + `(1 0) dup 0 sipop' + `(1 0) dup 1 sipop' + `(2 1 0) dup 0 sipop' + `(2 1 0) dup 1 sipop' + `(2 1 0) dup 2 sipop' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_b.nx.exp new file mode 100644 index 000000000..32e912924 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_b.nx.in new file mode 100644 index 000000000..6f294771d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 sipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_c.nx.exp new file mode 100644 index 000000000..a047d1973 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_c.nx.in new file mode 100644 index 000000000..909bbef3d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() mark sipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_d.nx.exp new file mode 100644 index 000000000..d952fd1f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_d.nx.in new file mode 100644 index 000000000..fb45eb122 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 sipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_e.nx.exp new file mode 100644 index 000000000..49e68d1c7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_e.nx.in new file mode 100644 index 000000000..fff4e18c5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) -1 sipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_f.nx.exp new file mode 100644 index 000000000..5260af154 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_f.nx.in new file mode 100644 index 000000000..fd64d5e15 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 0 sipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_g.nx.exp new file mode 100644 index 000000000..04cf7c93b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sipop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_g.nx.in new file mode 100644 index 000000000..9f74444ae --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sipop_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) 1 sipop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_a.nx.exp new file mode 100644 index 000000000..8a90eabf3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_a.nx.exp @@ -0,0 +1,23 @@ +Test begin +() 0 snpop --> () [] +(1) 0 snpop --> (1) [] +(1) 1 snpop --> () [1] +(1 2) 0 snpop --> (1 2) [] +(1 2) 1 snpop --> (2) [1] +(1 2) 2 snpop --> () [1 2] +(1 2 3) 0 snpop --> (1 2 3) [] +(1 2 3) 1 snpop --> (2 3) [1] +(1 2 3) 2 snpop --> (3) [1 2] +(1 2 3) 3 snpop --> () [1 2 3] +(1 2 3 4) 0 snpop --> (1 2 3 4) [] +(1 2 3 4) 1 snpop --> (2 3 4) [1] +(1 2 3 4) 2 snpop --> (3 4) [1 2] +(1 2 3 4) 3 snpop --> (4) [1 2 3] +(1 2 3 4) 4 snpop --> () [1 2 3 4] +(1 2 3 4 5) 0 snpop --> (1 2 3 4 5) [] +(1 2 3 4 5) 1 snpop --> (2 3 4 5) [1] +(1 2 3 4 5) 2 snpop --> (3 4 5) [1 2] +(1 2 3 4 5) 3 snpop --> (4 5) [1 2 3] +(1 2 3 4 5) 4 snpop --> (5) [1 2 3 4] +(1 2 3 4 5) 5 snpop --> () [1 2 3 4 5] +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_a.nx.in new file mode 100644 index 000000000..215b9d407 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_a.nx.in @@ -0,0 +1,39 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + () + (1) + (1 2) + (1 2 3) + (1 2 3 4) + (1 2 3 4 5) +]{ + dup scount 0 1 dn { + over 1 sprints print + ` ' print + dup cvs print + ` snpop --> ' print + + over () copy dup dn snbpop + + exch 1 sprints print + ` ' print + 1 sprint + } for + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_b.nx.exp new file mode 100644 index 000000000..2c5c577f8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_b.nx.in new file mode 100644 index 000000000..c1dd773d0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 snbpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_c.nx.exp new file mode 100644 index 000000000..f754791d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_c.nx.in new file mode 100644 index 000000000..f3d824ab6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() mark snbpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_d.nx.exp new file mode 100644 index 000000000..64e8d738a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_d.nx.in new file mode 100644 index 000000000..63993653c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 snbpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_e.nx.exp new file mode 100644 index 000000000..dc3635d5e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_e.nx.in new file mode 100644 index 000000000..f58e80d8d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() -1 snbpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_f.nx.exp new file mode 100644 index 000000000..7948f41b9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_f.nx.in new file mode 100644 index 000000000..73e2fac5b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 1 snbpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_g.nx.exp new file mode 100644 index 000000000..30601fc4b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snbpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_g.nx.in new file mode 100644 index 000000000..8a20dedc3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snbpop_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) 2 snbpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_a.nx.exp new file mode 100644 index 000000000..a1cc28fd5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_a.nx.exp @@ -0,0 +1,17 @@ +Test begin +(0) 1 sndn --> (0) +(1 0) 1 sndn --> (1 0) +(1 0) 2 sndn --> (0 1) +(2 1 0) 1 sndn --> (2 1 0) +(2 1 0) 2 sndn --> (2 0 1) +(2 1 0) 3 sndn --> (1 0 2) +(3 2 1 0) 1 sndn --> (3 2 1 0) +(3 2 1 0) 2 sndn --> (3 2 0 1) +(3 2 1 0) 3 sndn --> (3 1 0 2) +(3 2 1 0) 4 sndn --> (2 1 0 3) +(4 3 2 1 0) 1 sndn --> (4 3 2 1 0) +(4 3 2 1 0) 2 sndn --> (4 3 2 0 1) +(4 3 2 1 0) 3 sndn --> (4 3 1 0 2) +(4 3 2 1 0) 4 sndn --> (4 2 1 0 3) +(4 3 2 1 0) 5 sndn --> (3 2 1 0 4) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_a.nx.in new file mode 100644 index 000000000..64385db4f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (0) + (1 0) + (2 1 0) + (3 2 1 0) + (4 3 2 1 0) +]{ + dup scount 1 1 dn { + over 1 sprints print + ` ' print + dup cvs print + ` sndn --> ' print + + over () copy dup dn sndn + + 1 sprint + } for + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_b.nx.exp new file mode 100644 index 000000000..33467aa2e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_b.nx.in new file mode 100644 index 000000000..c7d67a76b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +3 sndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_c.nx.exp new file mode 100644 index 000000000..dd68baf07 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_c.nx.in new file mode 100644 index 000000000..a5c9b8359 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) 0 sndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_d.nx.exp new file mode 100644 index 000000000..f49d4b778 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 4) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndn-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_d.nx.in new file mode 100644 index 000000000..2e25d51db --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndn_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(2 1 0) 4 sndn + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_a.nx.exp new file mode 100644 index 000000000..fbf900abe --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_a.nx.exp @@ -0,0 +1,22 @@ +Test begin +`() dup 0 sndup' +() +`(0) dup 0 sndup' +(0) +`(0) dup 1 sndup' +(0 0) +`(1 0) dup 0 sndup' +(1 0) +`(1 0) dup 1 sndup' +(1 0 0) +`(1 0) dup 2 sndup' +(1 0 1 0) +`(2 1 0) dup 0 sndup' +(2 1 0) +`(2 1 0) dup 1 sndup' +(2 1 0 0) +`(2 1 0) dup 2 sndup' +(2 1 0 1 0) +`(2 1 0) dup 3 sndup' +(2 1 0 2 1 0) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_a.nx.in new file mode 100644 index 000000000..8e31675ac --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `() dup 0 sndup' + `(0) dup 0 sndup' + `(0) dup 1 sndup' + `(1 0) dup 0 sndup' + `(1 0) dup 1 sndup' + `(1 0) dup 2 sndup' + `(2 1 0) dup 0 sndup' + `(2 1 0) dup 1 sndup' + `(2 1 0) dup 2 sndup' + `(2 1 0) dup 3 sndup' +]{ + dup 1 sprint + cvx eval pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_b.nx.exp new file mode 100644 index 000000000..aff49d265 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_b.nx.in new file mode 100644 index 000000000..1842c03bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 sndup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_c.nx.exp new file mode 100644 index 000000000..9d78b30b2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_c.nx.in new file mode 100644 index 000000000..0060802d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) -1 sndup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_d.nx.exp new file mode 100644 index 000000000..4d7b4b8a0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_d.nx.in new file mode 100644 index 000000000..58134012a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 1 sndup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_e.nx.exp new file mode 100644 index 000000000..d75aea5fc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 4) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sndup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_e.nx.in new file mode 100644 index 000000000..1a871a093 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sndup_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(2 1 0) 4 sndup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_a.nx.exp new file mode 100644 index 000000000..d6597463f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +`(1 0) dup snip' +1 +(0) +`(2 1 0) dup snip' +1 +(2 0) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_a.nx.in new file mode 100644 index 000000000..341b81d89 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_a.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `(1 0) dup snip' + `(2 1 0) dup snip' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_b.nx.exp new file mode 100644 index 000000000..ae40ac68f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snip-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_b.nx.in new file mode 100644 index 000000000..db85ec2ea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +snip + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_c.nx.exp new file mode 100644 index 000000000..cd7e64b11 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snip-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_c.nx.in new file mode 100644 index 000000000..7b18bc926 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark snip + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_d.nx.exp new file mode 100644 index 000000000..fbe7b97bc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snip-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_d.nx.in new file mode 100644 index 000000000..3b3f0e653 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snip_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) snip + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_a.nx.exp new file mode 100644 index 000000000..63d9baa53 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_a.nx.exp @@ -0,0 +1,23 @@ +Test begin +() 0 snpop --> () [] +(1) 0 snpop --> (1) [] +(1) 1 snpop --> () [1] +(1 2) 0 snpop --> (1 2) [] +(1 2) 1 snpop --> (1) [2] +(1 2) 2 snpop --> () [1 2] +(1 2 3) 0 snpop --> (1 2 3) [] +(1 2 3) 1 snpop --> (1 2) [3] +(1 2 3) 2 snpop --> (1) [2 3] +(1 2 3) 3 snpop --> () [1 2 3] +(1 2 3 4) 0 snpop --> (1 2 3 4) [] +(1 2 3 4) 1 snpop --> (1 2 3) [4] +(1 2 3 4) 2 snpop --> (1 2) [3 4] +(1 2 3 4) 3 snpop --> (1) [2 3 4] +(1 2 3 4) 4 snpop --> () [1 2 3 4] +(1 2 3 4 5) 0 snpop --> (1 2 3 4 5) [] +(1 2 3 4 5) 1 snpop --> (1 2 3 4) [5] +(1 2 3 4 5) 2 snpop --> (1 2 3) [4 5] +(1 2 3 4 5) 3 snpop --> (1 2) [3 4 5] +(1 2 3 4 5) 4 snpop --> (1) [2 3 4 5] +(1 2 3 4 5) 5 snpop --> () [1 2 3 4 5] +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_a.nx.in new file mode 100644 index 000000000..b581ffb80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_a.nx.in @@ -0,0 +1,39 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + () + (1) + (1 2) + (1 2 3) + (1 2 3 4) + (1 2 3 4 5) +]{ + dup scount 0 1 dn { + over 1 sprints print + ` ' print + dup cvs print + ` snpop --> ' print + + over () copy dup dn snpop + + exch 1 sprints print + ` ' print + 1 sprint + } for + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_b.nx.exp new file mode 100644 index 000000000..ea71c33c8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_b.nx.in new file mode 100644 index 000000000..fd9c64bbf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 snpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_c.nx.exp new file mode 100644 index 000000000..01581f7fb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_c.nx.in new file mode 100644 index 000000000..684251b65 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() mark snpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_d.nx.exp new file mode 100644 index 000000000..fc1ea5a28 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_d.nx.in new file mode 100644 index 000000000..afa01fa41 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 snpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_e.nx.exp new file mode 100644 index 000000000..f0af938e0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_e.nx.in new file mode 100644 index 000000000..7a45446c3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() -1 snpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_f.nx.exp new file mode 100644 index 000000000..f7dd1ee2e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_f.nx.in new file mode 100644 index 000000000..53157403d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 1 snpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_g.nx.exp new file mode 100644 index 000000000..b81cecef8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snpop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_g.nx.in new file mode 100644 index 000000000..4b91a2250 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snpop_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) 2 snpop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_a.nx.exp new file mode 100644 index 000000000..277cb3854 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_a.nx.exp @@ -0,0 +1,17 @@ +Test begin +(0) 1 snup --> (0) +(1 0) 1 snup --> (1 0) +(1 0) 2 snup --> (0 1) +(2 1 0) 1 snup --> (2 1 0) +(2 1 0) 2 snup --> (2 0 1) +(2 1 0) 3 snup --> (0 2 1) +(3 2 1 0) 1 snup --> (3 2 1 0) +(3 2 1 0) 2 snup --> (3 2 0 1) +(3 2 1 0) 3 snup --> (3 0 2 1) +(3 2 1 0) 4 snup --> (0 3 2 1) +(4 3 2 1 0) 1 snup --> (4 3 2 1 0) +(4 3 2 1 0) 2 snup --> (4 3 2 0 1) +(4 3 2 1 0) 3 snup --> (4 3 0 2 1) +(4 3 2 1 0) 4 snup --> (4 0 3 2 1) +(4 3 2 1 0) 5 snup --> (0 4 3 2 1) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_a.nx.in new file mode 100644 index 000000000..b3847e854 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (0) + (1 0) + (2 1 0) + (3 2 1 0) + (4 3 2 1 0) +]{ + dup scount 1 1 dn { + over 1 sprints print + ` ' print + dup cvs print + ` snup --> ' print + + over () copy dup dn snup + + 1 sprint + } for + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_b.nx.exp new file mode 100644 index 000000000..1099546c0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_b.nx.in new file mode 100644 index 000000000..831ac3593 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +3 snup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_c.nx.exp new file mode 100644 index 000000000..4753ce6cc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-stack- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_c.nx.in new file mode 100644 index 000000000..ff6b2cb58 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) 0 snup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_d.nx.exp new file mode 100644 index 000000000..63e434ad5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 4) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --snup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_d.nx.in new file mode 100644 index 000000000..f22907c90 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/snup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(2 1 0) 4 snup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_a.nx.exp new file mode 100644 index 000000000..d47c86ab5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +(0 1) --> (0 1 0) +(0 1 2) --> (0 1 2 1) +(0 1 2 3) --> (0 1 2 3 2) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_a.nx.in new file mode 100644 index 000000000..55088264a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (0 1) + (0 1 2) + (0 1 2 3) +]{ + dup 1 sprints print + ` --> ' print + + dup sover + + 1 sprint + + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_b.nx.exp new file mode 100644 index 000000000..6d312af0d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sover-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_b.nx.in new file mode 100644 index 000000000..513d6010f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sover + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_c.nx.exp new file mode 100644 index 000000000..a3cb82e6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sover-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_c.nx.in new file mode 100644 index 000000000..a086db210 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sover + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_d.nx.exp new file mode 100644 index 000000000..f2e522d39 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sover-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_d.nx.in new file mode 100644 index 000000000..ea45026bf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() sover + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_e.nx.exp new file mode 100644 index 000000000..f2e522d39 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sover-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_e.nx.in new file mode 100644 index 000000000..78bbc2c95 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sover_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) sover + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_a.nx.exp new file mode 100644 index 000000000..3ef7f2cb5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_a.nx.exp @@ -0,0 +1,48 @@ +Test begin +{`a:b:c' `:' split 1 sprint} +[`a' `b' `c'] +{`a:b:c' `:' < > split 1 sprint} +[`a' `b' `c'] +{`a:b:c' `:' regex split 1 sprint} +[`a' `b' `c'] +{`a:b:c' `:' < > regex split 1 sprint} +[`a' `b' `c'] +{`@a@A@b@B@c@C@d@D' `A|B|C|D' split 1 sprint} +[`@a@' `@b@' `@c@' `@d@'] +{`@a@A@b@B@c@C@d@D' `A|B|C|D' < $i true > split 1 sprint} +[`@' `@' `@' `@' `@' `@' `@' `@'] +{`a:b:c:d:e' `:' < $i true > 0 split 1 sprint} +[`a' `b' `c' `d' `e'] +{`a:b:c:d:e' `:' < $i true > 1 split 1 sprint} +[`a:b:c:d:e'] +{`a:b:c:d:e' `:' < $i true > 2 split 1 sprint} +[`a' `b:c:d:e'] +{`a:b:c:d:e' `:' < $i true > 3 split 1 sprint} +[`a' `b' `c:d:e'] +{`a:b:c:d:e' `:' < $i true > 4 split 1 sprint} +[`a' `b' `c' `d:e'] +{`a:b:c:d:e' `:' < $i true > 5 split 1 sprint} +[`a' `b' `c' `d' `e'] +{`a:b:c:d:e' `:' < $i true > 6 split 1 sprint} +[`a' `b' `c' `d' `e'] +{`a:b:c' `' split 1 sprint} +[`a' `:' `b' `:' `c'] +{`a:b:c' `a' split 1 sprint} +[`' `:b:c'] +{`a:b:c' `:' split 1 sprint} +[`a' `b' `c'] +{`a:b:c' `b' split 1 sprint} +[`a:' `:c'] +{`a:b:c' `c' split 1 sprint} +[`a:b:'] +{`a:b:c' `X' split 1 sprint} +[`a:b:c'] +{`aa:b:c' `a' split 1 sprint} +[`' `' `:b:c'] +{`a:b:cc' `c' split 1 sprint} +[`a:b:' `'] +{`a:b:c' `(:)' split 1 sprint} +[`a' `:' `b' `:' `c'] +{`a:b:c' `((:))' split 1 sprint} +[`a' `:' `:' `b' `:' `:' `c'] +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_a.nx.in new file mode 100644 index 000000000..99ab3a36c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_a.nx.in @@ -0,0 +1,50 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`a:b:c' `:' split 1 sprint} + {`a:b:c' `:' <> split 1 sprint} + {`a:b:c' `:' regex split 1 sprint} + {`a:b:c' `:' <> regex split 1 sprint} + + {`@a@A@b@B@c@C@d@D' `A|B|C|D' split 1 sprint} + {`@a@A@b@B@c@C@d@D' `A|B|C|D' <$i true> split 1 sprint} + + {`a:b:c:d:e' `:' <$i true> 0 split 1 sprint} + {`a:b:c:d:e' `:' <$i true> 1 split 1 sprint} + {`a:b:c:d:e' `:' <$i true> 2 split 1 sprint} + {`a:b:c:d:e' `:' <$i true> 3 split 1 sprint} + {`a:b:c:d:e' `:' <$i true> 4 split 1 sprint} + {`a:b:c:d:e' `:' <$i true> 5 split 1 sprint} + {`a:b:c:d:e' `:' <$i true> 6 split 1 sprint} + + {`a:b:c' `' split 1 sprint} + {`a:b:c' `a' split 1 sprint} + {`a:b:c' `:' split 1 sprint} + {`a:b:c' `b' split 1 sprint} + {`a:b:c' `c' split 1 sprint} + + {`a:b:c' `X' split 1 sprint} + {`aa:b:c' `a' split 1 sprint} + {`a:b:cc' `c' split 1 sprint} + + {`a:b:c' `(:)' split 1 sprint} + {`a:b:c' `((:))' split 1 sprint} +]{ + dup 1 sprint + eval +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_b.nx.exp new file mode 100644 index 000000000..ce2cd578a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_b.nx.in new file mode 100644 index 000000000..158d38711 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_c.nx.exp new file mode 100644 index 000000000..5920d7751 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_c.nx.in new file mode 100644 index 000000000..22ecf0897 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_d.nx.exp new file mode 100644 index 000000000..3915f49df --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-dict- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_d.nx.in new file mode 100644 index 000000000..1a55a6990 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<> 1 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_e.nx.exp new file mode 100644 index 000000000..f3550d126 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`pattern' -dict- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_e.nx.in new file mode 100644 index 000000000..2d8ea1ec5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`pattern' <> 1 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_f.nx.exp new file mode 100644 index 000000000..faae4fe22 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (`input' `pattern' -dict- -1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_f.nx.in new file mode 100644 index 000000000..76fbd5c64 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <> -1 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_g.nx.exp new file mode 100644 index 000000000..2eb9f01a6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_g.nx.in new file mode 100644 index 000000000..4e2d29fa3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <> mark split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_h.nx.exp new file mode 100644 index 000000000..13fc42540 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -mark- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_h.nx.in new file mode 100644 index 000000000..30169619e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' mark 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_i.nx.exp new file mode 100644 index 000000000..22c035800 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' -mark- -dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_i.nx.in new file mode 100644 index 000000000..9608ab106 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' mark <> 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_j.nx.exp new file mode 100644 index 000000000..97689c933 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `pattern' -dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_j.nx.in new file mode 100644 index 000000000..94d988fdc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `pattern' <> 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_k.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_k.nx.exp new file mode 100644 index 000000000..bf1400100 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_k.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $regexerror +ostack: (`input' `(pattern' -dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_k.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_k.nx.in new file mode 100644 index 000000000..494a469d3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_k.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `(pattern' <> 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_l.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_l.nx.exp new file mode 100644 index 000000000..ceeee420a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_l.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_l.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_l.nx.in new file mode 100644 index 000000000..9c9f92442 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_l.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$i 0> 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_m.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_m.nx.exp new file mode 100644 index 000000000..ceeee420a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_m.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_m.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_m.nx.in new file mode 100644 index 000000000..53f68bd1a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_m.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$m 0> 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_n.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_n.nx.exp new file mode 100644 index 000000000..ceeee420a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_n.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`input' `pattern' -dict- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --split-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_n.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_n.nx.in new file mode 100644 index 000000000..b6f6d0b79 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/split_n.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`input' `pattern' <$s 0> 0 split + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_a.nx.exp new file mode 100644 index 000000000..1b525bba7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_a.nx.exp @@ -0,0 +1,6 @@ +1 +() +2 +(1) +3 +(1 2) diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_a.nx.in new file mode 100644 index 000000000..f8f68c48a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_a.nx.in @@ -0,0 +1,15 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +(1) dup spop pstack clear +(1 2) dup spop pstack clear +(1 2 3) dup spop pstack clear diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_b.nx.exp new file mode 100644 index 000000000..74dbbdc9f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_b.nx.in new file mode 100644 index 000000000..ffe3b9618 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +spop diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_c.nx.exp new file mode 100644 index 000000000..a404db061 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_c.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_c.nx.in new file mode 100644 index 000000000..3e45527ba --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 spop diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_d.nx.exp new file mode 100644 index 000000000..6b9f57f2d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_d.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spop-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_d.nx.in new file mode 100644 index 000000000..783c495f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spop_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() spop diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_a.nx.exp new file mode 100644 index 000000000..8386e9c05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_a.nx.exp @@ -0,0 +1,75 @@ +[] +[] +[] +[1] +[1] +[1] +[-array-] +[[1]] +[[1]] +[-array- -array-] +[[-array-] []] +[[[1]] []] +true +true +true +false +false +false +<> +<> +<> +<$foo $bar> +<$foo $bar> +<$foo $bar> +<$foo -dict-> +<$foo <>> +<$foo <>> +<$foo -dict-> +<$foo <$bar -array->> +<$foo <$bar [1]>> +-file- +-file- +-file- +-fino- +-fino- +-fino- +-1 +-1 +-1 +0 +0 +0 +123412341234 +123412341234 +123412341234 +$foo +$foo +$foo +!foo +!foo +!foo +foo +foo +foo +null +null +null +--pop-- +--pop-- +--pop-- +() +() +() +(-stack-) +(()) +(()) +(1 2 -array- 6) +(1 2 [3 4 5] 6) +(1 2 [3 4 5] 6) +(1 2 -array- 6) +(1 2 [3 4 5 -array-] 6) +(1 2 [3 4 5 [`a' `b']] 6) +`abc\n\n' +`abc\n\n' +`abc\n\n' diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_a.nx.in new file mode 100644 index 000000000..9a8e696c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_a.nx.in @@ -0,0 +1,65 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +[ + # array. + [] + [1] + [[1]] + [[[1]][]] + + # boolean. + true + false + + # dict. + <> + <$foo $bar> + <$foo <>> + <$foo <$bar [1]>> + + # file. + stdin + + # fino. + ( + + # integer. + -1 + 0 + 123412341234 + + # name. + $foo + $foo cve + $foo cvx + + # null. + null + + # operator. + ~pop + + # stack. + () + (()) + (1 2 [3 4 5] 6) + (1 2 [3 4 5 [`a' `b']] 6) + + # string. + `abc\n\x0a' +]{ + dup 1 sprint + dup 2 sprint + dup 3 sprint + pop +} foreach diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_b.nx.exp new file mode 100644 index 000000000..21214452d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_b.nx.exp @@ -0,0 +1,9 @@ +-1.000000e+00 +-1.000000e+00 +-1.000000e+00 +1.000000e-02 +1.000000e-02 +1.000000e-02 +1.234123e+11 +1.234123e+11 +1.234123e+11 diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_b.nx.in new file mode 100644 index 000000000..ccd49cf65 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sprint_b.nx.in @@ -0,0 +1,23 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +[ + # integer. + -1.0 + 0.01 + 123412341234.99 +]{ + dup 1 sprint + dup 2 sprint + dup 3 sprint + pop +} foreach diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_a.nx.exp new file mode 100644 index 000000000..c26f34a08 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +(true -array- -dict- -fino- 1 -mark- $foo null --pop-- -stack- `hi') +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_a.nx.in new file mode 100644 index 000000000..00b40554c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() + +[ + `true' + `[]' + `<>' + `(' + `1' + `mark' + `$foo' + `null' + `~pop' + `()' + ``hi'' +]{ + cvx eval + 1 idup exch spush +} foreach + +pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_b.nx.exp new file mode 100644 index 000000000..5b45655a9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_b.nx.in new file mode 100644 index 000000000..96287a88c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +spush diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_c.nx.exp new file mode 100644 index 000000000..c6156dccf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_c.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_c.nx.in new file mode 100644 index 000000000..f0fa4e472 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 spush diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_d.nx.exp new file mode 100644 index 000000000..8fad66c41 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_d.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --spush-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_d.nx.in new file mode 100644 index 000000000..e867bbac9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/spush_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 2 spush diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_a.nx.exp new file mode 100644 index 000000000..a51b5816c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_a.nx.exp @@ -0,0 +1,28 @@ +Test begin +`0' +0.000000e+00 +`1' +1.000000e+00 +`2' +1.414214e+00 +`25' +5.000000e+00 +`63' +7.937254e+00 +`64' +8.000000e+00 +`0.3' +5.477226e-01 +`1.234' +1.110856e+00 +`2.8699' +1.694078e+00 +`2.5' +1.581139e+00 +`25.23432' +5.023377e+00 +`63.34' +7.958643e+00 +`64.35' +8.021845e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_a.nx.in new file mode 100644 index 000000000..26d2ec621 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0' + `1' + `2' + `25' + `63' + `64' + + `0.3' + `1.234' + `2.8699' + `2.5' + `25.23432' + `63.34' + `64.35' + +]{ + dup 1 sprint + cvx eval sqrt + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_b.nx.exp new file mode 100644 index 000000000..0728e1bed --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sqrt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_b.nx.in new file mode 100644 index 000000000..25adc688c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sqrt + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_c.nx.exp new file mode 100644 index 000000000..89808048b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sqrt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_c.nx.in new file mode 100644 index 000000000..1b79cd37a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sqrt + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_d.nx.exp new file mode 100644 index 000000000..5155df33f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1.500000e+00) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sqrt-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_d.nx.in new file mode 100644 index 000000000..8e35b1e31 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sqrt_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1.5 sqrt + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_a.nx.in new file mode 100644 index 000000000..bac07389f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_a.nx.in @@ -0,0 +1,20 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 srand +1 srand +16@ffffffff srand +16@7fffffffffffffff srand + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_b.nx.exp new file mode 100644 index 000000000..8e51f45ed --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srand-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_b.nx.in new file mode 100644 index 000000000..6a6999194 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +srand + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_c.nx.exp new file mode 100644 index 000000000..6d9c943b4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srand-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_c.nx.in new file mode 100644 index 000000000..f2fe06747 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark srand + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_d.nx.exp new file mode 100644 index 000000000..d7e72c16a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srand-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_d.nx.in new file mode 100644 index 000000000..ca587e5fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srand_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-1 srand + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_a.nx.exp new file mode 100644 index 000000000..d348c9973 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_a.nx.exp @@ -0,0 +1,44 @@ +Test begin +`(1 2 3 4) dup 1 0 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 1 1 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 1 2 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 2 0 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 2 1 sroll pstack clear' +(1 2 4 3) +`(1 2 3 4) dup 2 2 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 3 1 sroll pstack clear' +(1 4 2 3) +`(1 2 3 4) dup 3 2 sroll pstack clear' +(1 3 4 2) +`(1 2 3 4) dup 3 -1 sroll pstack clear' +(1 3 4 2) +`(1 2 3 4) dup 3 -2 sroll pstack clear' +(1 4 2 3) +`(1 2 3 4) dup 3 3 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 4 -4 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 4 -3 sroll pstack clear' +(4 1 2 3) +`(1 2 3 4) dup 4 -2 sroll pstack clear' +(3 4 1 2) +`(1 2 3 4) dup 4 -1 sroll pstack clear' +(2 3 4 1) +`(1 2 3 4) dup 4 0 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 4 1 sroll pstack clear' +(4 1 2 3) +`(1 2 3 4) dup 4 2 sroll pstack clear' +(3 4 1 2) +`(1 2 3 4) dup 4 3 sroll pstack clear' +(2 3 4 1) +`(1 2 3 4) dup 4 4 sroll pstack clear' +(1 2 3 4) +`(1 2 3 4) dup 4 5 sroll pstack clear' +(4 1 2 3) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_a.nx.in new file mode 100644 index 000000000..75a26648d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_a.nx.in @@ -0,0 +1,43 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `(1 2 3 4) dup 1 0 sroll pstack clear' + `(1 2 3 4) dup 1 1 sroll pstack clear' + `(1 2 3 4) dup 1 2 sroll pstack clear' + `(1 2 3 4) dup 2 0 sroll pstack clear' + `(1 2 3 4) dup 2 1 sroll pstack clear' + `(1 2 3 4) dup 2 2 sroll pstack clear' + `(1 2 3 4) dup 3 1 sroll pstack clear' + `(1 2 3 4) dup 3 2 sroll pstack clear' + `(1 2 3 4) dup 3 -1 sroll pstack clear' + `(1 2 3 4) dup 3 -2 sroll pstack clear' + `(1 2 3 4) dup 3 3 sroll pstack clear' + `(1 2 3 4) dup 4 -4 sroll pstack clear' + `(1 2 3 4) dup 4 -3 sroll pstack clear' + `(1 2 3 4) dup 4 -2 sroll pstack clear' + `(1 2 3 4) dup 4 -1 sroll pstack clear' + `(1 2 3 4) dup 4 0 sroll pstack clear' + `(1 2 3 4) dup 4 1 sroll pstack clear' + `(1 2 3 4) dup 4 2 sroll pstack clear' + `(1 2 3 4) dup 4 3 sroll pstack clear' + `(1 2 3 4) dup 4 4 sroll pstack clear' + `(1 2 3 4) dup 4 5 sroll pstack clear' +]{ + dup 1 sprint + cvx eval +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_b.nx.exp new file mode 100644 index 000000000..c4880f7ca --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_b.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_b.nx.in new file mode 100644 index 000000000..99e12fa06 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_b.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_c.nx.exp new file mode 100644 index 000000000..149f2a3b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_c.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_c.nx.in new file mode 100644 index 000000000..57279c3eb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_c.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_d.nx.exp new file mode 100644 index 000000000..4ef7e098c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_d.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (1 2) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_d.nx.in new file mode 100644 index 000000000..38ea7647c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_d.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 2 sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_e.nx.exp new file mode 100644 index 000000000..047592a9b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_e.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (-stack- 1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_e.nx.in new file mode 100644 index 000000000..2cb8f2528 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_e.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() 1 mark sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_f.nx.exp new file mode 100644 index 000000000..a0bed39de --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_f.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (-stack- -mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_f.nx.in new file mode 100644 index 000000000..31ea261a7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_f.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() mark 1 sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_g.nx.exp new file mode 100644 index 000000000..cb512a56b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_g.nx.exp @@ -0,0 +1,7 @@ +Error $typecheck +ostack: (1 2 3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_g.nx.in new file mode 100644 index 000000000..2c074eb64 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_g.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +1 2 3 sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_h.nx.exp new file mode 100644 index 000000000..5d4a65420 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_h.nx.exp @@ -0,0 +1,7 @@ +Error $rangecheck +ostack: (-stack- 0 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_h.nx.in new file mode 100644 index 000000000..ff97b0b8d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_h.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() 0 1 sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_i.nx.exp new file mode 100644 index 000000000..faee24d05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_i.nx.exp @@ -0,0 +1,7 @@ +Error $stackunderflow +ostack: (-stack- 2 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sroll-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_i.nx.in new file mode 100644 index 000000000..d0ca75f1c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sroll_i.nx.in @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +() 2 1 sroll diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_a.nx.exp new file mode 100644 index 000000000..6f7ffb3f0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_a.nx.exp @@ -0,0 +1,65 @@ +Test begin +(1) -1 srot --> (1) +(1) 0 srot --> (1) +(1) 1 srot --> (1) +(1 2) -2 srot --> (1 2) +(1 2) -1 srot --> (2 1) +(1 2) 0 srot --> (1 2) +(1 2) 1 srot --> (2 1) +(1 2) 2 srot --> (1 2) +(1 2 3) -3 srot --> (1 2 3) +(1 2 3) -2 srot --> (3 1 2) +(1 2 3) -1 srot --> (2 3 1) +(1 2 3) 0 srot --> (1 2 3) +(1 2 3) 1 srot --> (3 1 2) +(1 2 3) 2 srot --> (2 3 1) +(1 2 3) 3 srot --> (1 2 3) +(1 2 3 4) -4 srot --> (1 2 3 4) +(1 2 3 4) -3 srot --> (4 1 2 3) +(1 2 3 4) -2 srot --> (3 4 1 2) +(1 2 3 4) -1 srot --> (2 3 4 1) +(1 2 3 4) 0 srot --> (1 2 3 4) +(1 2 3 4) 1 srot --> (4 1 2 3) +(1 2 3 4) 2 srot --> (3 4 1 2) +(1 2 3 4) 3 srot --> (2 3 4 1) +(1 2 3 4) 4 srot --> (1 2 3 4) +(1 2 3 4 5) -5 srot --> (1 2 3 4 5) +(1 2 3 4 5) -4 srot --> (5 1 2 3 4) +(1 2 3 4 5) -3 srot --> (4 5 1 2 3) +(1 2 3 4 5) -2 srot --> (3 4 5 1 2) +(1 2 3 4 5) -1 srot --> (2 3 4 5 1) +(1 2 3 4 5) 0 srot --> (1 2 3 4 5) +(1 2 3 4 5) 1 srot --> (5 1 2 3 4) +(1 2 3 4 5) 2 srot --> (4 5 1 2 3) +(1 2 3 4 5) 3 srot --> (3 4 5 1 2) +(1 2 3 4 5) 4 srot --> (2 3 4 5 1) +(1 2 3 4 5) 5 srot --> (1 2 3 4 5) +(1 2 3 4 5 6) -6 srot --> (1 2 3 4 5 6) +(1 2 3 4 5 6) -5 srot --> (6 1 2 3 4 5) +(1 2 3 4 5 6) -4 srot --> (5 6 1 2 3 4) +(1 2 3 4 5 6) -3 srot --> (4 5 6 1 2 3) +(1 2 3 4 5 6) -2 srot --> (3 4 5 6 1 2) +(1 2 3 4 5 6) -1 srot --> (2 3 4 5 6 1) +(1 2 3 4 5 6) 0 srot --> (1 2 3 4 5 6) +(1 2 3 4 5 6) 1 srot --> (6 1 2 3 4 5) +(1 2 3 4 5 6) 2 srot --> (5 6 1 2 3 4) +(1 2 3 4 5 6) 3 srot --> (4 5 6 1 2 3) +(1 2 3 4 5 6) 4 srot --> (3 4 5 6 1 2) +(1 2 3 4 5 6) 5 srot --> (2 3 4 5 6 1) +(1 2 3 4 5 6) 6 srot --> (1 2 3 4 5 6) +(1 2 3 4 5 6 7) -7 srot --> (1 2 3 4 5 6 7) +(1 2 3 4 5 6 7) -6 srot --> (7 1 2 3 4 5 6) +(1 2 3 4 5 6 7) -5 srot --> (6 7 1 2 3 4 5) +(1 2 3 4 5 6 7) -4 srot --> (5 6 7 1 2 3 4) +(1 2 3 4 5 6 7) -3 srot --> (4 5 6 7 1 2 3) +(1 2 3 4 5 6 7) -2 srot --> (3 4 5 6 7 1 2) +(1 2 3 4 5 6 7) -1 srot --> (2 3 4 5 6 7 1) +(1 2 3 4 5 6 7) 0 srot --> (1 2 3 4 5 6 7) +(1 2 3 4 5 6 7) 1 srot --> (7 1 2 3 4 5 6) +(1 2 3 4 5 6 7) 2 srot --> (6 7 1 2 3 4 5) +(1 2 3 4 5 6 7) 3 srot --> (5 6 7 1 2 3 4) +(1 2 3 4 5 6 7) 4 srot --> (4 5 6 7 1 2 3) +(1 2 3 4 5 6 7) 5 srot --> (3 4 5 6 7 1 2) +(1 2 3 4 5 6 7) 6 srot --> (2 3 4 5 6 7 1) +(1 2 3 4 5 6 7) 7 srot --> (1 2 3 4 5 6 7) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_a.nx.in new file mode 100644 index 000000000..96ed899b4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_a.nx.in @@ -0,0 +1,39 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (1) + (1 2) + (1 2 3) + (1 2 3 4) + (1 2 3 4 5) + (1 2 3 4 5 6) + (1 2 3 4 5 6 7) +]{ + dup scount + dup neg 1 dn { + over 1 sprints print + ` ' print + dup cvs print + ` srot --> ' print + + over () copy dup dn srot + + 1 sprint + } for + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_b.nx.exp new file mode 100644 index 000000000..c647cf8f8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_b.nx.in new file mode 100644 index 000000000..9e8b0434f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 srot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_c.nx.exp new file mode 100644 index 000000000..cd368cf5b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_c.nx.in new file mode 100644 index 000000000..bd4e6ecc8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 srot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_d.nx.exp new file mode 100644 index 000000000..55690416b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-stack- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_d.nx.in new file mode 100644 index 000000000..446335d70 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) mark srot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_e.nx.exp new file mode 100644 index 000000000..db86d7450 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --srot-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_e.nx.in new file mode 100644 index 000000000..89535da29 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/srot_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 1 srot + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stack_a.nx.exp new file mode 100644 index 000000000..c626fc9a6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stack_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +() +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stack_a.nx.in new file mode 100644 index 000000000..efd7d6bc1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stack_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stack 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_a.nx.exp new file mode 100644 index 000000000..99b419dbc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +(--start-- -file- --estack--) +(--start-- -file- --estack--) +(--start-- -file- --estack--) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_a.nx.in new file mode 100644 index 000000000..6046e0752 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{quit} start +estack 1 sprint + +{stop} start +estack 1 sprint + +{exit} start +estack 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_b.nx.exp new file mode 100644 index 000000000..fc0c51541 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --start-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_b.nx.in new file mode 100644 index 000000000..d6a4e5219 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/start_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +start + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stderr_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stderr_a.nx.exp new file mode 100644 index 000000000..cf778b0f0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stderr_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +-file- +Written to stderr +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stderr_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stderr_a.nx.in new file mode 100644 index 000000000..c83e82358 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stderr_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stderr 1 sprint +stderr `Written to stderr\n' write pop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdin_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdin_a.nx.exp new file mode 100644 index 000000000..c0f1cef39 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdin_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-file- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdin_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdin_a.nx.in new file mode 100644 index 000000000..bb73b8141 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdin_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stdin 1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdout_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdout_a.nx.exp new file mode 100644 index 000000000..f388ae194 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdout_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +-file- +Written to stdout +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdout_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdout_a.nx.in new file mode 100644 index 000000000..6eb8f60aa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stdout_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stdout 1 sprint +stdout `Written to stdout\n' write pop + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_a.nx.exp new file mode 100644 index 000000000..a6990275a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +true +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_a.nx.in new file mode 100644 index 000000000..25c5942c3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{stop} stopped 1 sprint +{} stopped 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_b.nx.exp new file mode 100644 index 000000000..2aa8c5c8a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --stopped-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_b.nx.in new file mode 100644 index 000000000..784fbd67e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stopped + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_c.nx.exp new file mode 100644 index 000000000..67035578e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_c.nx.exp @@ -0,0 +1,9 @@ +Test begin +Error $invalidexit +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..3): +0: --exit-- +1: --stopped-- +2: -file- +3: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_c.nx.in new file mode 100644 index 000000000..7dc8e6231 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stopped_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{exit} stopped + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_a.nx.exp new file mode 100644 index 000000000..f64587730 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +`' +`\0' +`\0\0\0\0\0\0\0\0\0\0' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_a.nx.in new file mode 100644 index 000000000..d077e3f4a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 string 1 sprint +1 string 1 sprint +10 string 1 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_b.nx.exp new file mode 100644 index 000000000..ade33ac59 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --string-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_b.nx.in new file mode 100644 index 000000000..ae5af6858 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +string + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_c.nx.exp new file mode 100644 index 000000000..5c4a182dd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --string-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_c.nx.in new file mode 100644 index 000000000..43a33cd51 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark string + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_d.nx.exp new file mode 100644 index 000000000..09d6f19f5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-3) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --string-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_d.nx.in new file mode 100644 index 000000000..f2be081b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +-3 string + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_e.nx.exp new file mode 100644 index 000000000..9d29fed30 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_e.nx.exp @@ -0,0 +1,551 @@ +Test begin +`\`\\\`\'' --> `\`' +`\`\\\'\'' --> `\'' +`\`\\\\\'' --> `\\' +`\`\\0\'' --> `\0' +`\`\\n\'' --> `\n' +`\`\\r\'' --> `\r' +`\`\\t\'' --> `\t' +`\`\\b\'' --> `\b' +`\`\\f\'' --> `\f' +`\`\\a\'' --> `\a' +`\`\\\n\'' --> `' +`\`\\\r\n\'' --> `' +`\`\\e\'' --> `\e' +`\`\\ca\'' --> `\ca' +`\`\\cb\'' --> `\cb' +`\`\\cc\'' --> `\cc' +`\`\\cd\'' --> `\cd' +`\`\\ce\'' --> `\ce' +`\`\\cf\'' --> `\cf' +`\`\\cg\'' --> `\a' +`\`\\ch\'' --> `\b' +`\`\\ci\'' --> `\t' +`\`\\cj\'' --> `\n' +`\`\\ck\'' --> `\ck' +`\`\\cl\'' --> `\f' +`\`\\cm\'' --> `\r' +`\`\\cn\'' --> `\cn' +`\`\\co\'' --> `\co' +`\`\\cp\'' --> `\cp' +`\`\\cq\'' --> `\cq' +`\`\\cr\'' --> `\cr' +`\`\\cs\'' --> `\cs' +`\`\\ct\'' --> `\ct' +`\`\\cu\'' --> `\cu' +`\`\\cv\'' --> `\cv' +`\`\\cw\'' --> `\cw' +`\`\\cx\'' --> `\cx' +`\`\\cy\'' --> `\cy' +`\`\\cz\'' --> `\cz' +`\`\\cA\'' --> `\ca' +`\`\\cB\'' --> `\cb' +`\`\\cC\'' --> `\cc' +`\`\\cD\'' --> `\cd' +`\`\\cE\'' --> `\ce' +`\`\\cF\'' --> `\cf' +`\`\\cG\'' --> `\a' +`\`\\cH\'' --> `\b' +`\`\\cI\'' --> `\t' +`\`\\cJ\'' --> `\n' +`\`\\cK\'' --> `\ck' +`\`\\cL\'' --> `\f' +`\`\\cM\'' --> `\r' +`\`\\cN\'' --> `\cn' +`\`\\cO\'' --> `\co' +`\`\\cP\'' --> `\cp' +`\`\\cQ\'' --> `\cq' +`\`\\cR\'' --> `\cr' +`\`\\cS\'' --> `\cs' +`\`\\cT\'' --> `\ct' +`\`\\cU\'' --> `\cu' +`\`\\cV\'' --> `\cv' +`\`\\cW\'' --> `\cw' +`\`\\cX\'' --> `\cx' +`\`\\cY\'' --> `\cy' +`\`\\cZ\'' --> `\cz' +`\`\\x00\'' --> `\0' +`\`\\x01\'' --> `\ca' +`\`\\x02\'' --> `\cb' +`\`\\x03\'' --> `\cc' +`\`\\x04\'' --> `\cd' +`\`\\x05\'' --> `\ce' +`\`\\x06\'' --> `\cf' +`\`\\x07\'' --> `\a' +`\`\\x08\'' --> `\b' +`\`\\x09\'' --> `\t' +`\`\\x0a\'' --> `\n' +`\`\\x0b\'' --> `\ck' +`\`\\x0c\'' --> `\f' +`\`\\x0d\'' --> `\r' +`\`\\x0e\'' --> `\cn' +`\`\\x0f\'' --> `\co' +`\`\\x0A\'' --> `\n' +`\`\\x0B\'' --> `\ck' +`\`\\x0C\'' --> `\f' +`\`\\x0D\'' --> `\r' +`\`\\x0E\'' --> `\cn' +`\`\\x0F\'' --> `\co' +`\`\\x10\'' --> `\cp' +`\`\\x11\'' --> `\cq' +`\`\\x12\'' --> `\cr' +`\`\\x13\'' --> `\cs' +`\`\\x14\'' --> `\ct' +`\`\\x15\'' --> `\cu' +`\`\\x16\'' --> `\cv' +`\`\\x17\'' --> `\cw' +`\`\\x18\'' --> `\cx' +`\`\\x19\'' --> `\cy' +`\`\\x1a\'' --> `\cz' +`\`\\x1b\'' --> `\e' +`\`\\x1c\'' --> `\x1c' +`\`\\x1d\'' --> `\x1d' +`\`\\x1e\'' --> `\x1e' +`\`\\x1f\'' --> `\x1f' +`\`\\x1A\'' --> `\cz' +`\`\\x1B\'' --> `\e' +`\`\\x1C\'' --> `\x1c' +`\`\\x1D\'' --> `\x1d' +`\`\\x1E\'' --> `\x1e' +`\`\\x1F\'' --> `\x1f' +`\`\\x20\'' --> ` ' +`\`\\x21\'' --> `!' +`\`\\x22\'' --> `"' +`\`\\x23\'' --> `#' +`\`\\x24\'' --> `$' +`\`\\x25\'' --> `%' +`\`\\x26\'' --> `&' +`\`\\x27\'' --> `\'' +`\`\\x28\'' --> `(' +`\`\\x29\'' --> `)' +`\`\\x2a\'' --> `*' +`\`\\x2b\'' --> `+' +`\`\\x2c\'' --> `,' +`\`\\x2d\'' --> `-' +`\`\\x2e\'' --> `.' +`\`\\x2f\'' --> `/' +`\`\\x2A\'' --> `*' +`\`\\x2B\'' --> `+' +`\`\\x2C\'' --> `,' +`\`\\x2D\'' --> `-' +`\`\\x2E\'' --> `.' +`\`\\x2F\'' --> `/' +`\`\\x30\'' --> `0' +`\`\\x31\'' --> `1' +`\`\\x32\'' --> `2' +`\`\\x33\'' --> `3' +`\`\\x34\'' --> `4' +`\`\\x35\'' --> `5' +`\`\\x36\'' --> `6' +`\`\\x37\'' --> `7' +`\`\\x38\'' --> `8' +`\`\\x39\'' --> `9' +`\`\\x3a\'' --> `:' +`\`\\x3b\'' --> `;' +`\`\\x3c\'' --> `<' +`\`\\x3d\'' --> `=' +`\`\\x3e\'' --> `>' +`\`\\x3f\'' --> `?' +`\`\\x3A\'' --> `:' +`\`\\x3B\'' --> `;' +`\`\\x3C\'' --> `<' +`\`\\x3D\'' --> `=' +`\`\\x3E\'' --> `>' +`\`\\x3F\'' --> `?' +`\`\\x40\'' --> `@' +`\`\\x41\'' --> `A' +`\`\\x42\'' --> `B' +`\`\\x43\'' --> `C' +`\`\\x44\'' --> `D' +`\`\\x45\'' --> `E' +`\`\\x46\'' --> `F' +`\`\\x47\'' --> `G' +`\`\\x48\'' --> `H' +`\`\\x49\'' --> `I' +`\`\\x4a\'' --> `J' +`\`\\x4b\'' --> `K' +`\`\\x4c\'' --> `L' +`\`\\x4d\'' --> `M' +`\`\\x4e\'' --> `N' +`\`\\x4f\'' --> `O' +`\`\\x4A\'' --> `J' +`\`\\x4B\'' --> `K' +`\`\\x4C\'' --> `L' +`\`\\x4D\'' --> `M' +`\`\\x4E\'' --> `N' +`\`\\x4F\'' --> `O' +`\`\\x50\'' --> `P' +`\`\\x51\'' --> `Q' +`\`\\x52\'' --> `R' +`\`\\x53\'' --> `S' +`\`\\x54\'' --> `T' +`\`\\x55\'' --> `U' +`\`\\x56\'' --> `V' +`\`\\x57\'' --> `W' +`\`\\x58\'' --> `X' +`\`\\x59\'' --> `Y' +`\`\\x5a\'' --> `Z' +`\`\\x5b\'' --> `[' +`\`\\x5c\'' --> `\\' +`\`\\x5d\'' --> `]' +`\`\\x5e\'' --> `^' +`\`\\x5f\'' --> `_' +`\`\\x5A\'' --> `Z' +`\`\\x5B\'' --> `[' +`\`\\x5C\'' --> `\\' +`\`\\x5D\'' --> `]' +`\`\\x5E\'' --> `^' +`\`\\x5F\'' --> `_' +`\`\\x60\'' --> `\`' +`\`\\x61\'' --> `a' +`\`\\x62\'' --> `b' +`\`\\x63\'' --> `c' +`\`\\x64\'' --> `d' +`\`\\x65\'' --> `e' +`\`\\x66\'' --> `f' +`\`\\x67\'' --> `g' +`\`\\x68\'' --> `h' +`\`\\x69\'' --> `i' +`\`\\x6a\'' --> `j' +`\`\\x6b\'' --> `k' +`\`\\x6c\'' --> `l' +`\`\\x6d\'' --> `m' +`\`\\x6e\'' --> `n' +`\`\\x6f\'' --> `o' +`\`\\x6A\'' --> `j' +`\`\\x6B\'' --> `k' +`\`\\x6C\'' --> `l' +`\`\\x6D\'' --> `m' +`\`\\x6E\'' --> `n' +`\`\\x6F\'' --> `o' +`\`\\x70\'' --> `p' +`\`\\x71\'' --> `q' +`\`\\x72\'' --> `r' +`\`\\x73\'' --> `s' +`\`\\x74\'' --> `t' +`\`\\x75\'' --> `u' +`\`\\x76\'' --> `v' +`\`\\x77\'' --> `w' +`\`\\x78\'' --> `x' +`\`\\x79\'' --> `y' +`\`\\x7a\'' --> `z' +`\`\\x7b\'' --> `{' +`\`\\x7c\'' --> `|' +`\`\\x7d\'' --> `}' +`\`\\x7e\'' --> `~' +`\`\\x7f\'' --> `\x7f' +`\`\\x7A\'' --> `z' +`\`\\x7B\'' --> `{' +`\`\\x7C\'' --> `|' +`\`\\x7D\'' --> `}' +`\`\\x7E\'' --> `~' +`\`\\x7F\'' --> `\x7f' +`\`\\x80\'' --> `\x80' +`\`\\x81\'' --> `\x81' +`\`\\x82\'' --> `\x82' +`\`\\x83\'' --> `\x83' +`\`\\x84\'' --> `\x84' +`\`\\x85\'' --> `\x85' +`\`\\x86\'' --> `\x86' +`\`\\x87\'' --> `\x87' +`\`\\x88\'' --> `\x88' +`\`\\x89\'' --> `\x89' +`\`\\x8a\'' --> `\x8a' +`\`\\x8b\'' --> `\x8b' +`\`\\x8c\'' --> `\x8c' +`\`\\x8d\'' --> `\x8d' +`\`\\x8e\'' --> `\x8e' +`\`\\x8f\'' --> `\x8f' +`\`\\x8A\'' --> `\x8a' +`\`\\x8B\'' --> `\x8b' +`\`\\x8C\'' --> `\x8c' +`\`\\x8D\'' --> `\x8d' +`\`\\x8E\'' --> `\x8e' +`\`\\x8F\'' --> `\x8f' +`\`\\x90\'' --> `\x90' +`\`\\x91\'' --> `\x91' +`\`\\x92\'' --> `\x92' +`\`\\x93\'' --> `\x93' +`\`\\x94\'' --> `\x94' +`\`\\x95\'' --> `\x95' +`\`\\x96\'' --> `\x96' +`\`\\x97\'' --> `\x97' +`\`\\x98\'' --> `\x98' +`\`\\x99\'' --> `\x99' +`\`\\x9a\'' --> `\x9a' +`\`\\x9b\'' --> `\x9b' +`\`\\x9c\'' --> `\x9c' +`\`\\x9d\'' --> `\x9d' +`\`\\x9e\'' --> `\x9e' +`\`\\x9f\'' --> `\x9f' +`\`\\x9A\'' --> `\x9a' +`\`\\x9B\'' --> `\x9b' +`\`\\x9C\'' --> `\x9c' +`\`\\x9D\'' --> `\x9d' +`\`\\x9E\'' --> `\x9e' +`\`\\x9F\'' --> `\x9f' +`\`\\xa0\'' --> `\xa0' +`\`\\xa1\'' --> `\xa1' +`\`\\xa2\'' --> `\xa2' +`\`\\xa3\'' --> `\xa3' +`\`\\xa4\'' --> `\xa4' +`\`\\xa5\'' --> `\xa5' +`\`\\xa6\'' --> `\xa6' +`\`\\xa7\'' --> `\xa7' +`\`\\xa8\'' --> `\xa8' +`\`\\xa9\'' --> `\xa9' +`\`\\xaa\'' --> `\xaa' +`\`\\xab\'' --> `\xab' +`\`\\xac\'' --> `\xac' +`\`\\xad\'' --> `\xad' +`\`\\xae\'' --> `\xae' +`\`\\xaf\'' --> `\xaf' +`\`\\xaA\'' --> `\xaa' +`\`\\xaB\'' --> `\xab' +`\`\\xaC\'' --> `\xac' +`\`\\xaD\'' --> `\xad' +`\`\\xaE\'' --> `\xae' +`\`\\xaF\'' --> `\xaf' +`\`\\xb0\'' --> `\xb0' +`\`\\xb1\'' --> `\xb1' +`\`\\xb2\'' --> `\xb2' +`\`\\xb3\'' --> `\xb3' +`\`\\xb4\'' --> `\xb4' +`\`\\xb5\'' --> `\xb5' +`\`\\xb6\'' --> `\xb6' +`\`\\xb7\'' --> `\xb7' +`\`\\xb8\'' --> `\xb8' +`\`\\xb9\'' --> `\xb9' +`\`\\xba\'' --> `\xba' +`\`\\xbb\'' --> `\xbb' +`\`\\xbc\'' --> `\xbc' +`\`\\xbd\'' --> `\xbd' +`\`\\xbe\'' --> `\xbe' +`\`\\xbf\'' --> `\xbf' +`\`\\xbA\'' --> `\xba' +`\`\\xbB\'' --> `\xbb' +`\`\\xbC\'' --> `\xbc' +`\`\\xbD\'' --> `\xbd' +`\`\\xbE\'' --> `\xbe' +`\`\\xbF\'' --> `\xbf' +`\`\\xc0\'' --> `\xc0' +`\`\\xc1\'' --> `\xc1' +`\`\\xc2\'' --> `\xc2' +`\`\\xc3\'' --> `\xc3' +`\`\\xc4\'' --> `\xc4' +`\`\\xc5\'' --> `\xc5' +`\`\\xc6\'' --> `\xc6' +`\`\\xc7\'' --> `\xc7' +`\`\\xc8\'' --> `\xc8' +`\`\\xc9\'' --> `\xc9' +`\`\\xca\'' --> `\xca' +`\`\\xcb\'' --> `\xcb' +`\`\\xcc\'' --> `\xcc' +`\`\\xcd\'' --> `\xcd' +`\`\\xce\'' --> `\xce' +`\`\\xcf\'' --> `\xcf' +`\`\\xcA\'' --> `\xca' +`\`\\xcB\'' --> `\xcb' +`\`\\xcC\'' --> `\xcc' +`\`\\xcD\'' --> `\xcd' +`\`\\xcE\'' --> `\xce' +`\`\\xcF\'' --> `\xcf' +`\`\\xd0\'' --> `\xd0' +`\`\\xd1\'' --> `\xd1' +`\`\\xd2\'' --> `\xd2' +`\`\\xd3\'' --> `\xd3' +`\`\\xd4\'' --> `\xd4' +`\`\\xd5\'' --> `\xd5' +`\`\\xd6\'' --> `\xd6' +`\`\\xd7\'' --> `\xd7' +`\`\\xd8\'' --> `\xd8' +`\`\\xd9\'' --> `\xd9' +`\`\\xda\'' --> `\xda' +`\`\\xdb\'' --> `\xdb' +`\`\\xdc\'' --> `\xdc' +`\`\\xdd\'' --> `\xdd' +`\`\\xde\'' --> `\xde' +`\`\\xdf\'' --> `\xdf' +`\`\\xdA\'' --> `\xda' +`\`\\xdB\'' --> `\xdb' +`\`\\xdC\'' --> `\xdc' +`\`\\xdD\'' --> `\xdd' +`\`\\xdE\'' --> `\xde' +`\`\\xdF\'' --> `\xdf' +`\`\\xe0\'' --> `\xe0' +`\`\\xe1\'' --> `\xe1' +`\`\\xe2\'' --> `\xe2' +`\`\\xe3\'' --> `\xe3' +`\`\\xe4\'' --> `\xe4' +`\`\\xe5\'' --> `\xe5' +`\`\\xe6\'' --> `\xe6' +`\`\\xe7\'' --> `\xe7' +`\`\\xe8\'' --> `\xe8' +`\`\\xe9\'' --> `\xe9' +`\`\\xea\'' --> `\xea' +`\`\\xeb\'' --> `\xeb' +`\`\\xec\'' --> `\xec' +`\`\\xed\'' --> `\xed' +`\`\\xee\'' --> `\xee' +`\`\\xef\'' --> `\xef' +`\`\\xeA\'' --> `\xea' +`\`\\xeB\'' --> `\xeb' +`\`\\xeC\'' --> `\xec' +`\`\\xeD\'' --> `\xed' +`\`\\xeE\'' --> `\xee' +`\`\\xeF\'' --> `\xef' +`\`\\xf0\'' --> `\xf0' +`\`\\xf1\'' --> `\xf1' +`\`\\xf2\'' --> `\xf2' +`\`\\xf3\'' --> `\xf3' +`\`\\xf4\'' --> `\xf4' +`\`\\xf5\'' --> `\xf5' +`\`\\xf6\'' --> `\xf6' +`\`\\xf7\'' --> `\xf7' +`\`\\xf8\'' --> `\xf8' +`\`\\xf9\'' --> `\xf9' +`\`\\xfa\'' --> `\xfa' +`\`\\xfb\'' --> `\xfb' +`\`\\xfc\'' --> `\xfc' +`\`\\xfd\'' --> `\xfd' +`\`\\xfe\'' --> `\xfe' +`\`\\xff\'' --> `\xff' +`\`\\xfA\'' --> `\xfa' +`\`\\xfB\'' --> `\xfb' +`\`\\xfC\'' --> `\xfc' +`\`\\xfD\'' --> `\xfd' +`\`\\xfE\'' --> `\xfe' +`\`\\xfF\'' --> `\xff' +`\`\\xA0\'' --> `\xa0' +`\`\\xA1\'' --> `\xa1' +`\`\\xA2\'' --> `\xa2' +`\`\\xA3\'' --> `\xa3' +`\`\\xA4\'' --> `\xa4' +`\`\\xA5\'' --> `\xa5' +`\`\\xA6\'' --> `\xa6' +`\`\\xA7\'' --> `\xa7' +`\`\\xA8\'' --> `\xa8' +`\`\\xA9\'' --> `\xa9' +`\`\\xAa\'' --> `\xaa' +`\`\\xAb\'' --> `\xab' +`\`\\xAc\'' --> `\xac' +`\`\\xAd\'' --> `\xad' +`\`\\xAe\'' --> `\xae' +`\`\\xAf\'' --> `\xaf' +`\`\\xAA\'' --> `\xaa' +`\`\\xAB\'' --> `\xab' +`\`\\xAC\'' --> `\xac' +`\`\\xAD\'' --> `\xad' +`\`\\xAE\'' --> `\xae' +`\`\\xAF\'' --> `\xaf' +`\`\\xB0\'' --> `\xb0' +`\`\\xB1\'' --> `\xb1' +`\`\\xB2\'' --> `\xb2' +`\`\\xB3\'' --> `\xb3' +`\`\\xB4\'' --> `\xb4' +`\`\\xB5\'' --> `\xb5' +`\`\\xB6\'' --> `\xb6' +`\`\\xB7\'' --> `\xb7' +`\`\\xB8\'' --> `\xb8' +`\`\\xB9\'' --> `\xb9' +`\`\\xBa\'' --> `\xba' +`\`\\xBb\'' --> `\xbb' +`\`\\xBc\'' --> `\xbc' +`\`\\xBd\'' --> `\xbd' +`\`\\xBe\'' --> `\xbe' +`\`\\xBf\'' --> `\xbf' +`\`\\xBA\'' --> `\xba' +`\`\\xBB\'' --> `\xbb' +`\`\\xBC\'' --> `\xbc' +`\`\\xBD\'' --> `\xbd' +`\`\\xBE\'' --> `\xbe' +`\`\\xBF\'' --> `\xbf' +`\`\\xC0\'' --> `\xc0' +`\`\\xC1\'' --> `\xc1' +`\`\\xC2\'' --> `\xc2' +`\`\\xC3\'' --> `\xc3' +`\`\\xC4\'' --> `\xc4' +`\`\\xC5\'' --> `\xc5' +`\`\\xC6\'' --> `\xc6' +`\`\\xC7\'' --> `\xc7' +`\`\\xC8\'' --> `\xc8' +`\`\\xC9\'' --> `\xc9' +`\`\\xCa\'' --> `\xca' +`\`\\xCb\'' --> `\xcb' +`\`\\xCc\'' --> `\xcc' +`\`\\xCd\'' --> `\xcd' +`\`\\xCe\'' --> `\xce' +`\`\\xCf\'' --> `\xcf' +`\`\\xCA\'' --> `\xca' +`\`\\xCB\'' --> `\xcb' +`\`\\xCC\'' --> `\xcc' +`\`\\xCD\'' --> `\xcd' +`\`\\xCE\'' --> `\xce' +`\`\\xCF\'' --> `\xcf' +`\`\\xD0\'' --> `\xd0' +`\`\\xD1\'' --> `\xd1' +`\`\\xD2\'' --> `\xd2' +`\`\\xD3\'' --> `\xd3' +`\`\\xD4\'' --> `\xd4' +`\`\\xD5\'' --> `\xd5' +`\`\\xD6\'' --> `\xd6' +`\`\\xD7\'' --> `\xd7' +`\`\\xD8\'' --> `\xd8' +`\`\\xD9\'' --> `\xd9' +`\`\\xDa\'' --> `\xda' +`\`\\xDb\'' --> `\xdb' +`\`\\xDc\'' --> `\xdc' +`\`\\xDd\'' --> `\xdd' +`\`\\xDe\'' --> `\xde' +`\`\\xDf\'' --> `\xdf' +`\`\\xDA\'' --> `\xda' +`\`\\xDB\'' --> `\xdb' +`\`\\xDC\'' --> `\xdc' +`\`\\xDD\'' --> `\xdd' +`\`\\xDE\'' --> `\xde' +`\`\\xDF\'' --> `\xdf' +`\`\\xE0\'' --> `\xe0' +`\`\\xE1\'' --> `\xe1' +`\`\\xE2\'' --> `\xe2' +`\`\\xE3\'' --> `\xe3' +`\`\\xE4\'' --> `\xe4' +`\`\\xE5\'' --> `\xe5' +`\`\\xE6\'' --> `\xe6' +`\`\\xE7\'' --> `\xe7' +`\`\\xE8\'' --> `\xe8' +`\`\\xE9\'' --> `\xe9' +`\`\\xEa\'' --> `\xea' +`\`\\xEb\'' --> `\xeb' +`\`\\xEc\'' --> `\xec' +`\`\\xEd\'' --> `\xed' +`\`\\xEe\'' --> `\xee' +`\`\\xEf\'' --> `\xef' +`\`\\xEA\'' --> `\xea' +`\`\\xEB\'' --> `\xeb' +`\`\\xEC\'' --> `\xec' +`\`\\xED\'' --> `\xed' +`\`\\xEE\'' --> `\xee' +`\`\\xEF\'' --> `\xef' +`\`\\xF0\'' --> `\xf0' +`\`\\xF1\'' --> `\xf1' +`\`\\xF2\'' --> `\xf2' +`\`\\xF3\'' --> `\xf3' +`\`\\xF4\'' --> `\xf4' +`\`\\xF5\'' --> `\xf5' +`\`\\xF6\'' --> `\xf6' +`\`\\xF7\'' --> `\xf7' +`\`\\xF8\'' --> `\xf8' +`\`\\xF9\'' --> `\xf9' +`\`\\xFa\'' --> `\xfa' +`\`\\xFb\'' --> `\xfb' +`\`\\xFc\'' --> `\xfc' +`\`\\xFd\'' --> `\xfd' +`\`\\xFe\'' --> `\xfe' +`\`\\xFf\'' --> `\xff' +`\`\\xFA\'' --> `\xfa' +`\`\\xFB\'' --> `\xfb' +`\`\\xFC\'' --> `\xfc' +`\`\\xFD\'' --> `\xfd' +`\`\\xFE\'' --> `\xfe' +`\`\\xFF\'' --> `\xff' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_e.nx.in new file mode 100644 index 000000000..395354164 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/string_e.nx.in @@ -0,0 +1,83 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + ``\\\`'' + ``\\\''' + ``\\\\'' + ``\\0'' + ``\\n'' + ``\\r'' + ``\\t'' + ``\\b'' + ``\\f'' + ``\\a'' + ``\\\n'' + ``\\\r\n'' + ``\\e'' + + # Lower case control character. + `a' 0 get 1 `z' 0 get { + `\`\\c' + # #c #string + exch + # #string #c + `?' dup 0 4 ndn put cat + # #string + `\'' cat + } for + + # Upper case control character. + `A' 0 get 1 `Z' 0 get { + `\`\\c' + # #c #string + exch + # #string #c + `?' dup 0 4 ndn put cat + # #string + `\'' cat + } for + + # Hexadecimal character. + [`0' `1' `2' `3' `4' `5' `6' `7' `8' `9' + `a' `b' `c' `d' `e' `f' + `A' `B' `C' `D' `E' `F'] + + 0 1 21 { + 0 1 21 { + # #key #Y #Z + `\`\\x' + 3 idup 3 idup get cat + exch 3 idup exch get cat + `\'' cat + + up + # #string #key #Y + } for + # #key #Y + pop + } for + # #key + pop +]{ + dup 1 sprints print + ` --> ' print + + cvx eval + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_a.nx.exp new file mode 100644 index 000000000..7867ac155 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +`(0 42) dup stuck' +(42 0 42) +`(1 0 ()) dup stuck' +(1 -stack- 0 -stack-) +`(2 1 0 mark) dup stuck' +(2 1 -mark- 0 -mark-) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_a.nx.in new file mode 100644 index 000000000..ad2a36464 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_a.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `(0 42) dup stuck' + `(1 0 ()) dup stuck' + `(2 1 0 mark) dup stuck' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_b.nx.exp new file mode 100644 index 000000000..da5462663 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --stuck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_b.nx.in new file mode 100644 index 000000000..bad03ec80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stuck + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_c.nx.exp new file mode 100644 index 000000000..4209bbbd1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --stuck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_c.nx.in new file mode 100644 index 000000000..8565ebe8b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() stuck + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_d.nx.exp new file mode 100644 index 000000000..4209bbbd1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --stuck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_d.nx.in new file mode 100644 index 000000000..bc87809bb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) stuck + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_e.nx.exp new file mode 100644 index 000000000..0e9004835 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --stuck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_e.nx.in new file mode 100644 index 000000000..48e2cac4e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/stuck_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark stuck + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_a.nx.exp new file mode 100644 index 000000000..b84df66c7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_a.nx.exp @@ -0,0 +1,12 @@ +Test begin +`0 0 sub' +0 +`0 -1 sub' +1 +`-1 0 sub' +-1 +`1 1 sub' +0 +`-1 -1 sub' +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_a.nx.in new file mode 100644 index 000000000..4777bcd29 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_a.nx.in @@ -0,0 +1,27 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 0 sub' + `0 -1 sub' + `-1 0 sub' + `1 1 sub' + `-1 -1 sub' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_b.nx.exp new file mode 100644 index 000000000..20e975bf4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_b.nx.in new file mode 100644 index 000000000..f75f873e4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 sub + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_c.nx.exp new file mode 100644 index 000000000..732f287e1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_c.nx.in new file mode 100644 index 000000000..7091039f8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark sub + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_d.nx.exp new file mode 100644 index 000000000..438560b62 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sub-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_d.nx.in new file mode 100644 index 000000000..0f7caaebe --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 sub + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_e.nx.exp new file mode 100644 index 000000000..4787c3fc4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_e.nx.exp @@ -0,0 +1,32 @@ +Test begin +`0.0 0 sub' +0.000000e+00 +`0.0 -1 sub' +1.000000e+00 +`-1.0 0 sub' +-1.000000e+00 +`1.0 1 sub' +0.000000e+00 +`-1.0 -1 sub' +0.000000e+00 +`0 0.0 sub' +0.000000e+00 +`0 -1.0 sub' +1.000000e+00 +`-1 0.0 sub' +-1.000000e+00 +`1 1.0 sub' +0.000000e+00 +`-1 -1.0 sub' +0.000000e+00 +`0 0.0 sub' +0.000000e+00 +`0 -1.0 sub' +1.000000e+00 +`-1 0.0 sub' +-1.000000e+00 +`1 1.0 sub' +0.000000e+00 +`-1 -1.0 sub' +0.000000e+00 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_e.nx.in new file mode 100644 index 000000000..1395973c5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sub_e.nx.in @@ -0,0 +1,39 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0.0 0 sub' + `0.0 -1 sub' + `-1.0 0 sub' + `1.0 1 sub' + `-1.0 -1 sub' + + `0 0.0 sub' + `0 -1.0 sub' + `-1 0.0 sub' + `1 1.0 sub' + `-1 -1.0 sub' + + `0 0.0 sub' + `0 -1.0 sub' + `-1 0.0 sub' + `1 1.0 sub' + `-1 -1.0 sub' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_a.nx.exp new file mode 100644 index 000000000..cff16f2d5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_a.nx.exp @@ -0,0 +1,110 @@ +Test begin +{`' `'} +false +0: null +1: null +2: null +3: null +4: null +5: null +6: null +7: null +8: null +9: null +{`' `.'} +false +0: null +1: null +2: null +3: null +4: null +5: null +6: null +7: null +8: null +9: null +{`Some input text' `'} +true +0: `' +1: null +2: null +3: null +4: null +5: null +6: null +7: null +8: null +9: null +{`Some input text' `\\w\\w+'} +true +0: `Some' +1: null +2: null +3: null +4: null +5: null +6: null +7: null +8: null +9: null +{`Some input text' `(\\w\\w+)'} +true +0: `Some' +1: `Some' +2: null +3: null +4: null +5: null +6: null +7: null +8: null +9: null +{`Some input text' `((\\w)\\w+)'} +true +0: `Some' +1: `Some' +2: `S' +3: null +4: null +5: null +6: null +7: null +8: null +9: null +{`Some input text' `((i)((n)|(X))\\w+)'} +true +0: `input' +1: `input' +2: `i' +3: `n' +4: `n' +5: null +6: null +7: null +8: null +9: null +{`Some input text' `((i)((X)|(n))\\w+)'} +true +0: `input' +1: `input' +2: `i' +3: `n' +4: null +5: `n' +6: null +7: null +8: null +9: null +{`' `'} +false +0: null +1: null +2: null +3: null +4: null +5: null +6: null +7: null +8: null +9: null +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_a.nx.in new file mode 100644 index 000000000..fe7e9fa4f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_a.nx.in @@ -0,0 +1,35 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`' `'} + {`' `.'} + {`Some input text' `'} + {`Some input text' `\w\w+'} + {`Some input text' `(\w\w+)'} + {`Some input text' `((\w)\w+)'} + {`Some input text' `((i)((n)|(X))\w+)'} + {`Some input text' `((i)((X)|(n))\w+)'} + {`' `'} +]{ + dup 1 sprint + eval match 1 sprint + 0 1 9 { + dup cvs print `: ' print + submatch 1 sprint + } for +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_b.nx.exp new file mode 100644 index 000000000..b16627317 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --submatch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_b.nx.in new file mode 100644 index 000000000..96e5fa0d6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +submatch + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_c.nx.exp new file mode 100644 index 000000000..ababeaecb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --submatch-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_c.nx.in new file mode 100644 index 000000000..e4ab5773f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/submatch_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark submatch + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_a.nx.exp new file mode 100644 index 000000000..ec9fa31a8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_a.nx.exp @@ -0,0 +1,50 @@ +Test begin +{`Input string' `p(.)' `X\\1Y' < > subst pstack 2 npop} +1 +`InXuYt string' +{`Input string' `p(.)' `X\\1Y' < > subst pstack 2 npop} +1 +`InXuYt string' +{`Input string' `p(.)' `X\\1Y' < > regsub subst pstack 2 npop} +1 +`InXuYt string' +{`Input String' `([a-r])' `[\\2]' subst pstack 2 npop} +1 +`I[]put String' +{`Input String' `([a-r])' `[\\2]' < > subst pstack 2 npop} +1 +`I[]put String' +{`Input String' `([a-r])' `[\\2]' < $g true > subst pstack 2 npop} +6 +`I[][]ut St[][][][]' +{`Input String' `([a-j])|([k-r])' `[\\1|\\2]' subst pstack 2 npop} +1 +`I[|n]put String' +{`Input String' `([a-j])|([k-r])' `[\\1|\\2]' < > subst pstack 2 npop} +1 +`I[|n]put String' +{`Input String' `([a-j])|([k-r])' `[\\1|\\2]' < $g true > subst pstack 2 npop} +6 +`I[|n][|p]ut St[|r][i|][|n][g|]' +{`Input String' `([a-j])' `\\\\1' < $g true > subst pstack 2 npop} +2 +`Input Str\\in\\g' +{`Input String' `([a-j])' `\\1\\' < $g true > subst pstack 2 npop} +2 +`Input Stri\\ng\\' +{`Input String' `i' `>\\1<' < $g true > subst pstack 2 npop} +1 +`Input Str>\\1<' < $g true $i true > subst pstack 2 npop} +2 +`>\\1<' < $g true > subst pstack 2 npop} +1 +`>Multiple< line\ninput string' +{`Multiple line\ninput string' `(\\w+.)' `>\\1<' < $g true $m true > subst pstack 2 npop} +4 +`>Multiple <>line<\n>input <>string<' +{`Multiple line\ninput string' `(\\w+.)' `>\\1<' < $g true $s true > subst pstack 2 npop} +4 +`>Multiple <>line\n<>input <>string<' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_a.nx.in new file mode 100644 index 000000000..1e7eec1d3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_a.nx.in @@ -0,0 +1,56 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + {`Input string' `p(.)' `X\1Y' <> subst pstack 2 npop} + {`Input string' `p(.)' `X\1Y' <> subst pstack 2 npop} + {`Input string' `p(.)' `X\1Y' <> regsub subst pstack 2 npop} + + {`Input String' `([a-r])' `[\2]' subst pstack 2 npop} + {`Input String' `([a-r])' `[\2]' <> subst pstack 2 npop} + {`Input String' `([a-r])' `[\2]' <$g true> subst pstack 2 npop} + + {`Input String' `([a-j])|([k-r])' `[\1|\2]' subst pstack 2 npop} + {`Input String' `([a-j])|([k-r])' `[\1|\2]' <> subst pstack 2 npop} + {`Input String' `([a-j])|([k-r])' `[\1|\2]' <$g true> subst pstack 2 npop} + + {`Input String' `([a-j])' `\\\1' <$g true> subst pstack 2 npop} + + {`Input String' `([a-j])' `\1\\' <$g true> subst pstack 2 npop} + + {`Input String' `i' `>\1<' <$g true> subst pstack 2 npop} + {`Input String' `i' `>\1<' <$g true $i true> subst pstack 2 npop} + + { + `Multiple line\ninput string' + `(^\w+)' `>\1<' <$g true> subst + pstack 2 npop + } + { + `Multiple line\ninput string' + `(\w+.)' `>\1<' <$g true $m true> subst + pstack 2 npop + } + { + `Multiple line\ninput string' + `(\w+.)' `>\1<' <$g true $s true> subst + pstack 2 npop + } +]{ + dup 2 sprint + eval +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_b.nx.exp new file mode 100644 index 000000000..b9daffd9a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_b.nx.in new file mode 100644 index 000000000..0526e66d6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_c.nx.exp new file mode 100644 index 000000000..77ec3d07f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_c.nx.in new file mode 100644 index 000000000..72f08a43c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_d.nx.exp new file mode 100644 index 000000000..9fef182a7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_d.nx.in new file mode 100644 index 000000000..39b5e7deb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_e.nx.exp new file mode 100644 index 000000000..ba3646415 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_e.nx.in new file mode 100644 index 000000000..42dccaaab --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' <> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_f.nx.exp new file mode 100644 index 000000000..34b24995c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (`' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_f.nx.in new file mode 100644 index 000000000..218020a52 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_f.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' <> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_g.nx.exp new file mode 100644 index 000000000..392a41ddc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_g.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-regsub-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_g.nx.in new file mode 100644 index 000000000..c082c1726 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_g.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' <> regsub subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_h.nx.exp new file mode 100644 index 000000000..0bc71b157 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_h.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' `' -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_h.nx.in new file mode 100644 index 000000000..fcafa8bd7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_h.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' `' mark subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_i.nx.exp new file mode 100644 index 000000000..8db65c25b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_i.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' -mark- -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_i.nx.in new file mode 100644 index 000000000..2e794915e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_i.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' mark <> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_j.nx.exp new file mode 100644 index 000000000..2e2b7652a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_j.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' -mark- `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_j.nx.in new file mode 100644 index 000000000..8e74bbc65 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_j.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' mark `' <> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_k.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_k.nx.exp new file mode 100644 index 000000000..bb512a746 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_k.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- `' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_k.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_k.nx.in new file mode 100644 index 000000000..2eab41df9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_k.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `' `' <> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_l.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_l.nx.exp new file mode 100644 index 000000000..4ea4c46d0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_l.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -regsub-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_l.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_l.nx.in new file mode 100644 index 000000000..fc46ba3c5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_l.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark `' `' <> regsub subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_m.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_m.nx.exp new file mode 100644 index 000000000..194898eb2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_m.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_m.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_m.nx.in new file mode 100644 index 000000000..2e1d3eebd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_m.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' `' <$g 0> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_n.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_n.nx.exp new file mode 100644 index 000000000..194898eb2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_n.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_n.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_n.nx.in new file mode 100644 index 000000000..76269d65f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_n.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' `' <$i 0> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_o.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_o.nx.exp new file mode 100644 index 000000000..194898eb2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_o.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_o.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_o.nx.in new file mode 100644 index 000000000..e403a47c8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_o.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' `' <$m 0> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_p.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_p.nx.exp new file mode 100644 index 000000000..194898eb2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_p.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (`' `' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_p.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_p.nx.in new file mode 100644 index 000000000..70aa57edc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_p.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `' `' <$s 0> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_q.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_q.nx.exp new file mode 100644 index 000000000..a27fc6315 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_q.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $regexerror +ostack: (`' `(' `' -dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --subst-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_q.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_q.nx.in new file mode 100644 index 000000000..f36a8418a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/subst_q.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`' `(' `' <> subst + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_a.nx.exp new file mode 100644 index 000000000..9f5d17ae6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +(0 1) --> (0 0 1) +(0 1 2) --> (0 1 1 2) +(0 1 2 3) --> (0 1 2 2 3) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_a.nx.in new file mode 100644 index 000000000..a71a3314e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_a.nx.in @@ -0,0 +1,31 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (0 1) + (0 1 2) + (0 1 2 3) +]{ + dup 1 sprints print + ` --> ' print + + dup sunder + + 1 sprint + + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_b.nx.exp new file mode 100644 index 000000000..b13d2b69c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sunder-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_b.nx.in new file mode 100644 index 000000000..fc0562845 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sunder + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_c.nx.exp new file mode 100644 index 000000000..bfb2fd59b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sunder-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_c.nx.in new file mode 100644 index 000000000..0f9c02cb2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sunder + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_d.nx.exp new file mode 100644 index 000000000..080aad0c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sunder-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_d.nx.in new file mode 100644 index 000000000..e166d7c5c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() sunder + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_e.nx.exp new file mode 100644 index 000000000..080aad0c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sunder-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_e.nx.in new file mode 100644 index 000000000..102181ac2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sunder_e.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1) sunder + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_a.nx.exp new file mode 100644 index 000000000..df01b2aa8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +(2 1 0) --> (0 2 1) +(3 2 1 0) --> (3 0 2 1) +(4 3 2 1 0) --> (4 3 0 2 1) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_a.nx.in new file mode 100644 index 000000000..4079d0e50 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_a.nx.in @@ -0,0 +1,29 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + (2 1 0) + (3 2 1 0) + (4 3 2 1 0) +]{ + dup 1 sprints print + ` --> ' print + + dup sup + + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_b.nx.exp new file mode 100644 index 000000000..561f4eb70 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_b.nx.in new file mode 100644 index 000000000..58bb8fc45 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +sup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_c.nx.exp new file mode 100644 index 000000000..c58ee8b22 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_c.nx.in new file mode 100644 index 000000000..25f70fb20 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark sup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_d.nx.exp new file mode 100644 index 000000000..16c600974 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-stack-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --sup-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_d.nx.in new file mode 100644 index 000000000..5fba8b974 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sup_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +(1 0) sup + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_a.nx.exp new file mode 100644 index 000000000..cb0e0924c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_a.nx.exp @@ -0,0 +1,4 @@ +Test begin +<> +-dict- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_a.nx.in new file mode 100644 index 000000000..6ca7f3207 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_a.nx.in @@ -0,0 +1,23 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<> 1 sprint +< + $foo `foo' + $bar $bar + $biz () + $baz null +> 0 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_b.nx.exp new file mode 100644 index 000000000..a13cd0b75 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $unmatchedmark +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: -->-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_b.nx.in new file mode 100644 index 000000000..a5c3c97f6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +> + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_c.nx.exp new file mode 100644 index 000000000..2d91aed66 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $rangecheck +ostack: (-mark- $foo) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: -->-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_c.nx.in new file mode 100644 index 000000000..9f3233cbd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_gt_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +<$foo> + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lp_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lp_a.nx.exp new file mode 100644 index 000000000..2f7337329 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lp_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-fino- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lp_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lp_a.nx.in new file mode 100644 index 000000000..45b1ba9fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lp_a.nx.in @@ -0,0 +1,15 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush +( pstack +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lt_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lt_a.nx.exp new file mode 100644 index 000000000..de9ae7039 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lt_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-mark- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lt_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lt_a.nx.in new file mode 100644 index 000000000..2382615a2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_lt_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +< pstack + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_a.nx.exp new file mode 100644 index 000000000..398e6a022 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +() +(-stack-) +(1 (2) 3) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_a.nx.in new file mode 100644 index 000000000..24f3fb4bf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_a.nx.in @@ -0,0 +1,19 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +() 1 sprint +(()) 1 sprint +(1 (2) 3) 2 sprint + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_b.nx.exp new file mode 100644 index 000000000..317f8db05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $unmatchedfino +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --)-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_b.nx.in new file mode 100644 index 000000000..3bf3ba9d5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/sym_rp_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +) + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_a.nx.exp new file mode 100644 index 000000000..d73ddaf31 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_a.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 0: Error $syntaxerror +ostack: (`\'') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_a.nx.in new file mode 100644 index 000000000..494d6f82e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_a.nx.in @@ -0,0 +1,12 @@ +' +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_b.nx.exp new file mode 100644 index 000000000..545ea898c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_b.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 0: Error $syntaxerror +ostack: (`}') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_b.nx.in new file mode 100644 index 000000000..3ab2befa7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_b.nx.in @@ -0,0 +1,12 @@ +} +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_c.nx.exp new file mode 100644 index 000000000..b8006c9a6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_c.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`$\n') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_c.nx.in new file mode 100644 index 000000000..ddfd70643 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_c.nx.in @@ -0,0 +1,12 @@ +$ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_d.nx.exp new file mode 100644 index 000000000..51d649b2c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_d.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`$#') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_d.nx.in new file mode 100644 index 000000000..8006b6d5a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_d.nx.in @@ -0,0 +1,12 @@ +$# +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_e.nx.exp new file mode 100644 index 000000000..5fc1cb24f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_e.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 3: Error $syntaxerror +ostack: (`\`\\xr') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_e.nx.in new file mode 100644 index 000000000..37edafc26 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_e.nx.in @@ -0,0 +1,12 @@ +`\xr0' +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_f.nx.exp new file mode 100644 index 000000000..6e29588fb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_f.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 4: Error $syntaxerror +ostack: (`\`\\xar') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_f.nx.in new file mode 100644 index 000000000..8822938f9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_f.nx.in @@ -0,0 +1,12 @@ +`\xar' +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_g.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_g.nx.exp new file mode 100644 index 000000000..c209a3464 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_g.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`$ ') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_g.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_g.nx.in new file mode 100644 index 000000000..68136ba20 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_g.nx.in @@ -0,0 +1,12 @@ +$ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_h.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_h.nx.exp new file mode 100644 index 000000000..1f330a65b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_h.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`~\n') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_h.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_h.nx.in new file mode 100644 index 000000000..1a2e6f88a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_h.nx.in @@ -0,0 +1,12 @@ +~ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_i.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_i.nx.exp new file mode 100644 index 000000000..6741428ad --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_i.nx.exp @@ -0,0 +1,7 @@ +Test begin +At line 4, column 1: Error $syntaxerror +ostack: (-pmark- `\'') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_i.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_i.nx.in new file mode 100644 index 000000000..63d96943e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_i.nx.in @@ -0,0 +1,15 @@ +`Test begin\n' print flush +# Syntax error within a procedure. +{'} +`Test end\n' print +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_j.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_j.nx.exp new file mode 100644 index 000000000..74ae6a666 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_j.nx.exp @@ -0,0 +1,7 @@ +Test begin +At line 5, column 0: Error $syntaxerror +ostack: (`\`Unterminated string\n\`Test end\n\' print\n') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_j.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_j.nx.in new file mode 100644 index 000000000..e87313736 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_j.nx.in @@ -0,0 +1,3 @@ +`Test begin\n' print flush +`Unterminated string +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_k.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_k.nx.exp new file mode 100644 index 000000000..75f5992a1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_k.nx.exp @@ -0,0 +1,6 @@ +At line 3, column 1: Error $syntaxerror +ostack: (`$') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_k.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_k.nx.in new file mode 100644 index 000000000..c40901e86 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_k.nx.in @@ -0,0 +1,2 @@ +# Make sure there is no newline after the $ to get a syntaxerror at EOF. +$ \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_l.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_l.nx.exp new file mode 100644 index 000000000..194cf697f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_l.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 3: Error $syntaxerror +ostack: (`\`\\c4') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_l.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_l.nx.in new file mode 100644 index 000000000..4f3f82b77 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_l.nx.in @@ -0,0 +1,12 @@ +`\c4' +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_m.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_m.nx.exp new file mode 100644 index 000000000..2334f07d6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_m.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`!\n') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_m.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_m.nx.in new file mode 100644 index 000000000..88173ad76 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_m.nx.in @@ -0,0 +1,12 @@ +! +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_n.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_n.nx.exp new file mode 100644 index 000000000..37be013e6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_n.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`!#') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_n.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_n.nx.in new file mode 100644 index 000000000..3c0967d43 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_n.nx.in @@ -0,0 +1,12 @@ +!# +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_o.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_o.nx.exp new file mode 100644 index 000000000..aa4fe3659 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_o.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`! ') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_o.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_o.nx.in new file mode 100644 index 000000000..220ab21aa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_o.nx.in @@ -0,0 +1,12 @@ +! +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_p.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_p.nx.exp new file mode 100644 index 000000000..6a7aa51df --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_p.nx.exp @@ -0,0 +1,6 @@ +At line 3, column 1: Error $syntaxerror +ostack: (`!') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_p.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_p.nx.in new file mode 100644 index 000000000..c0e4c095a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_p.nx.in @@ -0,0 +1,2 @@ +# Make sure there is no newline after the ! to get a syntaxerror at EOF. +! \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_q.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_q.nx.exp new file mode 100644 index 000000000..3a0ff721c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_q.nx.exp @@ -0,0 +1,6 @@ +At line 3, column 1: Error $syntaxerror +ostack: (`~') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_q.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_q.nx.in new file mode 100644 index 000000000..5242518b6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_q.nx.in @@ -0,0 +1,2 @@ +# Make sure there is no newline after the ~ to get a syntaxerror at EOF. +~ \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_r.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_r.nx.exp new file mode 100644 index 000000000..a21310590 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_r.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`~#') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_r.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_r.nx.in new file mode 100644 index 000000000..f527321a0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_r.nx.in @@ -0,0 +1,12 @@ +~# +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_s.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_s.nx.exp new file mode 100644 index 000000000..372f7d194 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_s.nx.exp @@ -0,0 +1,6 @@ +At line 2, column 1: Error $syntaxerror +ostack: (`~ ') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_s.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_s.nx.in new file mode 100644 index 000000000..7785ab262 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/syntaxerror_s.nx.in @@ -0,0 +1,12 @@ +~ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/template.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/template.nx.in new file mode 100644 index 000000000..4d694173b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/template.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + + + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_a.nx.exp new file mode 100644 index 000000000..f4a505b8a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-stack- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_a.nx.in new file mode 100644 index 000000000..a2b5002da --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +self threaddstack 0 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_b.nx.exp new file mode 100644 index 000000000..0246a6911 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threaddstack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_b.nx.in new file mode 100644 index 000000000..4512f0a56 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +threaddstack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_c.nx.exp new file mode 100644 index 000000000..26a6d7a4f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threaddstack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_c.nx.in new file mode 100644 index 000000000..36ee1710e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threaddstack_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark threaddstack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_a.nx.exp new file mode 100644 index 000000000..f4a505b8a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-stack- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_a.nx.in new file mode 100644 index 000000000..63162642a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +self threadestack 0 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_b.nx.exp new file mode 100644 index 000000000..14c1157f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threadestack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_b.nx.in new file mode 100644 index 000000000..56f0efaea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +threadestack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_c.nx.exp new file mode 100644 index 000000000..00b0bbcb6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threadestack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_c.nx.in new file mode 100644 index 000000000..3faa07ff6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadestack_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark threadestack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_a.nx.exp new file mode 100644 index 000000000..f4a505b8a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-stack- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_a.nx.in new file mode 100644 index 000000000..0e01eb342 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +self threadistack 0 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_b.nx.exp new file mode 100644 index 000000000..8213c6f19 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threadistack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_b.nx.in new file mode 100644 index 000000000..2e2895a4a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +threadistack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_c.nx.exp new file mode 100644 index 000000000..20f46b588 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threadistack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_c.nx.in new file mode 100644 index 000000000..acad33c52 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadistack_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark threadistack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_a.nx.exp new file mode 100644 index 000000000..f4a505b8a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +-stack- +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_a.nx.in new file mode 100644 index 000000000..a6860e8b5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +self threadostack 0 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_b.nx.exp new file mode 100644 index 000000000..9cca360dc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threadostack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_b.nx.in new file mode 100644 index 000000000..bfc6a5ee8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +threadostack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_c.nx.exp new file mode 100644 index 000000000..1fe98df86 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --threadostack-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_c.nx.in new file mode 100644 index 000000000..8ec6f2f2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadostack_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark threadostack + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadsdict_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadsdict_a.nx.exp new file mode 100644 index 000000000..225a64586 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadsdict_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +<-thread- null> +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadsdict_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadsdict_a.nx.in new file mode 100644 index 000000000..02addb498 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/threadsdict_a.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +threadsdict 1 sprint + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_a.nx.exp new file mode 100644 index 000000000..c17bd3d15 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_a.nx.exp @@ -0,0 +1,7 @@ +Test begin +Error $unregistered +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_a.nx.in new file mode 100644 index 000000000..5f0357e27 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +$unregistered throw + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_b.nx.exp new file mode 100644 index 000000000..1aef5f871 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_b.nx.exp @@ -0,0 +1,67 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: { + {-array- -array- -array- -array-} + {--eval-- --not-- -array- --if--} + --foreach-- + 3:--> --dup-- + --type-- + $nametype + --ne-- + {$typecheck !throw} + --if-- + !currenterror + --begin-- + $newerror + true + --def-- + --dup-- + $errorname + --exch-- + --cvlit-- + --def-- + --ostack-- + --dup-- + --spop-- + --pop-- + $ostack + --exch-- + --def-- + $dstack + --dstack-- + --dup-- + --spop-- + --pop-- + --def-- + $estack + --estack-- + --dup-- + --spop-- + --pop-- + --def-- + $istack + --istack-- + --dup-- + --spop-- + --pop-- + --def-- + !estack + --dup-- + --sdup-- + --spop-- + --exch-- + --end-- + !errordict + --dup-- + 2 + --idup-- + --known-- + {--exch-- --get-- --eval--} + {--nip-- --dup-- $handleerror --get-- --eval-- $stop --get-- --eval--} + --ifelse-- +} +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_b.nx.in new file mode 100644 index 000000000..77b08f9d1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +throw + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_c.nx.exp new file mode 100644 index 000000000..b36bded4d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_c.nx.exp @@ -0,0 +1,67 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: { + {-array- -array- -array- -array-} + {--eval-- --not-- -array- --if--} + --foreach-- + --dup-- + --type-- + $nametype + --ne-- + {$typecheck !throw} + 8:--> --if-- + !currenterror + --begin-- + $newerror + true + --def-- + --dup-- + $errorname + --exch-- + --cvlit-- + --def-- + --ostack-- + --dup-- + --spop-- + --pop-- + $ostack + --exch-- + --def-- + $dstack + --dstack-- + --dup-- + --spop-- + --pop-- + --def-- + $estack + --estack-- + --dup-- + --spop-- + --pop-- + --def-- + $istack + --istack-- + --dup-- + --spop-- + --pop-- + --def-- + !estack + --dup-- + --sdup-- + --spop-- + --exch-- + --end-- + !errordict + --dup-- + 2 + --idup-- + --known-- + {--exch-- --get-- --eval--} + {--nip-- --dup-- $handleerror --get-- --eval-- $stop --get-- --eval--} + --ifelse-- +} +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_c.nx.in new file mode 100644 index 000000000..a464e2bf2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/throw_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark throw + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_a.nx.exp new file mode 100644 index 000000000..bd9ef57d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_a.nx.exp @@ -0,0 +1,71 @@ +Test begin +-->`1' +1 +-->`1 ' +1 +-->`1 2' +1 +2 +-->`1 2 ' +1 +2 +-->`\`a\'' +`a' +-->`\`a\' ' +`a' +-->`\`a\'\`b\'' +`a' +`b' +-->`\`a\' \`b\'' +`a' +`b' +-->`\`a\'\`b\' ' +`a' +`b' +-->`$foo' +$foo +-->`$foo ' +$foo +-->`foo' +foo +-->`foo ' +foo +-->`foo$foo' +foo +$foo +-->`foo$foo ' +foo +$foo +-->`~pop~spop' +--pop-- +--spop-- +-->`<>' +< +> +-->`<<>>' +< +< +> +> +-->`()(())' +( +) +( +( +) +) +-->`{}' +{} +-->`{foo bar}' +{foo bar} +-->`{foo bar} ' +{foo bar} +-->`{{}}' +{{}} +-->`{}{}' +{} +{} +-->`{' +-->`{{}' +-->`{{} ' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_a.nx.in new file mode 100644 index 000000000..dd0db8fd0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_a.nx.in @@ -0,0 +1,55 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `1' + `1 ' + `1 2' + `1 2 ' + ``a'' + ``a' ' + ``a'`b'' + ``a' `b'' + ``a'`b' ' + `$foo' + `$foo ' + `foo' + `foo ' + `foo$foo' + `foo$foo ' + `~pop~spop' + `<>' + `<<>>' + `()(())' + `{}' + `{foo bar}' + `{foo bar} ' + `{{}}' + `{}{}' + `{' + `{{}' + `{{} ' +]{ + `-->' print + dup 1 sprint + { + token { + 3 sprint + }{ + exit + } ifelse + } loop +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_b.nx.exp new file mode 100644 index 000000000..3df147a88 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --token-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_b.nx.in new file mode 100644 index 000000000..02b0d8be9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +token + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_c.nx.exp new file mode 100644 index 000000000..7ed83f8f8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +At line 1, column 0: Error $syntaxerror +ostack: (`}' `}') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --token-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_c.nx.in new file mode 100644 index 000000000..a717cd795 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/token_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +`}' token + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_a.nx.exp new file mode 100644 index 000000000..2a6c3816d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_a.nx.exp @@ -0,0 +1,56 @@ +Test begin +`-1 trunc' +-1 +`0 trunc' +0 +`1 trunc' +1 +`-1.0 trunc' +-1 +`0.0 trunc' +0 +`1.0 trunc' +1 +`-2.9 trunc' +-2 +`-2.6 trunc' +-2 +`-2.5 trunc' +-2 +`-2.4 trunc' +-2 +`-2.1 trunc' +-2 +`-1.9 trunc' +-1 +`-1.6 trunc' +-1 +`-1.5 trunc' +-1 +`-1.4 trunc' +-1 +`-1.1 trunc' +-1 +`0.0 trunc' +0 +`1.1 trunc' +1 +`1.4 trunc' +1 +`1.5 trunc' +1 +`1.6 trunc' +1 +`1.9 trunc' +1 +`2.1 trunc' +2 +`2.4 trunc' +2 +`2.5 trunc' +2 +`2.6 trunc' +2 +`2.9 trunc' +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_a.nx.in new file mode 100644 index 000000000..5c06d26ef --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_a.nx.in @@ -0,0 +1,56 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `-1 trunc' + `0 trunc' + `1 trunc' + + `-1.0 trunc' + `0.0 trunc' + `1.0 trunc' + + `-2.9 trunc' + `-2.6 trunc' + `-2.5 trunc' + `-2.4 trunc' + `-2.1 trunc' + + `-1.9 trunc' + `-1.6 trunc' + `-1.5 trunc' + `-1.4 trunc' + `-1.1 trunc' + + `0.0 trunc' + + `1.1 trunc' + `1.4 trunc' + `1.5 trunc' + `1.6 trunc' + `1.9 trunc' + + `2.1 trunc' + `2.4 trunc' + `2.5 trunc' + `2.6 trunc' + `2.9 trunc' +]{ + dup 1 sprint + cvx eval + 1 sprint +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_b.nx.exp new file mode 100644 index 000000000..72ead4f5d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --trunc-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_b.nx.in new file mode 100644 index 000000000..7f7df6e5f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +trunc + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_c.nx.exp new file mode 100644 index 000000000..5d9d599e7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --trunc-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_c.nx.in new file mode 100644 index 000000000..dd90e4e9f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/trunc_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark trunc + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_a.nx.exp new file mode 100644 index 000000000..bbfce3f13 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +Before: +`Hello\nHello\nHello\nHello\n' +Shorten: +`Hello\nHello\n' +Lengthen: +`Hello\nHello\n\0\0\0\0\0\0\0\0\0\0\0\0' +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_a.nx.in new file mode 100644 index 000000000..488e65a45 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_a.nx.in @@ -0,0 +1,59 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +# Open file for writing. +argv 2 get +`/truncate_a_tmp.out' cat +dup `w+' open + +dup `Hello\n' write pop +dup `Hello\n' write pop +dup `Hello\n' write pop +dup `Hello\n' write pop +#dup flushfile + +`Before:\n' print +dup 0 seek +dup 30 string read +{ + `read error\n' print +}{ + 1 sprint +} ifelse + +dup 12 truncate + +`Shorten:\n' print +dup 0 seek +dup 30 string read +{ + `read error\n' print +}{ + 1 sprint +} ifelse + +dup 24 truncate + +`Lengthen:\n' print +dup 0 seek +30 string read +{ + `read error\n' print +}{ + 1 sprint +} ifelse + +unlink + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_b.nx.exp new file mode 100644 index 000000000..1b9341515 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (5) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --truncate-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_b.nx.in new file mode 100644 index 000000000..4d8d8dec6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +5 truncate + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_c.nx.exp new file mode 100644 index 000000000..3f43cb2b3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 10) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --truncate-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_c.nx.in new file mode 100644 index 000000000..d0842375d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 10 truncate + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_d.nx.exp new file mode 100644 index 000000000..066d363d6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-file- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --truncate-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_d.nx.in new file mode 100644 index 000000000..4cac3fbac --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +stdout mark truncate + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_e.nx.exp new file mode 100644 index 000000000..1afd9d127 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $ioerror +ostack: (-file- 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --truncate-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_e.nx.in new file mode 100644 index 000000000..4709c8e49 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/truncate_e.nx.in @@ -0,0 +1,25 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +argv 2 get +`/truncate_e_tmp.out' cat +dup `w+' open + +dup close + +exch unlink + +0 truncate + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_a.nx.exp new file mode 100644 index 000000000..579bd2c51 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_a.nx.exp @@ -0,0 +1,17 @@ +Test begin +`0 42 tuck' +42 +0 +42 +`1 0 () tuck' +() +0 +() +1 +`2 1 0 mark tuck' +-mark- +0 +-mark- +1 +2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_a.nx.in new file mode 100644 index 000000000..8551ec9cb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_a.nx.in @@ -0,0 +1,26 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 42 tuck' + `1 0 () tuck' + `2 1 0 mark tuck' +]{ + dup 1 sprint + cvx eval + pstack clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_b.nx.exp new file mode 100644 index 000000000..66fccfcc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --tuck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_b.nx.in new file mode 100644 index 000000000..1aa42eecc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +tuck + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_c.nx.exp new file mode 100644 index 000000000..00c1afa3e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --tuck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_c.nx.in new file mode 100644 index 000000000..654827507 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/tuck_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 tuck + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_a.nx.exp new file mode 100644 index 000000000..24681ee06 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_a.nx.exp @@ -0,0 +1,26 @@ +Test begin +`[1 2 3]' +arraytype +`true' +booleantype +`<$foo \`foo\' $bar \`bar\'>' +dicttype +`stdin' +filetype +`(' +finotype +`42' +integertype +`mark' +marktype +`$foo' +nametype +`null' +nulltype +`~pop' +operatortype +`(1 2 3)' +stacktype +`\`foo\'' +stringtype +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_a.nx.in new file mode 100644 index 000000000..4df406590 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_a.nx.in @@ -0,0 +1,34 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `[1 2 3]' + `true' + `<$foo `foo' $bar `bar'>' + `stdin' + `(' + `42' + `mark' + `$foo' + `null' + `~pop' + `(1 2 3)' + ``foo'' +]{ + dup 1 sprint + cvx eval + type 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_b.nx.exp new file mode 100644 index 000000000..257a8ce61 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --type-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_b.nx.in new file mode 100644 index 000000000..17257e1f5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/type_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +type + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_a.nx.exp new file mode 100644 index 000000000..c43ea3259 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_a.nx.exp @@ -0,0 +1,3 @@ +Test begin +777 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_a.nx.in new file mode 100644 index 000000000..59e97a916 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_a.nx.in @@ -0,0 +1,20 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +8@777 umask +umask +<$b 8 $w 3 $p `0'> output `\n' print + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_b.nx.exp new file mode 100644 index 000000000..7be3d6f8e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --umask-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_b.nx.in new file mode 100644 index 000000000..4c93f35d0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +umask + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_c.nx.exp new file mode 100644 index 000000000..9636dc592 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --umask-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_c.nx.in new file mode 100644 index 000000000..de112f7bd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/umask_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark umask + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_a.nx.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_a.nx.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_a.nx.in new file mode 100644 index 000000000..0ceef0fc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_a.nx.in @@ -0,0 +1,20 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +currentdict $foo undef +$foo `foo' def +currentdict $foo undef +currentdict $foo undef + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_b.nx.exp new file mode 100644 index 000000000..ec4aab3a3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-dict-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --undef-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_b.nx.in new file mode 100644 index 000000000..098f02d09 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +dict undef + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_c.nx.exp new file mode 100644 index 000000000..afd11c350 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --undef-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_c.nx.in new file mode 100644 index 000000000..3345255de --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/undef_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark mark undef + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_a.nx.exp new file mode 100644 index 000000000..0e20deb0a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_a.nx.exp @@ -0,0 +1,5 @@ +Test begin +0 1 --> (0 0 1) +0 1 2 --> (0 1 1 2) +0 1 2 3 --> (0 1 2 2 3) +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_a.nx.in new file mode 100644 index 000000000..922176637 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1' + `0 1 2' + `0 1 2 3' +]{ + dup print + ` --> ' print + + cvx eval + under + + ostack 1 sprint + + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_b.nx.exp new file mode 100644 index 000000000..d38166223 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --under-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_b.nx.in new file mode 100644 index 000000000..0146a1207 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/under_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 under + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_a.nx.exp new file mode 100644 index 000000000..aef81f62f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_a.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --unsetenv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_a.nx.in new file mode 100644 index 000000000..2dad3e08c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_a.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +unsetenv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_b.nx.exp new file mode 100644 index 000000000..560f45543 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --unsetenv-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_b.nx.in new file mode 100644 index 000000000..55ecad915 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/unsetenv_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark unsetenv + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_a.nx.exp new file mode 100644 index 000000000..8309d0b6d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_a.nx.exp @@ -0,0 +1,11 @@ +Test begin +`{\`Got here\n\' print} false until' +Got here +`{\`Got here\n\' print exit} true until' +Got here +`{exit \`Got here\n\' print} true until' +`<> begin\n $foo 0 def\n {\n\t\`foo: \' print\n\tfoo 1 sprint\n\n\t$foo foo inc def\n }{foo 3 lt} until\n end' +foo: 0 +foo: 1 +foo: 2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_a.nx.in new file mode 100644 index 000000000..116469fb7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_a.nx.in @@ -0,0 +1,35 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `{`Got here\n' print} false until' + `{`Got here\n' print exit} true until' + `{exit `Got here\n' print} true until' + `<> begin + $foo 0 def + { + `foo: ' print + foo 1 sprint + + $foo foo inc def + }{foo 3 lt} until + end' +]{ + dup 1 sprint + + cvx eval +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_b.nx.exp new file mode 100644 index 000000000..35a8ace45 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --until-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_b.nx.in new file mode 100644 index 000000000..d2d4e0cdc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{} until + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_c.nx.exp new file mode 100644 index 000000000..3a6bbcaaa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_c.nx.exp @@ -0,0 +1,9 @@ +Test begin +Got here +Error $stackunderflow +ostack: (-array- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --until-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_c.nx.in new file mode 100644 index 000000000..d54238f2c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{`Got here\n' print flush} {} until + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_d.nx.exp new file mode 100644 index 000000000..627fed3d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_d.nx.exp @@ -0,0 +1,9 @@ +Test begin +Got here +Error $typecheck +ostack: (1 -array- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --until-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_d.nx.in new file mode 100644 index 000000000..a81af7910 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/until_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{`Got here\n' print flush} {1} until + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_a.nx.exp new file mode 100644 index 000000000..3cbae5bf9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_a.nx.exp @@ -0,0 +1,44 @@ +Test begin +`0 1 2' +First: +1 +0 +2 +Second: +0 +2 +1 +Third: +2 +1 +0 +`() [] {}' +First: +[] +() +{} +Second: +() +{} +[] +Third: +{} +[] +() +`0 1 2 3' +First: +2 +1 +3 +0 +Second: +1 +3 +2 +0 +Third: +3 +2 +1 +0 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_a.nx.in new file mode 100644 index 000000000..6139d626d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_a.nx.in @@ -0,0 +1,32 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `0 1 2' + `() [] {}' + `0 1 2 3' +]{ + dup 1 sprint + cvx eval + `First:\n' print + up pstack + `Second:\n' print + up pstack + `Third:\n' print + up pstack + clear +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_b.nx.exp new file mode 100644 index 000000000..f11fe8285 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (0 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --up-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_b.nx.in new file mode 100644 index 000000000..5b7208f1e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/up_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +0 1 up + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_a.nx.exp new file mode 100644 index 000000000..0ee6f8561 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_a.nx.exp @@ -0,0 +1,12 @@ +Test begin +`$foo' +false +`$bar' +false +`$threaddict' +true +<$threaddict -dict- $userdict -dict- $currenterror -dict- $errordict -dict-> +`$currenterror' +true +<$threaddict -dict- $userdict -dict- $currenterror -dict- $errordict -dict-> +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_a.nx.in new file mode 100644 index 000000000..5eb1d6508 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_a.nx.in @@ -0,0 +1,24 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `$foo' + `$bar' + `$threaddict' + `$currenterror' +]{ + dup 1 sprint cvx eval where pstack clear +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_b.nx.exp new file mode 100644 index 000000000..d580b028b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --where-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_b.nx.in new file mode 100644 index 000000000..68d7fb2ba --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/where_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +where + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_a.nx.exp new file mode 100644 index 000000000..e9d226c94 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_a.nx.exp @@ -0,0 +1,10 @@ +Test begin +`false {\`Got here\n\' print} while' +`true {\`Got here\n\' print exit} while' +Got here +`true {exit \`Got here\n\' print} while' +`<> begin\n $foo 0 def\n {foo 3 lt}{\n\t\`foo: \' print\n\tfoo 1 sprint\n\n\t$foo foo inc def\n } while\n end' +foo: 0 +foo: 1 +foo: 2 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_a.nx.in new file mode 100644 index 000000000..ece16bafe --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_a.nx.in @@ -0,0 +1,35 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `false {`Got here\n' print} while' + `true {`Got here\n' print exit} while' + `true {exit `Got here\n' print} while' + `<> begin + $foo 0 def + {foo 3 lt}{ + `foo: ' print + foo 1 sprint + + $foo foo inc def + } while + end' +]{ + dup 1 sprint + + cvx eval +} foreach + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_b.nx.exp new file mode 100644 index 000000000..3fb2af88f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --while-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_b.nx.in new file mode 100644 index 000000000..7f9527bc0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_b.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{} while + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_c.nx.exp new file mode 100644 index 000000000..5c6786596 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (-array- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --while-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_c.nx.in new file mode 100644 index 000000000..80a068218 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_c.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{} {`Got here\n' print} while + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_d.nx.exp new file mode 100644 index 000000000..ed475ebe6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -array- -array-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --while-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_d.nx.in new file mode 100644 index 000000000..91d1a6827 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/while_d.nx.in @@ -0,0 +1,18 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +{1} {`Got here\n' print} while + +`Test end\n' print +pstack diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_a.nx.exp new file mode 100644 index 000000000..7b2a9ddb6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_a.nx.exp @@ -0,0 +1,28 @@ +Test begin +`{1 2 3}' +true +`[1 2 3]' +false +`true' +false +`<$foo \`foo\' $bar \`bar\'>' +false +`stdin' +false +`(' +false +`42' +false +`mark' +false +`$foo' +false +`null' +false +`~pop' +true +`(1 2 3)' +false +`\`foo\'' +false +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_a.nx.in new file mode 100644 index 000000000..3a5a57086 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_a.nx.in @@ -0,0 +1,36 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `{1 2 3}' + `[1 2 3]' + `true' + `<$foo `foo' $bar `bar'>' + `stdin' + `(' + `42' + `mark' + `$foo' + `null' + `~pop' + `(1 2 3)' + ``foo'' +]{ + dup 1 sprint + cvx eval + xcheck + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_b.nx.exp new file mode 100644 index 000000000..066377133 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --xcheck-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_b.nx.in new file mode 100644 index 000000000..92ebdf424 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xcheck_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +xcheck + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_a.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_a.nx.exp new file mode 100644 index 000000000..44940042d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_a.nx.exp @@ -0,0 +1,22 @@ +Test begin +`false false' +false +`true true' +false +`false true' +true +`true false' +true +`0 0' +0 +`16@7fffffffffffffff 16@7fffffffffffffff' +0 +`16@0 16@7fffffffffffffff' +9223372036854775807 +`16@7fffffffffffffff 16@0' +9223372036854775807 +`2@0101010101010101010101010101010101010101010101010101010101010101\n\t2@0101010101010101010101010101010101010101010101010101010101010101' +0 +`2@0101010101010101010101010101010101010101010101010101010101010101\n\t2@0010101010101010101010101010101010101010101010101010101010101010' +9223372036854775807 +Test end diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_a.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_a.nx.in new file mode 100644 index 000000000..a4e4b51f4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_a.nx.in @@ -0,0 +1,38 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +[ + `false false' + `true true' + `false true' + `true false' + + `0 0' + `16@7fffffffffffffff 16@7fffffffffffffff' + `16@0 16@7fffffffffffffff' + `16@7fffffffffffffff 16@0' + + `2@0101010101010101010101010101010101010101010101010101010101010101 + 2@0101010101010101010101010101010101010101010101010101010101010101' + + `2@0101010101010101010101010101010101010101010101010101010101010101 + 2@0010101010101010101010101010101010101010101010101010101010101010' +]{ + dup 1 sprint + cvx eval + xor + 1 sprint +} foreach + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_b.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_b.nx.exp new file mode 100644 index 000000000..06b6fded6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_b.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $stackunderflow +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --xor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_b.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_b.nx.in new file mode 100644 index 000000000..194c65d3c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_b.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 xor + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_c.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_c.nx.exp new file mode 100644 index 000000000..1a4ae3380 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_c.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (-mark- 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --xor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_c.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_c.nx.in new file mode 100644 index 000000000..947afbeee --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_c.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +mark 1 xor + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_d.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_d.nx.exp new file mode 100644 index 000000000..7556e7b1d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_d.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 -mark-) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --xor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_d.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_d.nx.in new file mode 100644 index 000000000..b09d97137 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_d.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 mark xor + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_e.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_e.nx.exp new file mode 100644 index 000000000..9008e8ede --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_e.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (1 true) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --xor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_e.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_e.nx.in new file mode 100644 index 000000000..f074d4b8d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_e.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +1 true xor + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_f.nx.exp b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_f.nx.exp new file mode 100644 index 000000000..ae5a4e7c9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_f.nx.exp @@ -0,0 +1,8 @@ +Test begin +Error $typecheck +ostack: (true 1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --xor-- +1: -file- +2: --start-- diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_f.nx.in b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_f.nx.in new file mode 100644 index 000000000..79bd92f47 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx/test/xor_f.nx.in @@ -0,0 +1,17 @@ +################################################################################ +# +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`Test begin\n' print flush + +true 1 xor + +`Test end\n' print diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx_config/.cvsignore new file mode 100644 index 000000000..a405988a5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/.cvsignore @@ -0,0 +1,3 @@ +bin +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx_config/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/bin/onyx_config/Cookfile.inc.in new file mode 100644 index 000000000..f590b0f6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/Cookfile.inc.in @@ -0,0 +1,113 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Cookfile for onyx_config. + * + ******************************************************************************/ + +/* Include generated dependency files. */ +#include-cooked [glob @objroot@/bin/onyx_config/src/"*.d_*"] + +/* + * File lists. + */ + +/* Source file. */ +ONYX_CONFIG_NSRCS = @srcroot@/bin/onyx_config/src/onyx_config.nx.in.in; + +/* LaTeX source files. */ +ONYX_CONFIG_TEX_SRCS = ; +ONYX_CONFIG_TEX_SRCS = [addprefix @srcroot@/bin/onyx_config/doc/latex/ + [ONYX_CONFIG_TEX_SRCS]]; +/* ONYX_CONFIG_TEX_SRCS = [ONYX_CONFIG_TEX_SRCS] + @objroot@/bin/onyx_config/doc/latex/manual.tex; */ + +/* Binaries. */ +ONYX_CONFIG = @objroot@/bin/onyx_config/bin/onyx_config; + +/* + * User cook'ables. + */ + +onyx_config : [ONYX_CONFIG]; + +onyx_config_bins_tests : +{ +} + +onyx_config_bins_check : +{ +} + +onyx_config_bins_check_update : +{ +} + +onyx_config_bins_bootstrap : +{ +} + +onyx_config_bins_install : mods_install +#if @enable_onyx@ + onyx_bins_install +#endif +{ + @INSTALL@ -d [BINDIR]; + + echo \"#!@ONYX@\" > [BINDIR]/onyx_config-@onyx_version@; + cat [fromto @srcroot@/%0%.nx.in.in @objroot@/%0%.nx.in [ONYX_CONFIG_NSRCS]] + >> [BINDIR]/onyx_config-@onyx_version@; + chmod 0755 [BINDIR]/onyx_config-@onyx_version@; + + rm -f [BINDIR]/onyx_config; + ln -s onyx_config-@onyx_version@ [BINDIR]/onyx_config; + + @INSTALL@ -d [MANDIR]/man1; + @INSTALL@ -m 0444 @objroot@/bin/onyx_config/man/man1/onyx_config.1 + [MANDIR]/man1; +} + +onyx_config_bins_uninstall : +{ + rm -f [BINDIR]/onyx_config-@onyx_version@; + rm -f [BINDIR]/onyx_config; + rm -f [MANDIR]/man1/onyx_config.1; +} + +onyx_config_bins_clean : +{ + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_a + [ONYX_COMMON_SRCS] [BONYX_ONLY_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_a + [ONYX_COMMON_SRCS] [BONYX_ONLY_SRCS]]; + + rm -f [ONYX_CONFIG]; +} + +onyx_config_bins_distclean : +{ + rm -f [fromto @srcroot@/%0%.nx.in.in @objroot@/%0%.nx.in [ONYX_CONFIG_NSRCS]]; +} + +/* + * Dependencies. + */ + +[ONYX_CONFIG] : [fromto @srcroot@/%0%.nx.in.in @objroot@/%0%.nx.in + [ONYX_CONFIG_NSRCS]] +#if @enable_onyx@ + tonyx +#endif + set mkdir +{ + echo \"#!@TONYX@\" > [target]; + cat [fromto @srcroot@/%0%.nx.in.in @objroot@/%0%.nx.in [ONYX_CONFIG_NSRCS]] + >> [target]; + chmod 0755 [target]; +} diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/.cvsignore new file mode 100644 index 000000000..4955aa2d7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/.cvsignore @@ -0,0 +1 @@ +onyx_config.1 diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/onyx_config.1.in b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/onyx_config.1.in new file mode 100644 index 000000000..4202a981a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/man/man1/onyx_config.1.in @@ -0,0 +1,49 @@ +.ig \" -*-mode:nroff-*- + + + + +Version: Onyx +.. +.TH onyx_config 1 "onyx_config, version " +.hy 1 +.SH NAME +onyx_config - configuration helper for building with libonyx +.SH SYNOPSIS +.B onyx_config +.BR [ \-\-help ] +.BR [ \-\-prefix ] +.BR [ \-\-version ] +.BR [ \-\-cppflags ] +.BR [ \-\-cflags ] +.BR [ \-\-ldflags ] +.BR [ \-\-libs ] +.SH DESCRIPTION +The +.B onyx_config +program is a script that aids in building programs with libonyx. +.SS Command line flags: +.IP \-\-help +Display usage information and exit. +.IP \-\-prefix +Display the installation prefix. +.IP \-\-version +Display the release version. +.IP \-\-cppflags +Display the C preprocessor flags. +.IP \-\-cflags +Display the C compiler flags. +.IP \-\-ldflags +Display the library linker flags. +.IP \-\-libs +Display the libaries to link against. +.SH FILES +@prefix@/share/onyx/doc/html/onyx.html +.br +@prefix@/share/onyx/doc/ps/onyx.ps +.br +@prefix@/share/onyx/doc/pdf/onyx.pdf +.SH SEE ALSO +onyx(1) +.SH HISTORY +Written by Jason Evans . diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/.cvsignore b/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/.cvsignore new file mode 100644 index 000000000..69933e126 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/.cvsignore @@ -0,0 +1,2 @@ +Cookfile.list +onyx_config.nx.in diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/Cookfile b/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/onyx_config.nx.in.in b/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/onyx_config.nx.in.in new file mode 100644 index 000000000..4fe506bc0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/bin/onyx_config/src/onyx_config.nx.in.in @@ -0,0 +1,115 @@ +# -*- mode: onyx -*- +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# Script that provides the build flags to use with libonyx. +# +################################################################################ + +# Define usage string. +# +# - usage_string #string +$usage_string +`\ +Usage: onyx_config [--help] [--version] [--prefix]\n\ + [--cppflags] [--cflags] [--ldflags] [--libs]\n' +def + +# Print usage to stderr. +# +# - usage - +$usage { + stderr + usage_string + write pop +} def + +# Print a string, after stripping off leading and trailing whitespace. +# +# #string strip_print - +@enable_regex@ 1 eq { + $strip_print { + `^\s*(\S.*\S)\s*$' `\1' <$s true> subst pop + print + } def +}{ + $strip_print $print load def +} ifelse + +# Dictionary of procedures associated with command line flags. +$flags < + `--help' { + usage_string print flush + 0 die + } + `--prefix' { + `@prefix@' strip_print + } + `--version' { + `Canonware Onyx, version .' strip_print + } + `--cppflags' { + `@CPPFLAGS@' + @enable_regex@ 1 eq { + dup `-I@prefix@/include\\b' match not { + ` -I@prefix@/include' cat + } if + }{ + ` -I@prefix@/include' cat + } ifelse + strip_print + } + `--cflags' { + `@CFLAGS@' strip_print + } + `--ldflags' { + `@LDFLAGS@' + @enable_regex@ 1 eq { + dup `-L@prefix@/lib\\b' match not { + ` -L@prefix@/lib' cat + } if + }{ + `-L@prefix@/lib' cat + } ifelse + strip_print + } + `--libs' { + `-lonyx @LIBS@' strip_print + } +> def + +# Make sure at least one argument was specified. +argv length 2 lt { + # No arguments specified. + usage + 1 die +} if + +# Iteratively process command line arguments. +argv dup length dec 1 exch getinterval +0 1 2 idup length dec { + # #args #index + dup 0 gt { + # Print a spacer between iterations. + ` ' print + } if + under get + # #args #arg + flags over known { + # Call procedure associated with flag. + flags exch get eval + }{ + # Unknown flag. + usage + 1 die + } ifelse +} for + +# Finish up with a newline. +`\n' print diff --git a/tags/ONYX_4_3_1/devroot/config.guess b/tags/ONYX_4_3_1/devroot/config.guess new file mode 100755 index 000000000..cec14aab4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/config.guess @@ -0,0 +1,1309 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-13' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + sparc*) machine=`uname -p`-unknown ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/tags/ONYX_4_3_1/devroot/config.stamp.in b/tags/ONYX_4_3_1/devroot/config.stamp.in new file mode 100644 index 000000000..859afb1de --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/config.stamp.in @@ -0,0 +1 @@ +stamp diff --git a/tags/ONYX_4_3_1/devroot/config.sub b/tags/ONYX_4_3_1/devroot/config.sub new file mode 100755 index 000000000..838237e98 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/config.sub @@ -0,0 +1,1412 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-14' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | stormy16 | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/tags/ONYX_4_3_1/devroot/configure.in b/tags/ONYX_4_3_1/devroot/configure.in new file mode 100644 index 000000000..682e5377e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/configure.in @@ -0,0 +1,996 @@ +dnl +dnl +dnl +dnl +dnl Version: +dnl +dnl Process this file with autoconf to produce a configure script. +AC_INIT(Cookfile.in) + +dnl +dnl Version requirements for external software we depend on. +dnl +PTH_VERSION_MIN=2.0 +PCRE_VERSION_MIN=3.9 +LIBEDIT_VERSION_MIN=2.6 + +srcroot=$srcdir +AC_SUBST(srcroot) +abs_srcroot=`cd "$srcdir"; pwd` +AC_SUBST(abs_srcroot) + +objroot=. +AC_SUBST(objroot) +abs_objroot=`pwd` +AC_SUBST(abs_objroot) + +dnl Munge install path variables, since cook doesn't do sh variables. +if test "x$prefix" = "xNONE" ; then + prefix="/usr/local" +fi +if test "x$exec_prefix" = "xNONE" ; then + exec_prefix=$prefix +fi +PREFIX=$prefix +AC_SUBST(PREFIX) +BINDIR=`eval echo $bindir` +BINDIR=`eval echo $BINDIR` +AC_SUBST(BINDIR) +DATADIR=`eval echo $datadir` +DATADIR=`eval echo $DATADIR` +AC_SUBST(DATADIR) +LIBDIR=`eval echo $libdir` +LIBDIR=`eval echo $LIBDIR` +AC_SUBST(LIBDIR) +INCLUDEDIR=`eval echo $includedir` +INCLUDEDIR=`eval echo $INCLUDEDIR` +AC_SUBST(INCLUDEDIR) +MANDIR=`eval echo $mandir` +MANDIR=`eval echo $MANDIR` +AC_SUBST(MANDIR) + +cfgoutputs="Cookfile Cookfile.inc bin/Cookfile.inc doc/Cookfile.inc" +cfgoutputs="$cfgoutputs lib/Cookfile.inc mod/Cookfile.inc test/Cookfile.inc" +cfghdrs="config.stamp" +bins= +mods= +libs= +docs= + +dnl If CFLAGS isn't defined and using gcc, set CFLAGS to something reasonable. +dnl Otherwise, just prevent autoconf from molesting CFLAGS. +CFLAGS=$CFLAGS +AC_PROG_CC +if test "x$CFLAGS" = "x" ; then + no_CFLAGS="yes" +fi +if test "x$no_CFLAGS" = "xyes" -a "x$GCC" = "xyes" ; then + CFLAGS="-Wall -Wno-uninitialized -pipe -g3" +fi +AC_PROG_CPP + +dnl Check for non-default host C compiler. +AC_ARG_WITH(host-cc, [ --with-host-cc Host-specific C compiler], +if test "x$with_host_cc" = "xno" ; then + HCC="$CC" +else + HCC="$with_host_cc" +fi +, +HCC="$CC" +) +AC_SUBST(HCC) + +dnl Check for non-default target C compiler. +AC_ARG_WITH(target-cc, [ --with-target-cc Target-specific C compiler], +if test "x$with_target_cc" = "xno" ; then + TCC="$CC" +else + TCC="$with_target_cc" +fi +, +TCC="$CC" +) +AC_SUBST(TCC) + +dnl Platform-specific settings. abi and RPATH can probably be determined +dnl programmatically, but doing so is error-prone, which makes it generally +dnl not worth the trouble. +AC_CANONICAL_HOST +case "${host}" in + *-*-darwin*) + CFLAGS="$CFLAGS -fno-common -no-cpp-precomp" + abi="macho" + RPATH="" + ;; + *-*-freebsd*) + abi="elf" + RPATH="-Wl,-rpath," + ;; + *-*-linux*) + abi="elf" + AC_DEFINE(_GNU_SOURCE) + RPATH="-Wl,-rpath," + ;; + *-*-netbsd*) + AC_MSG_CHECKING(ABI) + AC_EGREP_CPP(yes, +[#ifdef __ELF__ + yes +#endif +], + abi="elf", + abi="aout") + AC_MSG_RESULT($abi) + RPATH="-Wl,-rpath," + ;; + *-*-solaris2*) + abi="elf" + RPATH="-Wl,-R," + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + LIBS="$LIBS -lposix4" + ;; + *) + AC_MSG_RESULT(Unsupported operating system: ${host}) + abi="elf" + RPATH="-Wl,-rpath," + ;; +esac +AC_SUBST(abi) +AC_SUBST(RPATH) + +case "${host_cpu}" in + i[[3456]]86) + AC_DEFINE(CW_CPU_IA32) + ;; + powerpc) + AC_DEFINE(CW_CPU_PPC) + ;; + *) + AC_MSG_RESULT(Unsupported CPU "${host_cpu}"; very slow mb_write()) + ;; +esac + +dnl Use threads by default. +AC_ARG_ENABLE(threads, [ --disable-threads Disable threads], +if test "x$enable_threads" = "xyes" ; then + enable_threads="1" +else + enable_threads="0" +fi +, +enable_threads="1" +) +AC_ARG_ENABLE(pth, [ --enable-pth Enable GNU pth], +if test "x$enable_pth" = "xyes" ; then + enable_pth="1" +else + enable_pth="0" +fi +, +enable_pth="0" +) +if test "x$enable_threads" = "x1" ; then + if test "x$enable_pth" = "x0" ; then + dnl Look for Mach threads. + have_mthreads="1" + AC_CHECK_HEADERS(mach/task.h, , have_mthreads="0") + AC_CHECK_FUNCS(mach_thread_self, , have_mthreads="0") + if test "x$have_mthreads" = "x1" ; then + AC_DEFINE(CW_MTHREADS) + fi + + dnl Look for Solaris threads. + have_sthreads="1" + AC_CHECK_HEADERS(thread.h, , have_sthreads="0") + AC_CHECK_LIB(thread, thr_suspend, , have_sthreads="0") + AC_CHECK_LIB(thread, thr_continue, , have_sthreads="0") + if test "x$have_sthreads" = "x1" ; then + LIBS="$LIBS -lthread" + AC_DEFINE(CW_STHREADS) + fi + + dnl Look for pthreads. + AC_CHECK_HEADERS(pthread.h, , enable_threads="0") + AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread", \ + AC_CHECK_LIB(c_r, pthread_create, \ + LIBS="$LIBS -pthread", enable_threads="0")) + if test "x$enable_threads" = "x1" ; then + AC_DEFINE(CW_THREADS) + AC_DEFINE(CW_PTHREADS) + fi + + dnl Look for FreeBSD's non-portable suspend/resume API (libc_r). + have_fthreads="1" + AC_CHECK_FUNCS(pthread_suspend_np, , have_fthreads="0") + AC_CHECK_FUNCS(pthread_resume_np, , have_fthreads="0") + if test "x$have_fthreads" = "x1" ; then + AC_DEFINE(CW_FTHREADS) + fi + else + dnl Look for GNU pth. + if test "x$PTH_PREFIX" = "x" ; then + AC_PATH_PROG(PTH_CONFIG, pth-config, , $PATH) + else + AC_PATH_PROG(PTH_CONFIG, pth-config, , "$PTH_PREFIX/bin") + fi + if test "x$PTH_CONFIG" != "x" ; then + dnl Make sure the version of pth found is sufficient. + AC_MSG_CHECKING(for pth >= $PTH_VERSION_MIN) + PTH_MAJOR=`$PTH_CONFIG --version | awk '{print $3}' | tr . " " | awk '{print $1}'` + PTH_MINOR=`$PTH_CONFIG --version | awk '{print $3}' | tr . " " | awk '{print $2}'` + PTH_MAJOR_MIN=`echo $PTH_VERSION_MIN | tr . " " | awk '{print $1}'` + PTH_MINOR_MIN=`echo $PTH_VERSION_MIN | tr . " " | awk '{print $2}'` + if test $PTH_MAJOR -gt $PTH_MAJOR_MIN \ + -o $PTH_MAJOR -eq $PTH_MAJOR_MIN \ + -a $PTH_MINOR -ge $PTH_MINOR_MIN ; then + AC_MSG_RESULT($PTH_MAJOR.$PTH_MINOR) + PTH_CPPFLAGS=`$PTH_CONFIG --cflags` + PTH_LDFLAGS=`$PTH_CONFIG --all --ldflags` + PTH_LIBS=`$PTH_CONFIG --all --libs` + have_pth="1" + else + AC_MSG_RESULT(no) + have_pth="0" + fi + else + have_pth="0" + fi + if test "x$have_pth" = "x1" ; then + CPPFLAGS="$CPPFLAGS $PTH_CPPFLAGS" + LDFLAGS="$LDFLAGS $PTH_LDFLAGS" + LIBS="$LIBS $PTH_LIBS" + AC_DEFINE(CW_THREADS) + AC_DEFINE(CW_PTH) + else + enable_threads="0" + fi + fi +fi +AC_SUBST(enable_threads) + +dnl Enable real support by default. +AC_ARG_ENABLE(real, [ --disable-real Disable real number support], + +if test "x$enable_real" = "xyes" ; then + enable_real="1" +else + enable_real="0" +fi +, +enable_real="1" +) +AC_SUBST(enable_real) +if test "x$enable_real" = "x1" ; then + AC_DEFINE(CW_REAL) + LIBS="$LIBS -lm" + AC_CHECK_FUNCS(asprintf) +fi + +dnl Support POSIX file operations by default. +AC_ARG_ENABLE(posix-file, [ --disable-posix-file Disable POSIX file support], +if test "x$enable_posix_file" = "xyes" ; then + enable_posix_file="1" +else + enable_posix_file="0" +fi +, +enable_posix_file="1" +) +AC_SUBST(enable_posix_file) +if test "x$enable_posix_file" = "x1" ; then + AC_DEFINE(CW_POSIX_FILE) +fi + +dnl Support POSIX by default. +AC_ARG_ENABLE(posix, [ --disable-posix Disable POSIX support], +if test "x$enable_posix" = "xyes" ; then + enable_posix="1" +else + enable_posix="0" +fi +, +enable_posix="1" +) +dnl posix depends on posix-file. +if test "x$enable_posix_file" = "x0" ; then + enable_posix="0" +fi + +AC_SUBST(enable_posix) +if test "x$enable_posix" = "x1" ; then + AC_DEFINE(CW_POSIX) +fi + +dnl Support sockets by default. +AC_ARG_ENABLE(socket, [ --disable-socket Disable socket support], +if test "x$enable_socket" = "xyes" ; then + enable_socket="1" +else + enable_socket="0" +fi +, +enable_socket="1" +) +dnl Socket support requires POSIX support. +if test "x$enable_posix" = "x0" ; then + enable_socket="0" +fi +AC_SUBST(enable_socket) +if test "x$enable_socket" = "x1" ; then + AC_DEFINE(CW_SOCKET) + AC_CHECK_TYPE(socklen_t, AC_DEFINE(CW_HAVE_SOCKLEN_T), , [ +#include +#include +]) +fi + +dnl Enable inline functions by default. +AC_ARG_ENABLE(inlines, [ --disable-inlines Do not use inline functions], +if test "x$enable_inlines" = "xno" ; then + enable_inlines="0" +else + enable_inlines="1" +fi +, +enable_inlines="1" +) +if test "x$enable_inlines" = "x1" ; then + AC_DEFINE(CW_USE_INLINES) +fi + +dnl Build libonyx by default. +AC_ARG_ENABLE(libonyx, [ --disable-libonyx Do not build libonyx], +if test "x$enable_libonyx" = "xno" ; then + enable_libonyx="0" +else + enable_libonyx="1" +fi +, +enable_libonyx="1" +) +if test "x$enable_libonyx" = "x0" ; then + AC_CHECK_HEADERS(libonyx/libonyx.h, , \ + AC_MSG_ERROR(Cannot find libonyx/libonyx.h)) + AC_CHECK_LIB(onyx, libonyx_init, LIBS="$LIBS", \ + AC_MSG_ERROR(Cannot find libonyx)) +fi + +AC_SUBST(enable_libonyx) +if test "x$enable_libonyx" = "x1" ; then + cfgoutputs="$cfgoutputs lib/libonyx/src/nx.nx lib/libonyx/src/nxo_thread.nx" + cfgoutputs="$cfgoutputs bin/onyx_config/src/onyx_config.nx.in" + AC_DEFINE(CW_USE_LIBONYX) +fi + +dnl Check if modules should be used. +AC_ARG_ENABLE(modules, [ --disable-modules Do not support modules], +if test "x$enable_modules" = "xno" ; then + enable_modules="0" +else + enable_modules="1" +fi +, +enable_modules="1" +) +if test "x$enable_modules" = "x1" ; then + AC_CHECK_FUNCS(dlopen, , \ + AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl", \ + [enable_modules="0" + AC_MSG_RESULT(Modules disabled since dlopen is missing)])) +fi +AC_SUBST(enable_modules) +if test "x$enable_modules" = "x1" ; then + AC_DEFINE(CW_MODULES) +fi + +dnl Build onyx by default. +if echo "" | grep Version >/dev/null ; then + onyx_version=devel +else + onyx_version="" +fi +AC_SUBST(onyx_version) + +AC_ARG_ENABLE(onyx, [ --disable-onyx Do not build onyx], +if test "x$enable_onyx" = "xno" ; then + enable_onyx="0" +else + enable_onyx="1" +fi +, +enable_onyx="1" +) +if test "x$enable_onyx" = "x0" ; then + AC_PATH_PROG(ONYX, onyx-$onyx_version, , $PATH) + if test "x$ONYX" = "x" ; then + AC_MSG_ERROR(Cannot find onyx-$onyx_version) + fi + TONYX="$ONYX" +else + ONYX="$BINDIR/onyx-$onyx_version" + AC_SUBST(ONYX) + TONYX="$abs_objroot/bin/onyx/bin/tonyx" +fi +AC_SUBST(TONYX) + +AC_SUBST(enable_onyx) +if test "x$enable_onyx" = "x1" ; then + cfgoutputs="$cfgoutputs bin/onyx/src/batch.nx bin/onyx/src/interactive.nx" + AC_DEFINE(CW_USE_ONYX) +fi + +dnl Build slate by default. +AC_ARG_ENABLE(slate, [ --disable-slate Do not build slate], +if test "x$enable_slate" = "xno" ; then + enable_slate="0" +else + enable_slate="1" +fi +, +enable_slate="1" +) + +if echo "" | grep Version >/dev/null ; then + slate_version=devel +else + slate_version="" +fi +AC_SUBST(slate_version) + +dnl Disable rules that do automatic regeneration of configure output by default. +AC_ARG_ENABLE(autogen, [ --enable-autogen Automatically regenerate configure output], +if test "x$enable_autogen" = "xno" ; then + enable_autogen="0" +else + enable_autogen="1" +fi +, +enable_autogen="0" +) +AC_SUBST(enable_autogen) + +dnl Do not compile with debugging by default. +AC_ARG_ENABLE(debug, [ --enable-debug Build debugging code], +if test "x$enable_debug" = "xno" ; then + enable_debug="0" +else + enable_debug="1" +fi +, +enable_debug="0" +) +if test "x$enable_debug" = "x1" ; then + AC_DEFINE(CW_DBG) + AC_DEFINE(CW_ASSERT) +fi + +dnl Only optimize if not debugging. +if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then + CFLAGS="$CFLAGS -O" +fi + +dnl Look for libraries. +if test "x$enable_onyx" = "x1" ; then + CW_BUILD_LIB(libonyx, lib_onyx) +fi + +dnl Look for modules. +if test "x$enable_modules" = "x1" ; then + dnl modprompt. + if test "x$enable_posix" = "x1" ; then + AC_ARG_WITH(libedit-prefix, [ --with-libedit-prefix Prefix for libedit], + if test "x$with_libedit_prefix" = "xno" ; then + LIBEDIT_PREFIX= + else + LIBEDIT_PREFIX="$with_libedit_prefix" + fi + , + LIBEDIT_PREFIX= + ) + if test "x$LIBEDIT_PREFIX" != "x" ; then + LIBEDIT_CPPFLAGS="-I$LIBEDIT_PREFIX/include" + LIBEDIT_LDFLAGS="-L$LIBEDIT_PREFIX/lib" + else + LIBEDIT_CPPFLAGS= + LIBEDIT_LDFLAGS= + fi + AC_SUBST(LIBEDIT_PREFIX) + AC_SUBST(LIBEDIT_LDFLAGS) + AC_SUBST(LIBEDIT_CPPFLAGS) + + AC_ARG_ENABLE(modprompt, [ --disable-modprompt Do not use modprompt], + if test "x$enable_modprompt" = "xno" ; then + enable_modprompt="0" + else + enable_modprompt="1" + fi + , + enable_modprompt="1" + ) + if test "x$enable_modprompt" = "x1" ; then + MODPROMPT_CPPFLAGS= + + TEMP_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$LIBEDIT_CPPFLAGS $CPPFLAGS" + AC_CHECK_HEADERS(histedit.h, , enable_modprompt="0") + dnl Check if this version of libedit is known to be compatible. + LIBEDIT_MAJOR_MIN=`echo $LIBEDIT_VERSION_MIN | tr . " " | awk '{print $1}'` + LIBEDIT_MINOR_MIN=`echo $LIBEDIT_VERSION_MIN | tr . " " | awk '{print $2}'` + AC_MSG_CHECKING(for libedit >= $LIBEDIT_MAJOR_MIN.$LIBEDIT_MINOR_MIN) + AC_EGREP_CPP(bad_libedit, +[#include +#if (defined(LIBEDIT_MAJOR) && defined(LIBEDIT_MINOR)) +#if (LIBEDIT_MAJOR > $LIBEDIT_MAJOR_MIN || LIBEDIT_MAJOR == $LIBEDIT_MAJOR_MIN && LIBEDIT_MINOR >= $LIBEDIT_MINOR_MIN) + good_libedit +#else + bad_libedit +#endif +#else + unknown_libedit +#endif +], [enable_modprompt="0" ; AC_MSG_RESULT(Obsolete libedit found)], \ + AC_EGREP_CPP(unknown_libedit, +[#include +#if (defined(LIBEDIT_MAJOR) && defined(LIBEDIT_MINOR)) +#if (LIBEDIT_MAJOR > $LIBEDIT_MAJOR_MIN || LIBEDIT_MAJOR == $LIBEDIT_MAJOR_MIN && LIBEDIT_MINOR >= $LIBEDIT_MINOR_MIN) + good_libedit +#else + bad_libedit +#endif +#else + unknown_libedit +#endif +], AC_MSG_RESULT(Unknown libedit; modprompt build may fail), \ + AC_MSG_RESULT(yes))) + CPPFLAGS="$TEMP_CPPFLAGS" + + TEMP_LIBS="$LIBS" + LIBS="$LIBEDIT_LDFLAGS $LIBS" + AC_CHECK_LIB(termcap, tgetent, MODPROMPT_LDFLAGS="-ltermcap", \ + AC_CHECK_LIB(tinfo, tgetent, MODPROMPT_LDFLAGS="-ltinfo", \ + AC_CHECK_LIB(curses, tgetent, MODPROMPT_LDFLAGS="-lcurses", \ + AC_CHECK_LIB(ncurses, tgetent, MODPROMPT_LDFLAGS="-lncurses"))), \ + enable_modprompt="0") + LIBS="$LIBS $MODPROMPT_LDFLAGS" + AC_CHECK_LIB(edit, el_init, \ + MODPROMPT_LDFLAGS="$MODPROMPT_LDFLAGS -ledit", enable_modprompt="0") + LIBS="$TEMP_LIBS" + AC_SUBST(MODPROMPT_CPPFLAGS) + AC_SUBST(MODPROMPT_LDFLAGS) + if test "x$enable_modprompt" = "x1" ; then + CW_BUILD_MOD(modprompt, enable_modprompt) + fi + fi + if test "x$enable_modprompt" = "x1" ; then + AC_DEFINE(CW_USE_MODPROMPT) + fi + else + enable_modprompt="0" + fi + if test "x$enable_modprompt" = "x0" ; then + AC_MSG_RESULT(Missing features or configuration options necessary for modprompt) + fi + + dnl modpane. + if test "x$enable_threads" = "x1" -a "x$enable_posix" = "x1" \ + -a "x$enable_posix_file" = "x1" -a "x$enable_modules" = "x1" ; then + enable_modpane="1" + + dnl Set up CPPFLAGS and LDFLAGS before doing header and library tests. + TEMP_CPPFLAGS="$CPPFLAGS" + TEMP_LDFLAGS="$LDFLAGS" + if test "x$MODPANE_CPPFLAGS" = "x" ; then + MODPANE_CPPFLAGS= + else + CPPFLAGS="$MODPANE_CPPFLAGS $CPPFLAGS" + fi + if test "x$MODPANE_LDFLAGS" = "x" ; then + MODPANE_LDFLAGS= + else + LDFLAGS="$MODPANE_LDFLAGS $LDFLAGS" + fi + + dnl Check for pty-related functionality. + AC_CHECK_HEADERS(termios.h, , enable_modpane="0") + AC_CHECK_FUNCS(tcgetattr, , enable_modpane="0") + AC_CHECK_FUNCS(cfmakeraw, , enable_modpane="0") + AC_CHECK_FUNCS(tcsetattr, , enable_modpane="0") + + dnl Check if modpane is in the source tree. + if test "x$enable_modpane" = "x1" ; then + CW_BUILD_MOD(modpane, enable_modpane) + fi + if test "x$enable_modpane" = "x1" ; then + AC_DEFINE(CW_USE_MODPANE) + AC_SUBST(MODPANE_CPPFLAGS) + AC_SUBST(MODPANE_LDFLAGS) + fi + + dnl Restore CPPFLAGS and LDFLAGS. + CPPFLAGS="$TEMP_CPPFLAGS" + LDFLAGS="$TEMP_LDFLAGS" + else + enable_modpane="0" + fi + if test "x$enable_modpane" = "x0" ; then + AC_MSG_RESULT(Missing features or configuration options necessary for modpane) + fi + + dnl modslate + if test "x$enable_slate" = "x1" -a "x$enable_threads" = "x1" \ + -a "x$enable_real" = "x1" -a "x$enable_posix" = "x1" \ + -a "x$enable_posix_file" = "x1" -a "x$enable_modules" = "x1" \ + -a "x$enable_modpane" = "x1" ; then + dnl Set up CPPFLAGS and LDFLAGS before doing header and library tests. + TEMP_CPPFLAGS="$CPPFLAGS" + TEMP_LDFLAGS="$LDFLAGS" + if test "x$MODSLATE_CPPFLAGS" = "x" ; then + MODSLATE_CPPFLAGS= + else + CPPFLAGS="$MODSLATE_CPPFLAGS $CPPFLAGS" + fi + if test "x$MODSLATE_LDFLAGS" = "x" ; then + MODSLATE_LDFLAGS= + else + LDFLAGS="$MODSLATE_LDFLAGS $LDFLAGS" + fi + + dnl Check for functionality needed by modslate. + dnl ... + + if test "x$enable_slate" = "x1" ; then + dnl Check if slate is in the source tree. + CW_BUILD_MOD(modslate, enable_slate) + fi + if test "x$enable_slate" = "x1" ; then + cfgoutputs="$cfgoutputs bin/slate/src/slate.nx.in" + AC_DEFINE(CW_USE_SLATE) + AC_SUBST(MODSLATE_CPPFLAGS) + AC_SUBST(MODSLATE_LDFLAGS) + fi + + dnl Restore CPPFLAGS and LDFLAGS. + CPPFLAGS="$TEMP_CPPFLAGS" + LDFLAGS="$TEMP_LDFLAGS" + else + enable_slate="0" + fi + if test "x$enable_slate" = "x0" ; then + AC_MSG_RESULT(Missing features or configuration options necessary for slate) + fi +else + AC_MSG_RESULT(Modules disabled; not doing module configuration) + enable_modprompt="0" + enable_modpane="0" + enable_slate="0" +fi +AC_SUBST(enable_modprompt) +AC_SUBST(enable_modpane) +AC_SUBST(enable_slate) + +dnl Look for binaries. +if test "x$enable_onyx" = "x1" ; then + CW_BUILD_BIN(onyx, bin_onyx) + CW_BUILD_BIN(onyx_config, bin_onyx_config) +fi +if test "x$enable_slate" = "x1" ; then + CW_BUILD_BIN(slate, bin_slate) +fi + +AC_SUBST(bins) +AC_SUBST(mods) +AC_SUBST(libs) +AC_SUBST(docs) + +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_PATH_PROG(AR, ar, , $PATH) +AC_PATH_PROG(LD, ld, , $PATH) +AC_PATH_PROG(PERL, perl, , $PATH) +AC_PATH_PROG(ACLOCAL, aclocal, , $PATH) +AC_PATH_PROG(AUTOCONF, autoconf, , $PATH) +AC_PATH_PROG(AUTOHEADER, autoheader, , $PATH) + +dnl Do not build documentaion by default; instead use the prebuilt +dnl documentation. +AC_ARG_WITH(docs, [ --with-docs Build documentation], +if test "x$with_docs" = "xno" ; then + with_docs="0" +else + with_docs="1" +fi +, +with_docs="0" +) +if test "x$with_docs" = "x1" ; then + AC_PATH_PROG(LATEX, latex, , $PATH) + AC_PATH_PROG(PDFLATEX, pdflatex, , $PATH) + AC_PATH_PROG(DVIPS, dvips, , $PATH) + AC_PATH_PROG(FIG2DEV, fig2dev, , $PATH) + AC_PATH_PROG(LATEX2HTML, latex2html, , $PATH) + AC_PATH_PROG(MAKEINDEX, makeindex, , $PATH) + + if test "x$LATEX" = "x" -o "x$PDFLATEX" = "x" -o "x$DVIPS" = "x" \ + -o "x$FIG2DEV" = "x" -o "x$LATEX2HTML" = "x" -o "x$MAKEINDEX" = "x" ; then + AC_MSG_ERROR(Missing one or more programs necessary for documentation build) + fi +fi +AC_SUBST(with_docs) +dnl Include rules for building/installing documents, if the docs are included. +dnl These tests are orthogonal to the tests above. +CW_BUILD_DOC(onyx, doc_onyx) +CW_BUILD_DOC(slate, doc_slate) + +VERIFY="$objroot/test/verify" +AC_SUBST(VERIFY) + +dnl Find libraries. +dnl Check for pcre. +AC_ARG_WITH(pcre-prefix, [ --with-pcre-prefix Prefix for pcre], +if test "x$with_pcre_prefix" = "xno" ; then + PCRE_PREFIX= +else + PCRE_PREFIX="$with_pcre_prefix" +fi +, +PCRE_PREFIX= +) +AC_SUBST(PCRE_PREFIX) + +if test "x$PCRE_PREFIX" = "x" ; then + AC_PATH_PROG(PCRE_CONFIG, pcre-config, , $PATH) +else + AC_PATH_PROG(PCRE_CONFIG, pcre-config, , "$PCRE_PREFIX/bin") +fi +if test "x$PCRE_CONFIG" != "x" ; then + dnl Make sure the version of pcre found is sufficient. + AC_MSG_CHECKING(for pcre >= $PCRE_VERSION_MIN) + PCRE_MAJOR=`$PCRE_CONFIG --version | tr . " " | awk '{print $1}'` + PCRE_MINOR=`$PCRE_CONFIG --version | tr . " " | awk '{print $2}'` + PCRE_MAJOR_MIN=`echo $PCRE_VERSION_MIN | tr . " " | awk '{print $1}'` + PCRE_MINOR_MIN=`echo $PCRE_VERSION_MIN | tr . " " | awk '{print $2}'` + if test $PCRE_MAJOR -gt $PCRE_MAJOR_MIN \ + -o $PCRE_MAJOR -eq $PCRE_MAJOR_MIN \ + -a $PCRE_MINOR -ge $PCRE_MINOR_MIN ; then + AC_MSG_RESULT($PCRE_MAJOR.$PCRE_MINOR) + PCRE_CPPFLAGS=`$PCRE_CONFIG --cflags` + PCRE_LDFLAGS=`$PCRE_CONFIG --libs | tr " " "\n" | grep "^\-L"` + PCRE_LIBS=`$PCRE_CONFIG --libs | tr " " "\n" | grep "^\-l"` + have_pcre="1" + else + AC_MSG_RESULT(no) + have_pcre="0" + fi +else + have_pcre="0" +fi + +dnl Define preprocessor macros. + +dnl Check for header files. +if test "x$enable_posix_file" = "x1" ; then + dnl Make sure that poll() and/or select() is available. + can_poll="0" + AC_CHECK_FUNCS(poll select, can_poll="1") + if test "x$can_poll" = "x0" ; then + AC_MSG_ERROR(Cannot build without poll() or select()) + fi + + AC_CHECK_FUNCS(readdir_r) +fi +if test "x$enable_posix" = "x1" ; then + AC_CHECK_HEADERS(unistd.h, , AC_MSG_ERROR(Cannot build without unistd.h)) +fi + +dnl Check for typedefs, structures, and compiler characteristics. +AC_C_BIGENDIAN + +dnl +dnl libonyx configuration. +dnl +if test "x$lib_onyx" = "x1" ; then + AC_CHECK_SIZEOF(signed char, 1) + AC_CHECK_SIZEOF(unsigned char, 1) + AC_CHECK_SIZEOF(signed short, 2) + AC_CHECK_SIZEOF(unsigned short, 2) + AC_CHECK_SIZEOF(int, 4) dnl defines SIZEOF_INT + AC_CHECK_SIZEOF(unsigned, 4) + AC_CHECK_SIZEOF(long, 4) + AC_CHECK_SIZEOF(unsigned long, 4) + AC_CHECK_SIZEOF(long long, 4) + AC_CHECK_SIZEOF(unsigned long long, 4) + AC_CHECK_SIZEOF(int *, 4) dnl defines SIZEOF_INT_P + AC_CHECK_SIZEOF(float, 4) + AC_CHECK_SIZEOF(double, 8) + AC_CHECK_SIZEOF(long double, 12) + + AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h machine/endian.h) + + if test "x$enable_posix" = "x1" ; then + rpath_post="\`$DATADIR/onyx-$onyx_version/nx'" + mpath_post="\`$DATADIR/onyx-$onyx_version/nxm'" + AC_SUBST(rpath_post) + AC_SUBST(mpath_post) + + dnl Try to figure out which field of struct dirent contains the entry string + dnl length. + AC_MSG_CHECKING(for (struct dirent).d_namlen) + AC_TRY_LINK([ +#include +#include +], [ + struct dirent ent; + + ent.d_namlen = 0; +], AC_MSG_RESULT(yes) + AC_DEFINE(CW_HAVE_DIRENT_NAMLEN), + AC_MSG_RESULT(no)) + + dnl Look for nanosecond resolution of atime in struct stat. + AC_MSG_CHECKING(for (struct stat).st_atimespec) + AC_TRY_LINK([ +#include +#include +], [ + struct stat st; + + st.st_atimespec.tv_nsec = 0; +], AC_MSG_RESULT(yes) + AC_DEFINE(CW_LIBONYX_USE_STAT_ATIMESPEC), + AC_MSG_RESULT(no)) + + dnl Look for nanosecond resolution of mtime in struct stat. + AC_MSG_CHECKING(for (struct stat).st_mtimespec) + AC_TRY_LINK([ +#include +#include +], [ + struct stat st; + + st.st_mtimespec.tv_nsec = 0; +], AC_MSG_RESULT(yes) + AC_DEFINE(CW_LIBONYX_USE_STAT_MTIMESPEC), + AC_MSG_RESULT(no)) + + dnl Look for nanosecond resolution of ctime in struct stat. + AC_MSG_CHECKING(for (struct stat).st_ctimespec) + AC_TRY_LINK([ +#include +#include +], [ + struct stat st; + + st.st_ctimespec.tv_nsec = 0; +], AC_MSG_RESULT(yes) + AC_DEFINE(CW_LIBONYX_USE_STAT_CTIMESPEC), + AC_MSG_RESULT(no)) + + AC_CHECK_FUNCS(unsetenv) + fi + + dnl Enable regular expression support by default. + AC_ARG_ENABLE(regex, [ --disable-regex Disable regular expression support], + + if test "x$enable_regex" = "xyes" ; then + enable_regex="1" + else + enable_regex="0" + fi + , + enable_regex="1" + ) + if test "x$have_pcre" = "x0" ; then + enable_regex="0" + fi + AC_SUBST(enable_regex) + if test "x$enable_regex" = "x1" ; then + CPPFLAGS="$CPPFLAGS $PCRE_CPPFLAGS" + LDFLAGS="$LDFLAGS $PCRE_LDFLAGS" + LIBS="$LIBS $PCRE_LIBS" + AC_DEFINE(CW_REGEX) + fi +fi + +dnl +dnl onyx configuration. +dnl +if test "x$bin_onyx" = "x1" ; then + AC_DEFINE_UNQUOTED(CW_TONYX_ONYX, "$abs_objroot/bin/onyx/bin/onyx") + + tmpath=ONYX_MPATH= + trpath=ONYX_RPATH= + for i in $mods ; do + tmpath=$tmpath:$abs_objroot/mod/$i/nxm + trpath=$trpath:$abs_objroot/mod/$i/nx + done + dnl Remove leading ':'. + tmpath=`echo $tmpath | sed s/://` + trpath=`echo $trpath | sed s/://` + AC_DEFINE_UNQUOTED(CW_TONYX_MPATH, "$tmpath") + AC_DEFINE_UNQUOTED(CW_TONYX_RPATH, "$trpath") +fi + +dnl +dnl slate configuration. +dnl +if test "x$bin_slate" = "x1" ; then + AC_DEFINE_UNQUOTED(CW_TSLATE_SLATE, "$abs_objroot/bin/slate/bin/slate") + + slate_rpath_post="\`$DATADIR/slate-$slate_version/nx'" + slate_mpath_post="\`$DATADIR/slate-$slate_version/nxm'" + AC_SUBST(slate_rpath_post) + AC_SUBST(slate_mpath_post) + + tmpath=SLATE_MPATH= + trpath=SLATE_RPATH= + for i in $mods ; do + tmpath=$tmpath:$abs_objroot/mod/$i/nxm + trpath=$trpath:$abs_objroot/mod/$i/nx + done + dnl Remove leading ':'. + tmpath=`echo $tmpath | sed s/://` + trpath=`echo $trpath | sed s/://` + AC_DEFINE_UNQUOTED(CW_TSLATE_MPATH, "$tmpath") + AC_DEFINE_UNQUOTED(CW_TSLATE_RPATH, "$trpath") +fi + +dnl Process .in files. +AC_SUBST(cfghdrs) +AC_CONFIG_HEADER($cfghdrs) + +dnl verify is handled separately, since it must be executable. +AC_CONFIG_FILES($cfgoutputs, chmod +x $objroot/test/verify) +AC_CONFIG_FILES(test/verify, chmod +x test/verify) +cfgoutputs="$cfgoutputs test/verify" +AC_SUBST(cfgoutputs) +AC_OUTPUT + +dnl +dnl Print out the results of configuration. +dnl +AC_MSG_RESULT(===============================================================================) +if test "x$bin_onyx" = "x1" ; then +AC_MSG_RESULT(Onyx version : $onyx_version) +fi +if test "x$bin_slate" = "x1" ; then +AC_MSG_RESULT(Slate version : $slate_version) +fi +AC_MSG_RESULT() +AC_MSG_RESULT(HCC : ${HCC}) +AC_MSG_RESULT(TCC : ${TCC}) +AC_MSG_RESULT(CFLAGS : ${CFLAGS}) +AC_MSG_RESULT(CPPFLAGS : ${CPPFLAGS}) +AC_MSG_RESULT(LDFLAGS : ${LDFLAGS}) +AC_MSG_RESULT(LIBS : ${LIBS}) +AC_MSG_RESULT() +AC_MSG_RESULT(PREFIX : ${PREFIX}) +AC_MSG_RESULT(BINDIR : ${BINDIR}) +AC_MSG_RESULT(DATADIR : ${DATADIR}) +AC_MSG_RESULT(LIBDIR : ${LIBDIR}) +AC_MSG_RESULT(INCLUDEDIR : ${INCLUDEDIR}) +AC_MSG_RESULT(MANDIR : ${MANDIR}) +AC_MSG_RESULT() +AC_MSG_RESULT(srcroot : ${srcroot}) +AC_MSG_RESULT(abs_srcroot : ${abs_srcroot}) +AC_MSG_RESULT(objroot : ${objroot}) +AC_MSG_RESULT(abs_objroot : ${abs_objroot}) +AC_MSG_RESULT() +AC_MSG_RESULT(libs :${libs}) +AC_MSG_RESULT(mods :${mods}) +AC_MSG_RESULT(bins :${bins}) +AC_MSG_RESULT(docs :${docs}) +AC_MSG_RESULT() +AC_MSG_RESULT(threads : ${enable_threads}) +AC_MSG_RESULT(real : ${enable_real}) +AC_MSG_RESULT(regex : ${enable_regex}) +AC_MSG_RESULT(posix : ${enable_posix}) +AC_MSG_RESULT(posix-file : ${enable_posix_file}) +AC_MSG_RESULT(socket : ${enable_socket}) +AC_MSG_RESULT(inlines : ${enable_inlines}) +AC_MSG_RESULT(libonyx : ${enable_libonyx}) +AC_MSG_RESULT(modules : ${enable_modules}) +AC_MSG_RESULT(autogen : ${enable_autogen}) +AC_MSG_RESULT(debug : ${enable_debug}) +AC_MSG_RESULT(docs : ${with_docs}) +AC_MSG_RESULT(===============================================================================) diff --git a/tags/ONYX_4_3_1/devroot/doc/.cvsignore b/tags/ONYX_4_3_1/devroot/doc/.cvsignore new file mode 100644 index 000000000..f925def9a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/.cvsignore @@ -0,0 +1,4 @@ +ps +pdf +html +Cookfile.inc diff --git a/tags/ONYX_4_3_1/devroot/doc/Cookfile b/tags/ONYX_4_3_1/devroot/doc/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/doc/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/doc/Cookfile.inc.in new file mode 100644 index 000000000..146c0528c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/Cookfile.inc.in @@ -0,0 +1,131 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Top level Cookfile for documentation. Documentation is only rebuilt if the + * --with-docs option is specified. + * + ******************************************************************************/ + +#include-cooked [fromto % @objroot@/doc/latex/%/Cookfile.inc @docs@] + +/* + * Targets. + */ +docs_ps : [addsuffix _docs_ps @docs@]; +docs_pdf : [addsuffix _docs_pdf @docs@]; +docs_html : [addsuffix _docs_html @docs@]; +docs : docs_ps docs_pdf docs_html; + +docs_install_ps : [addsuffix _docs_install_ps @docs@]; +docs_install_pdf : [addsuffix _docs_install_pdf @docs@]; +docs_install_html : [addsuffix _docs_install_html @docs@]; +docs_install : docs_install_ps docs_install_pdf docs_install_html; + +docs_uninstall : [addsuffix _docs_uninstall @docs@]; + +docs_clean : [addsuffix _docs_clean @docs@]; + +docs_relclean : [addsuffix _docs_relclean @docs@] +{ + rm -rf @objroot@/doc/html; + rm -rf @objroot@/doc/pdf; + rm -rf @objroot@/doc/ps; +} + +/* + * Build rules. + */ +@objroot@/%0%.ps : @srcroot@/%0%.fig + set mkdir +{ + @FIG2DEV@ -L ps @srcroot@/%0%.fig @objroot@/%0%.ps; +} + +@objroot@/%0ps/%1/%.ps : @objroot@/%0latex/%1/%.tex + set mkdir +{ + /* + * Clean up the temp files to keep {pdf}latex from stumbling over the output + * of each other. + * + * Change directory to the object tree, since latex can't be made to use a + * different location for output files. + */ + + rm -f [addprefix @objroot@/%0latex/%1/%. + alg aux aux-prev idx idx-prev ilg ind lof log lot out toc]; + rm -f @objroot@/%0latex/%1/texput.log; + + cd @objroot@/%0latex/%1/\; @PERL@ @abs_srcroot@/%0latex/ltx2e @LATEX@ %.tex; + cd @objroot@/%0latex/%1/\; @MAKEINDEX@ -c -l + -s @abs_srcroot@/%0latex/%1/%.mst + %.idx; + cd @objroot@/%0latex/%1/\; @PERL@ @abs_srcroot@/%0latex/ltx2e @LATEX@ %.tex; + @DVIPS@ @objroot@/%0latex/%1/%.dvi -o @objroot@/%0ps/%1/%.ps; +} + +@objroot@/%0pdf/%1/%.pdf : @objroot@/%0latex/%1/%.tex + set mkdir +{ + /* + * Clean up the temp files to keep {pdf}latex from stumbling over the output + * of each other. + * + * Change directory to the object tree, since latex can't be made to use a + * different location for output files. + */ + + rm -f [addprefix @objroot@/%0latex/%1/%. + alg aux aux-prev idx idx-prev ilg ind lof log lot out toc]; + rm -f @objroot@/%0latex/%1/texput.log; + + cd @objroot@/%0latex/%1/\; @PERL@ @abs_srcroot@/%0latex/ltx2e @PDFLATEX@ + %.tex; + cd @objroot@/%0latex/%1/\; @MAKEINDEX@ -c -l + -s @abs_srcroot@/%0latex/%1/%.mst + %.idx; + cd @objroot@/%0latex/%1/\; @PERL@ @abs_srcroot@/%0latex/ltx2e @PDFLATEX@ + %.tex; + cp @objroot@/%0latex/%1/%.pdf @objroot@/%0pdf/%1/%.pdf; +} + +@objroot@/%0html/%1/%.html : @objroot@/%0latex/%1/%.tex + set mkdir +{ + @LATEX2HTML@ -init_file @srcroot@/%0latex/%1/.latex2html-init + -dir @abs_objroot@/%0html/%1 -split 5 -toc_depth 4 -show_section_numbers + -footnode -noinfo -auto_link -transparent -image_type png -local_icons + @abs_objroot@/%0latex/%1/%.tex; + /* + * Fix up [, ], and \ characters. + * Get rid of spurious <> at the end of tables. + */ + [SHELL] -e; +data + for i in `find @objroot@/%0html/%1/ -type f |grep "\.html$"` ; do + echo "Fix up $i" + mv $i $i.tmp + cat $i.tmp | sed -e s/YYYbsZZZ/\\\\\\\\/g \\ + | sed -e s/YYYlbZZZ/\[/g \\ + | sed -e s/YYYrbZZZ/\]/g \\ + | sed -e \\ + "s/^\\\\\\(\\\\\\<\\\\/TABLE\\\\\\>\\\\\\)\\\\\\<\\\\\\>/\\\\1/g" \\ + > $i + rm $i.tmp + done +dataend + + /* + * Clean up temp files so that they won't get installed. + */ + rm -f @objroot@/%0html/%1/WARNINGS; + rm -f [addprefix @objroot@/%0html/%1/images. aux idx log pl tex]; + rm -f @objroot@/%0html/%1/internals.pl; + rm -f @objroot@/%0html/%1/labels.pl; +} diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/.cvsignore b/tags/ONYX_4_3_1/devroot/doc/latex/.cvsignore new file mode 100644 index 000000000..d8f1e52b1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/.cvsignore @@ -0,0 +1 @@ +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/Cookfile b/tags/ONYX_4_3_1/devroot/doc/latex/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/ltx2e b/tags/ONYX_4_3_1/devroot/doc/latex/ltx2e new file mode 100755 index 000000000..5e8a50557 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/ltx2e @@ -0,0 +1,222 @@ +#!/usr/bin/perl -w +#-*-mode:perl-*- + +$Pgm = $0; $Pgm =~ s/.*\/([^\/]+)$/\1/; +# +$Verbose = 0; +if ($ARGV[0] eq '-v') { + $Verbose = 1; + shift(@ARGV); +} +# +$latex = $ARGV[0]; +shift(@ARGV); +# +die "$Pgm: must have exactly two arguments\n" if $#ARGV != 0; +# figure out input file and its filename root +if (-f $ARGV[0]) { + $TeX_input = $ARGV[0]; + if ($TeX_input =~ /(.+)\.[^\.\/\n]+$/) { + $TeX_root = $1; + } else { + $TeX_root = $TeX_input; + } +} elsif (-f $ARGV[0].'.tex') { + $TeX_input = $ARGV[0].'.tex'; + $TeX_root = $ARGV[0]; +} else { + die "$Pgm: input file $ARGV[0] doesn't exist\n"; +} + +sub rm_temp_files { + system("rm -f /tmp/ltx-*.$$"); +} +sub rm_temp_files_and_exit { + system("rm -f /tmp/ltx-*.$$"); + exit(1); +} +$SIG{'INT'} = 'rm_temp_files_and_exit'; +$SIG{'QUIT'} = 'rm_temp_files_and_exit'; + +sub die_gracefully { + local($msg) = @_; + + print STDERR $msg; + &rm_temp_files_and_exit(); +} + +# must read through root file to see if a \bibliography +# is there... +$Bibliography_requested = 0; +open(TEXIF, "<$TeX_input") + || &die_gracefully("$Pgm: Can't read $TeX_input\n"); +while () { + $Bibliography_requested = 1 if /^\\bibliography/; +} +close(TEXIF); +&die_gracefully("$Pgm: reading $TeX_input had errors\n") if $? >> 8; + +# run latex first time (?) +&run_latex(); # sets $Says_labels_changed +$Times_run = 1; + +while (&something_more_needed()) { + + print STDERR "labels_changed=$Says_label_changed;bibtex_needed=$BibTeX_run_needed;makeindex_needed=$MakeIndex_run_needed\n" if $Verbose; + + if ($BibTeX_run_needed) { + &run_bibtex(); + } + if ($MakeIndex_run_needed) { + unlink "$TeX_root.ind"; + (system("makeindex $TeX_root.idx") >> 8) + && &die_gracefully("$Pgm: makeindex $TeX_root.idx had errors\n"); + } + + # save (copy) .aux file as .aux-prev file for future ref + # ditto for .idx file + unlink "$TeX_root.aux-prev"; + (system("cp $TeX_root.aux $TeX_root.aux-prev") >> 8) + && &die_gracefully("$Pgm: cp $TeX_root.aux $TeX_root.aux-prev failed\n"); + if (-f "$TeX_root.idx") { + unlink "$TeX_root.idx-prev"; + (system("cp $TeX_root.idx $TeX_root.idx-prev") >> 8) + && &die_gracefully("$Pgm: cp $TeX_root.idx $TeX_root.idx-prev failed\n"); + } + + # run latex again + &run_latex(); # sets $Says_labels_changed + $Times_run++; + + if ($Times_run >= 4) { + print STDERR "*** I don't run LaTeX more than four times;\n"; + print STDERR "*** Something is probably wrong...\n"; + &rm_temp_files_and_exit(); + } +} +&rm_temp_files(); +exit(0); + +sub run_latex { + $Says_labels_changed = 0; + $Multiply_defined_labels = 0; + $Changebar_changed = 0; + $NO_file = 0; + + select(STDERR); $| = 1; select(STDOUT); # no buffering on STDERR + print STDERR "$Pgm: *** running LaTeX...\n" if $Verbose; + unlink "$TeX_root.dvi"; + + open(LTXPIPE, "$latex $TeX_input 2>&1 |") + || &die_gracefully("$Pgm: Can't run latex pipe\n"); + while () { + $Multiply_defined_labels = 1 if /^LaTeX Warning: Label .* multiply defined/; + $Says_labels_changed = 1 if /^LaTeX Warning: Label\(s\) may have changed/ + && ! $Multiply_defined_labels; + $Changebar_changed = 1 if /^Changebar Warning: Changebar info has changed/; + + $NO_file = 1 if /^No file .*/; + + print STDERR $_; + } + close(LTXPIPE); + &die_gracefully("$Pgm: LaTeX run had errors\n") if $? >> 8; + + # sort .idx file, because this helps makeindex + # (can you say `bug'?) + if (-f "$TeX_root.idx") { + print STDERR "$Pgm: *** sorting $TeX_root.idx...\n" if $Verbose; + (system("sort -o $TeX_root.idx $TeX_root.idx") >> 8) + && &die_gracefully("$Pgm: sorting $TeX_root.idx failed\n"); + } + +} + +sub run_bibtex { # ugly because bibtex doesn't return a correct error status + local($bibtex_had_errors) = 0; + + print STDERR "$Pgm: *** running BibTeX...\n" if $Verbose; + unlink "$TeX_root.bbl"; + + $| = 1; # no buffering + open(BIBTXPIPE, "bibtex $TeX_root 2>&1 |") + || &die_gracefully("$Pgm: Can't run bibtex pipe\n"); + while () { + $bibtex_had_errors = 1 if /^\(There.*error message(s)?\)$/; + print STDERR $_; + } + close(BIBTXPIPE); + &die_gracefully("$Pgm: BibTeX run had errors\n") + if $? >> 8 || $bibtex_had_errors; +} + +sub something_more_needed { + # returns 1 or 0 if we need to run LaTeX + # possibly preceded by bibtex and/or makeindex run + + # $Says_labels_changed was set by previous &run_latex... + $BibTeX_run_needed = 0; + $MakeIndex_run_needed = 0; + + if ( ! -f ($TeX_root . '.aux-prev')) { # this was the first run + + print STDERR "$Pgm: *** 'twas first run of LaTeX on $TeX_input\n" if $Verbose; + + # we need makeindex to run if a non-zero-sized .idx file exists + # + $MakeIndex_run_needed = 1 + if -f "$TeX_root.idx" && -s "$TeX_root.idx"; + + # we need bibtex to run if there are \citations in the .aux file + # + &slurp_aux_file('aux'); + $BibTeX_run_needed = 1 + if $Bibliography_requested && + -f "/tmp/ltx-aux-cite.$$" && + -s "/tmp/ltx-aux-cite.$$"; + + + } else { # ltx had been run before (.aux-prev/.idx-prev files exist) + + # slurp both .aux and .aux-prev files + &slurp_aux_file('aux'); + &slurp_aux_file('aux-prev'); + + local($tmp_pre) = "/tmp/ltx"; + + if ((-s "$tmp_pre-.aux-cite.$$") # there are still \cite's in there + && (system("cmp -s $tmp_pre-.aux-cite.$$ $tmp_pre-.aux-prev-cite.$$") >> 8)) { + $BibTeX_run_needed = 1 if $Bibliography_requested; + if ($Verbose) { + system("diff -c1 $tmp_pre-.aux-prev-cite.$$ $tmp_pre-.aux-cite.$$"); + } + } + + if (-f "$TeX_root.idx") { + $MakeIndex_run_needed = + (system("cmp -s $TeX_root.idx $TeX_root.idx-prev") >> 8) ? 1 : 0; + if ($MakeIndex_run_needed && $Verbose) { + system("diff -c1 $TeX_root.idx-prev $TeX_root.idx"); + } + } + } + + $NO_file || $Changebar_changed || $Says_labels_changed || $BibTeX_run_needed || $MakeIndex_run_needed; +} + +sub slurp_aux_file { + local($ext) = @_; + + # copy all citations from slurpfile into /tmp/ltx-$ext-cite.$$ + + open(SLURPF,"< $TeX_root.$ext") + || &die_gracefully("$Pgm: Can't open $TeX_root.$ext for reading\n"); + open(CITEF,"> /tmp/ltx-$ext-cite.$$") + || &die_gracefully("$Pgm: Can't open /tmp/ltx-$ext-cite.$$ for writing\n"); + + while () { + print CITEF $_ if /\\citation/; + } + close(CITEF); + close(SLURPF); +} diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/.cvsignore b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/.cvsignore new file mode 100644 index 000000000..08b2a279e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/.cvsignore @@ -0,0 +1,16 @@ +Cookfile.inc +Cookfile.list +onyx.aux +onyx.aux-prev +onyx.dvi +onyx.idx +onyx.idx-prev +onyx.ilg +onyx.ind +onyx.lof +onyx.log +onyx.lot +onyx.out +onyx.pdf +onyx.tex +onyx.toc diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/.latex2html-init b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/.latex2html-init new file mode 100644 index 000000000..0267edcc0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/.latex2html-init @@ -0,0 +1,7 @@ +&ignore_commands( <<_IGNORED_CMDS_); +clearemptydoublepage +lhead # [] # {} +rhead # [] # {} +rightmark +_IGNORED_CMDS_ +1; diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/Cookfile b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/Cookfile.inc.in new file mode 100644 index 000000000..1ff28fff7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/Cookfile.inc.in @@ -0,0 +1,120 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Cookfile for Onyx manual. + * + ******************************************************************************/ + +#if @with_docs@ + ONYX_PS = @objroot@/doc/ps/onyx/onyx.ps; + ONYX_PDF = @objroot@/doc/pdf/onyx/onyx.pdf; + ONYX_HTML = @objroot@/doc/html/onyx/onyx.html; +#else + ONYX_PS = @srcroot@/doc/ps/onyx/onyx.ps; + ONYX_PDF = @srcroot@/doc/pdf/onyx/onyx.pdf; + ONYX_HTML = @srcroot@/doc/html/onyx/onyx.html; +#endif + +/* LaTeX source files. */ +ONYX_TEX_SRCS = [addprefix @srcroot@/doc/latex/onyx/ + front.tex back.tex lang.tex tut.tex] + [addprefix @objroot@/doc/latex/onyx/ + onyx.tex] + ; + +/* xfig source files. */ +ONYX_FIG_SRCS = ; +ONYX_FIG_SRCS = [addprefix @srcroot@/doc/latex/onyx/ [ONYX_FIG_SRCS]]; + +/* + * Targets. + */ + +onyx_docs_ps : +#if @with_docs@ + [ONYX_PS] +#endif + ; +onyx_docs_pdf : +#if @with_docs@ + [ONYX_PDF] +#endif + ; +onyx_docs_html : +#if @with_docs@ + [ONYX_HTML] +#endif + ; + +onyx_docs_install_ps : onyx_docs_ps +{ + @INSTALL@ -d [DATADIR]/onyx-@onyx_version@/doc/ps; + @INSTALL@ -m 0444 [ONYX_PS] [DATADIR]/onyx-@onyx_version@/doc/ps; +} + +onyx_docs_install_pdf : onyx_docs_pdf +{ + @INSTALL@ -d [DATADIR]/onyx-@onyx_version@/doc/pdf; + @INSTALL@ -m 0444 [ONYX_PDF] [DATADIR]/onyx-@onyx_version@/doc/pdf; +} + +onyx_docs_install_html : onyx_docs_html +{ + @INSTALL@ -d [DATADIR]/onyx-@onyx_version@/doc/html; + + loop local f = [glob [dirname [ONYX_HTML]]"/*"] + { + @INSTALL@ -m 0444 [f] [DATADIR]/onyx-@onyx_version@/doc/html; + } +} + +onyx_docs_uninstall : +{ + rm -rf [DATADIR]/onyx-@onyx_version@/doc; +} + +onyx_docs_clean : +{ + rm -f [addprefix @objroot@/doc/latex/onyx/onyx. + alg aux aux-prev dvi idx idx-prev ilg ind lof log lot out pdf + toc]; + rm -f @objroot@/doc/latex/onyx/texput.log; +} + +onyx_docs_relclean : +{ + rm -rf @objroot@/doc/html/onyx; + rm -rf @objroot@/doc/pdf/onyx; + rm -rf @objroot@/doc/ps/onyx; +} + +/* + * Dependencies. + */ +@objroot@/%0ps/onyx/%.ps : @objroot@/%0latex/onyx/%.tex [ONYX_TEX_SRCS] + [fromto @srcroot@/%0latex/onyx/%.fig + @objroot@/%0latex/onyx/%.ps + [ONYX_FIG_SRCS]]; + +/* + * This depends on the PostScript version of the manual so that the two rules + * will not run in parallel. This is necessary in order to keep them from + * stomping all over each others' temporory files. + */ +@objroot@/%0pdf/onyx/%.pdf : @objroot@/%0latex/onyx/%.tex + @objroot@/%0ps/onyx/%.ps + [ONYX_TEX_SRCS] + [fromto @srcroot@/%0latex/onyx/%.fig + @objroot@/%0latex/onyx/%.ps + [ONYX_FIG_SRCS]]; + +@objroot@/%0html/onyx/%.html : @objroot@/%0latex/onyx/%.tex [ONYX_TEX_SRCS] + [fromto @srcroot@/%0latex/onyx/%.fig + @objroot@/%0latex/onyx/%.ps + [ONYX_FIG_SRCS]]; diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/back.tex b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/back.tex new file mode 100644 index 000000000..e510e2eba --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/back.tex @@ -0,0 +1,33 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% Back matter of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\clearemptydoublepage +\backmatter +% +% Don't print the chapter number in the header for the index. +% +%begin{latexonly} +\rhead[\bfseries{INDEX}]{\bfseries\thepage} +%end{latexonly} + +\addcontentsline{toc}{chapter}{Index} +\begin{theindex} +% latex2html apparently generates and inserts its own index, so don't actually +% include the index for the html version. +%begin{latexonly} +\printindex +%end{latexonly} +\end{theindex} + +\end{document} diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/front.tex b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/front.tex new file mode 100644 index 000000000..d7d6fb03f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/front.tex @@ -0,0 +1,241 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% Definitions and front matter of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass[10pt,titlepage]{book} +\usepackage[dvips]{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{html} +\usepackage{makeidx} +%begin{latexonly} +\usepackage{newcent} +\usepackage{fancyheadings} +\usepackage{ifthen} +%end{latexonly} + +%begin{latexonly} +% +% Configure margins, line spacing, etc. +% +\setlength{\topmargin}{0in} +%\setlength{\headheight}{36pt} +\setlength{\headheight}{54pt} +\setlength{\headsep}{12pt} +\setlength{\topskip}{0in} +\setlength{\textheight}{8.5in} +\setlength{\oddsidemargin}{0in} +\setlength{\evensidemargin}{0in} +\setlength{\textwidth}{6.5in} +\setlength{\parindent}{0pt} +%\setlength{\parskip}{10pt} +\setlength{\parskip}{8pt} +%\setlength{\topsep}{0pt} +%\setlength{\partopsep}{0pt} +%\renewcommand{\baselinestretch}{1.3} +\renewcommand{\baselinestretch}{1.0} +%end{latexonly} + +% +% Title page setup +% +\title{Onyx Manual, Version } +\author{Jason Evans} +\date{\today} + +% Control what all ends up in the table of contents. +%\addtocounter{secnumdepth}{4} + +%begin{latexonly} +% Use this to make sure chapter breaks look right. +\newcommand{\clearemptydoublepage} + {\newpage \thispagestyle{empty} \cleardoublepage} + +% +% Set up the standard page headers. +% +%\renewcommand{\chaptermark}[1]{\markboth{#1}{}} +%\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} +%\lhead[\bfseries\thepage]{\bfseries\rightmark} +%\rhead[\bfseries{Chapter \thechapter}]{\bfseries\thepage} +%\cfoot{} +%\setlength{\headrulewidth}{2pt} +%\chead[\bfseries{Onyx Manual}]{\bfseries{Jason Evans}} +%end{latexonly} + +%begin{latexonly} +\newenvironment{capilist} + { + \raggedright + \begin{list}{} + { + \listparindent 0pt + \itemindent \listparindent + \item\relax + } + \begin{description} + } + { + \end{description} + \end{list} + \vspace{8pt} + } +%end{latexonly} +\begin{htmlonly} +\newenvironment{capilist} + { + \begin{description} + \begin{description} + } + { + \end{description} + \end{description} + } +\end{htmlonly} + +\newcommand{\citem}[1]{\bfseries #1: \normalfont + +} +\newenvironment{capi} + {\setlength{\parskip}{0pt}} + {\setlength{\parskip}{8pt}} + +\providecommand{\ifthenelse}[3]{ } % For latex2html. +\newcommand{\cfunc}[3][]{#1\ifthenelse{\equal{}{#1}}{}{ }{\em #2}(#3)} +\newcommand{\cvar}[1]{{\em #1}} +\newcommand{\ctype}[1]{#1} +\newcommand{\cppmacro}[3][]{#1\ifthenelse{\equal{}{#1}}{}{ }{\em #2}(#3)} +\newcommand{\cppdef}[1]{{\em #1}} +\newcommand{\binname}[1]{{\em #1}} +\newcommand{\libname}[1]{{\em #1}} +\newcommand{\filename}[1]{{\em #1}} +\newcommand{\classname}[1]{{\em #1}} +\newcommand{\dbgsym}[1]{{``#1''}} +\newcommand{\onyxop}[3]{{\em #1}\ifthenelse{\equal{}{#1}}{}{ }{\bf #2}\ifthenelse{\equal{}{#3}}{}{ }{\em #3}} +\newcommand{\oparg}[1]{{\em #1}} +\newcommand{\commas}{,,,} + +% \optableent{inputs}{operator}{outputs}{description} +\newcommand{\optableent}[4]{\parbox[t]{2.0in}{#1 \\ +\hspace*{0.25in} \parbox[t]{1.75in}{#2} \\ +\hspace*{0.50in} \parbox[t]{1.50in}{#3 \vspace*{2pt}}} & #4 \\ +} + +% For printed versions, we need to limit the width of tables, but for html +% there is no need to. +\newcommand{\optableformat}[1]{|l|p{#1in}|} +\newcommand{\rxtableformat}[1]{|r|p{#1in}|} + +% TeX doesn't have '\', '^', '<', '>', '|', and '~' in its text fonts. +\newcommand{\bs}{$\backslash$} +\newcommand{\carat}{\^{ }} +\newcommand{\lt}{$<$} +\newcommand{\gt}{$>$} +\newcommand{\pipe}{$|$} +\newcommand{\twid}{$\sim$} +\newcommand{\lb}{[} +\newcommand{\rb}{]} + +% The build system does substitution of the YYY..ZZZ strings after the html +% is generated. +\begin{htmlonly} +\newcommand{\optableformat}[1]{|l|l|} +\newcommand{\rxtableformat}[1]{|r|l|} +\newcommand{\bs}{YYYbsZZZ} +\newcommand{\carat}{^} +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\pipe}{|} +\newcommand{\twid}{\~} +\newcommand{\lb}{YYYlbZZZ} +\newcommand{\rb}{YYYrbZZZ} +\end{htmlonly} + +% Generate an index. +\makeindex + +\begin{document} +\frontmatter +\pagestyle{plain} +\maketitle + +\clearemptydoublepage +\begin{htmlonly} +\part*{Preface} +\end{htmlonly} +\begin{latexonly} +\chapter*{Preface} +\end{latexonly} + +This manual primarily documents the Onyx programming language. However, Onyx is +designed to be run either as a stand alone program or as an embeddable +interpreter, so the manual also documents different aspects of the +implementation that are important when embedding Onyx into another program. + +Onyx came in to existence when the author started working on a text editor named +slate (still in development) that was meant to be extensible, much in the same +way as \htmladdnormallink{GNU +emacs}{http://www.gnu.org/software/emacs/emacs.html}, +\htmladdnormallink{JED}{http://space.mit.edu/~davis/jed/}, and +\htmladdnormallink{Jade}{http://www.dcs.warwick.ac.uk/~john/sw/jade/}. One of +the goals was to provide robust multi-threading in slate in order to make it +simple to avoid the long pauses that afflict, for example, users of the +\htmladdnormallink{gnus}{http://www.gnus.org/} news/mail reader, which is part +of emacs. Unfortunately, when work began on slate in 1999, the author was +unable to find any embeddable scripting languages that provided adequate support +for threads. Thus Onyx was born. The author was familiar and enamored with +Adobe's PostScript$_{TM}$ language, which has basic threading support when used +in a Display PostScript$_{TM}$ environment, so Onyx started off looking very +similar. As Onyx matured, it deviated to the point that it is now a truly +different language, with different syntax, additional and more powerful data +types, better debugging capabilities, POSIX-related functionality, more powerful +threading, regular expressions, etc. + +As this project grew far beyond what was originally expected, it became clear +that in order to justify the effort being put into Onyx's design and +implementation, Onyx would have to be usable for more than just slate, or else +slate would have to become {\em very} popular, which seems unlikely, given the +plethora of text editors. Therefore, Onyx has been structured such that it can +be configured in a myriad of ways, with the hope that others will be able to +easily make it fit their needs. This manual documents Onyx in its full glory +without mention that features may be disabled, so there are portions that do not +apply to Onyx interpreters that have been configured without Onyx's full feature +set. + +For software distributions, news, and additional project information, see +\htmlurl{http://www.canonware.com/}. + +\clearemptydoublepage +\tableofcontents +\begin{latexonly} +\listoftables +\end{latexonly} + +% +% Setup for main body of document. +% +\mainmatter + +% +% Set up the standard page headers. +% +%begin{latexonly} +\renewcommand{\chaptermark}[1]{\markboth{#1}{}} +\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} +\lhead[\bfseries\thepage]{\bfseries\rightmark} +\rhead[\bfseries{Chapter \thechapter}]{\bfseries\thepage} +\cfoot{} +\setlength{\headrulewidth}{2pt} +\chead[\bfseries{Onyx Manual}]{\bfseries{Jason Evans}} +\pagestyle{fancy} +%end{latexonly} diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/lang.tex b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/lang.tex new file mode 100644 index 000000000..77f621dfa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/lang.tex @@ -0,0 +1,15815 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% Onyx reference portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\clearemptydoublepage +\chapter{Onyx Language Reference} +\label{onyxlang} + +Onyx is a stack-based, threaded, interpreted language. Its closest relative is +Adobe PostScript$_{TM}$, followed by Forth. Experienced PostScript programmers +should find most aspects of Onyx familiar, but there are significant differences +that will prevent a knowledgeable PostScript programmer from programming in Onyx +without first skimming this chapter. This chapter does not assume specific +knowledge of other programming languages, so stands as a definitive reference +for Onyx. + +Onyx is different from most languages in that it is not compiled, but rather +consumed. For example, there are mechanisms for creating the equivalent of +named procedures that can be called at a later time, but behind the scenes, the +code is actually being interpreted as it is scanned in such a way that an +executable object is created. As such, Onyx is not suited for compilation, +native or byte code. However, the language syntax is very simple and the +scanner/parser is extremely fast. There is also an operator called +\htmlref{\onyxop{}{bind}{}}{systemdict:bind} that optimizes interpreted code +execution to approximately the same performance level as would be expected of a +byte code interpreter. + +Onyx is implemented as a C library that can be embedded in other programs. +Mechanisms are provided for extending the set of operators available. This +manual only documents the base language; see application-specific documentation +for any language extensions. + +Following is a list of basic language features that are discussed in more detail +later in this chapter: + +\begin{itemize} +\item{Stack-based. There are no named variables as in procedural languages. +Operations are done using various stacks, so Onyx operations are coded in +postfix order.} +\item{Threaded. Onyx's threading uses the native POSIX threads implementation +of the operating system (or GNU pth, if so configured).} +\item{Interpreted. Onyx code is never compiled, but is instead interpreted as +it is encountered.} +\item{Garbage-collected. There is no need to manually track memory allocation, +since the interpreter has an integrated automatic mark and sweep garbage +collector.} +\end{itemize} + +\section{Objects} +\label{sec:onyx_objects} + +An Onyx object has three aspects: type, attribute, and value. + +Objects fall into two categories according to type: simple and composite. A +simple object takes up no memory of its own; it uses space within a stack, +array, or dictionary. A composite object requires space of its own in addition +to the space taken up in stacks, arrays, or dictionaries to refer to the +composite object. See Table~\ref{simple-composite} for object type +classifications. + +\begin{table}[htb] +\begin{center} +\begin{tabular}{|l|l|} +\hline +Simple & Composite \\ +\hline \hline +boolean & array \\ +fino & condition \\ +integer & dict \\ +mark & file \\ +name & hook \\ +null & mutex \\ +operator & regex \\ +pmark & regsub \\ +real & stack \\ + & string \\ + & thread \\ +\hline +\end{tabular} +\end{center} +\caption{\label{simple-composite} +Simple and composite types} +\end{table} + +There can be multiple references that refer to the same memory backing composite +objects. In most cases, composite objects that refer to the same memory are +indistinguishable, but for arrays and strings, composite objects may only be +able to access a subset of the total memory backing them. This behavior is +described in detail later. + +All objects have a literal, executable, or evaluatable attribute associated with +them. Composite objects each have their own attribute, even for composite +objects that share the same backing memory. Objects are ``interpreted'' when +they are encountered directly by the interpreter. Objects can also be +``evaluated''. One of two actions is taken when an object is interpreted or +evaluated: + +\begin{itemize} +\item{The object may be treated as code (executed). When executed, an object is +pushed onto the execution stack and executed.} +\item{The object may be treated as data. A data object is push onto the operand +stack.} +\end{itemize} + +Table~\ref{interp-act} enumerates under what circumstances object interpretation +results in execution. Table~\ref{eval-act} enumerates under what circumstances +object evaluation results in execution. Note that executable arrays are the +only objects that behave differently when interpreted versus evaluated. + +In practice, attributes are only useful for types that can be executed. +Attributes are not considered in equality test operations. + +\begin{table}[htb] +\begin{center} +\begin{tabular}{|l|c|c|c|} +\hline +Type & \multicolumn{3}{|c|}{Attribute} \\ +\cline{2-4} + & literal & executable & evaluatable \\ +\hline \hline +array & data & data & code \\ +\hline +boolean & data & data & data \\ +\hline +condition & data & data & data \\ +\hline +dict & data & data & data \\ +\hline +file & data & code & code \\ +\hline +fino & data & data & data \\ +\hline +hook & data & code & code \\ +\hline +integer & data & data & data \\ +\hline +mark & data & data & data \\ +\hline +mutex & data & data & data \\ +\hline +name & data & code & code \\ +\hline +null & data & code & code \\ +\hline +operator & data & code & code \\ +\hline +pmark & data & data & data \\ +\hline +real & data & data & data \\ +\hline +regex & data & data & data \\ +\hline +regsub & data & data & data \\ +\hline +stack & data & data & data \\ +\hline +string & data & code & code \\ +\hline +thread & data & data & data \\ +\hline +\end{tabular} +\end{center} +\caption{\label{interp-act} +Interpretation of objects by type and attribute} +\end{table} + +\begin{table}[htb] +\begin{center} +\begin{tabular}{|l|c|c|c|} +\hline +Type & \multicolumn{3}{|c|}{Attribute} \\ +\cline{2-4} + & literal & executable & evaluatable \\ +\hline \hline +array & data & code & code \\ +\hline +boolean & data & data & data \\ +\hline +condition & data & data & data \\ +\hline +dict & data & data & data \\ +\hline +file & data & code & code \\ +\hline +fino & data & data & data \\ +\hline +hook & data & code & code \\ +\hline +integer & data & data & data \\ +\hline +mark & data & data & data \\ +\hline +mutex & data & data & data \\ +\hline +name & data & code & code \\ +\hline +null & data & code & code \\ +\hline +operator & data & code & code \\ +\hline +pmark & data & data & data \\ +\hline +real & data & data & data \\ +\hline +regex & data & data & data \\ +\hline +regsub & data & data & data \\ +\hline +stack & data & data & data \\ +\hline +string & data & code & code \\ +\hline +thread & data & data & data \\ +\hline +\end{tabular} +\end{center} +\caption{\label{eval-act} +Evaluation of objects by type and attribute} +\end{table} + +\begin{description} + +\item[array: ] An array is an ordered sequence of objects of any type. The +sequence of objects contained in an array is indexed starting at 0. References +to existing arrays may be constructed such that a contiguous subsequence is +visible. The following code creates such an array: + +\begin{verbatim} +[0 1 2 3 4] +1 3 getinterval +\end{verbatim} + +After the code executes, the array left on the operand stack looks like: + +\begin{verbatim} +[1 2 3] +\end{verbatim} + +Executable arrays are in effect procedures. When an array is executed, its +elements are sequentially interpreted. + +\item[boolean: ] A boolean can have two values: true or false. + +\item[condition: ] A condition is used for thread synchronization. The standard +operations on a condition are to wait and to signal. + +\item[dict: ] A dict (short for dictionary) is a collection of key/value pairs. +Other names for dictionaries include ``associative array'' and ``hash''. A key +can be of any type, though in most cases, keys are of type name. A value can +also be of any type. + +\item[file: ] A file is a handle to an ordered sequence of bytes with a current +position. Read and write permissions are set when a file object is created. + +When an executable file is executed, it is used as a source of Onyx code. Data +are sequentially read from the file and interpreted until the end of the file is +reached. + +\item[fino: ] A fino (first in, never out) is used as a stack marker when +constructing stacks. + +\item[hook: ] The hook type is not used by the core Onyx language. It can be +used by applications that extend the interpreter as a container object. Hooks +can be executed, but the results are application dependent. + +Each hook has a tag associated with it that can used by C extension code as a +form of type checking. By default, the tag is a null object. In most cases, an +application that extends the interpreter using hook objects will set hook tags +to be name objects. + +\item[integer: ] An integer is a signed integer in the range $-2^{63}$ to +$2^{63} - 1$. + +\item[mark: ] A mark is used as a stack marker for various stack operations. + +\item[mutex: ] A mutex is a mutual exclusion lock. Mutexes cannot be acquired +recursively, and the application must take care to unlock mutexes before +allowing them to be garbage collected (whether during normal program execution +or at program termination). + +\item[name: ] A name is a key that uniquely identifies a sequence of characters. +Two name objects that correspond to the same sequence of characters can be +compared for equality with the same approximate cost as comparing two integers +for equality. Names are typically used as keys in dictionaries. + +When an executable name is executed, the topmost value in the dictionary stack +associated with the name is evaluated. + +\item[null: ] A null has no significance other than its existence. When an +executable null is executed, it does nothing. Executable nulls can be useful as +place holders that can later be replaced with useful code, or for replacing +obsolete code so that the code is no longer executed. + +\item[operator: ] An operator is an operation that is built in to the +interpreter. Operators can be executed. + +\item[pmark: ] A pmark is used as a stack marker when creating procedures in +deferred execution mode (i.e. procedures that use the \{\} syntax). The +application will only encounter pmarks in error conditions, and there is never a +reason for an application to explicitly create a pmark. + +\item[real: ] A real is a double precision (64 bit) floating point number. + +\item[regex: ] A regex encapsulates a regular expression and associated flags, +which can be used to find substring matches within an input string. + +\item[regsub: ] A regsub encapsulates a regular expression, substitution +template, and associated flags, which can be used to do substring substitutions +matches and create an output string from input string. + +\item[stack: ] A stack provides LIFO (last in, first out) access to objects that +it contains, as well as some more advanced access methods. An application can +create, then manipulate stacks in much the same way that the operand stack can +be manipulated. + +\item[string: ] A string is an ordered sequence of 8 bit characters. The bytes +contained in an string are indexed starting at 0. References to existing +strings may be constructed such that a contiguous subsequence is visible. The +following code creates such a string: + +\begin{verbatim} +`abcde' +1 3 getinterval +\end{verbatim} + +After the code executes, the string left on the operand stack looks like: + +\begin{verbatim} +`bcd' +\end{verbatim} + +When an executable string is executed, its contents are used as a source of Onyx +code. + +\item[thread: ] A thread object serves as a handle for operations such as +detaching and joining. + +\end{description} + +\section{Syntax} +\label{sec:onyx_syntax} +Onyx's syntax is very simple in comparison to most languages. The scanner and +parser are implemented as a human-understandable finite state machine (nested C +switch statements with a couple of auxiliary variables), which should give the +reader an idea of the simplicity of the language syntax. + +CRNL (carriage return, newline) pairs are in all important cases converted to +newlines during scanning. + +The characters \#, !, \$, {\twid}, {\lb}, {\rb}, \{, \}, (, ), `, ', {\lt}, and +{\gt} are special. In most cases, any of the special characters and whitespace +(space, tab, newline, formfeed, null) terminate any preceding token. All other +characters including non-printing characters are considered regular characters. + +A comment starts with a \# character outside of a string context and extends to +the next newline or formfeed. + +Procedures are actually executable arrays, but Onyx provides special syntax for +declaring procedures. Procedures are delimited by \{ and \}, and can be +nested. Normally, the interpreter executes code as it is scanned, but inside of +procedure declarations, execution is deferred. Instead of executing a procedure +body as it is encountered, the tokens of the procedure body are pushed onto the +operand stack until the closing \} is encountered, at which time an executable +array is constructed from the tokens in the procedure body and pushed onto the +operand stack. + +A partial grammar specification, using BNF notation (where convenient) is as +follows: + +\begin{description} +\item[{\lt}program{\gt} ::= ] {\lt}statement{\gt} + +\item[{\lt}statement{\gt} ::= ] {\lt}procedure{\gt} {\lt}statement{\gt} {\pipe} +{\lt}object{\gt} {\lt}statement{\gt} {\pipe} $\epsilon$ + +\item[{\lt}procedure{\gt} ::= ] \{{\lt}statement{\gt}\} + +\item[{\lt}object{\gt} ::= ] {\lt}integer{\gt} {\pipe} {\lt}real{\gt} {\pipe} +{\lt}name{\gt} {\pipe} {\lt}string{\gt} + +\item[{\lt}integer{\gt} ::= ] {\lt}dec\_integer{\gt} {\pipe} +{\lt}radix\_integer{\gt} + +\item[{\lt}real{\gt} ::= ] {\lt}dec\_real{\gt} {\pipe} {\lt}exp\_real{\gt} + +\item[{\lt}name{\gt} : ] Any token that cannot be interpreted as a number or a +string is interpreted as an executable name. There are four syntaxes for names: +executable, evaluatable, literal, and immediately evaluated. Executable and +evaluatable names are looked up in the dictionary stack and executed (unless +execution is deferred). Evaluatable names behave the same as executable names, +except when bing processed by the \htmlref{\onyxop{}{bind}{}}{systemdict:bind} +operator. Literal names are simply pushed onto the operand stack. Immediately +evaluated names are replaced by their values as defined in the dictionary stack, +even if execution is deferred. Examples include: +\begin{verbatim} +foo # executable +4noth3r # executable +!bar # evaluatable +$biz # literal +~baz # immediately evaluated +\end{verbatim} + +If the result of an immediately evaluated name is an executable array, the +evaluatable attribute is set for the array so that when the array is +interpreted, it is executed. This allows immediate evaluation to be +indiscriminately used without concern for whether the result is an executable +array or, say, an executable operator. + +\item[{\lt}string{\gt} ::= ] `'-delimited string. Ticks may +be embedded in the string without escaping them, as long as the unescaped ticks +are balanced. The following sequences have special meaning when escaped by a +{\bs} character: + \begin{description} + \item[` ] ` character. + \item[' ] ' character. + \item[{\bs} ] {\bs} character. + \item[0 ] Nul. + \item[n ] Newline. + \item[r ] Carriage return. + \item[t ] Tab. + \item[b ] Backspace. + \item[f ] Formfeed. + \item[a ] Alarm. + \item[e ] Escape. + \item[x{\lb}0-9a-fA-F{\rb}{\lb}0-9a-fA-F{\rb} ] Hex encoding for a byte. + \item[c{\lb}a-zA-Z{\rb} ] Control character. + \item[{\bs}n (newline) ] Ignore. + \item[{\bs}r{\bs}n (carriage return, newline) ] Ignore. + \end{description} + +{\bs} has no special meaning unless followed by a character in the above list. + +Examples include: +\begin{verbatim} +`' +`A string.' +`An embedded \n newline.' +`Another embedded +newline.' +`An ignored \ +newline.' +`Balanced ` and ' are allowed.' +`Manually escaped \` tick.' +`Manually escaped \` tick and `balanced unescaped ticks'.' +`An actual \\ backslash.' +`Another actual \ backslash.' +\end{verbatim} + +\item[{\lt}dec\_integer{\gt} : ] Signed integer in the range $-2^{63}$ to +$2^{63} - 1$. The sign is optional. Examples include: +\begin{verbatim} +0 +42 +-365 ++17 +\end{verbatim} + +\item[{\lt}radix\_integer{\gt} : ] Signed integer with explicit base between 2 +and 36, inclusive, in the range $-2^{63}$ to $2^{63} - 1$. Integer digits are +composed of decimal numbers and lower or upper case letters. The sign is +optional. Examples include: +\begin{verbatim} +2@101 +16@ff +16@Ff +16@FF +-10@42 +10@42 ++10@42 +9@18 +35@7r3x +35@7R3x +\end{verbatim} + +\item[{\lt}dec\_real{\gt} : ] Double precision floating point number in decimal +notation. At least one decimal digit and a decimal point are required. +Examples include: +\begin{verbatim} +0. +.0 +3. +.141 +3.141 +42.75 ++3.50 +-5.0 +\end{verbatim} + +\item[{\lt}exp\_real{\gt} : ] Floating point number in exponential notation. +The format is the same as for {\lt}dec\_real{\gt}, except that an exponent is +appended. The exponent is composed of an ``e'' or ``E'', an optional sign, and +a base 10 integer that is limited by the precision of the floating point format +(approximately $-308$ to $307$). Examples include: +\begin{verbatim} +6.022e23 +60.22e22 +6.022e+23 +1.661e-24 +1.661E-24 +\end{verbatim} + +\end{description} + +Arrays do not have explicit syntactic support, but the [ and ] operators support +their construction. Examples of array construction include: +\begin{verbatim} +[] +[0 `A string' `Another string.' true] +[5 +42 +false] +\end{verbatim} + +Dictionaries do not have explicit syntactic support, but the {\lt} and +{\gt} operators support their construction. Examples of dictionary +construction include: +\begin{verbatim} +<> +<$answer 42 $question `Who knows' $translate {babelfish} > +\end{verbatim} + +Stacks do not have explicit syntactic support, but the ( and ) operators support +their construction. Examples of stack contstruction include: +\begin{verbatim} +() +(1 2 mark `a') +\end{verbatim} + +\section{Stacks} + +Stacks in Onyx are the core data structure that programs act on. Stacks store +objects in a last in, first out (LIFO) order. Onyx includes a number of +operators that manipulate stacks. + +Each Onyx thread has four program-visible stacks associated with it: +\begin{description} +\item[Operand stack (ostack): ] Most direct object manipulations are done using + the operand stack. Operators use the operand stack for inputs and + outputs, and code generally uses the operand stack for a place to store + objects as they are being manipulated. +\item[Dictionary stack (dstack): ] The dictionary stack is used for looking up + names. Each thread starts with with four dictionaries on its dictionary + stack, which are, from top to bottom: + \begin{itemize} + \item{userdict} + \item{globaldict} + \item{systemdict} + \item{threaddict} + \end{itemize} + The dictionary stack is normally manipulated via the + \htmlref{\onyxop{}{begin}{}}{systemdict:begin} and + \htmlref{\onyxop{}{end}{}}{systemdict:end} operators. The initial + dictionaries on the dictionary stack should not generally be removed, + since doing so can cause interpreter crashes. +\item[Execution stack (estack): ] The interpreter uses the execution stack to + store objects that are being executed. The application generally does + not need to explicitly manipulate the execution stack, but its contents + are accessible, mainly for debugging purposes. +\item[Index stack (istack): ] The interpreter uses the index stack to store + execution offsets for arrays that are being executed. There is a one to + one correspondence of the elements of the execution stack to the + elements of the index stack, even though the elements of the index stack + that do not correspond to arrays have no meaning. The index stack does + not affect execution, and exists purely to allow useful execution stack + traces when errors occur. +\end{description} + +The application can also create additional stacks and manipulate them in much +the same way as the operand stack can be manipulated. + +\section{Standard I/O} +\label{sec:onyx_standard_io} + +Onyx provides operators to access the standard I/O file objects: +\htmlref{\onyxop{}{stdin}{}}{systemdict:stdin}, +\htmlref{\onyxop{}{stdout}{}}{systemdict:stdout}, and +\htmlref{\onyxop{}{stderr}{}}{systemdict:stderr}. Under normal circumstances, +these operators are adequate for all standard I/O operations. However, it may +be desirable to replace these files on a per-thread basis. This can be +accomplished using \htmlref{\onyxop{}{setstdin}{}}{systemdict:setstdin}, +\htmlref{\onyxop{}{setstdout}{}}{systemdict:setstdout}, and +\htmlref{\onyxop{}{setstderr}{}}{systemdict:setstderr}. Furthermore, the file +objects that are inherited by new threads can be accessed and modified via +\htmlref{\onyxop{}{gstdin}{}}{systemdict:gstdin}, +\htmlref{\onyxop{}{gstdout}{}}{systemdict:gstdout}, +\htmlref{\onyxop{}{gstderr}{}}{systemdict:gstderr}, +\htmlref{\onyxop{}{setgstdin}{}}{systemdict:setgstdin}, +\htmlref{\onyxop{}{setgstdout}{}}{systemdict:setgstdout}, and +\htmlref{\onyxop{}{setgstderr}{}}{systemdict:setgstderr}. + +\section{Interpreter recursion} + +During typical Onyx interpreter initialization, the +\htmlref{\onyxop{}{start}{}}{systemdict:start} operator is executed, which in +turn executes a file object corresponding to stdin. However, depending on how +the interpreter is invoked, the initial execution stack state may differ. + +The interpreter can be recursively invoked. For example, if the following code +is executed, the \htmlref{\onyxop{}{eval}{}}{systemdict:eval} operator +recursively invokes the interpreter to interpret the string. +\begin{verbatim} +`2 2 add' cvx eval +\end{verbatim} + +The depth of the execution stack directly corresponds to the recursion depth of +the interpreter. Execution stack depth is limited in order to catch unbounded +recursion. + +Onyx converts tail calls in order to prevent unbounded execution stack growth +due to tail recursion. For example, the following code does not cause the +execution stack to grow: + +\begin{verbatim} +$foo {foo} def +foo +\end{verbatim} + +The following code will result in an execution stack overflow: + +\begin{verbatim} +$foo {foo `filler'} def +foo +\end{verbatim} + +\section{Error handling} + +The error handling mechanisms in Onyx are simple but flexible. When an error +occurs, \htmlref{\onyxop{}{throw}{}}{systemdict:throw} is called. An error can +have any name, but only the following error names are generated internally by +Onyx: +\begin{description} +\label{argcheck} +\index{argcheck} +\item[argcheck: ] Incorrect argument value. +\label{estackoverflow} +\index{estackoverflow} +\item[estackoverflow: ] Maximum interpreter recursion was exceeded. +\label{invalidaccess} +\index{invalidaccess} +\item[invalidaccess: ] Permission error. +\label{invalidexit} +\index{invalidexit} +\item[invalidexit: ] The \onyxop{}{exit}{} operator was called outside of any +loop. This error is generated as a result of catching an exit, so the execution +state for where the error really happened is gone. +\label{invalidfileaccess} +\index{invalidfileaccess} +\item[invalidfileaccess: ] Insufficient file permissions. +\label{ioerror} +\index{ioerror} +\item[ioerror: ] I/O error (read(), write(), etc.). +\label{limitcheck} +\index{limitcheck} +\item[limitcheck: ] Value outside of legal range. +\label{neterror} +\index{neterror} +\item[neterror: ] Network error (refused connection, timeout, unreachable net, +etc.). +\label{rangecheck} +\index{rangecheck} +\item[rangecheck: ] Out of bounds string or array access, or out of bounds +value. +\label{regexerror} +\index{regexerror} +\item[regexerror: ] Regular expression syntax error. +\label{stackunderflow} +\index{stackunderflow} +\item[stackunderflow: ] Not enough objects on stack. +\label{syntaxerror} +\index{syntaxerror} +\item[syntaxerror: ] Scanner syntax error. +\label{typecheck} +\index{typecheck} +\item[typecheck: ] Incorrect argument type. +\label{undefined} +\index{undefined} +\item[undefined: ] Name not defined in any of the dictionaries on dstack. +\label{undefinedfilename} +\index{undefinedfilename} +\item[undefinedfilename: ] Bad filename. +\label{undefinedresult} +\index{undefinedresult} +\item[undefinedresult: ] Attempt to divide by 0. +\label{unmatchedfino} +\index{unmatchedfino} +\item[unmatchedfino: ] No fino on ostack. +\label{unmatchedmark} +\index{unmatchedmark} +\item[unmatchedmark: ] No mark on ostack. +\label{unregistered} +\index{unregistered} +\item[unregistered: ] Non-enumerated error. +\end{description} + +The Onyx scanner handles syntax errors specially, in that it pushes an +executable string onto the operand stack that represents the code that caused +the syntax error and records the line and column numbers in currenterror before +invoking \htmlref{\onyxop{}{throw}{}}{systemdict:throw}. + +The Onyx scanner also handles immediate name evaluation errors specially, in +that it pushes the name that could not be evaluated onto ostack before invoking +\htmlref{\onyxop{}{throw}{}}{systemdict:throw}. + +\section{Threads} + +Onyx supports multiple threads of execution by using the operating system's +native threading facilities. Along with threads comes the need for methods of +synchronization between threads. + +\subsection{Implicit synchronization} +\label{sec:onyx_implicit_synchronization} + +Implicit synchronization is a mandatory language feature, since objects such as +\htmlref{globaldict}{systemdict:globaldict} are implicitly accessed by the +interpreter, which makes it impossible to require the user to explicitly handle +all synchronization. Onyx provides optional implicit synchronization +capabilities for composite objects on an object by object basis. Each thread +has a setting which can be accessed via +\htmlref{\onyxop{}{currentlocking}{}}{systemdict:currentlocking} (initially set +to false) and set via \htmlref{\onyxop{}{setlocking}{}}{systemdict:setlocking}. +If implicit locking is active, then new objects will be created such that simple +accesses are synchronized. + +Implicit synchronization can be a source of deadlock, so care must be taken when +accessing implicitly locked objects. For example, if two threads copy two +implicitly locked strings to the other string, deadlock can result. + +\begin{verbatim} +# Initialization. +$A `aaaaaa' +$B `bbbbbb' + +... + +# In thread A: +A B copy + +... + +# In thread B: +B A copy +\end{verbatim} + +The following are descriptions of the implicit locking semantics for each type +of composite object: +\begin{description} +\item[array: ] Array copying is protected. Array element modifications are +protected, but element reads are not protected. +\item[condition: ] No implicit locking is done for conditions. +\item[dict: ] All dict operations are protected. +\item[file: ] All file operations are protected. There are no potential +deadlocks due to implicit file locking. +\item[hook: ] No implicit locking is done for hooks. +\item[mutex: ] No implicit locking is done for mutexes. +\item[regex: ] No implicit locking is done for regexes. +\item[regsub: ] No implicit locking is done for regsubs. +\item[stack: ] All stack operations are protected. There are no potential +deadlocks due to implicit stack locking. However, there are races in stack +copying, such that the results of copying a stack that is concurrently being +modified are unpredictable. In addition, removing an object that is being +concurrently accessed from a stack is unsafe. +\item[string: ] String copying is protected. Character access is protected by +many operators, but string copying is the only potential cause of deadlock for +string access. +\item[thread: ] Implicit locking is not done for thread operations, since other +synchronization is adequate to protect thread objects. +\end{description} + +\subsection{Explicit synchronization} + +Onyx includes a foundation of mutexes and condition variables, with which all +other synchronization primitives can be constructed. + +\section{Memory management} +Onyx programs do not need to track memory allocations, since memory reclamation +is done implicitly via automatic garbage collection. Onyx uses an atomic mark +and sweep garbage collector. + +The atomic nature of garbage collection may sound worrisome with regard to +performance, but in fact there are tangible benefits and no significant negative +impacts for most applications. Total throughput is improved, since minimal +locking is necessary. Concurrent garbage collection would impose a significant +locking overhead. + +On the down side, atomic garbage collection cannot make strong real-time +guarantees. However, the garbage collector is very efficient, and for typical +applications, garbage collection delays are measured in microseconds up to tens +of milliseconds on current hardware as of the year 2000. For interactive +applications, anything under about 100 milliseconds is undetectable by the user, +so under normal circumstances the user will not notice that garbage collection +is happening. + +There are three parameters that can be used to control garbage collection: +\begin{enumerate} +\item{The garbage collector can be turned off for situations where many objects +are being created over a short period of time.} +\item{The garbage collector runs whenever a certain number of bytes of memory +have been allocated since the last collection. This threshold can be changed or +disabled.} +\item{If no composite objects have been created for an extended period of time +(seconds), the garbage collector will run if any composite objects have been +allocated since the last collection. This idle timeout period can be changed or +disabled.} +\end{enumerate} + +There is one situation in which it is possible for garbage to never be +collected, despite the garbage collector being properly configured. Suppose +that a program creates some objects, the garbage collector runs, then the +program enters a code path that clobbers object references, such that the +objects could be collected, but no new objects are allocated. In such a +situation, neither the allocation inactivity timer (period), nor the object +allocation threshold will trigger a collection, and garbage will remain +uncollected. In practice this situation is unlikely, and is not a significant +problem since the program size is not growing. + +Garbage collection is controlled via the \htmlref{gcdict}{systemdict:gcdict} +dictionary, which is described in Section~\ref{sec:gcdict}. + +\section{Regular expressions} +\label{sec:onyx_regular_expressions} + +Regular expression support is provided by the PCRE library package, which is +open source software, written by Philip Hazel, and copyright by the University +of Cambridge, England. PCRE stands for ``Perl-compatible regular +expressions''. This manual only documents how Onyx interfaces with PCRE. For +more information about how PCRE's regular expressions work, see the following: + +\begin{itemize} +\item{The pcre(3) manual page.} +\item{The official PCRE website: \htmlurl{http://www.pcre.org/}.} +\item{The official PCRE download site: +\htmlurl{ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/}.} +\end{itemize} + +For general information about Perl regular expressions, the following are +recommended: + +\begin{itemize} +\item{Perl 5.6.1 regular expression documentation: +\htmlurl{http://www.perldoc.com/perl5.6.1/pod/perlre.html}.} +\item{\underline{Mastering Regular Expressions, 2nd Ed.}, by Jeffrey +E. F. Friedl. ISBN 0-596-00289-0.} +\item{\underline{Perl 5 Pocket Reference, 3rd Ed.}, by Johan Vromans. ISBN +0-596-00032-4.} +\item{\underline{Programming Perl, 3rd Ed.}, by Larry Wall, Tom Christiansen, +and Jon Orwant. ISBN 0-596-00027-8.} +\end{itemize} + +There are two special Onyx object types that support regular expressions: regex +and regsub. Objects of these types are created via the +\htmlref{\onyxop{}{regex}{}}{systemdict:regex} and +\htmlref{\onyxop{}{regsub}{}}{systemdict:regsub} operators, respectively. The +\htmlref{\onyxop{}{match}{}}{systemdict:match} operator applies a regular +expression to an input string, the +\htmlref{\onyxop{}{submatch}{}}{systemdict:submatch} operator returns a +matched substring of the input string, and the +\htmlref{\onyxop{}{offset}{}}{systemdict:offset} operator returns the offset +of a substring match relative to the beginning of the input string. The +\htmlref{\onyxop{}{split}{}}{systemdict:split} operator creates an array of +substrings that are separated by strings that match a regular expression. The +\htmlref{\onyxop{}{subst}{}}{systemdict:subst} operator finds regular expression +matches within an input string and applies a substitution template to the +matches, thereby creating an output string. See Section~\ref{sec:systemdict} +for detailed documentation on the above-mentioned operators. + +Regular expressions are written as strings in Onyx, so all of the standard +special sequences within strings are interpreted directly by the Onyx scanner. +Note that the {\bs} character is only special within strings if it is followed +by a special sequence. This allows regular expressions to seamlessly extend the +set of special sequences within strings while maintaining a reasonably +consistent syntax. + +The following sequences have special meaning within strings that specify +substitution templates: + +\begin{longtable}{\rxtableformat{5.50}} +\caption{Substitution template special characters} \\ +\hline +Sequence & Description \\ +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +Sequence & Description \\ +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +{\tt {\bs}1..{\bs}9} & Refer to captured expressions 1 through 9. \\ +\end{longtable} + +\section{Dictionary reference} + +All operators built in to Onyx have corresponding names that are composed +entirely of lower case letters and numbers (with the exception of +syntax-supporting operators like {\lb}). In order to avoid any possibility of +namespace collisions with names defined by current and future versions of Onyx, +use at least one character that is not a lower case letter or a number in names +(for example, capital letters, underscore, etc.). In practice, namespace +collisions usually aren't a problem, even if they happen, since the only effect +is that the program-defined definition shadows the built in definition during +name lookups. + +\subsection{currenterror} +\label{sec:currenterror} +\index{currenterror@\onyxop{}{currenterror}{}} + +Each thread has its own currenterror dictionary, which is used by the error +handling machinery to store error state. + +\begin{longtable}{\optableformat{4.10}} +\caption{currenterror summary} +\\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\optableent + {--} + {{\bf \htmlref{newerror}{currenterror:newerror}}} + {boolean} + {Set to true during error handling.} +\hline +\optableent + {--} + {{\bf \htmlref{errorname}{currenterror:errorname}}} + {name} + {Name of most recent error.} +\hline +\optableent + {--} + {{\bf \htmlref{line}{currenterror:line}}} + {number} + {Get line number of syntax error.} +\hline +\optableent + {--} + {{\bf \htmlref{column}{currenterror:column}}} + {number} + {Get column number of syntax error.} +\hline +\optableent + {--} + {{\bf \htmlref{ostack}{currenterror:ostack}}} + {stack} + {ostack snapshot.} +\hline +\optableent + {--} + {{\bf \htmlref{dstack}{currenterror:dstack}}} + {stack} + {dstack snaphot.} +\hline +\optableent + {--} + {{\bf \htmlref{estack}{currenterror:estack}}} + {stack} + {estack snapshot.} +\hline +\optableent + {--} + {{\bf \htmlref{istack}{currenterror:istack}}} + {stack} + {istack snapshot.} +\end{longtable} + +\begin{description} +\label{currenterror:column} +\index{column@\onyxop{}{column}{}} +\item[{\onyxop{--}{column}{integer}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[integer: ] + Column number, valid only if the error was a + syntaxerror. Column numbering starts at 0. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the column number that a syntaxerror occurred on. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `1 2 3}' cvx eval +At line 1, column 5: Error $syntaxerror +ostack: (1 2 3 `}') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..3): +0: `1 2 3}' +1: --eval-- +2: -file- +3: --start-- +onyx:5> currenterror $column get 1 sprint +5 +onyx:5> + \end{verbatim} + \end{description} +\label{currenterror:dstack} +\index{dstack@\onyxop{}{dstack}{}} +\item[{\onyxop{--}{dstack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + A dstack snapshot. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a stack that is a dstack snapshot as of the most recent + error. + \item[Example(s): ]\begin{verbatim} + +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +onyx:1> currenterror begin dstack end 1 sprint +(-dict- -dict- -dict- -dict-) +onyx:1> + \end{verbatim} + \end{description} +\label{currenterror:errorname} +\index{errorname@\onyxop{}{errorname}{}} +\item[{\onyxop{--}{errorname}{name}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[name: ] + Name of the most recent error. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the name of the most recent error. + \item[Example(s): ]\begin{verbatim} + +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +onyx:1> currenterror begin errorname end 1 sprint +$undefined +onyx:1> + \end{verbatim} + \end{description} +\label{currenterror:estack} +\index{estack@\onyxop{}{estack}{}} +\item[{\onyxop{--}{estack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + An estack snapshot. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a stack that is an estack snapshot as of the most recent + error. + \item[Example(s): ]\begin{verbatim} + +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +onyx:1> currenterror begin estack end 1 sprint +(--start-- -file- x) +onyx:1> + \end{verbatim} + \end{description} +\label{currenterror:istack} +\index{istack@\onyxop{}{istack}{}} +\item[{\onyxop{--}{istack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + An istack snapshot. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a stack that is an istack snapshot as of the most recent + error. + \item[Example(s): ]\begin{verbatim} + +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +onyx:1> currenterror begin istack end 1 sprint +(0 0 0) +onyx:1> + \end{verbatim} + \end{description} +\label{currenterror:newerror} +\index{newerror@\onyxop{}{newerror}{}} +\item[{\onyxop{--}{newerror}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + False if there has been no error since the last time + newerror was reset; true otherwise. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a boolean that represents whether there has been an error + since the last time newerror was set to false (as during + interpreter initialization). It is the application's + responsibility to reset newerror after each error if it expects + the value to be useful across multiple errors. + \item[Example(s): ]\begin{verbatim} + +onyx:0> currenterror begin +onyx:0> newerror 1 sprint +false +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +onyx:1> newerror 1 sprint +true +onyx:1> $newerror false def +onyx:1> newerror 1 sprint +false +onyx:1> resume +onyx:1> y +Error $undefined +ostack: (x) +dstack: (-dict- -dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: y +1: -file- +2: --start-- +onyx:2> newerror 1 sprint +true +onyx:2> + \end{verbatim} + \end{description} +\label{currenterror:line} +\index{line@\onyxop{}{line}{}} +\item[{\onyxop{--}{line}{integer}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[integer: ] + Line number, valid only if the error was a syntaxerror. + Line numbering starts at 1. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the line number that a syntaxerror occurred on. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `1 2 3}' cvx eval +At line 1, column 5: Error $syntaxerror +ostack: (1 2 3 `}') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..3): +0: `1 2 3}' +1: --eval-- +2: -file- +3: --start-- +onyx:5> currenterror $line get 1 sprint +1 +onyx:5> + \end{verbatim} + \end{description} +\label{currenterror:ostack} +\index{ostack@\onyxop{}{ostack}{}} +\item[{\onyxop{--}{ostack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + An ostack snapshot. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a stack that is an ostack snapshot as of the most recent + error. + \item[Example(s): ]\begin{verbatim} + +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +onyx:1> currenterror begin ostack end 1 sprint +() +onyx:1> + \end{verbatim} + \end{description} +\end{description} + +\subsection{envdict} +\label{sec:envdict} +\index{envdict@\onyxop{}{envdict}{}} + +The envdict dictionary contains keys of type name and values of type string that +correspond to the environment passed into the program. All threads share the +same envdict, which is implicitly locked. Modifications to envdict should be +made via the \htmlref{\onyxop{}{setenv}{}}{systemdict:setenv} and +\htmlref{\onyxop{}{unsetenv}{}}{systemdict:unsetenv} operators. If envdict is +modified directly, the changes will not be visible to programs such as +\binname{ps}. + +\subsection{errordict} +\label{sec:errordict} +\index{errordict@\onyxop{}{errordict}{}} + +Each thread has its own errordict, which is used by default by the error +handling machinery. + +\begin{longtable}{\optableformat{4.10}} +\caption{errordict summary} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\optableent + {--} + {{\bf \htmlref{handleerror}{errordict:handleerror}}} + {--} + {Print a state dump.} +\hline +\optableent + {--} + {{\bf \htmlref{stop}{errordict:stop}}} + {--} + {Last operation during error handling.} +\end{longtable} + +\begin{description} +\label{handleerror} +\label{errordict:handleerror} +\index{handleerror@\onyxop{}{handleerror}{}} +\item[{\onyxop{--}{handleerror}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] + Under normal conditions, no errors occur. However, it is + possible for the application to corrupt the error handling + machinery to the point that an error will occur. If that + happens, the result is possible infinite recursion, and program + crashes are a real possibility. + \item[Description: ] + Print a dump of the most recent error recorded in the + currenterror dictionary. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {true {true 1 sprint x y} if} eval +true +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..5): +0: x +1: { + true + 1 + sprint + 3:--> x + y +} +2: --if-- +3: --eval-- +4: -file- +5: --start-- +onyx:1> errordict begin handleerror end +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..5): +0: x +1: { + true + 1 + sprint + 3:--> x + y +} +2: --if-- +3: --eval-- +4: -file- +5: --start-- +onyx:1> + \end{verbatim} + \end{description} +\label{errordict:stop} +\index{stop@\onyxop{}{stop}{}} +\item[{\onyxop{--}{stop}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + This is called as the very last operation when an error occurs. + Initially, its value is the same as that for the + \htmlref{\onyxop{}{stop}{}}{systemdict:stop} operator in + systemdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> errordict begin +onyx:0> $stop {`Custom stop\n' print flush quit} def +onyx:0> x +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: x +1: -file- +2: --start-- +Custom stop + \end{verbatim} + \end{description} +\end{description} + +\subsection{gcdict} +\label{sec:gcdict} +\index{gcdict@\onyxop{}{gcdict}{}} + +The gcdict dictionary provides garbage collection control and status +capabilities. + +\begin{longtable}{\optableformat{4.10}} +\caption{gcdict summary} +\\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\multicolumn{2}{|l|}{Control operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{collect}{gcdict:collect}}} + {--} + {Force a garbage collection.} +\hline +\optableent + {boolean} + {{\bf \htmlref{setactive}{gcdict:setactive}}} + {--} + {Set whether the garbage collector is active.} +\hline +\optableent + {seconds} + {{\bf \htmlref{setperiod}{gcdict:setperiod}}} + {--} + {Set the inactivity period before the garbage collector will run.} +\hline +\optableent + {count} + {{\bf \htmlref{setthreshold}{gcdict:setthreshold}}} + {--} + {Set the number of bytes of memory allocation that will trigger a garbage collection.} +\hline \hline +\multicolumn{2}{|l|}{State and statistics operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{active}{gcdict:active}}} + {boolean} + {Get whether the garbage collector is active.} +\hline +\optableent + {--} + {{\bf \htmlref{period}{gcdict:period}}} + {seconds} + {Get the inactivity period before the garbage collector will run.} +\hline +\optableent + {--} + {{\bf \htmlref{threshold}{gcdict:threshold}}} + {count} + {Get the number of bytes of memory allocation that will trigger a garbage collection.} +\hline +\optableent + {--} + {{\bf \htmlref{stats}{gcdict:stats}}} + {array} + {Get garbage collection statistics.} +\end{longtable} + +\begin{description} +\label{gcdict:active} +\index{active@\onyxop{}{active}{}} +\item[{\onyxop{--}{active}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If true, the garbage collector is active; otherwise it + is not active. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get whether the garbage collector is active. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin active end 1 sprint +false + \end{verbatim} + \end{description} +\label{gcdict:collect} +\index{collect@\onyxop{}{collect}{}} +\item[{\onyxop{--}{collect}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + Force a garbage collection. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin collect end +onyx:0> + \end{verbatim} + \end{description} +\label{gcdict:period} +\index{period@\onyxop{}{period}{}} +\item[{\onyxop{--}{period}{seconds}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[seconds: ] + The minimum number of seconds since the last object + allocation that the garbage collector will wait before + doing a garbage collection. 0 is treated specially to + mean forever. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the minimum number of seconds of object allocation + inactivity that the garbage collector will wait before doing a + garbage collection. This setting is disjoint from the threshold + setting, and does not prevent garbage collection due to the + threshold having been reached. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin period end 1 sprint +60 +onyx:0> + \end{verbatim} + \end{description} +\label{gcdict:setactive} +\index{setactive@\onyxop{}{setactive}{}} +\item[{\onyxop{boolean}{setactive}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[boolean: ] + If true (initial setting), activate the garbage + collector; otherwise deactivate the garbage collector. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set whether the garbage collector is active. This setting takes + effect asynchronously, so it is possible for the garbage + collector to run even after it has been deactivated. This + setting overrides the allocation inactivity period and + allocation threshold settings, so that if this setting is set to + false, the other settings have no effect. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin false setactive end +onyx:0> + \end{verbatim} + \end{description} +\label{gcdict:setperiod} +\index{setperiod@\onyxop{}{setperiod}{}} +\item[{\onyxop{seconds}{setperiod}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[seconds: ] + The minimum number of seconds since the last object + allocation that the garbage collector will wait before + doing a garbage collection. 0 is treated specially to + mean forever. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{limitcheck}{limitcheck}.] + \end{description} + \item[Description: ] + Set the minimum number of seconds of object allocation + inactivity that the garbage collector will wait before doing a + garbage collection. This setting is disjoint from the threshold + setting, and does not prevent garbage collection due to the + threshold having been reached. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin 60 setperiod end +onyx:0> + \end{verbatim} + \end{description} +\label{gcdict:setthreshold} +\index{setthreshold@\onyxop{}{setthreshold}{}} +\item[{\onyxop{count}{setthreshold}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[count: ] + Number of bytes of memory allocation since the last + garbage collection that will trigger a garbage + collection. 0 is treated specially to mean infinity. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{limitcheck}{limitcheck}.] + \end{description} + \item[Description: ] + Set the number of bytes of memory allocation since the last + garbage collection that will trigger a garbage collection. This + setting is disjoint from the inactivity period setting, and does + not prevent garbage collection due to the allocation inactivity + period having been exceeded. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin 40000 setthreshold end +onyx:0> + \end{verbatim} + \end{description} +\label{gcdict:stats} +\index{stats@\onyxop{}{stats}{}} +\item[{\onyxop{--}{stats}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array with the format {\lb}collections count + {\lb}ccount cmark csweep{\rb} {\lb}mcount mmark + msweep{\rb} {\lb}scount smark ssweep{\rb}{\rb}, where + the fields have the following meanings: + \begin{description}%\item[] + \item[collections: ] + Total number of collections the garbage + collector has performed. + \item[count: ] + Current number of bytes of memory allocated. + \item[ccount: ] + Number of bytes of memory allocated as of the + end of the most recent garbage collection. + \item[cmark: ] + Number of microseconds taken by the most recent + garbage collection mark phase. + \item[csweep: ] + Number of microseconds taken by the most recent + garbage collection sweep phase. + \item[mcount: ] + Largest number of bytes of memory ever allocated + at any point in time. + \item[mmark: ] + Maximum number of microseconds taken by any + garbage collection mark phase. + \item[msweep: ] + Number of microseconds taken by any garbage + collection sweep phase. + \item[scount: ] + Total number of bytes of memory ever allocated. + \item[smark: ] + Total number of microseconds taken by all + garbage collection mark phases. + \item[ssweep: ] + Total number of microseconds taken by all + garbage collection sweep phases. + \end{description} + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get statistics about the garbage collector. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin +onyx:0> stats 2 sprint +[23 72673 [72268 754 3467] [4752223 930 36492] [51057886 17448 136807]] +onyx:0> + \end{verbatim} + \end{description} +\label{gcdict:threshold} +\index{threshold@\onyxop{}{threshold}{}} +\item[{\onyxop{--}{threshold}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + Number of bytes of memory allocation since the last + garbage collection that will trigger a garbage + collection. 0 is treated specially to mean infinity. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the number of bytes of memory allocation since the last + garbage collection that will trigger a garbage collection. This + setting is disjoint from the inactivity period setting, and does + not prevent garbage collection due to the allocation inactivity + period having been exceeded. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict begin threshold end 1 sprint +65536 +onyx:0> + \end{verbatim} + \end{description} +\end{description} + +\subsection{globaldict} +\label{sec:globaldict} +\index{globaldict@\onyxop{}{globaldict}{}} + +All threads share the same globaldict, which is meant as a repository for +globally shared objects. globaldict is empty when the Onyx interpreter is +initialized, and is implicitly locked. + +\subsection{onyxdict} +\label{sec:onyxdict} +\index{onyxdict@\onyxop{}{onyxdict}{}} + +Various portions of Onyx use the onyxdict dictionary for storage of +miscellaneous objects that normally should not be part of the namespace visible +to dstack searches. + +\begin{longtable}{\optableformat{4.10}} +\caption{onyxdict summary} +\\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\optableent + {--} + {{\bf \htmlref{mpath\_post}{onyxdict:mpath_post}}} + {array} + {Get path searched by \htmlref{mrequire}{systemdict:mrequire}.} +\hline +\optableent + {--} + {{\bf \htmlref{mpath\_pre}{onyxdict:mpath_pre}}} + {array} + {Get path searched by \htmlref{mrequire}{systemdict:mrequire}.} +\hline +\optableent + {--} + {{\bf \htmlref{rpath\_post}{onyxdict:rpath_post}}} + {array} + {Get path searched by \htmlref{require}{systemdict:require}.} +\hline +\optableent + {--} + {{\bf \htmlref{rpath\_pre}{onyxdict:rpath_pre}}} + {array} + {Get path searched by \htmlref{require}{systemdict:require}.} +\end{longtable} + +\begin{description} +\label{onyxdict:mpath_post} +\index{mpath_post@\onyxop{}{mpath\_post}{}} +\item[{\onyxop{--}{mpath\_post}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of strings. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get an array of strings used by + \htmlref{mrequire}{systemdict:mrequire} as prefixes for file + searches. The elements of the array are tried in the order + listed. + \item[Example(s): ]\begin{verbatim} + +onyx:0> onyxdict $mpath_post get 1 sprint +[`/usr/local/share/onyx-3.0.0/nxm'] +onyx:0> + \end{verbatim} + \end{description} +\label{onyxdict:mpath_pre} +\index{mpath_pre@\onyxop{}{mpath\_pre}{}} +\item[{\onyxop{--}{mpath\_pre}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of strings. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get an array of strings used by + \htmlref{mrequire}{systemdict:mrequire} as prefixes for file + searches. The elements of the array are tried in the order + listed. + \item[Example(s): ]\begin{verbatim} + +onyx:0> onyxdict $mpath_pre get 1 sprint +[`' `.'] +onyx:0> + \end{verbatim} + \end{description} +\label{onyxdict:rpath_post} +\index{rpath_post@\onyxop{}{rpath\_post}{}} +\item[{\onyxop{--}{rpath\_post}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of strings. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get an array of strings used by + \htmlref{require}{systemdict:require} as prefixes for file + searches. The elements of the array are tried in the order + listed. + \item[Example(s): ]\begin{verbatim} + +onyx:0> onyxdict $rpath_post get 1 sprint +[`/usr/local/share/onyx-3.0.0/nx'] +onyx:0> + \end{verbatim} + \end{description} +\label{onyxdict:rpath_pre} +\index{rpath_pre@\onyxop{}{rpath\_pre}{}} +\item[{\onyxop{--}{rpath\_pre}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of strings. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get an array of strings used by + \htmlref{require}{systemdict:require} as prefixes for file + searches. The elements of the array are tried in the order + listed. + \item[Example(s): ]\begin{verbatim} + +onyx:0> onyxdict $rpath_pre get 1 sprint +[`' `.'] +onyx:0> + \end{verbatim} + \end{description} +\end{description} + +\subsection{outputsdict} +\label{sec:outputsdict} +\index{outputsdict@\onyxop{}{outputsdict}{}} + +The outputsdict dictionary is primarily used to support +\htmlref{\onyxop{}{outputs}{}}{systemdict:outputs}, but its contents may be of +use to an application that wishes to extend or modify formatted printing. + +There is an entry in outputsdict for each Onyx type. Each entry renders objects +that correspond to its name using optional flags stored in a dictionary. The +following flags are supported for all types: +\begin{description} +\item[{\tt \$n}: ] + Maximum length, in bytes. Default: disabled. +\item[{\tt \$w}: ] + Minimum length, in bytes. Default: disabled. +\item[{\tt \$j}: ] + Justification. Legal values: + \begin{description} + \item[{\tt \$l}: ] + Left. + \item[{\tt \$c}: ] + Center. + \item[{\tt \$r}: ] + Right (default). + \end{description} +\item[{\tt \$p}: ] + Padding character. Default: {\tt ` '}. +\item[{\tt \$r}: ] + Syntactic rendering recursion depth. Default: 1. +\end{description} + +The following additional flags are supported for integers: +\begin{description} +\item[{\tt \$b}: ] + Base, from 2 to 36. Default: 10. +\item[{\tt \$s}: ] + Sign. Legal values: + \begin{description} + \item[{\tt \$-}: ] + Only print sign if output is negative (default). + \item[{\tt \$+}: ] + Always print sign. + \end{description} +\end{description} + +The following additional flags are supported for reals: +\begin{description} +\item[{\tt \$d}: ] + Digits of precision past decimal point. Default: 6. +\item[{\tt \$e}: ] + Exponential notation, if true. Default: false. +\end{description} + +\begin{longtable}{\optableformat{4.10}} +\caption{outputsdict summary} +\\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\optableent + {array flags} + {{\bf \htmlref{arraytype}{outputsdict:arraytype}}} + {string} + {Create formatted string from array.} +\hline +\optableent + {boolean flags} + {{\bf \htmlref{booleantype}{outputsdict:booleantype}}} + {string} + {Create formatted string from boolean.} +\hline +\optableent + {condition flags} + {{\bf \htmlref{conditiontype}{outputsdict:conditiontype}}} + {string} + {Create formatted string from condition.} +\hline +\optableent + {dict flags} + {{\bf \htmlref{dicttype}{outputsdict:dicttype}}} + {string} + {Create formatted string from dict.} +\hline +\optableent + {file flags} + {{\bf \htmlref{filetype}{outputsdict:filetype}}} + {string} + {Create formatted string from file.} +\hline +\optableent + {fino flags} + {{\bf \htmlref{finotype}{outputsdict:finotype}}} + {string} + {Create formatted string from fino.} +\hline +\optableent + {hook flags} + {{\bf \htmlref{hooktype}{outputsdict:hooktype}}} + {string} + {Create formatted string from hook.} +\hline +\optableent + {integer flags} + {{\bf \htmlref{integertype}{outputsdict:integertype}}} + {string} + {Create formatted string from integer.} +\hline +\optableent + {mark flags} + {{\bf \htmlref{marktype}{outputsdict:marktype}}} + {string} + {Create formatted string from mark.} +\hline +\optableent + {mutex flags} + {{\bf \htmlref{mutextype}{outputsdict:mutextype}}} + {string} + {Create formatted string from mutex.} +\hline +\optableent + {name flags} + {{\bf \htmlref{nametype}{outputsdict:nametype}}} + {string} + {Create formatted string from name.} +\hline +\optableent + {null flags} + {{\bf \htmlref{nulltype}{outputsdict:nulltype}}} + {string} + {Create formatted string from null.} +\hline +\optableent + {operator flags} + {{\bf \htmlref{operatortype}{outputsdict:operatortype}}} + {string} + {Create formatted string from operator.} +\hline +\optableent + {pmark flags} + {{\bf \htmlref{pmarktype}{outputsdict:pmarktype}}} + {string} + {Create formatted string from pmark.} +\hline +\optableent + {real flags} + {{\bf \htmlref{realtype}{outputsdict:realtype}}} + {string} + {Create formatted string from real.} +\hline +\optableent + {regex flags} + {{\bf \htmlref{regextype}{outputsdict:regextype}}} + {string} + {Create formatted string from regex.} +\hline +\optableent + {regsub flags} + {{\bf \htmlref{regsubtype}{outputsdict:regsubtype}}} + {string} + {Create formatted string from regsub.} +\hline +\optableent + {stack flags} + {{\bf \htmlref{stacktype}{outputsdict:stacktype}}} + {string} + {Create formatted string from stack.} +\hline +\optableent + {string flags} + {{\bf \htmlref{stringtype}{outputsdict:stringtype}}} + {string} + {Create formatted string from string.} +\hline +\optableent + {thread flags} + {{\bf \htmlref{threadtype}{outputsdict:threadtype}}} + {string} + {Create formatted string from thread.} +\end{longtable} + +\begin{description} +\label{outputsdict:arraytype} +\index{arraytype@\onyxop{}{arraytype}{}} +\item[{\onyxop{array flags}{arraytype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{array}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{array}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> [1 [2 3] 4] +onyx:1> dup <$w 9 $p `_' $r 0> arraytype print `\n' print flush +__-array- +onyx:1> dup <$w 9 $p `_' $r 1> arraytype print `\n' print flush +[1 -array- 4] +onyx:1> + \end{verbatim} + \end{description} +\label{outputsdict:booleantype} +\index{booleantype@\onyxop{}{booleantype}{}} +\item[{\onyxop{boolean flags}{booleantype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[boolean: ] + A boolean object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{boolean}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{boolean}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> false +onyx:1> dup <$n 3> booleantype print `\n' print flush +fal +onyx:1> dup <$n 7> booleantype print `\n' print flush +false +onyx:1> + \end{verbatim} + \end{description} +\label{outputsdict:conditiontype} +\index{conditiontype@\onyxop{}{conditiontype}{}} +\item[{\onyxop{condition flags}{conditiontype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{condition}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{condition}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> condition +onyx:1> <$w 15 $p `_' $j $c> booleantype print `\n' print flush +__-condition-__ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:dicttype} +\index{dicttype@\onyxop{}{dicttype}{}} +\item[{\onyxop{dict flags}{dicttype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[dict: ] + A dict object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{dict}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{dict}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> <$foo `foo'> <$w 30 $p `.' $j $r> dicttype print `\n' print flush +..................<$foo `foo'> +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:filetype} +\index{filetype@\onyxop{}{filetype}{}} +\item[{\onyxop{file flags}{filetype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{file}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> stdin +onyx:1> <$w 30 $p `.' $j $c> filetype print `\n' print flush +............-file-............ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:finotype} +\index{finotype@\onyxop{}{finotype}{}} +\item[{\onyxop{fino flags}{finotype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[fino: ] + A fino object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{fino}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{fino}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> ( +onyx:1> <$w 30 $p `.' $j $c> finotype print `\n' print flush +............-fino-............ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:hooktype} +\index{hooktype@\onyxop{}{hooktype}{}} +\item[{\onyxop{hook flags}{hooktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[hook: ] + A hook object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{hook}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{hook}. + \item[Example(s): ] + The following example is a bit contrived, since there is no way + to create a hook object with a stock onyx interpreter. + Therefore, imagine that an operator named taggedhook exists that + creates a hook with a tag that is the name ``tagged''. + \begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> taggedhook +onyx:1> <$w 30 $p `.' $j $l hooktype print `\n' print flush +=tagged=...................... +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:integertype} +\index{integertype@\onyxop{}{integertype}{}} +\item[{\onyxop{integer flags}{integertype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[integer: ] + An integer object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{integer}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{integer}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> 42 <$w 6 $p `_' $j $c $s $-> integertype print `\n' print flush +__42__ +onyx:0> 42 <$w 6 $p `_' $j $c $s $+> integertype print `\n' print flush +_+42__ +onyx:0> `0x' print 42 <$w 6 $p `0' $b 16> integertype print `\n' print flush +0x00002a +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:marktype} +\index{marktype@\onyxop{}{marktype}{}} +\item[{\onyxop{mark flags}{marktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{mark}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{mark}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> mark +onyx:1> <$w 30 $p `.' $j $c> marktype print `\n' print flush +............-mark-............ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:mutextype} +\index{mutextype@\onyxop{}{mutextype}{}} +\item[{\onyxop{mutex flags}{mutextype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{mutex}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{mutex}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> mutex +onyx:1> <$w 30 $p `.' $j $c> mutextype print `\n' print flush +...........-mutex-............ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:nametype} +\index{nametype@\onyxop{}{nametype}{}} +\item[{\onyxop{name flags}{nametype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[name: ] + A name object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{name}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{name}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> $foo +onyx:1> <$w 30 $p `.' $j $c> nametype print `\n' print flush +.............$foo............. +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:nulltype} +\index{nulltype@\onyxop{}{nulltype}{}} +\item[{\onyxop{null flags}{nulltype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[null: ] + A null object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{null}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{null}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> null +onyx:1> <$w 30 $p `.' $j $c> nulltype print `\n' print flush +.............null............. +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:operatortype} +\index{operatortype@\onyxop{}{operatortype}{}} +\item[{\onyxop{operator flags}{operatortype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[operator: ] + An operator object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{operator}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{operator}. + \item[Example(s): ] + The following example shows an operator printed out with two + leading and trailing dashes. If the interpreter cannot + determine the name associated with an operator, as will be the + case for custom operators, the operator will be printed as + {\tt -operator-}. + \begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> ~realtime +onyx:1> <$w 30 $p `.' $j $c> operatortype print `\n' print flush +.........--realtime--......... +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:pmarktype} +\index{pmarktype@\onyxop{}{pmarktype}{}} +\item[{\onyxop{pmark flags}{pmarktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[pmark: ] + A pmark object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{pmark}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{pmark}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> { ~x +Error $undefined +ostack: (-pmark- $x) +dstack: (-dict- -dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- +onyx:3> pop pop resume +onyx:1> <$w 30 $p `.' $j $c> pmarktype print `\n' print flush +...........-pmark-............ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:realtype} +\index{realtype@\onyxop{}{realtype}{}} +\item[{\onyxop{real flags}{realtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[real: ] + A real object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{real}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{real}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> 6.022e23 <$d 4> realtype print `\n' print flush +602200000000000027262976.0000 +onyx:0> 6.022e23 <$d 4 $e true> realtype print `\n' print flush +6.0220e+23 +onyx:0> 6.022e23 <$d 0 $e true> realtype print `\n' print flush +6e+23 +onyx:0> 6.022e23 <$d 4 $w 40 $p `0'> realtype print `\n' print flush +00000000000602200000000000027262976.0000 +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:regextype} +\index{regextype@\onyxop{}{regextype}{}} +\item[{\onyxop{regex flags}{regextype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[regex: ] + A regex object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{regex}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{regex}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> `' regex +onyx:1> <$w 30 $p `.' $j $c> regextype print `\n' print flush +...........-regex-............ +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:regsubtype} +\index{regsubtype@\onyxop{}{regsubtype}{}} +\item[{\onyxop{regsub flags}{regsubtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[regsub: ] + A regsub object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{regsub}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{regsub}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> `' `' regsub +onyx:1> <$w 30 $p `.' $j $c> regsubtype print `\n' print flush +...........-regsub-........... +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:stacktype} +\index{stacktype@\onyxop{}{stacktype}{}} +\item[{\onyxop{stack flags}{stacktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> (1 (2 3) 4) +onyx:1> dup <$w 9 $p `_' $r 0> stacktype print `\n' print flush +__-stack- +onyx:1> <$w 9 $p `_' $r 1> stacktype print `\n' print flush +(1 -stack- 4) +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:stringtype} +\index{stringtype@\onyxop{}{stringtype}{}} +\item[{\onyxop{string flags}{stringtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[string: ] + A string object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{string}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> `A string' +onyx:1> <$w 30 $p `.' $j $c> stringtype print `\n' print flush +...........A string........... +onyx:0> + \end{verbatim} + \end{description} +\label{outputsdict:threadtype} +\index{threadtype@\onyxop{}{threadtype}{}} +\item[{\onyxop{thread flags}{threadtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \item[flags: ] + Formatting flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Formatted string representation of \oparg{thread}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{thread}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict begin +onyx:0> () {} thread +onyx:1> <$w 30 $p `.' $j $c> threadtype print `\n' print flush +...........-thread-........... +onyx:0> + \end{verbatim} + \end{description} +\end{description} + +\subsection{sprintsdict} +\label{sec:sprintsdict} +\index{sprintsdict@\onyxop{}{sprintsdict}{}} + +The sprintsdict dictionary is primarily used to support +\htmlref{\onyxop{}{sprints}{}}{systemdict:sprints}, but its contents may be of +use to an application that wishes to extend or modify syntactical printing. + +There is an entry in sprintsdict for each Onyx type. If there is a +syntactically valid representation for an object and the recursion depth is +greater than 0, the corresponding operator creates a string that syntactically +represents the object. Otherwise, a string with a non-syntictical +representation of the object is created, except for booleans, integers, names, +nulls, reals, and strings, for which the results are always syntactical. If the +recursion depth is greater than 0, the operators will recursively convert any +contained objects. + +The implementation of \htmlref{\onyxop{}{sprints}{}}{systemdict:sprints} is +useful in illustrating a useful method of doing type-dependent operations: + +\begin{verbatim} +$sprints { + 1 idup type $sprintsdict load exch get eval +} def +\end{verbatim} + +\begin{longtable}{\optableformat{4.10}} +\caption{sprintsdict summary} +\\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\optableent + {array depth} + {{\bf \htmlref{arraytype}{sprintsdict:arraytype}}} + {string} + {Create syntactical string from array.} +\hline +\optableent + {boolean depth} + {{\bf \htmlref{booleantype}{sprintsdict:booleantype}}} + {string} + {Create syntactical string from boolean.} +\hline +\optableent + {condition depth} + {{\bf \htmlref{conditiontype}{sprintsdict:conditiontype}}} + {string} + {Create syntactical string from condition.} +\hline +\optableent + {dict depth} + {{\bf \htmlref{dicttype}{sprintsdict:dicttype}}} + {string} + {Create syntactical string from dict.} +\hline +\optableent + {file depth} + {{\bf \htmlref{filetype}{sprintsdict:filetype}}} + {string} + {Create syntactical string from file.} +\hline +\optableent + {fino depth} + {{\bf \htmlref{finotype}{sprintsdict:finotype}}} + {string} + {Create syntactical string from fino.} +\hline +\optableent + {hook depth} + {{\bf \htmlref{hooktype}{sprintsdict:hooktype}}} + {string} + {Create syntactical string from hook.} +\hline +\optableent + {integer depth} + {{\bf \htmlref{integertype}{sprintsdict:integertype}}} + {string} + {Create syntactical string from integer.} +\hline +\optableent + {mark depth} + {{\bf \htmlref{marktype}{sprintsdict:marktype}}} + {string} + {Create syntactical string from mark.} +\hline +\optableent + {mutex depth} + {{\bf \htmlref{mutextype}{sprintsdict:mutextype}}} + {string} + {Create syntactical string from mutex.} +\hline +\optableent + {name depth} + {{\bf \htmlref{nametype}{sprintsdict:nametype}}} + {string} + {Create syntactical string from name.} +\hline +\optableent + {null depth} + {{\bf \htmlref{nulltype}{sprintsdict:nulltype}}} + {string} + {Create syntactical string from null.} +\hline +\optableent + {operator depth} + {{\bf \htmlref{operatortype}{sprintsdict:operatortype}}} + {string} + {Create syntactical string from operator.} +\hline +\optableent + {pmark depth} + {{\bf \htmlref{pmarktype}{sprintsdict:pmarktype}}} + {string} + {Create syntactical string from pmark.} +\hline +\optableent + {real depth} + {{\bf \htmlref{realtype}{sprintsdict:realtype}}} + {string} + {Create syntactical string from real.} +\hline +\optableent + {regex depth} + {{\bf \htmlref{regextype}{sprintsdict:regextype}}} + {string} + {Create syntactical string from regex.} +\hline +\optableent + {regsub depth} + {{\bf \htmlref{regsubtype}{sprintsdict:regsubtype}}} + {string} + {Create syntactical string from regsub.} +\hline +\optableent + {stack depth} + {{\bf \htmlref{stacktype}{sprintsdict:stacktype}}} + {string} + {Create syntactical string from stack.} +\hline +\optableent + {string depth} + {{\bf \htmlref{stringtype}{sprintsdict:stringtype}}} + {string} + {Create syntactical string from string.} +\hline +\optableent + {thread depth} + {{\bf \htmlref{threadtype}{sprintsdict:threadtype}}} + {string} + {Create syntactical string from thread.} +\end{longtable} + +\begin{description} +\label{sprintsdict:arraytype} +\index{arraytype@\onyxop{}{arraytype}{}} +\item[{\onyxop{array depth}{arraytype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{array}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{array}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> [1 [2 3] 4] +onyx:1> dup 0 arraytype print `\n' print flush +-array- +onyx:1> dup 1 arraytype print `\n' print flush +[1 -array- 4] +onyx:1> dup 2 arraytype print `\n' print flush +[1 [2 3] 4] +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:booleantype} +\index{booleantype@\onyxop{}{booleantype}{}} +\item[{\onyxop{boolean depth}{booleantype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[boolean: ] + A boolean object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{boolean}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{boolean}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> true +onyx:1> dup 0 booleantype print `\n' print flush +true +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:conditiontype} +\index{conditiontype@\onyxop{}{conditiontype}{}} +\item[{\onyxop{condition depth}{conditiontype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{condition}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{condition}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> condition +onyx:1> dup 0 conditiontype print `\n' print flush +-condition- +onyx:1> dup 1 conditiontype print `\n' print flush +-condition- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:dicttype} +\index{dicttype@\onyxop{}{dicttype}{}} +\item[{\onyxop{dict depth}{dicttype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[dict: ] + A dict object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{dict}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{dict}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> <$a `a' $subdict <$b `b'>> +onyx:1> dup 0 dicttype print `\n' print flush +-dict- +onyx:1> dup 1 dicttype print `\n' print flush +<$subdict -dict- $a `a'> +onyx:1> dup 2 dicttype print `\n' print flush +<$subdict <$b `b'> $a `a'> +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:filetype} +\index{filetype@\onyxop{}{filetype}{}} +\item[{\onyxop{file depth}{filetype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{file}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> stdout +onyx:1> dup 0 filetype print `\n' print flush +-file- +onyx:1> dup 1 filetype print `\n' print flush +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:finotype} +\index{finotype@\onyxop{}{finotype}{}} +\item[{\onyxop{fino depth}{finotype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[fino: ] + A fino object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{fino}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{fino}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> ( +onyx:1> dup 0 finotype print `\n' print flush +-fino- +onyx:1> dup 1 finotype print `\n' print flush +-fino- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:hooktype} +\index{hooktype@\onyxop{}{hooktype}{}} +\item[{\onyxop{hook depth}{hooktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[hook: ] + A hook object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{hook}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{hook}. + \item[Example(s): ] + The following example is a bit contrived, since there is no way + to create a hook object with a stock onyx interpreter. + Therefore, imagine that an operator named taggedhook exists that + creates a hook with a tag that is the name ``tagged'', and that + an operator named untaggedhook exists that creates an untagged + hook. + \begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> taggedhook +onyx:1> dup 0 hooktype print `\n' print flush +=tagged= +onyx:1> 1 hooktype print `\n' print flush +=tagged= +onyx:0> untaggedhook +onyx:1> dup 0 hooktype print `\n' print flush +-hook- +onyx:1> 1 hooktype print `\n' print flush +-hook- +onyx:0> + \end{verbatim} + \end{description} +\label{sprintsdict:integertype} +\index{integertype@\onyxop{}{integertype}{}} +\item[{\onyxop{integer depth}{integertype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[integer: ] + An integer object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{integer}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{integer}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> 42 +onyx:1> dup 0 integertype print `\n' print flush +42 +onyx:1> dup 1 integertype print `\n' print flush +42 +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:marktype} +\index{marktype@\onyxop{}{marktype}{}} +\item[{\onyxop{mark depth}{marktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{mark}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{mark}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> mark +onyx:1> dup 0 marktype print `\n' print flush +-mark- +onyx:1> dup 1 marktype print `\n' print flush +-mark- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:mutextype} +\index{mutextype@\onyxop{}{mutextype}{}} +\item[{\onyxop{mutex depth}{mutextype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{mutex}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{mutex}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> mutex +onyx:1> dup 0 mutextype print `\n' print flush +-mutex- +onyx:1> dup 1 mutextype print `\n' print flush +-mutex- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:nametype} +\index{nametype@\onyxop{}{nametype}{}} +\item[{\onyxop{name depth}{nametype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[name: ] + A name object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{name}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{name}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> $foo +onyx:1> dup 0 nametype print `\n' print flush +$foo +onyx:1> dup 1 nametype print `\n' print flush +$foo +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:nulltype} +\index{nulltype@\onyxop{}{nulltype}{}} +\item[{\onyxop{null depth}{nulltype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[null: ] + A null object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{null}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{null}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> null +onyx:1> dup 0 nulltype print `\n' print flush +-null- +onyx:1> dup 1 nulltype print `\n' print flush +-null- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:operatortype} +\index{operatortype@\onyxop{}{operatortype}{}} +\item[{\onyxop{operator depth}{operatortype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[operator: ] + An operator object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{operator}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{operator}. + \item[Example(s): ] + The following example shows an operator printed out with two + leading and trailing dashes. If the interpreter cannot + determine the name associated with an operator, as will be the + case for custom operators, the operator will be printed as + {\tt -operator-}. + \begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> ~realtime +onyx:1> dup 0 operatortype print `\n' print flush +--realtime-- +onyx:1> 1 operatortype print `\n' print flush +--realtime-- +onyx:0> + \end{verbatim} + \end{description} +\label{sprintsdict:pmarktype} +\index{pmarktype@\onyxop{}{pmarktype}{}} +\item[{\onyxop{pmark depth}{pmarktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[pmark: ] + A pmark object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{pmark}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{pmark}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> { ~x +Error $undefined +ostack: (-pmark- $x) +dstack: (-dict- -dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- +onyx:3> pop pop resume +onyx:1> dup 0 pmarktype print `\n' print flush +-pmark- +onyx:1> dup 1 pmarktype print `\n' print flush +-pmark- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:regextype} +\index{regextype@\onyxop{}{regextype}{}} +\item[{\onyxop{regex depth}{regextype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[regex: ] + A regex object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{regex}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{regex}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> `' regex +onyx:1> dup 0 regextype print `\n' print flush +-regex- +onyx:1> dup 1 regextype print `\n' print flush +-regex- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:regsubtype} +\index{regsubtype@\onyxop{}{regsubtype}{}} +\item[{\onyxop{regsub depth}{regsubtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[regsub: ] + A regsub object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{regsub}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{regsub}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> `' `' regsub +onyx:1> dup 0 regsubtype print `\n' print flush +-regsub- +onyx:1> dup 1 regsubtype print `\n' print flush +-regsub- +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:realtype} +\index{realtype@\onyxop{}{realtype}{}} +\item[{\onyxop{real depth}{realtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[real: ] + A real object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{real}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{real}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> 42.0 +onyx:1> dup 0 realtype print `\n' print flush +4.200000e+01 +onyx:1> dup 1 realtype print `\n' print flush +4.200000e+01 +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:stacktype} +\index{stacktype@\onyxop{}{stacktype}{}} +\item[{\onyxop{stack depth}{stacktype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> (1 (2 3) 4) +onyx:1> dup 0 stacktype print `\n' print flush +-stack- +onyx:1> dup 1 stacktype print `\n' print flush +(1 -stack- 4) +onyx:1> dup 2 stacktype print `\n' print flush +(1 (2 3) 4) +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:stringtype} +\index{stringtype@\onyxop{}{stringtype}{}} +\item[{\onyxop{string depth}{stringtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[string: ] + A string object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{string}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> `abcd' +onyx:1> dup 0 stringtype print `\n' print flush +`abcd' +onyx:1> dup 1 stringtype print `\n' print flush +`abcd' +onyx:1> + \end{verbatim} + \end{description} +\label{sprintsdict:threadtype} +\index{threadtype@\onyxop{}{threadtype}{}} +\item[{\onyxop{thread depth}{threadtype}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \item[depth: ] + Recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + Syntactical string representation of \oparg{thread}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{thread}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict begin +onyx:0> thread +onyx:1> dup 0 threadtype print `\n' print flush +-thread- +onyx:1> dup 1 threadtype print `\n' print flush +-thread- +onyx:1> + \end{verbatim} + \end{description} +\end{description} + +\subsection{systemdict} +\label{sec:systemdict} +\index{systemdict@\onyxop{}{systemdict}{}} + +The systemdict dictionary contains most of the operators that are of general +use. Although there are no mechanisms that prevent modification of systemdict, +programs should not normally need to modify systemdict, since globaldict +provides a place for storing globally shared objects. All threads share the +same systemdict, which is implicitly locked. + +\begin{longtable}{\optableformat{4.10}} +\caption{systemdict summary} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\multicolumn{2}{|l|}{Operand stack operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{mark}{systemdict:mark}}} + {mark} + {Create a mark.} +\hline +\optableent + {\commas obj} + {{\bf \htmlref{aup}{systemdict:aup}}} + {obj \commas} + {Rotate stack up one position.} +\hline +\optableent + {obj \commas} + {{\bf \htmlref{adn}{systemdict:adn}}} + {\commas obj} + {Rotate stack down one position.} +\hline +\optableent + {--} + {{\bf \htmlref{count}{systemdict:count}}} + {count} + {Get the number of objects on ostack.} +\hline +\optableent + {mark \dots} + {{\bf \htmlref{counttomark}{systemdict:counttomark}}} + {mark \dots count} + {Get the depth of the topmost mark on ostack.} +\hline +\optableent + {obj} + {{\bf \htmlref{dup}{systemdict:dup}}} + {obj dup} + {Duplicate an object.} +\hline +\optableent + {obj \commas} + {{\bf \htmlref{bdup}{systemdict:bdup}}} + {obj \commas dup} + {Duplicate bottom object.} +\hline +\optableent + {objects count} + {{\bf \htmlref{ndup}{systemdict:ndup}}} + {objects objects} + {Duplicate objects.} +\hline +\optableent + {obj \dots index} + {{\bf \htmlref{idup}{systemdict:idup}}} + {obj \dots dup} + {Duplicate object on ostack at index.} +\hline +\optableent + {\dots obj \commas index} + {{\bf \htmlref{ibdup}{systemdict:ibdup}}} + {\dots obj \commas dup} + {Duplicate object on ostack at index from bottom.} +\hline +\optableent + {a b} + {{\bf \htmlref{tuck}{systemdict:tuck}}} + {b a b} + {Tuck duplicate of top object under second object.} +\hline +\optableent + {a b} + {{\bf \htmlref{under}{systemdict:under}}} + {a a b} + {Duplicate second object.} +\hline +\optableent + {a b} + {{\bf \htmlref{over}{systemdict:over}}} + {a b a} + {Duplicate second object.} +\hline +\optableent + {a b} + {{\bf \htmlref{exch}{systemdict:exch}}} + {b a} + {Exchange top two objects.} +\hline +\optableent + {a b c} + {{\bf \htmlref{up}{systemdict:up}}} + {c a b} + {Roll top three objects up one.} +\hline +\optableent + {a \dots b count} + {{\bf \htmlref{nup}{systemdict:nup}}} + {b a \dots} + {Roll count objects up one.} +\hline +\optableent + {a b c} + {{\bf \htmlref{dn}{systemdict:dn}}} + {b c a} + {Roll top three objects down one.} +\hline +\optableent + {a \dots b count} + {{\bf \htmlref{ndn}{systemdict:ndn}}} + {\dots b a} + {Roll count objects down one.} +\hline +\optableent + {\dots amount} + {{\bf \htmlref{rot}{systemdict:rot}}} + {\dots} + {Rotate stack up by \oparg{amount}.} +\hline +\optableent + {region count amount} + {{\bf \htmlref{roll}{systemdict:roll}}} + {rolled} + {Roll \oparg{count} objects up by \oparg{amount}.} +\hline +\optableent + {obj} + {{\bf \htmlref{pop}{systemdict:pop}}} + {--} + {Remove object.} +\hline +\optableent + {obj \commas} + {{\bf \htmlref{bpop}{systemdict:bpop}}} + {\commas} + {Remove bottom object.} +\hline +\optableent + {objects count} + {{\bf \htmlref{npop}{systemdict:npop}}} + {--} + {Remove count objects.} +\hline +\optableent + {objects \dots count} + {{\bf \htmlref{nbpop}{systemdict:nbpop}}} + {\dots} + {Remove count objects from bottom.} +\hline +\optableent + {obj \dots index} + {{\bf \htmlref{ipop}{systemdict:ipop}}} + {\dots} + {Remove object at index.} +\hline +\optableent + {\dots obj \commas index} + {{\bf \htmlref{ibpop}{systemdict:ibpop}}} + {\dots \commas} + {Remove object at index from bottom.} +\hline +\optableent + {a b} + {{\bf \htmlref{nip}{systemdict:nip}}} + {b} + {Remove second object.} +\hline +\optableent + {objects} + {{\bf \htmlref{clear}{systemdict:clear}}} + {--} + {Pop all objects off ostack.} +\hline +\optableent + {mark \dots} + {{\bf \htmlref{cleartomark}{systemdict:cleartomark}}} + {--} + {Remove objects from ostack through topmost mark.} +\hline +\optableent + {--} + {{\bf \htmlref{ostack}{systemdict:ostack}}} + {stack} + {Get a current ostack snapshot.} +\hline +\optableent + {thread} + {{\bf \htmlref{threadostack}{systemdict:threadostack}}} + {stack} + {Get a reference to thread's ostack.} +\hline \hline +\multicolumn{2}{|l|}{Execution, control, and execution stack operators} \\ +\hline \hline +\optableent + {obj} + {{\bf \htmlref{eval}{systemdict:eval}}} + {--} + {Evaluate object.} +\hline +\optableent + {boolean obj} + {{\bf \htmlref{if}{systemdict:if}}} + {--} + {Conditionally evaluate object.} +\hline +\optableent + {boolean a b} + {{\bf \htmlref{ifelse}{systemdict:ifelse}}} + {--} + {Conditionally evaluate one of two objects.} +\hline +\optableent + {init inc limit proc} + {{\bf \htmlref{for}{systemdict:for}}} + {--} + {Iterate with a control variable.} +\hline +\optableent + {count proc} + {{\bf \htmlref{repeat}{systemdict:repeat}}} + {--} + {Iterate a set number of times.} +\hline +\optableent + {cond proc} + {{\bf \htmlref{while}{systemdict:while}}} + {--} + { Loop while cond is true.} +\hline +\optableent + {proc cond} + {{\bf \htmlref{until}{systemdict:until}}} + {--} + { Loop until cond is false.} +\hline +\optableent + {proc} + {{\bf \htmlref{loop}{systemdict:loop}}} + {--} + { Loop indefinitely.} +\hline +\optableent + {array proc} + {{\bf \htmlref{foreach}{systemdict:foreach}}} + {--} + {Iterate on array elements.} +\optableent + {dict proc} + {{\bf \htmlref{foreach}{systemdict:foreach}}} + {--} + {Iterate on dictionary key/value pairs.} +\optableent + {stack proc} + {{\bf \htmlref{foreach}{systemdict:foreach}}} + {--} + {Iterate on stack elements.} +\optableent + {string proc} + {{\bf \htmlref{foreach}{systemdict:foreach}}} + {--} + {Iterate on string elements.} +\hline +\optableent + {--} + {{\bf \htmlref{exit}{systemdict:exit}}} + {--} + {Terminate innermost looping context.} +\hline +\optableent + {file/string} + {{\bf \htmlref{token}{systemdict:token}}} + {false} + {Unsuccessfully scan for a token.} +\optableent + {file/string} + {{\bf \htmlref{token}{systemdict:token}}} + {rem obj true} + {Successfully scan for a token} +\hline +\optableent + {obj} + {{\bf \htmlref{start}{systemdict:start}}} + {--} + {Evaluate object.} +\hline +\optableent + {--} + {{\bf \htmlref{quit}{systemdict:quit}}} + {--} + {Unwind to innermost start context.} +\hline +\optableent + {obj} + {{\bf \htmlref{stopped}{systemdict:stopped}}} + {boolean} + {Evaluate object.} +\hline +\optableent + {--} + {{\bf \htmlref{stop}{systemdict:stop}}} + {--} + {Unwind to innermost stopped or start context.} +\hline +\optableent + {name} + {{\bf \htmlref{throw}{systemdict:throw}}} + {obj} + {Throw an error.} +\hline +\optableent + {--} + {{\bf \htmlref{estack}{systemdict:estack}}} + {stack} + {Get a current estack snapshot.} +\hline +\optableent + {thread} + {{\bf \htmlref{threadestack}{systemdict:threadestack}}} + {stack} + {Get a reference to thread's estack.} +\hline +\optableent + {--} + {{\bf \htmlref{countestack}{systemdict:countestack}}} + {count} + {Get current estack depth.} +\hline +\optableent + {--} + {{\bf \htmlref{istack}{systemdict:istack}}} + {stack} + {Get a current istack snapshot.} +\hline +\optableent + {thread} + {{\bf \htmlref{threadistack}{systemdict:threadistack}}} + {stack} + {Get a reference to thread's istack.} +\hline +\optableent + {status} + {{\bf \htmlref{die}{systemdict:die}}} + {--} + {Exit program.} +\hline +\optableent + {path symbol} + {{\bf \htmlref{modload}{systemdict:modload}}} + {--} + {Load a module.} +\hline +\optableent + {file symbol} + {{\bf \htmlref{mrequire}{systemdict:mrequire}}} + {--} + {Search for and load a module.} +\hline +\optableent + {file} + {{\bf \htmlref{require}{systemdict:require}}} + {--} + {Search for and evaluate a source file.} +\hline +\optableent + {args} + {{\bf \htmlref{exec}{systemdict:exec}}} + {--} + {Overlay a new program and execute it.} +\hline +\optableent + {args} + {{\bf \htmlref{forkexec}{systemdict:forkexec}}} + {pid} + {Fork and exec a new process.} +\hline +\optableent + {pid} + {{\bf \htmlref{waitpid}{systemdict:waitpid}}} + {status} + {Wait for a program to terminate.} +\hline +\optableent + {args} + {{\bf \htmlref{system}{systemdict:system}}} + {status} + {Execute a program.} +\hline +\optableent + {--} + {{\bf \htmlref{pid}{systemdict:pid}}} + {pid} + {Get process ID.} +\hline +\optableent + {--} + {{\bf \htmlref{ppid}{systemdict:ppid}}} + {pid} + {Get parent's process ID.} +\hline +\optableent + {--} + {{\bf \htmlref{uid}{systemdict:uid}}} + {uid} + {Get the process's user ID.} +\hline +\optableent + {uid} + {{\bf \htmlref{setuid}{systemdict:setuid}}} + {boolean} + {Set the process's user ID.} +\hline +\optableent + {--} + {{\bf \htmlref{euid}{systemdict:euid}}} + {uid} + {Get the process's effective user ID.} +\hline +\optableent + {uid} + {{\bf \htmlref{seteuid}{systemdict:seteuid}}} + {boolean} + {Set the process's effective user ID.} +\hline +\optableent + {--} + {{\bf \htmlref{gid}{systemdict:gid}}} + {gid} + {Get the process's group ID.} +\hline +\optableent + {gid} + {{\bf \htmlref{setgid}{systemdict:setgid}}} + {boolean} + {Set the process's group ID.} +\hline +\optableent + {--} + {{\bf \htmlref{egid}{systemdict:egid}}} + {gid} + {Get the process's effective group ID.} +\hline +\optableent + {gid} + {{\bf \htmlref{setegid}{systemdict:setegid}}} + {boolean} + {Set the process's effective group ID.} +\hline +\optableent + {--} + {{\bf \htmlref{realtime}{systemdict:realtime}}} + {nsecs} + {Get the number of nanoseconds since the epoch.} +\hline +\optableent + {nanoseconds} + {{\bf \htmlref{nsleep}{systemdict:nsleep}}} + {--} + {Nanosleep.} +\hline \hline +\multicolumn{2}{|l|}{Stack operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{(}{systemdict:sym_lp}}} + {fino} + {Begin a stack declaration.} +\hline +\optableent + {fino objects} + {{\bf \htmlref{)}{systemdict:sym_rp}}} + {stack} + {Create a stack.} +\hline +\optableent + {--} + {{\bf \htmlref{stack}{systemdict:stack}}} + {stack} + {Create a stack.} +\hline +\optableent + {stack obj} + {{\bf \htmlref{spush}{systemdict:spush}}} + {--} + {Push object onto stack.} +\hline +\optableent + {stack obj} + {{\bf \htmlref{sbpush}{systemdict:sbpush}}} + {--} + {Push object onto bottom of stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{scount}{systemdict:scount}}} + {count} + {Get the number of objects on a stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{scounttomark}{systemdict:scounttomark}}} + {count} + {Get the depth of the topmost mark on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sdup}{systemdict:sdup}}} + {--} + {Duplicate an object.} +\hline +\optableent + {stack} + {{\bf \htmlref{sbdup}{systemdict:sbdup}}} + {--} + {Duplicate bottom object.} +\hline +\optableent + {stack count} + {{\bf \htmlref{sndup}{systemdict:sndup}}} + {--} + {Duplicate objects on stack.} +\hline +\optableent + {stack index} + {{\bf \htmlref{sidup}{systemdict:sidup}}} + {--} + {Duplicate object on stack at index.} +\hline +\optableent + {stack index} + {{\bf \htmlref{sibdup}{systemdict:sibdup}}} + {--} + {Duplicate object on stack at index from bottom.} +\hline +\optableent + {stack} + {{\bf \htmlref{stuck}{systemdict:stuck}}} + {--} + {Tuck duplicate of top object on stack under next object on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sunder}{systemdict:sunder}}} + {--} + {Duplicate second object on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sover}{systemdict:sover}}} + {--} + {Duplicate second object on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sexch}{systemdict:sexch}}} + {--} + {Exchange top objects on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sup}{systemdict:sup}}} + {--} + {Roll top three objects on stack up one.} +\hline +\optableent + {stack count} + {{\bf \htmlref{snup}{systemdict:snup}}} + {--} + {Roll count objects on stack up one.} +\hline +\optableent + {stack} + {{\bf \htmlref{saup}{systemdict:saup}}} + {--} + {Roll objects on stack up one.} +\hline +\optableent + {stack} + {{\bf \htmlref{sdn}{systemdict:sdn}}} + {--} + {Roll top three objects on stack down one.} +\hline +\optableent + {stack count} + {{\bf \htmlref{sndn}{systemdict:sndn}}} + {--} + {Roll count objects on stack down one.} +\hline +\optableent + {stack} + {{\bf \htmlref{sadn}{systemdict:sadn}}} + {--} + {Roll objects on stack down one.} +\hline +\optableent + {stack amount} + {{\bf \htmlref{srot}{systemdict:srot}}} + {--} + {Rotate objects on stack up by \oparg{amount}.} +\hline +\optableent + {stack count amount} + {{\bf \htmlref{sroll}{systemdict:sroll}}} + {--} + {Roll objects on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{spop}{systemdict:spop}}} + {obj} + {Pop object off stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sbpop}{systemdict:sbpop}}} + {obj} + {Pop object off bottom of stack.} +\hline +\optableent + {stack count} + {{\bf \htmlref{snpop}{systemdict:snpop}}} + {array} + {Pop count objects off stack.} +\hline +\optableent + {stack count} + {{\bf \htmlref{snbpop}{systemdict:snbpop}}} + {array} + {Pop count objects off bottom of stack.} +\hline +\optableent + {stack index} + {{\bf \htmlref{sipop}{systemdict:sipop}}} + {obj} + {Remove object on stack at index.} +\hline +\optableent + {stack index} + {{\bf \htmlref{sibpop}{systemdict:sibpop}}} + {obj} + {Remove object on stack at index from bottom.} +\hline +\optableent + {stack} + {{\bf \htmlref{snip}{systemdict:snip}}} + {obj} + {Remove second object on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{sclear}{systemdict:sclear}}} + {--} + {Remove all objects on stack.} +\hline +\optableent + {stack} + {{\bf \htmlref{scleartomark}{systemdict:scleartomark}}} + {--} + {Remove objects from stack down through topmost mark.} +\hline +\optableent + {(a) (b)} + {{\bf \htmlref{cat}{systemdict:cat}}} + {(a b)} + {Catenate two stacks.} +\hline +\optableent + {stacks count} + {{\bf \htmlref{ncat}{systemdict:ncat}}} + {stack} + {Catenate stacks.} +\hline +\optableent + {srcstack dststack} + {{\bf \htmlref{copy}{systemdict:copy}}} + {dststack} + {Copy stack contents.} +\hline \hline +\multicolumn{2}{|l|}{Number (integer, real) and math operators} \\ +\hline \hline +\optableent + {a b} + {{\bf \htmlref{add}{systemdict:add}}} + {r} + {Add a and b.} +\hline +\optableent + {a} + {{\bf \htmlref{inc}{systemdict:inc}}} + {r} + {Add 1 to a.} +\hline +\optableent + {a b} + {{\bf \htmlref{sub}{systemdict:sub}}} + {r} + {Subtract b from a.} +\hline +\optableent + {a} + {{\bf \htmlref{dec}{systemdict:dec}}} + {r} + {Subtract 1 from a.} +\hline +\optableent + {a b} + {{\bf \htmlref{mul}{systemdict:mul}}} + {r} + {Multiply a and b.} +\hline +\optableent + {a b} + {{\bf \htmlref{div}{systemdict:div}}} + {r} + {Divide a by b.} +\hline +\optableent + {a b} + {{\bf \htmlref{idiv}{systemdict:idiv}}} + {r} + {Divide a by b (integers).} +\hline +\optableent + {a b} + {{\bf \htmlref{mod}{systemdict:mod}}} + {r} + {Mod a by b (integers and reals).} +\hline +\optableent + {a b} + {{\bf \htmlref{exp}{systemdict:pow}}} + {r} + {Raise a to the power of b.} +\hline +\optableent + {x} + {{\bf \htmlref{exp}{systemdict:exp}}} + {r} + {$e$ (base of natural logarithm) raised to x.} +\hline +\optableent + {a} + {{\bf \htmlref{sqrt}{systemdict:sqrt}}} + {r} + {Square root.} +\hline +\optableent + {a} + {{\bf \htmlref{ln}{systemdict:ln}}} + {r} + {Natural log.} +\hline +\optableent + {a} + {{\bf \htmlref{log}{systemdict:log}}} + {r} + {Base 10 log.} +\hline +\optableent + {a} + {{\bf \htmlref{abs}{systemdict:abs}}} + {r} + {Get the absolute value of a.} +\hline +\optableent + {a} + {{\bf \htmlref{neg}{systemdict:neg}}} + {r} + {Get the negative of a.} +\hline +\optableent + {a} + {{\bf \htmlref{ceiling}{systemdict:ceiling}}} + {r} + {Integer ceiling of a real.} +\hline +\optableent + {a} + {{\bf \htmlref{floor}{systemdict:floor}}} + {r} + {Integer floor of a real.} +\hline +\optableent + {a} + {{\bf \htmlref{round}{systemdict:round}}} + {r} + {Real rounded to integer.} +\hline +\optableent + {a} + {{\bf \htmlref{trunc}{systemdict:trunc}}} + {r} + {Integer from real with truncated fractional.} +\hline +\optableent + {a} + {{\bf \htmlref{sin}{systemdict:sin}}} + {r} + {Sine in radians.} +\hline +\optableent + {a} + {{\bf \htmlref{sinh}{systemdict:sinh}}} + {r} + {Hyperbolic sine.} +\hline +\optableent + {a} + {{\bf \htmlref{asin}{systemdict:asin}}} + {r} + {Arcsine.} +\hline +\optableent + {a} + {{\bf \htmlref{asinh}{systemdict:asinh}}} + {r} + {Hyperbolic arcsine.} +\hline +\optableent + {a} + {{\bf \htmlref{cos}{systemdict:cos}}} + {r} + {Cosine in radians.} +\hline +\optableent + {a} + {{\bf \htmlref{cosh}{systemdict:cosh}}} + {r} + {Hyperbolic cosine.} +\hline +\optableent + {a} + {{\bf \htmlref{acos}{systemdict:acos}}} + {r} + {Arc cosine.} +\hline +\optableent + {a} + {{\bf \htmlref{acosh}{systemdict:acosh}}} + {r} + {Hyperbolic arc cosine.} +\hline +\optableent + {x} + {{\bf \htmlref{tan}{systemdict:tan}}} + {r} + {Tangent of x in radians.} +\hline +\optableent + {x} + {{\bf \htmlref{tanh}{systemdict:tanh}}} + {r} + {Hyperbolic tangent.} +\hline +\optableent + {x} + {{\bf \htmlref{atan}{systemdict:atan}}} + {r} + {Arctangent.} +\hline +\optableent + {y x} + {{\bf \htmlref{atan2}{systemdict:atan2}}} + {r} + {Arctangent in radians of $\frac{y}{x}$.} +\hline +\optableent + {x} + {{\bf \htmlref{atanh}{systemdict:atanh}}} + {r} + {Hyperbolic arctangent.} +\hline +\optableent + {seed} + {{\bf \htmlref{srand}{systemdict:srand}}} + {--} + {Seed pseudo-random number generator.} +\hline +\optableent + {--} + {{\bf \htmlref{rand}{systemdict:rand}}} + {integer} + {Get a pseudo-random number.} +\hline \hline +\multicolumn{2}{|l|}{String operators} \\ +\hline \hline +\optableent + {length} + {{\bf \htmlref{string}{systemdict:string}}} + {string} + {Create a string.} +\hline +\optableent + {string} + {{\bf \htmlref{length}{systemdict:length}}} + {count} + {Get string length.} +\hline +\optableent + {string index} + {{\bf \htmlref{get}{systemdict:get}}} + {integer} + {Get string element.} +\hline +\optableent + {string index integer} + {{\bf \htmlref{put}{systemdict:put}}} + {--} + {Set string element.} +\hline +\optableent + {string index length} + {{\bf \htmlref{getinterval}{systemdict:getinterval}}} + {substring} + {Get a string interval.} +\hline +\optableent + {string index substring} + {{\bf \htmlref{putinterval}{systemdict:putinterval}}} + {--} + {Copy substring into string.} +\hline +\optableent + {`a' `b'} + {{\bf \htmlref{cat}{systemdict:cat}}} + {`ab'} + {Catenate two strings.} +\hline +\optableent + {strings count} + {{\bf \htmlref{ncat}{systemdict:ncat}}} + {string} + {Catenate strings.} +\hline +\optableent + {srcstring dststring} + {{\bf \htmlref{copy}{systemdict:copy}}} + {dstsubstring} + {Copy string.} +\hline +\optableent + {obj depth} + {{\bf \htmlref{sprints}{systemdict:sprints}}} + {string} + {Create syntactical string from object.} +\hline +\optableent + {obj flags} + {{\bf \htmlref{outputs}{systemdict:outputs}}} + {string} + {Create formatted string from object.} +\hline +\optableent + {string pattern} + {{\bf \htmlref{search}{systemdict:search}}} + {post pattern pre true} + {Successfully search for pattern.} +\optableent + {string pattern} + {{\bf \htmlref{search}{systemdict:search}}} + {string false} + {Unsuccessfully earch for pattern.} +\hline \hline +\multicolumn{2}{|l|}{Name operators} \\ +\hline \hline +\optableent + {name} + {{\bf \htmlref{length}{systemdict:length}}} + {count} + {Get name length.} +\hline \hline +\multicolumn{2}{|l|}{Array operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{argv}{systemdict:argv}}} + {args} + {Get program arguments.} +\hline +\optableent + {--} + {{\bf \htmlref{[}{systemdict:sym_lb}}} + {mark} + {Begin an array declaration.} +\hline +\optableent + {mark objects} + {{\bf \htmlref{]}{systemdict:sym_rb}}} + {array} + {Construct an array.} +\hline +\optableent + {length} + {{\bf \htmlref{array}{systemdict:array}}} + {array} + {Create an array.} +\hline +\optableent + {array} + {{\bf \htmlref{length}{systemdict:length}}} + {count} + {Get array length.} +\hline +\optableent + {array index} + {{\bf \htmlref{get}{systemdict:get}}} + {obj} + {Get array element.} +\hline +\optableent + {array index obj} + {{\bf \htmlref{put}{systemdict:put}}} + {--} + {Set array element.} +\hline +\optableent + {array index length} + {{\bf \htmlref{getinterval}{systemdict:getinterval}}} + {subarray} + {Get an array interval.} +\hline +\optableent + {array index subarray} + {{\bf \htmlref{putinterval}{systemdict:putinterval}}} + {--} + {Copy subarray into array.} +\hline +\optableent + {[a] [b]} + {{\bf \htmlref{cat}{systemdict:cat}}} + {[a b]} + {Catenate two arrays.} +\hline +\optableent + {arrays count} + {{\bf \htmlref{ncat}{systemdict:ncat}}} + {array} + {Catenate arrays.} +\hline +\optableent + {srcarray dstarray} + {{\bf \htmlref{copy}{systemdict:copy}}} + {dstsubarray} + {Copy array.} +\hline \hline +\multicolumn{2}{|l|}{Dictionary and dictionary stack operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{gcdict}{systemdict:gcdict}}} + {dict} + {Get gcdict.} +\hline +\optableent + {--} + {{\bf \htmlref{userdict}{systemdict:userdict}}} + {dict} + {Get userdict.} +\hline +\optableent + {--} + {{\bf \htmlref{globaldict}{systemdict:globaldict}}} + {dict} + {Get globaldict.} +\hline +\optableent + {--} + {{\bf \htmlref{systemdict}{systemdict:systemdict}}} + {dict} + {Get systemdict.} +\hline +\optableent + {--} + {{\bf \htmlref{onyxdict}{systemdict:onyxdict}}} + {dict} + {Get onyxdict.} +\hline +\optableent + {--} + {{\bf \htmlref{sprintsdict}{systemdict:sprintsdict}}} + {dict} + {Get sprintsdict.} +\hline +\optableent + {--} + {{\bf \htmlref{outputsdict}{systemdict:outputsdict}}} + {dict} + {Get outputsdict.} +\hline +\optableent + {--} + {{\bf \htmlref{envdict}{systemdict:envdict}}} + {dict} + {Get envdict.} +\hline +\optableent + {--} + {{\bf \htmlref{threadsdict}{systemdict:threadsdict}}} + {dict} + {Get threadsdict.} +\hline +\optableent + {key val} + {{\bf \htmlref{setenv}{systemdict:setenv}}} + {--} + {Set environment variable.} +\hline +\optableent + {key} + {{\bf \htmlref{unsetenv}{systemdict:unsetenv}}} + {--} + {Unset environment variable.} +\hline +\optableent + {--} + {{\bf \htmlref{{\lt}}{systemdict:sym_lt}}} + {mark} + {Begin a dictionary declaration.} +\hline +\optableent + {mark kvpairs} + {{\bf \htmlref{{\gt}}{systemdict:sym_gt}}} + {dict} + {Construct a dictionary.} +\hline +\optableent + {--} + {{\bf \htmlref{dict}{systemdict:dict}}} + {dict} + {Create a dictionary.} +\hline +\optableent + {dict} + {{\bf \htmlref{begin}{systemdict:begin}}} + {--} + {Pust dict onto dstack.} +\hline +\optableent + {--} + {{\bf \htmlref{end}{systemdict:end}}} + {--} + {Pop a dictionary off dstack.} +\hline +\optableent + {key val} + {{\bf \htmlref{def}{systemdict:def}}} + {--} + {Define key/value pair.} +\hline +\optableent + {dict key} + {{\bf \htmlref{undef}{systemdict:undef}}} + {--} + {Undefine key in dict.} +\hline +\optableent + {key} + {{\bf \htmlref{load}{systemdict:load}}} + {val} + {Look up a key's value.} +\hline +\optableent + {dict key} + {{\bf \htmlref{known}{systemdict:known}}} + {boolean} + {Check for key in dict.} +\hline +\optableent + {key} + {{\bf \htmlref{where}{systemdict:where}}} + {false} + {Unsuccessfully get topmost dstack dictionary that defines key.} +\hline +\optableent + {key} + {{\bf \htmlref{where}{systemdict:where}}} + {dict true} + {Successfully get topmost dstack dictionary that defines key.} +\hline +\optableent + {dict} + {{\bf \htmlref{length}{systemdict:length}}} + {count} + {Get number of dictionary key/value pairs.} +\hline +\optableent + {dict key} + {{\bf \htmlref{get}{systemdict:get}}} + {value} + {Get dict value associate with key.} +\hline +\optableent + {dict key value} + {{\bf \htmlref{put}{systemdict:put}}} + {--} + {Set dict key/value pair.} +\hline +\optableent + {srcdict dstdict} + {{\bf \htmlref{copy}{systemdict:copy}}} + {dstdict} + {Copy dictionary contents.} +\hline +\optableent + {--} + {{\bf \htmlref{currentdict}{systemdict:currentdict}}} + {dict} + {Get topmost dstack dictionary.} +\hline +\optableent + {--} + {{\bf \htmlref{dstack}{systemdict:dstack}}} + {stack} + {Get dstack snapshot.} +\hline +\optableent + {thread} + {{\bf \htmlref{threaddstack}{systemdict:threaddstack}}} + {stack} + {Get a reference to thread's dstack.} +\hline +\optableent + {--} + {{\bf \htmlref{countdstack}{systemdict:countdstack}}} + {count} + {Get number of stacks on dstack.} +\hline \hline +\multicolumn{2}{|l|}{File and filesystem operators} \\ +\hline \hline +\optableent + {filename flags} + {{\bf \htmlref{open}{systemdict:open}}} + {file} + {Open a file.} +\optableent + {filename flags mode} + {{\bf \htmlref{open}{systemdict:open}}} + {file} + {Open a file, creation mode specified.} +\hline +\optableent + {--} + {{\bf \htmlref{pipe}{systemdict:pipe}}} + {rfile wfile} + {Create a pipe.} +\hline +\optableent + {file} + {{\bf \htmlref{close}{systemdict:close}}} + {--} + {Close file.} +\hline +\optableent + {file} + {{\bf \htmlref{read}{systemdict:read}}} + {integer boolean} + {Read from file.} +\optableent + {file string} + {{\bf \htmlref{read}{systemdict:read}}} + {substring boolean} + {Read from file.} +\optableent + {file} + {{\bf \htmlref{readline}{systemdict:readline}}} + {string boolean} + {Read a line from file.} +\hline +\optableent + {{\lt}file dict \dots{\gt} timeout} + {{\bf \htmlref{poll}{systemdict:poll}}} + {{\lb}file \dots{\rb}} + {Wait for file(s) to change status.} +\hline +\optableent + {file} + {{\bf \htmlref{bytesavailable}{systemdict:bytesavailable}}} + {count} + {Get number of buffered readable bytes.} +\hline +\optableent + {file} + {{\bf \htmlref{iobuf}{systemdict:iobuf}}} + {count} + {Get size of I/O buffer.} +\hline +\optableent + {file count} + {{\bf \htmlref{setiobuf}{systemdict:setiobuf}}} + {--} + {Set size of I/O buffer.} +\hline +\optableent + {file} + {{\bf \htmlref{nonblocking}{systemdict:nonblocking}}} + {boolean} + {Get non-blocking mode.} +\hline +\optableent + {file boolean} + {{\bf \htmlref{setnonblocking}{systemdict:setnonblocking}}} + {--} + {Set non-blocking mode.} +\hline +\optableent + {file integer/string} + {{\bf \htmlref{write}{systemdict:write}}} + {false} + {Write to file.} +\optableent + {file integer/string} + {{\bf \htmlref{write}{systemdict:write}}} + {integer/substring true} + {Write to file.} +\hline +\optableent + {string} + {{\bf \htmlref{print}{systemdict:print}}} + {--} + {Print string to stdout.} +\hline +\optableent + {obj depth} + {{\bf \htmlref{sprint}{systemdict:sprint}}} + {--} + {Syntactically print object to stdout.} +\hline +\optableent + {obj flags} + {{\bf \htmlref{output}{systemdict:output}}} + {--} + {Formatted print to stdout.} +\hline +\optableent + {--} + {{\bf \htmlref{pstack}{systemdict:pstack}}} + {--} + {Syntactically print ostack elements.} +\hline +\optableent + {file} + {{\bf \htmlref{flushfile}{systemdict:flushfile}}} + {--} + {Flush file buffer.} +\hline +\optableent + {--} + {{\bf \htmlref{flush}{systemdict:flush}}} + {--} + {Flush stdout buffer.} +\hline +\optableent + {file length} + {{\bf \htmlref{truncate}{systemdict:truncate}}} + {--} + {Truncate file.} +\hline +\optableent + {file offset} + {{\bf \htmlref{seek}{systemdict:seek}}} + {--} + {Move file position pointer.} +\hline +\optableent + {file} + {{\bf \htmlref{tell}{systemdict:tell}}} + {offset} + {Get file position pointer offset.} +\hline +\optableent + {path} + {{\bf \htmlref{mkdir}{systemdict:mkdir}}} + {--} + {Create a directory.} +\optableent + {path mode} + {{\bf \htmlref{mkdir}{systemdict:mkdir}}} + {--} + {Create a directory, mode specified.} +\hline +\optableent + {path} + {{\bf \htmlref{mkfifo}{systemdict:mkfifo}}} + {--} + {Create a named pipe.} +\optableent + {path mode} + {{\bf \htmlref{mkfifo}{systemdict:mkfifo}}} + {--} + {Create a named pipe, mode specified.} +\hline +\optableent + {old new} + {{\bf \htmlref{rename}{systemdict:rename}}} + {--} + {Rename a file or directory.} +\hline +\optableent + {file/filename mode} + {{\bf \htmlref{chmod}{systemdict:chmod}}} + {--} + {Change file permissions.} +\hline +\optableent + {file/filename uid gid} + {{\bf \htmlref{chown}{systemdict:chown}}} + {--} + {Change file owner and group.} +\hline +\optableent + {filename linkname} + {{\bf \htmlref{link}{systemdict:link}}} + {--} + {Create a hard link.} +\hline +\optableent + {filename linkname} + {{\bf \htmlref{symlink}{systemdict:symlink}}} + {--} + {Create a symbolic link.} +\hline +\optableent + {filename} + {{\bf \htmlref{unlink}{systemdict:unlink}}} + {--} + {Unlink a file.} +\hline +\optableent + {path} + {{\bf \htmlref{rmdir}{systemdict:rmdir}}} + {--} + {Remove an empty directory.} +\hline +\optableent + {file/filename flag} + {{\bf \htmlref{test}{systemdict:test}}} + {boolean} + {Test a file.} +\hline +\optableent + {file/filename} + {{\bf \htmlref{status}{systemdict:status}}} + {dict} + {Get file information.} +\hline +\optableent + {linkname} + {{\bf \htmlref{readlink}{systemdict:readlink}}} + {string} + {Get symbolic link data.} +\hline +\optableent + {path proc} + {{\bf \htmlref{dirforeach}{systemdict:dirforeach}}} + {--} + {Iterate on directory entries.} +\hline +\optableent + {--} + {{\bf \htmlref{pwd}{systemdict:pwd}}} + {path} + {Get present working directory.} +\hline +\optableent + {path} + {{\bf \htmlref{cd}{systemdict:cd}}} + {--} + {Change present working directory.} +\hline +\optableent + {path} + {{\bf \htmlref{chroot}{systemdict:chroot}}} + {--} + {Change root directory.} +\hline +\optableent + {--} + {{\bf \htmlref{stdin}{systemdict:stdin}}} + {file} + {Get thread's stdin.} +\hline +\optableent + {--} + {{\bf \htmlref{stdout}{systemdict:stdout}}} + {file} + {Get thread's stdout.} +\hline +\optableent + {--} + {{\bf \htmlref{stderr}{systemdict:stderr}}} + {file} + {Get thread's stderr.} +\hline +\optableent + {--} + {{\bf \htmlref{gstdin}{systemdict:gstdin}}} + {file} + {Get global stdin.} +\hline +\optableent + {--} + {{\bf \htmlref{gstdout}{systemdict:gstdout}}} + {file} + {Get global stdout.} +\hline +\optableent + {--} + {{\bf \htmlref{gstderr}{systemdict:gstderr}}} + {file} + {Get global stderr.} +\hline +\optableent + {file} + {{\bf \htmlref{setstdin}{systemdict:setstdin}}} + {--} + {Set thread's stdin.} +\hline +\optableent + {file} + {{\bf \htmlref{setstdout}{systemdict:setstdout}}} + {--} + {Set thread's stdout.} +\hline +\optableent + {file} + {{\bf \htmlref{setstderr}{systemdict:setstderr}}} + {--} + {Set thread's stderr.} +\hline +\optableent + {file} + {{\bf \htmlref{setgstdin}{systemdict:setgstdin}}} + {--} + {Set global stdin.} +\hline +\optableent + {file} + {{\bf \htmlref{setgstdout}{systemdict:setgstdout}}} + {--} + {Set global stdout.} +\hline +\optableent + {file} + {{\bf \htmlref{setgstderr}{systemdict:setgstderr}}} + {--} + {Set global stderr.} +\hline \hline +\multicolumn{2}{|l|}{Socket and networking operators} \\ +\hline \hline +\optableent + {family type proto} + {{\bf \htmlref{socket}{systemdict:socket}}} + {sock} + {Create a socket.} +\optableent + {family type} + {{\bf \htmlref{socket}{systemdict:socket}}} + {sock} + {Create a socket.} +\hline +\optableent + {sock addr port} + {{\bf \htmlref{bindsocket}{systemdict:bindsocket}}} + {--} + {Bind socket to address/port.} +\optableent + {sock addr} + {{\bf \htmlref{bindsocket}{systemdict:bindsocket}}} + {--} + {Bind socket to address.} +\optableent + {sock path} + {{\bf \htmlref{bindsocket}{systemdict:bindsocket}}} + {--} + {Bind socket to port.} +\hline +\optableent + {sock backlog} + {{\bf \htmlref{listen}{systemdict:listen}}} + {--} + {Listen for socket connections.} +\optableent + {sock} + {{\bf \htmlref{listen}{systemdict:listen}}} + {--} + {Listen for socket connections.} +\hline +\optableent + {sock} + {{\bf \htmlref{accept}{systemdict:accept}}} + {sock} + {Accept a socket connection.} +\hline +\optableent + {sock addr port} + {{\bf \htmlref{connect}{systemdict:connect}}} + {--} + {Connect a socket.} +\optableent + {sock path} + {{\bf \htmlref{connect}{systemdict:connect}}} + {--} + {Connect a socket.} +\hline +\optableent + {service} + {{\bf \htmlref{serviceport}{systemdict:serviceport}}} + {port} + {Get port number for service name.} +\hline +\optableent + {sock} + {{\bf \htmlref{sockname}{systemdict:sockname}}} + {dict} + {Get socket information.} +\hline +\optableent + {sock level optname} + {{\bf \htmlref{sockopt}{systemdict:sockopt}}} + {optval} + {Get socket option.} +\optableent + {sock optname} + {{\bf \htmlref{sockopt}{systemdict:sockopt}}} + {optval} + {Get socket option.} +\hline +\optableent + {sock level optname optval} + {{\bf \htmlref{setsockopt}{systemdict:setsockopt}}} + {--} + {Set socket option.} +\optableent + {sock optname optval} + {{\bf \htmlref{setsockopt}{systemdict:setsockopt}}} + {--} + {Set socket option.} +\hline +\optableent + {sock} + {{\bf \htmlref{peername}{systemdict:peername}}} + {dict} + {Get peer socket information.} +\hline +\optableent + {sock mesg flags} + {{\bf \htmlref{send}{systemdict:send}}} + {nsend} + {Send a message.} +\optableent + {sock mesg} + {{\bf \htmlref{send}{systemdict:send}}} + {count} + {Send a message.} +\hline +\optableent + {sock string flags} + {{\bf \htmlref{recv}{systemdict:recv}}} + {substring} + {Receive a message.} +\optableent + {sock string} + {{\bf \htmlref{recv}{systemdict:recv}}} + {substring} + {Receive a message.} +\hline +\optableent + {family type proto} + {{\bf \htmlref{socketpair}{systemdict:socketpair}}} + {sock sock} + {Create a socket pair.} +\optableent + {family type} + {{\bf \htmlref{socketpair}{systemdict:socketpair}}} + {sock sock} + {Create a socket pair.} +\hline \hline +\multicolumn{2}{|l|}{Logical and bitwise operators} \\ +\hline \hline +\optableent + {a b} + {{\bf \htmlref{lt}{systemdict:lt}}} + {boolean} + {a less than b? (integer/real, string)} +\hline +\optableent + {a b} + {{\bf \htmlref{le}{systemdict:le}}} + {boolean} + {a less than or equal to b? (integer/real, string)} +\hline +\optableent + {a b} + {{\bf \htmlref{eq}{systemdict:eq}}} + {boolean} + {a equal to b? (any type)} +\hline +\optableent + {a b} + {{\bf \htmlref{ne}{systemdict:ne}}} + {boolean} + {a not equal to b? (any type)} +\hline +\optableent + {a b} + {{\bf \htmlref{ge}{systemdict:ge}}} + {boolean} + {a greater than or equal to b? (integer/real, string)} +\hline +\optableent + {a b} + {{\bf \htmlref{gt}{systemdict:gt}}} + {boolean} + {a greater than b? (integer/real, string)} +\hline +\optableent + {a b} + {{\bf \htmlref{and}{systemdict:and}}} + {r} + {Logical/bitwise and. (boolean/integer) } +\hline +\optableent + {a b} + {{\bf \htmlref{or}{systemdict:or}}} + {r} + {Logical/bitwise or. (boolean/integer)} +\hline +\optableent + {a b} + {{\bf \htmlref{xor}{systemdict:xor}}} + {r} + {Logical/bitwise exclusive or. (boolean/integer)} +\hline +\optableent + {a} + {{\bf \htmlref{not}{systemdict:not}}} + {r} + {Logical/bitwise not. (boolean/integer)} +\hline +\optableent + {a shift} + {{\bf \htmlref{shift}{systemdict:shift}}} + {integer} + {Bitwise shift.} +\hline +\optableent + {--} + {{\bf \htmlref{false}{systemdict:false}}} + {false} + {Return true.} +\hline +\optableent + {--} + {{\bf \htmlref{true}{systemdict:true}}} + {true} + {Return false.} +\hline \hline +\multicolumn{2}{|l|}{Type, conversion, and attribute operators} \\ +\hline \hline +\optableent + {obj} + {{\bf \htmlref{type}{systemdict:type}}} + {name} + {Get object type.} +\hline +\optableent + {obj} + {{\bf \htmlref{echeck}{systemdict:echeck}}} + {boolean} + {Evaluatable?} +\hline +\optableent + {obj} + {{\bf \htmlref{xcheck}{systemdict:xcheck}}} + {boolean} + {Executable?} +\hline +\optableent + {obj} + {{\bf \htmlref{cve}{systemdict:cve}}} + {obj} + {Set evaluatable attribute.} +\hline +\optableent + {obj} + {{\bf \htmlref{cvx}{systemdict:cvx}}} + {obj} + {Set executable attribute.} +\hline +\optableent + {obj} + {{\bf \htmlref{cvlit}{systemdict:cvlit}}} + {obj} + {Set literal attribute.} +\hline +\optableent + {string} + {{\bf \htmlref{cvn}{systemdict:cvn}}} + {name} + {Convert string to name.} +\hline +\optableent + {obj} + {{\bf \htmlref{cvs}{systemdict:cvs}}} + {string} + {Convert object to string.} +\hline +\optableent + {integer radix} + {{\bf \htmlref{cvrs}{systemdict:cvrs}}} + {string} + {Convert integer to radix string.} +\hline +\optableent + {real precision} + {{\bf \htmlref{cvds}{systemdict:cvds}}} + {string} + {Convert real to decimal string.} +\hline +\optableent + {real precision} + {{\bf \htmlref{cves}{systemdict:cves}}} + {string} + {Convert real to exponential string.} +\hline +\optableent + {hook} + {{\bf \htmlref{hooktag}{systemdict:hooktag}}} + {tag} + {Get hook tag.} +\hline \hline +\multicolumn{2}{|l|}{Threading and synchronization operators} \\ +\hline \hline +\optableent + {stack entry} + {{\bf \htmlref{thread}{systemdict:thread}}} + {thread} + {Create and run a thread.} +\hline +\optableent + {--} + {{\bf \htmlref{self}{systemdict:self}}} + {thread} + {Get a thread object for the running thread.} +\hline +\optableent + {thread} + {{\bf \htmlref{join}{systemdict:join}}} + {--} + {Wait for thread to exit.} +\hline +\optableent + {thread} + {{\bf \htmlref{detach}{systemdict:detach}}} + {--} + {Detach thread.} +\hline +\optableent + {--} + {{\bf \htmlref{yield}{systemdict:yield}}} + {--} + {Voluntarily yield the processor.} +\hline +\optableent + {--} + {{\bf \htmlref{mutex}{systemdict:mutex}}} + {mutex} + {Create a mutex.} +\hline +\optableent + {mutex proc} + {{\bf \htmlref{monitor}{systemdict:mutex}}} + {--} + {Evaluate an object under the protection of a mutex.} +\hline +\optableent + {mutex} + {{\bf \htmlref{lock}{systemdict:lock}}} + {--} + {Acquire mutex.} +\hline +\optableent + {mutex} + {{\bf \htmlref{trylock}{systemdict:trylock}}} + {boolean} + {Try to acquire mutex.} +\hline +\optableent + {mutex} + {{\bf \htmlref{unlock}{systemdict:unlock}}} + {--} + {Release mutex.} +\hline +\optableent + {--} + {{\bf \htmlref{condition}{systemdict:condition}}} + {condition} + {Create a condition variable.} +\hline +\optableent + {condition mutex} + {{\bf \htmlref{wait}{systemdict:wait}}} + {--} + {Wait on condition.} +\hline +\optableent + {condition mutex timeout} + {{\bf \htmlref{timedwait}{systemdict:timedwait}}} + {boolean} + {Wait on condition with timeout.} +\hline +\optableent + {condition} + {{\bf \htmlref{signal}{systemdict:signal}}} + {--} + {Signal a condition waiter.} +\hline +\optableent + {condition} + {{\bf \htmlref{broadcast}{systemdict:broadcast}}} + {--} + {Signal all condition waiters.} +\hline +\optableent + {--} + {{\bf \htmlref{currentlocking}{systemdict:currentlocking}}} + {boolean} + {Get implicit locking mode.} +\hline +\optableent + {boolean} + {{\bf \htmlref{setlocking}{systemdict:setlocking}}} + {--} + {Set implicit locking mode.} +\hline +\optableent + {obj} + {{\bf \htmlref{lcheck}{systemdict:lcheck}}} + {boolean} + {Implicitly locked?} +\hline \hline +\multicolumn{2}{|l|}{Regular expression operators} \\ +\hline \hline +\optableent + {string flags} + {{\bf \htmlref{regex}{systemdict:regex}}} + {regex} + {Create a regex object.} +\optableent + {string} + {{\bf \htmlref{regex}{systemdict:regex}}} + {regex} + {Create a regex object.} +\hline +\optableent + {input pattern flags} + {{\bf \htmlref{match}{systemdict:match}}} + {boolean} + {Find pattern matches in input string.} +\optableent + {input pattern} + {{\bf \htmlref{match}{systemdict:match}}} + {boolean} + {Find pattern matches in input string.} +\optableent + {input regex} + {{\bf \htmlref{match}{systemdict:match}}} + {boolean} + {Find regex matches in input string.} +\hline +\optableent + {input pattern flags limit} + {{\bf \htmlref{split}{systemdict:split}}} + {array} + {Split input into an array of substrings.} +\optableent + {input pattern flags} + {{\bf \htmlref{split}{systemdict:split}}} + {array} + {Split input into an array of substrings.} +\optableent + {input pattern limit} + {{\bf \htmlref{split}{systemdict:split}}} + {array} + {Split input into an array of substrings.} +\optableent + {input pattern} + {{\bf \htmlref{split}{systemdict:split}}} + {array} + {Split input into an array of substrings.} +\optableent + {input regex limit} + {{\bf \htmlref{split}{systemdict:split}}} + {array} + {Split input into an array of substrings.} +\optableent + {input regex} + {{\bf \htmlref{split}{systemdict:split}}} + {array} + {Split input into an array of substrings.} +\hline +\optableent + {integer} + {{\bf \htmlref{submatch}{systemdict:submatch}}} + {substring} + {Get capturing subpattern match.} +\hline +\optableent + {input submatch} + {{\bf \htmlref{offset}{systemdict:offset}}} + {offset} + {Get submatch offset from beginning of input.} +\hline +\optableent + {pattern template flags} + {{\bf \htmlref{regsub}{systemdict:regsub}}} + {regsub} + {Create a regsub object.} +\optableent + {pattern template} + {{\bf \htmlref{regsub}{systemdict:regsub}}} + {regsub} + {Create a regsub object.} +\hline +\optableent + {input pattern template flags} + {{\bf \htmlref{subst}{systemdict:subst}}} + {output count} + {Substitute template for pattern matches.} +\optableent + {input pattern template} + {{\bf \htmlref{subst}{systemdict:subst}}} + {output count} + {Substitute template for pattern matches.} +\optableent + {input regsub} + {{\bf \htmlref{subst}{systemdict:subst}}} + {output count} + {Substitute.} +\hline \hline +\multicolumn{2}{|l|}{Miscellaneous operators} \\ +\hline \hline +\optableent + {--} + {{\bf \htmlref{product}{systemdict:product}}} + {string} + {Get the product string.} +\hline +\optableent + {--} + {{\bf \htmlref{version}{systemdict:version}}} + {string} + {Get the version string.} +\hline +\optableent + {proc} + {{\bf \htmlref{bind}{systemdict:bind}}} + {proc} + {Bind names to operators.} +\hline +\optableent + {--} + {{\bf \htmlref{null}{systemdict:null}}} + {null} + {Create a null object.} +\end{longtable} + +%% \label{systemdict:OPNAME} +%% \index{OPNAME@\onyxop{}{OPNAME}{}} +%% \item[{\onyxop{OPARGS}{OPNAME}{OPOUTS}}: ] +%% \begin{description}\item[] +%% \item[Input(s): ] +%% \begin{description}\item[] +%% \item[: ] +%% \end{description} +%% \item[Output(s): ] +%% \begin{description}\item[] +%% \item[: ] +%% \end{description} +%% \item[Errors(s): ] +%% \begin{description}\item[] +%% \item[\htmlref{stackunderflow}{stackunderflow}.] +%% \item[\htmlref{typecheck}{typecheck}.] +%% \end{description} +%% \item[Description: ] +%% \item[Example(s): ]\begin{verbatim} + +%% \end{verbatim} +%% \end{description} + +\begin{description} +\label{systemdict:sym_lp} +\index{(@\onyxop{}{(}{}} +\item[{\onyxop{--}{(}{fino}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[fino: ] + A fino object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Push a fino object onto ostack to denote the bottom of a stack + that has not yet been constructed. + \item[Example(s): ]\begin{verbatim} + +onyx:0> ( +onyx:1> pstack +-fino- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sym_rp} +\index{)@\onyxop{}{)}{}} +\item[{\onyxop{fino objects}{)}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[fino: ] + A fino object, usually created by the \onyxop{}{)}{} + operator. + \item[objects: ] + 0 or more objects. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{unmatchedfino}{unmatchedfino}.] + \end{description} + \item[Description: ] + Create a stack object and move all objects from ostack down to + the first fino object to the new stack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> () +onyx:1> 1 sprint +() +onyx:0> (1 2 +onyx:3> pstack +2 +1 +-fino- +onyx:3> ) +onyx:1> 1 sprint +(1 2) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sym_lt} +\index{<@\onyxop{}{{\lt}}{}} +\item[{\onyxop{--}{{\lt}}{mark}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Begin a dictionary declaration. See the + \htmlref{\onyxop{}{>}{}}{systemdict:sym_gt} operator + documentation for more details on dictionary construction. + \item[Example(s): ]\begin{verbatim} + +onyx:0> < 1 sprint +-mark- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sym_gt} +\index{>@\onyxop{}{{\gt}}{}} +\item[{\onyxop{mark kvpairs}{{\gt}}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \item[kvpairs: ] + Zero or more pairs of non-mark objects, where the first + is a key and the second is an associated value. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary that contains \oparg{kvpairs}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{unmatchedmark}{unmatchedmark}.] + \end{description} + \item[Description: ] + Construct a dictionary that contains \oparg{kvpairs}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> < +onyx:1> $foo `foo' +onyx:3> $bar `bar' +onyx:5> $biz `biz' +onyx:7> $pop ~pop +onyx:9> > +onyx:1> pstack +<$pop --pop-- $biz `biz' $bar `bar' $foo `foo'> +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sym_lb} +\index{[@\onyxop{}{{\lb}}{}} +\item[{\onyxop{--}{{\lb}}{mark}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Begin an array declaration. See the + \htmlref{\onyxop{}{]}{}}{systemdict:sym_rb} operator + documentation for more details on array construction. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [ 1 sprint +-mark- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sym_rb} +\index{]@\onyxop{}{{\rb}}{}} +\item[{\onyxop{mark objects}{{\rb}}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \item[objects: ] + Zero or more non-mark objects. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array that contains \oparg{objects}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{unmatchedmark}{unmatchedmark}.] + \end{description} + \item[Description: ] + Construct an array that contains all \oparg{objects} on ostack + down to the first \oparg{mark}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> mark 1 2 3 ] 1 sprint +[1 2 3] + \end{verbatim} + \end{description} +\label{systemdict:abs} +\index{abs@\onyxop{}{abs}{}} +\item[{\onyxop{a}{abs}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Absolute value of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the absolute value of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 5 abs 1 sprint +5 +onyx:0> -5 abs 1 sprint +5 +onyx:0> 3.14 abs 1 sprint +3.140000e+00 +onyx:0> -3.14 abs 1 sprint +3.140000e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:accept} +\index{accept@\onyxop{}{accept}{}} +\item[{\onyxop{sock}{accept}{sock}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A listening socket. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[sock: ] + A socket that is connected to a client. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Accept a connection and create a socket that is connected to a + client. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup `localhost' 7777 bindsocket +onyx:1> dup listen +onyx:1> dup accept +onyx:2> dup peername 1 sprint +<$family $AF_INET $address 2130706433 $port 33742> +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:acos} +\index{acos@\onyxop{}{acos}{}} +\item[{\onyxop{a}{acos}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Arc cosine of \oparg{a} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the arc cosine of \oparg{a} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 acos 1 sprint +0.000000e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:acosh} +\index{acosh@\onyxop{}{acosh}{}} +\item[{\onyxop{a}{acosh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Hyperbolic arc cosine of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the hyperbolic arc cosine of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 10 acosh 1 sprint +2.993223e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:add} +\index{add@\onyxop{}{add}{}} +\item[{\onyxop{a b}{add}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \item[b: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The sum of \oparg{a} and \oparg{b}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the sum of \oparg{a} and \oparg{b}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 2 2 add 1 sprint +4 +onyx:0> -1 3 add 1 sprint +2 +onyx:0> 2.0 3.1 add 1 sprint +5.100000e+00 +onyx:0> -1.5 +3e1 add 1 sprint +2.850000e+01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:adn} +\index{adn@\onyxop{}{adn}{}} +\item[{\onyxop{obj \commas}{adn}{\commas obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\commas: ] + Zero or more objects. + \item[obj: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Rotate stack down one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 3 adn pstack +1 +3 +2 +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:and} +\index{and@\onyxop{}{and}{}} +\item[{\onyxop{a b}{and}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or boolean. + \item[b: ] + The same type as \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + If \oparg{a} and \oparg{b} are integers, their bitwise + and, otherwise their logical and. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the bitwise and of two integers, or the logical and of + two booleans. + \item[Example(s): ]\begin{verbatim} + +onyx:0> false true and 1 sprint +false +onyx:0> true true and 1 sprint +true +onyx:0> 5 3 and 1 sprint +1 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:argv} +\index{argv@\onyxop{}{argv}{}} +\item[{\onyxop{--}{argv}{args}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[args: ] + An array of strings. The first string in \oparg{args} + is the path of this program, and any additional + array elements are the arguments that were passed during + invocation. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the argument vector that was used to invoke this program. + \item[Example(s): ]\begin{verbatim} + +onyx:0> argv 1 sprint +[`/usr/local/bin/onyx'] +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:array} +\index{array@\onyxop{}{array}{}} +\item[{\onyxop{length}{array}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[length: ] + Non-negative number of array elements. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of \oparg{length} elements. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create an array of \oparg{length} elements. The elements are + initialized to null objects. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 array 1 sprint +[null null null] +onyx:0> 0 array 1 sprint +[] +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:asin} +\index{asin@\onyxop{}{asin}{}} +\item[{\onyxop{a}{asin}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Arc sine of \oparg{a} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the arc sine of \oparg{a} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> -1 asin 1 sprint +-1.570796e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:asinh} +\index{asinh@\onyxop{}{asinh}{}} +\item[{\onyxop{a}{asinh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Hyperbolic arc sine of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the hyperbolic arc sine of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 10 asinh 1 sprint +2.998223e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:atan} +\index{atan@\onyxop{}{atan}{}} +\item[{\onyxop{x}{atan}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[x: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Arctangent of \oparg{x} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the arctangent of \oparg{x} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 atan 1 sprint +7.853982e-01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:atan2} +\index{atan2@\onyxop{}{atan2}{}} +\item[{\onyxop{y x}{atan2}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[y: ] + An integer or real. + \item[x: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Arctangent of $\frac{y}{x}$ in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the arctangent of $\frac{y}{x}$ in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 1 atan2 1 sprint +7.853982e-01 +onyx:0> 0 1 atan2 1 sprint +0.000000e+00 +onyx:0> -1.0 0 atan2 1 sprint +-1.570796e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:atanh} +\index{atanh@\onyxop{}{atanh}{}} +\item[{\onyxop{x}{atanh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[x: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Hyperbolic arctangent of \oparg{x}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \end{description} + \item[Description: ] + Return the hyperbolic arctangent of \oparg{x}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0.5 atanh 1 sprint +5.493061e-01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:aup} +\index{aup@\onyxop{}{aup}{}} +\item[{\onyxop{\commas obj}{aup}{obj \commas}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\commas: ] + Zero or more objects. + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Rotate stack up one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 3 aup pstack +2 +1 +3 +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:bdup} +\index{bdup@\onyxop{}{bdup}{}} +\item[{\onyxop{obj \commas}{bdup}{obj \commas dup}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \item[dup: ] + A duplicate of \oparg{obj}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Create a duplicate of the bottom object on ostack and put it on + top of ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 3 +onyx:3> bdup pstack +1 +3 +2 +1 +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:begin} +\index{begin@\onyxop{}{begin}{}} +\item[{\onyxop{dict}{begin}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Push \oparg{dict} onto dstack, thereby adding its keys to the + namespace. + \item[Example(s): ]\begin{verbatim} + +onyx:0> <$foo `foo'> begin +onyx:0> foo 1 sprint +`foo' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:bind} +\index{bind@\onyxop{}{bind}{}} +\item[{\onyxop{proc}{bind}{proc}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[proc: ] + A procedure (array). \oparg{proc} will be bound even if + it is literal, but contained literal arrays will not be + recursively bound. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[proc: ] + The same procedure as was passed in. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Recursively bind unbound procedures. Executable names within a + procedure are replaced with their values if defined in dstack, + in any of the following cases: + \begin{itemize} + \item{The value is a literal object.} + \item{The value is an executable or evaluatable operator.} + \item{The value is an executable or evaluatable hook.} + \item{The value is an executable or evaluatable array.} + \end{itemize} + + Binding has a large positive impact on performance, since name + lookups are thereafter avoided. However, binding is not done by + default because there are situations where it is useful to leave + procedures unbound: + \begin{itemize} + \item{Debugging is easier, since the names associated with + objects are still available.} + \item{Behavior is more dynamic. It is possible to replace a + definition on dstack and have it immediately take effect on + unbound procedures. Note however that care must be taken + when relying on this, since binding is recursive, and a lack of + complete understanding of what procedures reference each other + can result in undesired bound procedures. For this reason, it + is generally best to make dynamic behavior explicit by using + evaluatable names.} + \item{There are situations where a program needs to do some + setup before binding a procedure, and providing manual control + over when binding happens allows more sophisticated use of + binding.} + \end{itemize} + \item[Example(s): ]\begin{verbatim} + +onyx:0> {pop sprint {pop sprint}} +onyx:1> dup 2 sprint +{pop sprint {pop sprint}} +onyx:1> bind +onyx:1> dup 2 sprint +{--pop-- _{sprints --print-- `\n' --print-- --flush--}_ {--pop-- -array-}} +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:bindsocket} +\index{bindsocket@\onyxop{}{bindsocket}{}} +\item[{\onyxop{sock addr port}{bindsocket}{--}}: ] +\item[{\onyxop{sock addr}{bindsocket}{--}}: ] +\item[{\onyxop{sock path}{bindsocket}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[addr: ] + An IPv4 address or DNS hostname. + \item[port: ] + An IPv4 port number. If not specified, the OS chooses a + port number. + \item[path: ] + A filesystem path for a Unix-domain socket. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Bind an address/port to an IPv4 socket, or a filesystem path to + a Unix-domain socket. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup `localhost' 7777 bindsocket +onyx:1> dup sockname 1 sprint +<$family $AF_INET $address 2130706433 $port 7777> +onyx:1> close +onyx:0> $AF_LOCAL $SOCK_STREAM socket +onyx:1> dup `/tmp/socket' bindsocket +onyx:1> dup sockname 1 sprint +<$family $AF_LOCAL $path `/tmp/socket'> +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:bpop} +\index{bpop@\onyxop{}{bpop}{}} +\item[{\onyxop{obj \commas}{bpop}{\commas}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\commas: ] + Zero or more objects. + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\commas: ] + Zero or more objects. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Remove the bottom object from ostack and discard it. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 +onyx:2> bpop pstack +2 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:broadcast} +\index{broadcast@\onyxop{}{broadcast}{}} +\item[{\onyxop{condition}{broadcast}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Signal all threads that are waiting on \oparg{condition}. If + there are no waiters, this operator has no effect. + \item[Example(s): ]\begin{verbatim} + +onyx:0> condition mutex dup lock ostack +onyx:3> {dup lock exch broadcast unlock} +onyx:4> thread 3 1 roll +onyx:3> dup 3 1 roll +onyx:4> wait unlock join +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:bytesavailable} +\index{bytesavailable@\onyxop{}{bytesavailable}{}} +\item[{\onyxop{file}{bytesavailable}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + Number of buffered readable bytes. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the number of buffered readable bytes that can be read + without the possibility of blocking. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup `Hello\n' write +onyx:1> dup `Goodbye\n' write +onyx:1> dup 0 seek +onyx:1> dup readline 1 sprint 1 sprint +false +`Hello' +onyx:1> dup bytesavailable 1 sprint +8 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:cat} +\index{cat@\onyxop{}{cat}{}} +\item[{\onyxop{[a] [b]}{cat}{[a b]}}: ] +\item[{\onyxop{(a) (b)}{cat}{(a b)}}: ] +\item[{\onyxop{`a' `b'}{cat}{`ab'}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An array, stack, or string. + \item[b: ] + An array, stack, or string. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[ab: ] + The catenation of \oparg{a} and \oparg{b}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Catenate two arrays, strings, or stacks. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`a'] [`b'] cat +onyx:1> 1 sprint +[`a' `b'] +onyx:0> (`a') (`b') cat +onyx:1> 1 sprint +(`a' `b') +onyx:0> `a' `b' cat +onyx:1> 1 sprint +`ab' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cd} +\index{cd@\onyxop{}{cd}{}} +\item[{\onyxop{path}{cd}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string that represents a filesystem path. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Change the present working directory to \oparg{path}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> pwd 1 sprint +`/usr/local' +onyx:0> `bin' cd +onyx:0> pwd 1 sprint +`/usr/local/bin' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ceiling} +\index{ceiling@\onyxop{}{ceiling}{}} +\item[{\onyxop{a}{ceiling}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Integer ceiling of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the integer ceiling of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> -1.51 ceiling 1 sprint +-1 +onyx:0> -1.49 ceiling 1 sprint +-1 +onyx:0> 0 ceiling 1 sprint +0 +onyx:0> 1.49 ceiling 1 sprint +2 +onyx:0> 1.51 ceiling 1 sprint +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:chmod} +\index{chmod@\onyxop{}{chmod}{}} +\item[{\onyxop{file/filename mode}{chmod}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[filename: ] + A string that represents a filename. + \item[mode: ] + An integer that represents a Unix file mode. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/tdir' 8@755 mkdir +onyx:0> `/tmp/tdir' status $mode get 1 sprint +16877 +onyx:0> `/tmp/tdir' `r' open +onyx:1> dup 8@555 chmod +onyx:1> `/tmp/tdir' status $mode get 1 sprint +16749 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:chown} +\index{chown@\onyxop{}{chown}{}} +\item[{\onyxop{file/filename uid gid}{chown}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[filename: ] + A string that represents a filename. + \item[uid: ] + An integer that represents a user ID. + \item[gid: ] + An integer that represents a group ID. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Change the owner and group of a file. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/tdir' 8@755 mkdir +onyx:0> `/tmp/tdir' status +onyx:1> dup $uid get 1 sprint +1001 +onyx:1> $gid get 1 sprint +0 +onyx:0> `/tmp/tdir' 1001 1001 chown +onyx:0> `/tmp/tdir' status +onyx:1> dup $uid get 1 sprint +1001 +onyx:1> $gid get 1 sprint +1001 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:chroot} +\index{chroot@\onyxop{}{chroot}{}} +\item[{\onyxop{path}{chroot}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string that represents a filesystem path. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Change the root directory to \oparg{path}. This operator + requires super-user priviledges. + \item[Example(s): ]\begin{verbatim} + +onyx:0> pwd 1 sprint +`/home/jasone/cw/devroot' +onyx:0> `/home/jasone' chroot +onyx:0> pwd 1 sprint +`/cw/devroot' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:clear} +\index{clear@\onyxop{}{clear}{}} +\item[{\onyxop{objects}{clear}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[objects: ] + All objects on ostack. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + Pop all objects off of ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 3 pstack +3 +2 +1 +onyx:3> clear pstack +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cleartomark} +\index{cleartomark@\onyxop{}{cleartomark}{}} +\item[{\onyxop{mark \dots}{cleartomark}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\dots: ] + Zero or more objects. + \item[mark: ] + A mark object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{unmatchedmark}{unmatchedmark}.] + \end{description} + \item[Description: ] + Remove objects from ostack down to and including the topmost + mark. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 mark 1 0 pstack +0 +1 +-mark- +3 +onyx:4> cleartomark pstack +3 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:close} +\index{close@\onyxop{}{close}{}} +\item[{\onyxop{file}{close}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Close a file. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open +onyx:1> close +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:condition} +\index{condition@\onyxop{}{condition}{}} +\item[{\onyxop{--}{condition}{condition}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Create a condition object. + \item[Example(s): ]\begin{verbatim} + +onyx:0> condition 1 sprint +-condition- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:connect} +\index{connect@\onyxop{}{connect}{}} +\item[{\onyxop{sock addr port}{connect}{--}}: ] +\item[{\onyxop{sock path}{connect}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[addr: ] + An IPv4 address or DNS hostname. + \item[port: ] + An IPv4 port number. If not specified, the OS chooses a + port number. + \item[path: ] + A filesystem path for a Unix-domain socket. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Connect \oparg{sock}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup `localhost' 7777 connect +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:copy} +\index{copy@\onyxop{}{copy}{}} +\item[{\onyxop{srcarray dstarray}{copy}{dstsubarray}}: ] +\item[{\onyxop{srcdict dstdict}{copy}{dstdict}}: ] +\item[{\onyxop{srcstack dststack}{copy}{dststack}}: ] +\item[{\onyxop{srcstring dststring}{copy}{dstsubstring}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[srcarray: ] + An array object. + \item[srcdict: ] + A dict object. + \item[srcstack: ] + A stack object. + \item[srcstring: ] + A string object. + \item[dstarray: ] + An array object, at least as long as \oparg{srcarray}. + \item[dstdict: ] + A dict object. + \item[dststack: ] + A stack object. + \item[dststring: ] + A string object, at least as long as \oparg{srcstring}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[dstsubarray: ] + A subarray of \oparg{dstarray}, with the same contents + as \oparg{srcarray}. + \item[dstdict: ] + The same object as the input \oparg{dstdict}, but with + the contents of \oparg{srcdict} inserted. + \item[dststack: ] + The same object as the input \oparg{dststack}, but with + the contents of \oparg{srcstack} pushed. + \item[dstsubstring: ] + A substring of \oparg{dststring}, with the same contents + as \oparg{srcstring}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Copy from one object to another. Array and string copying are + destructive; dictionary and stack copying are not. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`a'] [`b' `c'] copy 1 sprint +[`a'] +onyx:0> <$foo `foo'> <$bar `bar'> copy 1 sprint +<$bar `bar' $foo `foo'> +onyx:1> (1 2) (3 4) copy 1 sprint +(3 4 1 2) +onyx:1> `a' `bc' copy 1 sprint +`a' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:cos} +\index{cos@\onyxop{}{cos}{}} +\item[{\onyxop{a}{cos}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Cosine of \oparg{a} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the cosine of \oparg{a} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 cos 1 sprint +1.000000e+00 +onyx:0> 3.14 cos 1 sprint +-9.999987e-01 +onyx:0> 3.1415927 cos 1 sprint +-1.000000e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cosh} +\index{cosh@\onyxop{}{cosh}{}} +\item[{\onyxop{a}{cosh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Hyperbolic cosine of \oparg{a} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the hyperbolic cosine of \oparg{a} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 cosh 1 sprint +1.006766e+01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:count} +\index{count@\onyxop{}{count}{}} +\item[{\onyxop{--}{count}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + The number of objects on ostack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the number of objects on ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 2 1 0 count pstack +3 +0 +1 +2 +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:countdstack} +\index{countdstack@\onyxop{}{countdstack}{}} +\item[{\onyxop{--}{countdstack}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + Number of dictionaries on dstack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the number of dictionaries on dstack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> countdstack 1 sprint +4 +onyx:0> dict begin +onyx:0> countdstack 1 sprint +5 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:countestack} +\index{countestack@\onyxop{}{countestack}{}} +\item[{\onyxop{--}{countestack}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + The number of objects currently on the execution stack + (recursion depth). + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the current number of objects on the execution stack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> countestack 1 sprint +3 +onyx:0> estack 1 sprint +(--start-- -file- --estack--) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:counttomark} +\index{counttomark@\onyxop{}{counttomark}{}} +\item[{\onyxop{mark \dots}{counttomark}{mark \dots count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\dots: ] + Zero or more objects. + \item[mark: ] + A mark object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\dots: ] + \oparg{count} objects. + \item[mark: ] + The same mark that was passed in. + \item[count: ] + The depth of \oparg{mark} on ostack. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{unmatchedmark}{unmatchedmark}.] + \end{description} + \item[Description: ] + Get the depth of the topmost mark on ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 mark 2 1 0 counttomark 1 sprint +3 +onyx:5> + \end{verbatim} + \end{description} +\label{systemdict:currentdict} +\index{currentdict@\onyxop{}{currentdict}{}} +\item[{\onyxop{--}{currentdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + Topmost stack on dstack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the topmost dictionary on dstack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> <$foo `foo'> begin +onyx:0> currentdict 1 sprint +<$foo `foo'> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:currentlocking} +\index{currentlocking@\onyxop{}{currentlocking}{}} +\item[{\onyxop{--}{currentlocking}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, new objects are created with implicit locking + disabled. Otherwise, new objects are created with + implicit locking enabled. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the current implicit locking mode. See + Section~\ref{sec:onyx_implicit_synchronization} for implicit + synchronization details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> currentlocking 1 sprint +false +onyx:0> true setlocking +onyx:0> currentlocking 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cvds} +\index{cvds@\onyxop{}{cvds}{}} +\item[{\onyxop{real precision}{cvds}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[real: ] + A real. + \item[precision: ] + Number of digits after the decimal point to show. If + negative, do not show trailing zeros. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string representation of \oparg{real} in decimal form + with \oparg{precision} digits of decimal precision. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Convert \oparg{real} to a string representation in decimal + notation, with \oparg{precision} digits of decimal precision. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 42.3 0 cvds 1 sprint +`42' +onyx:0> 42.3 1 cvds 1 sprint +`42.3' +onyx:0> -42.3 4 cvds 1 sprint +`-42.3000' +onyx:0> -43.3 -4 cvds 1 sprint +`-42.3' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cve} +\index{cve@\onyxop{}{cve}{}} +\item[{\onyxop{obj}{cve}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The same object that was passed in, but with the + evaluatable attribute set. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Set the evaluatable attribute for \oparg{obj}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 2 3] cve 1 sprint +_{1 2 3}_ +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cves} +\index{cves@\onyxop{}{cves}{}} +\item[{\onyxop{real precision}{cves}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[real: ] + A real. + \item[precision: ] + Number of digits after the decimal point to show. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string representation of \oparg{real} in exponential + form with \oparg{precision} digits of decimal precision. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Convert \oparg{real} to a string representation in exponential + notation, with \oparg{precision} digits of decimal precision. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 42.3 0 cves 1 sprint +`4e+01' +onyx:0> 42.3 1 cves 1 sprint +`4.2e+01' +onyx:0> 42.3 2 cves 1 sprint +`4.23e+01' +onyx:0> -42.3 5 cves 1 sprint +`-4.23000e+01' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cvlit} +\index{cvlit@\onyxop{}{cvlit}{}} +\item[{\onyxop{obj}{cvlit}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The same object that was passed in, but with the literal + attribute set. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Set the literal attribute for \oparg{obj}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {1 2 3} cvlit 1 sprint +[1 2 3] +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cvn} +\index{cvn@\onyxop{}{cvn}{}} +\item[{\onyxop{string}{cvn}{name}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[string: ] + A string. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[name: ] + A literal name that corresponds to \oparg{string}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Convert \oparg{string} to a literal name. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `foo' cvn 1 sprint +$foo +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cvrs} +\index{cvrs@\onyxop{}{cvrs}{}} +\item[{\onyxop{integer radix}{cvrs}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[integer: ] + An integer. + \item[radix: ] + A numerical base, from 2 to 36, inclusive. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string representation of \oparg{integer} in base + \oparg{radix}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Convert \oparg{integer} to a string representation in base + \oparg{radix}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 42 2 cvrs 1 sprint +`101010' +onyx:0> 42 16 cvrs 1 sprint +`2a' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cvs} +\index{cvs@\onyxop{}{cvs}{}} +\item[{\onyxop{obj}{cvs}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string representation of \oparg{obj}. The string + depends on the type of \oparg{obj}: + \begin{description} + \item[boolean: ] {\tt `true'} or {\tt `false'}. + \item[name: ] The string representation of the name. + \item[integer: ] The integer in base 10. + \item[operator: ] The string representation of the + operator name or {\tt `-operator-'}. + \item[real: ] The real in exponential notation. + \item[string: ] A printable representation of + \oparg{obj}. The result can be evaluated to produce + the original string. + \item[Other types: ] {\tt `--nostringval--'}. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Convert \oparg{obj} to a string representation. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true cvs 1 sprint +`true' +onyx:0> $foo cvs 1 sprint +`foo' +onyx:0> 42 cvs 1 sprint +`42' +onyx:0> ~pop cvs 1 sprint +`pop' +onyx:0> 42.0 cvs 1 sprint +`4.200000e+01' +onyx:0> `foo\nbar\\biz\`baz' cvs 1 sprint +`\`foo\\nbar\\\\biz\\\`baz\'' +onyx:0> mutex cvs 1 sprint +`--nostringval--' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:cvx} +\index{cvx@\onyxop{}{cvx}{}} +\item[{\onyxop{obj}{cvx}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The same object that was passed in, but with the + executable attribute set. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Set the executable attribute for \oparg{obj}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 2 3] cvx 1 sprint +{1 2 3} +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:dec} +\index{dec@\onyxop{}{dec}{}} +\item[{\onyxop{a}{dec}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + $a - 1$. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Subtract one from \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 dec 1 sprint +0 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:def} +\index{def@\onyxop{}{def}{}} +\item[{\onyxop{key val}{def}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[key: ] + An object. + \item[val: ] + A value associated with \oparg{key}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Define \oparg{key} with associated value \oparg{val} in the + topmost dictionary on dstack. If \oparg{key} is already defined + in that dictionary, the old definition is replaced. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $foo `foo' def +onyx:0> foo 1 sprint +`foo' +onyx:0> $foo `FOO' def +onyx:0> foo 1 sprint +`FOO' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:detach} +\index{detach@\onyxop{}{detach}{}} +\item[{\onyxop{thread}{detach}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Detach \oparg{thread} so that its resources will be + automatically reclaimed after it exits. A thread may only be + detached or joined once; any attempt to do so more than once + results in undefined behavior (likely crash). + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2) {add 1 sprint self detach} thread +3 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:dict} +\index{dict@\onyxop{}{dict}{}} +\item[{\onyxop{--}{dict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + An empty dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Create an empty dictionary. + \item[Example(s): ]\begin{verbatim} + +onyx:0> dict 1 sprint +<> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:die} +\index{die@\onyxop{}{die}{}} +\item[{\onyxop{status}{die}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[status: ] + A integer from 0 to 255 that is used as the program exit + code. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Exit the program with exit code \oparg{status}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 die + \end{verbatim} + \end{description} +\label{systemdict:dirforeach} +\index{dirforeach@\onyxop{}{dirforeach}{}} +\item[{\onyxop{path proc}{dirforeach}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string that represents a filesystem path. + \item[proc: ] + An object to be executed. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + For each entry in the directory represented by \oparg{path} + except for ``.'' and ``..'', push a string that represents the + entry onto ostack and execute \oparg{proc}. This operator + supports the \htmlref{\onyxop{}{exit}{}}{systemdict:exit} + operator. + \item[Example(s): ]\begin{verbatim} + +onyx:0> pwd {1 sprint} dirforeach +`CVS' +`.cvsignore' +`Cookfile' +`Cookfile.inc' +`latex' +`Cookfile.inc.in' +onyx:0> pwd {`Cookfile.inc' search + {pop `Yes: ' print 1 sprint pop exit} + {`Not: ' print 1 sprint} ifelse +} dirforeach +Not: `CVS' +Not: `.cvsignore' +Not: `Cookfile' +Yes: `Cookfile.inc' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:div} +\index{div@\onyxop{}{div}{}} +\item[{\onyxop{a b}{div}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \item[b: ] + A non-zero integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The quotient of \oparg{a} divided by \oparg{b}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedresult}{undefinedresult}.] + \end{description} + \item[Description: ] + Return the quotient of \oparg{a} divided by \oparg{b}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 2 div 1 sprint +2.000000e+00 +onyx:0> 5 2.0 div 1 sprint +2.500000e+00 +onyx:0> 5.0 0 div +Error $undefinedresult +ostack: (5.000000e+00 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --div-- +1: -file- +2: --start-- +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:dn} +\index{dn@\onyxop{}{dn}{}} +\item[{\onyxop{a b c}{dn}{b c a}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \item[c: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[b: ] + An object. + \item[c: ] + An object. + \item[a: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Rotate the top three objects on ostack down one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' `d' dn pstack +`b' +`d' +`c' +`a' +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:dstack} +\index{dstack@\onyxop{}{dstack}{}} +\item[{\onyxop{--}{dstack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + A snapshot of dstack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a snapshot of dstack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> dstack 1 sprint +(-dict- -dict- -dict- -dict-) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:dup} +\index{dup@\onyxop{}{dup}{}} +\item[{\onyxop{obj}{dup}{obj dup}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The same object that was passed in. + \item[dup: ] + A duplicate of \oparg{obj}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Create a duplicate of the top object on ostack. For composite + objects, the new object is a reference to the same composite + object. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 dup pstack +1 +1 +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:echeck} +\index{echeck@\onyxop{}{echeck}{}} +\item[{\onyxop{obj}{echeck}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{obj} has the evaluatable attribute, + false otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Check \oparg{obj} for evaluatable attribute. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {1 2 3} cve +onyx:1> dup 1 sprint +_{1 2 3}_ +onyx:1> echeck 1 sprint +true +onyx:0> {1 2 3} echeck 1 sprint +false +onyx:0> [1 2 3] echeck 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:egid} +\index{egid@\onyxop{}{egid}{}} +\item[{\onyxop{--}{egid}{gid}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[gid: ] + Process's effective group ID. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the process's effective group ID. + \item[Example(s): ]\begin{verbatim} + +onyx:0> egid 1 sprint +1001 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:end} +\index{end@\onyxop{}{end}{}} +\item[{\onyxop{--}{end}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Pop the topmost dictionary off dstack, thereby removing its + contents from the namespace. + \item[Example(s): ]\begin{verbatim} + +onyx:0> <$foo `foo'> begin +onyx:0> foo 1 sprint +`foo' +onyx:0> end +onyx:0> foo 1 sprint +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: foo +1: -file- +2: --start-- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:envdict} +\index{envdict@\onyxop{}{envdict}{}} +\item[{\onyxop{--}{envdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get envdict. See Section~\ref{sec:envdict} for details on + envdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> envdict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:eq} +\index{eq@\onyxop{}{eq}{}} +\item[{\onyxop{a b}{eq}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{a} is equal to \oparg{b}, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Compare two objects for equality. Equality has the following + meaning, depending on the types of \oparg{a} and \oparg{b}: + \begin{description} + \item[array, condition, dict, file, hook, mutex, stack, + thread: ] \oparg{a} and \oparg{b} are equal iff they refer to + the same memory. + \item[operator: ] \oparg{a} and \oparg{b} are equal iff they + refer to the same function. + \item[name, string: ] \oparg{a} and \oparg{b} are equal iff they + are lexically equivalent. A name can be equal to a string. + \item[boolean: ] \oparg{a} and \oparg{b} are equal iff they + are the same value. + \item[integer, real: ] \oparg{a} and \oparg{b} are equal iff + they are the same value. + \end{description} + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex mutex eq 1 sprint +false +onyx:0> mutex dup eq 1 sprint +true +onyx:0> $foo `foo' eq 1 sprint +true +onyx:0> true true eq 1 sprint +true +onyx:0> true false eq 1 sprint +false +onyx:0> 1 1 eq 1 sprint +true +onyx:0> 1 2 eq 1 sprint +false +onyx:0> 1.0 1 eq 1 sprint +true +onyx:0> 1.0 1.1 eq 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:estack} +\index{estack@\onyxop{}{estack}{}} +\item[{\onyxop{--}{estack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + A current snapshot (copy) of the execution stack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a current snapshot of the execution stack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> estack 1 sprint +(--start-- -file- --estack--) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:euid} +\index{euid@\onyxop{}{euid}{}} +\item[{\onyxop{--}{euid}{uid}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[uid: ] + Process's effective user ID. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the process's effective user ID. + \item[Example(s): ]\begin{verbatim} + +onyx:0> euid 1 sprint +1001 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:eval} +\index{eval@\onyxop{}{eval}{}} +\item[{\onyxop{obj}{eval}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Evaluate object. See Section~\ref{sec:onyx_objects} for + details on object evaluation. + \item[Example(s): ]\begin{verbatim} + +onyx:0> ``hi' 1 sprint' cvx eval +`hi' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:exch} +\index{exch@\onyxop{}{exch}{}} +\item[{\onyxop{a b}{exch}{b a}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[b: ] + The same object that was passed in. + \item[a: ] + The same object that was passed in. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Exchange the top two objects on ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 pstack +2 +1 +onyx:2> exch pstack +1 +2 +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:exec} +\index{exec@\onyxop{}{exec}{}} +\item[{\onyxop{args}{exec}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[args: ] + An array of strings. The first string in \oparg{args} + is the path of the program to invoke, and any additional + array elements are passed as command line arguments to + the invoked program. + \end{description} + \item[Output(s): ] None (this operator does not return). + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Overlay a new program and execute it. The current contents of + envdict are used to construct the new program's environment. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `Old program' +onyx:1> [`/usr/local/bin/onyx'] exec +Canonware Onyx, version 1.0.0. +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:exit} +\index{exit@\onyxop{}{exit}{}} +\item[{\onyxop{--}{exit}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + Exit the innermost enclosing looping context immediately. + This operator can be called within the looping context of + \htmlref{\onyxop{}{for}{}}{systemdict:for}, + \htmlref{\onyxop{}{repeat}{}}{systemdict:repeat}, + \htmlref{\onyxop{}{while}{}}{systemdict:while}, + \htmlref{\onyxop{}{until}{}}{systemdict:until}, + \htmlref{\onyxop{}{loop}{}}{systemdict:loop}, + \htmlref{\onyxop{}{foreach}{}}{systemdict:foreach}, and + \htmlref{\onyxop{}{dirforeach}{}}{systemdict:dirforeach}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {`hi' 1 sprint exit `bye' 1 sprint} loop +`hi' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:exp} +\index{exp@\onyxop{}{exp}{}} +\item[{\onyxop{b}{exp}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + $e$ raised to the \oparg{b} power. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return $e$ (the base of natural logarithm) raised to the + \oparg{b} power. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 exp 1 sprint +2.008554e+01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:false} +\index{false@\onyxop{}{false}{}} +\item[{\onyxop{--}{false}{false}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[false: ] + The boolean value false. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Return false. + \item[Example(s): ]\begin{verbatim} + +onyx:0> false 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:floor} +\index{floor@\onyxop{}{floor}{}} +\item[{\onyxop{a}{floor}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Integer floor of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the integer floor of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> -1.51 floor 1 sprint +-2 +onyx:0> -1.49 floor 1 sprint +-2 +onyx:0> 0 floor 1 sprint +0 +onyx:0> 1.49 floor 1 sprint +1 +onyx:0> 1.51 floor 1 sprint +1 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:flush} +\index{flush@\onyxop{}{flush}{}} +\item[{\onyxop{--}{flush}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \end{description} + \item[Description: ] + Flush any buffered data associated with stdout. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `Hi\n' print +onyx:0> flush +Hi +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:flushfile} +\index{flushfile@\onyxop{}{flushfile}{}} +\item[{\onyxop{file}{flushfile}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Flush any buffered data associated with \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `Hi\n' print +onyx:0> stdout flushfile +Hi +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:for} +\index{for@\onyxop{}{for}{}} +\item[{\onyxop{init inc limit proc}{for}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[init: ] + Initial value of control variable. + \item[inc: ] + Amount to increment control variable by at the end of + each iteration. + \item[limit: ] + Inclusive upper bound for control variable if less than + or equal to \oparg{init}, otherwise inclusive lower + bound for control variable. + \item[proc: ] + An object. + \end{description} + \item[Output(s): ] At the beginning of each iteration, the current + value of the control variable is pushed onto ostack. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Iteratively evaluate \oparg{proc}, pushing a control variable + onto ostack at the beginning of each iteration, until the + control variable has exceeded \oparg{limit}. This operator + supports the \htmlref{\onyxop{}{exit}{}}{systemdict:exit} + operator. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 1 3 {1 sprint} for +0 +1 +2 +3 +onyx:0> 0 -1 -3 {1 sprint} for +0 +-1 +-2 +-3 +onyx:0> 0 2 7 {1 sprint} for +0 +2 +4 +6 +onyx:0> 0 1 1000 {dup 1 sprint 3 eq {exit} if} for +0 +1 +2 +3 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:foreach} +\index{foreach@\onyxop{}{foreach}{}} +\item[{\onyxop{array proc}{foreach}{--}}: ] +\item[{\onyxop{dict proc}{foreach}{--}}: ] +\item[{\onyxop{stack proc}{foreach}{--}}: ] +\item[{\onyxop{string proc}{foreach}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[dict: ] + A dict object. + \item[stack: ] + A stack object. + \item[string: ] + A string object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + For each entry in the first input argument (\oparg{array}, + \oparg{dict}, \oparg{stack}, or \oparg{string}), push the entry + onto ostack and execute \oparg{proc}. This operator supports + the \htmlref{\onyxop{}{exit}{}}{systemdict:exit} operator. + + The object being iterated over can be modified during iteration, + with the expectation of no ill consequences, and in most cases + the modifications are immediately apparent. However, there are + some cases in which behavior does not follow this guideline: + \begin{itemize}\item[] + \item{Objects inserted into a dictionary during iteration may or + may not be iterated over.} + \item{In the case of stack iteration, a snapshot is taken before + iteration begins, so any changes to the stack during + iteration will not affect iteration in any way.} + \end{itemize} + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 2] {1 sprint} foreach +1 +2 +onyx:0> <$foo `foo' $bar `bar'> {pstack clear} foreach +`bar' +$bar +`foo' +$foo +onyx:0> (1 2) {pstack clear} foreach +2 +1 +onyx:0> `ab' {pstack clear} foreach +97 +98 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:forkexec} +\index{forkexec@\onyxop{}{forkexec}{}} +\item[{\onyxop{args}{forkexec}{pid}}: ] + \begin{description}\item[] + \item[Input(s): ] + \item[args: ] + An array of strings. The first string in \oparg{args} + is the path of the program to invoke, and any additional + array elements are passed as command line arguments to + the invoked program. + \item[Output(s): ] + \begin{description}\item[] + \item[pid: ] + Process identifier for the new process, or 0 if the + child process. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{limitcheck}{limitcheck}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Fork and exec a new process. The current contents of envdict + are used to construct the new program's environment. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`/bin/date'] forkexec dup 1 sprint waitpid 1 sprint +6516 +Sat Jul 13 20:47:54 PDT 2002 +0 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:gcdict} +\index{gcdict@\onyxop{}{gcdict}{}} +\item[{\onyxop{--}{gcdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get gcdict. See Section~\ref{sec:gcdict} for details on + gcdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gcdict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ge} +\index{ge@\onyxop{}{ge}{}} +\item[{\onyxop{a b}{ge}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + A number (integer or real) or string. + \item[b: ] + An object of a type compatible with \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{a} is greater than or equal to \oparg{b}, + false otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Compare two numbers or strings. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 ge 1 sprint +false +onyx:0> 1 1 ge 1 sprint +true +onyx:0> 2 1 ge 1 sprint +true +onyx:0> 1 1.1 ge 1 sprint +false +onyx:0> 1.1 1.1 ge 1 sprint +true +onyx:0> 1.1 1 ge 1 sprint +true +onyx:0> `a' `b' ge 1 sprint +false +onyx:0> `a' `a' ge 1 sprint +true +onyx:0> `b' `a' ge 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:get} +\index{get@\onyxop{}{get}{}} +\item[{\onyxop{array index}{get}{obj}}: ] +\item[{\onyxop{dict key}{get}{value}}: ] +\item[{\onyxop{string index}{get}{integer}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[dict: ] + A dict object. + \item[string: ] + A string object. + \item[index: ] Offset of \oparg{array} element or \oparg{string} + element. + \item[key: ] + A key in \oparg{dict}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The object in \oparg{array} at offset \oparg{index}. + \item[value: ] + The value in \oparg{dict} corresponding to \oparg{key}. + \item[integer: ] + The ascii value of the character in \oparg{string} at + offset \oparg{index}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefined}{undefined}.] + \end{description} + \item[Description: ] + Get an element of \oparg{array}, a value in \oparg{dict}, or an + element of \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`a' `b' `c'] 1 get 1 sprint +`b' +onyx:0> <$foo `foo' $bar `bar'> $bar get 1 sprint +`bar' +onyx:0> `abc' 1 get 1 sprint +98 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:getinterval} +\index{getinterval@\onyxop{}{getinterval}{}} +\item[{\onyxop{array index length}{getinterval}{subarray}}: ] +\item[{\onyxop{string index length}{getinterval}{substring}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[string: ] + A string object. + \item[index: ] + The offset into \oparg{array} or \oparg{string} to get + the interval from. + \item[length: ] + The length of the interval in \oparg{array} or + \oparg{string} to get. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[subarray: ] + A subarray of \oparg{array} at offset \oparg{index} and + of length \oparg{length}. + \item[substring: ] + A substring of \oparg{string} at offset \oparg{index} + and of length \oparg{length}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get an interval of \oparg{array} or \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [0 1 2 3] 1 2 getinterval 1 sprint +[1 2] +onyx:0> `abcd' 1 2 getinterval 1 sprint +`bc' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:gid} +\index{gid@\onyxop{}{gid}{}} +\item[{\onyxop{--}{gid}{gid}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[gid: ] + Process's group ID. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the process's group ID. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gid 1 sprint +1001 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:globaldict} +\index{globaldict@\onyxop{}{globaldict}{}} +\item[{\onyxop{--}{globaldict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get globaldict. See Section~\ref{sec:globaldict} for details on + globaldict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> globaldict 1 sprint +<> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:gstderr} +\index{gstderr@\onyxop{}{gstderr}{}} +\item[{\onyxop{--}{gstderr}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object corresponding to the global stderr. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the global stderr that is inherited by new threads. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gstderr pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:gstdin} +\index{gstdin@\onyxop{}{gstdin}{}} +\item[{\onyxop{--}{gstdin}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object corresponding to the global stdin. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the global stdin that is inherited by new threads. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gstdin pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:gstdout} +\index{gstdout@\onyxop{}{gstdout}{}} +\item[{\onyxop{--}{gstdout}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object corresponding to the global stdout. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the global stdout that is inherited by new threads. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> gstdout pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:gt} +\index{gt@\onyxop{}{gt}{}} +\item[{\onyxop{a b}{gt}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + A number (integer or real) or string. + \item[b: ] + An object of a type compatible with \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{a} is greater than \oparg{b}, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Compare two numbers or strings. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 1 gt 1 sprint +false +onyx:0> 2 1 gt 1 sprint +true +onyx:0> 1.1 1.1 gt 1 sprint +false +onyx:0> 1.1 1 gt 1 sprint +true +onyx:0> `a' `a' gt 1 sprint +false +onyx:0> `b' `a' gt 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:hooktag} +\index{hooktag@\onyxop{}{hooktag}{}} +\item[{\onyxop{hook}{hooktag}{tag}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[hook: ] + A hook object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[tag: ] + The tag associated with \oparg{hook}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the tag associated with \oparg{hook}. + \item[Example(s): ]\begin{verbatim} + + \end{verbatim} + \end{description} +\label{systemdict:ibdup} +\index{ibdup@\onyxop{}{ibdup}{}} +\item[{\onyxop{\dots obj \commas index}{ibdup}{\dots obj \commas dup}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\dots: ] + \oparg{index} objects. + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \item[index: ] + Offset from bottom of ostack, counting from 0. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\dots: ] + \oparg{index} objects. + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \item[dup: ] + Duplicate of \oparg{obj}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the object on ostack that is at + offset \oparg{index} from the bottom of ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:4> 2 ibdup pstack +2 +3 +2 +1 +0 +onyx:5> + \end{verbatim} + \end{description} +\label{systemdict:ibpop} +\index{ibpop@\onyxop{}{ibpop}{}} +\item[{\onyxop{\dots obj \commas index}{ibpop}{\dots \commas}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\dots: ] + \oparg{index} objects. + \item[obj: ] + An object. + \item[\commas: ] + Zero or more objects. + \item[index: ] + Offset from bottom of ostack, counting from 0. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\dots: ] + \oparg{index} objects. + \item[\commas: ] + Zero or more objects. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the object from ostack that is at offset + \oparg{index} from the bottom of ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 1 2 3 +onyx:4> 2 ibpop pstack +3 +1 +0 +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:idiv} +\index{idiv@\onyxop{}{idiv}{}} +\item[{\onyxop{a b}{idiv}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer. + \item[b: ] + A non-zero integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The integer quotient of \oparg{a} divided by \oparg{b}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedresult}{undefinedresult}.] + \end{description} + \item[Description: ] + Return the integer quotient of \oparg{a} divided by \oparg{b}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 2 idiv 1 sprint +2 +onyx:0> 5 2 idiv 1 sprint +2 +onyx:0> 5 0 idiv +Error $undefinedresult +ostack: (5 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --idiv-- +1: -file- +2: --start-- +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:idup} +\index{idup@\onyxop{}{idup}{}} +\item[{\onyxop{obj \dots index}{idup}{obj \dots dup}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \item[index: ] + Offset from top of ostack, counting from 0, not counting + \oparg{index}), of the object to duplicate on ostack. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The same object that was passed in. + \item[dup: ] + A duplicate of \oparg{obj}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the object on ostack at \oparg{index}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 2 1 0 2 idup pstack +2 +0 +1 +2 +3 +onyx:5> + \end{verbatim} + \end{description} +\label{systemdict:if} +\index{if@\onyxop{}{if}{}} +\item[{\onyxop{boolean obj}{if}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[boolean: ] + A boolean. + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Evaluate \oparg{obj} if \oparg{boolean} is true. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true {`yes' 1 sprint} if +`yes' +onyx:0> false {`yes' 1 sprint} if +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ifelse} +\index{ifelse@\onyxop{}{ifelse}{}} +\item[{\onyxop{boolean a b}{ifelse}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[boolean: ] + A boolean. + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Evaluate \oparg{a} if \oparg{boolean} is true, evaluate + \oparg{b} otherwise. See Section~\ref{sec:onyx_objects} for + details on object evaluation. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true {`yes'}{`no'} ifelse 1 sprint +`yes' +onyx:0> false {`yes'}{`no'} ifelse 1 sprint +`no' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:inc} +\index{inc@\onyxop{}{inc}{}} +\item[{\onyxop{a}{inc}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + $a + 1$. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Add one to \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 inc 1 sprint +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:iobuf} +\index{iobuf@\onyxop{}{iobuf}{}} +\item[{\onyxop{file}{iobuf}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + The size in bytes of the I/O buffer associated with + \oparg{file}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the size of the I/O buffer associated with \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stdout iobuf 1 sprint +512 +onyx:0> stderr iobuf 1 sprint +0 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ipop} +\index{ipop@\onyxop{}{ipop}{}} +\item[{\onyxop{obj \dots index}{ipop}{\dots}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \item[index: ] + Offset from top of ostack, counting from 0, not counting + \oparg{index}), of the object to remove from ostack. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the \oparg{obj} at \oparg{index} from ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 2 1 0 +onyx:3> 1 ipop pstack +0 +2 +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:istack} +\index{istack@\onyxop{}{istack}{}} +\item[{\onyxop{--}{istack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + A current snapshot (copy) of the index stack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a current snapshot of the index stack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> istack 1 sprint +(0 0 0) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:join} +\index{join@\onyxop{}{join}{}} +\item[{\onyxop{thread}{join}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Wait for \oparg{thread} to exit. A thread may only be detached + or joined once; any attempt to do so more than once results in + undefined behavior (likely crash). + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2) {add 1 sprint} thread join `Done\n' print flush +3 +Done +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:known} +\index{known@\onyxop{}{known}{}} +\item[{\onyxop{dict key}{known}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \item[key: ] + A key to look for in \oparg{dict}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{key} is defined in \oparg{dict}, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Check whether \oparg{key} is defined in \oparg{dict}. + \item[Example(s): ]\begin{verbatim} + +onyx:1> <$foo `foo'> $foo known 1 sprint +true +onyx:1> <$foo `foo'> $bar known 1 sprint +false +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:lcheck} +\index{lcheck@\onyxop{}{lcheck}{}} +\item[{\onyxop{obj}{lcheck}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An array, dict, file, or string. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{obj} is implicitly locked, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Check if \oparg{obj} is implicitly locked. + \item[Example(s): ]\begin{verbatim} + +onyx:0> false setlocking +onyx:0> [1 2 3] lcheck 1 sprint +false +onyx:0> true setlocking +onyx:0> [1 2 3] lcheck 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:le} +\index{le@\onyxop{}{le}{}} +\item[{\onyxop{a b}{le}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + A number (integer or real) or string. + \item[b: ] + An object of a type compatible with \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{a} is less than or equal to \oparg{b}, + false otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Compare two numbers or strings. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 le 1 sprint +true +onyx:0> 1 1 le 1 sprint +true +onyx:0> 2 1 le 1 sprint +false +onyx:0> 1 1.1 le 1 sprint +true +onyx:0> 1.1 1.1 le 1 sprint +true +onyx:0> 1.1 1 le 1 sprint +false +onyx:0> `a' `b' le 1 sprint +true +onyx:0> `a' `a' le 1 sprint +true +onyx:0> `b' `a' le 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:length} +\index{length@\onyxop{}{length}{}} +\item[{\onyxop{array}{length}{count}}: ] +\item[{\onyxop{dict}{length}{count}}: ] +\item[{\onyxop{name}{length}{count}}: ] +\item[{\onyxop{string}{length}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[dict: ] + A dict object. + \item[name: ] + A name object. + \item[string: ] + A string object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + Number of elements in \oparg{array}, number of entries + in \oparg{dict}, number of characters in \oparg{name}, + or number of characters in \oparg{string}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the umber of elements in \oparg{array}, number of entries in + \oparg{dict}, number of characters in \oparg{name}, or number of + characters in \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 2 3] length 1 sprint +3 +onyx:0> <$foo `foo' $bar `bar'> length 1 sprint +2 +onyx:0> $foo length 1 sprint +3 +onyx:0> `foo' length 1 sprint +3 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:link} +\index{link@\onyxop{}{link}{}} +\item[{\onyxop{filename linkname}{link}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[filename: ] + A string that represents a filename. + \item[linkname: ] + A string that represents a filename. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a hard link from \oparg{linkname} to \oparg{filename}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open +onyx:1> dup `Hello\n' write +onyx:1> dup flushfile +onyx:1> close +onyx:0> `/tmp/foo' `/tmp/bar' link +onyx:0> `/tmp/bar' `r' open +onyx:1> readline +onyx:2> pstack +false +`Hello' +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:listen} +\index{listen@\onyxop{}{listen}{}} +\item[{\onyxop{sock backlog}{listen}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[backlog: ] + Maximum backlog of connections to listen for. If not + specified, the maximum backlog is used. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Listen for connections on a socket. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup `localhost' 7777 bindsocket +onyx:1> dup listen +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:ln} +\index{ln@\onyxop{}{ln}{}} +\item[{\onyxop{a}{ln}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Natural logarithm of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the natural logarithm of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 5 ln 1 sprint +1.609438e+00 +onyx:0> 8.5 ln 1 sprint +2.140066e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:load} +\index{load@\onyxop{}{load}{}} +\item[{\onyxop{key}{load}{val}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[key: ] + A key to look up in dstack. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[val: ] + The value associated with the topmost definition of + \oparg{key} in dstack. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{undefined}{undefined}.] + \end{description} + \item[Description: ] + Get the topmost definition of \oparg{key} in dstack. + \item[Example(s): ]\begin{verbatim} + +onyx:1> <$foo `foo'> begin +onyx:1> <$foo `FOO'> begin +onyx:1> $foo load 1 sprint +`FOO' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:lock} +\index{lock@\onyxop{}{lock}{}} +\item[{\onyxop{mutex}{lock}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Acquire \oparg{mutex}, waiting if necessary. Attempting to + acquire \oparg{mutex} recursively will result in undefined + behavior (likely deadlock or crash). + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex dup lock unlock +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:log} +\index{log@\onyxop{}{log}{}} +\item[{\onyxop{a}{log}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Base 10 logarithm of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the base 10 logarithm of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 5 log 1 sprint +6.989700e-01 +onyx:0> 8.5 log 1 sprint +9.294189e-01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:loop} +\index{loop@\onyxop{}{loop}{}} +\item[{\onyxop{proc}{loop}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[proc: ] + An object to evaluate. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Repeatedly evaluate \oparg{proc} indefinitely. This operator + supports the \htmlref{\onyxop{}{exit}{}}{systemdict:exit} + operator. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 {1 add dup 1 sprint dup 3 eq {pop exit} if} loop +1 +2 +3 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:lt} +\index{lt@\onyxop{}{lt}{}} +\item[{\onyxop{a b}{lt}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + A number (integer or real) or string. + \item[b: ] + An object of a type compatible with \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{a} is less than \oparg{b}, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Compare two numbers or strings. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 lt 1 sprint +true +onyx:0> 1 1 lt 1 sprint +false +onyx:0> 1 1.1 lt 1 sprint +true +onyx:0> 1.1 1.1 lt 1 sprint +false +onyx:0> 1.1 1 lt 1 sprint +false +onyx:0> `a' `b' lt 1 sprint +true +onyx:0> `a' `a' lt 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mark} +\index{mark@\onyxop{}{mark}{}} +\item[{\onyxop{--}{mark}{mark}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[mark: ] + A mark object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Push a mark onto ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> mark pstack +-mark- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:match} +\index{match@\onyxop{}{match}{}} +\item[{\onyxop{input pattern flags}{match}{boolean}}: ] +\item[{\onyxop{input pattern}{match}{boolean}}: ] +\item[{\onyxop{input regex}{match}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[input: ] + An input string to find matches in. + \item[pattern: ] + A string that specifies a regular expression. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[flags: ] + A dictionary of optional flags: + \begin{description}%\item[] + \item[\$c: ] + Continue where previous match ended. Don't + update the offset to start the next match from + unless this match is successful. Defaults to + false. + \item[\$g: ] + Continue where previous match ended. If the + match is unsuccessful, update the offset to + start the next match from to the beginning of + \oparg{input}. Defaults to false. + \item[\$i: ] Case insensitive. Defaults to false. + \item[\$m: ] Treat input as a multi-line string. + Defaults to false. + \item[\$s: ] Treat input as a single line, so that + the dot metacharacter matches any character, + including a newline. Defaults to false. + \end{description} + \item[regex: ] + A regex object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + \begin{description}\item[] + \item[TRUE: ] Match successful. + \item[FALSE: ] No match found. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{regexerror}{regexerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Look in \oparg{input} for a match to the regular expression + specified by \oparg{regex}/\oparg{pattern}/\oparg{flags}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `input' `I' <$i true> match {0 submatch 1 sprint} if +`i' +onyx:0> `input' `I' <$i true> regex match {0 submatch 1 sprint} if +`i' +onyx:0> `input' `I' match {0 submatch 1 sprint} if +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mkdir} +\index{mkdir@\onyxop{}{mkdir}{}} +\item[{\onyxop{path}{mkdir}{--}}: ] +\item[{\onyxop{path mode}{mkdir}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string object that represents a directory path. + \item[mode: ] + An integer that represents a Unix file mode. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a directory. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/tdir' 8@755 mkdir +onyx:0> `/tmp/tdir' {1 sprint} dirforeach +`.' +`..' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mkfifo} +\index{mkfifo@\onyxop{}{mkfifo}{}} +\item[{\onyxop{path}{mkfifo}{--}}: ] +\item[{\onyxop{path mode}{mkfifo}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string object that represents a directory path. + \item[mode: ] + An integer that represents a Unix file mode. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a named pipe. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/fifo' mkfifo +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mod} +\index{mod@\onyxop{}{mod}{}} +\item[{\onyxop{a b}{mod}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \item[b: ] + A non-zero integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The modulus of \oparg{a} and \oparg{b}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedresult}{undefinedresult}.] + \end{description} + \item[Description: ] + Return the modulus of \oparg{a} and \oparg{b}. Note + that \oparg{a} and \oparg{b} can be any combination of + integers and reals. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 2 mod 1 sprint +0 +onyx:0> 5 2 mod 1 sprint +1 +onyx:0> 5 0 mod +Error $undefinedresult +ostack: (5 0) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --mod-- +1: -file- +2: --start-- +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:modload} +\index{modload@\onyxop{}{modload}{}} +\item[{\onyxop{path symbol}{modload}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string that represents a module filename. + \item[symbol: ] + A string that represents the symbol name of a + module initialization function to be executed. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefined}{undefined}.] + \end{description} + \item[Description: ] + Dynamically load a module, create a hook object that + encapsulates the handle returned by dlopen(3) (hook data + pointer) and the module initialization function (hook evaluation + function), and evaluate the hook. + + All objects that refer to code and/or data that are part of the + module must directly and/or indirectly maintain a reference to + the hook that is evaluated by this operator, since failing to do + so would allow the garbage collector to unload the module, which + could result in dangling pointers to unmapped memory regions. + + Loadable modules present a problem for the garbage collector + during the sweep phase. All objects that refer to memory that + is dynamically mapped as part of the module must be destroyed + before the module is unloaded. Destruction ordering constraints + show up in other situations as well, but in the case of loadable + modules, there is no reasonable solution except to explicitly + order the destruction of objects. Therefore, by default, the + hook that is evaluated by modload is destroyed during the second + sweep pass (count starts at 0). It is possible for a module to + override what sweep pass the hook is destroyed on, in cases + where there are additional ordering constraints for the objects + created by a module. This isn't important from the Onyx + language perspective, but is important to understand when + implementing modules. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/usr/local/share/onyx/nxmod/mdprompt.nxm' `modprompt_init' +onyx:2> modload +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:monitor} +\index{monitor@\onyxop{}{monitor}{}} +\item[{\onyxop{mutex proc}{monitor}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex. + \item[proc: ] + Any object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Execute \oparg{proc} while holding \oparg{mutex}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex {`hello\n' print} monitor flush +hello +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mrequire} +\index{mrequire@\onyxop{}{mrequire}{}} +\item[{\onyxop{file symbol}{mrequire}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A string that represents a module filename. + \item[symbol: ] + A string that represents the symbol name of a + module initialization function to be executed. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefined}{undefined}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \end{description} + \item[Description: ] + Search for and load a module. The module is searched for by + catenating a prefix, a ``/'', and \oparg{file} to form a file + path. Prefixes are tried in the following order: + \begin{enumerate} + \item{The ordered elements of the + \htmlref{mpath\_pre}{onyxdict:mpath_pre} array, which is + defined in \htmlref{onyxdict}{sec:onyxdict}.} + \item{If defined, the ordered elements of the + ONYX\_MPATH environment variable, which is a + colon-separated list.} + \item{The ordered elements of the + \htmlref{mpath\_post}{onyxdict:mpath_post} array, which + is defined in \htmlref{onyxdict}{sec:onyxdict}.} + \end{enumerate} + \item[Example(s): ]\begin{verbatim} + +onyx:0> `modgtk.nxm' `modgtk_init' mrequire +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mul} +\index{mul@\onyxop{}{mul}{}} +\item[{\onyxop{a b}{mul}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \item[b: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The product of \oparg{a} and \oparg{b}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the product of \oparg{a} and \oparg{b}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 17 mul 1 sprint +51 +onyx:0> -5 -6 mul 1 sprint +30 +onyx:0> 3.5 4.0 mul 1 sprint +1.400000e+01 +onyx:0> -1.5 3 mul 1 sprint +-4.500000e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:mutex} +\index{mutex@\onyxop{}{mutex}{}} +\item[{\onyxop{--}{mutex}{mutex}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Create a mutex. + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex 1 sprint +-mutex- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:nbpop} +\index{nbpop@\onyxop{}{nbpop}{}} +\item[{\onyxop{objects \dots count}{nbpop}{\dots}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[objects: ] + Zero or more objects. + \item[count: ] + Number of \oparg{objects} to pop. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the bottom \oparg{count} \oparg{objects} from ostack and + discard them. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' 2 nbpop pstack +`c' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:ncat} +\index{ncat@\onyxop{}{ncat}{}} +\item[{\onyxop{arrays count}{ncat}{array}}: ] +\item[{\onyxop{stacks count}{ncat}{stack}}: ] +\item[{\onyxop{strings count}{ncat}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[arrays: ] + \oparg{count} arrays. + \item[stacks: ] + \oparg{count} stacks. + \item[strings: ] + \oparg{count} strings. + \item[count: ] + Number of \oparg{arrays}, \oparg{stacks}, or + \oparg{strings} to catenate. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The catenation of \oparg{arrays}, \oparg{stacks}, or + \oparg{strings}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Catenate \oparg{count} \oparg{arrays}, \oparg{stacks}, or + \oparg{strings}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`a'] [`b'] [`c'] 3 ncat 1 sprint +[`a' `b' `c'] +onyx:0> (`a') (`b') (`c') 3 ncat 1 sprint +(`a' `b' `c') +onyx:0> `a' `b' `c' 3 ncat 1 sprint +`abc' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ndn} +\index{ndn@\onyxop{}{ndn}{}} +\item[{\onyxop{a \dots b count}{ndn}{\dots b a}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[\dots: ] + $count - 2$ objects. + \item[b: ] + An object. + \item[count: ] + Number of objects to rotate downward. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\dots: ] + $count - 2$ objects. + \item[b: ] + An object. + \item[a: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate \oparg{count} objects on ostack down one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' `d' `e' 4 ndn pstack +`b' +`e' +`d' +`c' +`a' +onyx:5> + \end{verbatim} + \end{description} +\label{systemdict:ndup} +\index{ndup@\onyxop{}{ndup}{}} +\item[{\onyxop{objects count}{ndup}{objects objects}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[objects: ] + Zero or more objects. + \item[count: ] + The number of \oparg{objects} do duplicate. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[objects: ] + The same objects that were passed in. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create duplicates of the top \oparg{count} objects on ostack. + For composite objects, the new object is a reference to the same + composite object. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' 2 ndup pstack +`c' +`b' +`c' +`b' +`a' +onyx:5> + \end{verbatim} + \end{description} +\label{systemdict:ne} +\index{ne@\onyxop{}{ne}{}} +\item[{\onyxop{a b}{ne}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{a} is not equal to \oparg{b}, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Compare two objects for inequality. Inequality has the + following meaning, depending on the types of \oparg{a} and + \oparg{b}: + \begin{description} + \item[array, condition, dict, file, hook, mutex, stack, + thread: ] \oparg{a} and \oparg{b} are not equal unless they + refer to the same memory. + \item[operator: ] \oparg{a} and \oparg{b} are not equal unless + they refer to the same function. + \item[name, string: ] \oparg{a} and \oparg{b} are not equal iff + they are lexically equivalent. A name can be equal to a string. + \item[boolean: ] \oparg{a} and \oparg{b} are not equal unless + they are the same value. + \item[integer, real: ] \oparg{a} and \oparg{b} are not equal + unless they are the same value. + \end{description} + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex mutex ne 1 sprint +true +onyx:0> mutex dup ne 1 sprint +false +onyx:0> $foo `foo' ne 1 sprint +false +onyx:0> $foo $bar ne 1 sprint +true +onyx:0> true false ne 1 sprint +true +onyx:0> true true ne 1 sprint +false +onyx:0> 1 1 ne 1 sprint +false +onyx:0> 1 2 ne 1 sprint +true +onyx:0> 1.0 1 ne 1 sprint +false +onyx:0> 1.0 1.1 ne 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:neg} +\index{neg@\onyxop{}{neg}{}} +\item[{\onyxop{a}{neg}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The negative of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the negative of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 neg 1 sprint +0 +onyx:0> 5 neg 1 sprint +-5 +onyx:0> -5 neg 1 sprint +5 +onyx:0> 3.14 neg 1 sprint +-3.140000e+00 +onyx:0> -3.14 neg 1 sprint +3.140000e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:nip} +\index{nip@\onyxop{}{nip}{}} +\item[{\onyxop{a b}{nip}{b}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[b: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Remove the second to top object from ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' +onyx:3> nip pstack +`c' +`a' +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:nonblocking} +\index{nonblocking@\onyxop{}{nonblocking}{}} +\item[{\onyxop{file}{nonblocking}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + Nonb-blocking mode for \oparg{file}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get non-blocking mode for \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open +onyx:1> dup nonblocking 1 sprint +false +onyx:1> dup true setnonblocking +onyx:1> dup nonblocking 1 sprint +true +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:not} +\index{not@\onyxop{}{not}{}} +\item[{\onyxop{a}{not}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or boolean. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + If \oparg{a} is an integer, the bitwise negation of + \oparg{a}, otherwise the logical negation of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the bitwise negation of an integer, or the logical + negation of a boolean. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true not 1 sprint +false +onyx:0> false not 1 sprint +true +onyx:0> 1 not 1 sprint +-2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:npop} +\index{npop@\onyxop{}{npop}{}} +\item[{\onyxop{objects count}{npop}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[objects: ] + Zero or more objects. + \item[count: ] + Number of \oparg{objects} to pop. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the top \oparg{count} \oparg{objects} from ostack and + discard them. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' 2 npop pstack +`a' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:nsleep} +\index{nsleep@\onyxop{}{nsleep}{}} +\item[{\onyxop{nanoseconds}{nsleep}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[nanoseconds: ] + Minimum number of nanoseconds to sleep. Must be greater + than 0. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Sleep for at least \oparg{nanoseconds} nanonseconds. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1000 nsleep +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:null} +\index{null@\onyxop{}{null}{}} +\item[{\onyxop{--}{null}{null}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[null: ] + A null object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Create a null object. + \item[Example(s): ]\begin{verbatim} + +onyx:0> null pstack +null +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:nup} +\index{nup@\onyxop{}{nup}{}} +\item[{\onyxop{a \dots b count}{nup}{b a \dots}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[\dots: ] + $count - 2$ objects. + \item[b: ] + An object. + \item[count: ] + Number of objects to rotate upward. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[b: ] + An object. + \item[a: ] + An object. + \item[\dots: ] + $count - 2$ objects. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate \oparg{count} objects on ostack up one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' `d' `e' 4 nup pstack +`d' +`c' +`b' +`e' +`a' +onyx:5> + \end{verbatim} + \end{description} +\label{systemdict:offset} +\index{offset@\onyxop{}{offset}{}} +\item[{\onyxop{input submatch}{offset}{offset}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[input: ] + A string. + \item[submatch: ] + A substring of \oparg{input}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[offset: ] + The integer offset of \oparg{submatch}, relative to the + beginning of \oparg{input}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the offset of \oparg{submatch}, relative to the beginning of + \oparg{input}. \oparg{submatch} must be a substring of + \oparg{input}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `input' dup `n(p)u' match {1 submatch offset 1 sprint} if +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:onyxdict} +\index{onyxdict@\onyxop{}{onyxdict}{}} +\item[{\onyxop{--}{onyxdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get onyxdict. See Section~\ref{sec:onyxdict} for details on + onyxdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> onyxdict 1 sprint +<$rpath_pre -array- $rpath_post -array- $mpath_pre -array- $mpath_post -array-> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:open} +\index{open@\onyxop{}{open}{}} +\item[{\onyxop{filename flags}{open}{file}}: ] +\item[{\onyxop{filename flags mode}{open}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[filename: ] + A string that represents a filename. + \item[flags: ] + A string that represents a file mode: + \begin{description}%\item[] + \item[`r': ] + Read only. + \item[`r+': ] + Read/write, starting at offset 0. + \item[`w': ] + Write only. Create file if necessary. Truncate + file if non-zero length. + \item[`w+': ] + Read/write, starting at offset 0. Create + file if necessary. + \item[`a': ] + Write only, starting at end of file. + \item[`a+': ] + Read/write, starting at end of file. + \end{description} + \item[mode: ] + Mode to use when creating a new file (defaults to 0777). + Note that the process's umask also affects creation + mode. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{limitcheck}{limitcheck}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Open a file. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:or} +\index{or@\onyxop{}{or}{}} +\item[{\onyxop{a b}{or}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or boolean. + \item[b: ] + The same type as \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + If \oparg{a} and \oparg{b} are integers, their bitwise + or, otherwise their logical or. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the bitwise or of two integers, or the logical or of + two booleans. + \item[Example(s): ]\begin{verbatim} + +onyx:0> false false or 1 sprint +false +onyx:0> true false or 1 sprint +true +onyx:0> 5 3 or 1 sprint +7 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ostack} +\index{ostack@\onyxop{}{ostack}{}} +\item[{\onyxop{--}{ostack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + A current snapshot (copy) of ostack. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a current snapshot of ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 3 ostack pstack +(1 2 3) +3 +2 +1 +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:output} +\index{output@\onyxop{}{output}{}} +\item[{\onyxop{obj depth}{output}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object to print syntactically. + \item[depth: ] + Maximum recursion depth. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Syntactically print \oparg{obj}. See + Section~\ref{sec:outputsdict} for format specifier details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 [2 3] 4] <$w 20 $p `_' $j $c $r 1> output `\n' print flush +___[1 -array- 4]____ +onyx:0> [1 [2 3] 4] <$w 20 $p `_' $j $c $r 2> output `\n' print flush +____[1 [2 3] 4]_____ +onyx:0> 4242 <$s $+> output `\n' print flush ++4242 +onyx:0> `0x' print 4242 <$b 16> output `\n' print flush +0x1092 +onyx:0> `0x' 4242 <$b 16> outputs cat <$w 10 $p `.'> +onyx:2> output `\n' print flush +....0x1092 +onyx:0> `0x' print 4242 <$w 8 $p `0' $b 16> output `\n' print flush +0x00001092 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:outputs} +\index{outputs@\onyxop{}{outputs}{}} +\item[{\onyxop{obj flags}{outputs}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object to print syntactically. + \item[depth: ] + Formatting flags. See Section~\ref{sec:outputsdict} for + details on the supported flags. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A formatted string representation of \oparg{obj}. + See Section~\ref{sec:outputsdict} for format specifier + details. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a formatted string representation of \oparg{obj}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 [2 3] 4] <$w 20 $p `_' $j $c $r 1> outputs print `\n' print flush +___[1 -array- 4]____ +onyx:0> [1 [2 3] 4] <$w 20 $p `_' $j $c $r 2> outputs print `\n' print flush +____[1 [2 3] 4]_____ +onyx:0> 4242 <$s $+> outputs print `\n' print flush ++4242 +onyx:0> `0x' print 4242 <$b 16> outputs print `\n' print flush +0x1092 +onyx:0> `0x' 4242 <$b 16> outputs cat <$w 10 $p `.'> outputs +onyx:1> print `\n' print flush +....0x1092 +onyx:0> `0x' print 4242 <$w 8 $p `0' $b 16> outputs print `\n' print flush +0x00001092 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:outputsdict} +\index{outputsdict@\onyxop{}{outputsdict}{}} +\item[{\onyxop{--}{outputsdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get outputsdict. See Section~\ref{sec:outputsdict} for details + on outputsdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> outputsdict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:over} +\index{over@\onyxop{}{over}{}} +\item[{\onyxop{a b}{over}{a b a}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Create a duplicate of the second object on ostack and push it + onto ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 1 2 over pstack +1 +2 +1 +0 +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:peername} +\index{peername@\onyxop{}{peername}{}} +\item[{\onyxop{sock}{peername}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary of information about the peer end of + \oparg{sock}. Depending on the socket family, the + following entries may exist: + \begin{description}%\item[] + \item[family: ] Socket family. + \item[address: ] IPv4 address. + \item[port: ] IPv4 port. + \item[path: ] Unix-domain socket path. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Get information about the peer end of \oparg{sock}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup `localhost' 7777 bindsocket +onyx:1> dup listen +onyx:1> dup accept +onyx:2> dup peername 1 sprint +<$family $AF_INET $address 2130706433 $port 33746> +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:pid} +\index{pid@\onyxop{}{pid}{}} +\item[{\onyxop{--}{pid}{pid}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[pid: ] + Process identifier. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the process ID of the running process. + \item[Example(s): ]\begin{verbatim} + +onyx:0> pid 1 sprint +80624 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:pipe} +\index{pipe@\onyxop{}{pipe}{}} +\item[{\onyxop{--}{pipe}{rfile wfile}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[rfile: ] + A readable file object. Data read from \oparg{rfile} + were previously written to \oparg{wfile}. + \item[wfile: ] + A writeable file object. Data written to \oparg{wfile} + can subsequently be read from \oparg{rfile}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a pipe. + \item[Example(s): ]\begin{verbatim} + +onyx:0> pipe +onyx:2> $wfile exch def +onyx:1> $rfile exch def +onyx:0> wfile `foo\n' write +onyx:0> wfile flushfile +onyx:0> rfile readline pop 1 sprint +`foo' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:poll} +\index{poll@\onyxop{}{poll}{}} +\item[{\onyxop{{\lt}file flags \dots{\gt} timeout}{poll}{{\lb}file + \dots{\rb}}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[{\lt}\dots{\gt}: ] + A dictionary of \oparg{file}/\oparg{flags} key/value + pairs. + \begin{description}%\item[] + \item[file: ] + A file object. + \item[flags: ] + A dictionary that contains keys corresponding to + file status attributes to poll. The following + keys are heeded: + \begin{description}%\item[] + \item[\$POLLIN: ] + Normal or priority data are available + for reading. + \item[\$POLLRDNORM: ] + Normal data are available for reading. + \item[\$POLLRDBAND: ] + Priority data are available for reading. + \item[\$POLLPRI: ] + High-priority data are available for + reading. + \item[\$POLLOUT: ] + Normal data can be written. + \item[\$POLLWRNORM: ] + Normal data can be written. + \item[\$POLLWRBAND: ] + Priority data can be written. + \end{description} + The values associated with the keys are + disregarded, but are set appropriately before + \onyxop{}{poll}{} returns (true/false). + \end{description} + \item[timeout: ] + Timeout, in milliseconds (maximum $2^{31} - 1$). -1 is + treated specially to mean infinite timeout. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[{\lb}\dots{\rb}: ] + An array containing a reference to each \oparg{file} in + \oparg{{\lt}\dots{\gt}} for which a non-zero number of + status attributes is set to true. A zero-length array + indicates that the poll timed out. + \begin{description}%\item[] + \item[file: ] + A reference to a file object passed in that has + one or more attributes set to true. + \end{description} + \end{description} + Although \oparg{{\lt}\dots{\gt}} is not returned, its contents + are modified. + \begin{description}\item[] + \item[flags: ] + The dictionary passed in. For recognized key that is + defined, the associated value is set to true or false, + depending on the status of \oparg{file}. In addition, + the following keys may defined (if not already defined) + with a value of true in the case of errors: + \begin{description}%\item[] + \item[\$POLLERR: ] + An error has occurred. + \item[\$POLLHUP: ] + Hangup has occurred. + \item[\$POLLNVAL: ] + \oparg{file} is not an open file. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Wait for any of the \oparg{flags} associated with a \oparg{file} + in \oparg{{\lt}\dots{\gt}} to be true. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stderr <$POLLWRNORM null>> dup 0 poll +onyx:2> 2 sprint 2 sprint +[-file- -file-] +<-file- <$POLLWRNORM true> -file- <$POLLOUT true>> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:pop} +\index{pop@\onyxop{}{pop}{}} +\item[{\onyxop{obj}{pop}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Remove the top object from ostack and discard it. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 +onyx:2> pstack +2 +1 +onyx:2> pop +onyx:1> pstack +1 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:pow} +\index{pow@\onyxop{}{pow}{}} +\item[{\onyxop{a b}{pow}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \item[b: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + \oparg{a} to the \oparg{b} power. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return \oparg{a} to the \oparg{b} power. If a negative exponent + is specified, the result will always be a real, even if both + arguments are integers. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 5 0 pow 1 sprint +1 +onyx:0> 5 1 pow 1 sprint +5 +onyx:0> 5 2 pow 1 sprint +25 +onyx:0> -5 3 pow 1 sprint +-125 +onyx:0> 5 -3 pow 1 sprint +8.000000e-03 +onyx:0> 2.1 3.5 pow 1 sprint +1.342046e+01 +onyx:0> 100 .01 pow 1 sprint +1.000000e+02 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:ppid} +\index{ppid@\onyxop{}{ppid}{}} +\item[{\onyxop{--}{ppid}{pid}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[pid: ] + Process identifier. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the process ID of the running process's parent. + \item[Example(s): ]\begin{verbatim} + +onyx:0> ppid 1 sprint +352 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:print} +\index{print@\onyxop{}{print}{}} +\item[{\onyxop{string}{print}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[string: ] + A string object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Print \oparg{string} to stdout. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `Hi\n' print flush +Hi +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:product} +\index{product@\onyxop{}{product}{}} +\item[{\onyxop{--}{product}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string that contains the product name, normally + `Canonware Onyx'. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the product string. The string returned is a reference to + the original product string. + \item[Example(s): ]\begin{verbatim} + +onyx:0> product pstack +`Canonware Onyx' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:pstack} +\index{pstack@\onyxop{}{pstack}{}} +\item[{\onyxop{--}{pstack}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \end{description} + \item[Description: ] + Syntactically print the elements of ostack, one per line. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' 1 mark $foo [1 2 3] (4 5 6) +onyx:6> pstack +(4 5 6) +[1 2 3] +$foo +-mark- +1 +`a' +onyx:6> + \end{verbatim} + \end{description} +\label{systemdict:put} +\index{put@\onyxop{}{put}{}} +\item[{\onyxop{array index obj}{put}{--}}: ] +\item[{\onyxop{dict key value}{put}{--}}: ] +\item[{\onyxop{string index integer}{put}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[dict: ] + A dict object. + \item[string: ] + A string object. + \item[index: ] + Offset in \oparg{array} or \oparg{string} to put + \oparg{obj} or \oparg{integer}, respectively. + \item[key: ] + An object to use as a key in \oparg{dict}. + \item[obj: ] + An object to insert into \oparg{array} at offset + \oparg{index}. + \item[value: ] + An object to associate with \oparg{key} in \oparg{dict}. + \item[integer: ] + The ascii value of a character to insert into + \oparg{string} at offset \oparg{index}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Insert into \oparg{array}, \oparg{dict}, or \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 array dup 1 `a' put 1 sprint +[null `a' null] +onyx:0> dict dup $foo `foo' put 1 sprint +<$foo `foo'> +onyx:0> 3 string dup 1 97 put 1 sprint +`\x00a\x00' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:putinterval} +\index{putinterval@\onyxop{}{putinterval}{}} +\item[{\onyxop{array index subarray}{putinterval}{--}}: ] +\item[{\onyxop{string index substring}{putinterval}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[array: ] + An array object. + \item[string: ] + A string object. + \item[index: ] + Offset into \oparg{array} or \oparg{string} to put + \oparg{subarray} or \oparg{substring}, respectively. + \item[subarray: ] + An array object to put into \oparg{array} at offset + \oparg{index}. When inserted \oparg{subarray} must not + extend past the end of \oparg{array}. + \item[substring: ] + A string object to put into \oparg{string} at offset + \oparg{index}. When inserted \oparg{substring} must not + extend past the end of \oparg{string}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Replace a portion of \oparg{array} or \oparg{string}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 array dup 1 [`a' `b'] putinterval 1 sprint +[null `a' `b' null] +onyx:0> 4 string dup 1 `ab' putinterval 1 sprint +`\x00ab\x00' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:pwd} +\index{pwd@\onyxop{}{pwd}{}} +\item[{\onyxop{--}{pwd}{path}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[path: ] + A string that represents the present working directory. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \end{description} + \item[Description: ] + Push a string onto ostack that represents the present working + directory. + \item[Example(s): ]\begin{verbatim} + +onyx:0> pwd +onyx:1> pstack +`/usr/local/bin' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:quit} +\index{quit@\onyxop{}{quit}{}} +\item[{\onyxop{--}{quit}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + Unwind the execution stack to the innermost + \htmlref{\onyxop{}{start}{}}{systemdict:start} context. Under + normal circumstances, there is always at least one such context. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stdin cvx start +onyx:0> estack 1 sprint +(--start-- -file- --start-- -file- --estack--) +onyx:0> quit +onyx:0> estack 1 sprint +(--start-- -file- --estack--) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:rand} +\index{rand@\onyxop{}{rand}{}} +\item[{\onyxop{--}{rand}{integer}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[integer: ] + A pseudo-random non-negative integer, with 63 bits of + psuedo-randomness. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Return a pseudo-random integer. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 srand +onyx:0> rand 1 sprint +9018578418316157091 +onyx:0> rand 1 sprint +8979240987855095636 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:read} +\index{read@\onyxop{}{read}{}} +\item[{\onyxop{file}{read}{integer boolean}}: ] +\item[{\onyxop{file string}{read}{substring boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[string: ] + A string object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[integer: ] + An integer that represents the ascii value of a + character that was read from \oparg{file}. + \item[substring: ] + A substring of \oparg{string} that contains data + read from \oparg{file}. + \item[boolean: ] + If true, end of file reached during read. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Read from \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup `Hello\n' write +onyx:1> dup flushfile +onyx:1> dup 0 seek +onyx:1> dup 10 string read +onyx:3> pop 1 sprint +`Hello\n' + \end{verbatim} + \end{description} +\label{systemdict:readline} +\index{readline@\onyxop{}{readline}{}} +\item[{\onyxop{file}{readline}{string boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string that contains a line of text from \oparg{file}. + \item[boolean: ] + If true, end of file reached during read. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Read a line of text from \oparg{file}. Lines are separated + by ``{\bs}n'' or ``{\bs}r{\bs}n'', which is removed. The + last line in a file may not have a newline at the end. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup `Hello\n' write +onyx:1> dup `Goodbye\n' write +onyx:1> dup 0 seek +onyx:1> dup readline 1 sprint 1 sprint +false +`Hello' +onyx:1> dup readline 1 sprint 1 sprint +false +`Goodbye' +onyx:1> dup readline 1 sprint 1 sprint +true +`' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:readlink} +\index{readlink@\onyxop{}{readlink}{}} +\item[{\onyxop{linkname}{readlink}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[linkname: ] + A string that represents the path of a symbolic link. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string that represents the link data associated with + \oparg{linkname}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Get the data for the symbolic link at \oparg{linkname}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `bar' `foo' symlink +onyx:0> `foo' readlink 1 sprint +`bar' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:realtime} +\index{realtime@\onyxop{}{realtime}{}} +\item[{\onyxop{--}{realtime}{nsecs}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[nsecs: ] + Number of nanoseconds since the epoch (midnight on 1 + January 1970). + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the number of nanoseconds since the epoch. + \item[Example(s): ]\begin{verbatim} + +onyx:0> realtime 1 sprint +993539837806479000 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:recv} +\index{recv@\onyxop{}{recv}{}} +\item[{\onyxop{sock string flags}{recv}{substring}}: ] +\item[{\onyxop{sock string}{recv}{substring}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[string: ] + A string to use as a buffer for the message being + received. + \item[flags: ] + An array of flag names. The following flags are + supported: + \begin{description}%\item[] + \item[\$MSG\_OOB] + \item[\$MSG\_PEEK] + \item[\$MSG\_WAITALL] + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[substring: ] + A substring of \oparg{string} that contains message + data. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_DGRAM socket +onyx:1> dup `localhost' 7777 bindsocket +onyx:1> dup true setnonblocking +onyx:1> dup 10 string recv +onyx:2> 1 sprint +`hello' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:regex} +\index{regex@\onyxop{}{regex}{}} +\item[{\onyxop{string flags}{regex}{regex}}: ] +\item[{\onyxop{string}{regex}{regex}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[string: ] + A string that specifies a regular expression. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[flags: ] + A dictionary of optional flags: + \begin{description}%\item[] + \item[\$c: ] + Continue where previous match ended. Don't + update the offset to start the next match from + unless this match is successful. Defaults to + false. + \item[\$g: ] + Continue where previous match ended. If the + match is unsuccessful, update the offset to + start the next match from to the beginning of + \oparg{input}. Defaults to false. + \item[\$i: ] Case insensitive. Defaults to false. + \item[\$m: ] Treat input as a multi-line string. + Defaults to false. + \item[\$s: ] Treat input as a single line, so that + the dot metacharacter matches any character, + including a newline. Defaults to false. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[regex: ] + A regex object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{regexerror}{regexerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a regex object, according to \oparg{string} and + \oparg{flags}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `pattern' regex 1 sprint +-regex- +onyx:0> `pattern' <$g true> regex 1 sprint +-regex- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:regsub} +\index{regsub@\onyxop{}{regsub}{}} +\item[{\onyxop{pattern template flags}{regsub}{regsub}}: ] +\item[{\onyxop{pattern template}{regsub}{regsub}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[pattern: ] + A string that specifies a regular expression. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[template: ] + A string that specifies a substitution template. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[flags: ] + A dictionary of optional flags: + \begin{description}%\item[] + \item[\$g: ] + Substitute all matches, if true, rather than + just the first match. Defaults to false. + \item[\$i: ] Case insensitive. Defaults to false. + \item[\$m: ] Treat input as a multi-line string. + Defaults to false. + \item[\$s: ] Treat input as a single line, so that + the dot metacharacter matches any character, + including a newline. Defaults to false. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[regsub: ] + A regsub object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{regexerror}{regexerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a regsub object, according to \oparg{pattern}, + \oparg{template}, and \oparg{flags}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `([a-z]+)' `<\1>' <$g true> regsub +onyx:1> 1 sprint +-regsub- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:rename} +\index{rename@\onyxop{}{rename}{}} +\item[{\onyxop{old new}{rename}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[old: ] + A string object that represents a file path. + \item[new: ] + A string object that represents a file path. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{limitcheck}{limitcheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \end{description} + \item[Description: ] + Rename a file or directory from \oparg{old} to \oparg{new}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/tdir' 8@755 mkdir +onyx:0> `/tmp/tdir' `/tmp/ndir' rename +onyx:0> `/tmp/ndir' {1 sprint} dirforeach +`.' +`..' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:repeat} +\index{repeat@\onyxop{}{repeat}{}} +\item[{\onyxop{count proc}{repeat}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[count: ] + Number of times to evaluate \oparg{proc} (non-negative). + \item[proc: ] + An object to evaluate. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Evaluate \oparg{proc} \oparg{count} times. This operator + supports the \htmlref{\onyxop{}{exit}{}}{systemdict:exit} + operator. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 {`hi' 1 sprint} repeat +`hi' +`hi' +`hi' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:require} +\index{require@\onyxop{}{require}{}} +\item[{\onyxop{file}{require}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A string that represents a module filename. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefined}{undefined}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \end{description} + \item[Description: ] + Search for and evaluate an Onyx source file. The file is + searched for by catenating a prefix, a ``/'', and \oparg{file} + to form a file path. Prefixes are tried in the following order: + \begin{enumerate} + \item{The ordered elements of the + \htmlref{rpath\_pre}{onyxdict:rpath_pre} array, which is + defined in \htmlref{onyxdict}{sec:onyxdict}.} + \item{If defined, the ordered elements of the + ONYX\_RPATH environment variable, which is a + colon-separated list.} + \item{The ordered elements of the + \htmlref{rpath\_post}{onyxdict:rpath_post} array, which + is defined in \htmlref{onyxdict}{sec:onyxdict}.} + \end{enumerate} + \item[Example(s): ]\begin{verbatim} + +onyx:0> `modgtk/modgtk_defs.nx' require +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:rmdir} +\index{rmdir@\onyxop{}{rmdir}{}} +\item[{\onyxop{path}{rmdir}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[path: ] + A string object that represents a directory path. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Remove an empty directory. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/tdir' 8@755 mkdir +onyx:0> `/tmp/tdir' rmdir +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:roll} +\index{roll@\onyxop{}{roll}{}} +\item[{\onyxop{region count amount}{roll}{rolled}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[region: ] + 0 or more objects to be rolled. + \item[count: ] + Number of objects in \oparg{region}. + \item[amount: ] + Amount by which to roll. If positive, roll + upward. If negative, roll downward. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[rolled: ] + Rolled version of \oparg{region}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Roll the top \oparg{count} objects on ostack (not counting + \oparg{count} and \oparg{amount}) by \oparg{amount} positions. + A positive \oparg{amount} indicates an upward roll, whereas a + negative \oparg{amount} indicates a downward roll. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 2 1 0 +onyx:4> pstack +0 +1 +2 +3 +onyx:4> 3 1 roll +onyx:4> pstack +1 +2 +0 +3 +onyx:4> 3 -2 roll +onyx:4> pstack +2 +0 +1 +3 +onyx:4> 4 0 roll +onyx:4> pstack +2 +0 +1 +3 +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:round} +\index{round@\onyxop{}{round}{}} +\item[{\onyxop{a}{round}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Integer round of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Round \oparg{a} to the nearest integer and return the result. + \item[Example(s): ]\begin{verbatim} + +onyx:0> -1.51 round 1 sprint +-2 +onyx:0> -1.49 round 1 sprint +-1 +onyx:0> 0 round 1 sprint +0 +onyx:0> 1.49 round 1 sprint +1 +onyx:0> 1.51 round 1 sprint +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:rot} +\index{rot@\onyxop{}{rot}{}} +\item[{\onyxop{\dots amount}{rot}{\dots}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[\dots: ] + One or more objects. + \item[amount: ] + Number of positions to rotate the stack upward. A + negative value causes downward rotation. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[\dots: ] + One or more objects. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate the stack contents up \oparg{amount} positions. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1 2 3 4 5 2 rot pstack clear +3 +2 +1 +5 +4 +onyx:0> 1 2 3 4 5 -2 rot pstack clear +2 +1 +5 +4 +3 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sadn} +\index{sadn@\onyxop{}{sadn}{}} +\item[{\onyxop{stack}{sadn}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate the contents of \oparg{stack} down one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3 4) dup sadn 1 sprint +(2 3 4 1) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:saup} +\index{saup@\onyxop{}{saup}{}} +\item[{\onyxop{stack}{saup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate the contents of \oparg{stack} up one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3 4) dup saup 1 sprint +(4 1 2 3) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sbdup} +\index{sbdup@\onyxop{}{sbdup}{}} +\item[{\onyxop{stack}{sbdup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Duplicate the bottom object on \oparg{stack} and push it onto + \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (2 1 0) dup sbdup pstack +(2 1 0 2) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sbpop} +\index{sbpop@\onyxop{}{sbpop}{}} +\item[{\onyxop{stack}{sbpop}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Pop \oparg{obj} off the bottom of \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3) dup sbpop pstack +1 +(2 3) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:sbpush} +\index{sbpush@\onyxop{}{sbpush}{}} +\item[{\onyxop{stack obj}{sbpush}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Push \oparg{obj} onto the bottom of \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (0) dup 1 sbpush +onyx:1> pstack +(1 0) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sclear} +\index{sclear@\onyxop{}{sclear}{}} +\item[{\onyxop{stack}{sclear}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove all objects on \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3 4) dup sclear pstack +() +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:scleartomark} +\index{scleartomark@\onyxop{}{scleartomark}{}} +\item[{\onyxop{stack}{scleartomark}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unmatchedmark}{unmatchedmark}.] + \end{description} + \item[Description: ] + Remove objects from \oparg{stack} down to and including the + topmost mark. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 mark 1 0) dup scleartomark pstack +(3) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:scount} +\index{scount@\onyxop{}{scount}{}} +\item[{\onyxop{stack}{scount}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + The number of objects on \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the number of objects on \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2) scount 1 sprint +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:scounttomark} +\index{scounttomark@\onyxop{}{scounttomark}{}} +\item[{\onyxop{stack}{scounttomark}{count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[count: ] + The depth of the topmost mark on \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unmatchedmark}{unmatchedmark}.] + \end{description} + \item[Description: ] + Get the depth of the topmost mark on \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 mark 1 0) scounttomark 1 sprint +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sdn} +\index{sdn@\onyxop{}{sdn}{}} +\item[{\onyxop{stack}{sdn}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate the top three objects on \oparg{stack} down one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) dup sdn pstack +(3 1 0 2) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sdup} +\index{sdup@\onyxop{}{sdup}{}} +\item[{\onyxop{stack}{sdup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Duplicate the top object on \oparg{stack} and push it onto + \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1) dup sdup 1 sprint +(1 1) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:search} +\index{search@\onyxop{}{search}{}} +\item[{\onyxop{string pattern}{search}{post pattern pre true}}: ] +\item[{\onyxop{string pattern}{search}{string false}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[string: ] + A string object. + \item[pattern: ] + A string that represents a substring to search for in + \oparg{string}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[post: ] + The substring of \oparg{string} that follows the match. + \item[pattern: ] + The substring of \oparg{string} that matches the input + \oparg{pattern}. + \item[pre: ] + The substring of \oparg{string} that precedes the match. + \item[true: ] + Success. + \item[string: ] + The same object as the input \oparg{string}. + \item[false: ] + Failure. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Search for the first instance of \oparg{pattern} in + \oparg{string}, and if found, return substrings that partition + \oparg{string} into \oparg{pre}, \oparg{pattern}, and + \oparg{post}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `abcabc' `ab' search pstack clear +true +`' +`ab' +`cabc' +onyx:0> `abcabc' `ca' search pstack clear +true +`ab' +`ca' +`bc' +onyx:0> `abcabc' `cb' search pstack clear +false +`abcabc' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:seek} +\index{seek@\onyxop{}{seek}{}} +\item[{\onyxop{file offset}{seek}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[offset: ] + Offset in bytes from the beginning of \oparg{file} + to move the file position pointer to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Move the file position pointer for \oparg{file} to + \oparg{offset}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup `Hello\n' write +onyx:1> dup 0 seek +onyx:1> readline pstack +false +`Hello' +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:self} +\index{self@\onyxop{}{self}{}} +\item[{\onyxop{--}{self}{thread}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object that corresponds to the running thread. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a thread object for the running thread. + \item[Example(s): ]\begin{verbatim} + +onyx:0> self 1 sprint +-thread- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:send} +\index{send@\onyxop{}{send}{}} +\item[{\onyxop{sock mesg flags}{send}{nsend}}: ] +\item[{\onyxop{sock mesg}{send}{nsend}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[mesg: ] + A message string. + \item[flags: ] + An array of flag names. The following flags are + supported: + \begin{description}%\item[] + \item[\$MSG\_OOB] + \item[\$MSG\_PEEK] + \item[\$MSG\_WAITALL] + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[nsend: ] + Number of bytes of \oparg{mesg} actually sent. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Send a message. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_DGRAM socket +onyx:1> dup `localhost' 7777 connect +onyx:1> dup `hello' send +onyx:2> 1 sprint +5 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:serviceport} +\index{serviceport@\onyxop{}{serviceport}{}} +\item[{\onyxop{service}{serviceport}{port}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[service: ] + A string that represents a network service name. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[port: ] + The port number corresponding to \oparg{service}, or 0 + if the service is unknown. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + \item[Example(s): ]\begin{verbatim} + +onyx:0> `ftp' serviceport 1 sprint +21 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setegid} +\index{setegid@\onyxop{}{setegid}{}} +\item[{\onyxop{gid}{setegid}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[gid: ] + A group ID. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, success, otherwise failure. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the process's effective group ID to \oparg{gid}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1001 setegid 1 sprint +false +onyx:0> 0 setegid 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setenv} +\index{setenv@\onyxop{}{setenv}{}} +\item[{\onyxop{key val}{setenv}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[key: ] + A name object. + \item[val: ] + A value to associate with \oparg{key}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set an environment variable named \oparg{key} and associate + \oparg{val} with it. If \oparg{val} is not a string, it is + converted to a string using the + \htmlref{\onyxop{}{cvs}{}}{systemdict:cvs} operator before the + environment variable is set. A corresponding entry is also + created in the envdict dictionary. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $foo `foo' setenv +onyx:0> envdict $foo known 1 sprint +true +onyx:0> envdict $foo get 1 sprint +`foo' +onyx:0> $foo unsetenv +onyx:0> envdict $foo known 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:seteuid} +\index{seteuid@\onyxop{}{seteuid}{}} +\item[{\onyxop{uid}{seteuid}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[uid: ] + A user ID. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, success, otherwise failure. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the process's effective user ID to \oparg{uid}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1001 seteuid 1 sprint +false +onyx:0> 0 seteuid 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setgid} +\index{setgid@\onyxop{}{setgid}{}} +\item[{\onyxop{gid}{setgid}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[gid: ] + A group ID. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, success, otherwise failure. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the process's group ID to \oparg{gid}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1001 setgid 1 sprint +false +onyx:0> 0 setgid 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setgstderr} +\index{setgstderr@\onyxop{}{setgstderr}{}} +\item[{\onyxop{file}{setgstderr}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file to set the global stderr to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the global stderr to \oparg{file}. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/stderr' `w' open dup 0 setiobuf setgstderr +onyx:0> () {stderr `Some text\n' write} thread join +onyx:0> `/tmp/stderr' `r' open readline pop 1 sprint +`Some text' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setgstdin} +\index{setgstdin@\onyxop{}{setgstdin}{}} +\item[{\onyxop{file}{setgstdin}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file to set the global stdin to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the global stdin to \oparg{file}. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ] + Under normal interactive operation, stdin is pushed onto estack + during interpreter initialization and evaluated until EOF is + reached. Therefore, changing stdin has no effect on the file + descriptor already on estack. The following example recursively + evaluates stdin after redefining it. +\begin{verbatim} + +lawine:~> cat /tmp/stdin +1 2 3 pstack +lawine:~> onyx +Canonware Onyx, version 3.1.0. +onyx:0> `/tmp/stdin' `r' open cvx setgstdin +onyx:0> () {stdin eval} thread join +3 +2 +1 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setgstdout} +\index{setgstdout@\onyxop{}{setgstdout}{}} +\item[{\onyxop{file}{setgstdout}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file to set the global stdout to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the global stdout to \oparg{file}. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ] + In the following example, the prompt continues to be printed, + even though stdout has been redefined, because the prompt module + was initialized to print to file descriptor 1. This + demonstrates the only known exception in the stock Onyx + interpreter where redefining stdout will not redirect output. +\begin{verbatim} + +onyx:0> `/tmp/stdout' `w' open dup 0 setiobuf setgstdout +onyx:0> () {`Some text\n' print} thread join +onyx:0> `/tmp/stdout' `r' open readline pop 1 sprint +`Some text' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setiobuf} +\index{setiobuf@\onyxop{}{setiobuf}{}} +\item[{\onyxop{file count}{setiobuf}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[count: ] + The size in bytes to set the I/O buffer associated with + \oparg{file} to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the size of the I/O buffer associated with \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stdout iobuf 1 sprint +512 +onyx:0> stdout 0 setiobuf +onyx:0> stdout iobuf 1 sprint +0 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setlocking} +\index{setlocking@\onyxop{}{setlocking}{}} +\item[{\onyxop{boolean}{setlocking}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[boolean: ] + A boolean to set the implicit locking mode to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the current implicit locking mode. See + Section~\ref{sec:onyx_implicit_synchronization} for implicit + synchronization details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> currentlocking 1 sprint +false +onyx:0> true setlocking +onyx:0> currentlocking 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setnonblocking} +\index{setnonblocking@\onyxop{}{setnonblocking}{}} +\item[{\onyxop{file boolean}{setnonblocking}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[boolean: ] + Non-blocking mode to set \oparg{file} to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set non-blocking mode for \oparg{file} to \oparg{boolean}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open +onyx:1> dup nonblocking 1 sprint +false +onyx:1> dup true setnonblocking +onyx:1> dup nonblocking 1 sprint +true +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:setsockopt} +\index{setsockopt@\onyxop{}{setsockopt}{}} +\item[{\onyxop{sock level optname optval}{setsockopt}{--}}: ] +\item[{\onyxop{sock optname optval}{setsockopt}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[level: ] + Level at which to set the socket option. If not + specified, \$SOL\_SOCKET is used. + \item[optname: ] + Name of option to set the value of. The following + option names are supported: + \begin{description}%\item[] + \item[\$SO\_DEBUG] + \item[\$SO\_REUSEADDR] + \item[\$SO\_REUSEPORT] + \item[\$SO\_KEEPALIVE] + \item[\$SO\_DONTROUTE] + \item[\$SO\_BROADCAST] + \item[\$SO\_OOBINLINE] + \item[\$SO\_SNDBUF] + \item[\$SO\_RCVBUF] + \item[\$SO\_SNDLOWAT] + \item[\$SO\_RCVLOWAT] + \item[\$SO\_TYPE] + \item[\$SO\_ERROR: ] + \oparg{optval} is an integer. + \item[\$SO\_LINGER: ] + \oparg{optval} is a dictionary, and the + following entries are defined: + \begin{description}%\item[] + \item[\$on: ] + Boolean. + \item[\$time: ] + Linger time in seconds. + \end{description} + \item[\$SO\_SNDTIMEO] + \item[\$SO\_RCVTIMEO: ] + \oparg{optval} is an integer, in nanoseconds. + \end{description} + \item[optval: ] + Value to associate with \oparg{optname}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Set a socket option. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup $SO_OOBINLINE sockopt 1 sprint +0 +onyx:1> dup $SO_OOBINLINE 1 setsockopt +onyx:1> dup $SO_OOBINLINE sockopt 1 sprint +1 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:setstderr} +\index{setstderr@\onyxop{}{setstderr}{}} +\item[{\onyxop{file}{setstderr}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file to set the calling thread's stderr to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the thread's stderr to \oparg{file}. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/stderr' `w' open dup 0 setiobuf setstderr +onyx:0> stderr `Some text\n' write +onyx:0> `/tmp/stderr' `r' open readline pop 1 sprint +`Some text' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setstdin} +\index{setstdin@\onyxop{}{setstdin}{}} +\item[{\onyxop{file}{setstdin}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file to set the calling thread's stdin to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the thread's stdin to \oparg{file}. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ] + Under normal interactive operation, stdin is pushed onto estack + during interpreter initialization and evaluated until EOF is + reached. Therefore, changing stdin has no effect on the file + descriptor already on estack. The following example recursively + evaluates stdin after redefining it. +\begin{verbatim} + +lawine:~> cat /tmp/stdin +1 2 3 pstack +lawine:~> onyx +Canonware Onyx, version 3.1.0. +onyx:0> `/tmp/stdin' `r' open cvx setstdin +onyx:0> stdin eval +3 +2 +1 +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:setstdout} +\index{setstdout@\onyxop{}{setstdout}{}} +\item[{\onyxop{file}{setstdout}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file to set the calling thread's stdout to. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the thread's stdout to \oparg{file}. See + Section~\ref{sec:onyx_standard_io} for standard I/O details. + \item[Example(s): ] + In the following example, the prompt continues to be printed, + even though stdout has been redefined, because the prompt module + was initialized to print to file descriptor 1. This + demonstrates the only known exception in the stock Onyx + interpreter where redefining stdout will not redirect output. +\begin{verbatim} + +onyx:0> `/tmp/stdout' `w' open dup 0 setiobuf setstdout +onyx:0> `Some text\n' print +onyx:0> gstdout setstdout +onyx:0> `/tmp/stdout' `r' open readline pop 1 sprint +`Some text' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:setuid} +\index{setuid@\onyxop{}{setuid}{}} +\item[{\onyxop{uid}{setuid}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[uid: ] + A user ID. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, success, otherwise failure. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the process's user ID to \oparg{uid}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 1001 setuid 1 sprint +false +onyx:0> 0 setuid 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sexch} +\index{sexch@\onyxop{}{sexch}{}} +\item[{\onyxop{stack}{sexch}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Exchange the top two objects on \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3) dup sexch pstack +(1 3 2) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:shift} +\index{shift@\onyxop{}{shift}{}} +\item[{\onyxop{--}{shift}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer. + \item[shift: ] + An integer that represents a bitwise shift amount. + Negative means right shift, and positive means left + shift. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + \oparg{a} shifted by \oparg{shift} bits. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Shift an integer bitwise. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 1 shift 1 sprint +8 +onyx:0> 4 -1 shift 1 sprint +2 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sibdup} +\index{sibdup@\onyxop{}{sibdup}{}} +\item[{\onyxop{stack index}{sibdup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[index: ] + Offset from bottom of \oparg{stack}, counting from 0, of + the object to duplicate. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the object on \oparg{stack} that is at + offset \oparg{index} from the bottom of \oparg{stack} and push + it onto \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) dup 2 sibdup pstack +(3 2 1 0 1) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sibpop} +\index{sibpop@\onyxop{}{sibpop}{}} +\item[{\onyxop{stack index}{sibpop}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[index: ] + Offset from bottom of \oparg{stack}, counting from 0, of + the object to remove from \oparg{stack}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + An object removed from \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the \oparg{obj} from \oparg{stack} that is at offset + \oparg{index} from the bottom of \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (0 1 2 3) dup 2 sibpop pstack +2 +(0 1 3) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:sidup} +\index{sidup@\onyxop{}{sidup}{}} +\item[{\onyxop{stack index}{sidup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[index: ] + Depth (count starts at 0) of the object to duplicate in + \oparg{stack}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the object on \oparg{stack} at depth + \oparg{index} and push it onto \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) dup 2 sidup +onyx:1> 1 sprint +(3 2 1 0 2) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:signal} +\index{signal@\onyxop{}{signal}{}} +\item[{\onyxop{condition}{signal}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Signal a thread that is waiting on \oparg{condition}. If there + are no waiters, this operator has no effect. + \item[Example(s): ]\begin{verbatim} + +onyx:0> condition mutex dup lock ostack +onyx:3> {dup lock exch signal unlock} +onyx:4> thread 3 1 roll +onyx:3> dup 3 1 roll +onyx:4> wait unlock join +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sin} +\index{sin@\onyxop{}{sin}{}} +\item[{\onyxop{a}{sin}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Sine of \oparg{a} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the sine of \oparg{a} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 sin 1 sprint +0.000000e+00 +onyx:0> 1.570796 sin 1 sprint +1.000000e+00 +onyx:0> 0.7853982 sin 1 sprint +7.071068e-01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sinh} +\index{sinh@\onyxop{}{sinh}{}} +\item[{\onyxop{a}{sinh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Hyperbolic sine of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the hyperbolic sine of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 sinh 1 sprint +1.001787e+01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sipop} +\index{sipop@\onyxop{}{sipop}{}} +\item[{\onyxop{stack index}{sipop}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[index: ] + Offset from top of \oparg{stack}, counting from 0, of + the object to remove from \oparg{stack}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + An object removed from \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the \oparg{obj} at \oparg{index} from \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) dup 2 sipop pstack +2 +(3 1 0) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:snbpop} +\index{snbpop@\onyxop{}{snbpop}{}} +\item[{\onyxop{stack count}{snbpop}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[count: ] + Number of objects to pop off the bottom of + \oparg{stack}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of objects popped off the bottom of + \oparg{stack}, with the same object ordering as when on + \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Pop \oparg{count} objects off the bottom of \oparg{stack} and + put them into an array. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3 4) dup 2 snbpop pstack +[1 2] +(3 4) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:sndn} +\index{sndn@\onyxop{}{sndn}{}} +\item[{\onyxop{stack count}{sndn}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[count: ] + Number of objects on \oparg{stack} to rotate down one + position. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate \oparg{count} objects on \oparg{stack} down one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (5 4 3 2 1 0) dup 4 sndn pstack +(5 4 2 1 0 3) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sndup} +\index{sndup@\onyxop{}{sndup}{}} +\item[{\onyxop{stack count}{sndup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[count: ] + Number of objects on \oparg{stack} to duplicate. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create duplicates of the top \oparg{count} objects on + \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) dup 2 sndup pstack +(3 2 1 0 1 0) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:snip} +\index{snip@\onyxop{}{snip}{}} +\item[{\onyxop{stack}{snip}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The object that was the second to top object on + \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Remove the second to top object from \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (2 1 0) dup snip pstack +1 +(2 0) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:snpop} +\index{snpop@\onyxop{}{snpop}{}} +\item[{\onyxop{stack count}{snpop}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[count: ] + Number of objects to pop off of \oparg{stack}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of objects popped off of \oparg{stack}, with + the same object ordering as when on \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Pop \oparg{count} objects off of \oparg{stack} and put them into + an array. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3 4) dup 2 snpop pstack +[3 4] +(1 2) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:snup} +\index{snup@\onyxop{}{snup}{}} +\item[{\onyxop{stack count}{snup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[count: ] + Number of objects on \oparg{stack} to rotate up one + position. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate \oparg{count} objects on \oparg{stack} up one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (5 4 3 2 1 0) dup 4 snup pstack +(5 4 0 3 2 1) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:socket} +\index{socket@\onyxop{}{socket}{}} +\item[{\onyxop{family type proto}{socket}{sock}}: ] +\item[{\onyxop{family type}{socket}{sock}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[family: ] + The name of a socket address family, either \$AF\_INET + or \$AF\_LOCAL. + \item[type: ] + The name of a socket type, either \$SOCK\_STREAM or + \$SOCK\_DGRAM. + \item[proto: ] + The name of a socket protocol. This argument is not + useful, given the current limited choice of address + families. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a socket. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> $AF_LOCAL $SOCK_DGRAM socket +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:socketpair} +\index{socketpair@\onyxop{}{socketpair}{}} +\item[{\onyxop{family type proto}{socketpair}{sock sock}}: ] +\item[{\onyxop{family type}{socketpair}{sock sock}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[family: ] + The name of a socket address family, either \$AF\_INET + or \$AF\_LOCAL. + \item[type: ] + The name of a socket type, either \$SOCK\_STREAM or + \$SOCK\_DGRAM. + \item[proto: ] + The name of a socket protocol. This argument is not + useful, given the current limited choice of address + families. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[sock: ] + A connected socket. There are no functional differences + between the two sockets that are returned. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{invalidaccess}{invalidaccess}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a pair of sockets that are connected to each other. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_LOCAL $SOCK_STREAM socketpair +onyx:2> pstack +-file- +-file- +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:sockname} +\index{sockname@\onyxop{}{sockname}{}} +\item[{\onyxop{sock}{sockname}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary of information about \oparg{sock}. + Depending on the socket family, the following entries + may exist: + \begin{description}%\item[] + \item[family: ] Socket family. + \item[address: ] IPv4 address. + \item[port: ] IPv4 port. + \item[path: ] Unix-domain socket path. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{neterror}{neterror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Get information about \oparg{sock}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup `localhost' bindsocket +onyx:1> dup sockname 1 sprint +<$family $AF_INET $address 2130706433 $port 33745> +onyx:1> close +onyx:0> $AF_LOCAL $SOCK_STREAM socket +onyx:1> dup `/tmp/socket' bindsocket +onyx:1> dup sockname 1 sprint +<$family $AF_LOCAL $path `/tmp/socket'> +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sockopt} +\index{sockopt@\onyxop{}{sockopt}{}} +\item[{\onyxop{sock level optname}{sockopt}{optval}}: ] +\item[{\onyxop{sock optname}{sockopt}{optval}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[sock: ] + A socket. + \item[level: ] + Level at which to get the socket option. If not + specified, \$SOL\_SOCKET is used. + \item[optname: ] + Name of option to get the value of. The following + option names are supported: + \begin{description}%\item[] + \item[\$SO\_DEBUG] + \item[\$SO\_REUSEADDR] + \item[\$SO\_REUSEPORT] + \item[\$SO\_KEEPALIVE] + \item[\$SO\_DONTROUTE] + \item[\$SO\_BROADCAST] + \item[\$SO\_OOBINLINE] + \item[\$SO\_SNDBUF] + \item[\$SO\_RCVBUF] + \item[\$SO\_SNDLOWAT] + \item[\$SO\_RCVLOWAT] + \item[\$SO\_TYPE] + \item[\$SO\_ERROR: ] + \oparg{optval} is an integer. + \item[\$SO\_LINGER: ] + \oparg{optval} is a dictionary, and the + following entries are defined: + \begin{description}%\item + \item[\$on: ] + Boolean. + \item[\$time: ] + Linger time in seconds. + \end{description} + \item[\$SO\_SNDTIMEO] + \item[\$SO\_RCVTIMEO: ] + \oparg{optval} is an integer, in nanoseconds. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[optval: ] + Value associated with \oparg{optname}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{argcheck}{argcheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Get a socket option. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $AF_INET $SOCK_STREAM socket +onyx:1> dup $SO_SNDBUF sockopt 1 sprint +16384 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sover} +\index{sover@\onyxop{}{sover}{}} +\item[{\onyxop{stack}{sover}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the second object on \oparg{stack} and + push it onto \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (2 1 0) dup sover pstack +(2 1 0 1) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:split} +\index{split@\onyxop{}{split}{}} +\item[{\onyxop{input pattern flags limit}{split}{array}}: ] +\item[{\onyxop{input pattern flags}{split}{array}}: ] +\item[{\onyxop{input pattern limit}{split}{array}}: ] +\item[{\onyxop{input pattern}{split}{array}}: ] +\item[{\onyxop{input regex limit}{split}{array}}: ] +\item[{\onyxop{input regex}{split}{array}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[input: ] + An input string to find matches in. + \item[pattern: ] + A string that specifies a regular expression. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[flags: ] + A dictionary of optional flags: + \begin{description}%\item[] + \item[\$i: ] Case insensitive. Defaults to false. + \item[\$m: ] Treat input as a multi-line string. + Defaults to false. + \item[\$s: ] Treat input as a single line, so that + the dot metacharacter matches any character, + including a newline. Defaults to false. + \end{description} + \item[regex: ] + A regex object. + \item[limit: ] + Split \oparg{input} into no more than \oparg{limit} + substrings. 0 is treated as infinity. Defaults to 0. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[array: ] + An array of substrings containing the text between + pattern matches. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{regexerror}{regexerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create an array of substrings from \oparg{input} that are + separated by portions of \oparg{input} that match a regular + expression. + + If there are capturing subpatterns in the regular expression, + also create substrings for those capturing subpatterns and + insert them into the substring array. + + As a special case, if the regular expression matches the empty + string, split a single character. This avoids an infinite + loop. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a:b:c' `:' split 1 sprint +[`a' `b' `c'] +onyx:0> `a:b:c' `:' 2 split 1 sprint +[`a' `b:c'] +onyx:0> `a:b:c' `(:)' split 1 sprint +[`a' `:' `b' `:' `c'] +onyx:0> `a:b:c' `' split 1 sprint +[`a' `:' `b' `:' `c'] +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:spop} +\index{spop@\onyxop{}{spop}{}} +\item[{\onyxop{stack}{spop}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The object that was popped off of \oparg{stack}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Pop an object off of \oparg{stack} and push it onto ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2) dup spop +onyx:2> pstack +2 +(1) +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:sprint} +\index{sprint@\onyxop{}{sprint}{}} +\item[{\onyxop{obj depth}{sprint}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object to print syntactically. + \item[depth: ] + Maximum recursion depth. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Syntactically print \oparg{obj}. See + Section~\ref{sec:sprintsdict} for printing details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 [2 3] 4] +onyx:1> dup 0 sprint +-array- +onyx:1> dup 1 sprint +[1 -array- 4] +onyx:1> dup 2 sprint +[1 [2 3] 4] +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sprints} +\index{sprints@\onyxop{}{sprints}{}} +\item[{\onyxop{obj depth}{sprints}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object to print syntactically. + \item[depth: ] + Maximum recursion depth. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A syntactical string representation of \oparg{obj}. + See Section~\ref{sec:sprintsdict} for printing details. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a syntactical string representation of \oparg{obj}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [1 [2 3] 4] +onyx:1> dup 0 sprints print `\n' print flush +-array- +onyx:1> dup 1 sprints print `\n' print flush +[1 -array- 4] +onyx:1> dup 2 sprints print `\n' print flush +[1 [2 3] 4] +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sprintsdict} +\index{sprintsdict@\onyxop{}{sprintsdict}{}} +\item[{\onyxop{--}{sprintsdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get sprintsdict. See Section~\ref{sec:sprintsdict} for details + on sprintsdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> sprintsdict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:spush} +\index{spush@\onyxop{}{spush}{}} +\item[{\onyxop{stack obj}{spush}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Push \oparg{obj} onto \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (0) dup 1 spush +onyx:1> pstack +(0 1) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sqrt} +\index{sqrt@\onyxop{}{sqrt}{}} +\item[{\onyxop{a}{sqrt}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + A non-negative integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Square root of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the square root of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 4 sqrt 1 sprint +2.000000e+00 +onyx:0> 2.0 sqrt 1 sprint +1.414214e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:srand} +\index{srand@\onyxop{}{srand}{}} +\item[{\onyxop{seed}{srand}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[seed: ] + A non-negative integer. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Seed the pseudo-random number generator with \oparg{seed}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 5 srand +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:sroll} +\index{sroll@\onyxop{}{sroll}{}} +\item[{\onyxop{stack count amount}{sroll}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \item[count: ] + Number of objects to roll in \oparg{stack}. + \item[amount: ] + Amount by which to roll. If positive, roll + upward. If negative, roll downward. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Roll the top \oparg{count} objects on \oparg{stack} by + \oparg{amount} positions. A positive \oparg{amount} + indicates an upward roll, whereas a negative \oparg{amount} + indicates a downward roll. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) +onyx:1> dup 3 1 sroll pstack +(3 0 2 1) +onyx:1> dup 3 -2 sroll pstack +(3 1 0 2) +onyx:1> dup 4 0 sroll pstack +(3 1 0 2) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:srot} +\index{srot@\onyxop{}{srot}{}} +\item[{\onyxop{stack amount}{srot}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + One or more objects. + \item[amount: ] + Number of positions to rotate \oparg{stack} upward. A + negative value causes downward rotation. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate \oparg{stack} up \oparg{count} positions. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2 3 4 5) dup 2 srot 1 sprint +(4 5 1 2 3) +onyx:0> (1 2 3 4 5) dup -2 srot 1 sprint +(3 4 5 1 2) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:stack} +\index{stack@\onyxop{}{stack}{}} +\item[{\onyxop{--}{stack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + An empty stack object. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Create a new stack object and push it onto ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stack +onyx:1> pstack +() + \end{verbatim} + \end{description} +\label{systemdict:start} +\index{start@\onyxop{}{start}{}} +\item[{\onyxop{obj}{start}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Evaluate \oparg{obj}. This operator provides a context that + silently terminates execution stack unwinding due to the + \htmlref{\onyxop{}{exit}{}}{systemdict:exit}, + \htmlref{\onyxop{}{quit}{}}{systemdict:quit}, and + \htmlref{\onyxop{}{stop}{}}{systemdict:stop} operators. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stdin cvx start +onyx:0> quit +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:status} +\index{status@\onyxop{}{status}{}} +\item[{\onyxop{file/filename}{status}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[filename: ] + A string that represents a filename. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary that contains the following entries: + \begin{description}%\item[] + \item[dev: ] + Inode's device. + \item[ino: ] + Inode's number. + \item[mode: ] + Inode permissions. + \item[nlink: ] + Number of hard links. + \item[uid: ] + User ID of the file owner. + \item[gid: ] + Group ID of the file owner. + \item[rdev: ] + Device type. + \item[size: ] + File size in bytes. + \item[atime: ] + Time of last access, in nanoseconds since the + epoch. + \item[mtime: ] + Time of last modification, in nanoseconds since + the epoch. + \item[ctime: ] + Time of last file status change, in nanoseconds + since the epoch. + \item[blksize: ] + Optimal block size for I/O. + \item[blocks: ] + Number of blocks allocated. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Get status information about a file. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp' status 1 sprint +<$dev 134405 $ino 2 $mode 17407 $nlink 5 $uid 0 $gid 0 $rdev 952 $size 3584 +$atime 994883041000000000 $mtime 994883041000000000 $ctime 994883041000000000 +$blksize 0 $blocks 8> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:stderr} +\index{stderr@\onyxop{}{stderr}{}} +\item[{\onyxop{--}{stderr}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object corresponding to the calling thread's + stderr. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the thread's stderr. See Section~\ref{sec:onyx_standard_io} + for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stderr pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:stdin} +\index{stdin@\onyxop{}{stdin}{}} +\item[{\onyxop{--}{stdin}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object corresponding to the calling thread's + stdin. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the thread's stdin. See Section~\ref{sec:onyx_standard_io} + for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stdin pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:stdout} +\index{stdout@\onyxop{}{stdout}{}} +\item[{\onyxop{--}{stdout}{file}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + A file object corresponding to the calling thread's + stdout. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the thread's stdout. See Section~\ref{sec:onyx_standard_io} + for standard I/O details. + \item[Example(s): ]\begin{verbatim} + +onyx:0> stdout pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:stop} +\index{stop@\onyxop{}{stop}{}} +\item[{\onyxop{--}{stop}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + Unwind the execution stack to the innermost + \htmlref{\onyxop{}{stopped}{}}{systemdict:stopped} or + \htmlref{\onyxop{}{start}{}}{systemdict:start} context. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {stop} stopped 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:stopped} +\index{stopped@\onyxop{}{stopped}{}} +\item[{\onyxop{obj}{stopped}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object to evaluate. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if stop operator was executed, false otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidexit}{invalidexit}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Evaluate \oparg{obj}. This operator provides a context that + terminates execution stack unwinding due to the + \htmlref{\onyxop{}{stop}{}}{systemdict:stop}. It will also + terminate execution stack unwinding due to the + \htmlref{\onyxop{}{exit}{}}{systemdict:exit} operator, but will + throw an \htmlref{invalidexit}{invalidexit} error, then do the + equivalent of calling + \htmlref{\onyxop{}{quit}{}}{systemdict:quit}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {stop} stopped 1 sprint +true +onyx:0> {} stopped 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:string} +\index{string@\onyxop{}{string}{}} +\item[{\onyxop{length}{string}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[length: ] + Non-negative number of bytes. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string of \oparg{length} bytes. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a string of \oparg{length} bytes. The bytes are + initialized to 0. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 string 1 sprint +`\x00\x00\x00' +onyx:0> +onyx:0> 0 string 1 sprint +`' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:stuck} +\index{stuck@\onyxop{}{stuck}{}} +\item[{\onyxop{stack}{stuck}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Tuck duplicate of top object on \oparg{stack} under second + object on \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (2 1 0) dup stuck pstack +(2 0 1 0) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sub} +\index{sub@\onyxop{}{sub}{}} +\item[{\onyxop{a b}{sub}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \item[b: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + The value of \oparg{b} subtracted from \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Subtract \oparg{b} from \oparg{a} and return the result. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 5 3 sub 1 sprint +2 +onyx:0> -3 4 sub 1 sprint +-7 +onyx:0> 5.1 1.1 sub 1 sprint +4.000000e+00 +onyx:0> 5 1.0 sub 1 sprint +4.000000e+00 +onyx:0> -3.0 4.1 sub 1 sprint +-7.100000e+00 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:submatch} +\index{submatch@\onyxop{}{submatch}{}} +\item[{\onyxop{integer}{submatch}{substring}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[integer: ] + \begin{description}\item[] + \item[0: ] + Get substring of text that matched the regular + expression. + \item[{\gt}0: ] + Get substring of text that matched the specified + capturing subpattern. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[substring: ] + A substring of the string that was most recently matched + by the + \htmlref{\onyxop{}{match}{}}{systemdict:match}, + \htmlref{\onyxop{}{split}{}}{systemdict:split}, or + \htmlref{\onyxop{}{subst}{}}{systemdict:subst} + operators. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get a substring of the input string that was most recently + matched against. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `input' `n(p)u' match {0 submatch 1 sprint 1 submatch 1 sprint} if +`npu' +`p' +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:subst} +\index{subst@\onyxop{}{subst}{}} +\item[{\onyxop{input pattern template flags}{subst}{output count}}: ] +\item[{\onyxop{input pattern template}{subst}{output count}}: ] +\item[{\onyxop{input regsub}{subst}{output count}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[input: ] + An input string. + \item[pattern: ] + A string that specifies a regular expression. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[template: ] + A string that specifies a substitution template. See + Section~\ref{sec:onyx_regular_expressions} for syntax. + \item[flags: ] + A dictionary of optional flags: + \begin{description}%\item[] + \item[\$g: ] + Substitute all matches, if true, rather than + just the first match. Defaults to false. + \item[\$i: ] Case insensitive. Defaults to false. + \item[\$m: ] Treat input as a multi-line string. + Defaults to false. + \item[\$s: ] Treat input as a single line, so that + the dot metacharacter matches any character, + including a newline. Defaults to false. + \end{description} + \item[regsub: ] + A regsub object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[output: ] + A string that is created by substituting substrings + within \oparg{input} that match a regular expression. + \item[count: ] + Number of substitutions made. If 0 substitutions were + made, then \oparg{output} is a duplicate of + \oparg{input}, rather than a copy. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{regexerror}{regexerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a string by substituting according to a template for each + substring within \oparg{input} that matches a regular + expression. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `Input String' `([a-r])' `[\1]' <$g true> subst pstack +6 +`I[n][p]ut St[r][i][n][g]' +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:sunder} +\index{sunder@\onyxop{}{sunder}{}} +\item[{\onyxop{stack}{sunder}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the second object on \oparg{stack} and put + it under the top object on \oparg{stack}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (2 1 0) dup sunder pstack +(2 1 1 0) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:sup} +\index{sup@\onyxop{}{sup}{}} +\item[{\onyxop{stack}{sup}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Rotate the top three objects on \oparg{stack} up one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (3 2 1 0) dup sup pstack +(3 0 2 1) +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:symlink} +\index{symlink@\onyxop{}{symlink}{}} +\item[{\onyxop{filename linkname}{symlink}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[filename: ] + A string that represents a filename. + \item[linkname: ] + A string that represents a filename. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Create a symbolic link from \oparg{linkname} to + \oparg{filename}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open +onyx:1> dup `Hello\n' write +onyx:1> dup flushfile +onyx:1> close +onyx:0> `/tmp/foo' `/tmp/bar' symlink +onyx:0> `/tmp/bar' `r' open +onyx:1> readline +onyx:2> pstack +false +`Hello' +onyx:2> + \end{verbatim} + \end{description} +\label{systemdict:system} +\index{system@\onyxop{}{system}{}} +\item[{\onyxop{args}{system}{status}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[args: ] + An array of strings. The first string in \oparg{args} + is the path of the program to invoke, and any additional + array elements are passed as command line arguments to + the invoked program. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[status: ] + Exit code of terminated process. A negative value + indicates that the process was terminated by a signal + (use the \htmlref{\onyxop{}{neg}{}}{systemdict:neg} + operator to get the signal number), and a non-negative + value is the exit code of a program that terminated + normally. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Execute a program as a child process and wait for it to + terminate. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`/usr/bin/which' `onyx'] system +/usr/local/bin/onyx +onyx:1> 1 sprint +0 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:systemdict} +\index{systemdict@\onyxop{}{systemdict}{}} +\item[{\onyxop{--}{systemdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get systemdict. See Section~\ref{sec:systemdict} for details on + systemdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> systemdict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:tan} +\index{tan@\onyxop{}{tan}{}} +\item[{\onyxop{a}{sinh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Tangent of \oparg{a} in radians. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the tangent of \oparg{a} in radians. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0.785 tan 1 sprint +9.992040e-01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:tanh} +\index{tanh@\onyxop{}{tanh}{}} +\item[{\onyxop{a}{tanh}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Hyperbolic tangent of \oparg{a}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the hyperbolic tangent of \oparg{a}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 3 tanh 1 sprint +9.950548e-01 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:tell} +\index{tell@\onyxop{}{tell}{}} +\item[{\onyxop{file}{tell}{offset}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[fil: ] + A file object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[offset: ] + Offset of the file position pointer for \oparg{file}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get the file position pointer offset for \oparg{file}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup tell 1 sprint +0 +onyx:1> dup `Hello\n' write +onyx:1> dup tell 1 sprint +6 +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:test} +\index{test@\onyxop{}{test}{}} +\item[{\onyxop{file/filename flag}{test}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[filename: ] + A string that represents a filename. + \item[flag: ] + A single-character string that represents the test to do + on \oparg{file} or \oparg{filename}: + \begin{description}%\item[] + \item[`b': ] + Block special device? + \item[`c': ] + Character special device? + \item[`d': ] + Directory? + \item[`e': ] + Exists? + \item[`f': ] + Regular file? + \item[`g': ] + Setgid? + \item[`k': ] + Sticky? + \item[`p': ] + Named pipe? + \item[`r': ] + Readable? + \item[`s': ] + Size greater than 0? + \item[`t': ] + tty? + \item[`u': ] + Setuid? + \item[`w': ] + Write bit set? + \item[`x': ] + Executable bit set? + \item[`L': ] + Symbolic link? + \item[`O': ] + Owner matches effective uid? + \item[`G': ] + Group matches effective gid? + \item[`S': ] + Socket? + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If true, the test evaluated to true; false otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Test a file for an attribute. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/blah' `e' test 1 sprint +false +onyx:0> `/tmp' `e' test 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:thread} +\index{thread@\onyxop{}{thread}{}} +\item[{\onyxop{stack entry}{thread}{thread}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[stack: ] + A stack that contains the contents for the new thread's + ostack. + \item[entry: ] + An initial object to execute in the new thread. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object that corresponds to the new thread. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create and run a new thread. + \item[Example(s): ]\begin{verbatim} + +onyx:0> (1 2) {add 1 sprint} thread join `Done\n' print flush +3 +Done +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:threaddstack} +\index{threaddstack@\onyxop{}{threaddstack}{}} +\item[{\onyxop{thread}{threaddstack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + The dictionary stack belonging to \oparg{thread}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get a reference to the dictionary stack belonging to + \oparg{thread}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> self threaddstack 1 sprint +(-dict- -dict- -dict- -dict-) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:threadestack} +\index{threadestack@\onyxop{}{threadestack}{}} +\item[{\onyxop{thread}{threadestack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + The execution stack belonging to \oparg{thread}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get a reference to the execution stack belonging to + \oparg{thread}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> self threadestack 1 sprint +(-file- -array- --eval-- --ifelse-- -array- --for-- -array-) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:threadistack} +\index{threadistack@\onyxop{}{threadistack}{}} +\item[{\onyxop{thread}{threadistack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + The index stack belonging to \oparg{thread}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get a reference to the index stack belonging to \oparg{thread}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> self threadistack 1 sprint +(0 0 0 0 7 0 3) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:threadostack} +\index{threadostack@\onyxop{}{threadostack}{}} +\item[{\onyxop{thread}{threadostack}{stack}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[thread: ] + A thread object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[stack: ] + The operand stack belonging to \oparg{thread}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Get a reference to the operand stack belonging to + \oparg{thread}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> self threadostack 1 sprint +(-stack- -stack- -stack- -stack-) +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:threadsdict} +\index{threadsdict@\onyxop{}{threadsdict}{}} +\item[{\onyxop{--}{threadsdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. Each key is a thread reference. By + default, each value is null, but this need not be so, + and the value can be redefined for debugging purposes. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get a dictionary containing references to all threads. + \item[Example(s): ]\begin{verbatim} + +onyx:0> threadsdict 1 sprint +<-thread- null> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:throw} +\index{throw@\onyxop{}{throw}{}} +\item[{\onyxop{name}{throw}{obj}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[name: ] The name of an error. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[obj: ] + The object that was being executed when the error was + thrown. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefined}{undefined}.] + \end{description} + \item[Description: ] + Throw an error, using the following steps: + \begin{enumerate} + \item{Set newerror in the currenterror dictionary to true.} + \item{Set errorname in the currenterror dictionary to + \oparg{name}.} + \item{Set ostack, dstack, estack, and istack in the currenterror + dictionary to be current stack snapshots.} + \item{Push the object that was being executed before throw was + called onto ostack.} + \item{If there is an error handler in the errordict dictionary + that corresponds to \oparg{name}, evaluate it. Otherwise, + evaluate errordict's + \htmlref{\onyxop{}{handleerror}{}}{errordict:handleerror} and + \htmlref{\onyxop{}{stop}{}}{errordict:stop} operators.} + \end{enumerate} + \item[Example(s): ]\begin{verbatim} + +onyx:0> $unregistered throw +Error $unregistered +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..1): +0: -file- +1: --start-- +onyx:1> pstack +-file- +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:timedwait} +\index{timedwait@\onyxop{}{timedwait}{}} +\item[{\onyxop{condition mutex timeout}{timedwait}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \item[mutex: ] + A mutex object that this thread currently owns. + \item[timeout: ] + Minimum number of nanoseconds to wait for + \oparg{condition}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, success, otherwise timeout. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Wait on \oparg{condition} for at least \oparg{timeout} + nanoseconds. \oparg{mutex} is atomically released when the + current thread blocks, then acquired again before the current + thread runs again. Using a mutex that the current thread does + not own will result in undefined behavior (likely crash). + \item[Example(s): ]\begin{verbatim} + +onyx:0> condition mutex dup lock ostack +onyx:3> {dup lock exch signal unlock} +onyx:4> thread 3 1 roll +onyx:3> dup 3 1 roll +onyx:4> 1000000000 timedwait 1 sprint unlock join +false +onyx:0> mutex condition 1 idup dup lock 1000000000 timedwait 1 sprint unlock +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:token} +\index{token@\onyxop{}{token}{}} +\item[{\onyxop{file/string}{token}{false}}: ] +\item[{\onyxop{file/string}{token}{file/substring obj true}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file that is used as onyx source code to scan a token + from. + \item[string: ] + A string that is used as onyx source code to scan a + token from. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[file: ] + The same file object that was passed in. + \item[substring: ] + The remainder of \oparg{string} after scanning a token. + \item[obj: ] + An object that was constructed by scanning a token. + \item[false/true: ] + If true, a token was successfully scanned, false + otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{syntaxerror}{syntaxerror}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefined}{undefined}.] + \end{description} + \item[Description: ] + Scan a token from a file or string, using onyx syntax rules. If + a token is followed by whitespace, one character of whitespace + is consumed when the token is scanned. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `1 2' token pstack clear +true +1 +`2' +onyx:0> `foo' token pstack clear +true +foo +`' +onyx:0> `foo ' token pstack clear +true +foo +`' +onyx:0> `foo ' token pstack clear +true +foo +` ' +onyx:0> `foo$bar' token pstack clear +true +foo +`$bar' +onyx:0> `foo{}' token pstack clear +true +foo +`{}' +onyx:0> ` ' token pstack clear +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:trunc} +\index{trunc@\onyxop{}{trunc}{}} +\item[{\onyxop{a}{trunc}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or real. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + Integer created from \oparg{a} by discarding the + fractional portion. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Discard the fractional portion of \oparg{a} to create an + integer, and return the result. + \item[Example(s): ]\begin{verbatim} + +onyx:0> -1.51 trunc 1 sprint +-1 +onyx:0> -1.49 trunc 1 sprint +-1 +onyx:0> 0 trunc 1 sprint +0 +onyx:0> 1.49 trunc 1 sprint +1 +onyx:0> 1.51 trunc 1 sprint +1 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:truncate} +\index{truncate@\onyxop{}{truncate}{}} +\item[{\onyxop{file length}{truncate}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[length: ] + New length for \oparg{file}. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{rangecheck}{rangecheck}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the length of \oparg{file} to \oparg{length}. If this + causes the file to grow, the appended bytes will have the + value zero. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup `Hello\n' write +onyx:1> dup flushfile +onyx:1> dup 0 seek +onyx:1> dup 10 string read +onyx:3> pop 1 sprint +`Hello\n' +onyx:1> dup 3 truncate +onyx:1> dup 0 seek +onyx:1> dup 10 string read +onyx:3> pop 1 sprint +`Hel' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:true} +\index{true@\onyxop{}{true}{}} +\item[{\onyxop{--}{true}{true}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[true: ] + The boolean value true. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Return true. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:trylock} +\index{trylock@\onyxop{}{trylock}{}} +\item[{\onyxop{mutex}{trylock}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + If false, \oparg{mutex} was successfully acquired. + Otherwise the mutex acquisition failed. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Try to acquire \oparg{mutex}, but return a failure immediately + if \oparg{mutex} cannot be acquired, rather than blocking. + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex dup +onyx:2> trylock 1 sprint +false +onyx:1> trylock 1 sprint +true +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:tuck} +\index{tuck@\onyxop{}{tuck}{}} +\item[{\onyxop{a b}{tuck}{b a b}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[: ] + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Create a duplicate of the top object on ostack and put it under + the second object on ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' +oonyx:3> tuck pstack +`c' +`b' +`c' +`a' +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:type} +\index{type@\onyxop{}{type}{}} +\item[{\onyxop{obj}{type}{name}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[name: ] + An executable name that corresponds to the type of + \oparg{obj}: + \begin{description} + \item[array: ] arraytype. + \item[boolean: ] booleantype. + \item[condition: ] conditiontype. + \item[dict: ] dicttype. + \item[file: ] filetype. + \item[fino: ] finotype. + \item[hook: ] hooktype. + \item[integer: ] integertype. + \item[mark: ] marktype. + \item[mutex: ] mutextype. + \item[name: ] nametype. + \item[null: ] nulltype. + \item[operator: ] operatortype. + \item[pmark: ] pmarktype. + \item[stack: ] stacktype. + \item[string: ] stringtype. + \item[thread: ] threadtype. + \end{description} + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Get a name that represent the type of \oparg{obj}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true type 1 sprint +booleantype +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:uid} +\index{uid@\onyxop{}{uid}{}} +\item[{\onyxop{--}{uid}{uid}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[uid: ] + Process's user ID. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the process's user ID. + \item[Example(s): ]\begin{verbatim} + +onyx:0> uid 1 sprint +1001 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:umask} +\index{umask@\onyxop{}{umask}{}} +\item[{\onyxop{nmask}{umask}{omask}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[nmask: ] + Value to set umask to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[omask: ] + Old umask. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Set the process's umask to \oparg{nmask} and return the old + umask. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 8@777 umask <$b 8 $w 3 $p `0'> output `\n' print flush +022 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:undef} +\index{undef@\onyxop{}{undef}{}} +\item[{\onyxop{dict key}{undef}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \item[val: ] + A key in \oparg{dict} to undefine. + \end{description} + \item[Output(s): ] None + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + If \oparg{key} is defined in \oparg{dict}, undefine it. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $foo `foo' def +onyx:0> currentdict $foo undef +onyx:0> currentdict $foo undef +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:under} +\index{under@\onyxop{}{under}{}} +\item[{\onyxop{a b}{under}{a a b}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Create a duplicate of the second object on ostack and put it + under the top object on ostack. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 1 2 under pstack +2 +1 +1 +0 +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:unlink} +\index{unlink@\onyxop{}{unlink}{}} +\item[{\onyxop{filename}{unlink}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[filename: ] + A string that represents a filename. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{invalidfileaccess}{invalidfileaccess}.] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \item[\htmlref{undefinedfilename}{undefinedfilename}.] + \item[\htmlref{unregistered}{unregistered}.] + \end{description} + \item[Description: ] + Unlink \oparg{filename}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w' open +onyx:1> dup `Hello\n' write +onyx:1> dup flushfile +onyx:1> close +onyx:0> `/tmp/foo' unlink +onyx:0> `/tmp/foo' `r' open +Error $invalidfileaccess +ostack: (`/tmp/foo' `r') +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --open-- +1: -file- +2: --start-- +onyx:3> + \end{verbatim} + \end{description} +\label{systemdict:unlock} +\index{unlock@\onyxop{}{unlock}{}} +\item[{\onyxop{mutex}{unlock}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[mutex: ] + A mutex object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Unlock \oparg{mutex}. Unlocking a mutex that the running thread + does not own will result in undefined behavior (likely crash). + \item[Example(s): ]\begin{verbatim} + +onyx:0> mutex dup lock unlock +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:unsetenv} +\index{unsetenv@\onyxop{}{unsetenv}{}} +\item[{\onyxop{key}{unsetenv}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[key: ] + A name object. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Unset \oparg{key} in the environment and in the envdict + dictionary, if \oparg{key} is defined. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $foo `foo' setenv +onyx:0> envdict $foo known 1 sprint +true +onyx:0> envdict $foo get 1 sprint +`foo' +onyx:0> $foo unsetenv +onyx:0> envdict $foo known 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:until} +\index{until@\onyxop{}{until}{}} +\item[{\onyxop{proc cond}{until}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[proc: ] + An object to be repeatedly evaluated. + \item[cond: ] + An object that, when evaluated, places a boolean on + ostack. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Repeatedly evaluate \oparg{proc} and \oparg{cond}, terminating + the first time that \oparg{cond} places false on ostack. This + operator supports the + \htmlref{\onyxop{}{exit}{}}{systemdict:exit} operator. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 {inc dup 1 sprint}{dup 3 lt} until pop +1 +2 +3 +onyx:0> 0 {inc dup 1 sprint exit}{dup 3 lt} until pop +1 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:up} +\index{up@\onyxop{}{up}{}} +\item[{\onyxop{a b c}{up}{c a b}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An object. + \item[b: ] + An object. + \item[c: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[c: ] + An object. + \item[a: ] + An object. + \item[b: ] + An object. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Rotate the top three objects on ostack up one position. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `a' `b' `c' `d' up pstack +`c' +`b' +`d' +`a' +onyx:4> + \end{verbatim} + \end{description} +\label{systemdict:userdict} +\index{userdict@\onyxop{}{userdict}{}} +\item[{\onyxop{--}{userdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + A dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get userdict. See Section~\ref{sec:userdict} for details on + userdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> userdict 1 sprint +<> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:version} +\index{version@\onyxop{}{version}{}} +\item[{\onyxop{--}{version}{string}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[string: ] + A string that contains the version name. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get the version string. The string returned is a reference to + the original version string. + \item[Example(s): ]\begin{verbatim} + +onyx:0> version pstack +`1.0.0' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:wait} +\index{wait@\onyxop{}{wait}{}} +\item[{\onyxop{condition mutex}{wait}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[condition: ] + A condition object. + \item[mutex: ] + A mutex object that this thread currently owns. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Wait on \oparg{condition}. \oparg{mutex} is atomically released + when the current thread blocks, then acquired again before the + current thread runs again. Using a mutex that the current + thread does not own will result in undefined behavior (likely + crash). + \item[Example(s): ]\begin{verbatim} + +onyx:0> condition mutex dup lock ostack +onyx:3> {dup lock exch signal unlock} +onyx:4> thread 3 1 roll +onyx:3> dup 3 1 roll +onyx:4> wait unlock join +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:waitpid} +\index{waitpid@\onyxop{}{waitpid}{}} +\item[{\onyxop{pid}{waitpid}{status}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[pid: ] + Process identifier. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[status: ] + Exit code of terminated process. A negative value + indicates that the process was terminated by a signal + (use the \htmlref{\onyxop{}{neg}{}}{systemdict:neg} + operator to get the signal number), and a non-negative + value is the exit code of a program that terminated + normally. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Wait for the process with process ID \oparg{pid} to exit. + \item[Example(s): ]\begin{verbatim} + +onyx:0> [`/bin/date'] forkexec dup 1 sprint waitpid 1 sprint +6516 +Sat Jul 13 20:47:54 PDT 2002 +0 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:where} +\index{where@\onyxop{}{where}{}} +\item[{\onyxop{key}{where}{false}}: ] +\item[{\onyxop{key}{where}{dict true}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[key: ] + A key to search for in dstack. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + The topmost dictionary in dstack that contains a + definition for \oparg{key}. + \item[false/true: ] + If false, no definition of \oparg{key} was found in + dstack. Otherwise \oparg{dict} is the topmost + dictionary in dstack that contains a definition for + \oparg{key}. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Get the topmost dictionary in dstack that defines \oparg{key}. + \item[Example(s): ]\begin{verbatim} + +onyx:0> $foo where pstack clear +false +onyx:0> $threaddict where pstack clear +true +<$threaddict -dict- $userdict -dict- $currenterror -dict- $errordict -dict- +$resume --stop--> +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:while} +\index{while@\onyxop{}{while}{}} +\item[{\onyxop{cond proc}{while}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[cond: ] + An object that, when evaluated, places a boolean on + ostack. + \item[proc: ] + An object to be repeatedly evaluated. + \end{description} + \item[Output(s): ] None. + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Repeatedly evaluate \oparg{cond} and \oparg{proc}, terminating + the first time that \oparg{cond} places false on ostack. This + operator supports the + \htmlref{\onyxop{}{exit}{}}{systemdict:exit} operator. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 {dup 3 lt}{inc dup 1 sprint} while pop +1 +2 +3 +onyx:0> 0 {dup 3 lt}{inc dup 1 sprint exit} while pop +1 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:write} +\index{write@\onyxop{}{write}{}} +\item[{\onyxop{file integer/string}{write}{false}}: ] +\item[{\onyxop{file integer/string}{write}{integer/substring true}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[file: ] + A file object. + \item[integer: ] + An integer that represents an ascii character value. + \item[string: ] + A string object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[false: ] + Successful complete write. + \item[integer: ] + The \oparg{integer} that was passed in. + \item[substring: ] + The substring of \oparg{string} that was not written. + \item[true: ] + Successful partial write. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{ioerror}{ioerror}.] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Write \oparg{integer} or \oparg{string} to \oparg{file}. + Partial writes can only happen for non-blocking files. + \item[Example(s): ]\begin{verbatim} + +onyx:0> `/tmp/foo' `w+' open +onyx:1> dup `Hello\n' write pop +onyx:1> dup 0 seek +onyx:1> dup readline 1 sprint 1 sprint +false +`Hello' +onyx:1> + \end{verbatim} + \end{description} +\label{systemdict:xcheck} +\index{xcheck@\onyxop{}{xcheck}{}} +\item[{\onyxop{obj}{xcheck}{boolean}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[obj: ] + An object. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[boolean: ] + True if \oparg{obj} has the executable or evaluatable + attribute, false otherwise. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \end{description} + \item[Description: ] + Check \oparg{obj} for executable or evaluatable attribute. + \item[Example(s): ]\begin{verbatim} + +onyx:0> {1 2 3} xcheck 1 sprint +true +onyx:0> [1 2 3] xcheck 1 sprint +false +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:xor} +\index{xor@\onyxop{}{xor}{}} +\item[{\onyxop{a b}{xor}{r}}: ] + \begin{description}\item[] + \item[Input(s): ] + \begin{description}\item[] + \item[a: ] + An integer or boolean. + \item[b: ] + The same type as \oparg{a}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[r: ] + If \oparg{a} and \oparg{b} are integers, their bitwise + exclusive or, otherwise their logical exclusive or. + \end{description} + \item[Errors(s): ] + \begin{description}\item[] + \item[\htmlref{stackunderflow}{stackunderflow}.] + \item[\htmlref{typecheck}{typecheck}.] + \end{description} + \item[Description: ] + Return the bitwise exclusive or of two integers, or the logical + exclusive or of two booleans. + \item[Example(s): ]\begin{verbatim} + +onyx:0> true false xor 1 sprint +true +onyx:0> true true xor 1 sprint +false +onyx:0> 5 3 xor 1 sprint +6 +onyx:0> + \end{verbatim} + \end{description} +\label{systemdict:yield} +\index{yield@\onyxop{}{yield}{}} +\item[{\onyxop{--}{yield}{--}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Errors(s): ] None. + \item[Description: ] + Vuluntarily yield the processor, so that another thread or + process may be run. + \item[Example(s): ]\begin{verbatim} + +onyx:0> 0 100000 {1 add yield} repeat 1 sprint +100000 +onyx:0> + \end{verbatim} + \end{description} +\end{description} + +\subsection{threaddict} +\label{sec:threaddict} +\index{threaddict@\onyxop{}{threaddict}{}} + +Each thread has its own threaddict, which is not shared with any other threads. +threaddict is meant to be used for thread-specific definitions that would +otherwise go in systemdict. + +\begin{longtable}{\optableformat{4.10}} +\caption{threaddict summary} +\\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline +%begin{latexonly} +\endfirsthead +\caption[]{\emph{continued}} \\ +\hline +\optableent + {Input(s)} + {Op/Proc/Var} + {Output(s)} + {Description} +\hline \hline \endhead +\multicolumn{2}{r}{\emph{Continued on next page...}} \endfoot +\hline \endlastfoot +%end{latexonly} +\optableent + {--} + {{\bf \htmlref{threaddict}{threaddict:threaddict}}} + {dict} + {Get threaddict.} +\hline +\optableent + {--} + {{\bf \htmlref{userdict}{threaddict:userdict}}} + {dict} + {Get userdict.} +\hline +\optableent + {--} + {{\bf \htmlref{currenterror}{threaddict:currenterror}}} + {dict} + {Get currenterror.} +\hline +\optableent + {--} + {{\bf \htmlref{errordict}{threaddict:errordict}}} + {dict} + {Get errordict.} +\end{longtable} + +\begin{description} +\label{threaddict:currenterror} +\index{currenterror@\onyxop{}{currenterror}{}} +\item[{\onyxop{--}{currenterror}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + The currenterror dictionary. See + Section~\ref{sec:currenterror} for details on + currenterror. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get currenterror. + \item[Example(s): ]\begin{verbatim} + +onyx:0> currenterror 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{threaddict:errordict} +\index{errordict@\onyxop{}{errordict}{}} +\item[{\onyxop{--}{errordict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + The errordict dictionary. See + Section~\ref{sec:errordict} for details on errordict. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get errordict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> errordict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{threaddict:threaddict} +\index{threaddict@\onyxop{}{threaddict}{}} +\item[{\onyxop{--}{threaddict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + The threaddict dictionary. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get threaddict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> threaddict 0 sprint +-dict- +onyx:0> + \end{verbatim} + \end{description} +\label{threaddict:userdict} +\index{userdict@\onyxop{}{userdict}{}} +\item[{\onyxop{--}{userdict}{dict}}: ] + \begin{description}\item[] + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[dict: ] + The userdict dictionary. See + Section~\ref{sec:userdict} for details on userdict. + \end{description} + \item[Errors(s): ] None. + \item[Description: ] + Get userdict. + \item[Example(s): ]\begin{verbatim} + +onyx:0> userdict 1 sprint +<> +onyx:0> + \end{verbatim} + \end{description} +\end{description} + +\subsection{threadsdict} +\label{sec:threadsdict} +\index{threadsdict@\onyxop{}{threadsdict}{}} + +There is one entry in threadsdict for each thread. The key is the thread, and +the value is null by default. The value can be safely changed, which can be +useful when debugging. However, the key must not be changed, or garbage +collection will trigger a horrible death, since the root set will not be +complete. + +\subsection{userdict} +\label{sec:userdict} +\index{userdict@\onyxop{}{userdict}{}} + +Each thread has its own userdict, which is not shared with any other threads. +userdict is meant to be used for general storage of definitions that do not need +to be shared among threads. userdict starts out empty when a thread is +created. diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/onyx.mst b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/onyx.mst new file mode 100644 index 000000000..05565f9dd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/onyx.mst @@ -0,0 +1,2 @@ +preamble "" +postamble "" \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/onyx.tex.in b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/onyx.tex.in new file mode 100644 index 000000000..0dd20c2d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/onyx.tex.in @@ -0,0 +1,31 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% Body of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Definitions and front matter. +\input{@abs_srcroot@/doc/latex/onyx/front} + +% Onyx Language Tutorial. +\input{@abs_srcroot@/doc/latex/onyx/tut} + +% Onyx Language Reference. +\input{@abs_srcroot@/doc/latex/onyx/lang} + +% The onyx program. +\input{@abs_objroot@/bin/onyx/doc/latex/manual} + +% The libonyx library. +\input{@abs_objroot@/lib/libonyx/doc/latex/manual} + +% Back matter. +\input{@abs_srcroot@/doc/latex/onyx/back} diff --git a/tags/ONYX_4_3_1/devroot/doc/latex/onyx/tut.tex b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/tut.tex new file mode 100644 index 000000000..84ca4a29b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/doc/latex/onyx/tut.tex @@ -0,0 +1,747 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% Onyx tutorial portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\clearemptydoublepage +\chapter{Onyx Language Tutorial} +\label{onyxtut} + +This manual includes a comprehensive \htmlref{Onyx Language Reference}{onyxlang} +chapter, which explains the details of what Onyx is. However, that chapter is +rather dry, and more importantly, it does not discuss how to best utilize Onyx. +This chapter introduces concepts that are important when designing and +implementing Onyx programs, though it is not a complete language tutorial. You +will need to read the first several sections of Chapter~\ref{onyxlang} in order +to absorb all of the information in this chapter. However, you should be able +to read this chapter first, then come back to it and glean additional +understanding after having read later chapters. + +Onyx is a stack-based language, so although the ideas that are important to +program design in other more traditional languages still apply in many cases, +there are different ways of approaching certain problems that integrate better +with the facilities provided by Onyx. The most obvious example of this is that +Onyx programs are more efficient if written to use named variables as little as +possible, relying instead on the power of the operand stack. Another example is +error handling. It is possible to write procedures that check for every error +condition, but Onyx provides a form of exception handling that, if used +correctly, can significantly improve code readability and performance. + +Accomplished PostScript programmers will find little new in this chapter; Onyx +differs from PostScript in the details, but the concepts are very similar. +Accomplished Forth programmers will already be comfortable with stack +management, but the rest of the chapter discusses concepts that either have no +Forth equivalent, or that are significantly different from Forth, as is the case +for dictionaries. + +\section{Syntax} + +Onyx syntax is extremely simple. Code is essentially composed of tokens that +are delimited by whitespace or a list of self-delimiting tokens (see +Section~\ref{sec:onyx_syntax} for details). As such, there are very few ways +for a syntax error to occur, but typographical mistakes may instead produce +other errors. For example, say that a C programmer forgets he is writing Onyx +code and types the following at the interactive \binname{onyx} prompt: + +\begin{verbatim} +onyx:0> 1000L {`Hello\n' print} repeat +\end{verbatim} + +The intention is to print {\tt Hello} 1000 times, but {\tt 1000L} is invalid +syntax for an integer, so Onyx creates an executable name object instead, and +then tries to execute the name, resulting in the following error: + +\begin{verbatim} +Error $undefined +ostack: () +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: 1000L +1: -file- +2: --start-- +\end{verbatim} + +This is typical of the simple errors encountered when writing Onyx code. The +Onyx scanner uses a simple state machine to try to create objects of various +types, and when it fails, the input is instead used to create an executable +name. + +The scanner only deals with a few types (ignoring procedures for the moment): +integers, reals, names, and strings. There are many other object types, but +none of them are created directly by the scanner. + +\{ and \} are used to delimit procedure bodies, which in actuality are +executable arrays. \{ puts the scanner into deferred execution mode until the +matching \} is scanned. \{\} pairs can be nested, so execution is deferred +until matching \} characters have been scanned for all \{ characters. Deferred +execution means that the scanner creates objects as it scans code, but does not +execute any of them. While not a strictly necessary language feature, this +greatly simplifies the task of constructing executable arrays, which can then be +treated as procedures. + +Following are equivalent examples of how a procedure associated with the name +{\tt double} can be defined: + +\begin{verbatim} +onyx:0> $double {2 mul} def +onyx:0> $double [ 2 $mul load ] cvx def +\end{verbatim} + +As mentioned earlier, there are few ways of generating a syntax error, but it is +possible. The most common syntax errors are due to unmatched ' and \} +characters. Generating other syntax errors is left as an exercise for the +reader. + +\section{Data types} + +Onyx includes a rich set of data types. In fact, Onyx code is represented as +data, which means that there is a whole range of possibilities when writing Onyx +programs that are difficult or impossible with compiled languages such as C. +This aspect of Onyx is discussed in Section~\ref{onyxtut:introspection}. + +Onyx is dynamically typed, which means that errors due to object type +incompatibilities are detected during program execution. For example, the +following code will always run without an error, even though the arguments that +would be passed to the \htmlref{\onyxop{}{add}{}}{systemdict:add} operator are +invalid. + +\begin{verbatim} +false { + `a string' [1] add +}{ + `This is always printed' 1 sprint +} ifelse +\end{verbatim} + +Dynamic typing has advantages in the flexibility that it offers, but it also +means that type errors can go undetected in code for long periods of time before +the invalid code is executed. + +The Onyx type system is not extensible. There is no way to add new types in a +program. However, there are techniques that can be combined with the built in +types to simulate an extensible type system. For example, dictionaries can be +created with, say, a {\tt \_type} field that indicates the type of the object: + +\begin{verbatim} +< + $_type $fraction + $num 3 + $den 4 +> +\end{verbatim} + +Logical extensions of this can be used to create object hierarchies with single +or multiple inheritance. + +\section{Execution} + +Onyx code is never compiled, nor is it preprocessed by the interpreter. Onyx +code is simply consumed. This has some interesting implications, some of which +are not typical of even other interpreted languages: + +\begin{itemize} +\item{If a source file is modified during interpreter execution, the changes may +affect the currently running program, usually in unpleasant ways.} +\item{Syntax errors are not discovered until the malformed code is scanned. In +order to be sure that there are no syntax errors, a source file must be +completely scanned.} +\end{itemize} + +In practice, these are only minor inconveniences, but it is important to keep +them in mind when developing. + +\section{Memory management} + +Since Onyx includes an automatic mark and sweep garbage collector, memory +management typically requires little thought. There is no risk of leaking +memory in such a way that it cannot be freed. However, it is possible to +consume large amounts of memory by creating objects, then keeping references to +them long after they have outlived their usefulness. + +Onyx objects fall into two categories according to type: simple and composite. +Simple objects take up no virtual memory of their own; they are embedded into +other composite objects. For example, an integer on the operand stack takes up +only the space that the stack requires to store it. The same is true of an +integer that is stored an an element of an array. Composite objects are +composed of references that fit into the same places that an integer is stored, +plus additional structures stored elsewhere in virtual memory. There can be +multiple references to the same composite object, and as there is a chain of +references that makes it possible to reach a composite object, the garbage +collector will leave it alone. + +It is usually pretty obvious how to remove references to objects. Objects on +the operand stack can be popped off. Definitions in the dictionary stack can be +undefined. However, there may be situations such an array that contains +references to various objects, and the array cannot be discarded as a whole, but +individual elements are no longer needed. The null type is useful for +clobbering such references, and can even be effectively used to clobber portions +of procedures, since when a null object is executed it does absolutely nothing. +This unique aspect of null objects may not seem significant, but consider that +all other objects, when executed, are either pushed onto the execution stack and +executed, or pushed onto the operand stack. Doing nothing at all can be useful. + +\section{Stacks} + +Stacks in Onyx are pretty typical. Objects are implicitly or explicitly pushed +onto stacks by operators, and the stack contents can be rearranged and removed. +Although stacks are a first class object in Onyx, most Onyx programs are +concerned only with the operand stack, often referred to as ostack, which is +used as a place to store objects, pass arguments into operators and procedures, +and return results. + +Onyx is a postfix language, which means that code is written such that operands +precede operators. For example, the following code Calculates $5 \times (3 + +4)$ and prints the result: + +\begin{verbatim} +onyx:0> 5 3 4 add mul +onyx:1> 1 sprint +35 +onyx:0> +\end{verbatim} + +There are no parentheses to clarify operator precedence, because precedence is +implicit in the code. + +Stacks are either written bottom to top on one line, or top to bottom on +separate lines, as in the following examples. The example stack contains the +numbers 0, 1, and 2, where 0 is the top object and 2 is the bottom object: + +\begin{verbatim} +onyx:0> 2 1 0 +onyx:3> ostack 1 sprint +(2 1 0) +onyx:3> pstack +0 +1 +2 +onyx:3> +\end{verbatim} + +Learning to efficiently (and accurately) manage stacks is a mind-warping process +that no amount of reading is likely to impress upon the reader. There are +general concepts presented here, but ultimately, the reader will have to write a +good bit of code to get a handle on stacks. Even the author of Onyx found +himself stumbling over stacks well after Onyx was complete, despite limited +exposure to stack-based languages beforehand. The problem seems to be that +programmers learn to think in a different way that doesn't exercise the parts of +the brain necessary for stack manipulation. Some people might argue that stack +manipulation is the job of the compiler. In any case, stack manipulation is an +acquired skill that requires practice. + +\subsection{Using stacks as queues} + +Stacks are implemented such that access to the top or bottom is very efficient, +and efficiency decreases linearly, the farther into the stack an operation has +to iterate. Since pushing and popping is efficient for both ends of stacks, +this means that stacks are suitable for use as queues. + +\subsection{Using the operand stack as two stacks} + +The ability to efficiently manipulate both ends of the operand stack means that +the operand stack can effectively be thought of as two stacks. This can be very +useful in situations where more than a handful of objects are being manipulated, +and an additional location to temporarily stash objects would be useful. If a +program is repeatedly doing large stack rotations, using the bottom of the stack +can often help to simplify the code and reduce stack manipulation overhead. + +\subsection{Efficiency issues} + +Since stacks are stored internally as doubly linked lists, the cost of indexed +access to an object on a stack is proportional to its offset from the top or +bottom of the stack, depending on the operator being used. Therefore, stacks +are not ideal in situations where arbitrary access to an object is a common +operation. An array is a better choice for indexed access, and a dictionary is +a better choice for keyed access. + +Indexed access doesn't just apply to operators like +\htmlref{\onyxop{}{idup}{}}{systemdict:idup}; operators like +\htmlref{\onyxop{}{nup}{}}{systemdict:nup} and +\htmlref{\onyxop{}{roll}{}}{systemdict:roll} are also affected. However, +operators such as \htmlref{\onyxop{}{rot}{}}{systemdict:rot} are not as heavily +impacted, since they only need to index into the stack by the number of +positions to rotate. + +\section{Dictionaries} + +Dictionaries are known by various other names, including hashes and associative +arrays. Dictionaries in Onyx associate keys with values. Keys and values can +be of any type, but for each dictionary, all keys are unique. For example, the +following dictionary cannot exist: + +\begin{verbatim} +< + 42 `Some value' + 42 `Another value' +> +\end{verbatim} + +To demonstrate this, the following example creates a dictionary with the first +key/value pair listed above, then inserts the second key/value pair. + +\begin{verbatim} +onyx:0> <42 `Some value'> +onyx:1> dup 1 sprint +<42 `Some value'> +onyx:1> dup 42 `Another value' put +onyx:1> dup 1 sprint +<42 `Another value'> +onyx:1> +\end{verbatim} + +When the second key/value pair is inserted, it replaces the first pair. + +\subsection{Efficiency issues} + +Although dictionaries can handle keys of any type, they are optimized to use +names as keys. The performance penalty for other key types is slight, but can +be exacerbated by the cost of comparison for other types. Name comparison is a +constant time operation, but string comparison is not. Therefore, use names +rather than strings whenever possible. + +\section{Regular expressions} +Onyx provides regular expression support that is very similar to what the Perl +programming language provides. There are two special data types, regex and +regsub, that are specific to regular expressions, but there is no special +language syntax devoted to regular expressions, unlike Perl. Instead, patterns +and substitution templates are specified via normal strings, and flags are +specified via dictionaries. + +\subsection{Matching} +The following snippet iteratively searches for capitalized words: + +\begin{verbatim} +`This is an Onyx string.' + +{dup `[A-Z]\w+' <$g true> match}{ + 0 submatch 1 sprint +} while +\end{verbatim} + +The above code generates the following output: + +\begin{verbatim} +`This' +`Onyx' +\end{verbatim} + +The {\tt \$g} flag to the \htmlref{\onyxop{}{match}{}}{systemdict:match} +operator says to store the location to start the next match at, which is what +makes the {\tt while} loop possible. The +\htmlref{\onyxop{}{submatch}{}}{systemdict:submatch} operator gets the substring +of the input string that the regular expression most recently matched. + +With a slight modification to the previous example, it is possible to get at the +capital letters, rather than the entire capitalized words. This is achieved by +using a set of capturing parentheses, and changing the argument to +\htmlref{\onyxop{}{submatch}{}}{systemdict:submatch}: + +\begin{verbatim} +`This is an Onyx string.' + +{dup `([A-Z])\w+' <$g true> match}{ + 1 submatch 1 sprint +} while +\end{verbatim} + +This generates the following output: + +\begin{verbatim} +`T' +`O' +\end{verbatim} + +This is a trivial example of how capturing subpatterns can be used, but the +possibilities are wide and varied. + +\subsection{Splitting} + +Sometimes it is desirable to \htmlref{\onyxop{}{split}{}}{systemdict:split} a +string into pieces, such as when dealing with a comma-delimited file: + +\begin{verbatim} +`Jason Evans, jasone@canonware.com, http://www.canonware.com/~jasone/' + +`,\s*' split +1 sprint +\end{verbatim} + +This generates the following output: + +\begin{verbatim} +[`Jason Evans' `jasone@canonware.com' `http://www.canonware.com/~jasone/'] +\end{verbatim} + +If for some reason preserving the delimiters is important, capturing parentheses +can be added to the splitting pattern: + +\begin{verbatim} +`Jason Evans, jasone@canonware.com, http://www.canonware.com/~jasone/' + +`(,)\s*' split +1 sprint +\end{verbatim} + +This generates the following output: + +\begin{verbatim} +[`Jason Evans' `,' `jasone@canonware.com' `,' `http://www.canonware.com/~jasone/'] +\end{verbatim} + +\subsection{Substituting} + +The \htmlref{\onyxop{}{match}{}}{systemdict:match} and +\htmlref{\onyxop{}{split}{}}{systemdict:split} operators provide enough power +that with some effort, it is possible to find regular expression matches, modify +the matched text, and create a modified string as output. However, this is a +common operation when using regular expressions for text processing, so the +\htmlref{\onyxop{}{subst}{}}{systemdict:subst} operator is also provided as a +more convenient interface for the most common types of substitution. + +Suppose that a comma-delimited file needs to be converted to a colon-delmited +file, consecutive separators need to be merged, and whitespace around the +separators needs to be stripped out. The following snippet does that: + +\begin{verbatim} +`Jason Evans (jasone@canonware.com) +Jason O. Evans ( jasone@canonware.com ) +' + +`(\w[A-Za-z. ]*\w) \(\s*([^\s]+)\s*\)' `"\1" <\2>' <$g true> subst pop +stdout exch write pop +\end{verbatim} + +This generates the following output: + +\begin{verbatim} +"Jason Evans" +"Jason O. Evans" +\end{verbatim} + +\section{Code organization} + +As mentioned earlier, Onyx does not have named variables in the same way as many +other languages. However, it does have the dictionary stack (dstack), which is +dynamically used for name lookups whenever an executable name is interpreted. +This section talks about how to effectively manage the namespace provided by +dstack. + +When the Onyx interpreter is first initialized, there are four dictionaries on +dstack: + +\begin{itemize} +\item{userdict} +\item{globaldict} +\item{systemdict} +\item{threaddict} +\end{itemize} + +dstack can be manipulated any way the application sees fit, though it is +generally dangerous to remove or significantly modify systemdict or threaddict, +since there are definitions in those dictionaries that are critical to the +correct functioning of the interpreter. + +Each thread has its own userdict, which provides a thread-local namespace. +globaldict is shared among all threads, so it provides a global namespace. +systemdict contains all of the default global definitions, and threaddict +contains the default thread-local definitions. + +For some applications, it may be desirable to add definitions to systemdict, but +care should be taken not to overwrite existing definitions unless you really +know what you are doing. In most cases, using globaldict is a better way to +go. + +\subsection{Procedures} + +Named procedures can be created by associating a name in one of the dictionaries +on dstack with a procedure. There is nothing magical about this, but some care +should be taken in choosing procedure names, and in deciding how to manage the +namespace. Onyx uses only lower case letters in the names of its definitions on +dstack, so it is easy to avoid namespace collisions by using some other +character in program definitions. There is nothing wrong with using all +lowercase letters for names in your programs, though some extra care is +warranted when doing so. + +An important consideration in program design is determining what belongs in the +global namespace. For an example of how Onyx partitions its namespace, look at +gcdict. There are several operators defined in gcdict that are only of interest +when manipulating the garbage collector, so those definitions are stashed out of +the way. Your program can do the same for definitions that are not of regular +interest. + +\subsection{Modules} +Onyx provides the infrastructure for loadable modules, which can be implemented +in Onyx and/or dynamically loaded machine code (shared libraries). See the +\htmlref{\onyxop{}{require}{}}{systemdict:require} and +\htmlref{\onyxop{}{mrequire}{}}{systemdict:mrequire} documentation for details +on how to load modules. + +When writing a module that is meant as a library of additional functionality, +some choices have to be made about how to organize the module. Some of the +obvious choices for how to organize the loaded definitions are: + +\begin{itemize} +\item{Insert definitions into globaldict.} +\item{Create a new dictionary full of definitions, and insert the dictionary + into globaldict as, say, foodict.} +\item{Create a new dictionary full of definitions, and put the dictionary on + dstack somewhere, such as directly above or below systemdict. Note that this + can be done by the application manually, so simply creating the dictionary and + letting the application insert it where it pleases could be a better choice.} +\item{Insert definitions into systemdict (questionable practice).} +\end{itemize} + +Depending on the nature of the module, any of the above solutions may be the +right choice. There are tradeoffs between convenience and cleanliness that +should be carefully weighed. + +\section{Error handling} +Onyx includes a powerful generic error handling mechanism that can be extended +and customized at several levels. The +\htmlref{\onyxop{}{throw}{}}{systemdict:throw} procedure is used to throw an +error, and virtually every aspect of the error handling machinery can be +customized, extended, or replaced, since it is all written in Onyx. + +Errors have names, with which error handlers can be associated in errordict. +errordict's \htmlref{\onyxop{}{handleerror}{}}{errordict:handleerror} procedure +can be modified or replaced. In fact, with some care, an entirely custom +errordict can be defined, then undefined once it is no longer needed. + +Following is the standard idiom for setting up and tearing down custom error +handling: + +\begin{verbatim} +# Set up custom error handling... +{ + # Do error-prone stuff... +} stopped { + # An error occurred. Do additional cleanup... +} if +# Restore error handling machinery... +\end{verbatim} + +The possibilities are extensive. However, a word of caution is in order. If +you mess something up in the error handling machinery, bad things will happen, +and you will have a terrible time debugging the problem. Be careful. + +\section{Introspection} +\label{onyxtut:introspection} + +The following code defines a named procedure that calculates factorials. + +\begin{verbatim} +# #n factorial #result +$factorial { + dup 1 gt { + # #n-1 factorial + dup 1 sub factorial + }{ + # Terminate recursion. + 1 + } ifelse + + mul +} def +\end{verbatim} + +What this code actually does is create an executable array, which can be +examined and modified. The following transcript shows the effects of modifying +the code. + +\begin{verbatim} +onyx:0> 3 factorial 1 sprint +6 +onyx:0> $factorial load 2 sprint +{dup 1 gt {dup 1 sub factorial} {1} ifelse mul} +onyx:0> $factorial load 4 {1 pstack} put +onyx:0> 3 factorial +1 +1 +2 +3 +onyx:1> 1 sprint +6 +onyx:0> +\end{verbatim} + +First $3!$ is calculated. Then the ``else'' clause of the ifelse construct is +modified to print the stack and $3!$ is recalculated. As can be seen, the stack +is printed during the calculation. + +\section{Threads} + +The original impetus for Onyx's creation was the need for scalable threading. +Onyx's threading is therefore truly powerful, though it comes at a cost. +Threading makes asynchronous garbage collection a necessity, which in turn makes +many aspects of Onyx's implementation a bit more heavyweight than would be +necessary for a single-threaded interpreter. + +\subsection{Implicit synchronization} + +Onyx provides mechanisms for implicit object synchronization. To see why +implicit object synchronization is necessary, consider what happens when two +threads concurrently modify globaldict (a perfectly legitimate thing to do, by +the way). The internals of a dictionary are rather complex, and if two +modifications were interleaved, havoc would ensue. Therefore, globaldict is +implicitly locked. That is a good thing, except that it slows down every access +to globaldict. In contrast, userdict is a per-thread dictionary, so it is not +implicitly locked. + +Implicit locking for new objects is controlled via +\htmlref{\onyxop{}{setlocking}{}}{systemdict:setlocking}, and can be queried via +\htmlref{\onyxop{}{currentlocking}{}}{systemdict:currentlocking}. Implicit +locking is turned off by default when Onyx is started up, so if an application +needs to create an object that is shared among threads, it should temporarily +turn on implicit locking. For example, the following code creates a stack in +globaldict that can be used as a simple message queue. + +\begin{verbatim} +currentlocking # Save for later restoration. +true currentlocking + +# Push globaldict onto dstack before calling def. +globaldict begin +$queue stack def +end # globaldict + +# Restore implicit locking mode. +setlocking +\end{verbatim} + +For additional details on the mechanics of implicit synchronization, see +Section~\ref{sec:onyx_implicit_synchronization}. + +\subsection{General threading concerns} + +Onyx's basic threading mechanisms are typical of those found in modern threading +implementations. One of the aspects of Onyx's threading implementation to be +aware of is that since the operating system's threading implementation is used, +there are many types of programming errors that can cause undefined behavior. +With some effort, it is possible to crash the Onyx interpreter without the use +of threads. However, it requires skill and discipline to {\em not} crash the +Onyx interpreter when using threads. This was a conscious design decision for +Onyx; doing otherwise would have limited the scalability of threading. + +Now prepare for some discouraging pontification on why threaded programming is +generally harmful. In the author's experience, the vast majority of developers +do not have a solid enough grasp of threading concepts to be seriously engaging +in the practice. As a first step to becoming proficient at threaded +programming, much reading and thought are necessary. The next step is to +implement several non-trivial threaded programs that are doomed to be complete +disasters. After that, it may be possible for a programmer to write threaded +programs that do the right thing most of the time. However, even the most +skilled developers still will be unable to consistently write code that is free +of race conditions, deadlocks, livelocks, locksteps, etc. Finally, there are +some developers who, despite being otherwise proficient, will {\em never} obtain +a solid grasp of threaded programming, regardless of how many times the basic +concepts are reviewed. + +In summary, don't use threads unless there are significant measurable gains in +performance or code complexity. Otherwise, threaded programming just is not +worth the unavoidable pain that it inflicts. + +\section{Optimization} + +There are many fine points to optimizing Onyx code, but they can primarily be +distilled down to the following simple rules: + +\begin{itemize} +\item{Avoid allocating composite objects, in order to reduce pressure on the + garbage collector. This means being very careful about string manipulation in + the fast path. The \htmlref{\onyxop{}{cat}{}}{systemdict:cat} operator is + convenient, but not friendly to the garbage collector.} +\item{Write code with as few objects as possible, to reduce the number of times + through the interpreter loop. This means getting very familiar with the stack + manipulation operators.} +\item{Use the operand stack rather than named variables.} +\item{Use the \htmlref{\onyxop{}{bind}{}}{systemdict:bind} operator for + procedure definitions whenever possible, in order to reduce dstack lookups.} +\item{Avoid the \htmlref{\onyxop{}{exit}{}}{systemdict:exit}, + \htmlref{\onyxop{}{stop}{}}{systemdict:stop}, and + \htmlref{\onyxop{}{quit}{}}{systemdict:quit} operators when possible, since + they are implemented via \cfunc{longjmp}{}.} +\end{itemize} + +\section{Debugging} + +Onyx does not have an integrated interactive debugger per se, because the +introspective power of Onyx is adequate for almost all debugging purposes. In +cases where it is impractical to interactively debug an application via the main +thread, it is possible to launch a thread that listens for connections on a +socket (or a fifo pair) and provides an interactive session. + +Following is a contrived example of debugging some bad code, interleaved with +explanations. The intention is to calculate $1 + 5$. + +\begin{verbatim} +onyx:0> 1 5L add +Error $undefined +ostack: (1) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: 5L +1: -file- +2: --start-- +onyx:2> pstack +5L +1 +\end{verbatim} + +{\tt 5L} is not a number, nor is it defined in dstack. Try replacing {\tt 5L} +with {\tt \$five}. + +\begin{verbatim} +onyx:2> pop $five resume +Error $typecheck +ostack: (1 $five) +dstack: (-dict- -dict- -dict- -dict-) +estack/istack trace (0..2): +0: --add-- +1: -file- +2: --start-- +onyx:3> pstack +--add-- +$five +1 +\end{verbatim} + +{\tt \$five} is a literal name, so no errors occur directly due to scanning it. +However, the \htmlref{\onyxop{}{add}{}}{systemdict:add} operator expects two +numbers, and {\tt \$five} is not a number. Replace it with {\tt 5} and evaluate +the operator. + +\begin{verbatim} +onyx:3> nip 5 exch eval +onyx:1> pstack +6 +\end{verbatim} + +The result is as desired. However, we forgot to +\htmlref{\onyxop{}{resume}{}}{onyx_interactive:resume} after the last error. + +\begin{verbatim} +onyx:1> estack 1 sprint +(--start-- -file- --add-- --ifelse-- --eval-- -array- -file- --estack--) +onyx:1> resume +\end{verbatim} + +Now the estack contents should be back to normal. + +\begin{verbatim} +onyx:1> estack 1 sprint +(--start-- -file- --estack--) +onyx:1> +\end{verbatim} + +The above example only demonstrates the flavor of typical interactive debugging, +but there is no magic involved in debugging, so your debugging ability should +improve automatically as you gain an improved understanding of Onyx. \ No newline at end of file diff --git a/tags/ONYX_4_3_1/devroot/install-sh b/tags/ONYX_4_3_1/devroot/install-sh new file mode 100755 index 000000000..ebc66913e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/tags/ONYX_4_3_1/devroot/lib/.cvsignore b/tags/ONYX_4_3_1/devroot/lib/.cvsignore new file mode 100644 index 000000000..82d4687e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/.cvsignore @@ -0,0 +1,2 @@ +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/lib/Cookfile b/tags/ONYX_4_3_1/devroot/lib/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/lib/Cookfile.inc.in new file mode 100644 index 000000000..91d8cdae0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/Cookfile.inc.in @@ -0,0 +1,120 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Top level Cookfile for libraries. + * + ******************************************************************************/ + +#include-cooked [fromto % @objroot@/lib/%/Cookfile.inc @libs@] + +/* + * Targets. + */ +libs_a : [addsuffix _libs_a @libs@]; +libs_s : [addsuffix _libs_s @libs@]; +libs : libs_a libs_s; + +libs_tests : [addsuffix _libs_tests @libs@]; +libs_check : [addsuffix _libs_check @libs@]; +libs_check_update : [addsuffix _libs_check_update @libs@]; + +libs_bootstrap : [addsuffix _libs_bootstrap @libs@]; + +libs_install_i : [addsuffix _libs_install_i @libs@]; +libs_install_a : [addsuffix _libs_install_a @libs@]; +libs_install_s : [addsuffix _libs_install_s @libs@]; +libs_install : libs_install_i libs_install_a libs_install_s; + +libs_uninstall : [addsuffix _libs_uninstall @libs@]; + +libs_clean : [addsuffix _libs_clean @libs@]; +libs_distclean : [addsuffix _libs_distclean @libs@]; + +/* + * Build rules for library C files --> object files. + */ +@objroot@/lib/%0src/%1.o_a : @srcroot@/lib/%0src/%1.c + set mkdir +{ + [TCC] [A_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @srcroot@/lib/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @srcroot@/lib/%0src/%1.c + "--prefix='"[target]" : "@srcroot@/lib/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto lib/%0src/%1.o_a lib/%0src/%1.d_a [target]]; +} + +@objroot@/lib/%0src/%1.o_b : @srcroot@/lib/%0src/%1.c + set mkdir +{ + [HCC] [A_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @srcroot@/lib/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @srcroot@/lib/%0src/%1.c + "--prefix='"[target]" : "@srcroot@/lib/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto lib/%0src/%1.o_b lib/%0src/%1.d_b [target]]; +} + +@objroot@/lib/%0src/%1.o_s : @srcroot@/lib/%0src/%1.c + set mkdir +{ + [TCC] [S_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @srcroot@/lib/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @srcroot@/lib/%0src/%1.c + "--prefix='"[target]" : "@srcroot@/lib/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto lib/%0src/%1.o_s lib/%0src/%1.d_s [target]]; +} + +/* For generated C files. */ +@objroot@/lib/%0src/%1.o_a : @objroot@/lib/%0src/%1.c + set mkdir +{ + [TCC] [A_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @objroot@/lib/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @objroot@/lib/%0src/%1.c + "--prefix='"[target]" : "@objroot@/lib/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto lib/%0src/%1.o_a lib/%0src/%1.d_a [target]]; +} + +@objroot@/lib/%0src/%1.o_b : @objroot@/lib/%0src/%1.c + set mkdir +{ + [HCC] [A_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @objroot@/lib/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @objroot@/lib/%0src/%1.c + "--prefix='"[target]" : "@objroot@/lib/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto lib/%0src/%1.o_b lib/%0src/%1.d_b [target]]; +} + +/* For generated C files. */ +@objroot@/lib/%0src/%1.o_s : @objroot@/lib/%0src/%1.c + set mkdir +{ + [TCC] [S_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @objroot@/lib/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @objroot@/lib/%0src/%1.c + "--prefix='"[target]" : "@objroot@/lib/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto lib/%0src/%1.o_s lib/%0src/%1.d_s [target]]; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/.cvsignore b/tags/ONYX_4_3_1/devroot/lib/libonyx/.cvsignore new file mode 100644 index 000000000..3eb3a9f11 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/.cvsignore @@ -0,0 +1,3 @@ +lib +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/lib/libonyx/Cookfile.inc.in new file mode 100644 index 000000000..f5778d296 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/Cookfile.inc.in @@ -0,0 +1,299 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Cookfile for libonyx. + * + * libbonyx is a bootstrap library that is created for bonyx, which is used to + * generate the native startup code embedded in libonyx. + * + ******************************************************************************/ + +/* Include generated dependency files. */ +#include-cooked [glob @objroot@/lib/libonyx/src/"*.d_*"] +#include-cooked [glob @objroot@/lib/libonyx/test/"*.d_*"] + +/* + * File lists. + */ + +/* Include files that are installed. */ +{ + local incs = libonyx.h ch.h dch.h gcdict.h mb.h mem.h nx.h nxa.h nxn.h nxo.h + nxo_array.h nxo_boolean.h nxo_dict.h nxo_file.h nxo_fino.h + nxo_hook.h nxo_integer.h nxo_mark.h nxo_name.h nxo_no.h + nxo_null.h nxo_operator.h nxo_pmark.h nxo_stack.h nxo_string.h + nxo_thread.h ql.h qr.h qs.h systemdict.h xep.h +#if @enable_threads@ + cnd.h mq.h mtx.h nxo_condition.h nxo_mutex.h thd.h tsd.h +#endif +#if @enable_real@ + nxo_real.h +#endif +#if @enable_regex@ + nxo_regex.h nxo_regsub.h +#endif + ; + incs = [addprefix @srcroot@/lib/libonyx/include/libonyx/ [incs]]; + incs = [incs] @objroot@/lib/libonyx/include/libonyx/libonyx_defs.h; + + LIBONYX_INCS = [incs]; +} + +/* Source files common to libonyx and libbonyx. */ +LIBONYX_COMMON_SRCS = [addprefix @srcroot@/lib/libonyx/src/ + libonyx.c ch.c dch.c gcdict.c mem.c nx.c nxa.c + nxn.c nxo.c nxo_array.c nxo_boolean.c + nxo_dict.c nxo_file.c nxo_fino.c nxo_hook.c + nxo_integer.c nxo_mark.c nxo_name.c nxo_null.c + nxo_operator.c nxo_pmark.c nxo_stack.c + nxo_string.c nxo_thread.c systemdict.c xep.c +#if @enable_threads@ + cnd.c mb.c mq.c mtx.c nxo_condition.c + nxo_mutex.c thd.c tsd.c +#endif +#if @enable_real@ + nxo_real.c +#endif +#if @enable_regex@ + nxo_regex.c nxo_regsub.c +#endif +#if @enable_posix@ + envdict.c +#endif + ]; + +/* Onyx source files that are used to generate C code. */ +LIBONYX_NSRCS = [addprefix @srcroot@/lib/libonyx/src/ + nx.nx.in nxo_thread.nx.in]; + +/* libbonyx-only source files. */ +LIBBONYX_ONLY_SRCS = [fromto %0%.nx.in %0%_bootstrap.c [LIBONYX_NSRCS]]; + +/* libonyx-only source files. */ +LIBONYX_ONLY_SRCS = [fromto @srcroot@/%0%.nx.in @objroot@/%0%_nxcode.c + [LIBONYX_NSRCS]]; + +/* Simple C tests. Output is diff'ed with the expected (.exp file) output. */ +LIBONYX_CTESTS = ch_a.c dch_a.c libonyx_a.c ql_a.c qr_a.c qs_a.c xep_a.c +#if @enable_threads@ + cnd_a.c mq_a.c mtx_a.c thd_a.c thd_b.c thd_c.c tsd_a.c +#endif +#if @enable_posix_file@ + hook_a.c +#endif + ; +LIBONYX_CTESTS = [addprefix @srcroot@/lib/libonyx/test/ [LIBONYX_CTESTS]]; + +/* LaTeX source files. */ +ONYX_TEX_SRCS += [addprefix @srcroot@/lib/libonyx/doc/latex/ + ch.tex cnd.tex dch.tex gcdict.tex mb.tex mem.tex + mq.tex mtx.tex nx.tex nxa.tex nxn.tex nxo.tex + nxo_array.tex nxo_boolean.tex nxo_dict.tex + nxo_file.tex nxo_fino.tex nxo_hook.tex + nxo_integer.tex nxo_mark.tex nxo_mutex.tex + nxo_name.tex nxo_no.tex nxo_null.tex + nxo_operator.tex nxo_pmark.tex nxo_real.tex + nxo_regex.tex nxo_regsub.tex nxo_stack.tex + nxo_string.tex nxo_thread.tex ql.tex qr.tex qs.tex + systemdict.tex thd.tex tsd.tex xep.tex] + @objroot@/lib/libonyx/doc/latex/manual.tex; + +/* Libraries. */ +LIBONYX_REV = 10; + +LIBBONYX_A = @objroot@/lib/libonyx/lib/libbonyx.a; +LIBONYX_A = @objroot@/lib/libonyx/lib/libonyx.a; +#if [matches elf @abi@] +LIBONYX_SNAME = libonyx.so.[LIBONYX_REV]; +LIBONYX_LNAME = libonyx.so; +LIBONYX_L = @objroot@/lib/libonyx/lib/[LIBONYX_LNAME]; +#elif [matches macho @abi@] +LIBONYX_SNAME = libonyx.[LIBONYX_REV].dylib; +LIBONYX_LNAME = libonyx.dylib; +LIBONYX_L = @objroot@/lib/libonyx/lib/[LIBONYX_LNAME]; +#else /* if [matches aout @abi@] */ +LIBONYX_SNAME = libonyx.so.[LIBONYX_REV].0; +LIBONYX_LNAME = ; +LIBONYX_L = ; +#endif +LIBONYX_S = @objroot@/lib/libonyx/lib/[LIBONYX_SNAME]; + +LDFLAGS = [LDFLAGS] -L@objroot@/lib/libonyx/lib; + +/* + * User cook'ables. + */ + +libbonyx_libs_a : [LIBBONYX_A]; +libonyx_libs_a : [LIBONYX_A]; +libonyx_libs_s : [LIBONYX_S]; +libonyx : libonyx_libs_a libonyx_libs_s; + +libonyx_libs_bootstrap : [BONYX] +{ + loop local f = [fromto @srcroot@/lib/libonyx/src/%.nx.in % [LIBONYX_NSRCS]] + { + cat @objroot@/lib/libonyx/src/[f].nx + | [BONYX] @srcroot@/lib/libonyx/src/[f]_gen.nx + > @srcroot@/lib/libonyx/src/[f]_bootstrap.c; + } +} + +libonyx_libs_tests : [fromto @srcroot@/%0%.c @objroot@/%0% [LIBONYX_CTESTS]]; + +libonyx_libs_check : libonyx_libs_tests [TONYX] +{ + @VERIFY@ -s @srcroot@ -o @objroot@ + [fromto @srcroot@/%0%.c @objroot@/%0% [LIBONYX_CTESTS]]; +} + +libonyx_libs_check_update : libonyx_libs_tests [TONYX] +{ + @VERIFY@ -u -s @srcroot@ -o @objroot@ + [fromto @srcroot@/%0%.c @objroot@/%0% [LIBONYX_CTESTS]]; +} + +libonyx_libs_install : libonyx_libs_install_i libonyx_libs_install_a + libonyx_libs_install_s; + +libonyx_libs_uninstall : +{ + rm -f [glob [LIBDIR]/libonyx*]; + rm -rf [INCLUDEDIR]/libonyx; +} + +libonyx_libs_clean : +{ + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_a [LIBONYX_COMMON_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_b [LIBONYX_COMMON_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_s [LIBONYX_COMMON_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [LIBONYX_COMMON_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_b [LIBONYX_COMMON_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_s [LIBONYX_COMMON_SRCS]]; + + rm -f [LIBONYX_ONLY_SRCS]; + rm -f [fromto %0%.c %0%.d_a [LIBONYX_ONLY_SRCS]]; + rm -f [fromto %0%.c %0%.d_s [LIBONYX_ONLY_SRCS]]; + rm -f [fromto %0%.c %0%.o_a [LIBONYX_ONLY_SRCS]]; + rm -f [fromto %0%.c %0%.o_s [LIBONYX_ONLY_SRCS]]; + + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_b [LIBBONYX_ONLY_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_b [LIBBONYX_ONLY_SRCS]]; + + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_a [LIBONYX_CTESTS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [LIBONYX_CTESTS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.out [LIBONYX_CTESTS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.diff [LIBONYX_CTESTS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0% [LIBONYX_CTESTS]]; + + rm -f [LIBBONYX_A] [LIBONYX_A] [LIBONYX_S] [LIBONYX_L]; +} + +libonyx_libs_distclean : +{ + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.perf [LIBONYX_CTESTS]]; + + rm -f [fromto @srcroot@/%0%.nx.in @objroot@/%0%.nx [LIBONYX_NSRCS]]; +} + +/* + * Various flags. + */ + +CPPFLAGS = -I@srcroot@/lib/libonyx/include + -I@objroot@/lib/libonyx/include/libonyx + [CPPFLAGS]; + +/* + * Build rules. + */ + +libonyx_libs_install_i : +{ + @INSTALL@ -d [INCLUDEDIR]/libonyx; + + loop local f = [LIBONYX_INCS] + { + @INSTALL@ -m 0644 [f] [INCLUDEDIR]/libonyx/; + } +} + +libonyx_libs_install_common : +{ + @INSTALL@ -d [LIBDIR]; +} + +libonyx_libs_install_a : [LIBONYX_A] libonyx_libs_install_common +{ + @INSTALL@ -m 0444 [LIBONYX_A] [LIBDIR]; +} + +libonyx_libs_install_s : [LIBONYX_S] libonyx_libs_install_common +{ +#if [matches macho @abi@] + /* Set install_name correctly before installing. */ + [TCC] -undefined suppress -flat_namespace -dynamiclib -bind_at_load + -compatibility_version [LIBONYX_REV] + -current_version [LIBONYX_REV] + -install_name [LIBDIR]/libonyx.[LIBONYX_REV].dylib + -o [LIBONYX_S] + [fromto @srcroot@/%0%.c @objroot@/%0%.o_s [LIBONYX_COMMON_SRCS]] + [fromto @objroot@/%0%.c @objroot@/%0%.o_s [LIBONYX_ONLY_SRCS]]; +#endif + + @INSTALL@ -m 0444 [LIBONYX_S] [LIBDIR]; + +#if [count [LIBONYX_LNAME]] + rm -f [LIBDIR]/[LIBONYX_LNAME]; + ln -s [LIBONYX_SNAME] [LIBDIR]/[LIBONYX_LNAME]; +#endif +} + +/* + * Dependencies. + */ + +[LIBBONYX_A] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_b [LIBONYX_COMMON_SRCS]] + [fromto @srcroot@/%0%.c @objroot@/%0%.o_b [LIBBONYX_ONLY_SRCS]] + set mkdir +{ + @AR@ cru [target] [younger]; + @RANLIB@ [target]; +} + +[LIBONYX_A] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_a [LIBONYX_COMMON_SRCS]] + [fromto @objroot@/%0%.c @objroot@/%0%.o_a [LIBONYX_ONLY_SRCS]] + set mkdir +{ + @AR@ cru [target] [younger]; + @RANLIB@ [target]; +} + +[LIBONYX_S] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_s [LIBONYX_COMMON_SRCS]] + [fromto @objroot@/%0%.c @objroot@/%0%.o_s [LIBONYX_ONLY_SRCS]] + set mkdir +{ + [TCC] +#if [matches elf @abi@] + -shared +#elif [matches macho @abi@] + -undefined suppress -flat_namespace -dynamiclib -bind_at_load + -compatibility_version [LIBONYX_REV] + -current_version [LIBONYX_REV] + -install_name @abs_objroot@/[LIBONYX_S] +#else /* if [matches aout @abi@] */ + -shared +#endif + -o [target] [need]; + +#if [count [LIBONYX_LNAME]] + rm -f @objroot@/lib/libonyx/lib/[LIBONYX_LNAME]; + ln -s [LIBONYX_SNAME] @objroot@/lib/libonyx/lib/[LIBONYX_LNAME]; +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/.cvsignore b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/.cvsignore new file mode 100644 index 000000000..d4f9179c4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/.cvsignore @@ -0,0 +1 @@ +manual.tex diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/ch.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/ch.tex new file mode 100644 index 000000000..e26983f54 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/ch.tex @@ -0,0 +1,408 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% ch portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{ch} +\label{ch} +\label{chi} +\index{ch@\classname{ch}{}} + +The \classname{ch} class implements chained hashing. It uses a simple bucket +chaining hash table implementation. Table size is set at creation time, and +cannot be changed, so performance will suffer if a \classname{ch} object is +over-filled. The main \ctype{cw\_ch\_t} data structure and the table are +contiguously allocated, which means that care must be taken when manually +pre-allocating space for the structure. Each item that is inserted into the +\classname{ch} object is encapsulated by a \classname{chi} object, for which +space can optionally be passed in as a parameter to \cfunc{ch\_insert}{}. If no +space for the \classname{chi} object is passed in, an opaque allocator function +is used internally for allocation. + +Multiple entries with the same key are allowed and are stored in LIFO order. + +Calling \cfunc{ch\_remove\_iterate}{} and \cfunc{ch\_get\_iterate}{} are +guaranteed to operate on the oldest item in the hash table, which means that the +hash code has an integrated FIFO queue. + +The \classname{ch} class is meant to be small and simple without compromising +performance. Note that it is not well suited for situations where the number of +items can vary wildly; the \htmlref{\classname{dch}}{dch} class is designed for +such situations. + +\subsubsection{API} +\begin{capi} +\label{CW_CH_TABLE2SIZEOF} +\index{CW_CH_TABLE2SIZEOF@\cppmacro{CW\_CH\_TABLE2SIZEOF}{}} +\citem{\cppmacro[cw\_uint32\_t]{CW\_CH\_TABLE2SIZEOF}{cw\_uint32\_t +a\_table\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_table\_size: ] + Number of slots in the hash table. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Size of a \classname{ch} object with + \cvar{a\_table\_size} slots. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Calculate the size of a \classname{ch} object with + \cvar{a\_table\_size} slots. + \end{capilist} +\label{ch_new} +\index{ch_new@\cfunc{ch\_new}{}} +\citem{\cfunc[]{ch\_new}{cw\_ch\_t *a\_ch, cw\_opaque\_alloc\_t *a\_alloc, +cw\_opaque\_dealloc\_t *a\_dealloc, void *a\_arg, cw\_uint32\_t a\_table\_size, +cw\_ch\_hash\_t *a\_hash, cw\_ch\_key\_comp\_t *a\_key\_comp}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to space for a \classname{ch} with + \cvar{a\_table\_size} slots, or NULL. Use the + \cppmacro{CW\_CH\_TABLE2SIZEOF}{} macro to calculate + the total space needed for a given table size. + \item[a\_alloc: ] + Pointer to an allocation function to use internally. + \item[a\_dealloc: ] + Pointer to a deallocation function to use internally. + \item[a\_arg: ] + Opaque pointer to pass to \cfunc{a\_alloc}{} and + \cfunc{a\_dealloc}{}. + \item[a\_table\_size: ] + Number of slots in the hash table. + \item[a\_hash: ] + Pointer to a hashing function. + \item[a\_key\_comp: ] + Pointer to a key comparison function. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a \classname{ch}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{ch_delete} +\index{ch_delete@\cfunc{ch\_delete}{}} +\citem{\cfunc[void]{ch\_delete}{cw\_ch\_t *a\_ch}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{ch_count} +\index{ch_count@\cfunc{ch\_count}{}} +\citem{\cfunc[cw\_uint32\_t]{ch\_count}{cw\_ch\_t *a\_ch}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Number of items in \cvar{a\_ch}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the number of items in \cvar{a\_ch}. + \end{capilist} +\label{ch_insert} +\index{ch_insert@\cfunc{ch\_insert}{}} +\citem{\cfunc[void]{ch\_insert}{cw\_ch\_t *a\_ch, const void *a\_key, const void +*a\_data, cw\_chi\_t *a\_chi}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \item[a\_key: ] + Pointer to a key. + \item[a\_data: ] + Pointer to data associated with \cvar{a\_key}. + \item[a\_chi: ] + Pointer to space for a \classname{chi}, or NULL. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Insert \cvar{a\_data} into \cvar{a\_ch}, using key + \cvar{a\_key}. Use \cvar{a\_chi} for the internal + \classname{chi} container if non-NULL. + \end{capilist} +\label{ch_remove} +\index{ch_remove@\cfunc{ch\_remove}{}} +\citem{\cfunc[cw\_bool\_t]{ch\_remove}{cw\_ch\_t *a\_ch, const void +*a\_search\_key, void **r\_key, void **r\_data, cw\_chi\_t **r\_chi}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \item[a\_search\_key: ] + Pointer to the key to search with. + \item[r\_key: ] + Pointer to a key pointer, or NULL. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \item[r\_chi: ] + Pointer to a \classname{chi} pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Item with key \cvar{a\_search\_key} not found. + \end{description} + \item[*r\_key: ] + If (\cvar{r\_key} != NULL) and (retval == FALSE), + pointer to a key. Otherwise, undefined. + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. Otherwise, undefined. + \item[*r\_chi: ] + If (\cvar{r\_chi} != NULL) and (retval == FALSE), + pointer to space for a \classname{chi}, or NULL. + Otherwise, undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Remove the item from \cvar{a\_ch} that was most recently + inserted with key \cvar{a\_search\_key}. If successful, set + \cvar{*r\_key} and \cvar{*r\_data} to point to the key, data, + and externally allocated \classname{chi}, respectively. + \end{capilist} +\label{ch_search} +\index{ch_search@\cfunc{ch\_search}{}} +\citem{\cfunc[cw\_bool\_t]{ch\_search}{cw\_ch\_t *a\_ch, const void *a\_key, +void **r\_data}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \item[a\_key: ] + Pointer to a key. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Item with key \cvar{a\_key} not found in + \cvar{a\_ch}. + \end{description} + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Search for the most recently inserted item with key + \cvar{a\_key}. If found, \cvar{*r\_data} to point to the + associated data. + \end{capilist} +\label{ch_get_iterate} +\index{ch_get_iterate@\cfunc{ch\_get\_iterate}{}} +\citem{\cfunc[cw\_bool\_t]{ch\_get\_iterate}{cw\_ch\_t *a\_ch, void **r\_key, +void **r\_data}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \item[r\_key: ] + Pointer to a key pointer, or NULL. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_ch} is empty. + \end{description} + \item[*r\_key: ] + If (\cvar{r\_key} != NULL) and (retval == FALSE), + pointer to a key. Otherwise, undefined. + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. Otherwise, undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{*r\_key} and \cvar{*r\_data} to point to the oldest + item in \cvar{a\_ch}. Promote the item so that it is the newest + item in \cvar{a\_ch}. + \end{capilist} +\label{ch_remove_iterate} +\index{ch_remove_iterate@\cfunc{ch\_remove\_iterate}{}} +\citem{\cfunc[cw\_bool\_t]{ch\_remove\_iterate}{cw\_ch\_t *a\_ch, void +**r\_key, void **r\_data, cw\_chi\_t **r\_chi}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_ch: ] + Pointer to a \classname{ch}. + \item[r\_key: ] + Pointer to a key pointer, or NULL. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \item[r\_chi: ] + Pointer to a \classname{chi} pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_ch} is empty. + \end{description} + \item[*r\_key: ] + If (\cvar{r\_key} != NULL) and (retval == FALSE), + pointer to a key. Otherwise, undefined. + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. Otherwise, undefined. + \item[*r\_chi: ] + If (\cvar{r\_chi} != NULL) and (retval == FALSE), + pointer to a \classname{chi}, or NULL. Otherwise, + undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{*r\_key} and \cvar{*r\_data} to point to the oldest + item in \cvar{a\_ch}, set \cvar{*r\_chi} to point to the item's + container, if externally allocated, and remove the item from + \cvar{a\_ch}. + \end{capilist} +\label{ch_string_hash} +\index{ch_string_hash@\cfunc{ch\_string\_hash}{}} +\citem{\cfunc[cw\_uint32\_t]{ch\_string\_hash}{const void *a\_key}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_key: ] + Pointer to a key. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Hash result. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + NULL-terminated string hashing function. + \end{capilist} +\label{ch_direct_hash} +\index{ch_direct_hash@\cfunc{ch\_direct\_hash}{}} +\citem{\cfunc[cw\_uint32\_t]{ch\_direct\_hash}{const void *a\_key}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_key: ] + Pointer to a key. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Hash result. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Direct (pointer) hashing function. + \end{capilist} +\label{ch_string_key_comp} +\index{ch_string_key_comp@\cfunc{ch\_string\_key\_comp}{}} +\citem{\cfunc[cw\_bool\_t]{ch\_string\_key\_comp}{const void *a\_k1, const void +*a\_k2}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_k1: ] + Pointer to a key. + \item[a\_k2: ] + Pointer to a key. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Not equal. + \item[TRUE: ] + Equal. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Test two keys (NULL-terminated strings) for equality. + \end{capilist} +\label{ch_direct_key_comp} +\index{ch_direct_key_comp@\cfunc{ch\_direct\_key\_comp}{}} +\citem{\cfunc[cw\_bool\_t]{ch\_direct\_key\_comp}{const void *a\_k1, const void +*a\_k2}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_k1: ] + Pointer to a key. + \item[a\_k2: ] + Pointer to a key. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Not equal. + \item[TRUE: ] + Equal. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Test two keys (pointers) for equality. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/cnd.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/cnd.tex new file mode 100644 index 000000000..6829c95e6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/cnd.tex @@ -0,0 +1,124 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% cnd portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{cnd} +\label{cnd} +\index{cnd@\classname{cnd}{}} + +The \classname{cnd} class implements condition variables, which can be used in +conjunction with the \htmlref{\classname{mtx}}{mtx} class to wait for a +condition to occur. + +\subsubsection{API} +\begin{capi} +\label{cnd_new} +\index{cnd_new@\cfunc{cnd\_new}{}} +\citem{\cfunc[void]{cnd\_new}{cw\_cnd\_t *a\_cnd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_cnd: ] + Pointer to space for a \classname{cnd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{cnd_delete} +\index{cnd_delete@\cfunc{cnd\_delete}{}} +\citem{\cfunc[void]{cnd\_delete}{cw\_cnd\_t *a\_cnd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_cnd: ] + Pointer to a \classname{cnd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{cnd_signal} +\index{cnd_signal@\cfunc{cnd\_signal}{}} +\citem{\cfunc[void]{cnd\_signal}{cw\_cnd\_t *a\_cnd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_cnd: ] + Pointer to a \classname{cnd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Signal one thread waiting on \cvar{a\_cnd}, if there are any + waiters. + \end{capilist} +\label{cnd_broadcast} +\index{cnd_broadcast@\cfunc{cnd\_broadcast}{}} +\citem{\cfunc[void]{cnd\_broadcast}{cw\_cnd\_t *a\_cnd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_cnd: ] + Pointer to a \classname{cnd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Signal all threads waiting on \cvar{a\_cnd}. + \end{capilist} +\label{cnd_timedwait} +\index{cnd_timedwait@\cfunc{cnd\_timedwait}{}} +\citem{\cfunc[cw\_bool\_t]{cnd\_timedwait}{cw\_cnd\_t *a\_cnd, cw\_mtx\_t +*a\_mtx, const struct timespec *a\_timeout}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_cnd: ] + Pointer to a \classname{cnd}. + \item[a\_mtx: ] + Pointer to a \classname{mtx}. + \item[a\_timeout: ] + Timeout, specified as an absolute time interval. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Timeout. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Wait for \cvar{a\_cnd} for at least \cvar{a\_time}. + \end{capilist} +\label{cnd_wait} +\index{cnd_wait@\cfunc{cnd\_wait}{}} +\citem{\cfunc[void]{cnd\_wait}{cw\_cnd\_t *a\_cnd, cw\_mtx\_t *a\_mtx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_cnd: ] + Pointer to a \classname{cnd}. + \item[a\_mtx: ] + Pointer to a \classname{mtx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Wait for \cvar{a\_cnd}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/dch.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/dch.tex new file mode 100644 index 000000000..82c783d5b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/dch.tex @@ -0,0 +1,341 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% dch portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{dch} +\label{dch} +\index{dch@\classname{dch}{}} + +The \classname{dch} class implements dynamic chained hashing. The +\classname{dch} class is a wrapper around the \classname{ch} class that enforces +fullness/emptiness constraints and rebuilds the hash table when necessary. +Other than this added functionality, the \classname{dch} class behaves almost +exactly like the \classname{ch} class. See the \htmlref{\classname{ch}}{ch} +class documentation for additional information. + +\subsubsection{API} +\begin{capi} + +\label{dch_new} +\index{dch_new@\cfunc{dch\_new}{}} +\citem{\cfunc[]{dch\_new}{cw\_dch\_t *a\_dch, cw\_opaque\_alloc\_t *a\_alloc, +cw\_opaque\_dealloc\_t *a\_dealloc, void *a\_arg, cw\_uint32\_t a\_base\_table, +cw\_uint32\_t a\_base\_grow, cw\_uint32\_t a\_base\_shrink, cw\_ch\_hash\_t +*a\_hash, cw\_ch\_key\_comp\_t *a\_key\_comp}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to space for a \classname{dch}, or NULL. + \item[a\_alloc: ] + Pointer to an allocation function to use internally. + \item[a\_dealloc: ] + Pointer to a deallocation function to use internally. + \item[a\_arg: ] + Opaque pointer to pass to \cfunc{a\_alloc}{} and + \cfunc{a\_dealloc}{}. + \item[a\_base\_table: ] + Number of slots in the initial hash table. + \item[a\_base\_grow: ] + Maximum number of items to allow in \cvar{a\_dch} before + doubling the hash table size. The same proportions (in + relation to \cvar{a\_base\_table}) are used to decide + when to double the table additional times. + \item[a\_base\_shrink: ] + Minimum proportional (with respect to + \cvar{a\_base\_table}) emptiness to allow in the hash + table before cutting the hash table size in half. + \item[a\_hash: ] + Pointer to a hashing function. + \item[a\_key\_comp: ] + Pointer to a key comparison function. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a \classname{dch}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{dch_delete} +\index{dch_delete@\cfunc{dch\_delete}{}} +\citem{\cfunc[void]{dch\_delete}{cw\_dch\_t *a\_dch}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{dch_count} +\index{dch_count@\cfunc{dch\_count}{}} +\citem{\cfunc[cw\_uint32\_t]{dch\_count}{cw\_dch\_t *a\_dch}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Number of items in \cvar{a\_dch}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the number of items in \cvar{a\_dch}. + \end{capilist} +\label{dch_shrinkable_get} +\index{dch_shrinkable_get@\cfunc{dch\_shrinkable\_get}{}} +\citem{\cfunc[cw\_bool\_t]{dch\_shrinkable\_get}{cw\_dch\_t *a\_dch}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[TRUE: ] \cvar{a\_dch} is currently shrinkable + (initial default). + \item[FALSE: ] \cvar{a\_dch} is not currently + shrinkable, so no attempt will be made to shrink + the hash table in \cfunc{dch\_remove}{} or + \cfunc{dch\_remove\_iterate}{}. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return whether \cvar{a\_dch} is currently shrinkable. + \end{capilist} +\label{dch_shrinkable_set} +\index{dch_shrinkable_set@\cfunc{dch\_shrinkable\_set}{}} +\citem{\cfunc[void]{dch\_shrinkable\_set}{cw\_dch\_t *a\_dch, cw\_bool\_t +a\_shrinkable}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \item[a\_shrinkable: ] + \begin{description}\item[] + \item[TRUE: ] Set \cvar{a\_dch} to be shrinkable. + \item[FALSE: ] Set \cvar{a\_dch} to not be shrinkable. + No attempt will be made to shrink the hash table + in \cfunc{dch\_remove}{} or + \cfunc{dch\_remove\_iterate}{} while in this + state. + \end{description} + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set whether \cvar{a\_dch} should try to shrink the hash table in + \cfunc{dch\_remove}{} and \cfunc{dch\_remove\_iterate}{}. + \end{capilist} +\label{dch_insert} +\index{dch_insert@\cfunc{dch\_insert}{}} +\citem{\cfunc[void]{dch\_insert}{cw\_dch\_t *a\_dch, const void *a\_key, const +void *a\_data, cw\_chi\_t *a\_chi}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \item[a\_key: ] + Pointer to a key. + \item[a\_data: ] + Pointer to data associated with \cvar{a\_key}. + \item[a\_chi: ] + Pointer to space for a \classname{chi}, or NULL. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Insert \cvar{a\_data} into \cvar{a\_dch}, using key + \cvar{a\_key}. Use \cvar{a\_chi} for the internal + \classname{chi} container if non-NULL. + \end{capilist} +\label{dch_remove} +\index{dch_remove@\cfunc{dch\_remove}{}} +\citem{\cfunc[cw\_bool\_t]{dch\_remove}{cw\_dch\_t *a\_dch, const void +*a\_search\_key, void **r\_key, void **r\_data, cw\_chi\_t **r\_chi}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \item[a\_search\_key: ] + Pointer to the key to search with. + \item[r\_key: ] + Pointer to a key pointer, or NULL. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \item[r\_chi: ] + Pointer to a \classname{chi} pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Item with key \cvar{a\_search\_key} not found. + \end{description} + \item[*r\_key: ] + If (\cvar{r\_key} != NULL) and (retval == FALSE), + pointer to a key. Otherwise, undefined. + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. Otherwise, undefined. + \item[*r\_chi: ] + If (\cvar{r\_chi} != NULL) and (retval == FALSE), + pointer to space for a \classname{chi}, or NULL. + Otherwise, undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Remove the item from \cvar{a\_dch} that was most recently + inserted with key \cvar{a\_search\_key}. If successful, set + \cvar{*r\_key} and \cvar{*r\_data} to point to the key, data, + and externally allocated \classname{chi}, respectively. + \end{capilist} +\label{dch_search} +\index{dch_search@\cfunc{dch\_search}{}} +\citem{\cfunc[cw\_bool\_t]{dch\_search}{cw\_dch\_t *a\_dch, const void *a\_key, +void **r\_data}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \item[a\_key: ] + Pointer to a key. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Item with key \cvar{a\_key} not found in + \cvar{a\_dch}. + \end{description} + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Search for the most recently inserted item with key + \cvar{a\_key}. If found, \cvar{*r\_data} to point to the + associated data. + \end{capilist} +\label{dch_get_iterate} +\index{dch_get_iterate@\cfunc{dch\_get\_iterate}{}} +\citem{\cfunc[cw\_bool\_t]{dch\_get\_iterate}{cw\_dch\_t *a\_dch, void **r\_key, +void **r\_data}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \item[r\_key: ] + Pointer to a key pointer, or NULL. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_dch} is empty. + \end{description} + \item[*r\_key: ] + If (\cvar{r\_key} != NULL) and (retval == FALSE), + pointer to a key. Otherwise, undefined. + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. Otherwise, undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{*r\_key} and \cvar{*r\_data} to point to the oldest + item in \cvar{a\_dch}. Promote the item so that it is the + newest item in \cvar{a\_dch}. + \end{capilist} +\label{dch_remove_iterate} +\index{dch_remove_iterate@\cfunc{dch\_remove\_iterate}{}} +\citem{\cfunc[cw\_bool\_t]{dch\_remove\_iterate}{cw\_dch\_t *a\_dch, void +**r\_key, void **r\_data, cw\_chi\_t **r\_chi}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_dch: ] + Pointer to a \classname{dch}. + \item[r\_key: ] + Pointer to a key pointer, or NULL. + \item[r\_data: ] + Pointer to a data pointer, or NULL. + \item[r\_chi: ] + Pointer to a \classname{chi} pointer, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_dch} is empty. + \end{description} + \item[*r\_key: ] + If (\cvar{r\_key} != NULL) and (retval == FALSE), + pointer to a key. Otherwise, undefined. + \item[*r\_data: ] + If (\cvar{r\_data} != NULL) and (retval == FALSE), + pointer to data. Otherwise, undefined. + \item[*r\_chi: ] + If (\cvar{r\_chi} != NULL) and (retval == FALSE), + pointer to a \classname{chi}, or NULL. Otherwise, + undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{*r\_key} and \cvar{*r\_data} to point to the oldest + item in \cvar{a\_dch}, set \cvar{*r\_chi} to point to the item's + container, if externally allocated, and remove the item from + \cvar{a\_dch}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/gcdict.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/gcdict.tex new file mode 100644 index 000000000..33d1dd776 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/gcdict.tex @@ -0,0 +1,71 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% gcdict portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{gcdict} +\label{gcdict} +\index{gcdict@\classname{gcdict}{}} + +The \classname{gcdict} functions implement the operators contained in +\onyxop{}{gcdict}{}. Only the C API is documented here; see +Section~\ref{sec:gcdict} for operator semantics. + +\subsubsection{API} +\begin{capi} +\label{gcdict_active} +\index{gcdict_active@\cfunc{gcdict\_active}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{active}{gcdict:active}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_collect} +\index{gcdict_collect@\cfunc{gcdict\_collect}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{collect}{gcdict:collect}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_period} +\index{gcdict_period@\cfunc{gcdict\_period}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{period}{gcdict:period}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_setactive} +\index{gcdict_setactive@\cfunc{gcdict\_setactive}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{setactive}{gcdict:setactive}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_setperiod} +\index{gcdict_setperiod@\cfunc{gcdict\_setperiod}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{setperiod}{gcdict:setperiod}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_setthreshold} +\index{gcdict_setthreshold@\cfunc{gcdict\_setthreshold}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{setthreshold}{gcdict:setthreshold}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_stats} +\index{gcdict_stats@\cfunc{gcdict\_stats}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{stats}{gcdict:stats}}{cw\_nxo\_t +*a\_thread}} +\label{gcdict_threshold} +\index{gcdict_threshold@\cfunc{gcdict\_threshold}{}} +\citem{\cfunc[void]{gcdict\_\htmlref{threshold}{gcdict:threshold}}{cw\_nxo\_t +*a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + C interfaces to Onyx operators that control garbage collection. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/manual.tex.in b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/manual.tex.in new file mode 100644 index 000000000..e149e3731 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/manual.tex.in @@ -0,0 +1,593 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% libonyx portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\clearemptydoublepage +\chapter{The libonyx library} +\label{onyxlib} + +The \libname{libonyx} library implements an embeddable \htmlref{Onyx}{onyxlang} +interpreter. \libname{libonyx} is designed to allow multiple interpreter +instances in the same program, though since \htmlref{Onyx}{onyxlang} is a +multi-threaded language, in most cases it makes more sense to use a single +interpreter instance with multiple threads. + +The \htmlref{Onyx}{onyxlang} language is described elsewhere in this manual, so +this chapter documents the C API with as little information about the +\htmlref{Onyx}{onyxlang} language as possible. + +A minimal program that runs the Onyx interpreter interactively looks like: +\begin{verbatim} +#include + +int +main(int argc, char **argv, char **envp) +{ + cw_nx_t nx; + cw_nxo_t thread, *nxo; + + /* Initialize libonyx and the Onyx interpreter. */ + libonyx_init(); + nx_new(&nx, NULL, argc, argv, envp); + + /* Create a thread. */ + nxo_thread_new(&thread, &nx); + + /* Set up stdin for evaluation. */ + nxo = nxo_stack_push(nxo_thread_ostack_get(&thread)); + nxo_dup(nxo, nxo_thread_stdin_get(&thread)); + nxo_attr_set(nxo, NXOA_EXECUTABLE); + + /* Start the thread. */ + nxo_thread_start(&thread); + + /* Clean up. */ + nx_delete(&nx); + libonyx_shutdown(); + return 0; +} +\end{verbatim} + +In most cases, an application will need to implement additional Onyx operators +(and make them accessible from within the Onyx interpreter) in order to make the +application accessible/controllable from the Onyx interpreter. If the +application user interface is to be interaction with the Onyx interpreter, then +little else needs to be done. + +\section{Compilation} +Use the following compiler command line to compile applications with +\libname{libonyx}. +\begin{verbatim} +cc `onyx_config --cppflags` `onyx_config --ldflags --libs` +\end{verbatim} + +\section{Types} +\libname{libonyx} is careful to use the following data types rather than the +built-in types (other than when using system library functions and string +pointers (char *)) to allow easy porting and explicit knowledge of variable +sizes: +\begin{description} +\item[cw\_bool\_t: ] Boolean, either FALSE or TRUE. +\item[cw\_sint8\_t: ] Signed 8 bit variable. +\item[cw\_uint8\_t: ] Unsigned 8 bit variable. +\item[cw\_sint16\_t: ] Signed 16 bit variable. +\item[cw\_uint16\_t: ] Unsigned 16 bit variable. +\item[cw\_sint32\_t: ] Signed 32 bit variable. +\item[cw\_uint32\_t: ] Unsigned 32 bit variable. +\item[cw\_sint64\_t: ] Signed 64 bit variable. +\item[cw\_uint64\_t: ] Unsigned 64 bit variable. +\item[cw\_fp64\_t: ] 64 bit IEEE floating point variable. +\end{description} + +\section{Global variables} +\libname{libonyx} defines the following global variables, which can be used by +the application: +\begin{description} +\item[cw\_g\_mem: ] \classname{mem} instance, default memory allocator. +\end{description} + +\section{Threads} +\libname{libonyx} encapsulates each interpreter instance in an \classname{nx} +object. An \classname{nx} object supports running multiple concurrent threads. +Each thread context is encapsulated by an \classname{nxo} thread object. + +In general, each process thread should execute in its own \classname{nxo} thread +object context, though the only explicit restriction placed on \classname{nxo} +thread object operations is that only one thread can be executing in an +\classname{nxo} thread object context at a time. In other words, the +\classname{nxo} thread class does not synchronize access to its internals, since +there is normally no reason for multiple threads to execute in the same +\classname{nxo} thread object context. + +\section{Garbage collection} +Since there can be arbitrary threads executing in the interpreter concurrently, +there are two ways to implement safe garbage collection: concurrent or atomic. +\libname{libonyx} uses atomic garbage collection, which means that the thread +doing garbage collection suspends all other threads that are created via +\cfunc{\htmlref{thd\_new}{thd_new}}{..., TRUE} during the mark phase. In order +for this to work, the garbage collector must not do any locking while the other +threads are suspended, or else there is a high probability of eventual deadlock. +\libname{libonyx} itself meets these criteria, as must any C extensions to the +interpreter that are executed by the garbage collector during the mark phase +(reference iteration). + +\section{Exceptions} +\libname{libonyx} reserves \htmlref{\classname{xep}}{xep} exception numbers 0 to +127 and defines the following exceptions: +\begin{description} +\label{CW_ONYXX_OOM} +\item[\cppdef{CW\_ONYXX\_OOM}: ] + Memory allocation error. +\label{CW_ONYXX_EXIT} +\item[\cppdef{CW\_ONYXX\_EXIT}: ] + Internal use, for the exit operator. +\label{CW_ONYXX_STOP} +\item[\cppdef{CW\_ONYXX\_STOP}: ] + Internal use, for the stop operator. +\label{CW_ONYXX_QUIT} +\item[\cppdef{CW\_ONYXX\_QUIT}: ] + Internal use, for the quit operator. +\end{description} + +\section{Integration issues} +\subsection{Thread creation} +\libname{libonyx}'s garbage collector uses the \htmlref{\classname{thd}}{thd} +class to suspend and resume all other threads during the mark phase of atomic +collection. For this to work, all threads that have any contact with +\libname{libonyx} must be created as suspendible threads using the +\htmlref{\classname{thd}}{thd} class. + +This can cause integration headaches for existing threaded applications, but +there is no other portable way to suspend and resume threads. The only +alternative is to assure that only one thread is executing in the interpreter +and to disable timeout-based (asynchronous) collection. + +\subsection{Restarted interrupted system calls} +As mentioned above, \libname{libonyx} uses thread suspension and resumption to +implement garbage collection. This has the side-effect of making restarted +interrupted system calls a real possibility. However, the operating system will +return with a partial result if the system call was partially complete when it +was interrupted. In practice, what this means is that short reads and writes +are possible where they otherwise wouldn't happen, so the application should not +make any assumptions about interruptible system calls always completing with a +full result. See the \htmlref{\classname{thd}}{thd} class documentation for +more details. + +\subsection{Signals} +Depending on how \libname{libonyx} is built, \cvar{SIGUSR1} and \cvar{SIGUSR2} +may be reserved by the \htmlref{\classname{thd}}{thd} class for thread +suspension and resumption. Additionally, the \cvar{SIGPIPE} signal is ignored +by default, since socket operations can cause \cvar{SIGPIPE} signals, for which +the library has no use. + +\section{Guidelines for writing extensions} +When embedding \libname{libonyx} in an application, it is usually desireable to +add some operators so that the interpreter can interact with the rest of the +application. The \libname{libonyx} source code contains hundreds of operators +that can be used as examples when writing new operators. However, there are +some very important rules that operators must follow, some of which may not be +obvious when reading the code. + +\begin{itemize} +\item{Manually managed (\cfunc{malloc}{}/\cfunc{free}{}) memory should not be +allocated unless the code is very careful. If a function recurses into the +interpreter (this includes calls to functions such as +\htmlref{\cfunc{nxo\_thread\_nerror}{}}{nxo_thread_nerror}), there is the very +real possibility that control will never return to the operator due to an +exception. Code must either catch all exceptions and clean up allocations, or +not recurse into the interpreter.} + +\item{Composite objects should never be allocated on the C stack. The garbage +collector has no knowledge of such objects, so if the only reference to an +object is on the C stack, the object may be collected, which will lead to +unpredictable program behavior. Instead of allocating objects on the C stack, +use tstack, available via +\htmlref{\cfunc{nxo\_thread\_tstack\_get}{}}{nxo_thread_tstack_get}, which is a +per-thread stack that the garbage collector scans.} + +\item{For an object to be safe from garbage collection, there must always be at +least one reference to it inside the interpreter. So, if C code obtains a +pointer to a composite object, then destroys the last known internal Onyx +reference (pops it off a stack, redefines it in a dict, replaces an element of +an array, etc.), the pointer is no longer safe to use. The \libname{libonyx} +API is structured such that it is invalid to do such a thing, for this reason.} + +\item{tstack must be cleaned up before returning from a function. This +constraint is placed on the code in order to avoid leaking space on tstack. In +debug versions of \libname{libonyx}, this is enforced by assertions. The one +exception to this rule has to do with \htmlref{\classname{xep}}{xep} exceptions, +in which case the catchers of the exceptions are responsible for cleaning up +tstack. Therefore, it is not necessary to catch exceptions merely to avoid +tstack leakage.} +\end{itemize} + +Since Onyx type checking is dynamic, it is the responsibility of the operators +to assure objects are the correct type before calling any of the type-specific +\cfunc{nxo\_*}{} functions. Failure to do so will result in unpredictable +behavior and likely crashes. + +\section{API} +\begin{capi} +\label{libonyx_init} +\index{libonyx_init@\cfunc{libonyx\_init}{}} +\citem{\cfunc[void]{libonyx\_init}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Initialize various global variables. In particular, initialize + \cvar{cw\_g\_mem}. + \end{capilist} +\label{libonyx_shutdown} +\index{libonyx_shutdown@\cfunc{libonyx\_shutdown}{}} +\citem{\cfunc[void]{libonyx\_shutdown}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Clean up the global variables that are initialized by + \cfunc{libonyx\_init}{}. + \end{capilist} +\label{cw_opaque_alloc_t} +\index{cw_opaque_alloc_t@\cfunc{cw\_opaque\_alloc\_t}{}} +\citem{\cfunc[void *]{cw\_opaque\_alloc\_t}{void *a\_arg, size\_t a\_size, +const char *a\_filename, cw\_uint32\_t a\_line\_num}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque pointer. + \item[a\_size: ] + Size of memory range to allocate. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Allocate \cvar{a\_size} of space and return a pointer to it. + \end{capilist} +\label{cw_opaque_realloc_t} +\index{cw_opaque_realloc_t@\cfunc{cw\_opaque\_realloc\_t}{}} +\citem{\cfunc[void *]{cw\_opaque\_realloc\_t}{void *a\_arg, void *a\_ptr, +size\_t a\_size, const char *a\_filename, cw\_uint32\_t a\_line\_num}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque pointer. + \item[a\_ptr: ] + Pointer to memory range to be reallocated. + \item[a\_size: ] + Size of memory range to allocate. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Reallocate \cvar{a\_size} of space and return a pointer to it. + \end{capilist} +\label{cw_opaque_dealloc_t} +\index{cw_opaque_dealloc_t@\cfunc{cw\_opaque\_dealloc\_t}{}} +\citem{\cfunc[void]{cw\_opaque\_dealloc\_t}{void *a\_mem, void *a\_ptr, size\_t +a\_size, const char *a\_filename, cw\_uint32\_t a\_line\_num}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque pointer. + \item[a\_ptr: ] + Pointer to to memory range to be freed. + \item[a\_size: ] + Sizef of memory range pointed to by \cvar{a\_ptr}. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Deallocate the memory pointed to by \cvar{a\_ptr}. + \end{capilist} +\label{cw_opaque_alloc} +\index{cw_opaque_alloc@\cfunc{cw\_opaque\_alloc}{}} +\citem{\cppmacro[void *]{cw\_opaque\_alloc}{cw\_opaque\_alloc\_t *a\_func, void +*a\_arg, size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_func: ] + Opaque allocator function pointer. + \item[a\_arg: ] + Opaque pointer. + \item[a\_size: ] + Size of memory range to allocate. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Allocate \cvar{a\_size} of space and return a pointer to it. + \end{capilist} +\label{cw_opaque_realloc} +\index{cw_opaque_realloc@\cfunc{cw\_opaque\_realloc}{}} +\citem{\cppmacro[void *]{cw\_opaque\_realloc}{cw\_opaque\_realloc\_t *a\_func, +void *a\_arg, void *a\_ptr, size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_func: ] + Opaque allocator function pointer. + \item[a\_arg: ] + Opaque pointer. + \item[a\_ptr: ] + Pointer to memory range to be reallocated. + \item[a\_size: ] + Size of memory range to allocate. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Reallocate \cvar{a\_size} of space and return a pointer to it. + \end{capilist} +\label{cw_opaque_dealloc} +\index{cw_opaque_dealloc@\cfunc{cw\_opaque\_dealloc}{}} +\citem{\cppmacro[void]{cw\_opaque\_dealloc}{cw\_opaque\_dealloc\_t *a\_func, +void *a\_mem, void *a\_ptr, size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_func: ] + Opaque allocator function pointer. + \item[a\_arg: ] + Opaque pointer. + \item[a\_ptr: ] + Pointer to to memory range to be freed. + \item[a\_size: ] + Sizef of memory range pointed to by \cvar{a\_ptr}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Deallocate the memory pointed to by \cvar{a\_ptr}. + \end{capilist} +\label{cw_onyx_code} +\index{cw_onyx_code@\cppmacro{cw\_onyx\_code}{}} +\citem{\cppmacro[void]{cw\_onyx\_code}{cw\_nxo\_t *a\_thread, const char +*a\_code}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_code: ] + A "-delimited string constant. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Depends on actions of a\_code. + \item[Description: ] + Convenience macro for static embedded \htmlref{Onyx}{onyxlang} + code. + \end{capilist} +\label{cw_assert} +\index{cw_assert@\cppmacro{cw\_assert}{}} +\citem{\cppmacro[void]{cw\_assert}{expression}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[expression: ] + C expression that evaluates to zero or non-zero. + \end{description} + \item[Output(s): ] + Possible error printed to \cvar{stderr}. + \item[Exception(s): ] None. + \item[Description: ] + If the expression evaluates to zero, print an error message to + \cvar{stderr} and \cfunc{abort}{}. + + Note: This macro is only active if the \cppdef{CW\_ASSERT} cpp + macro is defined. + \end{capilist} +\label{cw_not_reached} +\index{cw_not_reached@\cppmacro{cw\_not\_reached}{}} +\citem{\cppmacro[void]{cw\_not\_reached}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] + Error printed to \cvar{stderr}. + \item[Exception(s): ] None. + \item[Description: ] + Abort with an error message. + + Note: This macro is only active if the \cppdef{CW\_ASSERT} cpp + macro is defined. + \end{capilist} +\label{cw_check_ptr} +\index{cw_check\_ptr@\cppmacro{cw\_check\_ptr}{}} +\citem{\cppmacro[void]{cw\_check\_ptr}{a\_pointer}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_pointer: ] + A pointer. + \end{description} + \item[Output(s): ] + Possible error printed to \cvar{stderr}. + \item[Exception(s): ] None. + \item[Description: ] + If \cvar{a\_pointer} is NULL, print an error message to + \cvar{stderr} and \cfunc{abort}{}. + + Note: This macro is only active if the \cppdef{CW\_ASSERT} cpp + macro is defined. + \end{capilist} +\label{cw_error} +\index{cw_error@\cppmacro{cw\_error}{}} +\citem{\cppmacro[void]{cw\_error}{const char *a\_str}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_str: ] + Pointer to a NULL-terminated character array. + \end{description} + \item[Output(s): ] + Contents of \cvar{a\_str}, followed by a carriage return, + printed to \cvar{stderr}. + \item[Exception(s): ] None. + \item[Description: ] + Print the contents of \cvar{a\_str}, followed by a carriage + return, to \cvar{stderr}. + \end{capilist} +\label{cw_ntohq} +\index{cw_ntohq@\cppmacro{cw\_ntohq}{}} +\citem{\cppmacro[cw\_uint64\_t]{cw\_ntohq}{cw\_uint64\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_val: ] + 64 bit integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + 64 bit integer. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Convert \cvar{a\_val} from network byte order to host byte order + and return the result. + \end{capilist} +\label{cw_htonq} +\index{cw_htonq@\cppmacro{cw\_htonq}{}} +\citem{\cppmacro[cw\_uint64\_t]{cw\_htonq}{cw\_uint64\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_val: ] + 64 bit integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + 64 bit integer. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Convert \cvar{a\_val} from host byte order to network byte order + and return the result. + \end{capilist} +\label{cw_offsetof} +\index{cw_offsetof@\cppmacro{cw\_offsetof}{}} +\citem{\cppmacro[cw\_uint32\_t]{cw\_offsetof}{{\lt}type{\gt} a\_type, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_type: ] + C structure type name. + \item[a\_field: ] + Name of a field within \cvar{a\_type}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Offset of \cvar{a\_field} into \cvar{a\_type}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Calculate the offset of \cvar{a\_field} into \cvar{a\_type} + and return the result. + \end{capilist} +\end{capi} + +\section{Classes} +\input{@abs_srcroot@/lib/libonyx/doc/latex/ch} +\input{@abs_srcroot@/lib/libonyx/doc/latex/cnd} +\input{@abs_srcroot@/lib/libonyx/doc/latex/dch} +\input{@abs_srcroot@/lib/libonyx/doc/latex/mb} +\input{@abs_srcroot@/lib/libonyx/doc/latex/mem} +\input{@abs_srcroot@/lib/libonyx/doc/latex/mq} +\input{@abs_srcroot@/lib/libonyx/doc/latex/mtx} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nx} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxa} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxn} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_array} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_boolean} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_condition} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_dict} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_file} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_fino} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_hook} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_integer} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_mark} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_mutex} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_name} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_no} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_null} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_operator} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_pmark} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_real} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_regex} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_regsub} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_stack} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_string} +\input{@abs_srcroot@/lib/libonyx/doc/latex/nxo_thread} +\input{@abs_srcroot@/lib/libonyx/doc/latex/ql} +\input{@abs_srcroot@/lib/libonyx/doc/latex/qr} +\input{@abs_srcroot@/lib/libonyx/doc/latex/qs} +\input{@abs_srcroot@/lib/libonyx/doc/latex/thd} +\input{@abs_srcroot@/lib/libonyx/doc/latex/tsd} +\input{@abs_srcroot@/lib/libonyx/doc/latex/xep} + +\section{Dictionaries} +\input{@abs_srcroot@/lib/libonyx/doc/latex/gcdict} +\input{@abs_srcroot@/lib/libonyx/doc/latex/systemdict} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mb.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mb.tex new file mode 100644 index 000000000..f88e88433 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mb.tex @@ -0,0 +1,40 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% mb portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{mb} +\label{mb} +\index{mb@\classname{mb}{}} + +The \classname{mb} class implements memory barriers. A memory barrier is a low +level construct that is sometimes useful for guaranteeing the order in which +memory operations take place, even when multiple microprocessors are involved. +In most cases, mutexes are the best choice for synchronizing data access, but +sometimes it is convenient (and critical to performance) to use memory barriers +where weaker access constraints are adequate. + +\subsubsection{API} +\begin{capi} +\label{mb_write} +\index{mb_write@\cfunc{mb\_write}{}} +\citem{\cfunc[void]{mb\_write}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Create a write barrier, so that any memory writes done before + the memory barrier are guaranteed to be visible by the time any + memory writes after the memory barrier become visible. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mem.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mem.tex new file mode 100644 index 000000000..e5ec83419 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mem.tex @@ -0,0 +1,225 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% mem portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{mem} +\label{mem} +\index{mem@\classname{mem}{}} + +The \classname{mem} class implements a memory allocation (malloc) wrapper. For +the debug version of \libname{libonyx}, extra information is hashed for each +memory allocation that allows tracking of the following: + +\begin{itemize} +\item{File/line number of allocation.} +\item{Double allocation/deallocation of the same address.} +\item{Memory leaks (memory left allocated at mem destruction time).} +\end{itemize} + +If any memory leaks are detected, diagnostic output is printed to +\cvar{stderr}. + +Also, the debug version of \libname{libonyx} sets all newly allocated bytes to +{\tt 0xa5}, and all deallocated bytes to {\tt 0x5a} (except in the case of +\cfunc{mem\_calloc}{}). This tends to cause things to break sooner when +uninitialized or deallocated memory is referenced. + +In general, the \classname{mem} class doesn't need to be used directly. +Instead, there are several preprocessor macros that can be used: +\cppmacro{cw\_malloc}{}, \cppmacro{cw\_calloc}{}, +\cppmacro{cw\_realloc}{}, and \cppmacro{cw\_free}{}. + +\subsubsection{API} +\begin{capi} +\label{mem_new} +\index{mem_new@\cfunc{mem\_new}{}} +\citem{\cfunc[cw\_mem\_t *]{mem\_new}{cw\_mem\_t *a\_mem, cw\_mem\_t +*a\_internal}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mem: ] + Pointer to space for a \classname{mem}, or NULL. + \item[a\_internal: ] + Pointer to a \classname{mem} to use for internal + memory allocation, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a \classname{mem}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{mem_delete} +\index{mem_delete@\cfunc{mem\_delete}{}} +\citem{\cfunc[void]{mem\_delete}{cw\_mem\_t *a\_mem}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mem: ] + Pointer to a \classname{mem}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{mem_malloc_e} +\index{mem_malloc_e@\cfunc{mem\_malloc\_e}{}} +\citem{\cfunc[void *]{mem\_malloc\_e}{cw\_mem\_t *a\_mem, size\_t a\_size, const +char *a\_filename, cw\_uint32\_t a\_line\_num}} +\label{mem_malloc} +\index{mem_malloc@\cfunc{mem\_malloc}{}} +\citem{\cfunc[void *]{mem\_malloc}{cw\_mem\_t *a\_mem, size\_t a\_size}} +\label{cw_malloc} +\index{cw_malloc@\cppmacro{cw\_malloc}{}} +\citem{\cppmacro[void *]{cw\_malloc}{size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mem: ] + Pointer to a \classname{mem}. + \item[a\_size: ] + Size of memory range to allocate. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + \cfunc{malloc}{} wrapper. + \end{capilist} +\label{mem_calloc_e} +\index{mem_calloc_e@\cfunc{mem\_calloc\_e}{}} +\citem{\cfunc[void *]{mem\_calloc\_e}{cw\_mem\_t *a\_mem, size\_t a\_number, +size\_t a\_size, const char *a\_filename, cw\_uint32\_t a\_line\_num}} +\label{mem_calloc} +\index{mem_calloc@\cfunc{mem\_calloc}{}} +\citem{\cfunc[void *]{mem\_calloc}{cw\_mem\_t *a\_mem, size\_t a\_number, +size\_t a\_size}} +\label{cw_calloc} +\index{cw_calloc@\cppmacro{cw\_calloc}{}} +\citem{\cppmacro[void *]{cw\_calloc}{size\_t a\_number, size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mem: ] + Pointer to a \classname{mem}. + \item[a\_number: ] + Number of elements to allocate. + \item[a\_size: ] + Size of each element to allocate. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a zeroed memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + \cfunc{calloc}{} wrapper. + \end{capilist} +\label{mem_realloc_e} +\index{mem_realloc_e@\cfunc{mem\_realloc\_e}{}} +\citem{\cfunc[void *]{mem\_realloc\_e}{cw\_mem\_t *a\_mem, void *a\_ptr, size\_t +a\_size, size\_t a\_old\_size, const char *a\_filename, cw\_uint32\_t +a\_line\_num}} +\label{mem_realloc} +\index{mem_realloc@\cfunc{mem\_realloc}{}} +\citem{\cfunc[void *]{mem\_realloc}{cw\_mem\_t *a\_mem, void *a\_ptr, size\_t +a\_size}} +\label{cw_realloc} +\index{cw_realloc@\cppmacro{cw\_realloc}{}} +\citem{\cppmacro[void *]{cw\_realloc}{void *a\_ptr, size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mem: ] + Pointer to a \classname{mem}. + \item[a\_ptr: ] + Pointer to memory range to be reallocated. + \item[a\_size: ] + Size of memory range to allocate. + \item[a\_old\_size: ] + Size of memory range previously pointed to by + \cvar{a\_ptr}. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + \cfunc{realloc}{} wrapper. + \end{capilist} +\label{mem_free_e} +\index{mem_free_e@\cfunc{mem\_free\_e}{}} +\citem{\cfunc[void]{mem\_free\_e}{cw\_mem\_t *a\_mem, void *a\_ptr, size\_t +a\_size, const char *a\_filename, cw\_uint32\_t a\_line\_num}} +\label{mem_free} +\index{mem_free@\cfunc{mem\_free}{}} +\citem{\cfunc[void]{mem\_free}{cw\_mem\_t *a\_mem, void *a\_ptr, size\_t +a\_size}} +\label{cw_free} +\index{cw_free@\cppmacro{cw\_free}{}} +\citem{\cppmacro[void]{cw\_free}{void *a\_ptr}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mem: ] + Pointer to a \classname{mem}. + \item[a\_ptr: ] + Pointer to to memory range to be freed. + \item[a\_size: ] + Sizef of memory range pointed to by \cvar{a\_ptr}. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + \cfunc{free}{} wrapper. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mq.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mq.tex new file mode 100644 index 000000000..000f31f32 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mq.tex @@ -0,0 +1,263 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% mq portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{mq} +\label{mq} +\index{mq@\classname{mq}{}} + +The \classname{mq} class implements a simple unidirectional message queue. +In addition to putting and getting messages, there are methods that control +the ability to get or put. This provides a simple out of band state +transition capability. + +\subsubsection{API} +\begin{capi} +\label{mq_new} +\index{mq_new@\cfunc{mq\_new}{}} +\citem{\cfunc[void]{mq\_new}{cw\_mq\_t *a\_mq, cw\_mem\_t *a\_mem, +cw\_uint32\_t a\_msg\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to space for a \classname{mq}. + \item[a\_mem: ] + Pointer to the allocator to use internally. + \item[a\_msg\_size: ] + Size (in bytes) of messages used for all subsequent + calls to \cfunc{mq\_*get}{} and \cfunc{mq\_put}{}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{mq_delete} +\index{mq_delete@\cfunc{mq\_delete}{}} +\citem{\cfunc[void]{mq\_delete}{cw\_mq\_t *a\_mq}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{mq_tryget} +\index{mq_tryget@\cfunc{mq\_tryget}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_tryget}{cw\_mq\_t *a\_mq, ...}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \item[...: ] + Pointer to space to store a message. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] No messages in the queue, or get is + in the stop state. + \end{description} + \item[*...: ] + If \cvar{retval} is FALSE, a message. Otherwise, + undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Try to get a message, but return TRUE if none are available. + \end{capilist} +\label{mq_timedget} +\index{mq_timedget@\cfunc{mq\_timedget}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_timedget}{cw\_mq\_t *a\_mq, const struct timespec +*a\_timeout, ...}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \item[a\_timeout: ] + Timeout, specified as an absolute time interval. + \item[...: ] + Pointer to space to store a message. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] No messages in the queue, or get is + in the stop state. + \end{description} + \item[*...: ] + If \cvar{retval} is FALSE, a message. Otherwise, + undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Get a message. If none are available, block until a + message is available, or until timeout. + \end{capilist} +\label{mq_get} +\index{mq_get@\cfunc{mq\_get}{}} +\citem{\cfunc[cw\_bol\_t]{mq\_get}{cw\_mq\_t *a\_mq, ...}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \item[...: ] + Pointer to space to store a message. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Get is in the stop state. + \end{description} + \item[*...: ] + If \cvar{retval} is FALSE, a message. Otherwise, + undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Get a message. If none are available, block until a + message is available. + \end{capilist} +\label{mq_put} +\index{mq_put@\cfunc{mq\_put}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_put}{cw\_mq\_t *a\_mq, ...}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \item[...: ] + A message. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Failure due to put being in the stop + state. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Put a message in \cvar{a\_mq}. + \end{capilist} +\label{mq_get_start} +\index{mq_get_start@\cfunc{mq\_get\_start}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_get\_start}{cw\_mq\_t *a\_mq}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Error (already in start state). + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Change the get operation to the start state + (\cfunc{mq\_get}{} will not return TRUE). + \end{capilist} +\label{mq_get_stop} +\index{mq_get_stop@\cfunc{mq\_get\_stop}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_get\_stop}{cw\_mq\_t *a\_mq}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Error (already in stop state). + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Change the get operation to the stop state + (\cfunc{mq\_get}{} will return TRUE). + \end{capilist} +\label{mq_put_start} +\index{mq_put_start@\cfunc{mq\_put\_start}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_put\_start}{cw\_mq\_t *a\_mq}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Error (already in start state). + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Change the put operation to the start state + (\cfunc{mq\_put}{} will not return TRUE). + \end{capilist} +\label{mq_put_stop} +\index{mq_put_stop@\cfunc{mq\_put\_stop}{}} +\citem{\cfunc[cw\_bool\_t]{mq\_put\_stop}{cw\_mq\_t *a\_mq}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mq: ] + Pointer to a \classname{mq}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Error (already in stop state). + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Change the put operation to the stop state + (\cfunc{mq\_put}{} will return TRUE). + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mtx.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mtx.tex new file mode 100644 index 000000000..8cd99adc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/mtx.tex @@ -0,0 +1,103 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% mtx portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{mtx} +\label{mtx} +\index{mtx@\classname{mtx}{}} + +The \classname{mtx} class implements typical mutual exclusion locks. Only one +thread can hold a lock at a time, and attempting to attain the lock while +already owning it has undefined results. + +\subsubsection{API} +\begin{capi} +\label{mtx_new} +\index{mtx_new@\cfunc{mtx\_new}{}} +\citem{\cfunc[void]{mtx\_new}{cw\_mtx\_t *a\_mtx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mtx: ] + Pointer to space for a \classname{mtx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{mtx_delete} +\index{mtx_delete@\cfunc{mtx\_delete}{}} +\citem{\cfunc[void]{mtx\_delete}{cw\_mtx\_t *a\_mtx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mtx: ] + Pointer to a \classname{mtx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{mtx_lock} +\index{mtx_lock@\cfunc{mtx\_lock}{}} +\citem{\cfunc[void]{mtx\_lock}{cw\_mtx\_t *a\_mtx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mtx: ] + Pointer to a \classname{mtx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Lock \cvar{a\_mtx}. + \end{capilist} +\label{mtx_trylock} +\index{mtx_trylock@\cfunc{mtx\_trylock}{}} +\citem{\cfunc[cw\_bool\_t]{mtx\_trylock}{cw\_mtx\_t *a\_mtx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mtx: ] + Pointer to a \classname{mtx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Failure. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Try to lock \cvar{a\_mtx}, but return immediately instead of + blocking if \cvar{a\_mtx} is already locked. + \end{capilist} +\label{mtx_unlock} +\index{mtx_unlock@\cfunc{mtx\_unlock}{}} +\citem{\cfunc[void]{mtx\_unlock}{cw\_mtx\_t *a\_mtx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_mtx: ] + Pointer to a \classname{mtx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Unlock \cvar{a\_mtx}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nx.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nx.tex new file mode 100644 index 000000000..0955a0f57 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nx.tex @@ -0,0 +1,265 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nx portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nx} +\label{nx} +\index{nx@\classname{nx}{}} + +The \classname{nx} class encapsulates an Onyx interpreter instance. It contains +a number of interpreter-global objects, as well as the garbage collector. +Reclamation of all objects associated with an \classname{nx} instance is managed +by a garbage collector, so when an \classname{nx} is destroyed, all associated +objects are deallocated. + +\subsubsection{API} +\begin{capi} +\label{nx_new} +\index{nx_new@\cfunc{nx\_new}{}} +\citem{\cfunc[cw\_nx\_t *]{nx\_new}{cw\_nx\_t *a\_nx, cw\_op\_t +*a\_thread\_init, int a\_argc, char **a\_argv, char **a\_envp}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to space for an \classname{nx}, or NULL. + \item[a\_thread\_init: ] + Pointer to an initialization function to be called + during thread initialization, or NULL. + \item[a\_argc: ] + Number of command line arguments. + \item[a\_argv: ] + Pointer to an array of command line argument strings. + \item[a\_envp: ] + Pointer to an array of environment variable strings. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nx}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nx_delete} +\index{nx_delete@\cfunc{nx\_delete}{}} +\citem{\cfunc[void]{nx\_delete}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{nx_nxa_get} +\index{nx_nxa_get@\cfunc{nx\_nxa\_get}{}} +\citem{\cfunc[cw\_nxa\_t *]{nx\_nxa\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxa}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the garbage collector. + \end{capilist} +\label{nx_systemdict_get} +\index{nx_systemdict_get@\cfunc{nx\_systemdict\_get}{}} +\citem{\cfunc[cw\_nxo\_t +*]{nx\_\htmlref{systemdict}{sec:systemdict}\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxo} corresponding to + \onyxop{systemdict}{}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxo} corresponding to + \onyxop{systemdict}{}. + \end{capilist} +\label{nx_globaldict_get} +\index{nx_globaldict_get@\cfunc{nx\_globaldict\_get}{}} +\citem{\cfunc[cw\_nxo\_t +*]{nx\_\htmlref{globaldict}{sec:globaldict}\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxo} corresponding to + \onyxop{globaldict}{}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxo} corresponding to + \onyxop{globaldict}{}. + \end{capilist} +\label{nx_envdict_get} +\index{nx_envdict_get@\cfunc{nx\_envdict\_get}{}} +\citem{\cfunc[cw\_nxo\_t +*]{nx\_\htmlref{envdict}{sec:envdict}\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxo} corresponding to + \onyxop{envdict}{}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxo} corresponding to + \onyxop{envdict}{}. + \end{capilist} +\label{nx_stdin_get} +\index{nx_stdin_get@\cfunc{nx\_stdin\_get}{}} +\citem{\cfunc[cw\_nxo\_t +*]{nx\_\htmlref{stdin}{systemdict:stdin}\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxo} corresponding to + \onyxop{stdin}{}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxo} corresponding to + \onyxop{stdin}{}. + \end{capilist} +\label{nx_stdin_set} +\index{nx_stdin_set@\cfunc{nx\_stdin\_set}{}} +\citem{\cfunc[void]{nx\_\htmlref{stdin}{systemdict:stdin}\_set}{cw\_nx\_t +*a\_nx, cw\_nxo\_t *a\_stdin}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_stdin: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{a\_nx}'s stdin to \cvar{a\_stdin}. + \end{capilist} +\label{nx_stdout_get} +\index{nx_stdout_get@\cfunc{nx\_stdout\_get}{}} +\citem{\cfunc[cw\_nxo\_t +*]{nx\_\htmlref{stdout}{systemdict:stdout}\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxo} corresponding to + \onyxop{stdout}{}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxo} corresponding to + \onyxop{stdout}{}. + \end{capilist} +\label{nx_stdout_set} +\index{nx_stdout_set@\cfunc{nx\_stdout\_set}{}} +\citem{\cfunc[void]{nx\_\htmlref{stdout}{systemdict:stdout}\_set}{cw\_nx\_t +*a\_nx, cw\_nxo\_t *a\_stdout}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_stdout: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{a\_nx}'s stdout to \cvar{a\_stdout}. + \end{capilist} +\label{nx_stderr_get} +\index{nx_stderr_get@\cfunc{nx\_stderr\_get}{}} +\citem{\cfunc[cw\_nxo\_t +*]{nx\_\htmlref{stderr}{systemdict:stderr}\_get}{cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxo} corresponding to + \onyxop{stderr}{}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxo} corresponding to + \onyxop{stderr}{}. + \end{capilist} +\label{nx_stderr_set} +\index{nx_stderr_set@\cfunc{nx\_stderr\_set}{}} +\citem{\cfunc[void]{nx\_\htmlref{stderr}{systemdict:stderr}\_set}{cw\_nx\_t +*a\_nx, cw\_nxo\_t *a\_stderr}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_stderr: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{a\_nx}'s stderr to \cvar{a\_stderr}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxa.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxa.tex new file mode 100644 index 000000000..ca17d9eb0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxa.tex @@ -0,0 +1,407 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxa portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxa} +\label{nxa} +\index{nxa@\classname{nxa}{}} + +The \classname{nxa} class implements garbage collection. The garbage collector +runs a separate thread that is controlled via an asynchronous message queue. + +\subsubsection{API} +\begin{capi} +\label{nxa_malloc_e} +\index{nxa_malloc_e@\cfunc{nxa\_malloc\_e}{}} +\citem{\cfunc[void *]{nxa\_malloc\_e}{cw\_nxa\_t *a\_nxa, size\_t a\_size, const +char *a\_filename, cw\_uint32\_t a\_line\_num}} +\label{nxa_malloc} +\index{nxa_malloc@\cfunc{nxa\_malloc}{}} +\citem{\cfunc[void *]{nxa\_malloc}{cw\_nxa\_t *a\_nxa, size\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_size: ] + Size of memory range to allocate. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + \cfunc{malloc}{} wrapper. + \end{capilist} +\label{nxa_realloc_e} +\index{nxa_realloc_e@\cfunc{nxa\_realloc\_e}{}} +\citem{\cfunc[void *]{nxa\_realloc\_e}{cw\_nxa\_t *a\_nxa, void *a\_ptr, size\_t +a\_size, size\_t a\_old\_size, const char *a\_filename, cw\_uint32\_t +a\_line\_num}} +\label{nxa_realloc} +\index{nxa_realloc@\cfunc{nxa\_malloc}{}} +\citem{\cfunc[void *]{nxa\_realloc}{cw\_nxa\_t *a\_nxa, void *a\_ptr, size\_t +a\_size, size\_t a\_old\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_ptr: ] + Pointer to memory range to be reallocated. + \item[a\_size: ] + Size of memory range to allocate. + \item[a\_old\_size: ] + Size of memory range previously pointed to by + \cvar{a\_ptr}. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a memory range. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + \cfunc{realloc}{} wrapper. + \end{capilist} +\label{nxa_free_e} +\index{nxa_free_e@\cfunc{nxa\_free\_e}{}} +\citem{\cfunc[void *]{nxa\_free\_e}{cw\_nxa\_t *a\_nxa, void *a\_ptr, size\_t +a\_size, const char *a\_filename, cw\_uint32\_t a\_line\_num}} +\label{nxa_free} +\index{nxa_free@\cfunc{nxa\_free}{}} +\citem{\cfunc[void *]{nxa\_free}{cw\_nxa\_t *a\_nxa, void *a\_ptr, size\_t +a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_ptr: ] + Pointer to to memory range to be freed. + \item[a\_size: ] + Sizef of memory range pointed to by \cvar{a\_ptr}. + \item[a\_filename: ] + Should be \_\_FILE\_\_. + \item[a\_line\_num: ] + Should be \_\_LINE\_\_. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + \cfunc{free}{} wrapper. + \end{capilist} +\label{nxa_collect} +\index{nxa_collect@\cfunc{nxa\_collect}{}} +\citem{\cfunc[void]{nxa\_collect}{cw\_nxa\_t *a\_nxa}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Force an asynchronous garbage collection. + \end{capilist} +\label{nxa_dump} +\index{nxa_dump@\cfunc{nxa\_dump}{}} +\citem{\cfunc[void]{nxa\_dump}{cw\_nxa\_t *a\_nxa, cw\_nxo\_t *a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + Output printed to \onyxop{stdout}{}. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Print the internal state of gcdict to \onyxop{stdout}{}. + \end{capilist} +\label{nxa_active_get} +\index{nxa_active_get@\cfunc{nxa\_active\_get}{}} +\citem{\cfunc[cw\_bool\_t]{nxa\_active\_get}{cw\_nxa\_t *a\_nxa}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Garbage collector deactivated. + \item[TRUE: ] + Garbage collector active. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return whether the garbage collector is active (runnable). + \end{capilist} +\label{nxa_active_set} +\index{nxa_active_set@\cfunc{nxa\_active\_set}{}} +\citem{\cfunc[void]{nxa\_active\_set}{cw\_nxa\_t *a\_nxa, cw\_bool\_t +a\_active}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_active: ] + \begin{description}\item[] + \item[FALSE: ] + Deactivate garbage collector. + \item[TRUE: ] + Activate garbage collector. + \end{description} + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Send a message to the garbage collector to activate or + deactivate. The asynchronous nature of the message means that + it is possible for the garbage collector to run after this + function returns, even if a deactivation message has been sent. + \end{capilist} +\label{nxa_period_get} +\index{nxa_period_get@\cfunc{nxa\_period\_get}{}} +\citem{\cfunc[cw\_nxoi\_t]{nxa\_period\_get}{cw\_nxa\_t *a\_nxa}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Current inactivity period in seconds that the garbage + collector waits before doing a collection. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the current inactivity period in seconds that the garbage + collector waits before doing a collection. + \end{capilist} +\label{nxa_period_set} +\index{nxa_period_set@\cfunc{nxa\_period\_set}{}} +\citem{\cfunc[void]{nxa\_period\_set}{cw\_nxa\_t *a\_nxa, cw\_nxoi\_t +a\_period}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_period: ] + Inactivity period in seconds that the garbage collector + should wait before doing a collection. If 0, the + garbage collector will never run due to inactivity. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Set the inactivity period in seconds that the garbage collector + should wait before doing a collection. + \end{capilist} +\label{nxa_threshold_get} +\index{nxa_threshold_get@\cfunc{nxa\_threshold\_get}{}} +\citem{\cfunc[cw\_nxoi\_t]{nxa\_threshold\_get}{cw\_nxa\_t *a\_nxa}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Number of bytes of memory allocated since the last + garbage collection that will trigger the garbage + collector to run. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the number of bytes of memory allocated since the last + garbage collection that will trigger the garbage collector to + run. + \end{capilist} +\label{nxa_threshold_set} +\index{nxa_threshold_set@\cfunc{nxa\_threshold\_set}{}} +\citem{\cfunc[void]{nxa\_threshold\_set}{cw\_nxa\_t *a\_nxa, cw\_nxoi\_t +a\_threshold}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[a\_threshold: ] + The number of bytes of memory allocated since the last + garbage collection that will trigger the garbage + collector to run. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Set the number of bytes of memory allocated since the last + garbage collection that will trigger the garbage collector to + run. + \end{capilist} +\label{nxa_stats_get} +\index{nxa_stats_get@\cfunc{nxa\_stats\_get}{}} +\citem{\cfunc[void]{nxa\_stats\_get}{cw\_nxa\_t *a\_nxa, cw\_nxoi\_t +*r\_collections, cw\_nxoi\_t *r\_count, cw\_nxoi\_t *r\_ccount, cw\_nxoi\_t +*r\_cmark, cw\_nxoi\_t *r\_csweep, cw\_nxoi\_t *r\_mcount, cw\_nxoi\_t +*r\_mmark, cw\_nxoi\_t *r\_msweep, cw\_nxoi\_t *r\_scount, cw\_nxoi\_t +*r\_smark, cw\_nxoi\_t *r\_ssweep}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \item[r\_collections: ] + Pointer to an integer. + \item[r\_count: ] + Pointer to an integer. + \item[r\_ccount: ] + Pointer to an integer. + \item[r\_cmark: ] + Pointer to an integer. + \item[r\_csweep: ] + Pointer to an integer. + \item[r\_mcount: ] + Pointer to an integer. + \item[r\_mmark: ] + Pointer to an integer. + \item[r\_msweep: ] + Pointer to an integer. + \item[r\_scount: ] + Pointer to an integer. + \item[r\_smark: ] + Pointer to an integer. + \item[r\_ssweep: ] + Pointer to an integer. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_collections: ] + Number of times the garbage collector has run. + \item[*r\_count: ] + Current number of bytes of memory allocated. + \item[*r\_ccount: ] + Number of bytes of memory allocated as of the end of the + most recent garbage collection. + \item[*r\_cmark: ] + Number of microseconds spent in the mark phase of the + most recent garbage collection. + \item[*r\_csweep: ] + Number of microseconts spent in the sweep phase of the + most recent garbage collection. + \item[*r\_mcount: ] + Largest number of bytes of memory ever allocated at any + point in time. + \item[*r\_mmark: ] + Largest number of microseconds ever spent in the mark + phase of a garbage collection. + \item[*r\_msweep: ] + Largest number of microseconts spent in the sweep phase + of a garbage collection. + \item[*r\_scount: ] + Total number of bytes of memory ever allocated. + \item[*r\_smark: ] + Total number of microseconds spent in the mark phase of + all garbage collections. + \item[*r\_ssweep: ] + Total number of microseconts spent in the sweep phase of + all garbage collections. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return garbage collector statistics. + \end{capilist} +\label{nxa_nx_get} +\index{nxa_nx_get@\cfunc{nxa\_nx\_get}{}} +\citem{\cfunc[cw\_nx\_t *]{nxa\_nx\_get}{cw\_nxa\_t *a\_nxa}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a \classname{nx}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nx} associated with + \cvar{a\_nxa}. + \end{capilist} +\label{nxa_gcdict_get} +\index{nxa_gcdict_get@\cfunc{nxa\_gcdict\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxa\_gcdict\_get}{cw\_nxa\_t *a\_nxa}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxa: ] + Pointer to a \classname{nxa}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a dict \classname{nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the dict \classname{nxo} corresponding to + \onyxop{gcdict}{}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxn.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxn.tex new file mode 100644 index 000000000..91941a33c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxn.tex @@ -0,0 +1,66 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxn portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxn} +\label{nxn} +\index{nxn@\classname{nxn}{}} + +The \classname{nxn} class provides access to a table of string constants. The +main reason for this class's existence is that multiple C files often use +identical string constants, and this saves memory by allowing all to refer to a +single string. + +\subsubsection{API} +\begin{capi} +\label{nxn_str} +\index{nxn_str@\cfunc{nxn\_str}{}} +\citem{\cfunc[const cw\_uint8\_t *]{nxn\_str}{cw\_nxn\_t a\_nxn}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxn: ] + A number that corresponds to an entry in the string + table. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a string constant. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the string constant associated with + \cvar{a\_nxn}. + \end{capilist} +\label{nxn_len} +\index{nxn_len@\cfunc{nxn\_len}{}} +\citem{\cfunc[cw\_uint32\_t]{nxn\_len}{cw\_nxn\_t a\_nxn}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxn: ] + A number that corresponds to an entry in the string + table. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + String length of a string constant. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the string length of the string constant associated with + \cvar{a\_nxn}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo.tex new file mode 100644 index 000000000..cc033e611 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo.tex @@ -0,0 +1,272 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo} +\label{nxo} +\index{nxo@\classname{nxo}{}} + +The \classname{nxo} class is the basis for the Onyx type system. +\classname{nxo} objects can be any of the following types, as determined by the +\ctype{cw\_nxot\_t} type: +\begin{description} +\item[NXOT\_NO: ] \htmlref{\classname{nxo\_no}}{nxo_no} +\item[NXOT\_ARRAY: ] \htmlref{\classname{nxo\_array}}{nxo_array} +\item[NXOT\_BOOLEAN: ] \htmlref{\classname{nxo\_boolean}}{nxo_boolean} +\item[NXOT\_CONDITION: ] \htmlref{\classname{nxo\_condition}}{nxo_condition} +\item[NXOT\_DICT: ] \htmlref{\classname{nxo\_dict}}{nxo_dict} +\item[NXOT\_FILE: ] \htmlref{\classname{nxo\_file}}{nxo_file} +\item[NXOT\_FINO: ] \htmlref{\classname{nxo\_fino}}{nxo_fino} +\item[NXOT\_HOOK: ] \htmlref{\classname{nxo\_hook}}{nxo_hook} +\item[NXOT\_INTEGER: ] \htmlref{\classname{nxo\_integer}}{nxo_integer} +\item[NXOT\_MARK: ] \htmlref{\classname{nxo\_mark}}{nxo_mark} +\item[NXOT\_MUTEX: ] \htmlref{\classname{nxo\_mutex}}{nxo_mutex} +\item[NXOT\_NAME: ] \htmlref{\classname{nxo\_name}}{nxo_name} +\item[NXOT\_NULL: ] \htmlref{\classname{nxo\_null}}{nxo_null} +\item[NXOT\_OPERATOR: ] \htmlref{\classname{nxo\_operator}}{nxo_operator} +\item[NXOT\_PMARK: ] \htmlref{\classname{nxo\_pmark}}{nxo_pmark} +\item[NXOT\_REAL: ] \htmlref{\classname{nxo\_real}}{nxo_real} +\item[NXOT\_STACK: ] \htmlref{\classname{nxo\_stack}}{nxo_stack} +\item[NXOT\_STRING: ] \htmlref{\classname{nxo\_string}}{nxo_string} +\item[NXOT\_THREAD: ] \htmlref{\classname{nxo\_thread}}{nxo_thread} +\end{description} + +Due to limitations of the C programming language, it is the responsibility of +the application to do type checking to assure that an incompatible +\classname{nxo} object is not passed to a type-specific function. For example, +passing a file \classname{nxo} to \cfunc{nxo\_string\_get}{} is prohibited, and +will result in undefined behaviour (including crashes). + +Composite objects contain a reference to an \classname{nxoe} object. For the +most part, the application does not need to be aware of this. The only +exception is when writing extensions with the hook type. Hook objects need to +be able to iterate over the objects they reference internally, and return +\classname{nxoe} references to the garbage collector. + +The following functions are applicable to all types of \classname{nxo} objects. + +\subsubsection{API} +\begin{capi} +\label{nxo_compare} +\index{nxo_compare@\cfunc{nxo\_compare}{}} +\citem{\cfunc[cw\_sint32\_t]{nxo\_compare}{const cw\_nxo\_t *a\_a, const +cw\_nxo\_t *a\_b}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_a: ] + Pointer to an \classname{nxo}. + \item[a\_b: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[-1: ] + For types which it is meaningful (integer, + string), \cvar{a\_a} is less than \cvar{a\_b}. + \item[0: ] + \cvar{a\_a} and \cvar{a\_b} are equal. + \item[1: ] + For types which it is meaningful (integer, + string), \cvar{a\_a} is greater than + \cvar{a\_b}. + \item[2: ] + Incompatible types, or not the same composite + object. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Compare \cvar{a\_a} and \cvar{a\_b}. + \end{capilist} +\label{nxo_dup} +\index{nxo_dup@\cfunc{nxo\_dup}{}} +\citem{\cfunc[void]{nxo\_dup}{cw\_nxo\_t *a\_to, cw\_nxo\_t *a\_from}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_to: ] + Pointer to an \classname{nxo}. + \item[a\_from: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Duplicate \cvar{a\_from} to \cvar{a\_to}. This does not do a + copy of composite objects; rather it creates a new reference to + the value of a composite object. + \end{capilist} +\label{nxo_type_get} +\index{nxo_type_get@\cfunc{nxo\_type\_get}{}} +\citem{\cfunc[cw\_nxot\_t]{nxo\_type\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXOT\_NO: ] + \htmlref{\classname{nxo\_no}}{nxo_no} + \item[NXOT\_ARRAY: ] + \htmlref{\classname{nxo\_array}} + {nxo_array} + \item[NXOT\_BOOLEAN: ] + \htmlref{\classname{nxo\_boolean}} + {nxo_boolean} + \item[NXOT\_CONDITION: ] + \htmlref{\classname{nxo\_condition}} + {nxo_condition} + \item[NXOT\_DICT: ] + \htmlref{\classname{nxo\_dict}} + {nxo_dict} + \item[NXOT\_FILE: ] + \htmlref{\classname{nxo\_file}} + {nxo_file} + \item[NXOT\_FINO: ] + \htmlref{\classname{nxo\_fino}} + {nxo_fino} + \item[NXOT\_HOOK: ] + \htmlref{\classname{nxo\_hook}} + {nxo_hook} + \item[NXOT\_INTEGER: ] + \htmlref{\classname{nxo\_integer}} + {nxo_integer} + \item[NXOT\_MARK: ] + \htmlref{\classname{nxo\_mark}} + {nxo_mark} + \item[NXOT\_MUTEX: ] + \htmlref{\classname{nxo\_mutex}} + {nxo_mutex} + \item[NXOT\_NAME: ] + \htmlref{\classname{nxo\_name}} + {nxo_name} + \item[NXOT\_NULL: ] + \htmlref{\classname{nxo\_null}} + {nxo_null} + \item[NXOT\_OPERATOR: ] + \htmlref{\classname{nxo\_operator}} + {nxo_operator} + \item[NXOT\_PMARK: ] + \htmlref{\classname{nxo\_pmark}} + {nxo_pmark} + \item[NXOT\_REAL: ] + \htmlref{\classname{nxo\_real}} + {nxo_real} + \item[NXOT\_STACK: ] + \htmlref{\classname{nxo\_stack}} + {nxo_stack} + \item[NXOT\_STRING: ] + \htmlref{\classname{nxo\_string}} + {nxo_string} + \item[NXOT\_THREAD: ] + \htmlref{\classname{nxo\_thread}} + {nxo_thread} + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the type of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_nxoe_get} +\index{nxo_nxoe_get@\cfunc{nxo\_nxoe\_get}{}} +\citem{\cfunc[cw\_nxoe\_t *]{nxo\_nxoe\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the \classname{nxoe} associated with + \cvar{a\_nxo}, or NULL if \cvar{a\_nxo} is not + composite. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{nxoe} associated with + \cvar{a\_nxo}. + \end{capilist} +\label{nxo_lcheck} +\index{nxo_lcheck@\cfunc{nxo\_lcheck}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_lcheck}{}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an array, dict, file, stack, or string + \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + \cvar{a\_nxo} is not implicitly locked. + \item[TRUE: ] + \cvar{a\_nxo} is implicitly locked. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + For array, dict, file, stack, or string \classname{nxo\/}s, + return whether \cvar{a\_nxo} is implicitly locked. + \end{capilist} +\label{nxo_attr_get} +\index{nxo_attr_get@\cfunc{nxo\_attr\_get}{}} +\citem{\cfunc[cw\_nxoa\_t]{nxo\_attr\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXOA\_LITERAL: ] + \cvar{a\_nxo} is literal. + \item[NXOA\_EXECUTABLE: ] + \cvar{a\_nxo} is executable. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the attribute for \cvar{a\_nxo}. + \end{capilist} +\label{nxo_attr_set} +\index{nxo_attr_set@\cfunc{nxo\_attr\_set}{}} +\citem{\cfunc[void]{nxo\_attr\_set}{cw\_nxo\_t *a\_nxo, cw\_nxoa\_t a\_attr}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \item[a\_attr: ] + Value of attribute to set for \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set the attribute for \cvar{a\_nxo} to \cvar{a\_attr}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_array.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_array.tex new file mode 100644 index 000000000..40d2ad2f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_array.tex @@ -0,0 +1,155 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_array portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_array} +\label{nxo_array} +\index{nxo_array@\classname{nxo\_array}{}} + +The \classname{nxo\_array} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_array_new} +\index{nxo_array_new@\cfunc{nxo\_array\_new}{}} +\citem{\cfunc[void]{nxo\_array\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_bool\_t a\_locking, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an array \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_locking: ] + Implicit locking mode. + \item[a\_len: ] + Number of array elements. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_array_subarray_new} +\index{nxo_array_subarray_new@\cfunc{nxo\_array\_subarray\_new}{}} +\citem{\cfunc[void]{nxo\_array\_subarray\_new}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_array, cw\_nx\_t *a\_nx, cw\_uint32\_t a\_offset, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an array \classname{nxo}. + \item[a\_array: ] + Pointer to an array \classname{nxo} to create a subarray + of. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_offset: ] + Offset into \cvar{a\_array}. + \item[a\_len: ] + Number of array elements. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Subarray constructor. + \end{capilist} +\label{nxo_array_copy} +\index{nxo_array_copy@\cfunc{nxo\_array\_copy}{}} +\citem{\cfunc[void]{nxo\_array\_copy}{cw\_nxo\_t *a\_to, cw\_nxo\_t *a\_from}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_to: ] + Pointer to an array \classname{nxo}. + \item[a\_from: ] + Pointer to an array \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Copy the contents of \cvar{a\_from} to \cvar{a\_to}. The length + of \cvar{a\_to} must be at least that of \cvar{a\_from}. + \end{capilist} +\label{nxo_array_len_get} +\index{nxo_array_len_get@\cfunc{nxo\_array\_len\_get}{}} +\citem{\cfunc[cw\_uint32\_t]{nxo\_array\_len\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an array \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Number of elements in \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the number of elements in \cvar{a\_nxo}. + \end{capilist} +\label{nxo_array_el_get} +\index{nxo_array_el_get@\cfunc{nxo\_array\_el\_get}{}} +\citem{\cfunc[void]{nxo\_array\_el\_get}{const cw\_nxo\_t *a\_nxo, cw\_nxoi\_t +a\_offset, cw\_nxo\_t *r\_el}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an array \classname{nxo}. + \item[a\_offset: ] + Offset of element to get. + \item[r\_el: ] + Pointer to space to dup an object to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_el: ] + A dup of the element of \cvar{a\_nxo} at offset + \cvar{a\_offset}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Get a dup of the element of \cvar{a\_nxo} at offset + \cvar{a\_offset}. + \end{capilist} +\label{nxo_array_el_set} +\index{nxo_array_el_set@\cfunc{nxo\_array\_el\_set}{}} +\citem{\cfunc[void]{nxo\_array\_el\_set}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t *a\_el, +cw\_nxoi\_t a\_offset}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an array \classname{nxo}. + \item[a\_el: ] + Pointer to an \classname{nxo}. + \item[a\_offset: ] + Offset of element in \cvar{a\_nxo} to replace with + \cvar{a\_el}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Dup \cvar{a\_el} into the element of \cvar{a\_nxo} at offset + \cvar{a\_offset}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_boolean.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_boolean.tex new file mode 100644 index 000000000..1baab0e82 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_boolean.tex @@ -0,0 +1,74 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_boolean portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_boolean} +\label{nxo_boolean} +\index{nxo_boolean@\classname{nxo\_boolean}{}} + +The \classname{nxo\_boolean} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_boolean_new} +\index{nxo_boolean_new@\cfunc{nxo\_boolean\_new}{}} +\citem{\cfunc[void]{nxo\_boolean\_new}{cw\_nxo\_t *a\_nxo, cw\_bool\_t +a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a boolean \classname{nxo}. + \item[a\_val: ] + Initial value. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_boolean_get} +\index{nxo_boolean_get@\cfunc{nxo\_boolean\_get}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_boolean\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a boolean \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Value of \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the value of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_boolean_set} +\index{nxo_boolean_set@\cfunc{nxo\_boolean\_set}{}} +\citem{\cfunc[void]{nxo\_boolean\_set}{cw\_nxo\_t *a\_nxo, cw\_bool\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a boolean \classname{nxo}. + \item[a\_val: ] + Value to set \cvar{a\_nxo} to. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set the value of \cvar{a\_nxo} to \cvar{a\_val}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_condition.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_condition.tex new file mode 100644 index 000000000..c1e593084 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_condition.tex @@ -0,0 +1,114 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_condition portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_condition} +\label{nxo_condition} +\index{nxo_condition@\classname{nxo\_condition}{}} + +The \classname{nxo\_condition} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_condition_new} +\index{nxo_condition_new@\cfunc{nxo\_condition\_new}{}} +\citem{\cfunc[void]{nxo\_condition\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a condition \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_condition_signal} +\index{nxo_condition_signal@\cfunc{nxo\_condition\_signal}{}} +\citem{\cfunc[void]{nxo\_condition\_signal}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a condition \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Signal one thread waiting on \cvar{a\_nxo}, if there are any + waiters. + \end{capilist} +\label{nxo_condition_broadcast} +\index{nxo_condition_broadcast@\cfunc{nxo\_condition\_broadcast}{}} +\citem{\cfunc[void]{nxo\_condition\_broadcast}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a condition \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Signal all threads waiting on \cvar{a\_nxo}. + \end{capilist} +\label{nxo_condition_wait} +\index{nxo_condition_wait@\cfunc{nxo\_condition\_wait}{}} +\citem{\cfunc[void]{nxo\_condition\_wait}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_mutex}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a condition \classname{nxo}. + \item[a\_mutex: ] + Pointer to a mutex \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Wait for \cvar{a\_nxo}. + \end{capilist} +\label{nxo_condition_timedwait} +\index{nxo_condition_timedwait@\cfunc{nxo\_condition\_timedwait}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_condition\_timedwait}{cw\_nxo\_t *a\_nxo, +cw\_nxo\_t *a\_mutex, const struct timespec *a\_timeout}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a condition \classname{nxo}. + \item[a\_mutex: ] + Pointer to a mutex \classname{nxo}. + \item[a\_timeout: ] + Timeout, specified as an absolute time interval. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Timeout. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Wait for \cvar{a\_nxo} for at least \cvar{a\_timeout}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_dict.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_dict.tex new file mode 100644 index 000000000..43d3ebe95 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_dict.tex @@ -0,0 +1,195 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_dict portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_dict} +\label{nxo_dict} +\index{nxo_dict@\classname{nxo\_dict}{}} + +The \classname{nxo\_dict} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_dict_new} +\index{nxo_dict_new@\cfunc{nxo\_dict\_new}{}} +\citem{\cfunc[void]{nxo\_dict\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_bool\_t a\_locking, cw\_uint32\_t a\_dict\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a dict \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_locking: ] + Implicit locking mode. + \item[a\_dict\_size: ] + Initial number of slots. Dictionaries dynamically grow + and shrink as needed, but if the maximum size of + \cvar{a\_nxo} is known, it should be specified here to + save space. + \end{description} + \item[Output(s): ] None + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_dict_copy} +\index{nxo_dict_copy@\cfunc{nxo\_dict\_copy}{}} +\citem{\cfunc[]{nxo\_dict\_copy}{cw\_nxo\_t *a\_to, cw\_nxo\_t *a\_from, +cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_to: ] + Pointer to a dict \classname{nxo}. + \item[a\_from: ] + Pointer to a dict \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Do a deep copy (actual contents are copied) of \cvar{a\_from} to + \cvar{a\_to}. + \end{capilist} +\label{nxo_dict_def} +\index{nxo_dict_def@\cfunc{nxo\_dict\_def}{}} +\citem{\cfunc[void]{nxo\_dict\_def}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_nxo\_t *a\_key, cw\_nxo\_t *a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a dict \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_key: ] + Pointer to an \classname{nxo}. + \item[a\_val: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Define \cvar{a\_key} with value \cvar{a\_val} in \cvar{a\_nxo}. + \end{capilist} +\label{nxo_dict_undef} +\index{nxo_dict_undef@\cfunc{nxo\_dict\_undef}{}} +\citem{\cfunc[void]{nxo\_dict\_undef}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_nxo\_t *a\_key}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a dict \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_key: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Undefine \cvar{a\_key} in \cvar{a\_nxo}, if defined. + \end{capilist} +\label{nxo_dict_lookup} +\index{nxo_dict_lookup@\cfunc{nxo\_dict\_lookup}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_dict\_lookup}{const cw\_nxo\_t *a\_nxo, const +cw\_nxo\_t *a\_key, cw\_nxo\_t *r\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a dict \classname{nxo}. + \item[a\_key: ] + Pointer to an \classname{nxo}. + \item[r\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_key} not found. + \end{description} + \item[r\_nxo: ] + If \cvar{retval} is FALSE, value associated with + \cvar{a\_key} in \cvar{a\_nxo}, otherwise unmodified. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Find \cvar{a\_key} in \cvar{a\_nxo} and dup its associated value + to \cvar{r\_nxo}. + \end{capilist} +\label{nxo_dict_count} +\index{nxo_dict_count@\cfunc{nxo\_dict\_count}{}} +\citem{\cfunc[cw\_uint32\_t]{nxo\_dict\_count}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a dict \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + The number of key/value pairs in \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the number of key/value pairs in \cvar{a\_nxo}. + \end{capilist} +\label{nxo_dict_iterate} +\index{nxo_dict_iterate@\cfunc{nxo\_dict\_iterate}{}} +\citem{\cfunc[void]{nxo\_dict\_iterate}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t *r\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a dict \classname{nxo}. + \item[r\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_nxo} is empty. + \end{description} + \item[r\_nxo: ] + If \cvar{retval} is FALSE, A key in \cvar{a\_nxo}, + otherwise unmodified. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Iteratively get a key in \cvar{a\_nxo}. Each successive call to + this function will get the next key, and wrap back around to the + first key when all keys have been returned. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_file.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_file.tex new file mode 100644 index 000000000..5f3dc4929 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_file.tex @@ -0,0 +1,611 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_file portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_file} +\label{nxo_file} +\index{nxo_file@\classname{nxo\_file}{}} + +The \classname{nxo\_file} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{cw_nxo_file_read_t} +\index{cw_nxo_file_read_t@\cfunc{cw\_nxo\_file\_read\_t}{}} +\citem{\cfunc[cw\_sint32\_t]{cw\_nxo\_file\_read\_t}{void *a\_arg, cw\_nxo\_t +*a\_file, cw\_uint32\_t a\_len, cw\_uint8\_t *r\_str}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque data pointer. + \item[a\_file: ] + Pointer to a file \classname{nxo}. + \item[a\_len: ] + Length of \cvar{r\_str}. + \item[r\_str: ] + Pointer to space to put read data. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[-1: ] + Read error. + \item[{\gt}= 0: ] + Number of bytes stored in \cvar{r\_str}. + \end{description} + \item[r\_str: ] + If \cvar{retval} is non-negative, \cvar{retval} bytes of + read data, otherwise undefined. + \end{description} + \item[Exception(s): ] Application specific. + \item[Description: ] + Read up to \cvar{a\_len} bytes of data from \cvar{a\_file} and + store the result in \cvar{r\_str}. + \end{capilist} +\label{cw_nxo_file_write_t} +\index{cw_nxo_file_write_t@\cfunc{cw\_nxo\_file\_write\_t}{}} +\citem{\cfunc[cw\_bool\_t]{cw\_nxo\_file\_write\_t}{void *a\_arg, cw\_nxo\_t +*a\_file, const cw\_uint8\_t *a\_str, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque data pointer. + \item[a\_file: ] + Pointer to a file \classname{nxo}. + \item[a\_str: ] + Pointer to data to write. + \item[a\_len: ] + Length of \cvar{a\_str}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Write error. + \end{description} + \end{description} + \item[Exception(s): ] Application specific. + \item[Description: ] + Write \cvar{a\_len} bytes of data from \cvar{a\_str} to + \cvar{a\_file}. + \end{capilist} +\label{cw_nxo_file_ref_iter_t} +\index{cw_nxo_file_ref_iter_t@\cfunc{cw\_nxo\_file\_ref\_iter\_t}{}} +\citem{\cfunc[cw\_nxoe\_t *]{cw\_nxo\_file\_ref\_iter\_t}{void *a\_arg, +cw\_bool\_t a\_reset}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque data pointer. + \item[a\_reset: ] + \begin{description}\item[] + \item[FALSE: ] + At least one iteration has already occurred. + \item[TRUE: ] + First iteration. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to an \classname{nxoe}. + \item[NULL: ] + No more references. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Reference iterator function typedef. + \end{capilist} +\label{cw_nxo_file_delete_t} +\index{cw_nxo_file_delete_t@\cfunc{cw\_nxo\_file\_delete\_t}{}} +\citem{\cfunc[void]{cw\_nxo\_file\_delete\_t}{void *a\_arg, cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_arg: ] + Opaque data pointer. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor function typedef. + \end{capilist} +\label{nxo_file_new} +\index{nxo_file_new@\cfunc{nxo\_file\_new}{}} +\citem{\cfunc[void]{nxo\_file\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_bool\_t a\_locking}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_locking: ] + Implicit locking mode. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_file_fd_wrap} +\index{nxo_file_fd_wrap@\cfunc{nxo\_file\_fd\_wrap}{}} +\citem{\cfunc[void]{nxo\_file\_fd\_wrap}{cw\_nxo\_t *a\_nxo, cw\_uint32\_t +a\_fd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_fd: ] + File descriptor number. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Wrap file descriptor \cvar{a\_fd} so that operations on + \cvar{a\_nxo} will be backed by the file descriptor. + \end{capilist} +\label{nxo_file_synthetic} +\index{nxo_file_synthetic@\cfunc{nxo\_file\_synthetic}{}} +\citem{\cfunc[void]{nxo\_file\_synthetic}{cw\_nxo\_t *a\_nxo, +cw\_nxo\_file\_read\_t *a\_read, cw\_nxo\_file\_write\_t *a\_write, +cw\_nxo\_file\_ref\_iter\_t *a\_ref\_iter, cw\_nxo\_file\_delet\_t *a\_delete, +void *a\_arg}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_read: ] + Pointer to a read function. + \item[a\_write: ] + Pointer to a write function. + \item[a\_ref\_iter: ] + Pointer to a reference iterator function. + \item[a\_delete: ] + Pointer to a destructor function. + \item[a\_arg: ] + Opaque pointer to be passed to the read and write + functions. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set up \cvar{a\_nxo} to call the specified read and write + functions to satisfy file operations. + \end{capilist} +\label{nxo_file_open} +\index{nxo_file_open@\cfunc{nxo\_file\_open}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_open}{cw\_nxo\_t *a\_nxo, const +cw\_uint8\_t *a\_filename, cw\_uint32\_t a\_nlen, const cw\_uint8\_t *a\_flags, +cw\_uint32\_t a\_flen}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_filename: ] + Pointer to a string (not required to be '{\bs}0' + terminated) that represents a filename. + \item[a\_nlen: ] + Length in bytes of \cvar{a\_filename}. + \item[a\_flags: ] + Pointer to a string (not required to be '{\bs}0' + terminated) that represents a file mode: + \begin{description}\item[] + \item[``r'': ] + Read only. + \item[``r+'': ] + Read/write, starting at offset 0. + \item[``w'': ] + Write only. Create file if necessary. Truncate + file if non-zero length. + \item[``w+'': ] + Read/write, starting at offset 0. Create + file if necessary. + \item[``a'': ] + Write only, starting at end of file. + \item[``a+'': ] + Read/write, starting at end of file. + \end{description} + \item[a\_flen: ] + Length in bytes of \cvar{a\_flags}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \item[NXN\_\htmlref{invalidfileaccess} + {invalidfileaccess}.] + \item[NXN\_\htmlref{limitcheck}{limitcheck}.] + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Open a file. + \end{capilist} +\label{nxo_file_close} +\index{nxo_file_close@\cfunc{nxo\_file\_close}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_close}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Close a file. + \end{capilist} +\label{nxo_file_fd_get} +\index{nxo_file_fd_get@\cfunc{nxo\_file\_fd\_get}{}} +\citem{\cfunc[cw\_sint32\_t]{nxo\_file\_fd\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[-1: ] + Invalid or synthetic file. + \item[{\gt}= 0: ] + File descriptor number. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the file descriptor associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_file_nonblocking_get} +\index{nxo_file_nonblocking_get@\cfunc{nxo\_file\_nonblocking\_get}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_file\_nonblocking\_get}{const cw\_nxo\_t +*a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Blocking file. + \item[TRUE: ] + Non-blocking file. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the non-blocking mode for \cvar{a\_nxo}. + \end{capilist} +\label{nxo_file_nonblocking_set} +\index{nxo_file_nonblocking_set@\cfunc{nxo\_file\_nonblocking\_set}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_file\_nonblocking\_set}{cw\_nxo\_t *a\_nxo, +cw\_bool\_t a\_nonblocking}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_nonblocking: ] + Non-blocking mode to set \classname{nxo} to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + I/O error or non-POSIX file. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Set the non-blocking mode for \cvar{a\_nxo} to + \cvar{a\_nonblocking}. + \end{capilist} +\label{nxo_file_read} +\index{nxo_file_read@\cfunc{nxo\_file\_read}{}} +\citem{\cfunc[cw\_sint32\_t]{nxo\_file\_read}{cw\_nxo\_t *a\_nxo, cw\_uint32\_t +a\_len, cw\_uint8\_t *r\_str}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_len: ] + Length in bytes of \cvar{r\_str}. + \item[r\_str: ] + Pointer to a string to store read data into. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[-1: ] + NXN\_\htmlref{ioerror}{ioerror}. + \item[{\gt}= 0: ] + Number of bytes of data read into \cvar{r\_str}. + \end{description}\item[] + \item[r\_str: ] + If \cvar{retval} is non-negative, \cvar{retval} bytes of + read data. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Read data. + \end{capilist} +\label{nxo_file_readline} +\index{nxo_file_readline@\cfunc{nxo\_file\_readline}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_readline}{cw\_nxo\_t *a\_nxo, cw\_nx\_t +*a\_nx, cw\_bool\_t a\_locking, cw\_nxo\_t *r\_string, cw\_bool\_t *r\_eof}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_locking: ] + Implicit locking mode. + \item[r\_string: ] + Pointer to an \classname{nxo}. + \item[r\_eof: ] + Pointer to a \ctype{cw\_bool\_t}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \end{description} + \item[r\_string: ] + If \cvar{retval} is NXN\_ZERO, a string object, + otherwise unmodified. + \item[*r\_eof: ] + \begin{description}\item[] + \item[FALSE: ] + End of file not reached. + \item[TRUE: ] + End of file reached. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Read a line, terminated by ``{\bs}r'', ``{\bs}r{\bs}n'', or EOF. + \end{capilist} +\label{nxo_file_write} +\index{nxo_file_write@\cfunc{nxo\_file\_write}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_write}{cw\_nxo\_t *a\_nxo, const +cw\_uint8\_t *a\_str, cw\_uint32\_t a\_len, cw\_uint32\_t *r\_count}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_str: ] + Pointer to data to write. + \item[a\_len: ] + Length of \cvar{a\_str}. + \item[r\_count: ] + Pointer to a location to store the number of bytes + written, or NULL. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \end{description} + \item[*r\_count: ] + If \cvar{r\_count} is non-NULL, and retval is NXN\_ZERO, + number of bytes written, otherwise undefined. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Write the \cvar{a\_len} bytes of data pointed to \cvar{a\_str}. + If the file is in non-blocking mode, it is possible for + \cvar{*r\_count} to be as small as 0 for a successful write. + \end{capilist} +\label{nxo_file_truncate} +\index{nxo_file_truncate@\cfunc{nxo\_file\_truncate}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_truncate}{cw\_nxo\_t *a\_nxo, off\_t +a\_length}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_length: ] + Length to set file to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Truncate or extend the file associated with \cvar{a\_nxo} so + that it is \cvar{a\_length} bytes long. + \end{capilist} +\label{nxo_file_position_get} +\index{nxo_file_position_get@\cfunc{nxo\_file\_position\_get}{}} +\citem{\cfunc[cw\_nxoi\_t]{nxo\_file\_position\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[-1: ] + NXN\_\htmlref{ioerror}{ioerror}. + \item[{\gt}= 0: ] + Current file position. + \end{description}\item[] + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Get the current file position. + \end{capilist} +\label{nxo_file_position_set} +\index{nxo_file_position_set@\cfunc{nxo\_file\_position\_set}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_position\_set}{cw\_nxo\_t *a\_nxo, +cw\_nxoi\_t a\_position}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_position: ] + File position. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Move the current file position to \cvar{a\_position}. + \end{capilist} +\label{nxo_file_buffer_size_get} +\index{nxo_file_buffer_size_get@\cfunc{nxo\_file\_buffer\_size\_get}{}} +\citem{\cfunc[cw\_uint32\_t]{nxo\_file\_buffer\_size\_get}{const cw\_nxo\_t +*a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Size in bytes of the internal data buffer. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the size of the internal data buffer. + \end{capilist} +\label{nxo_file_buffer_size_set} +\index{nxo_file_buffer_size_set@\cfunc{nxo\_file\_buffer\_size\_set}{}} +\citem{\cfunc[void]{nxo\_file\_buffer\_size\_set}{cw\_nxo\_t *a\_nxo, +cw\_uint32\_t a\_size}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \item[a\_size: ] + Size in bytes of internal buffer to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Use an internal buffer of \cvar{a\_size} bytes. + \end{capilist} +\label{nxo_file_buffer_count} +\index{nxo_file_buffer_count@\cfunc{nxo\_file\_buffer\_count}{}} +\citem{\cfunc[cw\_nxoi\_t]{nxo\_file\_buffer\_count}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Current number of buffered bytes available for reading. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the current number of buffered bytes available for + reading. + \end{capilist} +\label{nxo_file_buffer_flush} +\index{nxo_file_buffer_flush@\cfunc{nxo\_file\_buffer\_flush}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_file\_buffer\_flush}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO.] + \item[NXN\_\htmlref{ioerror}{ioerror}.] + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Flush any buffered write data to disk, and discard any buffered + read data. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_fino.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_fino.tex new file mode 100644 index 000000000..9d5a3c18e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_fino.tex @@ -0,0 +1,37 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_fino portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_fino} +\label{nxo_fino} +\index{nxo_fino@\classname{nxo\_fino}{}} + +The \classname{nxo\_fino} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_fino_new} +\index{nxo_fino_new@\cfunc{nxo\_fino\_new}{}} +\citem{\cfunc[void]{nxo\_fino\_new}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_hook.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_hook.tex new file mode 100644 index 000000000..e222393f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_hook.tex @@ -0,0 +1,201 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_hook portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_hook} +\label{nxo_hook} +\index{nxo_hook@\classname{nxo\_hook}{}} + +The \classname{nxo\_hook} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{cw_nxo_hook_eval_t} +\index{cw_nxo_hook_eval_t@\cfunc{cw\_nxo\_hook\_eval\_t}{}} +\citem{\cfunc[void]{cw\_nxo\_hook\_eval\_t}{void *a\_data, +cw\_nxo\_t *a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_data: ] + Opaque data pointer. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Hook-dependent. + \item[Description: ] + Evaluation function typedef. + \end{capilist} +\label{cw_nxo_hook_ref_iter_t} +\index{cw_nxo_hook_ref_iter_t@\cfunc{cw\_nxo\_hook\_ref\_iter\_t}{}} +\citem{\cfunc[cw\_nxoe\_t *]{cw\_nxo\_hook\_ref\_iter\_t}{void *a\_data, +cw\_bool\_t a\_reset}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_data: ] + Opaque data pointer. + \item[a\_reset: ] + \begin{description}\item[] + \item[FALSE: ] + At least one iteration has already occurred. + \item[TRUE: ] + First iteration. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to an \classname{nxoe}. + \item[NULL: ] + No more references. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Reference iterator function typedef. + \end{capilist} +\label{cw_nxo_hook_delete_t} +\index{cw_nxo_hook_delete_t@\cfunc{cw\_nxo\_hook\_delete\_t}{}} +\citem{\cfunc[cw\_bool\_t]{cw\_nxo\_hook\_delete\_t}{void *a\_data, cw\_nx\_t +*a\_nx, cw\_uint32\_t a\_iter}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_data: ] + Opaque data pointer. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_iter: ] + Garbage collector sweep iteration count (starts at 0). + This value can be used to impose ordering of dependent + object deletions. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] Success. + \item[TRUE: ] Defer deletion until a later garbage + collector sweep iteration. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Destructor function typedef. + \end{capilist} +\label{nxo_hook_new} +\index{nxo_hook_new@\cfunc{nxo\_hook\_new}{}} +\citem{\cfunc[void]{nxo\_hook\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, void +*a\_data, cw\_nxo\_hook\_eval\_t *a\_eval\_f, cw\_nxo\_hook\_ref\_iter\_t +*a\_ref\_iter\_f, cw\_nxo\_hook\_delete\_t *a\_delete\_f}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a hook \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_data: ] + Opaque data pointer to be passed to \cvar{a\_eval\_f}, + \cvar{a\_ref\_iter\_f}, and \cvar{a\_delete\_f}. + \item[a\_eval\_f: ] + Pointer to an evaluation function. + \item[a\_ref\_iter\_f: ] + Pointer to a reference iterator function. + \item[a\_delete\_f: ] + Pointer to a destructor function. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_hook_tag_get} +\index{nxo_hook_tag_get@\cfunc{nxo\_hook\_tag\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_hook\_tag\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a hook \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the tag object associated with \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the tag object associated with + \cvar{a\_nxo}. This object pointer can safely be used for + modifying the tag object. + \end{capilist} +\label{nxo_hook_data_get} +\index{nxo_hook_data_get@\cfunc{nxo\_hook\_data\_get}{}} +\citem{\cfunc[void *]{nxo\_hook\_data\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a hook \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Opaque data pointer. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the opaque data pointer associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_hook_data_set} +\index{nxo_hook_data_set@\cfunc{nxo\_hook\_data\_set}{}} +\citem{\cfunc[void]{nxo\_hook\_data\_set}{cw\_nxo\_t *a\_nxo, void *a\_data}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a hook \classname{nxo}. + \item[a\_data: ] + Opaque data pointer. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set the opaque data pointer associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_hook_eval} +\index{nxo_hook_eval@\cfunc{nxo\_hook\_eval}{}} +\citem{\cfunc[void]{nxo\_hook\_eval}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t *a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a hook \classname{nxo}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Hook-specific. + \item[Description: ] + Evaluate the \cvar{a\_nxo}. If there is no evaluation function + associated with \cvar{a\_nxo}, it is pushed onto ostack. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_integer.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_integer.tex new file mode 100644 index 000000000..5c43af818 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_integer.tex @@ -0,0 +1,73 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_integer portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_integer} +\label{nxo_integer} +\index{nxo_integer@\classname{nxo\_integer}{}} + +The \classname{nxo\_integer} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_integer_new} +\index{nxo_integer_new@\cfunc{nxo\_integer\_new}{}} +\citem{\cfunc[void]{nxo\_integer\_new}{cw\_nxo\_t *a\_nxo, cw\_nxoi\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an integer \classname{nxo}. + \item[a\_val: ] + Initial value. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_integer_get} +\index{nxo_integer_get@\cfunc{nxo\_integer\_get}{}} +\citem{\cfunc[cw\_nxoi\_t]{nxo\_integer\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an integer \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Value of \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the value of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_integer_set} +\index{nxo_integer_set@\cfunc{nxo\_integer\_set}{}} +\citem{\cfunc[void]{nxo\_integer\_set}{cw\_nxo\_t *a\_nxo, cw\_nxoi\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an integer \classname{nxo}. + \item[a\_val: ] + Integer value. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set the value of \cvar{a\_nxo} to \cvar{a\_val}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_mark.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_mark.tex new file mode 100644 index 000000000..42224c8b6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_mark.tex @@ -0,0 +1,37 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_mark portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_mark} +\label{nxo_mark} +\index{nxo_mark@\classname{nxo\_mark}{}} + +The \classname{nxo\_mark} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_mark_new} +\index{nxo_mark_new@\cfunc{nxo\_mark\_new}{}} +\citem{\cfunc[void]{nxo\_mark\_new}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_mutex.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_mutex.tex new file mode 100644 index 000000000..e324cc98d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_mutex.tex @@ -0,0 +1,94 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_mutex portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_mutex} +\label{nxo_mutex} +\index{nxo_mutex@\classname{nxo\_mutex}{}} + +The \classname{nxo\_mutex} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_mutex_new} +\index{nxo_mutex_new@\cfunc{nxo\_mutex\_new}{}} +\citem{\cfunc[void]{nxo\_mutex\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a mutex \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_mutex_lock} +\index{nxo_mutex_lock@\cfunc{nxo\_mutex\_lock}{}} +\citem{\cfunc[void]{nxo\_mutex\_lock}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a mutex \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Lock \cvar{a\_nxo}. + \end{capilist} +\label{nxo_mutex_trylock} +\index{nxo_mutex_trylock@\cfunc{nxo\_mutex\_trylock}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_mutex\_trylock}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a mutex \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Failure. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Try to lock \cvar{a\_nxo}, but return immediately with an error + if unable to do so. + \end{capilist} +\label{nxo_mutex_unlock} +\index{nxo_mutex_unlock@\cfunc{nxo\_mutex\_unlock}{}} +\citem{\cfunc[void]{nxo\_mutex\_unlock}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a mutex \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Unlock \cvar{a\_nxo}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_name.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_name.tex new file mode 100644 index 000000000..ae0798548 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_name.tex @@ -0,0 +1,96 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_name portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_name} +\label{nxo_name} +\index{nxo_name@\classname{nxo\_name}{}} + +The \classname{nxo\_name} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_name_new} +\index{nxo_name_new@\cfunc{nxo\_name\_new}{}} +\citem{\cfunc[void]{nxo\_name\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, const +cw\_uint8\_t *a\_str, cw\_uint32\_t a\_len, cw\_bool\_t a\_is\_static}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a name \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_str: ] + Pointer to a character string (not required to be + '{\bs}0' terminated). + \item[a\_len: ] + Length in bytes of \cvar{a\_str}. + \item[a\_is\_static: ] + \begin{description}\item[] + \item[FALSE: ] + \cvar{a\_str} may be modified or deallocated + during the lifetime of the program. + \item[TRUE: ] + \cvar{a\_str} will not be modified for the + lifetime of the program. + \end{description} + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_name_str_get} +\index{nxo_name_str_get@\cfunc{nxo\_name\_str\_get}{}} +\citem{\cfunc[const cw\_uint8\_t *]{nxo\_name\_str\_get}{const cw\_nxo\_t +*a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a name \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a string that represents \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to a string that represents \cvar{a\_nxo}. + \end{capilist} +\label{nxo_name_len_get} +\index{nxo_name_len_get@\cfunc{nxo\_name\_len\_get}{}} +\citem{\cfunc[cw\_uint32\_t]{nxo\_name\_len\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a name \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Length in bytes of the name associated with + \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the length in bytes of the name associated with + \cvar{a\_nxo}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_no.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_no.tex new file mode 100644 index 000000000..8a8847366 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_no.tex @@ -0,0 +1,37 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_no portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_no} +\label{nxo_no} +\index{nxo_no@\classname{nxo\_no}{}} + +The \classname{nxo\_no} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_no_new} +\index{nxo_no_new@\cfunc{nxo\_no\_new}{}} +\citem{\cfunc[void]{nxo\_no\_new}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_null.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_null.tex new file mode 100644 index 000000000..757ef620e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_null.tex @@ -0,0 +1,37 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_null portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_null} +\label{nxo_null} +\index{nxo_null@\classname{nxo\_null}{}} + +The \classname{nxo\_null} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_null_new} +\index{nxo_null_new@\cfunc{nxo\_null\_new}{}} +\citem{\cfunc[void]{nxo\_null\_new}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_operator.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_operator.tex new file mode 100644 index 000000000..bf027207b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_operator.tex @@ -0,0 +1,60 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_operator portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_operator} +\label{nxo_operator} +\index{nxo_operator@\classname{nxo\_operator}{}} + +The \classname{nxo\_operator} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_operator_new} +\index{nxo_operator_new@\cfunc{nxo\_operator\_new}{}} +\citem{\cfunc[void]{nxo\_operator\_new}{cw\_nxo\_t *a\_nxo, cw\_op\_t *a\_op, +cw\_nxn\_t a\_nxn}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an operator \classname{nxo}. + \item[a\_op: ] + Pointer to an operator function. + \item[a\_nxn: ] + NXN\_ZERO, or an \classname{nxn}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_operator_f} +\index{nxo_operator_f@\cfunc{nxo\_operator\_f}{}} +\citem{\cfunc[cw\_op\_t *]{nxo\_operator\_f}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an operator \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an operator function. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the operator function associated with \cvar{a\_nxo}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_pmark.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_pmark.tex new file mode 100644 index 000000000..36331a4ce --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_pmark.tex @@ -0,0 +1,37 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_pmark portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_pmark} +\label{nxo_pmark} +\index{nxo_pmark@\classname{nxo\_pmark}{}} + +The \classname{nxo\_pmark} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_pmark_new} +\index{nxo_pmark_new@\cfunc{nxo\_pmark\_new}{}} +\citem{\cfunc[void]{nxo\_pmark\_new}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_real.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_real.tex new file mode 100644 index 000000000..b4efd868c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_real.tex @@ -0,0 +1,73 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_real portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_real} +\label{nxo_real} +\index{nxo_real@\classname{nxo\_real}{}} + +The \classname{nxo\_real} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_real_new} +\index{nxo_real_new@\cfunc{nxo\_real\_new}{}} +\citem{\cfunc[void]{nxo\_real\_new}{cw\_nxo\_t *a\_nxo, cw\_nxor\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a real \classname{nxo}. + \item[a\_val: ] + Initial value. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_real_get} +\index{nxo_real_get@\cfunc{nxo\_real\_get}{}} +\citem{\cfunc[cw\_nxor\_t]{nxo\_real\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a real \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Value of \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the value of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_real_set} +\index{nxo_real_set@\cfunc{nxo\_real\_set}{}} +\citem{\cfunc[void]{nxo\_real\_set}{cw\_nxo\_t *a\_nxo, cw\_nxor\_t a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a real \classname{nxo}. + \item[a\_val: ] + Real value. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set the value of \cvar{a\_nxo} to \cvar{a\_val}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_regex.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_regex.tex new file mode 100644 index 000000000..62774e040 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_regex.tex @@ -0,0 +1,334 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_regex portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_regex} +\label{nxo_regex} +\index{nxo_regex@\classname{nxo\_regex}{}} + +The \classname{nxo\_regex} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_regex_new} +\index{nxo_regex_new@\cfunc{nxo\_regex\_new}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_regex\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +const cw\_uint8\_t *a\_pattern, cw\_uint32\_t a\_len, cw\_bool\_t a\_cont, +cw\_bool\_t a\_global, cw\_bool\_t a\_insensitive, cw\_bool\_t a\_multiline, +cw\_bool\_t a\_singleline}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a regex \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_pattern: ] + Pointer to a string that specifies a regular expression. + \item[a\_len: ] + Length of \cvar{a\_pattern}. + \item[a\_cont: ] + Continue where last successful match ended if TRUE. + \item[a\_global: ] + Continue where last match ended if TRUE. + \item[a\_insensitive: ] + Match with case insensitivity if TRUE. + \item[a\_multiline: ] + Treat input as a multi-line string if TRUE. + \item[a\_singleline: ] + Treat input as a single line, so that the dot + metacharacter matches any character, including a + newline. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO: ] Success. + \item[NXN\_regexerror: ] Regular expression error. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_regex_match} +\index{nxo_regex_match@\cfunc{nxo\_regex\_match}{}} +\citem{\cfunc[void]{nxo\_regex\_match}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_thread, cw\_nxo\_t *a\_input, cw\_bool\_t *r\_match}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a regex \classname{nxo}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_input: ] + Pointer to a string \classname{nxo}. + \item[r\_match: ] + Pointer to a \ctype{cw\_bool\_t}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_match: ] + \begin{description}\item[] + \item[TRUE: ] Match successful. + \item[FALSE: ] No match found. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Look in \cvar{a\_input} for a match to the regex pointed to by + \cvar{a\_nxo}. As a side effect, set the thread's match cache, + which can be queried via \cfunc{nxo\_regex\_submatch}{}. + \end{capilist} +\label{nxo_regex_nonew_match} +\index{nxo_regex_nonew_match@\cfunc{nxo\_regex\_nonew\_match}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_regex\_nonew\_match}{cw\_nxo\_t *a\_thread, const +cw\_uint8\_t *a\_pattern, cw\_uint32\_t a\_len, cw\_bool\_t a\_cont, cw\_bool\_t +a\_global, cw\_bool\_t a\_insensitive, cw\_bool\_t a\_multiline, cw\_bool\_t +a\_singleline, cw\_nxo\_t *a\_input, cw\_bool\_t *r\_match}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_pattern: ] + Pointer to a string that specifies a regular expression. + \item[a\_len: ] + Length of \cvar{a\_pattern}. + \item[a\_cont: ] + Continue where last successful match ended if TRUE. + \item[a\_global: ] + Continue where last match ended if TRUE. + \item[a\_insensitive: ] + Match with case insensitivity if TRUE. + \item[a\_multiline: ] + Treat input as a multi-line string if TRUE. + \item[a\_singleline: ] + Treat input as a single line, so that the dot + metacharacter matches any character, including a + newline. + \item[a\_input: ] + Pointer to a string \classname{nxo}. + \item[r\_match: ] + Pointer to a \ctype{cw\_bool\_t}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO: ] Success. + \item[NXN\_regexerror: ] Regular expression error. + \end{description} + \item[*r\_match: ] + \begin{description}\item[] + \item[TRUE: ] Match successful. + \item[FALSE: ] No match found. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Look in \cvar{a\_input} for a match to the regular expression + specified by \cvar{a\_pattern}, \cvar{a\_len}, \cvar{a\_cont}, + \cvar{a\_global}, \cvar{a\_insensitive}, \cvar{a\_multiline}, + and \cvar{a\_singleline}. As a side effect, set the thread's + match cache, which can be queried via + \cfunc{nxo\_regex\_submatch}{}. + + This function combines \cfunc{nxo\_regex\_new}{} and + \cfunc{nxo\_regex\_match}{} in such a way that no Onyx regex + object is created, thus providing a more efficient way of doing + a one-off match. + \end{capilist} +\label{nxo_regex_split} +\index{nxo_regex_split@\cfunc{nxo\_regex\_split}{}} +\citem{\cfunc[void]{nxo\_regex\_split}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_thread, cw\_uint32\_t a\_limit, cw\_nxo\_t *a\_input, cw\_nxo\_t *r\_array}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a regex \classname{nxo}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_limit: ] + Maximum number of substrings to split \cvar{a\_input} + into. 0 is treated as infinity. + \item[a\_input: ] + Pointer to a string \classname{nxo}. + \item[r\_array: ] + Pointer to an \classname{nxo} to dup an array of + substrings to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_array: ] An array of substrings. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Use the regex pointed to by \cvar{a\_nxo} to find matches in + \cvar{a\_input} and create an array of substrings that contain + the data between those matches. + + If there are capturing subpatterns in the regular expression, + also create substrings for those capturing subpatterns and + insert them into the substring array. + + As a special case, if the regular expression matches the empty + string, split a single character. This avoids an infinite + loop. + + As a side effect, set the thread's match cache, which can be + queried via \cfunc{nxo\_regex\_submatch}{}. Keep in mind that + this function can match multiple times in a single invocation, + so only the last match is available in this way. + \end{capilist} +\label{nxo_regex_nonew_split} +\index{nxo_regex_nonew_split@\cfunc{nxo\_regex\_nonew\_split}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_regex\_nonew\_split}{cw\_nxo\_t *a\_thread, const +cw\_uint8\_t *a\_pattern, cw\_uint32\_t a\_len, cw\_bool\_t a\_insensitive, +cw\_bool\_t a\_multiline, cw\_bool\_t a\_singleline, cw\_uint32\_t a\_limit, +cw\_nxo\_t *a\_input, cw\_nxo\_t *r\_array}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_pattern: ] + Pointer to a string that specifies a regular expression. + \item[a\_len: ] + Length of \cvar{a\_pattern}. + \item[a\_insensitive: ] + Match with case insensitivity if TRUE. + \item[a\_multiline: ] + Treat input as a multi-line string if TRUE. + \item[a\_singleline: ] + Treat input as a single line, so that the dot + metacharacter matches any character, including a + newline. + \item[a\_limit: ] + Maximum number of substrings to split \cvar{a\_input} + into. 0 is treated as infinity. + \item[a\_input: ] + Pointer to a string \classname{nxo}. + \item[r\_array: ] + Pointer to an \classname{nxo} to dup an array of + substrings to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO: ] Success. + \item[NXN\_regexerror: ] Regular expression error. + \end{description} + \item[*r\_array: ] An array of substrings. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Use the regex specified by \cvar{a\_pattern}, \cvar{a\_len}, + \cvar{a\_insensitive}, \cvar{a\_multiline}, and + \cvar{a\_singleline} to find matches in \cvar{a\_input} and + create an array of substrings that contain the data between + those matches. + + If there are capturing subpatterns in the regular expression, + also create substrings for those capturing subpatterns and + insert them into the substring array. + + As a special case, if the regular expression matches the empty + string, split a single character. This avoids an infinite + loop. + + As a side effect, set the thread's match cache, which can be + queried via \cfunc{nxo\_regex\_submatch}{}. Keep in mind that + this function can match multiple times in a single invocation, + so only the last match is available in this way. + + This function combines \cfunc{nxo\_regex\_nex}{} and + \cfunc{nxo\_regex\_split}{} in such a way that no Onyx regex + object is created, thus providing a more efficient way of doing + a one-off split. + \end{capilist} +\label{nxo_regex_submatch} +\index{nxo_regex_submatch@\cfunc{nxo\_regex\_submatch}{}} +\citem{\cfunc[void]{nxo\_regex\_submatch}{cw\_nxo\_t *a\_thread, cw\_uint32\_t +a\_capture, cw\_nxo\_t *r\_match}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_capture: ] + Index of captured subpattern to create a substring for: + \begin{description}\item[] + \item[0: ] + Get substring of input text that matched the + regular expression. + \item[{\gt}0: ] + Get substring of input text that matched the + specified capturing subpattern. + \end{description} + \item[r\_match: ] + Pointer to an \classname{nxo} to dup a substring + reference to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_match: ] + An \classname{nxo}: + \begin{description}\item[] + \item[null: ] Subpattern not matched. + \item[string: ] + A substring of text that corresponds to + the captured subpattern specified by + \cvar{a\_capture}. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Create a substring using the calling thread's match cache that + corresponds to capturing subpattern \cvar{a\_capture}. + + Each thread has a match cache that is used by various + \classname{regex} and \classname{regsub} functions. That cache + stores a reference to the string that was most recently matched + against, as well as offsets and lengths of the match and + capturing subpatterns. Since creating substrings puts pressure + on the garbage collector, substring creation is done lazily + (i.e. when this function is called). Normally, a program has + little need to ask for the same substring twice, so the created + substrings are not cached. That means that if this function is + called twice in succession with the same arguments, two + different (but equivalent) substrings will be returned. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_regsub.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_regsub.tex new file mode 100644 index 000000000..10328c051 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_regsub.tex @@ -0,0 +1,185 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_regsub portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_regsub} +\label{nxo_regsub} +\index{nxo_regsub@\classname{nxo\_regsub}{}} + +The \classname{nxo\_regsub} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_regsub_new} +\index{nxo_regsub_new@\cfunc{nxo\_regsub\_new}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_regsub\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t +*a\_nx, const cw\_uint8\_t *a\_pattern, cw\_uint32\_t a\_plen, cw\_bool\_t +a\_global, cw\_bool\_t a\_insensitive, cw\_bool\_t a\_multiline, cw\_bool\_t +a\_singleline, const cw\_uint8\_t *a\_template, cw\_uint32\_t a\_tlen}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a regsub \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_pattern: ] + Pointer to a string that specifies a regular expression. + \item[a\_plen: ] + Length of \cvar{a\_pattern}. + \item[a\_global: ] + Substitute as many times as possible if TRUE. + \item[a\_insensitive: ] + Match with case insensitivity if TRUE. + \item[a\_multiline: ] + Treat input as a multi-line string if TRUE. + \item[a\_singleline: ] + Treat input as a single line, so that the dot + metacharacter matches any character, including a + newline. + \item[a\_template: ] + Pointer to a string that specifies a substitution + template. + \item[a\_tlen: ] + Length of \cvar{a\_template}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO: ] Success. + \item[NXN\_regexerror: ] Regular expression error. + \end{description} + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_regsub_subst} +\index{nxo_regsub_subst@\cfunc{nxo\_regsub\_subst}{}} +\citem{\cfunc[void]{nxo\_regsub\_subst}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_thread, cw\_nxo\_t *a\_input, cw\_nxo\_t *r\_output, cw\_uint32\_t +*r\_count}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a regsub \classname{nxo}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_input: ] + Pointer to a string \classname{nxo}. + \item[r\_output: ] + Pointer to an \classname{nxo} to dup a string reference + to. + \item[r\_count: ] + Pointer to a \ctype{cw\_uint32\_t}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_output: ] + A string that was created by substituting regular + expression matches according to a substitution template. + \item[*r\_count: ] + Number of substitutions made. If 0 substitutions were + made, \cvar{*r\_output} is a duplicate of + \cvar{a\_input}, rather than a copy. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Create a string by substituting according to \cvar{a\_template} + for each substring within \oparg{input} that matches a regular + expression. + + As a side effect, set the thread's match cache, which can be + queried via \cfunc{nxo\_regex\_submatch}{}. + \end{capilist} +\label{nxo_regsub_nonew_subst} +\index{nxo_regsub_nonew_subst@\cfunc{nxo\_regsub\_nonew\_subst}{}} +\citem{\cfunc[cw\_nxn\_t]{nxo\_regsub\_nonew\_subst}{cw\_nxo\_t *a\_thread, +const cw\_uint8\_t *a\_pattern, cw\_uint32\_t a\_plen, cw\_bool\_t a\_global, +cw\_bool\_t a\_insensitive, cw\_bool\_t a\_multiline, cw\_bool\_t a\_singleline, +const cw\_uint8\_t *a\_template, cw\_uint32\_t a\_tlen, cw\_nxo\_t *a\_input, +cw\_nxo\_t *r\_output, cw\_uint32\_t *r\_count}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \item[a\_pattern: ] + Pointer to a string that specifies a regular expression. + \item[a\_plen: ] + Length of \cvar{a\_pattern}. + \item[a\_global: ] + Substitute as many times as possible if TRUE. + \item[a\_insensitive: ] + Match with case insensitivity if TRUE. + \item[a\_multiline: ] + Treat input as a multi-line string if TRUE. + \item[a\_singleline: ] + Treat input as a single line, so that the dot + metacharacter matches any character, including a + newline. + \item[a\_template: ] + Pointer to a string that specifies a substitution + template. + \item[a\_tlen: ] + Length of \cvar{a\_template}. + \item[a\_input: ] + Pointer to a string \classname{nxo}. + \item[r\_output: ] + Pointer to an \classname{nxo} to dup a string reference + to. + \item[r\_count: ] + Pointer to a \ctype{cw\_uint32\_t}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[NXN\_ZERO: ] Success. + \item[NXN\_regexerror: ] Regular expression error. + \end{description} + \item[*r\_output: ] + A string that was created by substituting regular + expression matches (specified by \cvar{a\_pattern}) + according to \cvar{a\_template}. + \item[*r\_count: ] + Number of substitutions made. If 0 substitutions were + made, \cvar{*r\_output} is a duplicate of + \cvar{a\_input}, rather than a copy. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Create a string by substituting according to \cvar{a\_template} + for each substring within \oparg{input} that matches a regular + expression. + + As a side effect, set the thread's match cache, which can be + queried via \cfunc{nxo\_regex\_submatch}{}. + + This function combines \cfunc{nxo\_regsub\_new}{} and + \cfunc{nxo\_regsub\_subst}{} in such a way that no Onyx regsub + object is created, thus providing a more efficient way of doing + a one-off subst. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_stack.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_stack.tex new file mode 100644 index 000000000..cc741ff8b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_stack.tex @@ -0,0 +1,503 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_stack portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_stack} +\label{nxo_stack} +\index{nxo_stack@\classname{nxo\_stack}{}} + +The \classname{nxo\_stack} class is a subclass of the \classname{nxo} class. + +\subsubsection{API} +\begin{capi} +\label{nxo_stack_new} +\index{nxo_stack_new@\cfunc{nxo\_stack\_new}{}} +\citem{\cfunc[void]{nxo\_stack\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_bool\_t a\_locking}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_locking: ] + Implicit locking mode. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_stack_copy} +\index{nxo_stack_copy@\cfunc{nxo\_stack\_copy}{}} +\citem{\cfunc[void]{nxo\_stack\_copy}{cw\_nxo\_t *a\_to, cw\_nxo\_t *a\_from}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_to: ] + Pointer to a stack \classname{nxo}. + \item[a\_from: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Copy the objects in \cvar{a\_from} onto \cvar{a\_to}. + \end{capilist} +\label{nxo_stack_count} +\index{nxo_stack_count@\cfunc{nxo\_stack\_count}{}} +\citem{\cfunc[cw\_uint32\_t]{nxo\_stack\_count}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Number of objects on \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the number of objects on \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_push} +\index{nxo_stack_push@\cfunc{nxo\_stack\_push}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_push}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a no \classname{nxo} that has been pushed + onto \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Push a no \classname{nxo} onto \cvar{a\_nxo} and return a + pointer to it. + \end{capilist} +\label{nxo_stack_bpush} +\index{nxo_stack_bpush@\cfunc{nxo\_stack\_bpush}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_bpush}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a no \classname{nxo} that has been pushed + onto the bottom of \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Push a no \classname{nxo} onto the bottom of \cvar{a\_nxo} and + return a pointer to it. + \end{capilist} +\label{nxo_stack_under_push} +\index{nxo_stack_under_push@\cfunc{nxo\_stack\_under\_push}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_under\_push}{cw\_nxo\_t *a\_nxo, +cw\_nxo\_t *a\_object}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_object: ] + Pointer to an \classname{nxo} on \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to a no \classname{nxo} that has been pushed + under \cvar{a\_object} on \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Push a no \classname{nxo} under \cvar{a\_object} on + \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_pop} +\index{nxo_stack_pop@\cfunc{nxo\_stack\_pop}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_stack\_pop}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Pop an object off of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_bpop} +\index{nxo_stack_bpop@\cfunc{nxo\_stack\_bpop}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_stack\_bpop}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Pop an object off the bottom of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_npop} +\index{nxo_stack_npop@\cfunc{nxo\_stack\_npop}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_stack\_npop}{cw\_nxo\_t *a\_nxo, cw\_uint32\_t +a\_count}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_count: ] + Number of objects to pop off of \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Pop \cvar{a\_count} objects off of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_nbpop} +\index{nxo_stack_nbpop@\cfunc{nxo\_stack\_nbpop}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_stack\_nbpop}{cw\_nxo\_t *a\_nxo, cw\_uint32\_t +a\_count}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_count: ] + Number of objects to pop off the bottom of + \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Pop \cvar{a\_count} objects off the bottom of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_remove} +\index{nxo_stack_remove@\cfunc{nxo\_stack\_remove}{}} +\citem{\cfunc[void]{nxo\_stack\_remove}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_object}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_object: ] + Pointer to an object on \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + Remove \cvar{a\_object} from \cvar{a\_nxo}. + \item[Description: ] + \end{capilist} +\label{nxo_stack_get} +\index{nxo_stack_get@\cfunc{nxo\_stack\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the top \classname{nxo} on + \cvar{a\_nxo}. + \item[NULL: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the top \cvar{nxo} on \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_bget} +\index{nxo_stack_bget@\cfunc{nxo\_stack\_bget}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_bget}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the bottom \classname{nxo} on + \cvar{a\_nxo}. + \item[NULL: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the bottom \cvar{nxo} on \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_nget} +\index{nxo_stack_nget@\cfunc{nxo\_stack\_nget}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_nget}{const cw\_nxo\_t *a\_nxo, +cw\_uint32\_t a\_index}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_index: ] + Index of object in \cvar{a\_nxo} to return a pointer to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the \cvar{nxo} on \cvar{a\_nxo} at + index \cvar{a\_index}. + \item[NULL: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \cvar{nxo} on \cvar{a\_nxo} at index + \cvar{a\_index}. + \end{capilist} +\label{nxo_stack_nbget} +\index{nxo_stack_nbget@\cfunc{nxo\_stack\_nbget}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_nbget}{const cw\_nxo\_t *a\_nxo, +cw\_uint32\_t a\_index}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_index: ] + Index, counting from the bottom, of object in + \cvar{a\_nxo} to return a pointer to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the \cvar{nxo} on \cvar{a\_nxo} at + index \cvar{a\_index}, counting from the bottom. + \item[NULL: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \cvar{nxo} on \cvar{a\_nxo} at index + \cvar{a\_index}, counting from the bottom. + \end{capilist} +\label{nxo_stack_down_get} +\index{nxo_stack_down_get@\cfunc{nxo\_stack\_down\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_down\_get}{const cw\_nxo\_t *a\_nxo, +cw\_nxo\_t *a\_object}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_object: ] + Pointer to an object on \cvar{a\_nxo}, or NULL for the + top object on \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the \cvar{nxo} on \cvar{a\_nxo} under + \cvar{a\_object}. + \item[NULL: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + Return a pointer to the \cvar{nxo} on \cvar{a\_nxo} under + \cvar{a\_object}. + \item[Description: ] + \end{capilist} +\label{nxo_stack_up_get} +\index{nxo_stack_up_get@\cfunc{nxo\_stack\_up\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_stack\_up\_get}{const cw\_nxo\_t *a\_nxo, +cw\_nxo\_t *a\_object}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_object: ] + Pointer to an object on \cvar{a\_nxo}, or NULL for the + bottom object on \cvar{a\_nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the \cvar{nxo} on \cvar{a\_nxo} over + \cvar{a\_object}. + \item[NULL: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + Return a pointer to the \cvar{nxo} on \cvar{a\_nxo} over + \cvar{a\_object}. + \item[Description: ] + \end{capilist} +\label{nxo_stack_exch} +\index{nxo_stack_exch@\cfunc{nxo\_stack\_exch}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_stack\_exch}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Exchange the top two objects on \cvar{a\_nxo}. + \end{capilist} +\label{nxo_stack_rot} +\index{nxo_stack_rot@\cfunc{nxo\_stack\_rot}{}} +\citem{\cfunc[void]{nxo\_stack\_rot}{cw\_nxo\_t *a\_nxo, cw\_sint32\_t +a\_amount}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_amount: ] + Amount to rotate upward. A negative value rotates + downward. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Rotate \cvar{a\_nxo} up by \cvar{a\_amount}. + \end{capilist} +\label{nxo_stack_roll} +\index{nxo_stack_roll@\cfunc{nxo\_stack\_roll}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_stack\_roll}{cw\_nxo\_t *a\_nxo, cw\_uint32\_t +a\_count, cw\_sint32\_t a\_amount}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a stack \classname{nxo}. + \item[a\_count: ] + Number of objects in roll region. + \item[a\_amount: ] + Amount to roll upward. A negative value rolls downward. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Stack underflow. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Roll the top \cvar{a\_count} objects on \cvar{a\_nxo} up by + \cvar{a\_amount}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_string.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_string.tex new file mode 100644 index 000000000..fa18c5684 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_string.tex @@ -0,0 +1,251 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_string portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_string} +\label{nxo_string} +\index{nxo_string@\classname{nxo\_string}{}} + +The \classname{nxo\_string} class is a subclass of the \classname{nxo} class. +Strings are not `{\bs}0'-terminated, mainly since substrings are references to +other strings, and the termination character wouldn't be consistently useful. +\cfunc{nxo\_string\_cstring}{} is useful for creating `{\bs}0'-terminated copies +of strings for situations where other C functions expect terminated strings. + +\subsubsection{API} +\begin{capi} +\label{nxo_string_new} +\index{nxo_string_new@\cfunc{nxo\_string\_new}{}} +\citem{\cfunc[void]{nxo\_string\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx, +cw\_bool\_t a\_locking, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_locking: ] + Implicit locking mode. + \item[a\_len: ] + Length in bytes of string to create. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_string_substring_new} +\index{nxo_string_substring_new@\cfunc{nxo\_string\_substring\_new}{}} +\citem{\cfunc[void]{nxo\_string\_substring\_new}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t +*a\_string, cw\_nx\_t *a\_nx, cw\_uint32\_t a\_offset, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \item[a\_string: ] + Pointer to a string \classname{nxo} to create a + substring of. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \item[a\_offset: ] + Offset into \cvar{a\_string}. + \item[a\_len: ] + Length in bytes of substring to create. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Substring constructor. + \end{capilist} +\label{nxo_string_copy} +\index{nxo_string_copy@\cfunc{nxo\_string\_copy}{}} +\citem{\cfunc[void]{nxo\_string\_copy}{cw\_nxo\_t *a\_to, cw\_nxo\_t *a\_from}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_to: ] + Pointer to a string \classname{nxo}. + \item[a\_from: ] + Pointer to a string \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Copy the contents of \cvar{a\_from} to \cvar{a\_to}. The length + of \cvar{a\_to} must be at least that of \cvar{a\_from}. + \end{capilist} +\label{nxo_string_cstring} +\index{nxo_string_cstring@\cfunc{nxo\_string\_cstring}{}} +\citem{\cfunc[void]{nxo\_string\_cstring}{cw\_nxo\_t *a\_to, cw\_nxo\_t +*a\_from, cw\_nxo\_t *a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_to: ] + Pointer to an \classname{nxo}. + \item[a\_from: ] + Pointer to a string or name \classname{nxo}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Create a copy of \cvar{a\_from}, but append a `{\bs}0' character + to make it usable in calls to typical C functions that expect a + terminated string. + \end{capilist} +\label{nxo_string_len_get} +\index{nxo_string_len_get@\cfunc{nxo\_string\_len\_get}{}} +\citem{\cfunc[cw\_uint32\_t]{nxo\_string\_len\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Length of \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the length of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_string_el_get} +\index{nxo_string_el_get@\cfunc{nxo\_string\_el\_get}{}} +\citem{\cfunc[void]{nxo\_string\_el\_get}{const cw\_nxo\_t *a\_nxo, cw\_nxoi\_t +a\_offset, cw\_uint8\_t *r\_el}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \item[a\_offset: ] + Offset of character to get. + \item[r\_el: ] + Pointer to space to copy a character to. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_el: ] + A copy of the character of \cvar{a\_nxo} at offset + \cvar{a\_offset}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Get a copy of the character of \cvar{a\_nxo} at offset + \cvar{a\_offset}. + \end{capilist} +\label{nxo_string_el_set} +\index{nxo_string_el_set@\cfunc{nxo\_string\_el\_set}{}} +\citem{\cfunc[void]{nxo\_string\_el\_set}{cw\_nxo\_t *a\_nxo, cw\_uint8\_t +a\_el, cw\_nxoi\_t a\_offset}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \item[a\_el: ] + A character. + \item[a\_offset: ] + Offset of character in \cvar{a\_nxo} to replace with + \cvar{a\_el}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Copy \cvar{a\_el} into the element of \cvar{a\_nxo} at offset + \cvar{a\_offset}. + \end{capilist} +\label{nxo_string_lock} +\index{nxo_string_lock@\cfunc{nxo\_string\_lock}{}} +\citem{\cfunc[void]{nxo\_string\_lock}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + If implicit locking is activated for \cvar{a\_nxo}, lock it. + \end{capilist} +\label{nxo_string_unlock} +\index{nxo_string_unlock@\cfunc{nxo\_string\_unlock}{}} +\citem{\cfunc[void]{nxo\_string\_unlock}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + If implicit locking is activated for \cvar{a\_nxo}, unlock it. + \end{capilist} +\label{nxo_string_get} +\index{nxo_string_get@\cfunc{nxo\_string\_get}{}} +\citem{\cfunc[cw\_uint8\_t *]{nxo\_string\_get}{const cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the string internal to \cvar{a\_nxo}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the string internal to \cvar{a\_nxo}. + \end{capilist} +\label{nxo_string_set} +\index{nxo_string_set@\cfunc{nxo\_string\_set}{}} +\citem{\cfunc[void]{nxo\_string\_set}{cw\_nxo\_t *a\_nxo, cw\_uint32\_t +a\_offset, const cw\_uint8\_t *a\_str, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a string \classname{nxo}. + \item[a\_offset: ] + Offset into \cvar{a\_nxo} to replace. + \item[a\_str: ] + String to replace a range of \cvar{a\_nxo} with. + \item[a\_len: ] + Length in bytes of \cvar{a\_str}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Replace \cvar{a\_len} bytes of \cvar{a\_nxo} at offset + \cvar{a\_offset} with \cvar{a\_str}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_thread.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_thread.tex new file mode 100644 index 000000000..72ef372bf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/nxo_thread.tex @@ -0,0 +1,746 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% nxo_thread portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{nxo\_thread} +\label{nxo_thread} +\index{nxo_thread@\classname{nxo\_thread}{}} + +The \classname{nxo\_thread} class is a subclass of the \classname{nxo} class. + +The \classname{threadp} class is a helper class that contains scanner position +information. The \classname{threadp} state is used when recording syntax +errors. + +\subsubsection{API} +\begin{capi} +\label{nxo_threadp_new} +\index{nxo_threadp_new@\cfunc{nxo\_threadp\_new}{}} +\citem{\cfunc[void]{nxo\_threadp\_new}{cw\_nxo\_threadp\_t *a\_threadp}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_threadp: ] + Pointer to space for a \classname{threadp}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_threadp_delete} +\index{nxo_threadp_delete@\cfunc{nxo\_threadp\_delete}{}} +\citem{\cfunc[void]{nxo\_threadp\_delete}{cw\_nxo\_threadp\_t *a\_threadp, +cw\_nxo\_t *a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_threadp: ] + Pointer to a \classname{threadp}. + \item[a\_thread: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{nxo_threadp_position_get} +\index{nxo_threadp_position_get@\cfunc{nxo\_threadp\_position\_get}{}} +\citem{\cfunc[void]{nxo\_threadp\_position\_get}{const cw\_nxo\_threadp\_t +*a\_threadp, cw\_uint32\_t *r\_line, cw\_uint32\_t *r\_column}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_threadp: ] + Pointer to space for a \classname{threadp}. + \item[r\_line: ] + Pointer to a location to store a line number. + \item[r\_column: ] + Pointer to a location to store a column number. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[*r\_line: ] + Line number. + \item[*r\_column: ] + Column number. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Retrieve the line number and column number. + \end{capilist} +\label{nxo_threadp_position_set} +\index{nxo_threadp_position_set@\cfunc{nxo\_threadp\_position\_set}{}} +\citem{\cfunc[void]{nxo\_threadp\_position\_set}{cw\_nxo\_threadp\_t +*a\_threadp, cw\_uint32\_t a\_line, cw\_uint32\_t a\_column}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_threadp: ] + Pointer to space for a \classname{threadp}. + \item[a\_line: ] + Line number. + \item[a\_column: ] + Column number. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set the line number and column number. + \end{capilist} +\label{nxo_thread_new} +\index{nxo_thread_new@\cfunc{nxo\_thread\_new}{}} +\citem{\cfunc[void]{nxo\_thread\_new}{cw\_nxo\_t *a\_nxo, cw\_nx\_t *a\_nx}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_nx: ] + Pointer to an \classname{nx}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor. + \end{capilist} +\label{nxo_thread_start} +\index{nxo_thread_start@\cfunc{nxo\_thread\_start}{}} +\citem{\cfunc[void]{nxo\_thread\_start}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Application dependent. + \item[Description: ] + Start a thread running by calling the \onyxop{}{start}{} + operator such that the top object on ostack will be executed. + \end{capilist} +\label{nxo_thread_exit} +\index{nxo_thread_exit@\cfunc{nxo\_thread\_exit}{}} +\citem{\cfunc[void]{nxo\_thread\_exit}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Terminate the thread. This has the same effect as a detached + thread exiting. Calling this function may is necessary + (depending on the application) to allow the thread to be garbage + collected, much the same way as the \onyxop{}{detach}{} and + \onyxop{}{join}{} operators do. + \end{capilist} +\label{nxo_thread_thread} +\index{nxo_thread_thread@\cfunc{nxo\_thread\_thread}{}} +\citem{\cfunc[void]{nxo\_thread\_thread}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Create a new thread. The new thread calls + \cfunc{nxo\_thread\_start}{}. + \end{capilist} +\label{nxo_thread_} +\index{nxo_thread_detach@\cfunc{nxo\_thread\_detach}{}} +\citem{\cfunc[void]{nxo\_thread\_detach}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Detach \cvar{a\_nxo} so that when it exits it can be garbage + collected. + \end{capilist} +\label{nxo_thread_join} +\index{nxo_thread_join@\cfunc{nxo\_thread\_join}{}} +\citem{\cfunc[void]{nxo\_thread\_join}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Wait for \cvar{a\_nxo} to exit. + \end{capilist} +\label{nxo_thread_state} +\index{nxo_thread_state@\cfunc{nxo\_thread\_state}{}} +\citem{\cfunc[cw\_nxo\_threadts\_t]{nxo\_thread\_state}{const cw\_nxo\_t +*a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] The current scanner state of \cvar{a\_nxo}. + \begin{description}\item[] + \item[THREADTS\_START: ] Start state. + \item[THREADTS\_COMMENT: ] '\%' seen, but no line break + yet. + \item[THREADTS\_INTEGER: ] Scanning an integer. + \item[THREADTS\_INTEGER\_RADIX: ] Scanning a radix + integer. + \item[THREADTS\_REAL\_FRAC: ] Scanning the fractional + portion of a real. + \item[THREADTS\_REAL\_EXP: ] Scanning the exponent + porttion of a real. + \item[THREADTS\_STRING: ] Scanning a string. + \item[THREADTS\_STRING\_NEWLINE\_CONT: ] '{\bs}r' seen + in a string. + \item[THREADTS\_STRING\_PROT\_CONT: ] '{\bs}{\bs}' seen + in a string. + \item[THREADTS\_STRING\_CRLF\_CONT: ] '{\bs}' '{\bs}r' + seen in a string. + \item[THREADTS\_STRING\_CTRL\_CONT: ] '{\bs}' 'c' seen + in a string. + \item[THREADTS\_STRING\_HEX\_CONT: ] '{\bs}' 'x' seen in + a string. + \item[THREADTS\_STRING\_HEX\_FINISH: ] First hex digit + of a ``{\bs}xDD'' string escape sequence seen. + \item[THREADTS\_NAME\_START: ] '!', '\$', or '{\twid}' + seen. + \item[THREADTS\_NAME: ] Scanning a name. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the current scanner state. In general this is only + useful when implementing an interactive environment for which + the prompt behaves differently depending on what state the + scanner is in. For example the interactive \binname{onyx} shell + needs only to know whether the scanner is in the start state. + \end{capilist} +\label{nxo_thread_deferred} +\index{nxo_thread_deferred@\cfunc{nxo\_thread\_deferred}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_thread\_deferred}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Execution is not deferred. + \item[TRUE: ] + Execution is deferred. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return whether the scanner is currently in deferred execution + mode. See Section~\ref{sec:onyx_syntax} for information on + deferred execution. In general this is only useful when + implementing an interactive environment for which the prompt + behaves differently depending on what state the scanner is in. + \end{capilist} +\label{nxo_thread_reset} +\index{nxo_thread_reset@\cfunc{nxo\_thread\_reset}{}} +\citem{\cfunc[void]{nxo\_thread\_reset}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Reset the scanner to the start state, and turn deferral off. + This is a dangerous feature that should be used with great + care. \classname{nxo\_no} objects should never be visible from + inside the interpreter, so the caller must assure that any + \classname{nxo\_no} objects are removed before further + processing is done in the context of \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_loop} +\index{nxo_thread_loop@\cfunc{nxo\_thread\_loop}{}} +\citem{\cfunc[void]{nxo\_thread\_loop}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Application specific. + \item[Description: ] + Execute the top object on estack. The caller is responsible + for placing the object on estack, but it is removed before this + function returns. + \end{capilist} +\label{nxo_thread_interpret} +\index{nxo_thread_interpret@\cfunc{nxo\_thread\_interpret}{}} +\citem{\cfunc[void]{nxo\_thread\_interpret}{cw\_nxo\_t *a\_nxo, +cw\_nxo\_threadp\_t *a\_threadp, const cw\_uint8\_t *a\_str, cw\_uint32\_t +a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_threadp: ] + A \classname{threadp}. + \item[a\_str: ] + Pointer to a string to interpret. + \item[a\_len: ] + Length in bytes of \cvar{a\_str}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Application specific. + \item[Description: ] + Interpret the string pointed to by \cvar{a\_str}. + \end{capilist} +\label{nxo_thread_flush} +\index{nxo_thread_flush@\cfunc{nxo\_thread\_flush}{}} +\citem{\cfunc[void]{nxo\_thread\_flush}{cw\_nxo\_t *a\_nxo, cw\_nxo\_threadp\_t +*a\_threadp}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_threadp: ] + A \classname{threadp}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Application specific. + \item[Description: ] + Do the equivalent of interpreting a carriage return in order to + force acceptance of the previous token if no whitespace has yet + followed. + \end{capilist} +\label{nxo_thread_nerror} +\index{nxo_thread_nerror@\cfunc{nxo\_thread\_nerror}{}} +\citem{\cfunc[void]{nxo\_thread\_nerror}{cw\_nxo\_t *a\_nxo, cw\_nxn\_t a\_nxn}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_nxn: ] + An nxn corresponding to the name of an error. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Application dependent. + \item[Description: ] + Throw an error. + \end{capilist} +\label{nxo_thread_serror} +\index{nxo_thread_serror@\cfunc{nxo\_thread\_serror}{}} +\citem{\cfunc[void]{nxo\_thread\_serror}{cw\_nxo\_t *a\_nxo, const cw\_uint8\_t +a\_str, cw\_uint32\_t a\_len}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_str: ] + Pointer to a string that represents the name of an + error. + \item[a\_len: ] + The length of \cvar{a\_str}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] Application dependent. + \item[Description: ] + Throw an error. + \end{capilist} +\label{nxo_thread_dstack_search} +\index{nxo_thread_dstack_search@\cfunc{nxo\_thread\_dstack\_search}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_thread\_dstack\_search}{cw\_nxo\_t *a\_nxo, +cw\_nxo\_t *a\_key, cw\_nxo\_t *r\_value}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_key: ] + Pointer to an \classname{nxo}. + \item[r\_value: ] + Pointer to an \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + \cvar{a\_key} not found on dstack. + \end{description} + \item[r\_value: ] + Top value in dstack associated with \cvar{a\_key}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Search dstack for the topmost definition of \cvar{a\_key} and + dup its value to \cvar{r\_value}. + \end{capilist} +\label{nxo_thread_currentlocking} +\index{nxo_thread_currentlocking@\cfunc{nxo\_thread\_currentlocking}{}} +\citem{\cfunc[cw\_bool\_t]{nxo\_thread\_currentlocking}{const cw\_nxo\_t +*a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Implicit locking deactivated for new objects. + \item[TRUE: ] + Implicit locking activated for new objects. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return whether implicit locking is activated for new objects. + \end{capilist} +\label{nxo_thread_setlocking} +\index{nxo_thread_setlocking@\cfunc{nxo\_thread\_setlocking}{}} +\citem{\cfunc[void]{nxo\_thread\_setlocking}{cw\_nxo\_t *a\_nxo, cw\_bool\_t +a\_locking}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_locking: ] + \begin{description}\item[] + \item[FALSE: ] + Do not implicitly lock new objects. + \item[TRUE: ] + Implicitly lock new objects. + \end{description} + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Activate or deactivate implicit locking for new objects. + \end{capilist} +\label{nxo_thread_nx_get} +\index{nxo_thread_nx_get@\cfunc{nxo\_thread\_nx\_get}{}} +\citem{\cfunc[cw\_nx\_t *]{nxo\_thread\_nx\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nx}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the \classname{nx} associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_userdict_get} +\index{nxo_thread_userdict_get@\cfunc{nxo\_thread\_userdict\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_userdict\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the userdict associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_errordict_get} +\index{nxo_thread_errordict_get@\cfunc{nxo\_thread\_errordict\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_errordict\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the errordict associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_currenterror_get} +\index{nxo_thread_currenterror_get@\cfunc{nxo\_thread\_currenterror\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_currenterror\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the currenterror associated with + \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_ostack_get} +\index{nxo_thread_ostack_get@\cfunc{nxo\_thread\_ostack\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_ostack\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the ostack associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_dstack_get} +\index{nxo_thread_dstack_get@\cfunc{nxo\_thread\_dstack\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_dstack\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the dstack associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_estack_get} +\index{nxo_thread_estack_get@\cfunc{nxo\_thread\_estack\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_estack\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the estack associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_istack_get} +\index{nxo_thread_istack_get@\cfunc{nxo\_thread\_istack\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_istack\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the istack associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_tstack_get} +\index{nxo_thread_tstack_get@\cfunc{nxo\_thread\_tstack\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_tstack\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the tstack associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_stdin_get} +\index{nxo_thread_stdin_get@\cfunc{nxo\_thread\_stdin\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_stdin\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the stdin associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_stdin_set} +\index{nxo_thread_stdin_set@\cfunc{nxo\_thread\_stdin\_set}{}} +\citem{\cfunc[void]{nxo\_thread\_stdin\_set}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t + *a\_stdin}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_stdin: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{a\_nxo}'s stdin to \cvar{a\_stdin}. + \end{capilist} +\label{nxo_thread_stdout_get} +\index{nxo_thread_stdout_get@\cfunc{nxo\_thread\_stdout\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_stdout\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the stdout associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_stdout_set} +\index{nxo_thread_stdout_set@\cfunc{nxo\_thread\_stdout\_set}{}} +\citem{\cfunc[void]{nxo\_thread\_stdout\_set}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t + *a\_stdout}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_stdout: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{a\_nxo}'s stdout to \cvar{a\_stdout}. + \end{capilist} +\label{nxo_thread_stderr_get} +\index{nxo_thread_stderr_get@\cfunc{nxo\_thread\_stderr\_get}{}} +\citem{\cfunc[cw\_nxo\_t *]{nxo\_thread\_stderr\_get}{cw\_nxo\_t *a\_nxo}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to an \classname{nxo} that can safely be used + without risk of being garbage collected. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the stderr associated with \cvar{a\_nxo}. + \end{capilist} +\label{nxo_thread_stderr_set} +\index{nxo_thread_stderr_set@\cfunc{nxo\_thread\_stderr\_set}{}} +\citem{\cfunc[void]{nxo\_thread\_stderr\_set}{cw\_nxo\_t *a\_nxo, cw\_nxo\_t + *a\_stderr}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_nxo: ] + Pointer to a thread \classname{nxo}. + \item[a\_stderr: ] + Pointer to a file \classname{nxo}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set \cvar{a\_nxo}'s stderr to \cvar{a\_stderr}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/ql.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/ql.tex new file mode 100644 index 000000000..882841ba2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/ql.tex @@ -0,0 +1,398 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% ql portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{ql} +\label{ql} +\index{ql@\classname{ql}{}} + +The \classname{ql} macros implement operations on a list. The type of the list +elements and which field of the elements to use are determined by arguments that +are passed into the macros. The macros are optimized for speed and code size, +which means that there is minimal error checking built in. As a result, care +must be taken to assure that these macros are used as intended, or strange +things can happen. + +Internally, the list is represented as a ring, so with some care, the +\classname{ql} and \classname{qr} interfaces can be used in conjunction with +each other. + +Since a \classname{ql} is actually a ring, it is possible to have multiple +\classname{ql} heads that share the same ring. This works just fine, with the +caveat that operations on one \classname{ql} can have side-effects on another. + +\subsubsection{API} +\begin{capi} +\label{ql_head} +\index{ql_head@\cppmacro{ql\_head}{}} +\citem{\cppmacro[]{ql\_head}{{\lt}ql\_type{\gt} a\_type}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_type: ] + Data type for the \classname{ql} elements. + \end{description} + \item[Output(s): ] + A data structure that can be used as a \classname{ql} head. + \item[Exception(s): ] None. + \item[Description: ] + Generate code for a \classname{ql} head data structure. + \end{capilist} +\label{ql_head_initializer} +\index{ql_head_initializer@\cppmacro{ql\_head\_initializer}{}} +\citem{\cppmacro[]{ql\_head\_initializer}{{\lt}ql\_type{\gt} *a\_head}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Statically initialize a \classname{ql} head. + \end{capilist} +\label{ql_elm} +\index{ql_elm@\cppmacro{ql\_elm}{}} +\citem{\cppmacro[]{ql\_elm}{{\lt}ql\_type{\gt} a\_type}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_type: ] + Data type for the \classname{ql} elements. + \end{description} + \item[Output(s): ] + A data structure that can be used as a \classname{ql} element. + \item[Exception(s): ] None. + \item[Description: ] + Generate code for a \classname{ql} element data structure. + \end{capilist} +\label{ql_new} +\index{ql_new@\cppmacro{ql\_new}{}} +\citem{\cppmacro[void]{ql\_new}{{\lt}ql\_head{\gt} *a\_head}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{ql_elm_new} +\index{ql_elm_new@\cppmacro{ql\_elm\_new}{}} +\citem{\cppmacro[void]{ql\_elm\_new}{{\lt}ql\_type{\gt} *a\_elm, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{ql_first} +\index{ql_first@\cppmacro{ql\_first}{}} +\citem{\cppmacro[{\lt}ql\_type{\gt} *]{ql\_first}{{\lt}ql\_head{\gt} +*a\_head}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the first element in \cvar{a\_head}. + \item[NULL: ] + \cvar{a\_head} is empty. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the first element in the \classname{ql}. + \end{capilist} +\label{ql_last} +\index{ql_last@\cppmacro{ql\_last}{}} +\citem{\cppmacro[{\lt}ql\_type{\gt} *]{ql\_last}{{\lt}ql\_head{\gt} +*a\_head, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the last element in \cvar{a\_head}. + \item[NULL: ] + \cvar{a\_head} is empty. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the last element in the \classname{ql}. + \end{capilist} +\label{ql_next} +\index{ql_next@\cppmacro{ql\_next}{}} +\citem{\cppmacro[{\lt}ql\_type{\gt} *]{ql\_next}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the element after \cvar{a\_elm}. + \item[NULL: ] + \cvar{a\_elm} is the last element in + \cvar{a\_head}. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the element in \cvar{a\_head} after + \cvar{a\_elm}. + \end{capilist} +\label{ql_prev} +\index{ql_prev@\cppmacro{ql\_prev}{}} +\citem{\cppmacro[{\lt}ql\_type{\gt} *]{ql\_prev}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the element before \cvar{a\_elm}. + \item[NULL: ] + \cvar{a\_elm} is the first element in + \cvar{a\_head}. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the element in \cvar{a\_head} before + \cvar{a\_elm}. + \end{capilist} +\label{ql_before_insert} +\index{ql_before_insert@\cppmacro{ql\_before\_insert}{}} +\citem{\cppmacro[void]{ql\_before\_insert}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} *a\_qlelm, {\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} +a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_qlelm: ] + Pointer to an element within \cvar{a\_head}. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Insert \cvar{a\_elm} into \cvar{a\_head} before \cvar{a\_qlelm}. + \end{capilist} +\label{ql_after_insert} +\index{ql_after_insert@\cppmacro{ql\_after\_insert}{}} +\citem{\cppmacro[void]{ql\_after\_insert}{{\lt}ql\_type{\gt} *a\_qlelm, +{\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qlelm: ] + Pointer to an element within \cvar{a\_head}. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Insert \cvar{a\_elm} into \cvar{a\_head} after \cvar{a\_qlelm}. + \end{capilist} +\label{ql_head_insert} +\index{ql_head_insert@\cppmacro{ql\_head\_insert}{}} +\citem{\cppmacro[void]{ql\_head\_insert}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Insert \cvar{a\_elm} at the head of \cvar{a\_head}. + \end{capilist} +\label{ql_tail_insert} +\index{ql_tail_insert@\cppmacro{ql\_tail\_insert}{}} +\citem{\cppmacro[void]{ql\_tail\_insert}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Insert \cvar{a\_elm} at the tail of \cvar{a\_head}. + \end{capilist} +\label{ql_remove} +\index{ql_remove@\cppmacro{ql\_remove}{}} +\citem{\cppmacro[void]{ql\_remove}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Remove \cvar{a\_elm} from \cvar{a\_head}. + \end{capilist} +\label{ql_head_remove} +\index{ql_head_remove@\cppmacro{ql\_head\_remove}{}} +\citem{\cppmacro[void]{ql\_head\_remove}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} a\_type, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_type: ] + Data type for the \classname{ql} elements. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Remove the head element of \cvar{a\_head}. + \end{capilist} +\label{ql_tail_remove} +\index{ql_tail_remove@\cppmacro{ql\_tail\_remove}{}} +\citem{\cppmacro[void]{ql\_tail\_remove}{{\lt}ql\_head{\gt} *a\_head, +{\lt}ql\_type{\gt} a\_type, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_type: ] + Data type for the \classname{ql} elements. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Remove the tail element of \cvar{a\_head}. + \end{capilist} +\label{ql_foreach} +\index{ql_foreach@\cppmacro{ql\_foreach}{}} +\citem{\cppmacro[]{ql\_foreach}{{\lt}ql\_type{\gt} *a\_var, {\lt}ql\_type{\gt} +*a\_head, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_var: ] + The name of a temporary variable to use for iteration. + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Iterate through the \classname{ql}, storing a pointer to each + element in \cvar{a\_var} along the way. + \end{capilist} +\label{ql_reverse_foreach} +\index{ql_reverse_foreach@\cppmacro{ql\_reverse\_foreach}{}} +\citem{\cppmacro[]{ql\_reverse\_foreach}{{\lt}ql\_type{\gt} *a\_var, +{\lt}ql\_type{\gt} *a\_head, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_var: ] + The name of a temporary variable to use for iteration. + \item[a\_head: ] + Pointer to a \classname{ql} head. + \item[a\_field: ] + Field within the \classname{ql} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Iterate through the \classname{ql} in the reverse direction, + storing a pointer to each element in \cvar{a\_var} along the + way. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/qr.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/qr.tex new file mode 100644 index 000000000..96ef0295b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/qr.tex @@ -0,0 +1,244 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% qr portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{qr} +\label{qr} +\index{qr@\classname{qr}{}} + +The \classname{qr} macros implement operations on a ring. The type of the ring +elements and which field of the elements to use are determined by arguments that +are passed into the macros. The macros are optimized for speed and code size, +which means that there is minimal error checking built in. As a result, care +must be taken to assure that these are used as intended, or strange things can +happen. + +\subsubsection{API} +\begin{capi} +%\label{qr} +\index{qr@\cppmacro{qr}{}} +\citem{\cppmacro[]{qr}{{\lt}qr\_type{\gt} a\_type}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_type: ] + Data type for the \classname{qr}. + \end{description} + \item[Output(s): ] + A data structure that can be used for a \classname{qr}. + \item[Exception(s): ] None. + \item[Description: ] + Generate code for a \classname{qr} data structure. + \end{capilist} +\label{qr_new} +\index{qr_new@\cppmacro{qr\_new}{}} +\citem{\cppmacro[void]{qr\_new}{{\lt}qr\_type{\gt} *a\_qr, {\lt}field\_name{\gt} +a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qr: ] + Pointer to a \classname{qr}. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{qr_next} +\index{qr_next@\cppmacro{qr\_next}{}} +\citem{\cppmacro[{\lt}qr\_type{\gt} *]{qr\_next}{{\lt}qr\_type{\gt} *a\_qr, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qr: ] + Pointer to a \classname{qr}. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the next element in the \classname{qr}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the next element in the \classname{qr}. + \end{capilist} +\label{qr_prev} +\index{qr_prev@\cppmacro{qr\_prev}{}} +\citem{\cppmacro[{\lt}qr\_type{\gt} *]{qr\_prev}{{\lt}qr\_type{\gt} *a\_qr, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qr: ] + Pointer to a \classname{qr}. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the previous element in the \classname{qr}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the previous element in the \classname{qr}. + \end{capilist} +\label{qr_before_insert} +\index{qr_before_insert@\cppmacro{qr\_before\_insert}{}} +\citem{\cppmacro[void]{qr\_before\_insert}{{\lt}qr\_type{\gt} *a\_qrelm, +{\lt}qr\_type{\gt} *a\_qr, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qrelm: ] + Pointer to an element in a \classname{qr}. + \item[a\_qr: ] + Pointer to an element that is the only element in its + ring. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Insert \cvar{a\_qr} before \cvar{a\_qrelm}. + \end{capilist} +\label{qr_after_insert} +\index{qr_after_insert@\cppmacro{qr\_after\_insert}{}} +\citem{\cppmacro[void]{qr\_after\_insert}{{\lt}qr\_type{\gt} *a\_qrelm, +{\lt}qr\_type{\gt} *a\_qr, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qrelm: ] + Pointer to an element in a \classname{qr}. + \item[a\_qr: ] + Pointer to an element that is the only element in its + ring. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Insert \cvar{a\_qr} after \cvar{a\_qrelm}. + \end{capilist} +\label{qr_meld} +\index{qr_meld@\cppmacro{qr\_meld}{}} +\citem{\cppmacro[void]{qr\_meld}{{\lt}qr\_type{\gt} *a\_qr\_a, +{\lt}qr\_type{\gt} *a\_qr\_b, {\lt}qr\_type{\gt} a\_type, {\lt}field\_name{\gt} +a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qr\_a: ] + Pointer to a \classname{qr}. + \item[a\_qr\_b: ] + Pointer to a \classname{qr}. + \item[a\_type: ] + Data type for the \classname{qr} elements. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Meld \cvar{a\_qr\_a} and \cvar{a\_qr\_b} into one ring. + \end{capilist} +\label{qr_split} +\index{qr_split@\cppmacro{qr\_split}{}} +\citem{\cppmacro[void]{qr\_split}{{\lt}qr\_type{\gt} *a\_qr\_a, +{\lt}qr\_type{\gt} *a\_qr\_b, {\lt}qr\_type{\gt} a\_type, {\lt}field\_name{\gt} +a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qr\_a: ] + Pointer to a \classname{qr}. + \item[a\_qr\_b: ] + Pointer to a \classname{qr}. + \item[a\_type: ] + Data type for the \classname{qr} elements. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Split a ring at \cvar{a\_qr\_a} and \cvar{a\_qr\_b}. + \end{capilist} +\label{qr_remove} +\index{qr_remove@\cppmacro{qr\_remove}{}} +\citem{\cppmacro[void]{qr\_remove}{{\lt}qr\_type{\gt} *a\_qr, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qr: ] + Pointer to a \classname{qr}. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Remove \cvar{a\_qr} from the ring. + \end{capilist} +\label{qr_foreach} +\index{qr_foreach@\cppmacro{qr\_foreach}{}} +\citem{\cppmacro[]{qr\_foreach}{{\lt}qr\_type{\gt} *a\_var, {\lt}qr\_type{\gt} +*a\_qr, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_var: ] + The name of a temporary variable to use for iteration. + \item[a\_qr: ] + Pointer to a \classname{qr}. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Iterate through the \classname{qr}, storing a pointer to each + element in \cvar{a\_var} along the way. + \end{capilist} +\label{qr_reverse_foreach} +\index{qr_reverse_foreach@\cppmacro{qr\_reverse\_foreach}{}} +\citem{\cppmacro[]{qr\_reverse\_foreach}{{\lt}qr\_type{\gt} *a\_var, +{\lt}qr\_type{\gt} *a\_qr, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_var: ] + The name of a temporary variable to use for iteration. + \item[a\_qr: ] + Pointer to a \classname{qr}. + \item[a\_field: ] + Field within the \classname{qr} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Iterate through the \classname{qr} in the reverse direction, + storing a pointer to each element in \cvar{a\_var} along the + way. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/qs.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/qs.tex new file mode 100644 index 000000000..4df96f3fd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/qs.tex @@ -0,0 +1,225 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% qs portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{qs} +\label{qs} +\index{qs@\classname{qs}{}} + +The \classname{qs} macros implement operations on a stack. The type of the +stack elements and which field of the elements to use are determined by +arguments that are passed into the macros. The macros are optimized for speed +and code size, which means that there is minimal error checking built in. As a +result, care must be taken to assure that these macros are used as intended, or +strange things can happen. + +\subsubsection{API} +\begin{capi} +\label{qs_head} +\index{qs_head@\cppmacro{qs\_head}{}} +\citem{\cppmacro[]{qs\_head}{{\lt}qs\_type{\gt} a\_type}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_type: ] + Data type for the \classname{qs}. + \end{description} + \item[Output(s): ] + A data structure that can be used as a \classname{qs} head. + \item[Exception(s): ] None. + \item[Description: ] + Generate code for a \classname{qs} head data structure. + \end{capilist} +\label{qs_head_initializer} +\index{qs_head_initializer@\cppmacro{qs\_head\_initializer}{}} +\citem{\cppmacro[]{qs\_head\_initializer}{{\lt}qs\_type{\gt} *a\_head}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{qs} head. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Statically initialize a \classname{qs} head. + \end{capilist} +\label{qs_elm} +\index{qs_elm@\cppmacro{qs\_elm}{}} +\citem{\cppmacro[]{qs\_elm}{{\lt}qs\_elm\_type{\gt} a\_type}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_type: ] + Data type for the \classname{qs} elements. + \end{description} + \item[Output(s): ] + A data structure that can be used as a qs element. + \item[Exception(s): ] None. + \item[Description: ] + Generate code for a \classname{qs} element data structure. + \end{capilist} +\label{qs_new} +\index{qs_new@\cppmacro{qs\_new}{}} +\citem{\cppmacro[void]{qs\_new}{{\lt}qs\_type{\gt} *a\_head}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{qs} head. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{qs_elm_new} +\index{qs_elm_new@\cppmacro{qs\_elm\_new}{}} +\citem{\cppmacro[void]{qs\_elm\_new}{{\lt}qs\_elm\_type{\gt} *a\_elm, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{qs} element. + \item[a\_field: ] + Field within the \classname{qs} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{qs_top} +\index{qs_top@\cppmacro{qs\_top}{}} +\citem{\cppmacro[{\lt}qs\_type{\gt} *]{qs\_top}{{\lt}qs\_type{\gt} *a\_head}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{qs} head. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the top element in the \classname{qs}. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the top element in the \classname{qs}. + \end{capilist} +\label{qs_down} +\index{qs_down@\cppmacro{qs\_down}{}} +\citem{\cppmacro[{\lt}qs\_type{\gt} *]{qs\_down}{{\lt}qs\_elm\_type{\gt} +*a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_elm: ] + Pointer to a \classname{qs} element. + \item[a\_field: ] + Field within the \classname{qs} elements to use. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer to the next element in the + \classname{qs}. + \item[NULL: ] + \cvar{a\_elm} is the bottom element in the + \classname{qs}. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the next element in the \classname{qs} below + \cvar{a\_elm}. + \end{capilist} +\label{qs_push} +\index{qs_push@\cppmacro{qs\_push}{}} +\citem{\cppmacro[void]{qs\_push}{{\lt}qs\_type{\gt} *a\_head, +{\lt}qs\_elm\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{qs} head. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{qs} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Push \cvar{a\_elm} onto the \classname{qs}. + \end{capilist} +\label{qs_under_push} +\index{qs_under_push@\cppmacro{qs\_under\_push}{}} +\citem{\cppmacro[void]{qs\_under\_push}{{\lt}qs\_elm\_type{\gt} *a\_qselm, +{\lt}qs\_elm\_type{\gt} *a\_elm, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_qselm: ] + Pointer to a \classname{qs} element. + \item[a\_elm: ] + Pointer to an element. + \item[a\_field: ] + Field within the \classname{qs} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Push \cvar{a\_elm} under \cvar{a\_qselm}. + \end{capilist} +\label{qs_pop} +\index{qs_pop@\cppmacro{qs\_pop}{}} +\citem{\cppmacro[void]{qs\_pop}{{\lt}qs\_type{\gt} *a\_head, +{\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_head: ] + Pointer to a \classname{qs} head. + \item[a\_field: ] + Field within the \classname{qs} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Pop an element off of \cvar{a\_head}. + \end{capilist} +\label{qs_foreach} +\index{qs_foreach@\cppmacro{qs\_foreach}{}} +\citem{\cppmacro[]{qs\_foreach}{{\lt}qs\_elm\_type{\gt} *a\_var, +{\lt}qs\_type{\gt} *a\_head, {\lt}field\_name{\gt} a\_field}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_var: ] + The name of a temporary variable to use for iteration. + \item[a\_head: ] + Pointer to a \classname{qs} head. + \item[a\_field: ] + Field within the \classname{qs} elements to use. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Iterate down the \classname{qs}, storing a pointer to each + element in \cvar{a\_var} along the way. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/systemdict.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/systemdict.tex new file mode 100644 index 000000000..6663faef7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/systemdict.tex @@ -0,0 +1,1119 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% systemdict portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{systemdict} +\label{systemdict} +\index{systemdict@\classname{systemdict}{}} + +The \classname{systemdict} functions implement the operators contained in +\onyxop{}{systemdict}{}. Only the C API is documented here; see +Section~\ref{sec:systemdict} for operator semantics. + +\subsubsection{API} +\begin{capi} +\label{systemdict_abs} +\index{systemdict_abs@\cfunc{systemdict\_abs}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{abs}{systemdict:abs}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_accept} +\index{systemdict_accept@\cfunc{systemdict\_accept}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{accept}{systemdict:accept}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_acos} +\index{systemdict_acos@\cfunc{systemdict\_acos}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{acos}{systemdict:acos}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_acosh} +\index{systemdict_acosh@\cfunc{systemdict\_acosh}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{acosh}{systemdict:acosh}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_add} +\index{systemdict_add@\cfunc{systemdict\_add}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{add}{systemdict:add}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_adn} +\index{systemdict_adn@\cfunc{systemdict\_adn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{adn}{systemdict:adn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_and} +\index{systemdict_and@\cfunc{systemdict\_and}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{and}{systemdict:and}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_array} +\index{systemdict_array@\cfunc{systemdict\_array}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{array}{systemdict:array}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_asin} +\index{systemdict_asin@\cfunc{systemdict\_asin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{asin}{systemdict:asin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_asinh} +\index{systemdict_asinh@\cfunc{systemdict\_asinh}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{asinh}{systemdict:asinh}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_atan} +\index{systemdict_atan@\cfunc{systemdict\_atan}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{atan}{systemdict:atan}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_atan2} +\index{systemdict_atan2@\cfunc{systemdict\_atan2}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{atan2}{systemdict:atan2}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_atanh} +\index{systemdict_atanh@\cfunc{systemdict\_atanh}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{atanh}{systemdict:atanh}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_aup} +\index{systemdict_aup@\cfunc{systemdict\_aup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{aup}{systemdict:aup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_bdup} +\index{systemdict_bdup@\cfunc{systemdict\_bdup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{bdup}{systemdict:bdup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_begin} +\index{systemdict_begin@\cfunc{systemdict\_begin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{begin}{systemdict:begin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_bind} +\index{systemdict_bind@\cfunc{systemdict\_bind}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{bind}{systemdict:bind}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_bindsocket} +\index{systemdict_bindsocket@\cfunc{systemdict\_bindsocket}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{bindsocket}{systemdict:bindsocket}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_bpop} +\index{systemdict_bpop@\cfunc{systemdict\_bpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{bpop}{systemdict:bpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_broadcast} +\index{systemdict_broadcast@\cfunc{systemdict\_broadcast}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{broadcast}{systemdict:broadcast}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_bytesavailable} +\index{systemdict_bytesavailable@\cfunc{systemdict\_bytesavailable}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{bytesavailable}{systemdict:bytesavailable}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cat} +\index{systemdict_cat@\cfunc{systemdict\_cat}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cat}{systemdict:cat}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cd} +\index{systemdict_cd@\cfunc{systemdict\_cd}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cd}{systemdict:cd}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ceiling} +\index{systemdict_ceiling@\cfunc{systemdict\_ceiling}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ceiling}{systemdict:ceiling}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_chmod} +\index{systemdict_chmod@\cfunc{systemdict\_chmod}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{chmod}{systemdict:chmod}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_chown} +\index{systemdict_chown@\cfunc{systemdict\_chown}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{chown}{systemdict:chown}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_chroot} +\index{systemdict_chroot@\cfunc{systemdict\_chroot}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{chroot}{systemdict:chroot}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_clear} +\index{systemdict_clear@\cfunc{systemdict\_clear}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{clear}{systemdict:clear}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cleartomark} +\index{systemdict_cleartomark@\cfunc{systemdict\_cleartomark}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cleartomark}{systemdict:cleartomark}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_close} +\index{systemdict_close@\cfunc{systemdict\_close}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{close}{systemdict:close}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_condition} +\index{systemdict_condition@\cfunc{systemdict\_condition}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{condition}{systemdict:condition}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_connect} +\index{systemdict_connect@\cfunc{systemdict\_connect}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{connect}{systemdict:connect}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_copy} +\index{systemdict_copy@\cfunc{systemdict\_copy}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{copy}{systemdict:copy}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cos} +\index{systemdict_cos@\cfunc{systemdict\_cos}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cos}{systemdict:cos}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cosh} +\index{systemdict_cosh@\cfunc{systemdict\_cosh}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cosh}{systemdict:cosh}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_count} +\index{systemdict_count@\cfunc{systemdict\_count}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{count}{systemdict:count}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_countdstack} +\index{systemdict_countdstack@\cfunc{systemdict\_countdstack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{countdstack}{systemdict:countdstack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_countestack} +\index{systemdict_countestack@\cfunc{systemdict\_countestack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{countestack}{systemdict:countestack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_counttomark} +\index{systemdict_counttomark@\cfunc{systemdict\_counttomark}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{counttomark}{systemdict:counttomark}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_currentdict} +\index{systemdict_currentdict@\cfunc{systemdict\_currentdict}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{currentdict}{systemdict:currentdict}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_currentlocking} +\index{systemdict_currentlocking@\cfunc{systemdict\_currentlocking}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{currentlocking}{systemdict:currentlocking}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cvds} +\index{systemdict_cvds@\cfunc{systemdict\_cvds}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cvds}{systemdict:cvds}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cve} +\index{systemdict_cve@\cfunc{systemdict\_cve}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cve}{systemdict:cve}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cves} +\index{systemdict_cves@\cfunc{systemdict\_cves}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cves}{systemdict:cves}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cvlit} +\index{systemdict_cvlit@\cfunc{systemdict\_cvlit}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cvlit}{systemdict:cvlit}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cvn} +\index{systemdict_cvn@\cfunc{systemdict\_cvn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cvn}{systemdict:cvn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cvrs} +\index{systemdict_cvrs@\cfunc{systemdict\_cvrs}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cvrs}{systemdict:cvrs}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cvs} +\index{systemdict_cvs@\cfunc{systemdict\_cvs}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cvs}{systemdict:cvs}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_cvx} +\index{systemdict_cvx@\cfunc{systemdict\_cvx}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{cvx}{systemdict:cvx}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_dec} +\index{systemdict_dec@\cfunc{systemdict\_dec}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{dec}{systemdict:dec}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_def} +\index{systemdict_def@\cfunc{systemdict\_def}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{def}{systemdict:def}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_detach} +\index{systemdict_detach@\cfunc{systemdict\_detach}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{detach}{systemdict:detach}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_dict} +\index{systemdict_dict@\cfunc{systemdict\_dict}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{dict}{systemdict:dict}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_die} +\index{systemdict_die@\cfunc{systemdict\_die}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{die}{systemdict:die}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_dirforeach} +\index{systemdict_dirforeach@\cfunc{systemdict\_dirforeach}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{dirforeach}{systemdict:dirforeach}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_div} +\index{systemdict_div@\cfunc{systemdict\_div}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{div}{systemdict:div}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_dn} +\index{systemdict_dn@\cfunc{systemdict\_dn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{dn}{systemdict:dn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_dstack} +\index{systemdict_dstack@\cfunc{systemdict\_dstack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{dstack}{systemdict:dstack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_dup} +\index{systemdict_dup@\cfunc{systemdict\_dup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{dup}{systemdict:dup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_echeck} +\index{systemdict_echeck@\cfunc{systemdict\_echeck}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{echeck}{systemdict:echeck}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_egid} +\index{systemdict_egid@\cfunc{systemdict\_egid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{egid}{systemdict:egid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_end} +\index{systemdict_end@\cfunc{systemdict\_end}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{end}{systemdict:end}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_eq} +\index{systemdict_eq@\cfunc{systemdict\_eq}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{eq}{systemdict:eq}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_estack} +\index{systemdict_estack@\cfunc{systemdict\_estack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{estack}{systemdict:estack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_euid} +\index{systemdict_euid@\cfunc{systemdict\_euid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{euid}{systemdict:euid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_eval} +\index{systemdict_eval@\cfunc{systemdict\_eval}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{eval}{systemdict:eval}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_exch} +\index{systemdict_exch@\cfunc{systemdict\_exch}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{exch}{systemdict:exch}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_exec} +\index{systemdict_exec@\cfunc{systemdict\_exec}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{exec}{systemdict:exec}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_exit} +\index{systemdict_exit@\cfunc{systemdict\_exit}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{exit}{systemdict:exit}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_exp} +\index{systemdict_exp@\cfunc{systemdict\_exp}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{exp}{systemdict:exp}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_floor} +\index{systemdict_floor@\cfunc{systemdict\_floor}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{floor}{systemdict:floor}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_flush} +\index{systemdict_flush@\cfunc{systemdict\_flush}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{flush}{systemdict:flush}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_flushfile} +\index{systemdict_flushfile@\cfunc{systemdict\_flushfile}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{flushfile}{systemdict:flushfile}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_for} +\index{systemdict_for@\cfunc{systemdict\_for}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{for}{systemdict:for}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_foreach} +\index{systemdict_foreach@\cfunc{systemdict\_foreach}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{foreach}{systemdict:foreach}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_forkexec} +\index{systemdict_forkexec@\cfunc{systemdict\_forkexec}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{forkexec}{systemdict:forkexec}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ge} +\index{systemdict_ge@\cfunc{systemdict\_ge}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ge}{systemdict:ge}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_get} +\index{systemdict_get@\cfunc{systemdict\_get}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{get}{systemdict:get}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_getinterval} +\index{systemdict_getinterval@\cfunc{systemdict\_getinterval}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{getinterval}{systemdict:getinterval}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_gid} +\index{systemdict_gid@\cfunc{systemdict\_gid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{gid}{systemdict:gid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_gstderr} +\index{systemdict_gstderr@\cfunc{systemdict\_gstderr}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{gstderr}{systemdict:gstderr}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_gstdin} +\index{systemdict_gstdin@\cfunc{systemdict\_gstdin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{gstdin}{systemdict:gstdin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_gstdout} +\index{systemdict_gstdout@\cfunc{systemdict\_gstdout}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{gstdout}{systemdict:gstdout}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_gt} +\index{systemdict_gt@\cfunc{systemdict\_gt}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{gt}{systemdict:gt}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_hooktag} +\index{systemdict_hooktag@\cfunc{systemdict\_hooktag}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{hooktag}{systemdict:hooktag}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ibdup} +\index{systemdict_ibdup@\cfunc{systemdict\_ibdup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ibdup}{systemdict:ibdup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ibpop} +\index{systemdict_ibpop@\cfunc{systemdict\_ibpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ibpop}{systemdict:ibpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_idiv} +\index{systemdict_idiv@\cfunc{systemdict\_idiv}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{idiv}{systemdict:idiv}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_idup} +\index{systemdict_idup@\cfunc{systemdict\_idup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{idup}{systemdict:idup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_if} +\index{systemdict_if@\cfunc{systemdict\_if}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{if}{systemdict:if}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ifelse} +\index{systemdict_ifelse@\cfunc{systemdict\_ifelse}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ifelse}{systemdict:ifelse}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_inc} +\index{systemdict_inc@\cfunc{systemdict\_inc}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{inc}{systemdict:inc}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_iobuf} +\index{systemdict_iobuf@\cfunc{systemdict\_iobuf}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{iobuf}{systemdict:iobuf}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ipop} +\index{systemdict_ipop@\cfunc{systemdict\_ipop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ipop}{systemdict:ipop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_istack} +\index{systemdict_istack@\cfunc{systemdict\_istack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{istack}{systemdict:istack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_join} +\index{systemdict_join@\cfunc{systemdict\_join}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{join}{systemdict:join}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_known} +\index{systemdict_known@\cfunc{systemdict\_known}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{known}{systemdict:known}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_lcheck} +\index{systemdict_lcheck@\cfunc{systemdict\_lcheck}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{lcheck}{systemdict:lcheck}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_le} +\index{systemdict_le@\cfunc{systemdict\_le}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{le}{systemdict:le}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_length} +\index{systemdict_length@\cfunc{systemdict\_length}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{length}{systemdict:length}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_link} +\index{systemdict_link@\cfunc{systemdict\_link}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{link}{systemdict:link}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_listen} +\index{systemdict_listen@\cfunc{systemdict\_listen}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{listen}{systemdict:listen}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ln} +\index{systemdict_ln@\cfunc{systemdict\_ln}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ln}{systemdict:ln}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_load} +\index{systemdict_load@\cfunc{systemdict\_load}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{load}{systemdict:load}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_lock} +\index{systemdict_lock@\cfunc{systemdict\_lock}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{lock}{systemdict:lock}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_log} +\index{systemdict_log@\cfunc{systemdict\_log}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{log}{systemdict:log}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_loop} +\index{systemdict_loop@\cfunc{systemdict\_loop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{loop}{systemdict:loop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_lt} +\index{systemdict_lt@\cfunc{systemdict\_lt}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{lt}{systemdict:lt}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_match} +\index{systemdict_match@\cfunc{systemdict\_match}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{match}{systemdict:match}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_mkdir} +\index{systemdict_mkdir@\cfunc{systemdict\_mkdir}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{mkdir}{systemdict:mkdir}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_mkfifo} +\index{systemdict_mkfifo@\cfunc{systemdict\_mkfifo}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{mkfifo}{systemdict:mkfifo}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_mod} +\index{systemdict_mod@\cfunc{systemdict\_mod}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{mod}{systemdict:mod}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_modload} +\index{systemdict_modload@\cfunc{systemdict\_modload}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{modload}{systemdict:modload}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_monitor} +\index{systemdict_monitor@\cfunc{systemdict\_monitor}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{monitor}{systemdict:monitor}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_mul} +\index{systemdict_mul@\cfunc{systemdict\_mul}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{mul}{systemdict:mul}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_mutex} +\index{systemdict_mutex@\cfunc{systemdict\_mutex}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{mutex}{systemdict:mutex}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_nbpop} +\index{systemdict_nbpop@\cfunc{systemdict\_nbpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{nbpop}{systemdict:nbpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ncat} +\index{systemdict_ncat@\cfunc{systemdict\_ncat}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ncat}{systemdict:ncat}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ndn} +\index{systemdict_ndn@\cfunc{systemdict\_ndn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ndn}{systemdict:ndn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ndup} +\index{systemdict_ndup@\cfunc{systemdict\_ndup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ndup}{systemdict:ndup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ne} +\index{systemdict_ne@\cfunc{systemdict\_ne}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ne}{systemdict:ne}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_neg} +\index{systemdict_neg@\cfunc{systemdict\_neg}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{neg}{systemdict:neg}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_nip} +\index{systemdict_nip@\cfunc{systemdict\_nip}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{nip}{systemdict:nip}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_nonblocking} +\index{systemdict_nonblocking@\cfunc{systemdict\_nonblocking}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{nonblocking}{systemdict:nonblocking}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_not} +\index{systemdict_not@\cfunc{systemdict\_not}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{not}{systemdict:not}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_npop} +\index{systemdict_npop@\cfunc{systemdict\_npop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{npop}{systemdict:npop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_nsleep} +\index{systemdict_nsleep@\cfunc{systemdict\_nsleep}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{nsleep}{systemdict:nsleep}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_nup} +\index{systemdict_nup@\cfunc{systemdict\_nup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{nup}{systemdict:nup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_offset} +\index{systemdict_offset@\cfunc{systemdict\_offset}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{offset}{systemdict:offset}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_open} +\index{systemdict_open@\cfunc{systemdict\_open}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{open}{systemdict:open}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_or} +\index{systemdict_or@\cfunc{systemdict\_or}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{or}{systemdict:or}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ostack} +\index{systemdict_ostack@\cfunc{systemdict\_ostack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ostack}{systemdict:ostack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_over} +\index{systemdict_over@\cfunc{systemdict\_over}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{over}{systemdict:over}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_peername} +\index{systemdict_peername@\cfunc{systemdict\_peername}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{peername}{systemdict:peername}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_pid} +\index{systemdict_pid@\cfunc{systemdict\_pid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{pid}{systemdict:pid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_pipe} +\index{systemdict_pipe@\cfunc{systemdict\_pipe}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{pipe}{systemdict:pipe}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_poll} +\index{systemdict_poll@\cfunc{systemdict\_poll}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{poll}{systemdict:poll}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_pop} +\index{systemdict_pop@\cfunc{systemdict\_pop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{pop}{systemdict:pop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_pow} +\index{systemdict_pow@\cfunc{systemdict\_pow}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{pow}{systemdict:pow}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_ppid} +\index{systemdict_ppid@\cfunc{systemdict\_ppid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{ppid}{systemdict:ppid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_print} +\index{systemdict_print@\cfunc{systemdict\_print}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{print}{systemdict:print}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_put} +\index{systemdict_put@\cfunc{systemdict\_put}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{put}{systemdict:put}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_putinterval} +\index{systemdict_putinterval@\cfunc{systemdict\_putinterval}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{putinterval}{systemdict:putinterval}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_pwd} +\index{systemdict_pwd@\cfunc{systemdict\_pwd}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{pwd}{systemdict:pwd}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_quit} +\index{systemdict_quit@\cfunc{systemdict\_quit}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{quit}{systemdict:quit}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_rand} +\index{systemdict_rand@\cfunc{systemdict\_rand}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{rand}{systemdict:rand}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_read} +\index{systemdict_read@\cfunc{systemdict\_read}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{read}{systemdict:read}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_readline} +\index{systemdict_readline@\cfunc{systemdict\_readline}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{readline}{systemdict:readline}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_readlink} +\index{systemdict_readlink@\cfunc{systemdict\_readlink}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{readlink}{systemdict:readlink}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_realtime} +\index{systemdict_realtime@\cfunc{systemdict\_realtime}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{realtime}{systemdict:realtime}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_recv} +\index{systemdict_recv@\cfunc{systemdict\_recv}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{recv}{systemdict:recv}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_regex} +\index{systemdict_regex@\cfunc{systemdict\_regex}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{regex}{systemdict:regex}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_regsub} +\index{systemdict_regsub@\cfunc{systemdict\_regsub}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{regsub}{systemdict:regsub}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_rename} +\index{systemdict_rename@\cfunc{systemdict\_rename}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{rename}{systemdict:rename}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_repeat} +\index{systemdict_repeat@\cfunc{systemdict\_repeat}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{repeat}{systemdict:repeat}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_rmdir} +\index{systemdict_rmdir@\cfunc{systemdict\_rmdir}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{rmdir}{systemdict:rmdir}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_roll} +\index{systemdict_roll@\cfunc{systemdict\_roll}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{roll}{systemdict:roll}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_rot} +\index{systemdict_rot@\cfunc{systemdict\_rot}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{rot}{systemdict:rot}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_round} +\index{systemdict_round@\cfunc{systemdict\_round}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{round}{systemdict:round}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sadn} +\index{systemdict_sadn@\cfunc{systemdict\_sadn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sadn}{systemdict:sadn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_saup} +\index{systemdict_saup@\cfunc{systemdict\_saup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{saup}{systemdict:saup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sbdup} +\index{systemdict_sbdup@\cfunc{systemdict\_sbdup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sbdup}{systemdict:sbdup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sbpop} +\index{systemdict_sbpop@\cfunc{systemdict\_sbpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sbpop}{systemdict:sbpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sbpush} +\index{systemdict_sbpush@\cfunc{systemdict\_sbpush}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sbpush}{systemdict:sbpush}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sclear} +\index{systemdict_sclear@\cfunc{systemdict\_sclear}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sclear}{systemdict:sclear}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_scleartomark} +\index{systemdict_scleartomark@\cfunc{systemdict\_scleartomark}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{scleartomark}{systemdict:scleartomark}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_scount} +\index{systemdict_scount@\cfunc{systemdict\_scount}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{scount}{systemdict:scount}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_scounttomark} +\index{systemdict_scounttomark@\cfunc{systemdict\_scounttomark}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{scounttomark}{systemdict:scounttomark}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sdn} +\index{systemdict_sdn@\cfunc{systemdict\_sdn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sdn}{systemdict:sdn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sdup} +\index{systemdict_sdup@\cfunc{systemdict\_sdup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sdup}{systemdict:sdup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_seek} +\index{systemdict_seek@\cfunc{systemdict\_seek}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{seek}{systemdict:seek}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_self} +\index{systemdict_self@\cfunc{systemdict\_self}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{self}{systemdict:self}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_send} +\index{systemdict_send@\cfunc{systemdict\_send}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{send}{systemdict:send}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_serviceport} +\index{systemdict_serviceport@\cfunc{systemdict\_serviceport}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{serviceport}{systemdict:serviceport}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setegid} +\index{systemdict_setegid@\cfunc{systemdict\_setegid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setegid}{systemdict:setegid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setenv} +\index{systemdict_setenv@\cfunc{systemdict\_setenv}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setenv}{systemdict:setenv}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_seteuid} +\index{systemdict_seteuid@\cfunc{systemdict\_seteuid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{seteuid}{systemdict:seteuid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setgid} +\index{systemdict_setgid@\cfunc{systemdict\_setgid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setgid}{systemdict:setgid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setgstderr} +\index{systemdict_setgstderr@\cfunc{systemdict\_setgstderr}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setgstderr}{systemdict:setgstderr}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setgstdin} +\index{systemdict_setgstdin@\cfunc{systemdict\_setgstdin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setgstdin}{systemdict:setgstdin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setgstdout} +\index{systemdict_setgstdout@\cfunc{systemdict\_setgstdout}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setgstdout}{systemdict:setgstdout}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setiobuf} +\index{systemdict_setiobuf@\cfunc{systemdict\_setiobuf}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setiobuf}{systemdict:setiobuf}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setlocking} +\index{systemdict_setlocking@\cfunc{systemdict\_setlocking}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setlocking}{systemdict:setlocking}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setnonblocking} +\index{systemdict_setnonblocking@\cfunc{systemdict\_setnonblocking}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setnonblocking}{systemdict:setnonblocking}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setsockopt} +\index{systemdict_setsockopt@\cfunc{systemdict\_setsockopt}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setsockopt}{systemdict:setsockopt}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setstderr} +\index{systemdict_setstderr@\cfunc{systemdict\_setstderr}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setstderr}{systemdict:setstderr}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setstdin} +\index{systemdict_setstdin@\cfunc{systemdict\_setstdin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setstdin}{systemdict:setstdin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setstdout} +\index{systemdict_setstdout@\cfunc{systemdict\_setstdout}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setstdout}{systemdict:setstdout}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_setuid} +\index{systemdict_setuid@\cfunc{systemdict\_setuid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{setuid}{systemdict:setuid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sexch} +\index{systemdict_sexch@\cfunc{systemdict\_sexch}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sexch}{systemdict:sexch}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_shift} +\index{systemdict_shift@\cfunc{systemdict\_shift}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{shift}{systemdict:shift}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sibdup} +\index{systemdict_sibdup@\cfunc{systemdict\_sibdup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sibdup}{systemdict:sibdup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sibpop} +\index{systemdict_sibpop@\cfunc{systemdict\_sibpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sibpop}{systemdict:sibpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sidup} +\index{systemdict_sidup@\cfunc{systemdict\_sidup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sidup}{systemdict:sidup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_signal} +\index{systemdict_signal@\cfunc{systemdict\_signal}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{signal}{systemdict:signal}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sin} +\index{systemdict_sin@\cfunc{systemdict\_sin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sin}{systemdict:sin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sinh} +\index{systemdict_sinh@\cfunc{systemdict\_sinh}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sinh}{systemdict:sinh}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sipop} +\index{systemdict_sipop@\cfunc{systemdict\_sipop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sipop}{systemdict:sipop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_snbpop} +\index{systemdict_snbpop@\cfunc{systemdict\_snbpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{snbpop}{systemdict:snbpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sndn} +\index{systemdict_sndn@\cfunc{systemdict\_sndn}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sndn}{systemdict:sndn}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sndup} +\index{systemdict_sndup@\cfunc{systemdict\_sndup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sndup}{systemdict:sndup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_snip} +\index{systemdict_snip@\cfunc{systemdict\_snip}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{snip}{systemdict:snip}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_snpop} +\index{systemdict_snpop@\cfunc{systemdict\_snpop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{snpop}{systemdict:snpop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_snup} +\index{systemdict_snup@\cfunc{systemdict\_snup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{snup}{systemdict:snup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_socket} +\index{systemdict_socket@\cfunc{systemdict\_socket}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{socket}{systemdict:socket}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_socketpair} +\index{systemdict_socketpair@\cfunc{systemdict\_socketpair}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{socketpair}{systemdict:socketpair}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sockname} +\index{systemdict_sockname@\cfunc{systemdict\_sockname}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sockname}{systemdict:sockname}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sockopt} +\index{systemdict_sockopt@\cfunc{systemdict\_sockopt}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sockopt}{systemdict:sockopt}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sover} +\index{systemdict_sover@\cfunc{systemdict\_sover}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sover}{systemdict:sover}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_split} +\index{systemdict_split@\cfunc{systemdict\_split}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{split}{systemdict:split}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_spop} +\index{systemdict_spop@\cfunc{systemdict\_spop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{spop}{systemdict:spop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_spush} +\index{systemdict_spush@\cfunc{systemdict\_spush}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{spush}{systemdict:spush}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sqrt} +\index{systemdict_sqrt@\cfunc{systemdict\_sqrt}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sqrt}{systemdict:sqrt}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_srand} +\index{systemdict_srand@\cfunc{systemdict\_srand}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{srand}{systemdict:srand}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sroll} +\index{systemdict_sroll@\cfunc{systemdict\_sroll}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sroll}{systemdict:sroll}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_srot} +\index{systemdict_srot@\cfunc{systemdict\_srot}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{srot}{systemdict:srot}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stack} +\index{systemdict_stack@\cfunc{systemdict\_stack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stack}{systemdict:stack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_start} +\index{systemdict_start@\cfunc{systemdict\_start}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{start}{systemdict:start}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_status} +\index{systemdict_status@\cfunc{systemdict\_status}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{status}{systemdict:status}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stderr} +\index{systemdict_stderr@\cfunc{systemdict\_stderr}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stderr}{systemdict:stderr}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stdin} +\index{systemdict_stdin@\cfunc{systemdict\_stdin}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stdin}{systemdict:stdin}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stdout} +\index{systemdict_stdout@\cfunc{systemdict\_stdout}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stdout}{systemdict:stdout}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stop} +\index{systemdict_stop@\cfunc{systemdict\_stop}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stop}{systemdict:stop}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stopped} +\index{systemdict_stopped@\cfunc{systemdict\_stopped}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stopped}{systemdict:stopped}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_string} +\index{systemdict_string@\cfunc{systemdict\_string}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{string}{systemdict:string}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_stuck} +\index{systemdict_stuck@\cfunc{systemdict\_stuck}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{stuck}{systemdict:stuck}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sub} +\index{systemdict_sub@\cfunc{systemdict\_sub}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sub}{systemdict:sub}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_submatch} +\index{systemdict_submatch@\cfunc{systemdict\_submatch}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{submatch}{systemdict:submatch}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_subst} +\index{systemdict_subst@\cfunc{systemdict\_subst}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{subst}{systemdict:subst}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sunder} +\index{systemdict_sunder@\cfunc{systemdict\_sunder}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sunder}{systemdict:sunder}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sup} +\index{systemdict_sup@\cfunc{systemdict\_sup}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{sup}{systemdict:sup}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_sym_lp} +\index{systemdict_sym_lp@\cfunc{systemdict\_sym\_lp}{}} +\citem{\cfunc[void]{systemdict\_sym\_lp}{cw\_nxo\_t *a\_thread} +(``\htmlref{(}{systemdict:sym_lp}'')} +\label{systemdict_sym_rp} +\index{systemdict_sym_rp@\cfunc{systemdict\_sym\_rp}{}} +\citem{\cfunc[void]{systemdict\_sym\_rp}{cw\_nxo\_t *a\_thread} +(``\htmlref{)}{systemdict:sym_rp}'')} +\label{systemdict_sym_gt} +\index{systemdict_sym_gt@\cfunc{systemdict\_sym\_gt}{}} +\citem{\cfunc[void]{systemdict\_sym\_gt}{cw\_nxo\_t *a\_thread} +(``\htmlref{{\gt}}{systemdict:sym_gt}'')} +\label{systemdict_sym_rb} +\index{systemdict_sym_rb@\cfunc{systemdict\_sym\_rb}{}} +\citem{\cfunc[void]{systemdict\_sym\_rb}{cw\_nxo\_t *a\_thread} +(``\htmlref{{\rb}}{systemdict:sym_rb}'')} +\label{systemdict_symlink} +\index{systemdict_symlink@\cfunc{systemdict\_symlink}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{symlink}{systemdict:symlink}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_tan} +\index{systemdict_tan@\cfunc{systemdict\_tan}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{tan}{systemdict:tan}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_tanh} +\index{systemdict_tanh@\cfunc{systemdict\_tanh}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{tanh}{systemdict:tanh}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_tell} +\index{systemdict_tell@\cfunc{systemdict\_tell}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{tell}{systemdict:tell}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_test} +\index{systemdict_test@\cfunc{systemdict\_test}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{test}{systemdict:test}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_thread} +\index{systemdict_thread@\cfunc{systemdict\_thread}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{thread}{systemdict:thread}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_threadsdict} +\index{systemdict_threadsdict@\cfunc{systemdict\_threadsdict}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{threadsdict}{systemdict:threadsdict}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_threaddstack} +\index{systemdict_threaddstack@\cfunc{systemdict\_threaddstack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{threaddstack}{systemdict:threaddstack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_threadestack} +\index{systemdict_threadestack@\cfunc{systemdict\_threadestack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{threadestack}{systemdict:threadestack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_threadistack} +\index{systemdict_threadistack@\cfunc{systemdict\_threadistack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{threadistack}{systemdict:threadistack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_threadostack} +\index{systemdict_threadostack@\cfunc{systemdict\_threadostack}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{threadostack}{systemdict:threadostack}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_timedwait} +\index{systemdict_timedwait@\cfunc{systemdict\_timedwait}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{timedwait}{systemdict:timedwait}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_token} +\index{systemdict_token@\cfunc{systemdict\_token}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{token}{systemdict:token}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_trunc} +\index{systemdict_trunc@\cfunc{systemdict\_trunc}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{trunc}{systemdict:trunc}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_truncate} +\index{systemdict_truncate@\cfunc{systemdict\_truncate}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{truncate}{systemdict:truncate}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_trylock} +\index{systemdict_trylock@\cfunc{systemdict\_trylock}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{trylock}{systemdict:trylock}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_tuck} +\index{systemdict_tuck@\cfunc{systemdict\_tuck}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{tuck}{systemdict:tuck}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_type} +\index{systemdict_type@\cfunc{systemdict\_type}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{type}{systemdict:type}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_uid} +\index{systemdict_uid@\cfunc{systemdict\_uid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{uid}{systemdict:uid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_umask} +\index{systemdict_umask@\cfunc{systemdict\_umask}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{umask}{systemdict:umask}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_undef} +\index{systemdict_undef@\cfunc{systemdict\_undef}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{undef}{systemdict:undef}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_under} +\index{systemdict_under@\cfunc{systemdict\_under}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{under}{systemdict:under}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_unlink} +\index{systemdict_unlink@\cfunc{systemdict\_unlink}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{unlink}{systemdict:unlink}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_unlock} +\index{systemdict_unlock@\cfunc{systemdict\_unlock}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{unlock}{systemdict:unlock}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_unsetenv} +\index{systemdict_unsetenv@\cfunc{systemdict\_unsetenv}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{unsetenv}{systemdict:unsetenv}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_until} +\index{systemdict_until@\cfunc{systemdict\_until}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{until}{systemdict:until}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_up} +\index{systemdict_up@\cfunc{systemdict\_up}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{up}{systemdict:up}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_wait} +\index{systemdict_wait@\cfunc{systemdict\_wait}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{wait}{systemdict:wait}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_waitpid} +\index{systemdict_waitpid@\cfunc{systemdict\_waitpid}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{waitpid}{systemdict:waitpid}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_where} +\index{systemdict_where@\cfunc{systemdict\_where}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{where}{systemdict:where}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_while} +\index{systemdict_while@\cfunc{systemdict\_while}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{while}{systemdict:while}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_write} +\index{systemdict_write@\cfunc{systemdict\_write}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{write}{systemdict:write}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_xcheck} +\index{systemdict_xcheck@\cfunc{systemdict\_xcheck}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{xcheck}{systemdict:xcheck}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_xor} +\index{systemdict_xor@\cfunc{systemdict\_xor}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{xor}{systemdict:xor}}{cw\_nxo\_t +*a\_thread}} +\label{systemdict_yield} +\index{systemdict_yield@\cfunc{systemdict\_yield}{}} +\citem{\cfunc[void]{systemdict\_\htmlref{yield}{systemdict:yield}}{cw\_nxo\_t +*a\_thread}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thread: ] + Pointer to a thread. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + C interfaces to onyx operators. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/thd.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/thd.tex new file mode 100644 index 000000000..a560445d2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/thd.tex @@ -0,0 +1,260 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% thd portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{thd} +\label{thd} +\index{thd@\classname{thd}{}} + +The \classname{thd} class implements a wrapper around the system POSIX threads +library or GNU pth library. In most regards, this is a thin wrapper around the +normal threading functionality, but some extra information is kept in order to +allow implmentation of thread suspension/resumption, ``critical sections'', and +``single sections''. + +The suspendibility of each thread is determined by the arguments passed to +\cfunc{thd\_new}{}. The initial thread is always suspendible. Other threads +that are created via some mechanism other than \cfunc{thd\_new}{} are not +suspendible. + +Depending on how \libname{libonyx} is built, the additional functionality is +implemented with the aid of the \cvar{SIGUSR1} and \cvar{SIGUSR2} signals. As a +result, system calls may be interrupted by signals. The system calls will be +automatically restarted if they have made no progress at the time of +interruption, but will return a partial result otherwise. Therefore, if any of +the additional functionality is utilized, the application must be careful to +handle partial system call results. At least the following system calls can be +interrupted: \cfunc{read}{}, \cfunc{write}{}, \cfunc{sendto}{}, +\cfunc{recvfrom}{}, \cfunc{sendmsg}{}, \cfunc{recvmsg}{}, \cfunc{ioctl}{}, and +\cfunc{wait}{}. See the system documentation for additional information. + +\subsubsection{API} +\begin{capi} +\label{thd_new} +\index{thd_new@\cfunc{thd\_new}{}} +\citem{\cfunc[cw\_thd\_t *]{thd\_new}{void *(*a\_start\_func)(void *), void +*a\_arg, cw\_bool\_t a\_suspendible}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_start\_func: ] Pointer to a start function. + \item[a\_arg: ] Argument passed to \cfunc{a\_start\_func}{}. + \item[a\_suspendible: ] + \begin{description}\item[] + \item[FALSE: ] Not suspendible. + \item[TRUE: ] Suspendible. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] Pointer to a \classname{thd}. + \end{description} + \item[Exception(s): ] + \begin{description}\item[] + \item[\htmlref{CW\_ONYXX\_OOM}{CW_ONYXX_OOM}.] + \end{description} + \item[Description: ] + Constructor (creates a new thread). + \end{capilist} +\label{thd_delete} +\index{thd_delete@\cfunc{thd\_delete}{}} +\citem{\cfunc[void]{thd\_delete}{cw\_thd\_t *a\_thd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thd: ] Pointer to a \classname{thd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{thd_join} +\index{thd_join@\cfunc{thd\_join}{}} +\citem{\cfunc[void *]{thd\_join}{cw\_thd\_t *a\_thd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thd: ] Pointer to a \classname{thd}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Return value from thread entry function. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Join (wait for) the thread associated with \cvar{a\_thd}. + \end{capilist} +\label{thd_self} +\index{thd_self@\cfunc{thd\_self}{}} +\citem{\cfunc[cw\_thd\_t *]{thd\_self}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to the calling thread's \classname{thd} + structure. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return a pointer to the \classname{thd} structure that + corresponds to the calling thread. + \end{capilist} +\label{thd_yield} +\index{thd_yield@\cfunc{thd\_yield}{}} +\citem{\cfunc[void]{thd\_yield}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Give up the rest of the calling thread's time slice. + \end{capilist} +\label{thd_sigmask} +\index{thd_sigmask@\cfunc{thd\_sigmask}{}} +\citem{\cfunc[int]{thd\_sigmask}{int a\_how, const sigset\_t *a\_set, sigset\_t +*r\_oset}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_how: ] + \begin{description}\item[] + \item[SIG\_BLOCK: ] + Block signals in \cvar{a\_set}. + \item[SIG\_UNBLOCK: ] + Unblock signals in \cvar{a\_set}. + \item[SIG\_SETMASK: ] + Set signal mask to \cvar{a\_set}. + \end{description} + \item[a\_set: ] + Pointer to a signal set. + \item[r\_oset: ] + \begin{description}\item[] + \item[non-NULL: ] + Pointer space to store the old signal mask. + \item[NULL: ] + Ignored. + \end{description} + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Always zero, unless the arguments are invalid. + \item[*r\_oset: ] + Old signal set. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Set the calling thread's signal mask. + \end{capilist} +\label{thd_crit_enter} +\index{thd_crit_enter@\cfunc{thd\_crit\_enter}{}} +\citem{\cfunc[void]{thd\_crit\_enter}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Enter a critical region where the calling thread may not be + suspended by \cfunc{thd\_suspend}{}, \cfunc{thd\_trysuspend}{}, + or \cfunc{thd\_single\_enter}{}. + \end{capilist} +\label{thd_crit_leave} +\index{thd_crit_leave@\cfunc{thd\_crit\_leave}{}} +\citem{\cfunc[void]{thd\_crit\_leave}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Leave a critical section; the calling thread may once again be + suspended. + \end{capilist} +\label{thd_single_enter} +\index{thd_single_enter@\cfunc{thd\_single\_enter}{}} +\citem{\cfunc[void]{thd\_single\_enter}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Enter a critical region where all other suspendible threads must + be suspended. + \end{capilist} +\label{thd_single_leave} +\index{thd_single_leave@\cfunc{thd\_single\_leave}{}} +\citem{\cfunc[void]{thd\_single\_leave}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Leave a critical section where all other threads must be + suspended. All threads that were suspended in + \cfunc{thd\_single\_enter}{} are resumed. + \end{capilist} +\label{thd_suspend} +\index{thd_suspend@\cfunc{thd\_suspend}{}} +\citem{\cfunc[void]{thd\_suspend}{cw\_thd\_t *a\_thd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thd: ] + Pointer to a \classname{thd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Suspend \cvar{a\_thd}. + \end{capilist} +\label{thd_trysuspend} +\index{thd_trysuspend@\cfunc{thd\_trysuspend}{}} +\citem{\cfunc[cw\_bool\_t]{thd\_trysuspend}{cw\_thd\_t *a\_thd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thd: ] + Pointer to a \classname{thd}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + \begin{description}\item[] + \item[FALSE: ] + Success. + \item[TRUE: ] + Failure. + \end{description} + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Try to suspend \cvar{a\_thd}, but fail if it is in a critical + section. + \end{capilist} +\label{thd_resume} +\index{thd_resume@\cfunc{thd\_resume}{}} +\citem{\cfunc[void]{thd\_resume}{cw\_thd\_t *a\_thd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_thd: ] + Pointer to a \classname{thd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Resume (make runnable) \classname{a\_thd}. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/tsd.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/tsd.tex new file mode 100644 index 000000000..bfdecb751 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/tsd.tex @@ -0,0 +1,89 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% tsd portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{tsd} +\label{tsd} +\index{tsd@\classname{tsd}{}} + +The \classname{tsd} class implements thread-specific data. A \classname{tsd} +instance can be created, then any number of threads can use that same instance +to store and retrieve a thread-specific pointer to data. + +\subsubsection{API} +\begin{capi} +\label{tsd_new} +\index{tsd_new@\cfunc{tsd\_new}{}} +\citem{\cfunc[void]{tsd\_new}{cw\_tsd\_t *a\_tsd, void (*a\_func)(void *)}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_tsd: ] + Pointer to space for a \classname{tsd}. + \item[a\_func: ] + Pointer to a cleanup function, or NULL. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Constructor. + \end{capilist} +\label{tsd_delete} +\index{tsd_delete@\cfunc{tsd\_delete}{}} +\citem{\cfunc[void]{tsd\_delete}{cw\_tsd\_t *a\_tsd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_tsd: ] + Pointer to a \classname{tsd}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Destructor. + \end{capilist} +\label{tsd_get} +\index{tsd_get@\cfunc{tsd\_get}{}} +\citem{\cfunc[void *]{tsd\_get}{cw\_tsd\_t *a\_tsd}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_tsd: ] + Pointer to a \classname{tsd}. + \end{description} + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Pointer to thread-specific data. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Get thread-specific data pointer. + \end{capilist} +\label{tsd_set} +\index{tsd_set@\cfunc{tsd\_set}{}} +\citem{\cfunc[void]{tsd\_set}{cw\_tsd\_t *a\_tsd, void *a\_val}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_tsd: ] + Pointer to a \classname{tsd}. + \item[a\_val: ] + Pointer to thread-specific data. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Set thread-specific data pointer. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/xep.tex b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/xep.tex new file mode 100644 index 000000000..389a881f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/doc/latex/xep.tex @@ -0,0 +1,212 @@ +%-*-mode:latex-*- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Version: Onyx +% +% xep portion of Onyx Manual. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{xep} +\label{xep} +\index{xep@\classname{xep}{}} +The \classname{xep} class implements exception handling, with support for +\cppdef{xep\_try} and \cppmacro{xep\_catch}{} blocks. +Minimal use must include at least: +\begin{verbatim} +xep_begin(); +xep_try +{ + /* Code that might throw an exception. */ +} +xep_end(); +\end{verbatim} + +A more complete skeleton looks like: +\begin{verbatim} +xep_begin(); +xep_try +{ + /* Code that might throw an exception. */ +} +xep_catch(SOME_EXCEPTION) +{ + /* Handle exception... */ + xep_handled(); +} +xep_catch(ANOTHER_EXCEPTION) +xep_mcatch(YET_ANOTHER) +{ + /* React to exception, but propagate... */ +} +xep_acatch +{ + /* Handle all exceptions not explicitly handled above... */ + xep_handled(); +} +xep_end(); +\end{verbatim} + +Note that there is some serious cpp macro magic behind the \classname{xep} +interface, and as such, if usage deviates significantly from the above +templates, compiler errors may result. + +Exception values are of type \ctype{cw\_xepv\_t}. \cppdef{CW\_ONYXX\_MIN} to +\cppdef{CW\_ONYXX\_MAX} are reserved by \libname{libonyx}, and other ranges may +be reserved by other libraries. See their documentation for details. + +An exception is not implicitly handled if an exception handler is executed for +that exception. Instead, \cfunc{xep\_handled}{} must be manually called to +avoid propagating the exception up the handler chain. + +It is not legal to return from a function within an exception handling code +block, nor is it legal to jump out of an exception handling block; doing so will +corrupt the exception handler chain. + +\subsubsection{API} +\begin{capi} +\label{xep_begin} +\index{xep_begin@\cppmacro{xep\_begin}{}} +\citem{\cppmacro[void]{xep\_begin}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Begin an exception handling code block. + \end{capilist} +\label{xep_end} +\index{xep_end@\cppmacro{xep\_end}{}} +\citem{\cppmacro[void]{xep\_end}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + End an exception handling block. + \end{capilist} +\label{xep_try} +\index{xep_try@\cppdef{xep\_try}} +\citem{\cppdef{xep\_try} \dots} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Begin a block of code that is to be executed, with the + possibility that an exception might be thrown. + \end{capilist} +\label{xep_catch} +\index{xep_catch@\cppmacro{xep\_catch}{}} +\citem{\cppmacro{xep\_catch}{cw\_xepv\_t a\_xepv} \dots} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_xepv: ] + Exception number. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Begin a block of code that catches an exception. The exception + is not considered handled unless \cfunc{xep\_handled}{} is + called. + \end{capilist} +\label{xep_mcatch} +\index{xep_mcatch@\cppmacro{xep\_mcatch}{}} +\citem{\cppmacro{xep\_mcatch}{cw\_xepv\_t a\_xepv} \dots} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_xepv: ] + Exception number. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Begin a block of code that catches an exception. Must + immediately follow a \cfunc{xep\_catch}{} call. This interface + is used for the case where more than one exception type is to be + handled by the same code block. The exception is not considered + handled unless \cfunc{xep\_handled}{} is called. + \end{capilist} +\label{xep_acatch} +\index{xep_acatch@\cppdef{xep\_acatch}} +\citem{\cppdef{xep\_acatch} \dots} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Begin a block of code that catches all exceptions not explicitly + caught by \cppmacro{xep\_catch}{} and \cppmacro{xep\_mcatch}{} + blocks. There may only be one \cppdef{xep\_acatch} block within + a try/catch block. The exception is not considered handled + unless \cfunc{xep\_handled}{} is called. + \end{capilist} +\label{xep_value} +\index{xep_value@\cfunc{xep\_value}{}} +\citem{\cfunc[cw\_xepv\_t]{xep\_value}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] + \begin{description}\item[] + \item[retval: ] + Value of the current exception being handled. + \end{description} + \item[Exception(s): ] None. + \item[Description: ] + Return the value of the current exception being handled. + \end{capilist} +\label{xep_throw_e} +\label{xep_throw} +\index{xep_throw_e@\cfunc{xep\_throw\_e}{}} +\index{xep_throw@\cfunc{xep\_throw}{}} +\citem{\cfunc[void]{xep\_throw\_e}{cw\_xepv\_t a\_xepv, const char *a\_filename, +cw\_uint32\_t a\_line\_num}} +\citem{\cfunc[void]{xep\_throw}{cw\_xepv\_t a\_xepv}} + \begin{capilist} + \item[Input(s): ] + \begin{description}\item[] + \item[a\_xepv: ] + Exception number to throw. + \item[a\_filename: ] + Should be \cppdef{\_\_FILE\_\_}. + \item[a\_line\_num: ] + Should be \cppdef{\_\_LINE\_\_}. + \end{description} + \item[Output(s): ] None. + \item[Exception(s): ] + \begin{description}\item[] + \item[a\_xepv.] + \end{description} + \item[Description: ] + Throw an exception. + \end{capilist} +\label{xep_retry} +\index{xep_retry@\cfunc{xep\_retry}{}} +\citem{\cfunc[void]{xep\_retry}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Implicitly handle the current exception and retry the + \cppdef{xep\_try} code block. + \end{capilist} +\label{xep_handled} +\index{xep_handled@\cfunc{xep\_handled}{}} +\citem{\cfunc[void]{xep\_handled}{void}} + \begin{capilist} + \item[Input(s): ] None. + \item[Output(s): ] None. + \item[Exception(s): ] None. + \item[Description: ] + Mark the current exception as handled. + \end{capilist} +\end{capi} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/.cvsignore b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/.cvsignore new file mode 100644 index 000000000..3537d6280 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/.cvsignore @@ -0,0 +1,2 @@ +libonyx_defs.h +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/ch.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/ch.h new file mode 100644 index 000000000..f63588544 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/ch.h @@ -0,0 +1,140 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +/* Maintain counters used to get an idea of performance. */ +/* #define CW_CH_COUNT */ +#ifdef CW_CH_COUNT +/* Print counter values to stderr in ch_delete(). */ +/* #define CW_CH_VERBOSE */ +#endif + +/* Pseudo-opaque type. */ +typedef struct cw_ch_s cw_ch_t; +typedef struct cw_chi_s cw_chi_t; + +/* Declared here to avoid a circular dependency. */ +typedef struct cw_mem_s cw_mem_t; + +/* Internal container used by ch, one per item. chi's are internally linked to + * multiple ql's in order to implement various LIFO/FIFO orderings. */ +struct cw_chi_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#endif + /* If space for a chi wasn't passed into ch_insert(), this is TRUE. */ + cw_bool_t is_malloced; + + /* Key. */ + const void *key; + + /* Data. */ + const void *data; + + /* Link into the ch-wide list of chi's. */ + ql_elm(cw_chi_t) ch_link; + + /* Link into the slot's list of chi's. */ + ql_elm(cw_chi_t) slot_link; + + /* Slot number. */ + cw_uint32_t slot; +}; + +struct cw_ch_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#endif + +#ifdef CW_CH_COUNT + /* Counters used to get an idea of performance. */ + cw_uint64_t num_collisions; + cw_uint64_t num_inserts; + cw_uint64_t num_removes; + cw_uint64_t num_searches; +#endif + + /* Opaque allocation/deallocation pointers. */ + cw_opaque_alloc_t *alloc; + cw_opaque_dealloc_t *dealloc; + void *arg; + + /* TRUE if we malloced this structure internally. */ + cw_bool_t is_malloced; + + /* Head of the list of chi's. */ + ql_head(cw_chi_t) chi_ql; + + /* Total number of items. */ + cw_uint32_t count; + + /* Number of table slots. */ + cw_uint32_t table_size; + + /* Hashing and key comparison function pointers. */ + cw_uint32_t (*hash)(const void *); + cw_bool_t (*key_comp)(const void *, const void *); + + /* Must be last field, since it is used for array indexing of chi's beyond + * the end of the structure. */ + ql_head(cw_chi_t) table[1]; +}; + +/* Typedefs to allow easy function pointer passing. */ +typedef cw_uint32_t cw_ch_hash_t (const void *); +typedef cw_bool_t cw_ch_key_comp_t (const void *, const void *); + +/* Calculates ch size, given the number of hash table slots. Use this to + * calculate space allocation when passing pre-allocated space to ch_new(). */ +#define CW_CH_TABLE2SIZEOF(t) \ + (sizeof(cw_ch_t) + (((t) - 1) * sizeof(cw_chi_t *))) + +cw_ch_t * +ch_new(cw_ch_t *a_ch, cw_opaque_alloc_t *a_alloc, + cw_opaque_dealloc_t *a_dealloc, void *a_arg, cw_uint32_t a_table_size, + cw_ch_hash_t *a_hash, cw_ch_key_comp_t *a_key_comp); + +void +ch_delete(cw_ch_t *a_ch); + +cw_uint32_t +ch_count(cw_ch_t *a_ch); + +void +ch_insert(cw_ch_t *a_ch, const void *a_key, const void *a_data, + cw_chi_t *a_chi); + +cw_bool_t +ch_remove(cw_ch_t *a_ch, const void *a_search_key, void **r_key, void **r_data, + cw_chi_t **r_chi); + +cw_bool_t +ch_search(cw_ch_t *a_ch, const void *a_key, void **r_data); + +cw_bool_t +ch_get_iterate(cw_ch_t *a_ch, void **r_key, void **r_data); + +cw_bool_t +ch_remove_iterate(cw_ch_t *a_ch, void **r_key, void **r_data, cw_chi_t **r_chi); + +cw_uint32_t +ch_string_hash(const void *a_key); + +cw_uint32_t +ch_direct_hash(const void *a_key); + +cw_bool_t +ch_string_key_comp(const void *a_k1, const void *a_k2); + +cw_bool_t +ch_direct_key_comp(const void *a_k1, const void *a_k2); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/cnd.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/cnd.h new file mode 100644 index 000000000..1b07c1b40 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/cnd.h @@ -0,0 +1,43 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Pseudo-opaque type. */ +typedef struct cw_cnd_s cw_cnd_t; + +struct cw_cnd_s +{ +#ifdef CW_PTH + pth_cond_t condition; +#endif +#ifdef CW_PTHREADS + pthread_cond_t condition; +#endif +}; + +void +cnd_new(cw_cnd_t *a_cnd); + +void +cnd_delete(cw_cnd_t *a_cnd); + +void +cnd_signal(cw_cnd_t *a_cnd); + +void +cnd_broadcast(cw_cnd_t *a_cnd); + +cw_bool_t +cnd_timedwait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx, + const struct timespec *a_timeout); + +void +cnd_wait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/dch.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/dch.h new file mode 100644 index 000000000..fe58b185d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/dch.h @@ -0,0 +1,97 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifdef CW_CH_COUNT +/* Maintain counters used to get an idea of performance. */ +/* #define CW_DCH_COUNT */ +#ifdef CW_DCH_COUNT +/* Print counter values to stderr in dch_delete(). */ +/* #define CW_DCH_VERBOSE */ +#endif +#endif + +/* Pseudo-opaque type. */ +typedef struct cw_dch_s cw_dch_t; + +struct cw_dch_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#endif + +#ifdef CW_DCH_COUNT + /* Counters used to get an idea of performance. */ + cw_uint64_t num_grows; + cw_uint64_t num_shrinks; +#endif + + /* Opaque allocation/deallocation pointers. */ + cw_opaque_alloc_t *alloc; + cw_opaque_dealloc_t *dealloc; + void *arg; + + cw_bool_t is_malloced:1; + + /* Intial table size and high/low water marks. These values are used in + * proportion if the table grows. */ + cw_uint32_t base_table; + cw_uint32_t base_grow; + cw_uint32_t base_shrink; + + cw_bool_t shrinkable:1; + + /* (grow_factor * base_table) is the current table size. */ + cw_uint32_t grow_factor; + + /* Cached for later ch creation during rehashes. */ + cw_uint32_t (*hash)(const void *); + cw_bool_t (*key_comp)(const void *, const void *); + + /* Where all of the real work is done. */ + cw_ch_t *ch; +}; + +cw_dch_t * +dch_new(cw_dch_t *a_dch, cw_opaque_alloc_t *a_alloc, + cw_opaque_dealloc_t *a_dealloc, void *a_arg, cw_uint32_t a_base_table, + cw_uint32_t a_base_grow, cw_uint32_t a_base_shrink, + cw_ch_hash_t *a_hash, cw_ch_key_comp_t *a_key_comp); + +void +dch_delete(cw_dch_t *a_dch); + +cw_uint32_t +dch_count(cw_dch_t *a_dch); + +cw_bool_t +dch_shrinkable_get(cw_dch_t *a_dch); + +void +dch_shrinkable_set(cw_dch_t *a_dch, cw_bool_t a_shrinkable); + +void +dch_insert(cw_dch_t *a_dch, const void *a_key, const void *a_data, + cw_chi_t *a_chi); + +cw_bool_t +dch_remove(cw_dch_t *a_dch, const void *a_search_key, void **r_key, + void **r_data, cw_chi_t **r_chi); + +cw_bool_t +dch_search(cw_dch_t *a_dch, const void *a_key, void **r_data); + +cw_bool_t +dch_get_iterate(cw_dch_t *a_dch, void **r_key, void **r_data); + +cw_bool_t +dch_remove_iterate(cw_dch_t *a_dch, void **r_key, void **r_data, + cw_chi_t **r_chi); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/envdict_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/envdict_l.h new file mode 100644 index 000000000..cd1fa4e07 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/envdict_l.h @@ -0,0 +1,14 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +envdict_l_populate(cw_nxo_t *a_dict, cw_nx_t *a_nx, char **a_envp); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/gcdict.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/gcdict.h new file mode 100644 index 000000000..399a03364 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/gcdict.h @@ -0,0 +1,39 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +gcdict_active(cw_nxo_t *a_thread); + +void +gcdict_collect(cw_nxo_t *a_thread); + +#ifdef CW_PTHREADS +void +gcdict_period(cw_nxo_t *a_thread); +#endif + +void +gcdict_setactive(cw_nxo_t *a_thread); + +#ifdef CW_PTHREADS +void +gcdict_setperiod(cw_nxo_t *a_thread); +#endif + +void +gcdict_setthreshold(cw_nxo_t *a_thread); + +void +gcdict_stats(cw_nxo_t *a_thread); + +void +gcdict_threshold(cw_nxo_t *a_thread); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/gcdict_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/gcdict_l.h new file mode 100644 index 000000000..055268d86 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/gcdict_l.h @@ -0,0 +1,14 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +gcdict_l_populate(cw_nxo_t *a_dict, cw_nxa_t *a_nxa); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/libonyx.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/libonyx.h new file mode 100644 index 000000000..1e026b393 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/libonyx.h @@ -0,0 +1,444 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Master header file for libonyx. + * + ******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CW_LIBONYX_H_ +#define CW_LIBONYX_H_ + +#define CW_LIBONYX_VERSION "" + +/* Must be defined for pthreads. */ +#ifndef _REENTRANT +#define _REENTRANT +#endif + +#include "libonyx_defs.h" + +/* Global typedefs. */ + +#if (SIZEOF_SIGNED_CHAR == 1) +#define CW_TYPE_SINT8_DEFINED +typedef signed char cw_sint8_t; +#endif + +#if (SIZEOF_SIGNED_CHAR == 1) +#define CW_TYPE_UINT8_DEFINED +typedef unsigned char cw_uint8_t; +#endif + +#if (SIZEOF_SIGNED_SHORT == 2) +#define CW_TYPE_SINT16_DEFINED +typedef signed short cw_sint16_t; +#endif + +#if (SIZEOF_UNSIGNED_SHORT == 2) +#define CW_TYPE_UINT16_DEFINED +typedef unsigned short cw_uint16_t; +#endif + +#if (SIZEOF_INT == 4) +#define CW_TYPE_SINT32_DEFINED +typedef int cw_sint32_t; +#endif + +#if (SIZEOF_UNSIGNED == 4) +#define CW_TYPE_UINT32_DEFINED +typedef unsigned cw_uint32_t; +#endif + +#if (SIZEOF_LONG == 8) +#define CW_TYPE_SINT64_DEFINED +typedef long cw_sint64_t; +#endif + +#if (SIZEOF_UNSIGNED_LONG == 8) +#define CW_TYPE_UINT64_DEFINED +typedef unsigned long cw_uint64_t; +#endif + +#ifndef CW_TYPE_SINT64_DEFINED +#if (SIZEOF_LONG_LONG == 8) +#define CW_TYPE_SINT64_DEFINED +typedef long long cw_sint64_t; +#endif +#endif + +#ifndef CW_TYPE_UINT64_DEFINED +#if (SIZEOF_UNSIGNED_LONG_LONG == 8) +#define CW_TYPE_UINT64_DEFINED +typedef unsigned long long cw_uint64_t; +#endif +#endif + +#if (SIZEOF_FLOAT == 4) +#define CW_TYPE_FP32_DEFINED +typedef float cw_fp32_t; +#endif + +#if (SIZEOF_DOUBLE == 8) +#define CW_TYPE_FP64_DEFINED +typedef double cw_fp64_t; +#endif + +#ifndef CW_TYPE_FP64_DEFINED +#if (SIZEOF_LONG_DOUBLE == 8) +#define CW_TYPE_FP64_DEFINED +typedef long double cw_fp64_t; +#endif +#endif + +#if (!defined(CW_TYPE_SINT8_DEFINED) || !defined(CW_TYPE_UINT8_DEFINED) \ + || !defined(CW_TYPE_SINT16_DEFINED) || !defined(CW_TYPE_UINT16_DEFINED) \ + || !defined(CW_TYPE_SINT32_DEFINED) || !defined(CW_TYPE_UINT32_DEFINED) \ + || !defined(CW_TYPE_SINT64_DEFINED) || !defined(CW_TYPE_UINT64_DEFINED) \ + || !defined(CW_TYPE_FP32_DEFINED) || !defined(CW_TYPE_FP64_DEFINED)) +#error "Lacking mandatory typedefs" +#endif + +/* Definitions for booleans. */ +#ifndef FALSE +#define FALSE (0) +#endif +#ifndef TRUE +#define TRUE (1) +#endif + +typedef unsigned int cw_bool_t; + +/* Minimum initial size of dictionaries. This number shouldn't be too large, + * since for dictionaries below this size, an array is used internally instead + * of a hash table, which means that operations require linear searches. */ +#define CW_LIBONYX_DICT_SIZE 8 + +/* Maximum depth of estack. */ +#define CW_LIBONYX_ESTACK_MAX 256 + +/* Default file buffer size. */ +#define CW_LIBONYX_FILE_BUFFER_SIZE 512 + +/* Size of stack-allocated buffer to use when executing file objects. This + * generally doesn't need to be huge, because there is usually additional + * buffering going on upstream. */ +#define CW_LIBONYX_FILE_EVAL_READ_SIZE 128 + +/* Default minimum period of registration inactivity before a periodic + * collection is done (if any registrations have occured since the last + * collection). On average, the actual inactivity period will be 1.5 times + * this, but can range from 1 to 2 times this. */ +#define CW_LIBONYX_GCDICT_PERIOD 20 + +/* Default number of bytes of allocation since last collection that will cause + * an immediate collection. */ +#define CW_LIBONYX_GCDICT_THRESHOLD 262144 + +/* Initial size of globaldict. This is a bit arbitrary, and some applications + * could benefit from making it larger or smaller. */ +#define CW_LIBONYX_GLOBALDICT_HASH CW_LIBONYX_DICT_SIZE + +/* Initial size of onyxdict. Onyx uses this dictionary as a separate namespace + * for configuration parameters and variables that shouldn't normally be seen by + * dstack name lookups. */ +#define CW_LIBONYX_ONYXDICT_HASH CW_LIBONYX_DICT_SIZE + +/* Extra slots in systemdict left open at creation time. The embedded Onyx + * initialization code uses several slots, so if adding additional entries to + * systemdict and memory usage of the hash table is critical, it will be + * necessary to count the number of slots used by the embedded Onyx + * initialization code for the particular configuration, and add that number to + * the number of extra slots needed by the application. In general, there + * should be no reason to change this value though. */ +#define CW_LIBONYX_SYSTEMDICT_HASH_SPARE 16 + +/* Initial size of threadsdict. Most applications don't use many threads, so + * the initial size is set pretty low. */ +#define CW_LIBONYX_THREADSDICT_HASH CW_LIBONYX_DICT_SIZE + +/* Initial size initial name cache hash table. We know for sure that there will + * be about 250 names referenced by systemdict, errordict, and currenterror to + * begin with. */ +#define CW_LIBONYX_NAME_HASH 1024 + +/* Maximum number of stack elements to cache in a stack before reclaiming unused + * elements. */ +#define CW_LIBONYX_STACK_CACHE 16 + +/* Initial size of threaddict. */ +#define CW_LIBONYX_THREADDICT_HASH CW_LIBONYX_DICT_SIZE + +/* Initial size of dictionaries created with the dict operator. */ +#define CW_SYSTEMDICT_DICT_SIZE CW_LIBONYX_DICT_SIZE + +/* Exception numbers. libonyx reserves 0 through 127. */ +#define CW_ONYXX_MIN 0 +#define CW_ONYXX_MAX 127 + +/* Out of memory. */ +#define CW_ONYXX_OOM 2 +/* Internal use, for the exit operator. */ +#define CW_ONYXX_EXIT 3 +/* Internal use, for the stop operator, caught by the stopped operator. */ +#define CW_ONYXX_STOP 4 +/* Internal use, for the quit operator, caught by the start operator. */ +#define CW_ONYXX_QUIT 5 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include /* For htonl() and ntohl() on Darwin. */ +#endif +#ifdef HAVE_NETINET_IN_H +#include /* For htonl() and ntohl() on Darwin. */ +#endif +#ifdef HAVE_ARPA_INET_H +#include /* For htonl() and ntohl(). */ +#endif +#ifdef HAVE_MACHINE_ENDIAN_H +#include /* For htonl() and ntohl() on Darwin. */ +#endif +#ifdef CW_PTH +#include +#endif +#ifdef CW_PTHREADS +#include +#include +#include +#endif +#ifdef CW_MTHREADS +#include +#include +#include +#endif +#include +#include + +/* Generic typedef used for memory allocation hooks. This typedef is compatible + * with functions such as mem_malloc_e(). */ +typedef void *cw_opaque_alloc_t (const void *, size_t, const char *, + cw_uint32_t); + +/* Generic typedef used for memory reallocation hooks. This typedef is + * compatible with functions such as mem_realloc_e(). */ +typedef void *cw_opaque_realloc_t (const void *, void *, size_t, size_t, + const char *, cw_uint32_t); + +/* Generic typedef used for memory deallocation hooks. This typedef is + * compatible with functions such as mem_free_e(). */ +typedef void cw_opaque_dealloc_t (const void *, const void *, size_t, + const char *, cw_uint32_t); + +#include "qs.h" +#include "qr.h" +#include "ql.h" +#include "xep.h" +#ifdef CW_THREADS +#include "mtx.h" +#include "cnd.h" +#include "tsd.h" +#include "thd.h" +#endif +#include "mb.h" +#include "ch.h" +#include "dch.h" +#include "mem.h" +#ifdef CW_THREADS +#include "mq.h" +#endif + +/* libonyx initialization and shutdown function prototypes. */ +void +libonyx_init(void); + +void +libonyx_shutdown(void); + +/* Global variables. */ +extern cw_mem_t *cw_g_mem; + +#if (defined(CW_POSIX) && defined(CW_THREADS)) +extern cw_mtx_t cw_g_gethostbyname_mtx; +extern cw_mtx_t cw_g_getprotobyname_mtx; +extern cw_mtx_t cw_g_getservbyname_mtx; +#endif + +/* Used for deallocation via an opaque function pointer. These macros are used + * to call functions such as mem_free_e(). */ +#ifdef CW_DBG +#define cw_opaque_alloc(a_func, a_arg, a_size) \ + (a_func)((void *) (a_arg), (size_t) (a_size), __FILE__, __LINE__) +#define cw_opaque_realloc(a_func, a_ptr, a_arg, a_size, a_old_size) \ + (a_func)((void *) (a_arg), (void *) (a_ptr), (size_t) (a_size), \ + (size_t) (a_old_size), __FILE__, __LINE__) +#define cw_opaque_dealloc(a_func, a_arg, a_ptr, a_size) \ + (a_func)((void *) (a_arg), (void *) (a_ptr), (size_t) (a_size), \ + __FILE__, __LINE__) +#else +#define cw_opaque_alloc(a_func, a_arg, a_size) \ + (a_func)((void *) (a_arg), (size_t) (a_size), NULL, 0) +#define cw_opaque_realloc(a_func, a_ptr, a_arg, a_size, a_old_size) \ + (a_func)((void *) (a_arg), (void *) (a_ptr), (size_t) (a_size), \ + (size_t) (a_old_size), NULL, 0) +#define cw_opaque_dealloc(a_func, a_arg, a_ptr, a_size) \ + (a_func)((void *) (a_arg), (void *) (a_ptr), (size_t) (a_size), \ + NULL, 0) +#endif + +#ifdef WORDS_BIGENDIAN +#define cw_ntohq(a) (a) +#define cw_htonq(a) (a) +#else +#define cw_ntohq(a) \ + (cw_uint64_t) (((cw_uint64_t) (ntohl((cw_uint32_t) ((a) >> 32)))) \ + | (((cw_uint64_t) (ntohl((cw_uint32_t) \ + ((a) & 0x00000000ffffffff)))) << 32)) +#define cw_htonq(a) \ + (cw_uint64_t) (((cw_uint64_t) (htonl((cw_uint32_t) ((a) >> 32)))) \ + | (((cw_uint64_t) (htonl((cw_uint32_t) \ + ((a) & 0x00000000ffffffff)))) << 32)) +#endif + +/* assert()-alike. It's a bit prettier and cleaner, but the same idea. */ +#define cw_error(a) \ + do \ + { \ + fprintf(stderr, "%s:%u:%s(): Error: %s\n", __FILE__, \ + __LINE__, __FUNCTION__, a); \ + abort(); \ + } while (0) + +#ifdef CW_ASSERT +#define cw_not_reached() \ + do \ + { \ + fprintf(stderr, "%s:%u:%s(): Unreachable code reached\n", \ + __FILE__, __LINE__, __FUNCTION__); \ + abort(); \ + } while (0) + +#define cw_assert(a) \ + do \ + { \ + if (!(a)) \ + { \ + fprintf(stderr, "%s:%u:%s(): Failed assertion: \"%s\"\n", \ + __FILE__, __LINE__, __FUNCTION__, #a); \ + abort(); \ + } \ + } while (0) + +/* Macro to do the drudgery of assuring that a pointer is non-NULL. */ +#define cw_check_ptr(x) \ + do \ + { \ + if (((x) == NULL) || ((x) == (void *) 0xa5a5a5a5) \ + || ((x) == (void *) 0x5a5a5a5a)) \ + { \ + fprintf(stderr, "%s:%u:%s(): Invalid pointer: %s (%p)\n", \ + __FILE__, __LINE__, __FUNCTION__, #x, (x)); \ + abort(); \ + } \ + } while (0) +#else +#define cw_not_reached() +#define cw_assert(a) +#define cw_check_ptr(a) +#endif + +/* cw_dasssert() is used internally in places that the assertion should only + * be made if CW_DBG is defined, such as checking magic variables that only + * exist in that case. */ +#if (defined(CW_DBG) && defined(CW_ASSERT)) +#define cw_dassert(a) \ + do \ + { \ + if (!(a)) \ + { \ + fprintf(stderr, "%s:%u:%s(): Failed assertion: \"%s\"\n", \ + __FILE__, __LINE__, __FUNCTION__, #a); \ + abort(); \ + } \ + } while (0) +#else +#define cw_dassert(a) +#endif + +/* Convenience macro for determining the offset of a field within a + * structure. */ +#define cw_offsetof(a_type, a_field) \ + ((cw_uint32_t) &(((a_type *)NULL)->a_field)) + +#include "nxn.h" +#include "nxo.h" +#include "nxo_no.h" +#include "nxo_array.h" +#include "nxo_boolean.h" +#ifdef CW_THREADS +#include "nxo_condition.h" +#endif +#include "nxo_dict.h" +#include "nxo_file.h" +#include "nxo_fino.h" +#include "nxo_hook.h" +#include "nxo_integer.h" +#include "nxo_mark.h" +#ifdef CW_THREADS +#include "nxo_mutex.h" +#endif +#include "nxo_name.h" +#include "nxo_null.h" +#include "nxo_operator.h" +#include "nxo_pmark.h" +#ifdef CW_REAL +#include "nxo_real.h" +#endif +#ifdef CW_REGEX +#include "nxo_regex.h" +#include "nxo_regsub.h" +#endif +#include "nxa.h" +#include "nxo_stack.h" +#include "nxo_string.h" +#include "nxo_thread.h" +#include "nx.h" +#include "systemdict.h" +#include "gcdict.h" + +/* Convenience macro for static embedded onyx code. */ +#define cw_onyx_code(a_thread, a_code) \ + do \ + { \ + cw_nxo_threadp_t threadp; \ + static const cw_uint8_t code[] = (a_code); \ + \ + nxo_threadp_new(&threadp); \ + nxo_thread_interpret((a_thread), &threadp, code, \ + sizeof(code) - 1); \ + nxo_thread_flush((a_thread), &threadp); \ + nxo_threadp_delete(&threadp, (a_thread)); \ + } while (0) + +#endif /* CW_LIBONYX_H_ */ + +#ifdef __cplusplus +}; +#endif diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/libonyx_defs.h.in b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/libonyx_defs.h.in new file mode 100644 index 000000000..8d3535e6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/libonyx_defs.h.in @@ -0,0 +1,90 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#undef CW_DBG + +#ifndef CW_ASSERT +#undef CW_ASSERT +#endif + +/* Solaris needs this for sigwait(). */ +#undef _POSIX_PTHREAD_SEMANTICS + +/* GNU libc hides various prototypes, such as that for asprintf() unless this is + * defined. */ +#undef _GNU_SOURCE + +#undef WORDS_BIGENDIAN + +#undef CW_THREADS +#undef CW_PTHREADS +#undef CW_FTHREADS +#undef CW_MTHREADS +#undef CW_STHREADS +#undef CW_PTH + +#undef CW_REAL + +#undef CW_REGEX + +#undef CW_POSIX + +#undef CW_POSIX_FILE + +#undef CW_SOCKET + +#undef CW_MODULES + +/* If using gcc and inlines weren't disabled by configure, use inline + * functions. */ +#undef CW_USE_INLINES +#if (defined(__GNUC__) && defined(CW_USE_INLINES)) +#define CW_INLINE static __inline__ +#define CW_P_INLINE static __inline__ +#else +#define CW_INLINE +#define CW_P_INLINE static +#endif + +#undef CW_CPU_IA32 +#undef CW_CPU_PPC + +#undef SIZEOF_SIGNED_CHAR +#undef SIZEOF_UNSIGNED_CHAR +#undef SIZEOF_SIGNED_SHORT +#undef SIZEOF_UNSIGNED_SHORT +#undef SIZEOF_INT +#undef SIZEOF_UNSIGNED +#undef SIZEOF_LONG +#undef SIZEOF_UNSIGNED_LONG +#undef SIZEOF_LONG_LONG +#undef SIZEOF_UNSIGNED_LONG_LONG +#undef SIZEOF_INT_P +#undef SIZEOF_FLOAT +#undef SIZEOF_DOUBLE +#undef SIZEOF_LONG_DOUBLE + +#undef CW_HAVE_SOCKLEN_T +#undef CW_HAVE_DIRENT_NAMLEN +#undef CW_LIBONYX_USE_STAT_ATIMESPEC +#undef CW_LIBONYX_USE_STAT_MTIMESPEC +#undef CW_LIBONYX_USE_STAT_CTIMESPEC + +#undef HAVE_POLL +#undef HAVE_READDIR_R +#undef HAVE_UNSETENV +#undef HAVE_ASPRINTF + +#undef HAVE_SYS_SOCKET_H +#undef HAVE_NETINET_IN_H +#undef HAVE_ARPA_INET_H +#undef HAVE_MACHINE_ENDIAN_H diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mb.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mb.h new file mode 100644 index 000000000..bc75d8e87 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mb.h @@ -0,0 +1,94 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Memory barrier implementation. + * + ******************************************************************************/ + +#ifndef CW_THREADS +/* No memory barriers are necessary for single-threaded code. */ +#define mb_write() +#elif (defined CW_PTH) +/* No memory barriers are necessary for cooperative threading. */ +#define mb_write() +#else + +#ifndef CW_USE_INLINES +CW_INLINE void +mb_write(void); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_MB_C_)) + +#ifdef CW_CPU_IA32 +/* According to the Intel Architecture Software Developer's Manual, current + * processors execute instructions in order from the perspective of other + * processors in a multiprocessor system, but 1) Intel reserves the right to + * change that, and 2) the compiler's optimizer could re-order instructions if + * there weren't some form of barrier. Therefore, even if running on an + * architecture that does not need memory barriers (everything through at least + * i686), an "optimizer barrier" is necessary. */ +CW_INLINE void +mb_write(void) +{ +#if (0) + /* This is a true memory barrier. Benchmarks indicate a ~2.5x slowdown of + * Onyx with this enabled. */ + asm volatile ("push %%eax;" + "push %%ebx;" + "push %%ecx;" + "push %%edx;" + "xor %%eax,%%eax;" + "cpuid;" + "pop %%edx;" + "pop %%ecx;" + "pop %%ebx;" + "pop %%eax;" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +#else + /* This is hopefully enough to keep the compiler from reordering + * instructions around this one. */ + asm volatile ("nop;" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +#endif +} +#elif (defined(CW_CPU_PPC)) +CW_INLINE void +mb_write(void) +{ + asm volatile ("eieio" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +} +#else +/* This is much slower than a simple memory barrier, but the semantics of + * mutex unlock make this work. */ +CW_INLINE void +mb_write(void) +{ + cw_mtx_t mtx; + + mtx_new(&mtx); + mtx_lock(&mtx); + mtx_unlock(&mtx); + mtx_delete(&mtx); +} +#endif +#endif + +#endif /* (defined(CW_USE_INLINES) || defined(CW_MB_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mem.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mem.h new file mode 100644 index 000000000..931d07b63 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mem.h @@ -0,0 +1,111 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifdef CW_DBG +/* Track allocations and report leaks. */ +#define CW_MEM_ERROR +#ifdef CW_MEM_ERROR +/* Report all allocations. */ +/* #define CW_MEM_VERBOSE */ +#endif +#endif + +struct cw_mem_s +{ + /* Allocator for internal use. This can be used during debugging for + * finding leaks in the mem code itself. */ + cw_mem_t *mem; + + cw_bool_t is_malloced; + +#ifdef CW_THREADS + cw_mtx_t lock; +#endif + +#ifdef CW_MEM_ERROR +/* Slots in base hash table. */ +#define CW_MEM_BASE_TABLE 1024 +/* Maximum fullness of base table. */ +#define CW_MEM_BASE_GROW 256 +/* Proportional minimal fullness. */ +#define CW_MEM_BASE_SHRINK 32 + cw_dch_t *addr_hash; +#endif + + const void *handler_data; +}; + +cw_mem_t * +mem_new(cw_mem_t *a_mem, cw_mem_t *a_internal); + +void +mem_delete(cw_mem_t *a_mem); + +void * +mem_malloc_e(cw_mem_t *a_mem, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num); + +void * +mem_calloc_e(cw_mem_t *a_mem, size_t a_number, size_t a_size, const + char *a_filename, cw_uint32_t a_line_num); + +void * +mem_realloc_e(cw_mem_t *a_mem, void *a_ptr, size_t a_size, size_t + a_old_size, const char *a_filename, cw_uint32_t a_line_num); + +void +mem_free_e(cw_mem_t *a_mem, void *a_ptr, size_t a_size, + const char *a_filename, cw_uint32_t a_line_num); + +/* These macros are declared differently, depending on whether this is a debug + * library, because consistently using arguments of NULL and 0 reduces the size + * of the generated binary. Since these arguments aren't used in the optimized + * library anyway, this is a free (though perhaps small) memory savings. */ +#ifdef CW_MEM_ERROR +#define mem_malloc(a_mem, a_size) \ + mem_malloc_e((a_mem), (a_size), __FILE__, __LINE__) +#define mem_calloc(a_mem, a_number, a_size) \ + mem_calloc_e((a_mem), (a_number), (a_size), __FILE__, __LINE__) +#define mem_realloc(a_mem, a_ptr, a_size) \ + mem_realloc_e((a_mem), (a_ptr), (a_size), 0, __FILE__, __LINE__) +#define mem_free(a_mem, a_ptr) \ + mem_free_e((a_mem), (a_ptr), 0, __FILE__, __LINE__) + +#define cw_malloc(a_size) \ + mem_malloc_e(cw_g_mem, (a_size), __FILE__, __LINE__) +#define cw_calloc(a_number, a_size) \ + mem_calloc_e(cw_g_mem, (a_number), (a_size), __FILE__, __LINE__) +#define cw_realloc(a_ptr, a_size) \ + mem_realloc_e(cw_g_mem, (a_ptr), (a_size), 0, __FILE__, __LINE__) +#define cw_free(a_ptr) \ + mem_free_e(cw_g_mem, (a_ptr), 0, __FILE__, __LINE__) + +#else +#define mem_malloc(a_mem, a_size) \ + mem_malloc_e((a_mem), (a_size), NULL, 0) +#define mem_calloc(a_mem, a_number, a_size) \ + mem_calloc_e((a_mem), (a_number), (a_size), NULL, 0) +#define mem_realloc(a_mem, a_ptr, a_size) \ + mem_realloc_e((a_mem), (a_ptr), (a_size), 0, NULL, 0) +#define mem_free(a_mem, a_ptr) \ + mem_free_e((a_mem), (a_ptr), 0, NULL, 0) + +#define cw_malloc(a_size) \ + mem_malloc_e(cw_g_mem, (a_size), NULL, 0) +#define cw_calloc(a_number, a_size) \ + mem_calloc_e(cw_g_mem, (a_number), (a_size), NULL, 0) +#define cw_realloc(a_ptr, a_size) \ + mem_realloc_e(cw_g_mem, (a_ptr), (a_size), 0, NULL, 0) +#define cw_free(a_ptr) \ + mem_free_e(cw_g_mem, (a_ptr), 0, NULL, 0) + +#endif diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mq.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mq.h new file mode 100644 index 000000000..7f8aeed68 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mq.h @@ -0,0 +1,71 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Pseudo-opaque type. */ +typedef struct cw_mq_s cw_mq_t; + +struct cw_mq_s +{ + cw_mem_t *mem; +#ifdef CW_DBG + cw_uint32_t magic; +#endif + cw_uint32_t msg_count; + cw_uint32_t msg_size; + cw_uint32_t msgs_vec_count; + cw_uint32_t msgs_beg; + cw_uint32_t msgs_end; + union + { + cw_uint8_t *one; + cw_uint16_t *two; + cw_uint32_t *four; + cw_uint64_t *eight; + void *x; /* Don't care. */ + } msgs; + + cw_mtx_t lock; + cw_cnd_t cond; + + cw_bool_t get_stop; + cw_bool_t put_stop; +}; + +void +mq_new(cw_mq_t *a_mq, cw_mem_t *a_mem, cw_uint32_t a_msg_size); + +void +mq_delete(cw_mq_t *a_mq); + +cw_bool_t +mq_tryget(cw_mq_t *a_mq, ...); + +cw_bool_t +mq_timedget(cw_mq_t *a_mq, const struct timespec *a_timeout, ...); + +cw_bool_t +mq_get(cw_mq_t *a_mq, ...); + +cw_bool_t +mq_put(cw_mq_t *a_mq, ...); + +cw_bool_t +mq_get_start(cw_mq_t *a_mq); + +cw_bool_t +mq_get_stop(cw_mq_t *a_mq); + +cw_bool_t +mq_put_start(cw_mq_t *a_mq); + +cw_bool_t +mq_put_stop(cw_mq_t *a_mq); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mtx.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mtx.h new file mode 100644 index 000000000..39f08a7b7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/mtx.h @@ -0,0 +1,39 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Pseudo-opaque type. */ +typedef struct cw_mtx_s cw_mtx_t; + +struct cw_mtx_s +{ +#ifdef CW_PTH + pth_mutex_t mutex; +#endif +#ifdef CW_PTHREADS + pthread_mutex_t mutex; +#endif +}; + +void +mtx_new(cw_mtx_t *a_mtx); + +void +mtx_delete(cw_mtx_t *a_mtx); + +void +mtx_lock(cw_mtx_t *a_mtx); + +cw_bool_t +mtx_trylock(cw_mtx_t *a_mtx); + +void +mtx_unlock(cw_mtx_t *a_mtx); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nx.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nx.h new file mode 100644 index 000000000..896830269 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nx.h @@ -0,0 +1,177 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +struct cw_nx_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#define CW_NX_MAGIC 0xae9678fd +#endif + + cw_bool_t is_malloced; + + /* Used for remembering the current state of reference iteration. */ + cw_uint32_t ref_iter; + + /* Set to TRUE before the final garbage collection so that all objects get + * collected. */ + cw_bool_t shutdown; + + /* Global hash of names (key: {name, len}, value: (nxoe_name *)). This hash + * table keeps track of *all* name "values" in the virtual machine. When a + * name object is created, it actually adds a reference to a nxoe_name in + * this hash and uses a pointer to that nxoe_name as a unique key. */ +#ifdef CW_THREADS + cw_mtx_t name_lock; +#endif + cw_dch_t name_hash; + + /* Memory allocator. */ + cw_nxa_t nxa; + + /* Dictionaries. */ + cw_nxo_t threadsdict; + cw_nxo_t systemdict; + cw_nxo_t globaldict; +#ifdef CW_POSIX + cw_nxo_t envdict; +#endif + + /* Files. */ + cw_nxo_t stdin_nxo; + cw_nxo_t stdout_nxo; + cw_nxo_t stderr_nxo; + + /* Thread initialization hook. */ + cw_op_t *thread_init; +}; + +/* nx. */ +cw_nx_t * +nx_new(cw_nx_t *a_nx, cw_op_t *a_thread_init, int a_argc, char **a_argv, + char **a_envp); + +void +nx_delete(cw_nx_t *a_nx); + +void +nx_stdin_set(cw_nx_t *a_nx, cw_nxo_t *a_stdin); + +void +nx_stdout_set(cw_nx_t *a_nx, cw_nxo_t *a_stdout); + +void +nx_stderr_set(cw_nx_t *a_nx, cw_nxo_t *a_stderr); + +#ifndef CW_USE_INLINES +cw_nxa_t * +nx_nxa_get(cw_nx_t *a_nx); + +cw_nxo_t * +nx_threadsdict_get(cw_nx_t *a_nx); + +cw_nxo_t * +nx_systemdict_get(cw_nx_t *a_nx); + +cw_nxo_t * +nx_globaldict_get(cw_nx_t *a_nx); + +#ifdef CW_POSIX +cw_nxo_t * +nx_envdict_get(cw_nx_t *a_nx); +#endif + +cw_nxo_t * +nx_stdin_get(cw_nx_t *a_nx); + +cw_nxo_t * +nx_stdout_get(cw_nx_t *a_nx); + +cw_nxo_t * +nx_stderr_get(cw_nx_t *a_nx); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NX_C_)) +CW_INLINE cw_nxa_t * +nx_nxa_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->nxa; +} + +CW_INLINE cw_nxo_t * +nx_threadsdict_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->threadsdict; +} + +CW_INLINE cw_nxo_t * +nx_systemdict_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->systemdict; +} + +CW_INLINE cw_nxo_t * +nx_globaldict_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->globaldict; +} + +#ifdef CW_POSIX +CW_INLINE cw_nxo_t * +nx_envdict_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->envdict; +} +#endif + +CW_INLINE cw_nxo_t * +nx_stdin_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->stdin_nxo; +} + +CW_INLINE cw_nxo_t * +nx_stdout_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->stdout_nxo; +} + +CW_INLINE cw_nxo_t * +nx_stderr_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->stderr_nxo; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NX_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nx_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nx_l.h new file mode 100644 index 000000000..5673b2441 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nx_l.h @@ -0,0 +1,170 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +cw_nxoe_t * +nx_l_ref_iter(cw_nx_t *a_nx, cw_bool_t a_reset); + +void +nx_l_thread_insert(cw_nx_t *a_nx, cw_nxo_t *a_thread); + +void +nx_l_thread_remove(cw_nx_t *a_nx, cw_nxo_t *a_thread); + +#ifdef CW_THREADS +cw_mtx_t * +nx_l_name_lock_get(cw_nx_t *a_nx); +#endif + +cw_dch_t * +nx_l_name_hash_get(cw_nx_t *a_nx); + +cw_op_t * +nx_l_thread_init(cw_nx_t *a_nx); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NX_C_)) +CW_INLINE cw_nxoe_t * +nx_l_ref_iter(cw_nx_t *a_nx, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + if (a_nx->shutdown) + { + /* Return an empty root set so that the garbage collector will collect + * everything. */ + retval = NULL; + goto RETURN; + } + + if (a_reset) + { + a_nx->ref_iter = 0; + } + + for (retval = NULL; retval == NULL; a_nx->ref_iter++) + { + switch (a_nx->ref_iter) + { + case 0: + { + retval = nxo_nxoe_get(nxa_gcdict_get(&a_nx->nxa)); + break; + } + case 1: + { + retval = nxo_nxoe_get(&a_nx->threadsdict); + break; + } + case 2: + { + retval = nxo_nxoe_get(&a_nx->systemdict); + break; + } + case 3: + { + retval = nxo_nxoe_get(&a_nx->globaldict); + break; + } + case 4: + { + retval = nxo_nxoe_get(&a_nx->stdin_nxo); + break; + } + case 5: + { + retval = nxo_nxoe_get(&a_nx->stdout_nxo); + break; + } + case 6: + { + retval = nxo_nxoe_get(&a_nx->stderr_nxo); + break; + } +#ifdef CW_POSIX + case 7: + { + retval = nxo_nxoe_get(&a_nx->envdict); + break; + } +#endif + default: + { + retval = NULL; + goto RETURN; + } + } + } + + RETURN: + return retval; +} + +CW_INLINE void +nx_l_thread_insert(cw_nx_t *a_nx, cw_nxo_t *a_thread) +{ + cw_nxo_t nxo; + + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + cw_check_ptr(a_thread); + cw_assert(nxo_type_get(a_thread) == NXOT_THREAD); + + nxo_null_new(&nxo); + nxo_dict_def(&a_nx->threadsdict, a_nx, a_thread, &nxo); +} + +CW_INLINE void +nx_l_thread_remove(cw_nx_t *a_nx, cw_nxo_t *a_thread) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + cw_check_ptr(a_thread); + cw_assert(nxo_type_get(a_thread) == NXOT_THREAD); + + nxo_dict_undef(&a_nx->threadsdict, a_nx, a_thread); +} + +#ifdef CW_THREADS +CW_INLINE cw_mtx_t * +nx_l_name_lock_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->name_lock; +} +#endif + +CW_INLINE cw_dch_t * +nx_l_name_hash_get(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return &a_nx->name_hash; +} + +CW_INLINE cw_op_t * +nx_l_thread_init(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + return a_nx->thread_init; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NX_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxa.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxa.h new file mode 100644 index 000000000..ce631f43b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxa.h @@ -0,0 +1,142 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Memory allocator. */ +struct cw_nxa_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#define CW_NXA_MAGIC 0x63935743 +#endif +#ifdef CW_THREADS + /* Protects the gcdict_* fields and gc_pending. */ + cw_mtx_t lock; +#endif + + /* Dictionary that contains stats and flags, available from within the + * interpreter. */ + cw_nxo_t gcdict; + + /* Actual state of gcdict. */ + cw_bool_t gcdict_active; +#ifdef CW_PTHREADS + cw_nxoi_t gcdict_period; +#endif + cw_nxoi_t gcdict_threshold; + cw_nxoi_t gcdict_collections; + cw_nxoi_t gcdict_count; + cw_nxoi_t gcdict_current[3]; + cw_nxoi_t gcdict_maximum[3]; + cw_nxoi_t gcdict_sum[3]; + + /* Sequence set. */ +#ifdef CW_THREADS + cw_mtx_t seq_mtx; +#endif + ql_head(cw_nxoe_t) seq_set; + cw_bool_t white; /* Current value for white (alternates). */ + +#ifdef CW_PTHREADS + cw_mq_t gc_mq; +#endif + cw_bool_t gc_pending; + cw_bool_t gc_allocated; + + cw_nx_t *nx; +#ifdef CW_PTHREADS + cw_thd_t *gc_thd; +#endif +}; + +void * +nxa_malloc_e(cw_nxa_t *a_nxa, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num); + +void * +nxa_realloc_e(cw_nxa_t *a_nxa, void *a_ptr, size_t a_size, size_t + a_old_size, const char *a_filename, cw_uint32_t a_line_num); + +void +nxa_free_e(cw_nxa_t *a_nxa, void *a_ptr, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num); + +#ifdef CW_DBG +#define nxa_malloc(a_nxa, a_size) \ + nxa_malloc_e((a_nxa), (a_size), __FILE__, __LINE__) +#define nxa_realloc(a_nxa, a_ptr, a_size, a_old_size) \ + nxa_realloc_e((a_nxa), (a_ptr), (a_size), (a_old_size), __FILE__, __LINE__) +#define nxa_free(a_nxa, a_ptr, a_size) \ + nxa_free_e((a_nxa), (a_ptr), (a_size), __FILE__, __LINE__) +#else +#define nxa_malloc(a_nxa, a_size) \ + nxa_malloc_e((a_nxa), (a_size), NULL, 0) +#define nxa_realloc(a_nxa, a_ptr, a_size, a_old_size) \ + nxa_realloc_e((a_nxa), (a_ptr), (a_size), (a_old_size), NULL, 0) +#define nxa_free(a_nxa, a_ptr, a_size) \ + nxa_free_e((a_nxa), (a_ptr), (a_size), NULL, 0) +#endif + +void +nxa_collect(cw_nxa_t *a_nxa); + +cw_bool_t +nxa_active_get(cw_nxa_t *a_nxa); + +void +nxa_active_set(cw_nxa_t *a_nxa, cw_bool_t a_active); + +#ifdef CW_PTHREADS +cw_nxoi_t +nxa_period_get(cw_nxa_t *a_nxa); + +void +nxa_period_set(cw_nxa_t *a_nxa, cw_nxoi_t a_period); +#endif +cw_nxoi_t +nxa_threshold_get(cw_nxa_t *a_nxa); + +void +nxa_threshold_set(cw_nxa_t *a_nxa, cw_nxoi_t a_threshold); + +void +nxa_stats_get(cw_nxa_t *a_nxa, cw_nxoi_t *r_collections, cw_nxoi_t *r_count, + cw_nxoi_t *r_ccount, cw_nxoi_t *r_cmark, cw_nxoi_t *r_csweep, + cw_nxoi_t *r_mcount, cw_nxoi_t *r_mmark, cw_nxoi_t *r_msweep, + cw_nxoi_t *r_scount, cw_nxoi_t *r_smark, cw_nxoi_t *r_ssweep); + +#ifndef CW_USE_INLINES +cw_nx_t * +nxa_nx_get(cw_nxa_t *a_nxa); + +cw_nxo_t * +nxa_gcdict_get(cw_nxa_t *a_nxa); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXA_C_)) +CW_INLINE cw_nx_t * +nxa_nx_get(cw_nxa_t *a_nxa) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + return a_nxa->nx; +} + +CW_INLINE cw_nxo_t * +nxa_gcdict_get(cw_nxa_t *a_nxa) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + return &a_nxa->gcdict; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXA_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxa_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxa_l.h new file mode 100644 index 000000000..31e040c36 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxa_l.h @@ -0,0 +1,46 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifdef CW_THREADS +/* Enumeration of message types for the GC thread event loop. */ +typedef enum +{ + NXAM_NONE, + NXAM_COLLECT, + NXAM_RECONFIGURE, + NXAM_SHUTDOWN +} cw_nxam_t; +#endif + +#ifndef CW_THREADS +#endif + +void +nxa_l_new(cw_nxa_t *a_nxa, cw_nx_t *a_nx); + +void +nxa_l_shutdown(cw_nxa_t *a_nxa); + +void +nxa_l_delete(cw_nxa_t *a_nxa); + +void +nxa_l_gc_register(cw_nxa_t *a_nxa, cw_nxoe_t *a_nxoe); + +void +nxa_l_gc_reregister(cw_nxa_t *a_nxa, cw_nxoe_t *a_nxoe); + +void +nxa_l_count_adjust(cw_nxa_t *a_nxa, cw_nxoi_t a_adjust); + +cw_bool_t +nxa_l_white_get(cw_nxa_t *a_nxa); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxn.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxn.h new file mode 100644 index 000000000..c8fc282f0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxn.h @@ -0,0 +1,721 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Define some cpp magic to allow this file to be treated differently when + * included by nxn.c, so that cw_g_nx_names can be defined there. */ +#ifdef CW_NXN_C_ +#define NXN_XENTRY(a_nxn, a_str) a_str +#else +#define NXN_XENTRY(a_nxn, a_str) a_nxn +#endif +#define NXN_SENTRY(a_nxn, a_str) NXN_XENTRY(NXN_##a_nxn, a_str) +#define NXN_ENTRY(a_name) NXN_XENTRY(NXN_##a_name, #a_name) + +/* If nxn.c is including this file the second time, then the following is read + * as an array of string constants. Otherwise, it is read as an enumeration, + * which directly corresponds to the array of string constants. This trickery + * is lamentable, but is better than the alternative of maintaining the two + * representations separately. */ +#ifdef CW_NXN_C_ +const cw_uint8_t *cw_g_nx_names[] = +#else +extern const cw_uint8_t *cw_g_nx_names[]; +typedef enum +#endif +{ + NXN_SENTRY(ZERO, ""), + NXN_SENTRY(sym_lp, "("), + NXN_SENTRY(sym_rp, ")"), + NXN_SENTRY(sym_lt, "<"), + NXN_SENTRY(sym_gt, ">"), + NXN_SENTRY(sym_lb, "["), + NXN_SENTRY(sym_rb, "]"), +#ifdef CW_SOCKET + NXN_ENTRY(AF_INET), + NXN_ENTRY(AF_LOCAL), +#endif + NXN_ENTRY(abs), +#ifdef CW_SOCKET + NXN_ENTRY(accept), +#endif +#ifdef CW_REAL + NXN_ENTRY(acos), + NXN_ENTRY(acosh), +#endif + NXN_ENTRY(active), + NXN_ENTRY(add), +#ifdef CW_SOCKET + NXN_ENTRY(address), +#endif + NXN_ENTRY(adn), + NXN_ENTRY(and), + NXN_ENTRY(argcheck), + NXN_ENTRY(argv), + NXN_ENTRY(array), + NXN_ENTRY(arraytype), +#ifdef CW_REAL + NXN_ENTRY(asin), + NXN_ENTRY(asinh), + NXN_ENTRY(atan), + NXN_ENTRY(atan2), + NXN_ENTRY(atanh), +#endif +#ifdef CW_POSIX + NXN_ENTRY(atime), +#endif + NXN_ENTRY(aup), + NXN_ENTRY(bdup), + NXN_ENTRY(begin), + NXN_ENTRY(bind), +#ifdef CW_SOCKET + NXN_ENTRY(bindsocket), +#endif +#ifdef CW_POSIX + NXN_ENTRY(blksize), + NXN_ENTRY(blocks), +#endif + NXN_ENTRY(booleantype), + NXN_ENTRY(bpop), +#ifdef CW_THREADS + NXN_ENTRY(broadcast), +#endif + NXN_ENTRY(bytesavailable), +#ifdef CW_REGEX + NXN_ENTRY(c), +#endif + NXN_ENTRY(cat), +#ifdef CW_POSIX + NXN_ENTRY(cd), +#endif +#ifdef CW_REAL + NXN_ENTRY(ceiling), +#endif +#ifdef CW_POSIX + NXN_ENTRY(chmod), + NXN_ENTRY(chown), + NXN_ENTRY(chroot), +#endif + NXN_ENTRY(clear), + NXN_ENTRY(cleartomark), +#ifdef CW_POSIX + NXN_ENTRY(close), +#endif + NXN_ENTRY(collect), +#ifdef CW_THREADS + NXN_ENTRY(condition), + NXN_ENTRY(conditiontype), +#endif +#ifdef CW_SOCKET + NXN_ENTRY(connect), +#endif + NXN_ENTRY(copy), +#ifdef CW_REAL + NXN_ENTRY(cos), + NXN_ENTRY(cosh), +#endif + NXN_ENTRY(count), + NXN_ENTRY(countdstack), + NXN_ENTRY(countestack), + NXN_ENTRY(counttomark), +#ifdef CW_POSIX + NXN_ENTRY(ctime), +#endif + NXN_ENTRY(currentdict), +#ifdef CW_THREADS + NXN_ENTRY(currentlocking), +#endif +#ifdef CW_REAL + NXN_ENTRY(cvds), +#endif + NXN_ENTRY(cve), +#ifdef CW_REAL + NXN_ENTRY(cves), +#endif + NXN_ENTRY(cvlit), + NXN_ENTRY(cvn), + NXN_ENTRY(cvrs), + NXN_ENTRY(cvs), + NXN_ENTRY(cvx), + NXN_ENTRY(dec), + NXN_ENTRY(def), +#ifdef CW_THREADS + NXN_ENTRY(detach), +#endif +#ifdef CW_POSIX + NXN_ENTRY(dev), +#endif + NXN_ENTRY(dict), + NXN_ENTRY(dicttype), + NXN_ENTRY(die), +#ifdef CW_POSIX + NXN_ENTRY(dirforeach), +#endif +#ifdef CW_REAL + NXN_ENTRY(div), +#endif + NXN_ENTRY(dn), + NXN_ENTRY(dstack), + NXN_ENTRY(dup), + NXN_ENTRY(echeck), +#ifdef CW_POSIX + NXN_ENTRY(egid), +#endif + NXN_ENTRY(end), +#ifdef CW_POSIX + NXN_ENTRY(envdict), +#endif + NXN_ENTRY(eq), + NXN_ENTRY(errorname), + NXN_ENTRY(estack), + NXN_ENTRY(estackoverflow), +#ifdef CW_POSIX + NXN_ENTRY(euid), +#endif + NXN_ENTRY(eval), + NXN_ENTRY(exch), +#ifdef CW_POSIX + NXN_ENTRY(exec), +#endif + NXN_ENTRY(exit), +#ifdef CW_REAL + NXN_ENTRY(exp), +#endif + NXN_ENTRY(false), +#ifdef CW_POSIX + NXN_ENTRY(family), +#endif + NXN_ENTRY(filetype), + NXN_ENTRY(finotype), +#ifdef CW_REAL + NXN_ENTRY(floor), +#endif + NXN_ENTRY(flush), + NXN_ENTRY(flushfile), + NXN_ENTRY(for), + NXN_ENTRY(foreach), +#ifdef CW_POSIX + NXN_ENTRY(forkexec), +#endif +#ifdef CW_REGEX + NXN_ENTRY(g), +#endif + NXN_ENTRY(gcdict), + NXN_ENTRY(ge), + NXN_ENTRY(get), + NXN_ENTRY(getinterval), +#ifdef CW_POSIX + NXN_ENTRY(gid), +#endif + NXN_ENTRY(globaldict), +#ifdef CW_THREADS + NXN_ENTRY(gstderr), + NXN_ENTRY(gstdin), + NXN_ENTRY(gstdout), +#endif + NXN_ENTRY(gt), + NXN_ENTRY(hooktag), + NXN_ENTRY(hooktype), +#ifdef CW_POSIX + NXN_ENTRY(IPPROTO_IP), + NXN_ENTRY(IPPROTO_HOPOPTS), + NXN_ENTRY(IPPROTO_ICMP), + NXN_ENTRY(IPPROTO_IGMP), + NXN_ENTRY(IPPROTO_IPIP), + NXN_ENTRY(IPPROTO_TCP), + NXN_ENTRY(IPPROTO_EGP), + NXN_ENTRY(IPPROTO_PUP), + NXN_ENTRY(IPPROTO_UDP), + NXN_ENTRY(IPPROTO_IDP), + NXN_ENTRY(IPPROTO_TP), + NXN_ENTRY(IPPROTO_IPV6), + NXN_ENTRY(IPPROTO_ROUTING), + NXN_ENTRY(IPPROTO_FRAGMENT), + NXN_ENTRY(IPPROTO_RSVP), + NXN_ENTRY(IPPROTO_GRE), + NXN_ENTRY(IPPROTO_ESP), + NXN_ENTRY(IPPROTO_AH), + NXN_ENTRY(IPPROTO_ICMPV6), + NXN_ENTRY(IPPROTO_NONE), + NXN_ENTRY(IPPROTO_DSTOPTS), + NXN_ENTRY(IPPROTO_MTP), + NXN_ENTRY(IPPROTO_ENCAP), + NXN_ENTRY(IPPROTO_PIM), + NXN_ENTRY(IPPROTO_COMP), + NXN_ENTRY(IPPROTO_RAW), +#endif +#ifdef CW_REGEX + NXN_ENTRY(i), +#endif + NXN_ENTRY(ibdup), + NXN_ENTRY(ibpop), + NXN_ENTRY(idiv), + NXN_ENTRY(idup), + NXN_ENTRY(if), + NXN_ENTRY(ifelse), + NXN_ENTRY(inc), +#ifdef CW_POSIX + NXN_ENTRY(ino), +#endif + NXN_ENTRY(integertype), + NXN_ENTRY(invalidaccess), + NXN_ENTRY(invalidexit), + NXN_ENTRY(invalidfileaccess), + NXN_ENTRY(iobuf), + NXN_ENTRY(ioerror), + NXN_ENTRY(ipop), + NXN_ENTRY(istack), +#ifdef CW_THREADS + NXN_ENTRY(join), +#endif + NXN_ENTRY(known), +#ifdef CW_THREADS + NXN_ENTRY(lcheck), +#endif + NXN_ENTRY(le), + NXN_ENTRY(length), + NXN_ENTRY(limitcheck), +#ifdef CW_POSIX + NXN_ENTRY(link), +#endif +#ifdef CW_SOCKET + NXN_ENTRY(listen), +#endif +#ifdef CW_REAL + NXN_ENTRY(ln), +#endif + NXN_ENTRY(load), +#ifdef CW_THREADS + NXN_ENTRY(lock), +#endif +#ifdef CW_REAL + NXN_ENTRY(log), +#endif + NXN_ENTRY(loop), + NXN_ENTRY(lt), +#ifdef CW_SOCKET + NXN_ENTRY(MSG_OOB), + NXN_ENTRY(MSG_PEEK), + NXN_ENTRY(MSG_WAITALL), +#endif +#ifdef CW_REGEX + NXN_ENTRY(m), +#endif + NXN_ENTRY(mark), + NXN_ENTRY(marktype), +#ifdef CW_REGEX + NXN_ENTRY(match), +#endif +#ifdef CW_POSIX + NXN_ENTRY(mkdir), + NXN_ENTRY(mkfifo), +#endif + NXN_ENTRY(mod), +#ifdef CW_POSIX + NXN_ENTRY(mode), +#endif +#ifdef CW_MODULES + NXN_ENTRY(modload), +#endif +#ifdef CW_THREADS + NXN_ENTRY(monitor), +#endif +#ifdef CW_POSIX + NXN_ENTRY(mtime), +#endif + NXN_ENTRY(mul), +#ifdef CW_THREADS + NXN_ENTRY(mutex), + NXN_ENTRY(mutextype), +#endif + NXN_ENTRY(nametype), + NXN_ENTRY(nbpop), + NXN_ENTRY(ncat), + NXN_ENTRY(ndn), + NXN_ENTRY(ndup), + NXN_ENTRY(ne), +#ifdef CW_POSIX + NXN_ENTRY(neterror), +#endif + NXN_ENTRY(neg), + NXN_ENTRY(newerror), + NXN_ENTRY(nip), +#ifdef CW_POSIX + NXN_ENTRY(nlink), +#endif + NXN_ENTRY(nonblocking), + NXN_ENTRY(not), + NXN_ENTRY(npop), +#ifdef CW_POSIX + NXN_ENTRY(nsleep), +#endif + NXN_ENTRY(null), + NXN_ENTRY(nulltype), + NXN_ENTRY(nup), +#ifdef CW_REGEX + NXN_ENTRY(offset), +#endif +#ifdef CW_POSIX + NXN_ENTRY(on), +#endif + NXN_ENTRY(onyxdict), +#ifdef CW_POSIX + NXN_ENTRY(open), +#endif + NXN_ENTRY(operatortype), + NXN_ENTRY(or), + NXN_ENTRY(ostack), + NXN_ENTRY(over), +#ifdef CW_SOCKET + NXN_ENTRY(path), +#endif +#ifdef CW_POSIX + NXN_ENTRY(POLLERR), + NXN_ENTRY(POLLHUP), + NXN_ENTRY(POLLIN), + NXN_ENTRY(POLLNVAL), + NXN_ENTRY(POLLOUT), + NXN_ENTRY(POLLPRI), + NXN_ENTRY(POLLRDBAND), + NXN_ENTRY(POLLRDNORM), + NXN_ENTRY(POLLWRNORM), + NXN_ENTRY(POLLWRBAND), +#endif +#ifdef CW_SOCKET + NXN_ENTRY(peername), +#endif +#ifdef CW_PTHREADS + NXN_ENTRY(period), +#endif +#ifdef CW_POSIX + NXN_ENTRY(pid), +#endif + NXN_ENTRY(pmark), + NXN_ENTRY(pmarktype), +#ifdef CW_POSIX + NXN_ENTRY(pipe), + NXN_ENTRY(poll), +#endif + NXN_ENTRY(pop), +#ifdef CW_POSIX + NXN_ENTRY(port), +#endif + NXN_ENTRY(pow), +#ifdef CW_POSIX + NXN_ENTRY(ppid), +#endif + NXN_ENTRY(print), + NXN_ENTRY(product), + NXN_ENTRY(promptstring), + NXN_ENTRY(put), + NXN_ENTRY(putinterval), +#ifdef CW_POSIX + NXN_ENTRY(pwd), +#endif + NXN_ENTRY(quit), + NXN_ENTRY(rand), + NXN_ENTRY(rangecheck), +#ifdef CW_POSIX + NXN_ENTRY(rdev), +#endif + NXN_ENTRY(read), + NXN_ENTRY(readline), +#ifdef CW_POSIX + NXN_ENTRY(readlink), + NXN_ENTRY(realtime), +#endif +#ifdef CW_REAL + NXN_ENTRY(realtype), +#endif +#ifdef CW_SOCKET + NXN_ENTRY(recv), +#endif +#ifdef CW_REGEX + NXN_ENTRY(regex), + NXN_ENTRY(regexerror), + NXN_ENTRY(regextype), + NXN_ENTRY(regsub), + NXN_ENTRY(regsubtype), +#endif +#ifdef CW_POSIX + NXN_ENTRY(rename), +#endif + NXN_ENTRY(repeat), +#ifdef CW_POSIX + NXN_ENTRY(rmdir), +#endif + NXN_ENTRY(roll), + NXN_ENTRY(rot), +#ifdef CW_REAL + NXN_ENTRY(round), +#endif +#ifdef CW_SOCKET + NXN_ENTRY(SO_BROADCAST), + NXN_ENTRY(SO_DEBUG), + NXN_ENTRY(SO_DONTROUTE), + NXN_ENTRY(SO_ERROR), + NXN_ENTRY(SO_KEEPALIVE), + NXN_ENTRY(SO_LINGER), + NXN_ENTRY(SO_OOBINLINE), + NXN_ENTRY(SO_RCVBUF), + NXN_ENTRY(SO_RCVLOWAT), + NXN_ENTRY(SO_RCVTIMEO), + NXN_ENTRY(SO_REUSEADDR), +#ifdef SO_REUSEPORT + NXN_ENTRY(SO_REUSEPORT), +#endif + NXN_ENTRY(SO_SNDBUF), + NXN_ENTRY(SO_SNDLOWAT), + NXN_ENTRY(SO_SNDTIMEO), + NXN_ENTRY(SO_TYPE), + NXN_ENTRY(SOCK_DGRAM), + NXN_ENTRY(SOCK_RAW), + NXN_ENTRY(SOCK_STREAM), + NXN_ENTRY(SOL_SOCKET), +#endif +#ifdef CW_REGEX + NXN_ENTRY(s), +#endif + NXN_ENTRY(sadn), + NXN_ENTRY(saup), + NXN_ENTRY(sbdup), + NXN_ENTRY(sbpop), + NXN_ENTRY(sbpush), + NXN_ENTRY(sclear), + NXN_ENTRY(scleartomark), + NXN_ENTRY(scount), + NXN_ENTRY(scounttomark), + NXN_ENTRY(sdn), + NXN_ENTRY(sdup), +#ifdef CW_POSIX + NXN_ENTRY(seek), +#endif + NXN_ENTRY(self), +#ifdef CW_SOCKET + NXN_ENTRY(send), + NXN_ENTRY(serviceport), +#endif + NXN_ENTRY(setactive), +#ifdef CW_POSIX + NXN_ENTRY(setegid), + NXN_ENTRY(setenv), + NXN_ENTRY(seteuid), + NXN_ENTRY(setgid), +#endif +#ifdef CW_THREADS + NXN_ENTRY(setgstderr), + NXN_ENTRY(setgstdin), + NXN_ENTRY(setgstdout), +#endif + NXN_ENTRY(setiobuf), +#ifdef CW_THREADS + NXN_ENTRY(setlocking), +#endif + NXN_ENTRY(setnonblocking), +#ifdef CW_PTHREADS + NXN_ENTRY(setperiod), +#endif +#ifdef CW_SOCKET + NXN_ENTRY(setsockopt), +#endif + NXN_ENTRY(setstderr), + NXN_ENTRY(setstdin), + NXN_ENTRY(setstdout), + NXN_ENTRY(setthreshold), +#ifdef CW_POSIX + NXN_ENTRY(setuid), +#endif + NXN_ENTRY(sexch), + NXN_ENTRY(shift), + NXN_ENTRY(sibdup), + NXN_ENTRY(sibpop), + NXN_ENTRY(sidup), +#ifdef CW_THREADS + NXN_ENTRY(signal), +#endif +#ifdef CW_REAL + NXN_ENTRY(sin), + NXN_ENTRY(sinh), +#endif + NXN_ENTRY(sipop), +#ifdef CW_POSIX + NXN_ENTRY(size), +#endif + NXN_ENTRY(snbpop), + NXN_ENTRY(sndn), + NXN_ENTRY(sndup), + NXN_ENTRY(snip), + NXN_ENTRY(snpop), + NXN_ENTRY(snup), +#ifdef CW_SOCKET + NXN_ENTRY(socket), + NXN_ENTRY(socketpair), + NXN_ENTRY(sockname), + NXN_ENTRY(sockopt), +#endif + NXN_ENTRY(sover), +#ifdef CW_REGEX + NXN_ENTRY(split), +#endif + NXN_ENTRY(spop), + NXN_ENTRY(spush), +#ifdef CW_REAL + NXN_ENTRY(sqrt), +#endif +#ifdef CW_POSIX + NXN_ENTRY(srand), +#endif + NXN_ENTRY(sroll), + NXN_ENTRY(srot), + NXN_ENTRY(stack), + NXN_ENTRY(stacktype), + NXN_ENTRY(stackunderflow), + NXN_ENTRY(start), + NXN_ENTRY(stats), +#ifdef CW_POSIX + NXN_ENTRY(status), +#endif + NXN_ENTRY(stdin), + NXN_ENTRY(stderr), + NXN_ENTRY(stdout), + NXN_ENTRY(stop), + NXN_ENTRY(stopped), + NXN_ENTRY(string), + NXN_ENTRY(stringtype), + NXN_ENTRY(stuck), + NXN_ENTRY(sub), +#ifdef CW_REGEX + NXN_ENTRY(submatch), + NXN_ENTRY(subst), +#endif + NXN_ENTRY(sunder), + NXN_ENTRY(sup), +#ifdef CW_POSIX + NXN_ENTRY(symlink), +#endif + NXN_ENTRY(syntaxerror), + NXN_ENTRY(system), + NXN_ENTRY(systemdict), +#ifdef CW_REAL + NXN_ENTRY(tan), + NXN_ENTRY(tanh), +#endif + NXN_ENTRY(tell), +#ifdef CW_POSIX + NXN_ENTRY(test), +#endif +#ifdef CW_THREADS + NXN_ENTRY(thread), +#endif + NXN_ENTRY(threaddstack), + NXN_ENTRY(threadestack), + NXN_ENTRY(threadistack), + NXN_ENTRY(threadostack), + NXN_ENTRY(threadsdict), + NXN_ENTRY(threadtype), + NXN_ENTRY(threshold), + NXN_ENTRY(throw), +#ifdef CW_POSIX + NXN_ENTRY(time), +#endif +#ifdef CW_THREADS + NXN_ENTRY(timedwait), +#endif + NXN_ENTRY(token), + NXN_ENTRY(true), +#ifdef CW_REAL + NXN_ENTRY(trunc), +#endif +#ifdef CW_POSIX + NXN_ENTRY(truncate), +#endif +#ifdef CW_THREADS + NXN_ENTRY(trylock), +#endif + NXN_ENTRY(tuck), + NXN_ENTRY(type), + NXN_ENTRY(typecheck), +#ifdef CW_POSIX + NXN_ENTRY(uid), + NXN_ENTRY(umask), +#endif + NXN_ENTRY(undef), + NXN_ENTRY(undefined), + NXN_ENTRY(undefinedfilename), + NXN_ENTRY(undefinedresult), + NXN_ENTRY(under), +#ifdef CW_POSIX + NXN_ENTRY(unlink), +#endif +#ifdef CW_THREADS + NXN_ENTRY(unlock), +#endif + NXN_ENTRY(unmatchedfino), + NXN_ENTRY(unmatchedmark), + NXN_ENTRY(unregistered), +#ifdef CW_POSIX + NXN_ENTRY(unsetenv), +#endif + NXN_ENTRY(until), + NXN_ENTRY(up), + NXN_ENTRY(version), +#ifdef CW_THREADS + NXN_ENTRY(wait), +#endif +#ifdef CW_POSIX + NXN_ENTRY(waitpid), +#endif + NXN_ENTRY(where), + NXN_ENTRY(while), + NXN_ENTRY(write), + NXN_ENTRY(xcheck), + NXN_ENTRY(xor) +#ifdef CW_THREADS + , + NXN_ENTRY(yield) +#define NXN_LAST NXN_yield +#else +#define NXN_LAST NXN_xor +#endif +} +#ifndef CW_NXN_C_ +cw_nxn_t +#endif +; + +#ifndef CW_USE_INLINES +const cw_uint8_t *nxn_str(cw_nxn_t a_nxn); +cw_uint32_t nxn_len(cw_nxn_t a_nxn); +#endif + +#if (defined(CW_USE_INLINES) && !defined(CW_NXN_C_) \ + || (!defined(CW_USE_INLINES) && defined(CW_NXN_C_))) +CW_INLINE const cw_uint8_t * +nxn_str(cw_nxn_t a_nxn) +{ + cw_assert(a_nxn > NXN_ZERO && a_nxn <= NXN_LAST); + + return cw_g_nx_names[a_nxn]; +} + +CW_INLINE cw_uint32_t +nxn_len(cw_nxn_t a_nxn) +{ + cw_assert(a_nxn > NXN_ZERO && a_nxn <= NXN_LAST); + + return strlen((const char *) cw_g_nx_names[a_nxn]); +} +#endif /* (defined(CW_USE_INLINES) && !defined(CW_NXN_C_) \ + * || (!defined(CW_USE_INLINES) && defined(CW_NXN_C_))) */ + +#undef NXN_ENTRY +#undef NXN_SENTRY +#undef NXN_XENTRY diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo.h new file mode 100644 index 000000000..651d66351 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo.h @@ -0,0 +1,250 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxo_s cw_nxo_t; +typedef struct cw_nxoe_s cw_nxoe_t; + +/* Declared here to avoid circular header dependencies. */ +typedef struct cw_nx_s cw_nx_t; +typedef struct cw_nxa_s cw_nxa_t; +typedef void cw_op_t(cw_nxo_t *); + +typedef enum +{ + NXOT_NO, + NXOT_ARRAY, + NXOT_BOOLEAN, +#ifdef CW_THREADS + NXOT_CONDITION, +#endif + NXOT_DICT, + NXOT_FILE, + NXOT_FINO, + NXOT_HOOK, + NXOT_INTEGER, + NXOT_MARK, +#ifdef CW_THREADS + NXOT_MUTEX, +#endif + NXOT_NAME, + NXOT_NULL, + NXOT_OPERATOR, + NXOT_PMARK, +#ifdef CW_REAL + NXOT_REAL, +#endif +#ifdef CW_REGEX + NXOT_REGEX, + NXOT_REGSUB, +#endif + NXOT_STACK, + NXOT_STRING, + NXOT_THREAD +#define NXOT_LAST NXOT_THREAD +} cw_nxot_t; + +/* Attribute. */ +typedef enum +{ + NXOA_LITERAL, + NXOA_EXECUTABLE, + NXOA_EVALUATABLE +} cw_nxoa_t; + +typedef cw_sint64_t cw_nxoi_t; +typedef cw_fp64_t cw_nxor_t; + +/* Main object structure. */ +struct cw_nxo_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#define CW_NXO_MAGIC 0x398754ba +#endif + + /* We can't use bit fields here, since we need explicit knowledge of + * structure layout to avoid GC races in nxo_dup() and nxo_p_new(). + * Therefore, use a single 32 bit variable and do the bit manipulation + * manually. + * + * . : Unused. + * + * C : Op code. If this is an operator, and NXN_ZERO < op code <= NXN_LAST, + * op code corresponds to the name of this operator. This can be used + * to print the operator name. + * + * A : Attribute. An nxo is LITERAL, EXECUTABLE, or EVALUATABLE. + * + * B : Array bound. TRUE if the bind operator has processed this array. + * This is used to avoid infinite recursion in the bind operator + * when binding recursive procedures. + * + * T : Type. + * + * ........ ......CC CCCCCCCC AABTTTTT + * */ + cw_uint32_t flags; + + union + { + struct + { + cw_bool_t val; + } boolean; + struct + { + cw_nxoi_t i; + } integer; + struct + { + cw_nxor_t r; + } real; + struct + { + cw_op_t *f; + } oper; + cw_nxoe_t *nxoe; + } o; +}; + +/* All extended type objects contain a nxoe. This provides a poor man's + * inheritance. Since onyx's type system is non-extensible, this idiom is + * adequate. */ +struct cw_nxoe_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#define CW_NXOE_MAGIC 0x0fa6e798 +#endif + + /* Linkage for GC. All nxoe's are in a single ring, which the GC uses to + * implement a Baker's Treadmill collector. */ + qr(cw_nxoe_t) link; + + /* Object type. We store this in nxoe's as well as nxo's, since various + * functions access nxoe's directly, rather than going through a referring + * nxo. */ + cw_nxot_t type:5; + + /* If TRUE, the string in the key is statically allocated, and should not be + * deallocated during destruction. */ + cw_bool_t name_static:1; + + /* The GC toggles this value at each collection in order to maintain + * state. */ + cw_bool_t color:1; + + /* TRUE if this object has been registered with the GC. It is possible for + * an object to be reachable by the GC (on a stack, for instance), but not + * be registered yet. */ + cw_bool_t registered:1; + +#ifdef CW_THREADS + /* If true, accesses to this object are locked. This applies to arrays, + * dictionaries, files, and strings. */ + cw_bool_t locking:1; +#endif + + /* If TRUE, this nxoe is a reference to another nxoe. */ + cw_bool_t indirect:1; +}; + +cw_sint32_t +nxo_compare(const cw_nxo_t *a_a, const cw_nxo_t *a_b); + +cw_nxoe_t * +nxo_nxoe_get(const cw_nxo_t *a_nxo); + +#ifdef CW_THREADS +cw_bool_t +nxo_lcheck(cw_nxo_t *a_nxo); +#endif + +#ifndef CW_USE_INLINES +void +nxo_dup(cw_nxo_t *a_to, cw_nxo_t *a_from); + +cw_nxot_t +nxo_type_get(const cw_nxo_t *a_nxo); + +cw_nxoa_t +nxo_attr_get(const cw_nxo_t *a_nxo); + +void +nxo_attr_set(cw_nxo_t *a_nxo, cw_nxoa_t a_attr); + +void +nxo_p_new(cw_nxo_t *a_nxo, cw_nxot_t a_type); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_C_)) +CW_INLINE void +nxo_dup(cw_nxo_t *a_to, cw_nxo_t *a_from) +{ + cw_check_ptr(a_to); + cw_dassert(a_to->magic == CW_NXO_MAGIC); + + cw_check_ptr(a_from); + cw_dassert(a_from->magic == CW_NXO_MAGIC); + + /* The order of operations is important in order to avoid a GC race. */ + a_to->flags = 0; + mb_write(); + a_to->o = a_from->o; + mb_write(); + a_to->flags = a_from->flags; +} + +CW_INLINE cw_nxot_t +nxo_type_get(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + return ((cw_nxot_t)(a_nxo->flags & 0x1f)); +} + +CW_INLINE cw_nxoa_t +nxo_attr_get(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + return ((cw_nxoa_t)(((a_nxo)->flags >> 6) & 3)); +} + +CW_INLINE void +nxo_attr_set(cw_nxo_t *a_nxo, cw_nxoa_t a_attr) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + a_nxo->flags = (a_nxo->flags & 0xffffff3f) | (a_attr << 6); +} + +/* Private, but various object constructor macros need its definition. */ +CW_INLINE void +nxo_p_new(cw_nxo_t *a_nxo, cw_nxot_t a_type) +{ + /* The order of operations is important in order to avoid a GC race. */ + a_nxo->flags = 0; +#ifdef CW_DBG + a_nxo->magic = CW_NXO_MAGIC; +#endif + + /* o.integer.i is assumed to be at least as big as all the other fields in + * the union. */ + a_nxo->o.integer.i = 0; + mb_write(); + a_nxo->flags = a_type; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_array.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_array.h new file mode 100644 index 000000000..f3530fa09 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_array.h @@ -0,0 +1,31 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +nxo_array_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, + cw_uint32_t a_len); + +void +nxo_array_subarray_new(cw_nxo_t *a_nxo, cw_nxo_t *a_array, cw_nx_t *a_nx, + cw_uint32_t a_offset, cw_uint32_t a_len); + +void +nxo_array_copy(cw_nxo_t *a_to, cw_nxo_t *a_from); + +cw_uint32_t +nxo_array_len_get(const cw_nxo_t *a_nxo); + +void +nxo_array_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_nxo_t *r_el); + +void +nxo_array_el_set(cw_nxo_t *a_nxo, cw_nxo_t *a_el, cw_nxoi_t a_offset); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_array_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_array_l.h new file mode 100644 index 000000000..c5efad699 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_array_l.h @@ -0,0 +1,210 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* This is private, but is exposed here to make inlining nxo_array_el_get() + * possible. nxo_thread_loop() calls nxo_array_el_get() a lot, so this is + * critical to performance. */ +typedef struct cw_nxoe_array_s cw_nxoe_array_t; +struct cw_nxoe_array_s +{ + cw_nxoe_t nxoe; +#ifdef CW_THREADS + /* Access is locked if this object has the locking bit set. Indirect + * arrays aren't locked. */ + cw_mtx_t lock; +#endif + union + { + struct + { + cw_nxoe_array_t *array; + cw_uint32_t beg_offset; + cw_uint32_t len; + } i; + struct + { + cw_nxo_t *arr; + cw_uint32_t len; + cw_uint32_t alloc_len; + } a; + } e; +}; + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_array_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_array_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); + +#define nxo_l_array_el_get nxo_array_el_get + +void +nxo_l_array_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_nxo_t *r_el); + +cw_bool_t +nxo_l_array_bound_get(const cw_nxo_t *a_nxo); + +void +nxo_l_array_bound_set(cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_ARRAY_C_)) +CW_INLINE cw_bool_t +nxoe_l_array_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_array_t *array; + + array = (cw_nxoe_array_t *) a_nxoe; + + cw_check_ptr(array); + cw_dassert(array->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(array->nxoe.type == NXOT_ARRAY); + + if (array->nxoe.indirect == FALSE && array->e.a.alloc_len > 0) + { + nxa_free(a_nxa, array->e.a.arr, + array->e.a.alloc_len * sizeof(cw_nxo_t)); + } + +#ifdef CW_THREADS + if (array->nxoe.locking && array->nxoe.indirect == FALSE) + { + mtx_delete(&array->lock); + } +#endif + + nxa_free(a_nxa, array, sizeof(cw_nxoe_array_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_array_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_array_t *array; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_iter; + + array = (cw_nxoe_array_t *) a_nxoe; + + if (a_reset) + { + ref_iter = 0; + } + + if (a_nxoe->indirect) + { + if (ref_iter == 0) + { + retval = (cw_nxoe_t *) array->e.i.array; + ref_iter++; + } + else + { + retval = NULL; + } + } + else + { + retval = NULL; + while (retval == NULL && ref_iter < array->e.a.len) + { + retval = nxo_nxoe_get(&array->e.a.arr[ref_iter]); + ref_iter++; + } + } + + return retval; +} + +CW_INLINE void +nxo_l_array_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_nxo_t *r_el) +{ + cw_nxoe_array_t *array; +#ifdef CW_THREADS + cw_bool_t locking; +#endif + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_ARRAY); + cw_check_ptr(r_el); + + array = (cw_nxoe_array_t *) a_nxo->o.nxoe; + + cw_check_ptr(array); + cw_dassert(array->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(array->nxoe.type == NXOT_ARRAY); + + if (array->nxoe.indirect) + { + a_offset += array->e.i.beg_offset; + array = array->e.i.array; +#ifdef CW_THREADS + locking = FALSE; +#endif + } +#ifdef CW_THREADS + else + { + if (array->nxoe.locking) + { + locking = TRUE; + } + else + { + locking = FALSE; + } + } + + if (locking) + { + mtx_lock(&array->lock); + } +#endif + cw_assert(array->nxoe.indirect == FALSE); + + cw_assert(a_offset >= 0 && a_offset < array->e.a.len); + nxo_dup(r_el, &array->e.a.arr[a_offset]); +#ifdef CW_THREADS + if (locking) + { + mtx_unlock(&array->lock); + } +#endif +} + +CW_INLINE cw_bool_t +nxo_l_array_bound_get(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_ARRAY); + + return ((a_nxo->flags >> 5) & 1); +} + +CW_INLINE void +nxo_l_array_bound_set(cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_ARRAY); + + a_nxo->flags = (a_nxo->flags & 0xffffffdf) | (1 << 5); +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_ARRAY_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_boolean.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_boolean.h new file mode 100644 index 000000000..6288bf515 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_boolean.h @@ -0,0 +1,53 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +void +nxo_boolean_new(cw_nxo_t *a_nxo, cw_bool_t a_val); + +cw_bool_t +nxo_boolean_get(const cw_nxo_t *a_nxo); + +void +nxo_boolean_set(cw_nxo_t *a_nxo, cw_bool_t a_val); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_BOOLEAN_C_)) +CW_INLINE void +nxo_boolean_new(cw_nxo_t *a_nxo, cw_bool_t a_val) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_BOOLEAN); + a_nxo->o.boolean.val = a_val; +} + +CW_INLINE cw_bool_t +nxo_boolean_get(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_BOOLEAN); + + return a_nxo->o.boolean.val; +} + +CW_INLINE void +nxo_boolean_set(cw_nxo_t *a_nxo, cw_bool_t a_val) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_BOOLEAN); + + a_nxo->o.boolean.val = a_val; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_BOOLEAN_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_condition.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_condition.h new file mode 100644 index 000000000..f6f449d61 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_condition.h @@ -0,0 +1,27 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +nxo_condition_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx); + +void +nxo_condition_signal(cw_nxo_t *a_nxo); + +void +nxo_condition_broadcast(cw_nxo_t *a_nxo); + +void +nxo_condition_wait(cw_nxo_t *a_nxo, cw_nxo_t *a_mutex); + +cw_bool_t +nxo_condition_timedwait(cw_nxo_t *a_nxo, cw_nxo_t *a_mutex, + const struct timespec *a_timeout); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_condition_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_condition_l.h new file mode 100644 index 000000000..3e51261f1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_condition_l.h @@ -0,0 +1,53 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxoe_condition_s cw_nxoe_condition_t; + +struct cw_nxoe_condition_s +{ + cw_nxoe_t nxoe; + cw_cnd_t condition; +}; + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_condition_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_condition_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_CONDITION_C_)) +CW_INLINE cw_bool_t +nxoe_l_condition_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_condition_t *condition; + + condition = (cw_nxoe_condition_t *) a_nxoe; + + cw_check_ptr(condition); + cw_dassert(condition->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(condition->nxoe.type == NXOT_CONDITION); + + cnd_delete(&condition->condition); + + nxa_free(a_nxa, condition, sizeof(cw_nxoe_condition_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_condition_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + return NULL; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_CONDITION_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_dict.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_dict.h new file mode 100644 index 000000000..b9429fada --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_dict.h @@ -0,0 +1,36 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxoe_dicto_s cw_nxoe_dicto_t; +typedef struct cw_nxoe_dict_s cw_nxoe_dict_t; + +void +nxo_dict_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, + cw_uint32_t a_dict_size); + +void +nxo_dict_copy(cw_nxo_t *a_to, cw_nxo_t *a_from, cw_nx_t *a_nx); + +void +nxo_dict_def(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_nxo_t *a_key, cw_nxo_t *a_val); + +void +nxo_dict_undef(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_nxo_t *a_key); + +cw_bool_t +nxo_dict_lookup(const cw_nxo_t *a_nxo, const cw_nxo_t *a_key, cw_nxo_t *r_nxo); + +cw_uint32_t +nxo_dict_count(const cw_nxo_t *a_nxo); + +cw_bool_t +nxo_dict_iterate(cw_nxo_t *a_nxo, cw_nxo_t *r_nxo); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_dict_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_dict_l.h new file mode 100644 index 000000000..8c546a33d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_dict_l.h @@ -0,0 +1,177 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* This is private, but nxa needs to know its size. */ +struct cw_nxoe_dicto_s +{ + cw_nxo_t key; + cw_nxo_t val; +}; + +struct cw_nxoe_dict_s +{ + cw_nxoe_t nxoe; + +#ifdef CW_THREADS + /* Access is locked if this object has the locking bit set. */ + cw_mtx_t lock; +#endif + + /* If TRUE, the data are in the hash. Otherwise, they are stored in the + * array. */ + cw_bool_t is_hash:1; + + /* Iteration state variable for iterating over the data array. The value is + * always less than CW_LIBONYX_DICT_SIZE. */ + cw_uint32_t array_iter:31; + + union + { + /* Array of dicto's. Searching is linear. Invalid entries have a key + * of type NXOT_NO. If the array is full and another insertion occurs, + * the array contents are converted to a hash, and are never converted + * back to an array, even if the array would be large enough. */ + cw_nxoe_dicto_t array[CW_LIBONYX_DICT_SIZE]; + + /* Name/value pairs. The keys are (cw_nxo_t *), and the values are + * (cw_nxoe_dicto_t *). The nxo that the key points to resides in the + * nxoe_dicto (value) structure. */ + cw_dch_t hash; + } data; +}; + +cw_nxo_t * +nxo_l_dict_lookup(const cw_nxo_t *a_nxo, const cw_nxo_t *a_key); + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_dict_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_dict_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_DICT_C_)) +CW_INLINE cw_bool_t +nxoe_l_dict_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_dict_t *dict; + cw_nxoe_dicto_t *dicto; + cw_chi_t *chi; + + dict = (cw_nxoe_dict_t *) a_nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + if (dict->nxoe.locking) + { + mtx_delete(&dict->lock); + } +#endif + if (dict->is_hash) + { + /* Set the dch non-shrinkable to avoid rehashes, which could be fatal + * if any of the objects this dict points to have already been swept. */ + dch_shrinkable_set(&dict->data.hash, FALSE); + + while (dch_remove_iterate(&dict->data.hash, NULL, (void **) &dicto, + &chi) + == FALSE) + { + nxa_free(a_nxa, dicto, sizeof(cw_nxoe_dicto_t)); + nxa_free(a_nxa, chi, sizeof(cw_chi_t)); + } + dch_delete(&dict->data.hash); + } + nxa_free(a_nxa, dict, sizeof(cw_nxoe_dict_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_dict_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_dict_t *dict; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_iter; + /* If non-NULL, the previous reference iteration returned the key of this + * dicto, so the value of this dicto is the next reference to check. */ + static cw_nxoe_dicto_t *dicto; + + dict = (cw_nxoe_dict_t *) a_nxoe; + + if (a_reset) + { + ref_iter = 0; + dicto = NULL; + } + + retval = NULL; + if (dict->is_hash) + { + while (retval == NULL + && ref_iter < dch_count(&dict->data.hash)) + { + if (dicto == NULL) + { + /* Key. */ + dch_get_iterate(&dict->data.hash, NULL, (void **) &dicto); + retval = nxo_nxoe_get(&dicto->key); + } + else + { + /* Value. */ + retval = nxo_nxoe_get(&dicto->val); + ref_iter++; + dicto = NULL; + } + } + } + else + { + while (retval == NULL && ref_iter < CW_LIBONYX_DICT_SIZE) + { + if (dicto == NULL) + { + if (nxo_type_get(&dict->data.array[ref_iter].key) + != NXOT_NO) + { + /* Key. */ + dicto = &dict->data.array[ref_iter]; + retval = nxo_nxoe_get(&dicto->key); + } + else + { + /* Empty slot. */ + ref_iter++; + } + } + else + { + /* Value. */ + retval = nxo_nxoe_get(&dicto->val); + ref_iter++; + dicto = NULL; + } + } + } + + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_DICT_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_file.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_file.h new file mode 100644 index 000000000..593f49b35 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_file.h @@ -0,0 +1,92 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef cw_sint32_t cw_nxo_file_read_t (void *a_arg, cw_nxo_t *a_file, + cw_uint32_t a_len, cw_uint8_t *r_str); + +typedef cw_bool_t cw_nxo_file_write_t (void *a_arg, cw_nxo_t *a_file, + const cw_uint8_t *a_str, + cw_uint32_t a_len); + +typedef cw_nxoe_t *cw_nxo_file_ref_iter_t (void *a_arg, cw_bool_t a_reset); + +typedef void cw_nxo_file_delete_t (void *a_arg, cw_nx_t *a_nx); + +void +nxo_file_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking); + +#ifdef CW_POSIX_FILE +void +nxo_file_fd_wrap(cw_nxo_t *a_nxo, cw_uint32_t a_fd); +#endif + +void +nxo_file_synthetic(cw_nxo_t *a_nxo, cw_nxo_file_read_t *a_read, + cw_nxo_file_write_t *a_write, + cw_nxo_file_ref_iter_t *a_ref_iter, + cw_nxo_file_delete_t *a_delete, void *a_arg); + +#ifdef CW_POSIX_FILE +cw_nxn_t +nxo_file_open(cw_nxo_t *a_nxo, const cw_uint8_t *a_filename, cw_uint32_t a_nlen, + const cw_uint8_t *a_flags, cw_uint32_t a_flen, mode_t a_mode); +#endif + +cw_nxn_t +nxo_file_close(cw_nxo_t *a_nxo); + +#ifdef CW_POSIX_FILE +cw_sint32_t +nxo_file_fd_get(const cw_nxo_t *a_nxo); +#endif + +cw_bool_t +nxo_file_nonblocking_get(const cw_nxo_t *a_nxo); + +cw_bool_t +nxo_file_nonblocking_set(cw_nxo_t *a_nxo, cw_bool_t a_nonblocking); + +cw_sint32_t +nxo_file_read(cw_nxo_t *a_nxo, cw_uint32_t a_len, cw_uint8_t *r_str); + +cw_nxn_t +nxo_file_readline(cw_nxo_t *a_nxo, cw_bool_t a_locking, cw_nxo_t *r_string, + cw_bool_t *r_eof); + +cw_nxn_t +nxo_file_write(cw_nxo_t *a_nxo, const cw_uint8_t *a_str, cw_uint32_t a_len, + cw_uint32_t *r_count); + +#ifdef CW_POSIX_FILE +cw_nxn_t +nxo_file_truncate(cw_nxo_t *a_nxo, off_t a_length); +#endif + +cw_nxoi_t +nxo_file_position_get(cw_nxo_t *a_nxo); + +#ifdef CW_POSIX_FILE +cw_nxn_t +nxo_file_position_set(cw_nxo_t *a_nxo, cw_nxoi_t a_position); +#endif + +cw_uint32_t +nxo_file_buffer_size_get(const cw_nxo_t *a_nxo); + +void +nxo_file_buffer_size_set(cw_nxo_t *a_nxo, cw_uint32_t a_size); + +cw_nxoi_t +nxo_file_buffer_count(const cw_nxo_t *a_nxo); + +cw_nxn_t +nxo_file_buffer_flush(cw_nxo_t *a_nxo); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_file_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_file_l.h new file mode 100644 index 000000000..fe19a2733 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_file_l.h @@ -0,0 +1,158 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Size of stack-allocated buffer to use for nxo_file_readline(). If this + * overflows, heap allocation is used. */ +#ifdef CW_DBG +#define CW_NXO_FILE_READLINE_BUFSIZE 25 +#else +#define CW_NXO_FILE_READLINE_BUFSIZE 100 +#endif + +typedef struct cw_nxoe_file_s cw_nxoe_file_t; + +struct cw_nxoe_file_s +{ + cw_nxoe_t nxoe; +#ifdef CW_THREADS + /* Access is locked if this object has the locking bit set. */ + cw_mtx_t lock; +#endif + cw_nx_t *nx; + + enum + { + FILE_NONE, +#ifdef CW_POSIX_FILE + FILE_POSIX, +#endif + FILE_SYNTHETIC + } mode:2; + cw_bool_t nonblocking:1; + + union + { + struct + { + cw_nxo_file_read_t *read_f; + cw_nxo_file_write_t *write_f; + cw_nxo_file_ref_iter_t *ref_iter_f; + cw_nxo_file_delete_t *delete_f; + void *arg; + cw_nxoi_t position; + } s; +#ifdef CW_POSIX_FILE + struct + { + cw_sint32_t fd; + cw_bool_t wrapped; + } p; +#endif + } f; + /* Buffering. */ + cw_uint8_t *buffer; + cw_uint32_t buffer_size; + enum + { + BUFFER_EMPTY, + BUFFER_READ, + BUFFER_WRITE + } buffer_mode; + cw_uint32_t buffer_offset; +}; + +/* Private, but needed for the inlining of nxoe_l_file_delete(). */ +cw_nxn_t +nxo_p_file_buffer_flush(cw_nxoe_file_t *a_file); + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_file_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_file_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_FILE_C_)) +CW_INLINE cw_bool_t +nxoe_l_file_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_file_t *file; + + file = (cw_nxoe_file_t *) a_nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + + nxo_p_file_buffer_flush(file); + if (file->buffer != NULL) + { + nxa_free(a_nxa, file->buffer, file->buffer_size); + } +#ifdef CW_THREADS + if (file->nxoe.locking) + { + mtx_delete(&file->lock); + } +#endif + switch (file->mode) + { + case FILE_NONE: + { + break; + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + if (file->f.p.wrapped == FALSE) + { + close(file->f.p.fd); + } + break; + } +#endif + case FILE_SYNTHETIC: + { + if (file->f.s.delete_f != NULL) + { + file->f.s.delete_f(file->f.s.arg, nxa_nx_get(a_nxa)); + } + break; + } + } + + nxa_free(a_nxa, file, sizeof(cw_nxoe_file_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_file_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_file_t *file; + + file = (cw_nxoe_file_t *) a_nxoe; + + if (file->mode == FILE_SYNTHETIC && file->f.s.ref_iter_f != NULL) + { + retval = file->f.s.ref_iter_f(file->f.s.arg, a_reset); + } + else + { + retval = NULL; + } + + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_FILE_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_fino.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_fino.h new file mode 100644 index 000000000..343f0383e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_fino.h @@ -0,0 +1,26 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +void +nxo_fino_new(cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_FINO_C_)) +CW_INLINE void +nxo_fino_new(cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_FINO); +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_FINO_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_hook.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_hook.h new file mode 100644 index 000000000..bfc2b95e4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_hook.h @@ -0,0 +1,35 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef void cw_nxo_hook_eval_t (void *a_data, cw_nxo_t *a_thread); + +typedef cw_nxoe_t *cw_nxo_hook_ref_iter_t (void *a_data, cw_bool_t a_reset); + +typedef cw_bool_t cw_nxo_hook_delete_t (void *a_data, cw_nx_t *a_nx, + cw_uint32_t a_iter); + +void +nxo_hook_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, void *a_data, + cw_nxo_hook_eval_t *a_eval_f, cw_nxo_hook_ref_iter_t *a_ref_iter_f, + cw_nxo_hook_delete_t *a_delete_f); + +cw_nxo_t * +nxo_hook_tag_get(const cw_nxo_t *a_nxo); + +void * +nxo_hook_data_get(const cw_nxo_t *a_nxo); + +void +nxo_hook_data_set(cw_nxo_t *a_nxo, void *a_data); + +void +nxo_hook_eval(cw_nxo_t *a_nxo, cw_nxo_t *a_thread); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_hook_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_hook_l.h new file mode 100644 index 000000000..ee739d443 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_hook_l.h @@ -0,0 +1,119 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxoe_hook_s cw_nxoe_hook_t; + +struct cw_nxoe_hook_s +{ + cw_nxoe_t nxoe; + + cw_nxo_t tag; + void *data; + cw_nxo_hook_eval_t *eval_f; + cw_nxo_hook_ref_iter_t *ref_iter_f; + cw_nxo_hook_delete_t *delete_f; +}; + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_hook_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_hook_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_HOOK_C_)) +CW_INLINE cw_bool_t +nxoe_l_hook_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_bool_t retval; + cw_nxoe_hook_t *hook; + + hook = (cw_nxoe_hook_t *) a_nxoe; + + cw_check_ptr(hook); + cw_dassert(hook->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(hook->nxoe.type == NXOT_HOOK); + + if (hook->delete_f != NULL) + { + retval = hook->delete_f(hook->data, nxa_nx_get(a_nxa), a_iter); + } + else + { + retval = FALSE; + } + + if (retval == FALSE) + { + nxa_free(a_nxa, hook, sizeof(cw_nxoe_hook_t)); + } + + return retval; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_hook_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_hook_t *hook; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_stage; + + hook = (cw_nxoe_hook_t *) a_nxoe; + + if (a_reset) + { + ref_stage = 0; + } + + switch (ref_stage) + { + case 0: + { + ref_stage++; + retval = nxo_nxoe_get(&hook->tag); + if (retval != NULL) + { + break; + } + } + case 1: + { + ref_stage++; + if (hook->ref_iter_f != NULL) + { + retval = hook->ref_iter_f(hook->data, TRUE); + } + else + { + retval = NULL; + } + break; + } + case 2: + { + retval = hook->ref_iter_f(hook->data, FALSE); + break; + } + default: + { + cw_not_reached(); + } + } + + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_HOOK_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_integer.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_integer.h new file mode 100644 index 000000000..0e4ba2e73 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_integer.h @@ -0,0 +1,53 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +void +nxo_integer_new(cw_nxo_t *a_nxo, cw_nxoi_t a_val); + +cw_nxoi_t +nxo_integer_get(const cw_nxo_t *a_nxo); + +void +nxo_integer_set(cw_nxo_t *a_nxo, cw_nxoi_t a_val); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_INTEGER_C_)) +CW_INLINE void +nxo_integer_new(cw_nxo_t *a_nxo, cw_nxoi_t a_val) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_INTEGER); + a_nxo->o.integer.i = a_val; +} + +CW_INLINE cw_nxoi_t +nxo_integer_get(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_INTEGER); + + return a_nxo->o.integer.i; +} + +CW_INLINE void +nxo_integer_set(cw_nxo_t *a_nxo, cw_nxoi_t a_val) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_INTEGER); + + a_nxo->o.integer.i = a_val; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_INTEGER_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_l.h new file mode 100644 index 000000000..6dbbc9d4e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_l.h @@ -0,0 +1,32 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* nxo. */ +#define nxo_p_type_set(a_nxo, a_type) \ + do \ + { \ + mb_write(); \ + (a_nxo)->flags = ((a_nxo)->flags & 0xffffffe0) | (a_type); \ + } while (0) + +/* nxoe. */ +void +nxoe_l_new(cw_nxoe_t *a_nxoe, cw_nxot_t a_type, cw_bool_t a_locking); + +#define nxoe_l_color_get(a_nxoe) (a_nxoe)->color +#define nxoe_l_color_set(a_nxoe, a_color) (a_nxoe)->color = (a_color) + +#define nxoe_l_registered_get(a_nxoe) (a_nxoe)->registered +#define nxoe_l_registered_set(a_nxoe, a_registered) \ + (a_nxoe)->registered = (a_registered) + +#define nxoe_l_type_get(a_nxoe) (a_nxoe->type) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mark.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mark.h new file mode 100644 index 000000000..228e6e771 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mark.h @@ -0,0 +1,26 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +void +nxo_mark_new(cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_MARK_C_)) +CW_INLINE void +nxo_mark_new(cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_MARK); +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_MARK_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mutex.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mutex.h new file mode 100644 index 000000000..44e5c9d80 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mutex.h @@ -0,0 +1,23 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +nxo_mutex_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx); + +void +nxo_mutex_lock(cw_nxo_t *a_nxo); + +cw_bool_t +nxo_mutex_trylock(cw_nxo_t *a_nxo); + +void +nxo_mutex_unlock(cw_nxo_t *a_nxo); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mutex_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mutex_l.h new file mode 100644 index 000000000..7efb18d58 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_mutex_l.h @@ -0,0 +1,53 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxoe_mutex_s cw_nxoe_mutex_t; + +struct cw_nxoe_mutex_s +{ + cw_nxoe_t nxoe; + cw_mtx_t lock; +}; + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_mutex_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_mutex_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_MUTEX_C_)) +CW_INLINE cw_bool_t +nxoe_l_mutex_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_mutex_t *mutex; + + mutex = (cw_nxoe_mutex_t *) a_nxoe; + + cw_check_ptr(mutex); + cw_dassert(mutex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(mutex->nxoe.type == NXOT_MUTEX); + + mtx_delete(&mutex->lock); + + nxa_free(a_nxa, mutex, sizeof(cw_nxoe_mutex_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_mutex_ref_iter(cw_nxoe_t *a_nxo, cw_bool_t a_reset) +{ + return NULL; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_MUTEX_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_name.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_name.h new file mode 100644 index 000000000..873c67d03 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_name.h @@ -0,0 +1,21 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +nxo_name_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_str, + cw_uint32_t a_len, cw_bool_t a_is_static); + +const cw_uint8_t * +nxo_name_str_get(const cw_nxo_t *a_nxo); + +cw_uint32_t +nxo_name_len_get(const cw_nxo_t *a_nxo); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_name_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_name_l.h new file mode 100644 index 000000000..b688917d8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_name_l.h @@ -0,0 +1,102 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxoe_name_s cw_nxoe_name_t; + +struct cw_nxoe_name_s +{ + cw_nxoe_t nxoe; + /* name is not required to be NULL-terminated, so we keep track of the + * length. */ + const cw_uint8_t *str; + cw_uint32_t len; +}; + +cw_uint32_t +nxo_l_name_hash(const void *a_key); + +cw_bool_t +nxo_l_name_key_comp(const void *a_k1, const void *a_k2); + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_name_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_name_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_NAME_C_)) +CW_INLINE cw_bool_t +nxoe_l_name_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_name_t *name; +#ifdef CW_THREADS + cw_mtx_t *name_lock; +#endif + cw_dch_t *name_hash; + cw_chi_t *chi; + cw_nx_t *nx; + + name = (cw_nxoe_name_t *) a_nxoe; + + nx = nxa_nx_get(a_nxa); + +#ifdef CW_THREADS + name_lock = nx_l_name_lock_get(nx); +#endif + name_hash = nx_l_name_hash_get(nx); + +#ifdef CW_THREADS + mtx_lock(name_lock); +#endif + /* Only delete the hash entry if this object hasn't been put back into + * use. */ + if (name->nxoe.color != nxa_l_white_get(a_nxa)) + { + /* Remove from hash table. */ + dch_remove(name_hash, (void *) name, NULL, NULL, &chi); + nxa_free(a_nxa, chi, sizeof(cw_chi_t)); + + if (name->nxoe.name_static == FALSE) + { + /* Cast away the const here; it's one of two places that the string + * is allowed to be modified, and this cast is better than dropping + * the const altogether. */ + nxa_free(a_nxa, (cw_uint8_t *) name->str, name->len); + } + + nxa_free(a_nxa, name, sizeof(cw_nxoe_name_t)); + } + else + { + /* Re-register. */ + a_nxoe->registered = FALSE; + nxa_l_gc_register(a_nxa, a_nxoe); + } +#ifdef CW_THREADS + mtx_unlock(name_lock); +#endif + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_name_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_name_t *name; + + name = (cw_nxoe_name_t *) a_nxoe; + + return NULL; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_NAME_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_no.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_no.h new file mode 100644 index 000000000..d0b8caf55 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_no.h @@ -0,0 +1,13 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define nxo_no_new(a_nxo) nxo_p_new(a_nxo, NXOT_NO) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_null.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_null.h new file mode 100644 index 000000000..fdbb98fc9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_null.h @@ -0,0 +1,26 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +void +nxo_null_new(cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_NULL_C_)) +CW_INLINE void +nxo_null_new(cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_NULL); +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_NULL_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_operator.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_operator.h new file mode 100644 index 000000000..2171ef909 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_operator.h @@ -0,0 +1,31 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +nxo_operator_new(cw_nxo_t *a_nxo, cw_op_t *a_op, cw_nxn_t a_nxn); + +#ifndef CW_USE_INLINES +cw_op_t * +nxo_operator_f(const cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_OPERATOR_C_)) +CW_INLINE cw_op_t * +nxo_operator_f(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_OPERATOR); + + return a_nxo->o.oper.f; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_OPERATOR_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_operator_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_operator_l.h new file mode 100644 index 000000000..0c2e0b60b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_operator_l.h @@ -0,0 +1,13 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define nxo_l_operator_nxn_get(a_nxo) (((a_nxo)->flags >> 8) & 0x3ff) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_pmark.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_pmark.h new file mode 100644 index 000000000..1bf729fa9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_pmark.h @@ -0,0 +1,26 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +void +nxo_pmark_new(cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_PMARK_C_)) +CW_INLINE void +nxo_pmark_new(cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_PMARK); +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_PMARK_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_real.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_real.h new file mode 100644 index 000000000..139a3e401 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_real.h @@ -0,0 +1,54 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + + +#ifndef CW_USE_INLINES +void +nxo_real_new(cw_nxo_t *a_nxo, cw_nxor_t a_val); + +cw_nxor_t +nxo_real_get(const cw_nxo_t *a_nxo); + +void +nxo_real_set(cw_nxo_t *a_nxo, cw_nxor_t a_val); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_REAL_C_)) +CW_INLINE void +nxo_real_new(cw_nxo_t *a_nxo, cw_nxor_t a_val) +{ + cw_check_ptr(a_nxo); + + nxo_p_new(a_nxo, NXOT_REAL); + a_nxo->o.real.r = a_val; +} + +CW_INLINE cw_nxor_t +nxo_real_get(const cw_nxo_t *a_nxo) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_REAL); + + return a_nxo->o.real.r; +} + +CW_INLINE void +nxo_real_set(cw_nxo_t *a_nxo, cw_nxor_t a_val) +{ + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_REAL); + + a_nxo->o.real.r = a_val; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_REAL_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regex.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regex.h new file mode 100644 index 000000000..f90deacc0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regex.h @@ -0,0 +1,72 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + ******************************************************************************/ + +/* One of these is embedded in cw_nxoe_thread_t, which provides a per-thread + * regex cache. */ +typedef struct +{ + /* A reference to the input string that was most recently matched against, + * or a "no" object. */ + cw_nxo_t input; + + /* Offset into the input string to start the next match at. This is only + * used if the $c or $g flag is set. */ + int cont; + + /* Number of offset pairs in the offsets array that are valid. 0 or -1 is + * used to indicate that there are no valid offset pairs. */ + int mcnt; + + /* Cached vector and its length. This vector is repeatedly used for calls + * to pcre_exec(), and is cached here in order to avoid repeated + * allocations. + * + * The vector contains offset pairs into the input string of subpattern + * matches. Only the first mcnt pairs are valid. + * + * This vector starts out empty (ovp == NULL), and is grown as necessary, + * but never shrunk. */ + int *ovp; + int ovcnt; +} cw_nxo_regex_cache_t; + +cw_nxn_t +nxo_regex_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_pattern, + cw_uint32_t a_len, cw_bool_t a_cont, cw_bool_t a_global, + cw_bool_t a_insensitive, cw_bool_t a_multiline, + cw_bool_t a_singleline); + +void +nxo_regex_match(cw_nxo_t *a_nxo, cw_nxo_t *a_thread, cw_nxo_t *a_input, + cw_bool_t *r_match); + +cw_nxn_t +nxo_regex_nonew_match(cw_nxo_t *a_thread, const cw_uint8_t *a_pattern, + cw_uint32_t a_len, cw_bool_t a_cont, cw_bool_t a_global, + cw_bool_t a_insensitive, cw_bool_t a_multiline, + cw_bool_t a_singleline, cw_nxo_t *a_input, + cw_bool_t *r_match); + +void +nxo_regex_split(cw_nxo_t *a_nxo, cw_nxo_t *a_thread, cw_uint32_t a_limit, + cw_nxo_t *a_input, cw_nxo_t *r_array); + +cw_nxn_t +nxo_regex_nonew_split(cw_nxo_t *a_thread, const cw_uint8_t *a_pattern, + cw_uint32_t a_len, cw_bool_t a_insensitive, + cw_bool_t a_multiline, cw_bool_t a_singleline, + cw_uint32_t a_limit, cw_nxo_t *a_input, + cw_nxo_t *r_array); + +void +nxo_regex_submatch(cw_nxo_t *a_thread, cw_uint32_t a_capture, + cw_nxo_t *r_match); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regex_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regex_l.h new file mode 100644 index 000000000..2d994ddaa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regex_l.h @@ -0,0 +1,150 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include + +typedef struct cw_nxoe_regex_s cw_nxoe_regex_t; + +struct cw_nxoe_regex_s +{ + cw_nxoe_t nxoe; + + /* pcre data structures. */ + pcre *pcre; + pcre_extra *extra; + + /* Number of elements (each element is an int) needed for output vectors + * that are passed to pcre_exec(). */ + int ovcnt; + + /* Amount of memory allocated for the structures pointed to by pcre and + * extra. Unfortunately, it is prohibitively difficult to integrate pcre + * with nxa's allocator API in a multi-threaded interpreter, so pcre and + * extra are allocated with plain old malloc(). Thus, their sizes have to + * be queried and the GC informed of their size. */ + size_t size; +#ifdef PCRE_INFO_EXTRASIZE + size_t extrasize; +#endif + + /* Flags used when matching that determine where in the input string to + * start searching. */ + cw_bool_t cont:1; + cw_bool_t global:1; +}; + +#ifndef CW_USE_INLINES +void +nxo_l_regex_cache_new(cw_nxo_regex_cache_t *a_cache); + +cw_nxoe_t * +nxo_l_regex_cache_ref_iter(cw_nxo_regex_cache_t *a_cache, cw_bool_t a_reset); + +void +nxo_l_regex_cache_delete(cw_nxo_regex_cache_t *a_cache, cw_nxa_t *a_nxa); + +cw_bool_t +nxoe_l_regex_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_regex_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_REGEX_C_)) +/* This function assumes that nxo_thread_new() already zeroed memory. */ +CW_INLINE void +nxo_l_regex_cache_new(cw_nxo_regex_cache_t *a_cache) +{ + nxo_no_new(&a_cache->input); + a_cache->mcnt = -1; +} + +CW_INLINE cw_nxoe_t * +nxo_l_regex_cache_ref_iter(cw_nxo_regex_cache_t *a_cache, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_iter; + + if (a_reset) + { + ref_iter = 0; + } + + for (retval = NULL; retval == NULL; ref_iter++) + { + switch (ref_iter) + { + case 0: + { + retval = nxo_nxoe_get(&a_cache->input); + break; + } + default: + { + retval = NULL; + goto RETURN; + } + } + } + + RETURN: + return retval; +} + +CW_INLINE void +nxo_l_regex_cache_delete(cw_nxo_regex_cache_t *a_cache, cw_nxa_t *a_nxa) +{ + if (a_cache->ovp != NULL) + { + nxa_free(a_nxa, a_cache->ovp, sizeof(int) * a_cache->ovcnt); + } +} + +CW_INLINE cw_bool_t +nxoe_l_regex_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_regex_t *regex; + + regex = (cw_nxoe_regex_t *) a_nxoe; + + cw_check_ptr(regex); + cw_dassert(regex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(regex->nxoe.type == NXOT_REGEX); + + /* Destroy pcre. */ + free(regex->pcre); + if (regex->extra != NULL) + { + free(regex->extra); + } + /* Tell the GC that pcre has been deallocated. */ + nxa_l_count_adjust(a_nxa, -(cw_nxoi_t)(regex->size +#ifdef PCRE_INFO_EXTRASIZE + + regex->extrasize +#endif + )); + + nxa_free(a_nxa, regex, sizeof(cw_nxoe_regex_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_regex_ref_iter(cw_nxoe_t *a_nxo, cw_bool_t a_reset) +{ + return NULL; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_REGEX_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regsub.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regsub.h new file mode 100644 index 000000000..b0a3429af --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regsub.h @@ -0,0 +1,29 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + ******************************************************************************/ + +cw_nxn_t +nxo_regsub_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_pattern, + cw_uint32_t a_plen, cw_bool_t a_global, cw_bool_t a_insensitive, + cw_bool_t a_multiline, cw_bool_t a_singleline, + const cw_uint8_t *a_template, cw_uint32_t a_tlen); + +void +nxo_regsub_subst(cw_nxo_t *a_nxo, cw_nxo_t *a_thread, cw_nxo_t *a_input, + cw_nxo_t *r_output, cw_uint32_t *r_count); + +cw_nxn_t +nxo_regsub_nonew_subst(cw_nxo_t *a_thread, const cw_uint8_t *a_pattern, + cw_uint32_t a_plen, cw_bool_t a_global, + cw_bool_t a_insensitive, cw_bool_t a_multiline, + cw_bool_t a_singleline, const cw_uint8_t *a_template, + cw_uint32_t a_tlen, cw_nxo_t *a_input, + cw_nxo_t *r_output, cw_uint32_t *r_count); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regsub_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regsub_l.h new file mode 100644 index 000000000..4896e84c0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_regsub_l.h @@ -0,0 +1,119 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include + +typedef struct cw_nxoe_regsub_s cw_nxoe_regsub_t; + +/* Substitution template element. A substitution template is decomposed into a + * vector of these. */ +typedef struct +{ + /* String pointer and length for a plain string. If str is NULL, then len + * instead specifies a capturing subpattern. */ + cw_uint8_t *str; + cw_uint32_t len; +} cw_nxoe_regsub_telm_t; + +struct cw_nxoe_regsub_s +{ + cw_nxoe_t nxoe; + + /* pcre data structures. */ + pcre *pcre; + pcre_extra *extra; + + /* Number of elements (each element is an int) needed for output vectors + * that are passed to pcre_exec(). */ + int ovcnt; + + /* Amount of memory allocated for the structures pointed to by pcre and + * extra. Unfortunately, it is prohibitively difficult to integrate pcre + * with nxa's allocator API in a multi-threaded interpreter, so pcre and + * extra are allocated with plain old malloc(). Thus, their sizes have to + * be queried and the GC informed of their size. */ + size_t size; +#ifdef PCRE_INFO_EXTRASIZE + size_t extrasize; +#endif + + /* Flag used when determining whether to substitute just one, or all + * matches. */ + cw_bool_t global; + + /* Number of capturing subpatterns. */ + int capturecount; + + /* Template string and length. vec elements point into this string. */ + cw_uint8_t *template; + cw_uint32_t tlen; + + /* Vector of template elements. */ + cw_nxoe_regsub_telm_t *vec; + cw_uint32_t vlen; +}; + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_regsub_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_regsub_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_REGSUB_C_)) +CW_INLINE cw_bool_t +nxoe_l_regsub_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_regsub_t *regsub; + + regsub = (cw_nxoe_regsub_t *) a_nxoe; + + cw_check_ptr(regsub); + cw_dassert(regsub->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(regsub->nxoe.type == NXOT_REGSUB); + + if (regsub->vec != NULL) + { + nxa_free(a_nxa, regsub->vec, + sizeof(cw_nxoe_regsub_telm_t) * regsub->vlen); + } + + if (regsub->template != NULL) + { + nxa_free(a_nxa, regsub->template, regsub->tlen); + } + + /* Destroy pcre. */ + free(regsub->pcre); + if (regsub->extra != NULL) + { + free(regsub->extra); + } + /* Tell the GC that pcre has been deallocated. */ + nxa_l_count_adjust(a_nxa, -(cw_nxoi_t)(regsub->size +#ifdef PCRE_INFO_EXTRASIZE + + regsub->extrasize +#endif + )); + + nxa_free(a_nxa, regsub, sizeof(cw_nxoe_regsub_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_regsub_ref_iter(cw_nxoe_t *a_nxo, cw_bool_t a_reset) +{ + return NULL; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_REGSUB_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_stack.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_stack.h new file mode 100644 index 000000000..daedf0b8e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_stack.h @@ -0,0 +1,1262 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* The following types and structures are private, but need to be exposed for + * the inline functions. */ +typedef struct cw_nxoe_stack_s cw_nxoe_stack_t; +typedef struct cw_nxoe_stacko_s cw_nxoe_stacko_t; + +struct cw_nxoe_stacko_s +{ + /* Payload. Must be first field. */ + cw_nxo_t nxo; + + /* Stack/spares linkage. */ + ql_elm(cw_nxoe_stacko_t) link; +}; + +struct cw_nxoe_stack_s +{ + cw_nxoe_t nxoe; + +#ifdef CW_THREADS + /* Access locked if locking bit set. */ + cw_mtx_t lock; +#endif + + cw_nxa_t *nxa; + + /* Stack. */ + ql_head(cw_nxoe_stacko_t) stack; + + /* Number of stack elements. */ + cw_uint32_t count; + + /* Number of spare elements. */ + cw_uint32_t nspare; + + /* Not used, just under stack bottom. */ + cw_nxoe_stacko_t under; + + cw_nxoe_stacko_t *ref_stacko; + +#ifdef CW_THREADS + cw_nxoe_stacko_t *below; +#endif +}; + +void +nxo_stack_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking); + +void +nxo_stack_copy(cw_nxo_t *a_to, cw_nxo_t *a_from); + +#ifndef CW_USE_INLINES +cw_uint32_t +nxo_stack_count(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_stack_push(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_stack_bpush(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_stack_under_push(cw_nxo_t *a_nxo, cw_nxo_t *a_object); + +cw_bool_t +nxo_stack_pop(cw_nxo_t *a_nxo); + +cw_bool_t +nxo_stack_bpop(cw_nxo_t *a_nxo); + +cw_bool_t +nxo_stack_npop(cw_nxo_t *a_nxo, cw_uint32_t a_count); + +cw_bool_t +nxo_stack_nbpop(cw_nxo_t *a_nxo, cw_uint32_t a_count); + +void +nxo_stack_remove(cw_nxo_t *a_nxo, cw_nxo_t *a_object); + +cw_nxo_t * +nxo_stack_get(const cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_stack_bget(const cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_stack_nget(const cw_nxo_t *a_nxo, cw_uint32_t a_index); + +cw_nxo_t * +nxo_stack_nbget(const cw_nxo_t *a_nxo, cw_uint32_t a_index); + +cw_nxo_t * +nxo_stack_down_get(const cw_nxo_t *a_nxo, cw_nxo_t *a_object); + +cw_nxo_t * +nxo_stack_up_get(const cw_nxo_t *a_nxo, cw_nxo_t *a_object); + +cw_bool_t +nxo_stack_exch(cw_nxo_t *a_nxo); + +void +nxo_stack_rot(cw_nxo_t *a_nxo, cw_sint32_t a_amount); + +cw_bool_t +nxo_stack_roll(cw_nxo_t *a_nxo, cw_uint32_t a_count, cw_sint32_t a_amount); +#endif + +/* Private, but the inline functions need these prototypes. */ +cw_nxoe_stacko_t * +nxoe_p_stack_push(cw_nxoe_stack_t *a_stack); + +cw_nxoe_stacko_t * +nxoe_p_stack_bpush(cw_nxoe_stack_t *a_stack); + +void +nxoe_p_stack_pop(cw_nxoe_stack_t *a_stack); + +void +nxoe_p_stack_npop(cw_nxoe_stack_t *a_stack, cw_uint32_t a_count); + +void +nxoe_p_stack_nbpop(cw_nxoe_stack_t *a_stack, cw_uint32_t a_count); + + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_STACK_C_)) +#ifdef CW_THREADS +/* Private, but defined here for the inline functions. */ +CW_INLINE void +nxoe_p_stack_lock(cw_nxoe_stack_t *a_nxoe) +{ + if (a_nxoe->nxoe.locking) + { + mtx_lock(&a_nxoe->lock); + } +} + +/* Private, but defined here for the inline functions. */ +CW_INLINE void +nxoe_p_stack_unlock(cw_nxoe_stack_t *a_nxoe) +{ + if (a_nxoe->nxoe.locking) + { + mtx_unlock(&a_nxoe->lock); + } +} +#endif + +CW_INLINE cw_uint32_t +nxo_stack_count(cw_nxo_t *a_nxo) +{ + cw_uint32_t retval; + cw_nxoe_stack_t *stack; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + + retval = stack->count; + + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_push(cw_nxo_t *a_nxo) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + + /* Get an unused stacko. */ + if (qr_prev(ql_first(&stack->stack), link) != &stack->under) + { + /* Use spare. */ + stacko = qr_prev(ql_first(&stack->stack), link); + nxo_no_new(&stacko->nxo); + stack->nspare--; + } + else + { + /* A spare needs to be created. Do this in a separate function to keep + * this one small, since this code path is rarely executed. */ + stacko = nxoe_p_stack_push(stack); + } + + ql_first(&stack->stack) = stacko; + stack->count++; + retval = &stacko->nxo; + +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_bpush(cw_nxo_t *a_nxo) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + + /* Get an unused stacko. */ + if (qr_prev(ql_first(&stack->stack), link) != &stack->under) + { + /* Use spare. */ + stacko = qr_prev(ql_first(&stack->stack), link); + qr_remove(stacko, link); + stack->nspare--; + } + else + { + /* A spare needs to be created. Do this in a separate function to keep + * this one small, since this code path is rarely executed. */ + stacko = nxoe_p_stack_bpush(stack); + } + + nxo_no_new(&stacko->nxo); + qr_before_insert(&stack->under, stacko, link); + if (ql_first(&stack->stack) == &stack->under) + { + ql_first(&stack->stack) = stacko; + } + stack->count++; + retval = &stacko->nxo; + +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_under_push(cw_nxo_t *a_nxo, cw_nxo_t *a_object) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + + /* Get an unused stacko. If there are no spares, create one first. */ + if (qr_prev(ql_first(&stack->stack), link) != &stack->under) + { + /* Use spare. */ + stacko = qr_prev(ql_first(&stack->stack), link); + stack->nspare--; + } + else + { + /* A spare needs to be created. Do this in a separate function to keep + * this one small, since this code path is rarely executed. */ + stacko = nxoe_p_stack_push(stack); + } + + /* Push under. */ + if (a_object != NULL) + { + /* Push under a_object. */ + nxo_no_new(&stacko->nxo); + qr_remove(stacko, link); + qr_after_insert((cw_nxoe_stacko_t *) a_object, stacko, link); + } + else + { + /* Same as nxo_stack_push(). */ + nxo_no_new(&stacko->nxo); + ql_first(&stack->stack) = stacko; + } + + stack->count++; + retval = &stacko->nxo; + +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + + return retval; +} + +CW_INLINE cw_bool_t +nxo_stack_pop(cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + cw_nxoe_stack_t *stack; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (stack->count == 0) + { + retval = TRUE; + goto RETURN; + } + + if (stack->nspare < CW_LIBONYX_STACK_CACHE) + { +#ifdef CW_DBG + cw_nxoe_stacko_t *spare = ql_first(&stack->stack); +#endif + ql_first(&stack->stack) = qr_next(ql_first(&stack->stack), link); + stack->nspare++; +#ifdef CW_DBG + memset(&spare->nxo, 0x5a, sizeof(cw_nxo_t)); +#endif + } + else + { + /* A spare needs to be discarded. Do this in a separate function to + * keep this one small, since this code path is rarely executed. */ + nxoe_p_stack_pop(stack); + } + + stack->count--; + + retval = FALSE; + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_bool_t +nxo_stack_bpop(cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (stack->count == 0) + { + retval = TRUE; + goto RETURN; + } + + stacko = qr_prev(&stack->under, link); + + if (stacko == ql_first(&stack->stack)) + { + ql_first(&stack->stack) = &stack->under; + } + + /* This is non-optimal for the case of popping the last object, but it + * probably isn't worth the extra conditional logic to handle that case + * specially. */ + qr_remove(stacko, link); + if (stack->nspare < CW_LIBONYX_STACK_CACHE) + { + qr_meld(ql_first(&stack->stack), stacko, cw_nxoe_stacko_t, link); + stack->nspare++; +#ifdef CW_DBG + memset(&stacko->nxo, 0x5a, sizeof(cw_nxo_t)); +#endif + } + else + { + nxa_free(stack->nxa, stacko, sizeof(cw_nxoe_stacko_t)); + } + + stack->count--; + + retval = FALSE; + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_bool_t +nxo_stack_npop(cw_nxo_t *a_nxo, cw_uint32_t a_count) +{ + cw_bool_t retval; + cw_nxoe_stack_t *stack; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_count > stack->count) + { + retval = TRUE; + goto RETURN; + } + if (stack->nspare + a_count <= CW_LIBONYX_STACK_CACHE) + { + cw_nxoe_stacko_t *top; + cw_uint32_t i; +#ifdef CW_DBG + cw_nxoe_stacko_t *spare = ql_first(&stack->stack); +#endif + + /* Get a pointer to what will be the new stack top. */ + for (i = 0, top = ql_first(&stack->stack); i < a_count; i++) + { + top = qr_next(top, link); + } + + ql_first(&stack->stack) = top; + stack->nspare += a_count; +#ifdef CW_DBG + for (i = 0; i < a_count; i++) + { + memset(&spare->nxo, 0x5a, sizeof(cw_nxo_t)); + spare = qr_next(spare, link); + } +#endif + } + else + { + /* Spares need to be discarded. Do this in a separate function to keep + * this one small, since this code path is rarely executed. */ + nxoe_p_stack_npop(stack, a_count); + } + + stack->count -= a_count; + + retval = FALSE; + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_bool_t +nxo_stack_nbpop(cw_nxo_t *a_nxo, cw_uint32_t a_count) +{ + cw_bool_t retval; + cw_nxoe_stack_t *stack; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_count > stack->count) + { + retval = TRUE; + goto RETURN; + } + /* Popping 0 objects is legal, but the algorithm below can't handle it, so + * check for this case specially. */ + if (a_count == 0) + { + retval = FALSE; + goto RETURN; + } + if (stack->nspare + a_count <= CW_LIBONYX_STACK_CACHE) + { + cw_nxoe_stacko_t *bottom; + cw_uint32_t i; + + /* Get a pointer to what will be the topmost object removed. */ + for (i = 0, bottom = &stack->under; i < a_count; i++) + { + bottom = qr_prev(bottom, link); + } + + if (bottom != ql_first(&stack->stack)) + { + qr_split(&stack->under, bottom, cw_nxoe_stacko_t, link); + /* Reinsert the spares in the spares region. */ + qr_meld(ql_first(&stack->stack), bottom, cw_nxoe_stacko_t, link); + } + else + { + /* There's no need to split and meld. */ + ql_first(&stack->stack) = &stack->under; + } + + stack->nspare += a_count; +#ifdef CW_DBG + for (i = 0; i < a_count; i++) + { + memset(&bottom->nxo, 0x5a, sizeof(cw_nxo_t)); + bottom = qr_next(bottom, link); + } +#endif + } + else + { + /* Spares need to be discarded. Do this in a separate function to keep + * this one small, since this code path is rarely executed. */ + nxoe_p_stack_nbpop(stack, a_count); + } + + stack->count -= a_count; + + retval = FALSE; + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE void +nxo_stack_remove(cw_nxo_t *a_nxo, cw_nxo_t *a_object) +{ + cw_nxoe_stack_t *stack; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + + if (ql_first(&stack->stack) == (cw_nxoe_stacko_t *) a_object) + { + ql_first(&stack->stack) = qr_next(ql_first(&stack->stack), link); + } + qr_remove((cw_nxoe_stacko_t *) a_object, link); + + /* This is non-optimal for the case of removing the top object, but it's + * probabaly not worth the extra conditional logic to optimize that case + * specially. */ + if (stack->nspare < CW_LIBONYX_STACK_CACHE) + { + qr_before_insert(ql_first(&stack->stack), + (cw_nxoe_stacko_t *) a_object, link); + stack->nspare++; +#ifdef CW_DBG + memset(a_object, 0x5a, sizeof(cw_nxo_t)); +#endif + } + else + { + nxa_free(stack->nxa, a_object, sizeof(cw_nxoe_stacko_t)); + } + + stack->count--; + +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif +} + +CW_INLINE cw_nxo_t * +nxo_stack_get(const cw_nxo_t *a_nxo) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (stack->count == 0) + { + retval = NULL; + goto RETURN; + } + + stacko = ql_first(&stack->stack); + + retval = &stacko->nxo; + cw_dassert(retval->magic == CW_NXO_MAGIC); + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_bget(const cw_nxo_t *a_nxo) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (stack->count == 0) + { + retval = NULL; + goto RETURN; + } + + stacko = qr_prev(&stack->under, link); + + retval = &stacko->nxo; + cw_dassert(retval->magic == CW_NXO_MAGIC); + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_nget(const cw_nxo_t *a_nxo, cw_uint32_t a_index) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + cw_uint32_t i; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_index >= stack->count) + { + retval = NULL; + goto RETURN; + } + + for (i = 0, stacko = ql_first(&stack->stack); i < a_index; i++) + { + stacko = qr_next(stacko, link); + } + + retval = &stacko->nxo; + cw_dassert(retval->magic == CW_NXO_MAGIC); + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_nbget(const cw_nxo_t *a_nxo, cw_uint32_t a_index) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + cw_uint32_t i; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_index >= stack->count) + { + retval = NULL; + goto RETURN; + } + + for (i = 0, stacko = qr_prev(&stack->under, link); i < a_index; i++) + { + stacko = qr_prev(stacko, link); + } + + retval = &stacko->nxo; + cw_dassert(retval->magic == CW_NXO_MAGIC); + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_down_get(const cw_nxo_t *a_nxo, cw_nxo_t *a_object) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_object != NULL) + { + if (stack->count <= 1) + { + retval = NULL; + goto RETURN; + } + stacko = (cw_nxoe_stacko_t *) a_object; + stacko = qr_next(stacko, link); + if (stacko == &stack->under) + { + retval = NULL; + goto RETURN; + } + } + else + { + /* Same as nxo_stack_get(). */ + if (stack->count == 0) + { + retval = NULL; + goto RETURN; + } + + stacko = ql_first(&stack->stack); + } + + retval = &stacko->nxo; + cw_dassert(retval->magic == CW_NXO_MAGIC); + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_nxo_t * +nxo_stack_up_get(const cw_nxo_t *a_nxo, cw_nxo_t *a_object) +{ + cw_nxo_t *retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_object != NULL) + { + if (stack->count <= 1) + { + retval = NULL; + goto RETURN; + } + stacko = (cw_nxoe_stacko_t *) a_object; + if (stacko == ql_first(&stack->stack)) + { + retval = NULL; + goto RETURN; + } + stacko = qr_prev(stacko, link); + } + else + { + /* Same as nxo_stack_bget(). */ + if (stack->count == 0) + { + retval = NULL; + goto RETURN; + } + + stacko = qr_prev(&stack->under, link); + } + + retval = &stacko->nxo; + cw_dassert(retval->magic == CW_NXO_MAGIC); + RETURN: +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + return retval; +} + +CW_INLINE cw_bool_t +nxo_stack_exch(cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *top, *below; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + + /* Get a pointer to the new top of the stack. Then continue on to find the + * end of the roll region. */ +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (stack->count < 2) + { +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + retval = TRUE; + goto ERROR; + } + + top = ql_first(&stack->stack); + top = qr_next(top, link); + below = qr_next(top, link); + + /* We now have: + * + * ql_first(&stack->stack) --> /----------\ \ \ + * | | | | + * | | | \ + * | | | / 1 + * | | | | + * | | | / + * \----------/ \ + * top --> /----------\ / 2 + * | | | + * | | | + * | | | + * | | | + * | | | + * \----------/ / + * below --> /----------\ + * | | + * | | + * | | + * | | + * | | + * \----------/ + * + * Set stack->below so that if the GC runs during the following code, it can + * get at the below region. */ +#ifdef CW_THREADS + stack->below = below; + mb_write(); +#endif + qr_split(ql_first(&stack->stack), below, cw_nxoe_stacko_t, link); + ql_first(&stack->stack) = top; + mb_write(); + qr_meld(top, below, cw_nxoe_stacko_t, link); +#ifdef CW_THREADS + mb_write(); + stack->below = NULL; + nxoe_p_stack_unlock(stack); +#endif + + retval = FALSE; + ERROR: + return retval; +} + +CW_INLINE void +nxo_stack_rot(cw_nxo_t *a_nxo, cw_sint32_t a_amount) +{ + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *top; + cw_uint32_t i; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + + cw_assert(stack->count > 0); + + /* Calculate the current index of the element that will end up on top of the + * stack. This allows us to save a pointer to it as we iterate down/up the + * stack on the way to the new stack top. This code also has the side + * effect of 'mod'ing the rotate amount, so that we don't spend a bunch of + * time rotating the stack if the user specifies a rotate amount larger than + * the stack. A decent program will never do this, so it's not worth + * specifically optimizing, but it falls out of these calculations with no + * extra work, since we already have to deal with upward versus downward + * rotating calculations. */ + if (a_amount < 0) + { + /* Convert a_amount to a positive equivalent. */ + a_amount += ((a_amount - stack->count) / stack->count) * stack->count; + } + a_amount %= stack->count; + a_amount += stack->count; + a_amount %= stack->count; + + /* Do this check after the above calculations, just in case the rotate + * amount is an even multiple of the stack size. */ + if (a_amount == 0) + { + /* Noop. */ + return; + } + + /* Get a pointer to the new top of the stack. */ + /* Start from whichever end is closest to what will be the new top of + * stack. */ + if ((cw_uint32_t) a_amount < stack->count / 2) + { + /* Iterate down from the top. */ + for (i = 0, top = ql_first(&stack->stack); + i < (cw_uint32_t) a_amount; + i++) + { + top = qr_next(top, link); + } + } + else + { + /* Iterate up from the bottom. */ + for (i = 1, top = qr_prev(&stack->under, link); + i < (cw_uint32_t) (stack->count - a_amount); + i++) + { + top = qr_prev(top, link); + } + } + + /* We now have: + * + * ql_first(&stack->stack) --> /----------\ \ \ + * | | | | + * | | | \ + * | | | / a_amount + * | | | | + * | | | / + * \----------/ \ + * top --> /----------\ / stack->count + * | | | \ + * | | | | + * | | | \ + * | | | / stack->count - a_amount + * | | | | + * \----------/ / / + */ + qr_split(ql_first(&stack->stack), &stack->under, cw_nxoe_stacko_t, link); + ql_first(&stack->stack) = top; + mb_write(); + qr_meld(top, &stack->under, cw_nxoe_stacko_t, link); +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif +} + +CW_INLINE cw_bool_t +nxo_stack_roll(cw_nxo_t *a_nxo, cw_uint32_t a_count, cw_sint32_t a_amount) +{ + cw_bool_t retval; + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *top, *below; + cw_uint32_t i; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + stack = (cw_nxoe_stack_t *) a_nxo->o.nxoe; + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + + cw_assert(a_count > 0); + + /* Calculate the current index of the element that will end up on top of the + * stack. This allows us to save a pointer to it as we iterate down the + * stack on the way to the bottom of the roll region. This code also has + * the side effect of 'mod'ing the roll amount, so that we don't spend a + * bunch of time rolling the stack if the user specifies a roll amount + * larger than the roll region. A decent program will never do this, so + * it's not worth specifically optimizing, but it falls out of these + * calculations with no extra work, since we already have to deal with + * upward versus downward rolling calculations. */ + if (a_amount < 0) + { + /* Convert a_amount to a positive equivalent. */ + a_amount += ((a_amount - a_count) / a_count) * a_count; + } + a_amount %= a_count; + a_amount += a_count; + a_amount %= a_count; + + /* Do this check after the above calculations, just in case the roll amount + * is an even multiple of the roll region. */ + if (a_amount == 0) + { + /* Noop. */ + goto RETURN; + } + + /* Get a pointer to the new top of the stack. Then continue on to find the + * end of the roll region. */ +#ifdef CW_THREADS + nxoe_p_stack_lock(stack); +#endif + if (a_count > stack->count) + { +#ifdef CW_THREADS + nxoe_p_stack_unlock(stack); +#endif + retval = TRUE; + goto ERROR; + } + for (i = 0, top = ql_first(&stack->stack); i < (cw_uint32_t) a_amount; i++) + { + top = qr_next(top, link); + } + below = top; + + for (i = 0; i < a_count - a_amount; i++) + { + below = qr_next(below, link); + } + + /* We now have: + * + * ql_first(&stack->stack) --> /----------\ \ \ + * | | | | + * | | | \ + * | | | / a_amount + * | | | | + * | | | / + * \----------/ \ + * top --> /----------\ / a_count + * | | | + * | | | + * | | | + * | | | + * | | | + * \----------/ / + * below --> /----------\ + * | | + * | | + * | | + * | | + * | | + * \----------/ + * + * Set stack->below so that if the GC runs during the following code, it can + * get at the below region. */ +#ifdef CW_THREADS + stack->below = below; + mb_write(); +#endif + qr_split(ql_first(&stack->stack), below, cw_nxoe_stacko_t, link); + ql_first(&stack->stack) = top; + mb_write(); + qr_meld(top, below, cw_nxoe_stacko_t, link); +#ifdef CW_THREADS + mb_write(); + stack->below = NULL; + nxoe_p_stack_unlock(stack); +#endif + + RETURN: + retval = FALSE; + ERROR: + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_STACK_C_)) */ + +/* Convenience wrapper macros for use where errors should cause an error and + * immediate return. */ +#define NXO_STACK_POP(a_nxo, a_thread) \ + do \ + { \ + if (nxo_stack_pop(a_nxo)) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_BPOP(a_nxo, a_thread) \ + do \ + { \ + if (nxo_stack_bpop(a_nxo)) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_NPOP(a_nxo, a_thread, a_count) \ + do \ + { \ + if (nxo_stack_npop((a_nxo), (a_count))) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_NBPOP(a_nxo, a_thread, a_count) \ + do \ + { \ + if (nxo_stack_nbpop((a_nxo), (a_count))) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_GET(r_nxo, a_nxo, a_thread) \ + do \ + { \ + (r_nxo) = nxo_stack_get(a_nxo); \ + if ((r_nxo) == NULL) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_BGET(r_nxo, a_nxo, a_thread) \ + do \ + { \ + (r_nxo) = nxo_stack_bget(a_nxo); \ + if ((r_nxo) == NULL) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_NGET(r_nxo, a_nxo, a_thread, a_index) \ + do \ + { \ + (r_nxo) = nxo_stack_nget((a_nxo), (a_index)); \ + if ((r_nxo) == NULL) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_NBGET(r_nxo, a_nxo, a_thread, a_index) \ + do \ + { \ + (r_nxo) = nxo_stack_nbget((a_nxo), (a_index)); \ + if ((r_nxo) == NULL) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_DOWN_GET(r_nxo, a_nxo, a_thread, a_object) \ + do \ + { \ + (r_nxo) = nxo_stack_down_get((a_nxo), (a_object)); \ + if ((r_nxo) == NULL) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) + +#define NXO_STACK_UP_GET(r_nxo, a_nxo, a_thread, a_object) \ + do \ + { \ + (r_nxo) = nxo_stack_up_get((a_nxo), (a_object)); \ + if ((r_nxo) == NULL) \ + { \ + nxo_thread_nerror((a_thread), NXN_stackunderflow); \ + return; \ + } \ + } while (0) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_stack_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_stack_l.h new file mode 100644 index 000000000..65730defc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_stack_l.h @@ -0,0 +1,168 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_stack_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_stack_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_STACK_C_)) +CW_INLINE cw_bool_t +nxoe_l_stack_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_stack_t *stack; + cw_nxoe_stacko_t *stacko, *tstacko; + cw_uint32_t i; + + stack = (cw_nxoe_stack_t *) a_nxoe; + + cw_check_ptr(stack); + cw_dassert(stack->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(stack->nxoe.type == NXOT_STACK); + + /* Deallocate stacko's. */ + stacko = qr_next(&stack->under, link); + qr_remove(&stack->under, link); + for (i = 0; i < stack->count + stack->nspare; i++) + { + tstacko = qr_next(stacko, link); + qr_remove(tstacko, link); + nxa_free(stack->nxa, tstacko, sizeof(cw_nxoe_stacko_t)); + } + +#ifdef CW_THREADS + if (stack->nxoe.locking) + { + mtx_delete(&stack->lock); + } +#endif + + nxa_free(a_nxa, stack, sizeof(cw_nxoe_stack_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_stack_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_stack_t *stack; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_stage; + + stack = (cw_nxoe_stack_t *) a_nxoe; + + if (a_reset) + { +#ifdef CW_THREADS + if (stack->below != NULL) + { + /* We're in the middle of a roll operation, so need to handle the + * below region specially. It's entirely possible that we'll end + * up reporting some/all stack elements twice, but that doesn't + * cause a correctness problem, whereas not reporting them at all + * does. */ + ref_stage = 0; + } + else +#endif + { + ref_stage = 2; + } + } + + retval = NULL; + switch (ref_stage) + { +#ifdef CW_THREADS + case 0: + { + /* Set up for stage 1. */ + stack->ref_stacko = stack->below; + ref_stage++; + /* Fall through. */ + } + case 1: + { + /* below region stack iteration. */ + for (; retval == NULL && stack->ref_stacko != &stack->under; + stack->ref_stacko = qr_next(stack->ref_stacko, link)) + { + retval = nxo_nxoe_get(&stack->ref_stacko->nxo); + } + + if (retval != NULL) + { + break; + } + ref_stage++; + /* Fall through. */ + } +#endif + case 2: + { + /* First roll region iteration. */ + stack->ref_stacko = ql_first(&stack->stack); + if (stack->ref_stacko != &stack->under) + { + retval = nxo_nxoe_get(&stack->ref_stacko->nxo); + } + + ref_stage++; + if (retval != NULL) + { + break; + } + /* Fall through. */ + } + case 3: + { + /* Set up for stage 4. */ + if (stack->ref_stacko != &stack->under) + { + stack->ref_stacko = qr_next(stack->ref_stacko, link); + } + ref_stage++; + /* Fall through. */ + } + case 4: + { + /* Main roll region iteration. */ + for (; retval == NULL && stack->ref_stacko != &stack->under + && stack->ref_stacko != ql_first(&stack->stack); + stack->ref_stacko = qr_next(stack->ref_stacko, link)) + { + retval = nxo_nxoe_get(&stack->ref_stacko->nxo); + } + + if (retval != NULL) + { + break; + } + ref_stage++; + /* Fall through. */ + } + default: + { + retval = NULL; + } + } + + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_STACK_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_string.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_string.h new file mode 100644 index 000000000..947d23d01 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_string.h @@ -0,0 +1,52 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +nxo_string_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, + cw_uint32_t a_len); + +void +nxo_string_substring_new(cw_nxo_t *a_nxo, cw_nxo_t *a_string, cw_nx_t *a_nx, + cw_uint32_t a_offset, cw_uint32_t a_len); + +void +nxo_string_copy(cw_nxo_t *a_to, cw_nxo_t *a_from); + +void +nxo_string_cstring(cw_nxo_t *a_to, cw_nxo_t *a_from, cw_nxo_t *a_thread); + +cw_uint32_t +nxo_string_len_get(const cw_nxo_t *a_nxo); + +void +nxo_string_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_uint8_t *r_el); + +void +nxo_string_el_set(cw_nxo_t *a_nxo, cw_uint8_t a_el, cw_nxoi_t a_offset); + +#ifdef CW_THREADS +void +nxo_string_lock(cw_nxo_t *a_nxo); + +void +nxo_string_unlock(cw_nxo_t *a_nxo); +#else +#define nxo_string_lock(a_nxo) +#define nxo_string_unlock(a_nxo) +#endif + +cw_uint8_t * +nxo_string_get(const cw_nxo_t *a_nxo); + +void +nxo_string_set(cw_nxo_t *a_nxo, cw_uint32_t a_offset, const cw_uint8_t *a_str, + cw_uint32_t a_len); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_string_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_string_l.h new file mode 100644 index 000000000..e4d1a2ab8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_string_l.h @@ -0,0 +1,113 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct cw_nxoe_string_s cw_nxoe_string_t; + +struct cw_nxoe_string_s +{ + cw_nxoe_t nxoe; + +#ifdef CW_THREADS + /* Access is locked if this object has the locking bit set. Indirect + * strings aren't locked, but their parents are. */ + cw_mtx_t lock; +#endif + + union + { + struct + { + cw_nxoe_string_t *string; + cw_uint32_t beg_offset; + cw_uint32_t len; + } i; + struct + { + cw_uint8_t *str; + cw_uint32_t len; + cw_uint32_t alloc_len; + } s; + } e; +}; + +#ifndef CW_USE_INLINES +cw_bool_t +nxoe_l_string_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_string_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_STRING_C_)) +CW_INLINE cw_bool_t +nxoe_l_string_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_string_t *string; + + string = (cw_nxoe_string_t *) a_nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect == FALSE && string->e.s.alloc_len > 0) + { + nxa_free(a_nxa, string->e.s.str, string->e.s.alloc_len); + } + +#ifdef CW_THREADS + if (string->nxoe.locking && string->nxoe.indirect == FALSE) + { + mtx_delete(&string->lock); + } +#endif + + nxa_free(a_nxa, string, sizeof(cw_nxoe_string_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_string_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_string_t *string; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_iter; + + string = (cw_nxoe_string_t *) a_nxoe; + + if (a_reset) + { + ref_iter = 0; + } + + if (a_nxoe->indirect == FALSE) + { + retval = NULL; + } + else if (ref_iter == 0) + { + retval = (cw_nxoe_t *) string->e.i.string; + ref_iter++; + } + else + { + retval = NULL; + } + + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_STRING_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_thread.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_thread.h new file mode 100644 index 000000000..b44270639 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_thread.h @@ -0,0 +1,467 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#ifdef CW_DBG +#define CW_NXO_THREAD_BUFFER_SIZE 8 +#else +#define CW_NXO_THREAD_BUFFER_SIZE 256 +#endif + +typedef struct cw_nxo_threadp_s cw_nxo_threadp_t; +typedef struct cw_nxoe_thread_s cw_nxoe_thread_t; + +typedef struct cw_nxoe_threadts_s cw_nxoe_threadts_t; +typedef enum +{ + THREADTS_START, + THREADTS_COMMENT, + THREADTS_INTEGER, + THREADTS_INTEGER_RADIX, +#ifdef CW_REAL + THREADTS_REAL_FRAC, + THREADTS_REAL_EXP, +#endif + THREADTS_STRING, + THREADTS_STRING_NEWLINE_CONT, + THREADTS_STRING_PROT_CONT, + THREADTS_STRING_CRLF_CONT, + THREADTS_STRING_CTRL_CONT, + THREADTS_STRING_HEX_CONT, + THREADTS_STRING_HEX_FINISH, + THREADTS_NAME_START, + THREADTS_NAME +} cw_nxo_threadts_t; + +struct cw_nxo_threadp_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#endif + + /* Current line number (counting starts at 1 by convention) and column + * number (counting starts at 0). */ + cw_uint32_t line; + cw_sint32_t column; +}; + +struct cw_nxoe_thread_s +{ + cw_nxoe_t nxoe; + + /* nx this thread is part of. */ + cw_nx_t *nx; + + /* Self, for the self operator, and as a convenience in various places + * internally. */ + cw_nxo_t self; + +#ifdef CW_THREADS + /* Used by nxo_thread_thread(), nxo_thread_detach(), and + * nxo_thread_join(). */ + cw_thd_t *thd; + cw_mtx_t lock; + cw_cnd_t done_cnd; + cw_cnd_t join_cnd; + cw_bool_t done:1; + cw_bool_t gone:1; + cw_bool_t detached:1; + cw_bool_t joined:1; +#endif + +#ifdef CW_THREADS + /* TRUE : New array, dict, file, and string objects are implicitly locked. + * FALSE : No implicit locking for new objects. */ + cw_bool_t locking:1; +#endif + + /* Stacks. */ + + /* Execution stack. */ + cw_nxo_t estack; + + /* Execution index stack. */ + cw_nxo_t istack; + + /* Operand stack. */ + cw_nxo_t ostack; + + /* Dictionary stack. */ + cw_nxo_t dstack; + + /* Temp stack. */ + cw_nxo_t tstack; + + /* Files. */ + cw_nxo_t stdin_nxo; + cw_nxo_t stdout_nxo; + cw_nxo_t stderr_nxo; + +#ifdef CW_REGEX + /* Cached regular expression state used by the match operator. This needs + * to be stored here since the cache is per-thread, and there is no other + * reasonable place to store the information that provides adequate + * performance. Stuffing this in threaddict would impose a huge performance + * penalty due to dstack lookup overhead. + * + * The thread object initializes this structure, reports object + * references during GC reference iteration, and frees allocated memory. Otherwise, all operations on + * this structure are done by the regex class. */ + cw_nxo_regex_cache_t regex_cache; + + /* A 10 element array that stores the matching substring and the first 9 + * capturing subpattern matches. */ +// cw_nxo_t regex_matches; + + /* A reference to the string that was most recently matched against. */ +// cw_nxo_t regex_input; + + /* Offset into regex_input to start the next match at. This is only used if + * the $c or $g flag is set. */ +// cw_uint32_t regex_cont; +#endif + + /* Tokenizer state. If a token is broken across two or more input strings, + * data are copied to an internal buffer, and state machine state is + * preserved so that the buffered data need not be processed again. */ + + /* Current scanner state. */ + cw_nxo_threadts_t state; + + /* Every time a '{' token is encountered by the scanner, this value is + * incremented, and this value is decremented every time the scanner + * encounters a '}' token. Execution of objects is deferred if this value + * is non-zero. */ + cw_uint32_t defer_count; + + /* Offset of first invalid character in tok_str. */ + cw_uint32_t index; + + /* Pointer to the token buffer. As long as index is less than + * CW_NXO_THREAD_BUFFER_SIZE, tok_str actually points to buffer. Otherwise, + * adequate space is allocated (using exponential doubling), and the + * contents of tok_buffer are copied to the allocated buffer. + * + * If a temporary buffer is allocated, it is discarded as soon as the token + * is handled. That is, tok_buffer is used for every token until (if) + * tok_buffer overflows. */ + cw_uint8_t *tok_str; + cw_uint32_t buffer_len; /* Only valid if buffer overflowed. */ + cw_uint8_t buffer[CW_NXO_THREAD_BUFFER_SIZE]; + + union + { + /* integer/real. Which fields are valid (and whether the number is an + * integer or real) is implicit in the scanner state. */ + struct + { + /* Mantissa. */ + cw_bool_t mant_neg:1; /* FALSE: Positive. TRUE: Negative. */ + + /* Radix number base for mantissa (integers only). */ + cw_uint32_t radix_base:7; /* Radix (2-36). Error detection requires + * space to store up to 99. */ + + /* Whole part of mantissa (or radix integer). */ + cw_bool_t whole:1; /* FALSE: No whole portion of mantissa. + * TRUE: Whole portion of mantissa. */ + cw_uint32_t whole_off; /* Offset to first digit of whole. */ + cw_uint32_t whole_len; /* Length of whole. */ + +#ifdef CW_REAL + /* Fractional part of mantissa. */ + cw_bool_t frac:1; /* FALSE: No fractional portion of mantissa. + * TRUE: Fractional portion of mantissa. */ + cw_uint32_t frac_off; /* Offset to first digit of fractional. */ + cw_uint32_t frac_len; /* Length of fractional. */ + + /* Exponent. */ + cw_bool_t exp:1; /* FALSE: No exponent specified. + * TRUE: Exponential notation. */ + cw_bool_t exp_sign:1; /* FALSE: No sign. TRUE: Sign. */ + cw_bool_t exp_neg:1; /* FALSE: Positive. TRUE: Negative. */ + cw_uint32_t exp_off; /* Offset to first digit of exponent. */ + cw_uint32_t exp_len; /* Length of exponent. */ +#endif + } n; + + /* string. */ + struct + { + cw_uint32_t q_depth; + cw_uint8_t hex_val; + } s; + + /* name. */ + struct + { + /* The values of the first three actions must correspond to the + * values of the attributes in cw_nxoa_t, since the two enumerations + * are used interchangeably in nxoe_p_thread_name_accept(). */ + enum + { + ACTION_LITERAL = NXOA_LITERAL, + ACTION_EXECUTE = NXOA_EXECUTABLE, + ACTION_EVALUATE = NXOA_EVALUATABLE, + ACTION_IMMEDIATE + } action; + } m; + } m; +}; + +/* nxo_threadp. */ +void +nxo_threadp_new(cw_nxo_threadp_t *a_threadp); + +void +nxo_threadp_delete(cw_nxo_threadp_t *a_threadp, cw_nxo_t *a_thread); + +void +nxo_threadp_position_get(const cw_nxo_threadp_t *a_threadp, cw_uint32_t *r_line, + cw_uint32_t *r_column); + +void +nxo_threadp_position_set(cw_nxo_threadp_t *a_threadp, cw_uint32_t a_line, + cw_uint32_t a_column); + +/* nxo_thread. */ +void +nxo_thread_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx); + +void +nxo_thread_start(cw_nxo_t *a_nxo); + +void +nxo_thread_exit(cw_nxo_t *a_nxo); + +#ifdef CW_THREADS +void +nxo_thread_thread(cw_nxo_t *a_nxo); + +void +nxo_thread_detach(cw_nxo_t *a_nxo); + +void +nxo_thread_join(cw_nxo_t *a_nxo); +#endif + +cw_nxo_threadts_t +nxo_thread_state(const cw_nxo_t *a_nxo); + +cw_bool_t +nxo_thread_deferred(cw_nxo_t *a_nxo); + +void +nxo_thread_reset(cw_nxo_t *a_nxo); + +void +nxo_thread_loop(cw_nxo_t *a_nxo); + +void +nxo_thread_interpret(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp, const + cw_uint8_t *a_str, cw_uint32_t a_len); + +void +nxo_thread_flush(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp); + +void +nxo_thread_nerror(cw_nxo_t *a_nxo, cw_nxn_t a_nxn); + +void +nxo_thread_serror(cw_nxo_t *a_nxo, const cw_uint8_t *a_str, cw_uint32_t a_len); + +cw_bool_t +nxo_thread_dstack_search(cw_nxo_t *a_nxo, cw_nxo_t *a_key, cw_nxo_t *r_value); + +#ifdef CW_THREADS +cw_bool_t +nxo_thread_currentlocking(const cw_nxo_t *a_nxo); + +void +nxo_thread_setlocking(cw_nxo_t *a_nxo, cw_bool_t a_locking); +#else +#define nxo_thread_currentlocking(a_nxo) FALSE +#endif + +void +nxo_thread_stdin_set(cw_nxo_t *a_nxo, cw_nxo_t *a_stdin); + +void +nxo_thread_stdout_set(cw_nxo_t *a_nxo, cw_nxo_t *a_stdout); + +void +nxo_thread_stderr_set(cw_nxo_t *a_nxo, cw_nxo_t *a_stderr); + +#ifndef CW_USE_INLINES +cw_nx_t * +nxo_thread_nx_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_ostack_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_dstack_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_estack_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_istack_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_tstack_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_stdin_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_stdout_get(cw_nxo_t *a_nxo); + +cw_nxo_t * +nxo_thread_stderr_get(cw_nxo_t *a_nxo); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_THREAD_C_)) +CW_INLINE cw_nx_t * +nxo_thread_nx_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return thread->nx; +} + +CW_INLINE cw_nxo_t * +nxo_thread_ostack_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->ostack; +} + +CW_INLINE cw_nxo_t * +nxo_thread_dstack_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->dstack; +} + +CW_INLINE cw_nxo_t * +nxo_thread_estack_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->estack; +} + +CW_INLINE cw_nxo_t * +nxo_thread_istack_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->istack; +} + +CW_INLINE cw_nxo_t * +nxo_thread_tstack_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->tstack; +} + +CW_INLINE cw_nxo_t * +nxo_thread_stdin_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->stdin_nxo; +} + +CW_INLINE cw_nxo_t * +nxo_thread_stdout_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->stdout_nxo; +} + +CW_INLINE cw_nxo_t * +nxo_thread_stderr_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->stderr_nxo; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_THREAD_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_thread_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_thread_l.h new file mode 100644 index 000000000..7dd573caa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/nxo_thread_l.h @@ -0,0 +1,165 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +cw_uint32_t +nxo_l_thread_token(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp, + const cw_uint8_t *a_str, cw_uint32_t a_len); + +#ifndef CW_USE_INLINES +#ifdef CW_REGEX +cw_nxo_regex_cache_t * +nxo_l_thread_regex_cache_get(cw_nxo_t *a_nxo); +#endif + +cw_bool_t +nxoe_l_thread_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter); + +cw_nxoe_t * +nxoe_l_thread_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset); +#endif + +#if (defined(CW_USE_INLINES) || defined(CW_NXO_THREAD_C_)) +#ifdef CW_REGEX +CW_INLINE cw_nxo_regex_cache_t * +nxo_l_thread_regex_cache_get(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return &thread->regex_cache; +} +#endif + +CW_INLINE cw_bool_t +nxoe_l_thread_delete(cw_nxoe_t *a_nxoe, cw_nxa_t *a_nxa, cw_uint32_t a_iter) +{ + cw_nxoe_thread_t *thread; + + thread = (cw_nxoe_thread_t *) a_nxoe; + + cw_check_ptr(thread); + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + if (thread->tok_str != thread->buffer) + { + /* This shouldn't happen, since it indicates that there is an unaccepted + * token. However, it's really the caller's fault, so just clean up. */ + nxa_free(a_nxa, thread->tok_str, thread->buffer_len); + } + +#ifdef CW_REGEX + nxo_l_regex_cache_delete(&thread->regex_cache, a_nxa); +#endif + + nxa_free(a_nxa, thread, sizeof(cw_nxoe_thread_t)); + + return FALSE; +} + +CW_INLINE cw_nxoe_t * +nxoe_l_thread_ref_iter(cw_nxoe_t *a_nxoe, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + cw_nxoe_thread_t *thread; + /* Used for remembering the current state of reference iteration. This + * function is only called by the garbage collector, so as long as two + * interpreters aren't collecting simultaneously, using a static variable + * works fine. */ + static cw_uint32_t ref_iter; + + thread = (cw_nxoe_thread_t *) a_nxoe; + + if (a_reset) + { + ref_iter = 0; + } + + for (retval = NULL; retval == NULL; ref_iter++) + { + switch (ref_iter) + { + case 0: + { + retval = nxo_nxoe_get(&thread->estack); + break; + } + case 1: + { + retval = nxo_nxoe_get(&thread->istack); + break; + } + case 2: + { + retval = nxo_nxoe_get(&thread->ostack); + break; + } + case 3: + { + retval = nxo_nxoe_get(&thread->dstack); + break; + } + case 4: + { + retval = nxo_nxoe_get(&thread->tstack); + break; + } + case 5: + { + retval = nxo_nxoe_get(&thread->stdin_nxo); + break; + } + case 6: + { + retval = nxo_nxoe_get(&thread->stdout_nxo); + break; + } + case 7: + { + retval = nxo_nxoe_get(&thread->stderr_nxo); + break; + } +#ifdef CW_REGEX + case 8: + { + retval = nxo_l_regex_cache_ref_iter(&thread->regex_cache, TRUE); + if (retval == NULL) + { + /* Avoid looping and hitting the default case. */ + goto RETURN; + } + break; + } +#endif + default: + { +#ifdef CW_REGEX + retval = nxo_l_regex_cache_ref_iter(&thread->regex_cache, + FALSE); +#else + retval = NULL; +#endif + goto RETURN; + } + } + } + + RETURN: + return retval; +} +#endif /* (defined(CW_USE_INLINES) || defined(CW_NXO_THREAD_C_)) */ diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/ql.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/ql.h new file mode 100644 index 000000000..1d47c0427 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/ql.h @@ -0,0 +1,115 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* List definitions. */ +#define ql_head(a_type) \ +struct \ +{ \ + a_type *qlh_first; \ +} + +#define ql_head_initializer(a_head) {NULL} + +#define ql_elm(a_type) qr(a_type) + +/* List functions. */ +#define ql_new(a_head) \ + do \ + { \ + (a_head)->qlh_first = NULL; \ + } while (0) + +#define ql_elm_new(a_elm, a_field) qr_new((a_elm), a_field) + +#define ql_first(a_head) ((a_head)->qlh_first) + +#define ql_last(a_head, a_field) \ + ((ql_first(a_head) != NULL) ? qr_prev(ql_first(a_head), a_field) \ + : NULL) + +#define ql_next(a_head, a_elm, a_field) \ + ((ql_last(a_head, a_field) != (a_elm)) ? qr_next((a_elm), a_field) \ + : NULL) + +#define ql_prev(a_head, a_elm, a_field) \ + ((ql_first(a_head) != (a_elm)) ? qr_prev((a_elm), a_field) \ + : NULL) + +#define ql_before_insert(a_head, a_qlelm, a_elm, a_field) \ + do \ + { \ + qr_before_insert((a_qlelm), (a_elm), a_field); \ + if (ql_first(a_head) == (a_qlelm)) \ + { \ + ql_first(a_head) = (a_elm); \ + } \ + } while (0) + +#define ql_after_insert(a_qlelm, a_elm, a_field) \ + qr_after_insert((a_qlelm), (a_elm), a_field) + +#define ql_head_insert(a_head, a_elm, a_field) \ + do \ + { \ + if (ql_first(a_head) != NULL) \ + { \ + qr_before_insert(ql_first(a_head), (a_elm), a_field); \ + } \ + ql_first(a_head) = (a_elm); \ + } while (0) + +#define ql_tail_insert(a_head, a_elm, a_field) \ + do \ + { \ + if (ql_first(a_head) != NULL) \ + { \ + qr_before_insert(ql_first(a_head), (a_elm), a_field); \ + } \ + ql_first(a_head) = qr_next((a_elm), a_field); \ + } while (0) + +#define ql_remove(a_head, a_elm, a_field) \ + do \ + { \ + if (ql_first(a_head) == (a_elm)) \ + { \ + ql_first(a_head) = qr_next(ql_first(a_head), a_field); \ + } \ + if (ql_first(a_head) != (a_elm)) \ + { \ + qr_remove((a_elm), a_field); \ + } \ + else \ + { \ + ql_first(a_head) = NULL; \ + } \ + } while (0) + +#define ql_head_remove(a_head, a_type, a_field) \ + do \ + { \ + a_type *t = ql_first(a_head); \ + ql_remove((a_head), t, a_field); \ + } while (0) + +#define ql_tail_remove(a_head, a_type, a_field) \ + do \ + { \ + a_type *t = ql_last(a_head, a_field); \ + ql_remove((a_head), t, a_field); \ + } while (0) + +#define ql_foreach(a_var, a_head, a_field) \ + qr_foreach((a_var), ql_first(a_head), a_field) + +#define ql_reverse_foreach(a_var, a_head, a_field) \ + qr_reverse_foreach((a_var), ql_first(a_head), a_field) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/qr.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/qr.h new file mode 100644 index 000000000..8512af989 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/qr.h @@ -0,0 +1,88 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Ring definitions. */ +#define qr(a_type) \ +struct \ +{ \ + a_type *qre_next; \ + a_type *qre_prev; \ +} + +/* Ring functions. */ +#define qr_new(a_qr, a_field) \ + do \ + { \ + (a_qr)->a_field.qre_next = (a_qr); \ + (a_qr)->a_field.qre_prev = (a_qr); \ + } while (0) + +#define qr_next(a_qr, a_field) ((a_qr)->a_field.qre_next) + +#define qr_prev(a_qr, a_field) ((a_qr)->a_field.qre_prev) + +#define qr_before_insert(a_qrelm, a_qr, a_field) \ + do \ + { \ + (a_qr)->a_field.qre_prev = (a_qrelm)->a_field.qre_prev; \ + (a_qr)->a_field.qre_next = (a_qrelm); \ + (a_qr)->a_field.qre_prev->a_field.qre_next = (a_qr); \ + (a_qrelm)->a_field.qre_prev = (a_qr); \ + } while (0) + +#define qr_after_insert(a_qrelm, a_qr, a_field) \ + do \ + { \ + (a_qr)->a_field.qre_next = (a_qrelm)->a_field.qre_next; \ + (a_qr)->a_field.qre_prev = (a_qrelm); \ + (a_qr)->a_field.qre_next->a_field.qre_prev = (a_qr); \ + (a_qrelm)->a_field.qre_next = (a_qr); \ + } while (0) + +#define qr_meld(a_qr_a, a_qr_b, a_type, a_field) \ + do \ + { \ + a_type *t; \ + (a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \ + (a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \ + t = (a_qr_a)->a_field.qre_prev; \ + (a_qr_a)->a_field.qre_prev = (a_qr_b)->a_field.qre_prev; \ + (a_qr_b)->a_field.qre_prev = t; \ + } while (0) + +/* qr_meld() and qr_split() are functionally equivalent, so there's no need to + * have two copies of the code. */ +#define qr_split(a_qr_a, a_qr_b, a_type, a_field) \ + qr_meld((a_qr_a), (a_qr_b), a_type, a_field) + +#define qr_remove(a_qr, a_field) \ + do \ + { \ + (a_qr)->a_field.qre_prev->a_field.qre_next \ + = (a_qr)->a_field.qre_next; \ + (a_qr)->a_field.qre_next->a_field.qre_prev \ + = (a_qr)->a_field.qre_prev; \ + (a_qr)->a_field.qre_next = (a_qr); \ + (a_qr)->a_field.qre_prev = (a_qr); \ + } while (0) + +#define qr_foreach(var, a_qr, a_field) \ + for ((var) = (a_qr); \ + (var) != NULL; \ + (var) = (((var)->a_field.qre_next != (a_qr)) \ + ? (var)->a_field.qre_next : NULL)) + +#define qr_reverse_foreach(var, a_qr, a_field) \ + for ((var) = ((a_qr) != NULL) ? qr_prev(a_qr, a_field) : NULL; \ + (var) != NULL; \ + (var) = (((var) != (a_qr)) \ + ? (var)->a_field.qre_prev : NULL)) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/qs.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/qs.h new file mode 100644 index 000000000..bb79b62f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/qs.h @@ -0,0 +1,67 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Stack definitions. */ +#define qs_head(a_type) \ +struct \ +{ \ + a_type *qsh_top; \ +} + +#define qs_head_initializer(a_head) {NULL} + +#define qs_elm(a_type) \ +struct \ +{ \ + a_type *qse_down; \ +} + +/* Stack functions. */ +#define qs_new(a_head) \ + do \ + { \ + (a_head)->qsh_top = NULL; \ + } while (0) + +#define qs_elm_new(a_elm, a_field) \ + do \ + { \ + (a_elm)->a_field.qse_down = NULL; \ + } while (0) + +#define qs_top(a_head) ((a_head)->qsh_top) + +#define qs_down(a_elm, a_field) ((a_elm)->a_field.qse_down) + +#define qs_push(a_head, a_elm, a_field) \ + do \ + { \ + qs_down((a_elm), a_field) = qs_top(a_head); \ + qs_top(a_head) = (a_elm); \ + } while (0) + +#define qs_under_push(a_qselm, a_elm, a_field) \ + do \ + { \ + qs_down((a_elm), a_field) = qs_down((a_qselm), a_field); \ + qs_down((a_qselm), a_field) = (a_elm); \ + } while (0) + +#define qs_pop(a_head, a_field) \ + do \ + { \ + qs_top(a_head) = qs_down(qs_top(a_head), a_field); \ + } while (0) + +#define qs_foreach(a_var, a_head, a_field) \ + for ((a_var) = qs_top(a_head); (a_var) != NULL; \ + (a_var) = qs_down((a_var), a_field)) diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/systemdict.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/systemdict.h new file mode 100644 index 000000000..3b454051d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/systemdict.h @@ -0,0 +1,1031 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +typedef struct +{ + cw_uint32_t iter; + void *dlhandle; +} cw_nxmod_t; + +void +systemdict_abs(cw_nxo_t *a_thread); + +#ifdef CW_SOCKET +void +systemdict_accept(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_acos(cw_nxo_t *a_thread); + +void +systemdict_acosh(cw_nxo_t *a_thread); +#endif + +void +systemdict_add(cw_nxo_t *a_thread); + +void +systemdict_adn(cw_nxo_t *a_thread); + +void +systemdict_and(cw_nxo_t *a_thread); + +void +systemdict_array(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_asin(cw_nxo_t *a_thread); + +void +systemdict_asinh(cw_nxo_t *a_thread); + +void +systemdict_atan(cw_nxo_t *a_thread); + +void +systemdict_atan2(cw_nxo_t *a_thread); + +void +systemdict_atanh(cw_nxo_t *a_thread); +#endif + +void +systemdict_aup(cw_nxo_t *a_thread); + +void +systemdict_bdup(cw_nxo_t *a_thread); + +void +systemdict_begin(cw_nxo_t *a_thread); + +void +systemdict_bind(cw_nxo_t *a_thread); + +#ifdef CW_SOCKET +void +systemdict_bindsocket(cw_nxo_t *a_thread); +#endif + +void +systemdict_bpop(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_broadcast(cw_nxo_t *a_thread); +#endif + +void +systemdict_bytesavailable(cw_nxo_t *a_thread); + +void +systemdict_cat(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_cd(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_ceiling(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_chmod(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_chown(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_chroot(cw_nxo_t *a_thread); +#endif + +void +systemdict_clear(cw_nxo_t *a_thread); + +void +systemdict_cleartomark(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_close(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_condition(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_connect(cw_nxo_t *a_thread); +#endif + +void +systemdict_copy(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_cos(cw_nxo_t *a_thread); + +void +systemdict_cosh(cw_nxo_t *a_thread); +#endif + +void +systemdict_count(cw_nxo_t *a_thread); + +void +systemdict_countdstack(cw_nxo_t *a_thread); + +void +systemdict_countestack(cw_nxo_t *a_thread); + +void +systemdict_counttomark(cw_nxo_t *a_thread); + +void +systemdict_currentdict(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_currentlocking(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_cvds(cw_nxo_t *a_thread); +#endif + +void +systemdict_cve(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_cves(cw_nxo_t *a_thread); +#endif + +void +systemdict_cvlit(cw_nxo_t *a_thread); + +void +systemdict_cvn(cw_nxo_t *a_thread); + +void +systemdict_cvrs(cw_nxo_t *a_thread); + +void +systemdict_cvs(cw_nxo_t *a_thread); + +void +systemdict_cvx(cw_nxo_t *a_thread); + +void +systemdict_dec(cw_nxo_t *a_thread); + +void +systemdict_def(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_detach(cw_nxo_t *a_thread); +#endif + +void +systemdict_dict(cw_nxo_t *a_thread); + +void +systemdict_die(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_dirforeach(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_div(cw_nxo_t *a_thread); +#endif + +void +systemdict_dn(cw_nxo_t *a_thread); + +void +systemdict_dstack(cw_nxo_t *a_thread); + +void +systemdict_dup(cw_nxo_t *a_thread); + +void +systemdict_echeck(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_egid(cw_nxo_t *a_thread); +#endif + +void +systemdict_end(cw_nxo_t *a_thread); + +void +systemdict_eq(cw_nxo_t *a_thread); + +void +systemdict_estack(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_euid(cw_nxo_t *a_thread); +#endif + +void +systemdict_eval(cw_nxo_t *a_thread); + +void +systemdict_exch(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_exec(cw_nxo_t *a_thread); +#endif + +void +systemdict_exit(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_exp(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_floor(cw_nxo_t *a_thread); +#endif + +void +systemdict_flush(cw_nxo_t *a_thread); + +void +systemdict_flushfile(cw_nxo_t *a_thread); + +void +systemdict_for(cw_nxo_t *a_thread); + +void +systemdict_foreach(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_forkexec(cw_nxo_t *a_thread); +#endif + +void +systemdict_ge(cw_nxo_t *a_thread); + +void +systemdict_get(cw_nxo_t *a_thread); + +void +systemdict_getinterval(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_gid(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_gstderr(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_gstdin(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_gstdout(cw_nxo_t *a_thread); +#endif + +void +systemdict_gt(cw_nxo_t *a_thread); + +void +systemdict_hooktag(cw_nxo_t *a_thread); + +void +systemdict_ibdup(cw_nxo_t *a_thread); + +void +systemdict_ibpop(cw_nxo_t *a_thread); + +void +systemdict_idiv(cw_nxo_t *a_thread); + +void +systemdict_idup(cw_nxo_t *a_thread); + +void +systemdict_if(cw_nxo_t *a_thread); + +void +systemdict_ifelse(cw_nxo_t *a_thread); + +void +systemdict_inc(cw_nxo_t *a_thread); + +void +systemdict_iobuf(cw_nxo_t *a_thread); + +void +systemdict_ipop(cw_nxo_t *a_thread); + +void +systemdict_istack(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_join(cw_nxo_t *a_thread); +#endif + +void +systemdict_known(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_lcheck(cw_nxo_t *a_thread); +#endif + +void +systemdict_le(cw_nxo_t *a_thread); + +void +systemdict_length(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_link(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_listen(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_ln(cw_nxo_t *a_thread); +#endif + +void +systemdict_load(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_lock(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_log(cw_nxo_t *a_thread); +#endif + +void +systemdict_loop(cw_nxo_t *a_thread); + +void +systemdict_lt(cw_nxo_t *a_thread); + +#ifdef CW_REGEX +void +systemdict_match(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_mkdir(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_mkfifo(cw_nxo_t *a_thread); +#endif + +void +systemdict_mod(cw_nxo_t *a_thread); + +#ifdef CW_MODULES +void +systemdict_modload(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_monitor(cw_nxo_t *a_thread); +#endif + +void +systemdict_mul(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_mutex(cw_nxo_t *a_thread); +#endif + +void +systemdict_nbpop(cw_nxo_t *a_thread); + +void +systemdict_ncat(cw_nxo_t *a_thread); + +void +systemdict_ndn(cw_nxo_t *a_thread); + +void +systemdict_ndup(cw_nxo_t *a_thread); + +void +systemdict_ne(cw_nxo_t *a_thread); + +void +systemdict_neg(cw_nxo_t *a_thread); + +void +systemdict_nip(cw_nxo_t *a_thread); + +void +systemdict_nonblocking(cw_nxo_t *a_thread); + +void +systemdict_not(cw_nxo_t *a_thread); + +void +systemdict_npop(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_nsleep(cw_nxo_t *a_thread); +#endif + +void +systemdict_nup(cw_nxo_t *a_thread); + +#ifdef CW_REGEX +void +systemdict_offset(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_open(cw_nxo_t *a_thread); +#endif + +void +systemdict_or(cw_nxo_t *a_thread); + +void +systemdict_ostack(cw_nxo_t *a_thread); + +void +systemdict_over(cw_nxo_t *a_thread); + +#ifdef CW_SOCKET +void +systemdict_peername(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_pid(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_pipe(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_poll(cw_nxo_t *a_thread); +#endif + +void +systemdict_pop(cw_nxo_t *a_thread); + +void +systemdict_pow(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_ppid(cw_nxo_t *a_thread); +#endif + +void +systemdict_print(cw_nxo_t *a_thread); + +void +systemdict_put(cw_nxo_t *a_thread); + +void +systemdict_putinterval(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_pwd(cw_nxo_t *a_thread); +#endif + +void +systemdict_quit(cw_nxo_t *a_thread); + +void +systemdict_rand(cw_nxo_t *a_thread); + +void +systemdict_read(cw_nxo_t *a_thread); + +void +systemdict_readline(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_readlink(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_realtime(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_recv(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REGEX +void +systemdict_regex(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REGEX +void +systemdict_regsub(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_rename(cw_nxo_t *a_thread); +#endif + +void +systemdict_repeat(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_rmdir(cw_nxo_t *a_thread); +#endif + +void +systemdict_roll(cw_nxo_t *a_thread); + +void +systemdict_rot(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_round(cw_nxo_t *a_thread); +#endif + +void +systemdict_sadn(cw_nxo_t *a_thread); + +void +systemdict_saup(cw_nxo_t *a_thread); + +void +systemdict_sbdup(cw_nxo_t *a_thread); + +void +systemdict_sbpop(cw_nxo_t *a_thread); + +void +systemdict_sbpush(cw_nxo_t *a_thread); + +void +systemdict_sclear(cw_nxo_t *a_thread); + +void +systemdict_scleartomark(cw_nxo_t *a_thread); + +void +systemdict_scount(cw_nxo_t *a_thread); + +void +systemdict_scounttomark(cw_nxo_t *a_thread); + +void +systemdict_sdn(cw_nxo_t *a_thread); + +void +systemdict_sdup(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_seek(cw_nxo_t *a_thread); +#endif + +void +systemdict_self(cw_nxo_t *a_thread); + +#ifdef CW_SOCKET +void +systemdict_send(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_serviceport(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_setegid(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_setenv(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_seteuid(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_setgid(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_setgstderr(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_setgstdin(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_setgstdout(cw_nxo_t *a_thread); +#endif + +void +systemdict_setiobuf(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_setlocking(cw_nxo_t *a_thread); +#endif + +void +systemdict_setnonblocking(cw_nxo_t *a_thread); + +#ifdef CW_SOCKET +void +systemdict_setsockopt(cw_nxo_t *a_thread); +#endif + +void +systemdict_setstderr(cw_nxo_t *a_thread); + +void +systemdict_setstdin(cw_nxo_t *a_thread); + +void +systemdict_setstdout(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_setuid(cw_nxo_t *a_thread); +#endif + +void +systemdict_sexch(cw_nxo_t *a_thread); + +void +systemdict_shift(cw_nxo_t *a_thread); + +void +systemdict_sibdup(cw_nxo_t *a_thread); + +void +systemdict_sibpop(cw_nxo_t *a_thread); + +void +systemdict_sidup(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_signal(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL +void +systemdict_sin(cw_nxo_t *a_thread); + +void +systemdict_sinh(cw_nxo_t *a_thread); +#endif + +void +systemdict_sipop(cw_nxo_t *a_thread); + +void +systemdict_snbpop(cw_nxo_t *a_thread); + +void +systemdict_sndn(cw_nxo_t *a_thread); + +void +systemdict_sndup(cw_nxo_t *a_thread); + +void +systemdict_snip(cw_nxo_t *a_thread); + +void +systemdict_snpop(cw_nxo_t *a_thread); + +void +systemdict_snup(cw_nxo_t *a_thread); + +#ifdef CW_SOCKET +void +systemdict_socket(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_socketpair(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_sockname(cw_nxo_t *a_thread); +#endif + +#ifdef CW_SOCKET +void +systemdict_sockopt(cw_nxo_t *a_thread); +#endif + +void +systemdict_sover(cw_nxo_t *a_thread); + +#ifdef CW_REGEX +void +systemdict_split(cw_nxo_t *a_thread); +#endif +void +systemdict_spop(cw_nxo_t *a_thread); + +void +systemdict_spush(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_sqrt(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_srand(cw_nxo_t *a_thread); +#endif + +void +systemdict_sroll(cw_nxo_t *a_thread); + +void +systemdict_srot(cw_nxo_t *a_thread); + +void +systemdict_stack(cw_nxo_t *a_thread); + +void +systemdict_start(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_status(cw_nxo_t *a_thread); +#endif + +void +systemdict_stderr(cw_nxo_t *a_thread); + +void +systemdict_stdin(cw_nxo_t *a_thread); + +void +systemdict_stdout(cw_nxo_t *a_thread); + +void +systemdict_stop(cw_nxo_t *a_thread); + +void +systemdict_stopped(cw_nxo_t *a_thread); + +void +systemdict_string(cw_nxo_t *a_thread); + +void +systemdict_stuck(cw_nxo_t *a_thread); + +void +systemdict_sub(cw_nxo_t *a_thread); + +#ifdef CW_REGEX +void +systemdict_submatch(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REGEX +void +systemdict_subst(cw_nxo_t *a_thread); +#endif + +void +systemdict_sunder(cw_nxo_t *a_thread); + +void +systemdict_sup(cw_nxo_t *a_thread); + +void +systemdict_sym_lp(cw_nxo_t *a_thread); + +void +systemdict_sym_rp(cw_nxo_t *a_thread); + +void +systemdict_sym_gt(cw_nxo_t *a_thread); + +void +systemdict_sym_rb(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_symlink(cw_nxo_t *a_thread); +#endif + +#ifdef CW_REAL + +void +systemdict_tan(cw_nxo_t *a_thread); + +void +systemdict_tanh(cw_nxo_t *a_thread); +#endif + +void +systemdict_tell(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_test(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_thread(cw_nxo_t *a_thread); +#endif + +void +systemdict_threaddstack(cw_nxo_t *a_thread); + +void +systemdict_threadestack(cw_nxo_t *a_thread); + +void +systemdict_threadistack(cw_nxo_t *a_thread); + +void +systemdict_threadostack(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_threadsdict(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_timedwait(cw_nxo_t *a_thread); +#endif + +void +systemdict_token(cw_nxo_t *a_thread); + +#ifdef CW_REAL +void +systemdict_trunc(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_truncate(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_trylock(cw_nxo_t *a_thread); +#endif + +void +systemdict_tuck(cw_nxo_t *a_thread); + +void +systemdict_type(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_uid(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_umask(cw_nxo_t *a_thread); +#endif + +void +systemdict_undef(cw_nxo_t *a_thread); + +void +systemdict_under(cw_nxo_t *a_thread); + +#ifdef CW_POSIX +void +systemdict_unlink(cw_nxo_t *a_thread); +#endif + +#ifdef CW_THREADS +void +systemdict_unlock(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_unsetenv(cw_nxo_t *a_thread); +#endif + +void +systemdict_until(cw_nxo_t *a_thread); + +void +systemdict_up(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_wait(cw_nxo_t *a_thread); +#endif + +#ifdef CW_POSIX +void +systemdict_waitpid(cw_nxo_t *a_thread); +#endif + +void +systemdict_where(cw_nxo_t *a_thread); + +void +systemdict_while(cw_nxo_t *a_thread); + +void +systemdict_write(cw_nxo_t *a_thread); + +void +systemdict_xcheck(cw_nxo_t *a_thread); + +void +systemdict_xor(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +void +systemdict_yield(cw_nxo_t *a_thread); +#endif diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/systemdict_l.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/systemdict_l.h new file mode 100644 index 000000000..8ec2dc720 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/systemdict_l.h @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +void +systemdict_l_populate(cw_nxo_t *a_dict, cw_nx_t *a_nx, int a_argc, + char **a_argv); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/thd.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/thd.h new file mode 100644 index 000000000..1f7c385b8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/thd.h @@ -0,0 +1,93 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Opaque type. */ +typedef struct cw_thd_s cw_thd_t; + +/* Determine what mechanism to use for thread suspend/resume. The generic + * version relies on signals, which tends to be much slower than native + * implementations of suspend/resume, so only use it as a last resort. */ +#define CW_THD_GENERIC_SR + +/* FreeBSD-specific extensions (pthread_{suspend,resume}_np()). */ +#ifdef CW_FTHREADS +#undef CW_THD_GENERIC_SR +#endif + +/* Mach threads. */ +#ifdef CW_MTHREADS +#undef CW_THD_GENERIC_SR +#endif + +/* Solaris threads. */ +#ifdef CW_STHREADS +#undef CW_THD_GENERIC_SR +#endif + +/* GNU pth. */ +#ifdef CW_PTH +#undef CW_THD_GENERIC_SR +#endif + +#ifdef CW_THD_GENERIC_SR +/* The generic suspend/resume mechanism uses signals (using pthread_kill()). + * This is rather expensive, depending on the OS, but it does not violate + * portability. The only issue with this mechanism is that it requires two + * signals that cannot otherwise be used by the thread being suspended/resumed. + * On most OSs, SIGUSR1 and SIGUSR2 are the logical choices. */ +#define CW_THD_SIGSUSPEND SIGUSR1 +#define CW_THD_SIGRESUME SIGUSR2 +#endif + +/* Minimum thread stack size. */ +#define CW_THD_MINSTACK 524288 + +cw_thd_t * +thd_new(void *(*a_start_func)(void *), void *a_arg, cw_bool_t a_suspendible); + +void +thd_delete(cw_thd_t *a_thd); + +void * +thd_join(cw_thd_t *a_thd); + +cw_thd_t * +thd_self(void); + +#ifdef CW_PTH +#define thd_yield() pth_yield(NULL) +#else +#define thd_yield() sched_yield() +#endif + +void thd_sigmask(int a_how, const sigset_t *a_set, sigset_t *r_oset); + +void +thd_crit_enter(void); + +void +thd_crit_leave(void); + +void +thd_single_enter(void); + +void +thd_single_leave(void); + +void +thd_suspend(cw_thd_t *a_thd); + +cw_bool_t +thd_trysuspend(cw_thd_t *a_thd); + +void +thd_resume(cw_thd_t *a_thd); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/tsd.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/tsd.h new file mode 100644 index 000000000..c53124f16 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/tsd.h @@ -0,0 +1,36 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Pseudo-opaque type. */ +typedef struct cw_tsd_s cw_tsd_t; + +struct cw_tsd_s +{ +#ifdef CW_PTH + pth_key_t key; +#endif +#ifdef CW_PTHREADS + pthread_key_t key; +#endif +}; + +void +tsd_new(cw_tsd_t *a_tsd, void (*a_func)(void *)); + +void +tsd_delete(cw_tsd_t *a_tsd); + +void * +tsd_get(cw_tsd_t *a_tsd); + +void +tsd_set(cw_tsd_t *a_tsd, void *a_val); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/xep.h b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/xep.h new file mode 100644 index 000000000..a814ffe0b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/include/libonyx/xep.h @@ -0,0 +1,94 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Pseudo-opaque type. */ +typedef struct cw_xep_s cw_xep_t; + +typedef cw_uint32_t cw_xepv_t; + +#define CW_XEPV_NONE 0 +#define CW_XEPV_CODE 1 + +typedef enum +{ + CW_XEPS_TRY, + CW_XEPS_CATCH +} cw_xeps_t; + +struct cw_xep_s +{ + volatile qr(cw_xep_t) link; + volatile cw_xepv_t value; + volatile cw_bool_t is_handled; + volatile cw_bool_t is_linked; + volatile cw_xeps_t state; + volatile const char *filename; + volatile cw_uint32_t line_num; + jmp_buf context; +}; + +#define xep_begin() \ + { \ + cw_xep_t _xep + +#define xep_try \ + xep_p_link(&_xep); \ + switch (setjmp(_xep.context)) \ + { \ + case CW_XEPV_NONE: \ + case CW_XEPV_CODE: + +#define xep_catch(a_value) \ + break; \ + case (a_value): + +#define xep_mcatch(a_value) \ + case (a_value): + +#define xep_acatch \ + break; \ + default: \ + if (_xep.state != CW_XEPS_CATCH) \ + { \ + break; \ + } + +#define xep_end() \ + } \ + xep_p_unlink(&_xep); \ + } + +#define xep_value() (_xep.value) + +void +xep_throw_e(cw_xepv_t a_value, volatile const char *a_filename, + cw_uint32_t a_line_num); + +#define xep_throw(a_value) xep_throw_e((a_value), __FILE__, __LINE__) + +#define xep_retry() xep_p_retry(&_xep) + +#define xep_handled() xep_p_handled(&_xep) + +/* Private, but visible here so that the cpp macros above don't cause + * compilation warnings. */ +void +xep_p_retry(cw_xep_t *a_xep); + +void +xep_p_handled(cw_xep_t *a_xep); + +void +xep_p_link(cw_xep_t *a_xep); + +void +xep_p_unlink(cw_xep_t *a_xep); diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/.cvsignore b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/.cvsignore new file mode 100644 index 000000000..556291e6e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/.cvsignore @@ -0,0 +1,6 @@ +*.[do]_[abs] +nx.nx +nxo_thread.nx +nx_nxcode.c +nxo_thread_nxcode.c +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/asprintf.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/asprintf.c new file mode 100644 index 000000000..7956a0ef7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/asprintf.c @@ -0,0 +1,58 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Emulate asprintf(). + * + ******************************************************************************/ + +#include + +static int +asprintf(char **r_result, const char *a_format, ...) +{ + int retval; + char *result; + va_list ap; +#define CW_ASPRINTF_STARTLEN 16 + + result = (char *) malloc(CW_ASPRINTF_STARTLEN); + if (result == NULL) + { + retval = -1; + goto RETURN; + } + + va_start(ap, a_format); + retval = vsnprintf(result, CW_ASPRINTF_STARTLEN, a_format, ap); + va_end(ap); + + if (retval == -1) + { + goto RETURN; + } + else if (retval >= CW_ASPRINTF_STARTLEN) + { + free(result); + result = (char *) malloc(retval + 1); + if (result == NULL) + { + retval = -1; + goto RETURN; + } + + va_start(ap, a_format); + retval = vsnprintf(result, retval + 1, a_format, ap); + va_end(ap); + } + + *r_result = result; + RETURN: + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/ch.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/ch.c new file mode 100644 index 000000000..dd8a024e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/ch.c @@ -0,0 +1,411 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#ifdef CW_DBG +#define CW_CH_MAGIC 0x574936af +#define CW_CHI_MAGIC 0xabdcee0e +#endif + +cw_ch_t * +ch_new(cw_ch_t *a_ch, cw_opaque_alloc_t *a_alloc, + cw_opaque_dealloc_t *a_dealloc, void *a_arg, cw_uint32_t a_table_size, + cw_ch_hash_t *a_hash, cw_ch_key_comp_t *a_key_comp) +{ + cw_ch_t *retval; + + cw_check_ptr(a_alloc); + cw_check_ptr(a_dealloc); + cw_assert(a_table_size > 0); + cw_check_ptr(a_hash); + cw_check_ptr(a_key_comp); + + if (NULL != a_ch) + { + retval = a_ch; + memset(retval, 0, CW_CH_TABLE2SIZEOF(a_table_size)); + retval->is_malloced = FALSE; + } + else + { + retval = (cw_ch_t *) a_alloc(a_arg, CW_CH_TABLE2SIZEOF(a_table_size), + __FILE__, __LINE__); + memset(retval, 0, CW_CH_TABLE2SIZEOF(a_table_size)); + retval->is_malloced = TRUE; + } + + retval->alloc = a_alloc; + retval->dealloc = a_dealloc; + retval->arg = a_arg; + retval->table_size = a_table_size; + retval->hash = a_hash; + retval->key_comp = a_key_comp; + +#ifdef CW_DBG + retval->magic = CW_CH_MAGIC; +#endif + + return retval; +} + +void +ch_delete(cw_ch_t *a_ch) +{ + cw_chi_t *chi; + + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + +#ifdef CW_CH_VERBOSE + fprintf(stderr, + "%s(%p): num_collisions: %llu, num_inserts: %llu," + " num_removes: %llu, num_searches: %llu\n", + __FUNCTION__, a_ch, a_ch->num_collisions, a_ch->num_inserts, + a_ch->num_removes, a_ch->num_searches); +#endif + + while (ql_first(&a_ch->chi_ql) != NULL) + { + chi = ql_first(&a_ch->chi_ql); + cw_check_ptr(chi); + cw_dassert(chi->magic == CW_CHI_MAGIC); + ql_head_remove(&a_ch->chi_ql, cw_chi_t, ch_link); + if (chi->is_malloced) + { + cw_opaque_dealloc(a_ch->dealloc, a_ch->arg, chi, sizeof(cw_chi_t)); + } +#ifdef CW_DBG + else + { + memset(chi, 0x5a, sizeof(cw_chi_t)); + } +#endif + } + + if (a_ch->is_malloced) + { + cw_opaque_dealloc(a_ch->dealloc, a_ch->arg, a_ch, + CW_CH_TABLE2SIZEOF(a_ch->table_size)); + } +#ifdef CW_DBG + else + { + memset(a_ch, 0x5a, CW_CH_TABLE2SIZEOF(a_ch->table_size)); + } +#endif +} + +cw_uint32_t +ch_count(cw_ch_t *a_ch) +{ + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + + return a_ch->count; +} + +void +ch_insert(cw_ch_t *a_ch, const void *a_key, const void *a_data, + cw_chi_t *a_chi) +{ + cw_uint32_t slot; + cw_chi_t *chi; + + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + + /* Initialize chi. */ + if (a_chi != NULL) + { + chi = a_chi; + chi->is_malloced = FALSE; + } + else + { + chi = (cw_chi_t *) cw_opaque_alloc(a_ch->alloc, a_ch->arg, + sizeof(cw_chi_t)); + chi->is_malloced = TRUE; + } + chi->key = a_key; + chi->data = a_data; + ql_elm_new(chi, ch_link); + ql_elm_new(chi, slot_link); + slot = a_ch->hash(a_key) % a_ch->table_size; + chi->slot = slot; +#ifdef CW_DBG + chi->magic = CW_CHI_MAGIC; +#endif + + /* Hook into ch-wide list. */ + ql_tail_insert(&a_ch->chi_ql, chi, ch_link); + + /* Hook into the slot list. */ +#ifdef CW_CH_COUNT + if (ql_first(&a_ch->table[slot]) != NULL) + { + a_ch->num_collisions++; + } +#endif + ql_head_insert(&a_ch->table[slot], chi, slot_link); + + a_ch->count++; +#ifdef CW_CH_COUNT + a_ch->num_inserts++; +#endif +} + +cw_bool_t +ch_remove(cw_ch_t *a_ch, const void *a_search_key, void **r_key, void **r_data, + cw_chi_t **r_chi) +{ + cw_bool_t retval; + cw_uint32_t slot; + cw_chi_t *chi; + + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + + slot = a_ch->hash(a_search_key) % a_ch->table_size; + + for (chi = ql_first(&a_ch->table[slot]); chi != NULL; chi = + ql_next(&a_ch->table[slot], chi, slot_link)) + { + cw_check_ptr(chi); + cw_dassert(chi->magic == CW_CHI_MAGIC); + + /* Is this the chi we want? */ + if (a_ch->key_comp(a_search_key, chi->key)) + { + /* Detach from ch-wide list. */ + ql_remove(&a_ch->chi_ql, chi, ch_link); + + /* Detach from the slot list. */ + ql_remove(&a_ch->table[slot], chi, slot_link); + + if (r_key != NULL) + { + *r_key = (void *) chi->key; + } + if (r_data != NULL) + { + *r_data = (void *) chi->data; + } + if (chi->is_malloced) + { + cw_opaque_dealloc(a_ch->dealloc, a_ch->arg, chi, + sizeof(cw_chi_t)); + } + else if (r_chi != NULL) + { +#ifdef CW_DBG + chi->magic = 0; +#endif + *r_chi = chi; + } + + a_ch->count--; +#ifdef CW_CH_COUNT + a_ch->num_removes++; +#endif + retval = FALSE; + goto RETURN; + } + } + + retval = TRUE; + RETURN: + return retval; +} + +cw_bool_t +ch_search(cw_ch_t *a_ch, const void *a_key, void **r_data) +{ + cw_bool_t retval; + cw_uint32_t slot; + cw_chi_t *chi; + + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + + slot = a_ch->hash(a_key) % a_ch->table_size; + + for (chi = ql_first(&a_ch->table[slot]); + chi != NULL; + chi = ql_next(&a_ch->table[slot], chi, slot_link)) + { + cw_check_ptr(chi); + cw_dassert(chi->magic == CW_CHI_MAGIC); + + /* Is this the chi we want? */ + if (a_ch->key_comp(a_key, chi->key) == TRUE) + { + if (r_data != NULL) + { + *r_data = (void *) chi->data; + } + retval = FALSE; + goto RETURN; + } + } + + retval = TRUE; + RETURN: +#ifdef CW_CH_COUNT + a_ch->num_searches++; +#endif + return retval; +} + +cw_bool_t +ch_get_iterate(cw_ch_t *a_ch, void **r_key, void **r_data) +{ + cw_bool_t retval; + cw_chi_t *chi; + + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + + chi = ql_first(&a_ch->chi_ql); + if (chi == NULL) + { + retval = TRUE; + goto RETURN; + } + cw_check_ptr(chi); + cw_dassert(chi->magic == CW_CHI_MAGIC); + if (r_key != NULL) + { + *r_key = (void *) chi->key; + } + if (r_data != NULL) + { + *r_data = (void *) chi->data; + } + + /* Rotate the list. */ + ql_first(&a_ch->chi_ql) = qr_next(ql_first(&a_ch->chi_ql), ch_link); + + retval = FALSE; + RETURN: + return retval; +} + +cw_bool_t +ch_remove_iterate(cw_ch_t *a_ch, void **r_key, void **r_data, cw_chi_t **r_chi) +{ + cw_bool_t retval; + cw_chi_t *chi; + + cw_check_ptr(a_ch); + cw_dassert(a_ch->magic == CW_CH_MAGIC); + + chi = ql_first(&a_ch->chi_ql); + if (chi == NULL) + { + retval = TRUE; + goto RETURN; + } + cw_check_ptr(chi); + cw_dassert(chi->magic == CW_CHI_MAGIC); + + /* Detach from the ch-wide list. */ + ql_remove(&a_ch->chi_ql, chi, ch_link); + + /* Detach from the slot list. */ + ql_remove(&a_ch->table[chi->slot], chi, slot_link); + + if (r_key != NULL) + { + *r_key = (void *) chi->key; + } + if (r_data != NULL) + { + *r_data = (void *) chi->data; + } + if (chi->is_malloced) + { + cw_opaque_dealloc(a_ch->dealloc, a_ch->arg, chi, sizeof(cw_chi_t)); + } + else if (r_chi != NULL) + { +#ifdef CW_DBG + chi->magic = 0; +#endif + *r_chi = chi; + } + + a_ch->count--; +#ifdef CW_CH_COUNT + a_ch->num_removes++; +#endif + + retval = FALSE; + RETURN: + return retval; +} + +cw_uint32_t +ch_string_hash(const void *a_key) +{ + cw_uint32_t retval, c; + cw_uint8_t *str; + + cw_check_ptr(a_key); + + for (str = (cw_uint8_t *) a_key, retval = 5381; (c = *str) != 0; str++) + { + retval = ((retval << 5) + retval) + c; + } + + return retval; +} + +cw_uint32_t +ch_direct_hash(const void *a_key) +{ +#if (SIZEOF_INT_P == 4) + cw_uint32_t t = (cw_uint32_t) a_key; +#elif (SIZEOF_INT_P == 8) + cw_uint64_t t = (cw_uint64_t) a_key; +#else +#error Unsupported pointer size +#endif + + /* Shift right until we've shifted one 1 bit off. */ +#if (SIZEOF_INT_P == 8) + t >>= 32 * !(t & 0xffffffff); +#endif + t >>= 16 * !(t & 0xffff); + t >>= 8 * !(t & 0xff); + t >>= 4 * !(t & 0xf); + t >>= 2 * !(t & 0x3); + t >>= 1 * !(t & 0x1); + t >>= 1; + + return t; +} + +cw_bool_t +ch_string_key_comp(const void *a_k1, const void *a_k2) +{ + cw_check_ptr(a_k1); + cw_check_ptr(a_k2); + + return strcmp((char *) a_k1, (char *) a_k2) ? FALSE : TRUE; +} + +cw_bool_t +ch_direct_key_comp(const void *a_k1, const void *a_k2) +{ + return (a_k1 == a_k2) ? TRUE : FALSE; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/cnd.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/cnd.c new file mode 100644 index 000000000..c8d086c70 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/cnd.c @@ -0,0 +1,218 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#include +#include + +void +cnd_new(cw_cnd_t *a_cnd) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_cnd); + +#ifdef CW_PTH + if (pth_cond_init(&a_cnd->condition) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_cond_init(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_cond_init(&a_cnd->condition, NULL); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_cond_init(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void +cnd_delete(cw_cnd_t *a_cnd) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_cnd); + +#ifdef CW_PTHREADS + error = pthread_cond_destroy(&a_cnd->condition); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_cond_destroy(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void +cnd_signal(cw_cnd_t *a_cnd) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_cnd); + +#ifdef CW_PTH + if (pth_cond_notify(&a_cnd->condition, FALSE) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_cond_notify(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_cond_signal(&a_cnd->condition); + if (error) { + fprintf(stderr, "%s:%d:%s(): Error in pthread_cond_signal(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void +cnd_broadcast(cw_cnd_t *a_cnd) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_cnd); + +#ifdef CW_PTH + if (pth_cond_notify(&a_cnd->condition, TRUE) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_cond_notify(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_cond_broadcast(&a_cnd->condition); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_cond_broadcast(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +cw_bool_t +cnd_timedwait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx, + const struct timespec *a_timeout) +{ + cw_bool_t retval; +#ifdef CW_PTH + pth_event_t event; +#endif +#ifdef CW_PTHREADS + int error; +#endif + struct timeval now; + struct timespec timeout; + struct timezone tz; + + cw_check_ptr(a_cnd); + cw_check_ptr(a_mtx); + cw_check_ptr(a_timeout); + + /* Set timeout. */ + memset(&tz, 0, sizeof(struct timezone)); + gettimeofday(&now, &tz); + timeout.tv_nsec = now.tv_usec * 1000 + a_timeout->tv_nsec; + timeout.tv_sec = (now.tv_sec + a_timeout->tv_sec + + (timeout.tv_nsec / 1000000000)); /* Carry if nanoseconds + * overflowed. */ + /* Chop off the number of nanoseconds to be less than one second. */ + timeout.tv_nsec %= 1000000000; + +#ifdef CW_PTH + event = pth_event(PTH_EVENT_TIME, + pth_time(timeout.tv_sec, timeout.tv_nsec / 1000)); + + if (pth_cond_await(&a_cnd->condition, &a_mtx->mutex, event) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_cond_await(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + + if (pth_event_occurred(event) == FALSE) + { + retval = FALSE; + } + else + { + retval = TRUE; + } +#endif +#ifdef CW_PTHREADS + error = pthread_cond_timedwait(&a_cnd->condition, &a_mtx->mutex, &timeout); + if (error == 0) + { + retval = FALSE; + } + else if (error == ETIMEDOUT) + { + retval = TRUE; + } + else + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_cond_timedwait(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif + + return retval; +} + +void +cnd_wait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_cnd); + cw_check_ptr(a_mtx); + +#ifdef CW_PTH + if (pth_cond_await(&a_cnd->condition, &a_mtx->mutex, NULL) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_cond_wait: %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_cond_wait(&a_cnd->condition, &a_mtx->mutex); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_cond_wait: %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/dch.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/dch.c new file mode 100644 index 000000000..834e99d05 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/dch.c @@ -0,0 +1,347 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#ifdef CW_DBG +#define CW_DCH_MAGIC 0x4327589e +#endif + +static void +dch_p_grow(cw_dch_t *a_dch); +static void +dch_p_shrink(cw_dch_t *a_dch); +static void +dch_p_insert(cw_ch_t *a_ch, cw_chi_t * a_chi); + +cw_dch_t * +dch_new(cw_dch_t *a_dch, cw_opaque_alloc_t *a_alloc, + cw_opaque_dealloc_t *a_dealloc, void *a_arg, cw_uint32_t a_base_table, + cw_uint32_t a_base_grow, cw_uint32_t a_base_shrink, + cw_ch_hash_t *a_hash, cw_ch_key_comp_t *a_key_comp) +{ + cw_dch_t *retval; + + cw_check_ptr(a_alloc); + cw_check_ptr(a_dealloc); + cw_assert(a_base_table > 0); + cw_assert(a_base_grow > 0); + cw_assert(a_base_grow > a_base_shrink); + cw_check_ptr(a_hash); + cw_check_ptr(a_key_comp); + + if (a_dch != NULL) + { + retval = a_dch; + memset(retval, 0, sizeof(cw_dch_t)); + retval->is_malloced = FALSE; + } + else + { + retval = (cw_dch_t *) cw_opaque_alloc(a_alloc, a_arg, sizeof(cw_dch_t)); + memset(retval, 0, sizeof(cw_dch_t)); + retval->is_malloced = TRUE; + } + + retval->alloc = a_alloc; + retval->dealloc = a_dealloc; + retval->arg = a_arg; + retval->base_table = a_base_table; + retval->base_grow = a_base_grow; + retval->base_shrink = a_base_shrink; + retval->shrinkable = TRUE; + retval->grow_factor = 1; + retval->hash = a_hash; + retval->key_comp = a_key_comp; + + xep_begin(); + volatile cw_dch_t *v_retval; + xep_try + { + v_retval = retval; + retval->ch = ch_new(NULL, a_alloc, a_dealloc, a_arg, retval->base_table, + retval->hash, retval->key_comp); + } + xep_catch(CW_ONYXX_OOM) + { + retval = (cw_dch_t *) v_retval; + if (a_dch->is_malloced) + { + cw_opaque_dealloc(a_dealloc, a_arg, retval, sizeof(cw_dch_t)); + } + } + xep_end(); + +#ifdef CW_DBG + retval->magic = CW_DCH_MAGIC; +#endif + + return retval; +} + +void +dch_delete(cw_dch_t *a_dch) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + +#ifdef CW_DCH_VERBOSE + fprintf(stderr, + "%s(%p): num_collisions: %llu, num_inserts: %llu," + " num_removes: %llu, num_searches: %llu, num_grows: %llu," + " num_shrinks: %llu\n", + __FUNCTION__, a_dch, a_dch->ch->num_collisions, + a_dch->ch->num_inserts, a_dch->ch->num_removes, + a_dch->ch->num_searches, a_dch->num_grows, a_dch->num_shrinks); +#endif + + ch_delete(a_dch->ch); + + if (a_dch->is_malloced) + { + cw_opaque_dealloc(a_dch->dealloc, a_dch->arg, a_dch, sizeof(cw_dch_t)); + } +#ifdef CW_DBG + else + { + memset(a_dch, 0x5a, sizeof(cw_dch_t)); + } +#endif +} + +cw_uint32_t +dch_count(cw_dch_t *a_dch) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + return ch_count(a_dch->ch); +} + +cw_bool_t +dch_shrinkable_get(cw_dch_t *a_dch) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + return a_dch->shrinkable; +} + +void +dch_shrinkable_set(cw_dch_t *a_dch, cw_bool_t a_shrinkable) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + a_dch->shrinkable = a_shrinkable; +} + +void +dch_insert(cw_dch_t *a_dch, const void *a_key, const void *a_data, + cw_chi_t *a_chi) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + dch_p_grow(a_dch); + ch_insert(a_dch->ch, a_key, a_data, a_chi); +} + +cw_bool_t +dch_remove(cw_dch_t *a_dch, const void *a_search_key, void **r_key, + void **r_data, cw_chi_t **r_chi) +{ + cw_bool_t retval; + + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + if (a_dch->shrinkable) + { + dch_p_shrink(a_dch); + } + if (ch_remove(a_dch->ch, a_search_key, r_key, r_data, r_chi)) + { + retval = TRUE; + goto RETURN; + } + retval = FALSE; + RETURN: + return retval; +} + +cw_bool_t +dch_search(cw_dch_t *a_dch, const void *a_key, void **r_data) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + return ch_search(a_dch->ch, a_key, r_data); +} + +cw_bool_t +dch_get_iterate(cw_dch_t *a_dch, void **r_key, void **r_data) +{ + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + return ch_get_iterate(a_dch->ch, r_key, r_data); +} + +cw_bool_t +dch_remove_iterate(cw_dch_t *a_dch, void **r_key, void **r_data, + cw_chi_t **r_chi) +{ + cw_bool_t retval; + + cw_check_ptr(a_dch); + cw_dassert(a_dch->magic == CW_DCH_MAGIC); + + if (a_dch->shrinkable) + { + dch_p_shrink(a_dch); + } + if (ch_remove_iterate(a_dch->ch, r_key, r_data, r_chi)) + { + retval = TRUE; + goto RETURN; + } + retval = FALSE; + RETURN: + return retval; +} + +/* Given the ch API, there is no way to both safely and efficiently transfer the + * contents of one ch to another. Therefore, this function mucks with ch + * internals. */ +static void +dch_p_grow(cw_dch_t *a_dch) +{ + cw_ch_t *t_ch; + cw_chi_t *chi; + cw_uint32_t count, i; + + count = ch_count(a_dch->ch); + + if ((count + 1) > (a_dch->grow_factor * a_dch->base_grow)) + { + /* Too big. Create a new ch twice as large and populate it. */ + t_ch = ch_new(NULL, a_dch->alloc, a_dch->dealloc, a_dch->arg, + a_dch->base_table * a_dch->grow_factor * 2, a_dch->hash, + a_dch->key_comp); + for (i = 0; i < count; i++) + { + chi = ql_first(&a_dch->ch->chi_ql); + ql_remove(&a_dch->ch->chi_ql, chi, ch_link); + ql_elm_new(chi, slot_link); + dch_p_insert(t_ch, chi); + } + + a_dch->grow_factor *= 2; +#ifdef CW_DCH_COUNT + a_dch->num_grows++; + t_ch->num_collisions += a_dch->ch->num_collisions; + t_ch->num_inserts += a_dch->ch->num_inserts; + t_ch->num_removes += a_dch->ch->num_removes; + t_ch->num_searches += a_dch->ch->num_searches; +#endif + /* Set to NULL to keep ch_delete() from deleting all the items. */ + ql_first(&a_dch->ch->chi_ql) = NULL; + ch_delete(a_dch->ch); + a_dch->ch = t_ch; + } +} + +/* Given the ch API, there is no way to both safely and efficiently transfer the + * contents of one ch to another. Therefore, this function mucks with ch + * internals. */ +static void +dch_p_shrink(cw_dch_t *a_dch) +{ + cw_ch_t *t_ch; + cw_chi_t *chi; + cw_uint32_t count, i; + + count = ch_count(a_dch->ch); + + if ((count - 1 < a_dch->base_shrink * a_dch->grow_factor) + && (a_dch->grow_factor > 1)) + { + cw_uint32_t new_factor; + + /* + * Too big. Create a new ch with the smallest grow factor that + * does not cause the ch to be overflowed. + */ + for (new_factor = 1; new_factor * a_dch->base_grow <= count - 1; + new_factor *= 2) + { + cw_assert(new_factor < a_dch->grow_factor); + } + cw_assert(new_factor > 0); + cw_assert(new_factor < a_dch->grow_factor); + + t_ch = ch_new(NULL, a_dch->alloc, a_dch->dealloc, a_dch->arg, + a_dch->base_table * new_factor, a_dch->hash, + a_dch->key_comp); + for (i = 0; i < count; i++) + { + chi = ql_first(&a_dch->ch->chi_ql); + ql_remove(&a_dch->ch->chi_ql, chi, ch_link); + ql_elm_new(chi, slot_link); + dch_p_insert(t_ch, chi); + } + + a_dch->grow_factor = new_factor; +#ifdef CW_DCH_COUNT + a_dch->num_shrinks++; + t_ch->num_collisions += a_dch->ch->num_collisions; + t_ch->num_inserts += a_dch->ch->num_inserts; + t_ch->num_removes += a_dch->ch->num_removes; + t_ch->num_searches += a_dch->ch->num_searches; +#endif + /* Set to NULL to keep ch_delete() from deleting all the items. */ + ql_first(&a_dch->ch->chi_ql) = NULL; + ch_delete(a_dch->ch); + a_dch->ch = t_ch; + } +} + +/* Given the ch API, there is no way to both safely and efficiently transfer the + * contents of one ch to another. Therefore, this function mucks with ch + * internals. */ +static void +dch_p_insert(cw_ch_t *a_ch, cw_chi_t *a_chi) +{ + cw_uint32_t slot; + + /* Initialize a_chi. */ + slot = a_ch->hash(a_chi->key) % a_ch->table_size; + a_chi->slot = slot; + + /* Hook into ch-wide list. */ + ql_tail_insert(&a_ch->chi_ql, a_chi, ch_link); + + /* Hook into the slot list. */ +#ifdef CW_DCH_COUNT + if (ql_first(&a_ch->table[slot]) != NULL) + { + a_ch->num_collisions++; + } +#endif + ql_head_insert(&a_ch->table[slot], a_chi, slot_link); + + a_ch->count++; +#ifdef CW_DCH_COUNT + a_ch->num_inserts++; +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/envdict.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/envdict.c new file mode 100644 index 000000000..488195c7c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/envdict.c @@ -0,0 +1,60 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define CW_NX_ENVDICT_SIZE 128 + +void +envdict_l_populate(cw_nxo_t *a_dict, cw_nx_t *a_nx, char **a_envp) +{ + int i; + char *val_str; + cw_uint8_t *t_str; + cw_uint32_t key_len, val_len; + cw_nxo_t key_nxo, val_nxo; + + nxo_dict_new(a_dict, a_nx, TRUE, CW_NX_ENVDICT_SIZE); + + if (a_envp != NULL) + { + /* + * Iterate through key/value strings in the environment vector + * and insert them into the dictionary. + */ + for (i = 0; a_envp[i] != NULL; i++) + { + /* Find the '=' that separates key and value. */ + val_str = strchr(a_envp[i], '='); + key_len = val_str - a_envp[i]; + val_str++; + + /* Create key. */ + nxo_name_new(&key_nxo, a_nx, a_envp[i], key_len, FALSE); + + /* Create value. */ + val_len = strlen(val_str); + nxo_string_new(&val_nxo, a_nx, TRUE, val_len); + t_str = nxo_string_get(&val_nxo); +#ifdef CW_THREADS + nxo_string_lock(&val_nxo); +#endif + memcpy(t_str, val_str, val_len); +#ifdef CW_THREADS + nxo_string_unlock(&val_nxo); +#endif + + /* Insert into dictionary. */ + nxo_dict_def(a_dict, a_nx, &key_nxo, &val_nxo); + } + } +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/gcdict.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/gcdict.c new file mode 100644 index 000000000..c47b96751 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/gcdict.c @@ -0,0 +1,269 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxa_l.h" + +struct cw_gcdict_entry +{ + cw_nxn_t nxn; + cw_op_t *op_f; +}; + +#define ENTRY(name) {NXN_##name, gcdict_##name} + +/* Array of operators in gcdict. */ +static const struct cw_gcdict_entry gcdict_ops[] = { + ENTRY(active), + ENTRY(collect), +#ifdef CW_PTHREADS + ENTRY(period), +#endif + ENTRY(setactive), +#ifdef CW_PTHREADS + ENTRY(setperiod), +#endif + ENTRY(setthreshold), + ENTRY(stats), + ENTRY(threshold) +}; + +/* This is a global dictionary, but it should never be written to except by the + * GC thread, so don't bother locking it. */ +void +gcdict_l_populate(cw_nxo_t *a_dict, cw_nxa_t *a_nxa) +{ + cw_uint32_t i; + cw_nxo_t name, value; + cw_nx_t *nx; + +#define NEXTRA 0 +#define NENTRIES (sizeof(gcdict_ops) / sizeof(struct cw_gcdict_entry)) + + nx = nxa_nx_get(a_nxa); + nxo_dict_new(a_dict, nx, FALSE, NENTRIES + NEXTRA); + + for (i = 0; i < NENTRIES; i++) + { + nxo_name_new(&name, nx, nxn_str(gcdict_ops[i].nxn), + nxn_len(gcdict_ops[i].nxn), TRUE); + nxo_operator_new(&value, gcdict_ops[i].op_f, gcdict_ops[i].nxn); + nxo_attr_set(&value, NXOA_EXECUTABLE); + + nxo_dict_def(a_dict, nx, &name, &value); + } + + cw_assert(nxo_dict_count(a_dict) == NENTRIES + NEXTRA); +#undef NENTRIES +} + +void +gcdict_active(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxa_t *nxa; + cw_nxo_t *active; + + ostack = nxo_thread_ostack_get(a_thread); + nxa = nx_nxa_get(nxo_thread_nx_get(a_thread)); + active = nxo_stack_push(ostack); + nxo_boolean_new(active, nxa_active_get(nxa)); +} + +void +gcdict_collect(cw_nxo_t *a_thread) +{ + nxa_collect(nx_nxa_get(nxo_thread_nx_get(a_thread))); +} + +#ifdef CW_PTHREADS +void +gcdict_period(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxa_t *nxa; + cw_nxo_t *period; + + ostack = nxo_thread_ostack_get(a_thread); + nxa = nx_nxa_get(nxo_thread_nx_get(a_thread)); + period = nxo_stack_push(ostack); + nxo_integer_new(period, nxa_period_get(nxa)); +} +#endif + +void +gcdict_setactive(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *active; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(active, ostack, a_thread); + if (nxo_type_get(active) != NXOT_BOOLEAN) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxa_active_set(nx_nxa_get(nxo_thread_nx_get(a_thread)), + nxo_boolean_get(active)); + + nxo_stack_pop(ostack); +} + +#ifdef CW_PTHREADS +void +gcdict_setperiod(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *period; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(period, ostack, a_thread); + if (nxo_type_get(period) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(period) < 0 || nxo_integer_get(period) > UINT_MAX) + { + nxo_thread_nerror(a_thread, NXN_limitcheck); + return; + } + + nxa_period_set(nx_nxa_get(nxo_thread_nx_get(a_thread)), + nxo_integer_get(period)); + + nxo_stack_pop(ostack); +} +#endif + +void +gcdict_setthreshold(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *threshold; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(threshold, ostack, a_thread); + if (nxo_type_get(threshold) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(threshold) < 0 || nxo_integer_get(threshold) > UINT_MAX) + { + nxo_thread_nerror(a_thread, NXN_limitcheck); + return; + } + + nxa_threshold_set(nx_nxa_get(nxo_thread_nx_get(a_thread)), + nxo_integer_get(threshold)); + + nxo_stack_pop(ostack); +} + +/* Create a stats array: + * + * stats --> [ + * collections + * count + * current --> [ count mark sweep ] + * maximum --> [ count mark sweep ] + * sum --> [ count mark sweep ] + * ] + */ +void +gcdict_stats(cw_nxo_t *a_thread) +{ + cw_nx_t *nx; + cw_nxa_t *nxa; + cw_bool_t currentlocking; + cw_nxo_t *ostack, *tstack; + cw_nxo_t *stats, *nxo, *tnxo; + cw_nxoi_t collections, count; + cw_nxoi_t ccount, cmark, csweep; + cw_nxoi_t mcount, mmark, msweep; + cw_nxoi_t scount, smark, ssweep; + + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + currentlocking = nxo_thread_currentlocking(a_thread); + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + nxo = nxo_stack_push(tstack); + tnxo = nxo_stack_push(tstack); + + /* Get stats. */ + nxa_stats_get(nxa, &collections, &count, + &ccount, &cmark, &csweep, + &mcount, &mmark, &msweep, + &scount, &smark, &ssweep); + + /* Create the main array. */ + stats = nxo_stack_push(ostack); + nxo_array_new(stats, nx, currentlocking, 5); + + /* collections. */ + nxo_integer_new(nxo, collections); + nxo_array_el_set(stats, nxo, 0); + + /* count. */ + nxo_integer_new(nxo, count); + nxo_array_el_set(stats, nxo, 1); + + /* current. */ + nxo_array_new(nxo, nx, currentlocking, 3); + nxo_integer_new(tnxo, ccount); + nxo_array_el_set(nxo, tnxo, 0); + nxo_integer_new(tnxo, cmark); + nxo_array_el_set(nxo, tnxo, 1); + nxo_integer_new(tnxo, csweep); + nxo_array_el_set(nxo, tnxo, 2); + nxo_array_el_set(stats, nxo, 2); + + /* maximum. */ + nxo_array_new(nxo, nx, currentlocking, 3); + nxo_integer_new(tnxo, mcount); + nxo_array_el_set(nxo, tnxo, 0); + nxo_integer_new(tnxo, mmark); + nxo_array_el_set(nxo, tnxo, 1); + nxo_integer_new(tnxo, msweep); + nxo_array_el_set(nxo, tnxo, 2); + nxo_array_el_set(stats, nxo, 3); + + /* current. */ + nxo_array_new(nxo, nx, currentlocking, 3); + nxo_integer_new(tnxo, scount); + nxo_array_el_set(nxo, tnxo, 0); + nxo_integer_new(tnxo, smark); + nxo_array_el_set(nxo, tnxo, 1); + nxo_integer_new(tnxo, ssweep); + nxo_array_el_set(nxo, tnxo, 2); + nxo_array_el_set(stats, nxo, 4); + + nxo_stack_npop(tstack, 2); +} + +void +gcdict_threshold(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxa_t *nxa; + cw_nxo_t *threshold; + + ostack = nxo_thread_ostack_get(a_thread); + nxa = nx_nxa_get(nxo_thread_nx_get(a_thread)); + threshold = nxo_stack_push(ostack); + nxo_integer_new(threshold, nxa_threshold_get(nxa)); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/libonyx.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/libonyx.c new file mode 100644 index 000000000..9f7e9831c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/libonyx.c @@ -0,0 +1,127 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +* Initialization and shutdown functions for the whole library. +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +/* #define CW_MEM_DBG */ + +#ifdef CW_THREADS +void +thd_l_init(void); +void +thd_l_shutdown(void); +#endif +void +xep_l_init(void); +void +xep_l_shutdown(void); + +/* Globals. */ +cw_mem_t *cw_g_mem = NULL; +#ifdef CW_MEM_DBG +static cw_mem_t *cw_g_mem_mem = NULL; +#endif + +#if (defined(CW_SOCKET) && defined(CW_THREADS)) +cw_mtx_t cw_g_gethostbyname_mtx; +cw_mtx_t cw_g_getprotobyname_mtx; +cw_mtx_t cw_g_getservbyname_mtx; +#endif + +void +libonyx_init(void) +{ + volatile cw_uint32_t try_stage = 0; + + /* Start up global modules. */ +#ifdef CW_THREADS + thd_l_init(); +#endif + xep_l_init(); + + xep_begin(); + xep_try + { +#ifdef CW_MEM_DBG + cw_g_mem_mem = mem_new(NULL, NULL); + try_stage = 1; + + cw_g_mem = mem_new(NULL, cw_g_mem_mem); + try_stage = 2; +#else + cw_g_mem = mem_new(NULL, NULL); + try_stage = 2; +#endif + } + xep_catch(CW_ONYXX_OOM) + { + switch (try_stage) + { + case 2: + case 1: + { +#ifdef CW_MEM_DBG + mem_delete(cw_g_mem_mem); + cw_g_mem_mem = NULL; +#endif + } + case 0: + { + break; + } + default: + { + cw_not_reached(); + } + } + } + xep_end(); + +#ifdef CW_POSIX + /* Ignore SIGPIPE, so that writing to a closed socket won't crash the + * program. */ + signal(SIGPIPE, SIG_IGN); +#endif + +#if (defined(CW_SOCKET) && defined(CW_THREADS)) + /* Initialize mutexes that protect non-reentrant functions. */ + mtx_new(&cw_g_gethostbyname_mtx); + mtx_new(&cw_g_getprotobyname_mtx); + mtx_new(&cw_g_getservbyname_mtx); +#endif +} + +void +libonyx_shutdown(void) +{ + /* Shut down global modules in reverse order. */ +#if (defined(CW_SOCKET) && defined(CW_THREADS)) + mtx_delete(&cw_g_getservbyname_mtx); + mtx_delete(&cw_g_getprotobyname_mtx); + mtx_delete(&cw_g_gethostbyname_mtx); +#endif + + mem_delete(cw_g_mem); + cw_g_mem = NULL; + +#ifdef CW_MEM_DBG + mem_delete(cw_g_mem_mem); + cw_g_mem_mem = NULL; +#endif + + xep_l_shutdown(); +#ifdef CW_THREADS + thd_l_shutdown(); +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mb.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mb.c new file mode 100644 index 000000000..b403c92d0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mb.c @@ -0,0 +1,16 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + ******************************************************************************/ + +/* Compile non-inlined functions if not using inlines. */ +#define CW_MB_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mem.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mem.c new file mode 100644 index 000000000..02b949d2f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mem.c @@ -0,0 +1,464 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#ifdef cw_malloc +#undef cw_malloc +#endif +#define cw_malloc(a) malloc(a) + +#ifdef cw_calloc +#undef cw_calloc +#endif +#define cw_calloc(a, b) calloc(a, b) + +#ifdef cw_realloc +#undef cw_realloc +#endif +#define cw_realloc(a, b) realloc(a, b) + +#ifdef cw_free +#undef cw_free +#endif +#define cw_free(a) free(a) + +#ifdef CW_MEM_ERROR +struct cw_mem_item_s +{ + size_t size; + char *filename; + cw_uint32_t line_num; + cw_chi_t chi; /* For internal ch linkage. */ +}; +#endif + +cw_mem_t * +mem_new(cw_mem_t *a_mem, cw_mem_t *a_internal) +{ + cw_mem_t *retval; + volatile cw_uint32_t try_stage = 0; + + xep_begin(); + volatile cw_mem_t *v_retval; + xep_try + { + if (a_mem != NULL) + { + v_retval = retval = a_mem; + retval->is_malloced = FALSE; + } + else + { + v_retval = retval = (cw_mem_t *) mem_malloc(a_internal, + sizeof(cw_mem_t)); + retval->is_malloced = TRUE; + } + retval->mem = a_internal; +#ifdef CW_THREADS + mtx_new(&retval->lock); +#endif + try_stage = 1; + +#ifdef CW_MEM_ERROR + retval->addr_hash = dch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, + a_internal, CW_MEM_BASE_TABLE, + CW_MEM_BASE_GROW, + CW_MEM_BASE_SHRINK, ch_direct_hash, + ch_direct_key_comp); + try_stage = 2; +#endif + retval->handler_data = NULL; + } + xep_catch(CW_ONYXX_OOM) + { + retval = (cw_mem_t *)v_retval; + switch (try_stage) + { + case 1: + { +#ifdef CW_THREADS + mtx_delete(&retval->lock); +#endif + if (retval->is_malloced) + { + mem_free(a_internal, retval); + } + } + case 0: + { + break; + } + } + } + xep_end(); + return retval; +} + +void +mem_delete(cw_mem_t *a_mem) +{ + cw_check_ptr(a_mem); + +#ifdef CW_MEM_ERROR + { + cw_uint32_t i, num_addrs; + void *addr; + struct cw_mem_item_s *allocation; + + num_addrs = dch_count(a_mem->addr_hash); + + if (num_addrs > 0) + { + fprintf(stderr, "%s(%p): %u unfreed allocation%s\n", + __FUNCTION__, a_mem, num_addrs, num_addrs != 1 ? "s" : ""); + } + for (i = 0; i < num_addrs; i++) + { + dch_remove_iterate(a_mem->addr_hash, &addr, (void **) &allocation, + NULL); + fprintf(stderr, + "%s(%p): %p, size %zu never freed (allocated at %s:%u)\n", + __FUNCTION__, a_mem, addr, + allocation->size, allocation->filename, + allocation->line_num); + mem_free(a_mem->mem, allocation->filename); + mem_free(a_mem->mem, allocation); + } + dch_delete(a_mem->addr_hash); +#ifdef CW_THREADS + mtx_delete(&a_mem->lock); +#endif + } +#endif + + if (a_mem->is_malloced) + { + mem_free(a_mem->mem, a_mem); + } +} + +void * +mem_malloc_e(cw_mem_t *a_mem, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num) +{ + void *retval; + + cw_assert(a_size > 0); + +#ifdef CW_MEM_ERROR +#ifdef CW_THREADS + if (a_mem != NULL) + { + mtx_lock(&a_mem->lock); + } +#endif +#endif + + retval = cw_malloc(a_size); + if (retval == NULL) + { +#ifdef CW_MEM_ERROR + fprintf(stderr, "%s(%p): %p <-- malloc(%zu) at %s:%u\n", + __FUNCTION__, a_mem, retval, a_size, a_filename, a_line_num); +#endif + xep_throw(CW_ONYXX_OOM); + } + +#ifdef CW_MEM_ERROR + if (a_mem != NULL) + { + struct cw_mem_item_s *old_allocation; + + if (a_filename == NULL) + { + a_filename = ""; + } + + if (dch_search(a_mem->addr_hash, retval, (void **) &old_allocation) + == FALSE) + { + fprintf(stderr, "%s(%p): %p multiply-allocated " + "(was at %s:%u, size %zu; now at %s:%u, size %zu)\n", + __FUNCTION__, a_mem, retval, + old_allocation->filename, old_allocation->line_num, + old_allocation->size, a_filename, a_line_num, + a_size); + } + else + { + struct cw_mem_item_s *allocation; + + allocation = mem_malloc(a_mem->mem, sizeof(struct cw_mem_item_s)); + memset(retval, 0xa5, a_size); + + allocation->size = a_size; + allocation->filename = mem_malloc(a_mem->mem, + strlen(a_filename) + 1); + memcpy(allocation->filename, a_filename, + strlen(a_filename) + 1); + allocation->line_num = a_line_num; + +#ifdef CW_MEM_VERBOSE + fprintf(stderr, "%s(%p): %p <-- malloc(%zu) at %s:%u\n", + __FUNCTION__, a_mem, retval, a_size, a_filename, + a_line_num); +#endif + dch_insert(a_mem->addr_hash, retval, allocation, &allocation->chi); + } +#ifdef CW_THREADS + mtx_unlock(&a_mem->lock); +#endif + } +#endif + + return retval; +} + +void * +mem_calloc_e(cw_mem_t *a_mem, size_t a_number, size_t a_size, + const char *a_filename, cw_uint32_t a_line_num) +{ + void *retval; + + cw_assert(a_size * a_number > 0); + +#ifdef CW_MEM_ERROR +#ifdef CW_THREADS + if (a_mem != NULL) + { + mtx_lock(&a_mem->lock); + } +#endif +#endif + + retval = cw_calloc(a_number, a_size); + if (retval == NULL) + { +#ifdef CW_MEM_ERROR + fprintf(stderr, "%s(%p): %p <-- calloc(%zu, %zu) at %s:%u\n", + __FUNCTION__, a_mem, retval, a_number, a_size, + a_filename, a_line_num); +#endif + xep_throw(CW_ONYXX_OOM); + } + +#ifdef CW_MEM_ERROR + if (a_mem != NULL) + { + struct cw_mem_item_s *old_allocation; + + if (a_filename == NULL) + { + a_filename = ""; + } + + if (dch_search(a_mem->addr_hash, retval, (void **) &old_allocation) + == FALSE) + { + fprintf(stderr, "%s(%p): %p multiply-allocated " + "(was at %s:%u, size %zu; now at %s:%u, size %zu\n", + __FUNCTION__, a_mem, retval, + old_allocation->filename, old_allocation->line_num, + old_allocation->size, a_filename, a_line_num, + a_size); + } + else + { + struct cw_mem_item_s *allocation; + + allocation = mem_malloc(a_mem->mem, sizeof(struct cw_mem_item_s)); + /* Leave the memory alone, since calloc() is supposed to return + * zeroed memory. */ + + allocation->size = a_number * a_size; + allocation->filename = mem_malloc(a_mem->mem, + strlen(a_filename) + 1); + memcpy(allocation->filename, a_filename, strlen(a_filename) + 1); + allocation->line_num = a_line_num; + +#ifdef CW_MEM_VERBOSE + fprintf(stderr, "%s(%p): %p <-- calloc(%zu, %zu) at %s:%u\n", + __FUNCTION__, a_mem, retval, a_number, a_size, + a_filename, a_line_num); +#endif + dch_insert(a_mem->addr_hash, retval, allocation, + &allocation->chi); + } + } +#ifdef CW_THREADS + if (a_mem != NULL) + { + mtx_unlock(&a_mem->lock); + } +#endif +#endif + + return retval; +} + +void * +mem_realloc_e(cw_mem_t *a_mem, void *a_ptr, size_t a_size, size_t a_old_size, + const char *a_filename, cw_uint32_t a_line_num) +{ + void *retval; + + cw_check_ptr(a_ptr); + cw_assert(a_size > 0); + +#ifdef CW_MEM_ERROR +#ifdef CW_THREADS + if (a_mem != NULL) + { + mtx_lock(&a_mem->lock); + } +#endif +#endif + + retval = cw_realloc(a_ptr, a_size); + if (retval == NULL) + { +#ifdef CW_MEM_ERROR + fprintf(stderr, "%s(%p): %p <-- realloc(%p, %zu) at %s:%u\n", + __FUNCTION__, a_mem, retval, a_ptr, a_size, + a_filename, a_line_num); +#endif + xep_throw(CW_ONYXX_OOM); + } + +#ifdef CW_MEM_ERROR + if (a_mem != NULL) + { + struct cw_mem_item_s *allocation; + + if (a_filename == NULL) + { + a_filename = ""; + } + + if (dch_remove(a_mem->addr_hash, a_ptr, NULL, (void **) &allocation, + NULL)) + { + fprintf(stderr, "%s(%p): %p not allocated\n", __FUNCTION__, a_mem, + a_ptr); + } + else + { + char *old_filename; + size_t old_size; + cw_uint32_t old_line_num; + + old_filename = allocation->filename; + old_size = allocation->size; + old_line_num = allocation->line_num; + allocation->filename = mem_malloc(a_mem->mem, + strlen(a_filename) + 1); + memcpy(allocation->filename, a_filename, strlen(a_filename) + 1); + allocation->size = a_size; + allocation->line_num = a_line_num; + + dch_insert(a_mem->addr_hash, retval, allocation, &allocation->chi); + if (a_size > old_size) + { + memset(((cw_uint8_t *) retval) + old_size, 0xa5, + a_size - old_size); + } + if (a_old_size != 0 && a_old_size != old_size) + { + fprintf(stderr, "%s(%p): Wrong size %zu for %p " + "at %s:%u (size %zu, allocated at %s:%u)\n", + __FUNCTION__, a_mem, a_old_size, a_ptr, + a_filename, a_line_num, old_size, + old_filename, old_line_num); + } +#ifdef CW_MEM_VERBOSE + fprintf(stderr, "%s(%p): %p <-- realloc(%p, %zu) at " + "%s:%u (was size %zu, allocated at %s:%u)\n", + __FUNCTION__, a_mem, retval, a_ptr, a_size, + a_filename, a_line_num, old_size, old_filename, + old_line_num); +#endif + mem_free(a_mem->mem, old_filename); + } + } +#ifdef CW_THREADS + if (a_mem != NULL) + { + mtx_unlock(&a_mem->lock); + } +#endif +#endif + + return retval; +} + +void +mem_free_e(cw_mem_t *a_mem, void *a_ptr, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num) +{ +#ifdef CW_MEM_ERROR + if (a_mem != NULL) + { + struct cw_mem_item_s *allocation; + + if (a_filename == NULL) + { + a_filename = ""; + } + +#ifdef CW_THREADS + mtx_lock(&a_mem->lock); +#endif + + if (dch_remove(a_mem->addr_hash, a_ptr, NULL, (void **) &allocation, + NULL)) + { + fprintf(stderr, "%s(%p): %p not allocated, attempted " + "to free at %s:%u\n", __FUNCTION__, a_mem, a_ptr, + a_filename, a_line_num); + } + else + { + if (a_size != 0 && a_size != allocation->size) + { + fprintf(stderr, "%s(%p): Wrong size %zu for %p " + "at %s:%u (size %zu, allocated at %s:%u)\n", + __FUNCTION__, a_mem, a_size, a_ptr, + a_filename, a_line_num, allocation->size, + allocation->filename, allocation->line_num); + } +#ifdef CW_MEM_VERBOSE + fprintf(stderr, "%s(%p): free(%p) at %s:%u " + "(size %zu, allocated at %s:%u)\n", __FUNCTION__, + a_mem, a_ptr, a_filename, a_line_num, + allocation->size, allocation->filename, + allocation->line_num); +#endif + memset(a_ptr, 0x5a, allocation->size); + mem_free(a_mem->mem, allocation->filename); + mem_free(a_mem->mem, allocation); + } + } +#endif + + cw_free(a_ptr); + +#ifdef CW_MEM_ERROR +#ifdef CW_THREADS + if (a_mem != NULL) + { + mtx_unlock(&a_mem->lock); + } +#endif +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mq.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mq.c new file mode 100644 index 000000000..763a618ee --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mq.c @@ -0,0 +1,578 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#include + +#ifdef CW_DBG +#define CW_MQ_MAGIC 0xab01cd23 +#endif + +/* Number of messages to allocate space for when a message queue is first + * created. Since message space is doubled when more space is needed, this + * number isn't very important to performance, but if it is too high, space may + * be wasted. */ +#ifdef CW_DBG +#define CW_MQ_ARRAY_MIN_SIZE 1 +#else +#define CW_MQ_ARRAY_MIN_SIZE 8 +#endif + +void +mq_new(cw_mq_t *a_mq, cw_mem_t *a_mem, cw_uint32_t a_msg_size) +{ + cw_check_ptr(a_mq); + + a_mq->mem = a_mem; + a_mq->msg_count = 0; + + switch (a_msg_size) { + case 1: + { + a_mq->msg_size = 1; + break; + } + case 2: + { + a_mq->msg_size = 2; + break; + } + case 4: + { + a_mq->msg_size = 4; + break; + } + case 8: + { + a_mq->msg_size = 8; + break; + } + default: + { + cw_not_reached(); + } + } + + a_mq->msgs_vec_count = CW_MQ_ARRAY_MIN_SIZE; + a_mq->msgs_beg = 0; + a_mq->msgs_end = 0; + + a_mq->msgs.x + = (cw_uint32_t *) mem_malloc(a_mem, + a_mq->msgs_vec_count * a_mq->msg_size); + + mtx_new(&a_mq->lock); + cnd_new(&a_mq->cond); + + a_mq->get_stop = FALSE; + a_mq->put_stop = FALSE; + +#ifdef CW_DBG + a_mq->magic = CW_MQ_MAGIC; +#endif +} + +void +mq_delete(cw_mq_t *a_mq) +{ + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + + mtx_delete(&a_mq->lock); + cnd_delete(&a_mq->cond); + + mem_free(a_mq->mem, a_mq->msgs.x); + +#ifdef CW_DBG + memset(a_mq, 0x5a, sizeof(cw_mq_t)); +#endif +} + +cw_bool_t +mq_tryget(cw_mq_t *a_mq, ...) +{ + cw_bool_t retval; + union + { + cw_uint8_t *one; + cw_uint16_t *two; + cw_uint32_t *four; + cw_uint64_t *eight; + void *x; /* Don't care. */ + } r_msg; + va_list ap; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + + va_start(ap, a_mq); + r_msg.x = (void *) va_arg(ap, void *); + va_end(ap); + + mtx_lock(&a_mq->lock); + + if (a_mq->get_stop) + { + retval = TRUE; + goto RETURN; + } + if (a_mq->msg_count > 0) + { + switch (a_mq->msg_size) + { + case 1: + { + *r_msg.one = a_mq->msgs.one[a_mq->msgs_beg]; + break; + } + case 2: + { + *r_msg.two = a_mq->msgs.two[a_mq->msgs_beg]; + break; + } + case 4: + { + *r_msg.four = a_mq->msgs.four[a_mq->msgs_beg]; + break; + } + case 8: + { + *r_msg.eight = a_mq->msgs.eight[a_mq->msgs_beg]; + break; + } + default: + { + cw_not_reached(); + } + } + a_mq->msg_count--; + a_mq->msgs_beg = (a_mq->msgs_beg + 1) % a_mq->msgs_vec_count; + } + else + { + retval = TRUE; + goto RETURN; + } + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_timedget(cw_mq_t *a_mq, const struct timespec *a_timeout, ...) +{ + cw_bool_t retval, timed_out; + union + { + cw_uint8_t *one; + cw_uint16_t *two; + cw_uint32_t *four; + cw_uint64_t *eight; + void *x; /* Don't care. */ + } r_msg; + va_list ap; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + cw_check_ptr(a_timeout); + + va_start(ap, a_timeout); + r_msg.x = (void *) va_arg(ap, void *); + va_end(ap); + + mtx_lock(&a_mq->lock); + + if (a_mq->get_stop) + { + retval = TRUE; + goto RETURN; + } + /* A spurious wakeup will cause the timeout interval to start over. This + * isn't a big deal as long as spurious wakeups don't occur continuously, + * since the timeout period is merely a lower bound on how long to wait. */ + for (timed_out = FALSE; a_mq->msg_count == 0 && timed_out == FALSE;) + { + timed_out = cnd_timedwait(&a_mq->cond, &a_mq->lock, a_timeout); + if (a_mq->get_stop) + { + retval = TRUE; + goto RETURN; + } + } + if (a_mq->msg_count > 0) + { + switch (a_mq->msg_size) + { + case 1: + { + *r_msg.one = a_mq->msgs.one[a_mq->msgs_beg]; + break; + } + case 2: + { + *r_msg.two = a_mq->msgs.two[a_mq->msgs_beg]; + break; + } + case 4: + { + *r_msg.four = a_mq->msgs.four[a_mq->msgs_beg]; + break; + } + case 8: + { + *r_msg.eight = a_mq->msgs.eight[a_mq->msgs_beg]; + break; + } + default: + { + cw_not_reached(); + } + } + a_mq->msg_count--; + a_mq->msgs_beg = (a_mq->msgs_beg + 1) % a_mq->msgs_vec_count; + } + else + { + retval = TRUE; + goto RETURN; + } + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_get(cw_mq_t *a_mq, ...) +{ + cw_bool_t retval; + union + { + cw_uint8_t *one; + cw_uint16_t *two; + cw_uint32_t *four; + cw_uint64_t *eight; + void *x; /* Don't care. */ + } r_msg; + va_list ap; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + + va_start(ap, a_mq); + r_msg.x = (void *) va_arg(ap, void *); + va_end(ap); + + mtx_lock(&a_mq->lock); + + if (a_mq->get_stop) + { + retval = TRUE; + goto RETURN; + } + while (a_mq->msg_count == 0) + { + cnd_wait(&a_mq->cond, &a_mq->lock); + if (a_mq->get_stop) + { + retval = TRUE; + goto RETURN; + } + } + + switch (a_mq->msg_size) + { + case 1: + { + *r_msg.one = a_mq->msgs.one[a_mq->msgs_beg]; + break; + } + case 2: + { + *r_msg.two = a_mq->msgs.two[a_mq->msgs_beg]; + break; + } + case 4: + { + *r_msg.four = a_mq->msgs.four[a_mq->msgs_beg]; + break; + } + case 8: + { + *r_msg.eight = a_mq->msgs.eight[a_mq->msgs_beg]; + break; + } + default: + { + cw_not_reached(); + } + } + a_mq->msg_count--; + a_mq->msgs_beg = (a_mq->msgs_beg + 1) % a_mq->msgs_vec_count; + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_put(cw_mq_t *a_mq, ...) +{ + cw_bool_t retval; + union + { + cw_uint32_t four; + cw_uint64_t eight; + } a_msg; + va_list ap; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + + va_start(ap, a_mq); + switch (a_mq->msg_size) + { + case 1: /* Compiler-promoted to 32 bits. */ + case 2: /* Compiler-promoted to 32 bits. */ + case 4: + { + a_msg.four = va_arg(ap, cw_uint32_t); + break; + } + case 8: + { + a_msg.eight = va_arg(ap, cw_uint64_t); + break; + } + default: + { + cw_not_reached(); + } + } + va_end(ap); + + mtx_lock(&a_mq->lock); + + if (a_mq->msg_count == 0) + { + cnd_broadcast(&a_mq->cond); + } + if (a_mq->put_stop) + { + retval = TRUE; + goto RETURN; + } + else + { + if (a_mq->msg_count >= a_mq->msgs_vec_count) + { + union + { + cw_uint8_t *one; + cw_uint16_t *two; + cw_uint32_t *four; + cw_uint64_t *eight; + void *x; /* Don't care. */ + } t_msgs; + cw_uint32_t i, offset; + + /* Array overflow. Double the array and copy the messages. */ + t_msgs.x = (void *) mem_malloc(a_mq->mem, + a_mq->msgs_vec_count * 2 * + a_mq->msg_size); + + switch (a_mq->msg_size) + { + case 1: + { + for (i = 0, offset = a_mq->msgs_beg; + i < a_mq->msg_count; + i++, offset = (offset + 1) % a_mq->msgs_vec_count) + { + t_msgs.one[i] = a_mq->msgs.one[offset]; + } + break; + } + case 2: + { + for (i = 0, offset = a_mq->msgs_beg; + i < a_mq->msg_count; + i++, offset = (offset + 1) % a_mq->msgs_vec_count) + { + t_msgs.two[i] = a_mq->msgs.two[offset]; + } + break; + } + case 4: + { + for (i = 0, offset = a_mq->msgs_beg; + i < a_mq->msg_count; + i++, offset = (offset + 1) % a_mq->msgs_vec_count) + { + t_msgs.four[i] = a_mq->msgs.four[offset]; + } + break; + } + case 8: + { + for (i = 0, offset = a_mq->msgs_beg; + i < a_mq->msg_count; + i++, offset = (offset + 1) % a_mq->msgs_vec_count) + { + t_msgs.eight[i] = a_mq->msgs.eight[offset]; + } + break; + } + default: + { + cw_not_reached(); + } + } + mem_free(a_mq->mem, a_mq->msgs.x); + a_mq->msgs.x = t_msgs.x; + a_mq->msgs_beg = 0; + a_mq->msgs_end = a_mq->msg_count; + a_mq->msgs_vec_count *= 2; + } + + switch (a_mq->msg_size) + { + case 1: + { + /* The compiler promotes 8 bit args to 32 bits. */ + a_mq->msgs.one[a_mq->msgs_end] = a_msg.four; + break; + } + case 2: + { + /* The compiler promotes 16 bit args to 32 bits. */ + a_mq->msgs.two[a_mq->msgs_end] = a_msg.four; + break; + } + case 4: + { + a_mq->msgs.four[a_mq->msgs_end] = a_msg.four; + break; + } + case 8: + { + a_mq->msgs.eight[a_mq->msgs_end] = a_msg.eight; + break; + } + default: + { + cw_not_reached(); + } + } + a_mq->msg_count++; + a_mq->msgs_end = (a_mq->msgs_end + 1) % a_mq->msgs_vec_count; + } + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_get_start(cw_mq_t *a_mq) +{ + cw_bool_t retval; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + mtx_lock(&a_mq->lock); + + if (a_mq->get_stop == FALSE) + { + retval = TRUE; + goto RETURN; + } + a_mq->get_stop = FALSE; + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_get_stop(cw_mq_t *a_mq) +{ + cw_bool_t retval; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + mtx_lock(&a_mq->lock); + + if (a_mq->get_stop) + { + retval = TRUE; + goto RETURN; + } + cnd_broadcast(&a_mq->cond); + a_mq->get_stop = TRUE; + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_put_start(cw_mq_t *a_mq) +{ + cw_bool_t retval; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + mtx_lock(&a_mq->lock); + + if (a_mq->put_stop == FALSE) + { + retval = TRUE; + goto RETURN; + } + a_mq->put_stop = FALSE; + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} + +cw_bool_t +mq_put_stop(cw_mq_t *a_mq) +{ + cw_bool_t retval; + + cw_check_ptr(a_mq); + cw_dassert(a_mq->magic == CW_MQ_MAGIC); + mtx_lock(&a_mq->lock); + + if (a_mq->put_stop) + { + retval = TRUE; + goto RETURN; + } + a_mq->put_stop = TRUE; + + retval = FALSE; + RETURN: + mtx_unlock(&a_mq->lock); + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mtx.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mtx.c new file mode 100644 index 000000000..56d9812e1 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/mtx.c @@ -0,0 +1,167 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#include +#include + +void +mtx_new(cw_mtx_t *a_mtx) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_mtx); + +#ifdef CW_PTH + if (pth_mutex_init(&a_mtx->mutex) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_mutex_init: %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_mutex_init(&a_mtx->mutex, NULL); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_mutex_init: %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void +mtx_delete(cw_mtx_t *a_mtx) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_mtx); + +#ifdef CW_PTHREADS + error = pthread_mutex_destroy(&a_mtx->mutex); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_mutex_destroy(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void +mtx_lock(cw_mtx_t *a_mtx) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_mtx); + +#ifdef CW_PTH + if (pth_mutex_acquire(&a_mtx->mutex, FALSE, NULL) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_mutex_acquire(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_mutex_lock(&a_mtx->mutex); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_mutex_lock(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +cw_bool_t +mtx_trylock(cw_mtx_t *a_mtx) +{ + cw_bool_t retval; +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_mtx); + +#ifdef CW_PTH + if (pth_mutex_acquire(&a_mtx->mutex, TRUE, NULL)) + { + retval = FALSE; + } + else if (errno == EBUSY) + { + retval = TRUE; + } + else + { + fprintf(stderr, "%s:%d:%s(): Error in pth_mutex_acquire(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_mutex_trylock(&a_mtx->mutex); + if (error == 0) + { + retval = FALSE; + } + else if (error == EBUSY) + { + retval = TRUE; + } + else + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_mutex_trylock(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif + + return retval; +} + +void +mtx_unlock(cw_mtx_t *a_mtx) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_mtx); + +#ifdef CW_PTH + if (pth_mutex_release(&a_mtx->mutex) == FALSE) + { + fprintf(stderr, "%s:%d:%s(): Error in pth_mutex_release(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_mutex_unlock(&a_mtx->mutex); + if (error) + { + fprintf(stderr, "%s:%d:%s(): Error in pthread_mutex_unlock(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx.c new file mode 100644 index 000000000..a4fda5ee6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx.c @@ -0,0 +1,238 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#define CW_NX_C_ + +#include "../include/libonyx/libonyx.h" +#ifdef CW_POSIX +#include "../include/libonyx/envdict_l.h" +#endif +#include "../include/libonyx/gcdict_l.h" +#include "../include/libonyx/systemdict_l.h" +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_name_l.h" + +/* Prototype for automatically generated function. */ +void +nx_p_nxcode(cw_nx_t *a_nx); + +cw_nx_t * +nx_new(cw_nx_t *a_nx, cw_op_t *a_thread_init, int a_argc, char **a_argv, + char **a_envp) +{ + cw_nx_t *retval; + volatile cw_uint32_t try_stage = 0; + + xep_begin(); + volatile cw_nx_t *v_retval; + xep_try + { + if (a_nx != NULL) + { + retval = a_nx; + memset(retval, 0, sizeof(cw_nx_t)); + retval->is_malloced = FALSE; + } + else + { + retval = (cw_nx_t *) cw_malloc(sizeof(cw_nx_t)); + memset(retval, 0, sizeof(cw_nx_t)); + retval->is_malloced = TRUE; + } + v_retval = retval; + try_stage = 1; + +#ifdef CW_DBG + retval->magic = CW_NX_MAGIC; +#endif + + /* Initialize the GC. */ + nxa_l_new(&retval->nxa, retval); + try_stage = 2; + + /* Initialize the global name cache. */ +#ifdef CW_THREADS + mtx_new(&retval->name_lock); +#endif + dch_new(&retval->name_hash, (cw_opaque_alloc_t *) nxa_malloc_e, + (cw_opaque_dealloc_t *) nxa_free_e, &retval->nxa, + CW_LIBONYX_NAME_HASH, CW_LIBONYX_NAME_HASH / 4 * 3, + CW_LIBONYX_NAME_HASH / 4, nxo_l_name_hash, + nxo_l_name_key_comp); + try_stage = 3; + + /* Initialize gcdict. */ + gcdict_l_populate(nxa_gcdict_get(&retval->nxa), &retval->nxa); + try_stage = 4; + + /* Initialize stdin. */ + nxo_file_new(&retval->stdin_nxo, retval, TRUE); +#ifdef CW_POSIX_FILE + nxo_file_fd_wrap(&retval->stdin_nxo, 0); +#endif + nxo_file_buffer_size_set(&retval->stdin_nxo, + CW_LIBONYX_FILE_BUFFER_SIZE); + try_stage = 5; + + /* Initialize stdout. */ + nxo_file_new(&retval->stdout_nxo, retval, TRUE); +#ifdef CW_POSIX_FILE + nxo_file_fd_wrap(&retval->stdout_nxo, 1); +#endif + nxo_file_buffer_size_set(&retval->stdout_nxo, + CW_LIBONYX_FILE_BUFFER_SIZE); + try_stage = 6; + + /* Initialize stderr. */ + nxo_file_new(&retval->stderr_nxo, retval, TRUE); +#ifdef CW_POSIX_FILE + nxo_file_fd_wrap(&retval->stderr_nxo, 2); +#endif + try_stage = 7; + + /* Initialize globaldict. */ + nxo_dict_new(&retval->globaldict, retval, TRUE, + CW_LIBONYX_GLOBALDICT_HASH); + try_stage = 8; + +#ifdef CW_POSIX + /* Initialize envdict. */ + envdict_l_populate(&retval->envdict, retval, a_envp); + try_stage = 9; +#endif + + /* Initialize systemdict. */ + systemdict_l_populate(&retval->systemdict, retval, a_argc, + a_argv); + try_stage = 10; + + /* Initialize threadsdict. */ + nxo_dict_new(&retval->threadsdict, retval, TRUE, + CW_LIBONYX_THREADSDICT_HASH); + try_stage = 11; + + /* Now that all root set objects that nx is responsible for are + * initialized, activate the GC. */ + nxa_active_set(&retval->nxa, TRUE); + + /* Do soft operator initialization. */ + nx_p_nxcode(retval); + + /* Set the thread initialization hook pointer. It's important to set + * this after doing soft operator initialization, so that the hook + * doesn't get called above while ininitializing globally visible soft + * operators. */ + retval->thread_init = a_thread_init; + } + xep_catch (CW_ONYXX_OOM) + { + retval = (cw_nx_t *) v_retval; + switch (try_stage) + { + case 11: + case 10: +#ifdef CW_POSIX + case 9: +#endif + case 8: + case 7: + case 6: + case 5: + case 4: + case 3: + { + nxa_l_shutdown(&retval->nxa); + dch_delete(&retval->name_hash); +#ifdef CW_THREADS + mtx_delete(&retval->name_lock); +#endif + } + case 2: + { + nxa_l_delete(&retval->nxa); + } + case 1: + { +#ifdef CW_DBG + memset(a_nx, 0x5a, sizeof(cw_nx_t)); +#endif + if (retval->is_malloced) + cw_free(retval); + break; + } + default: + { + cw_not_reached(); + } + } + } + xep_end(); + + return retval; +} + +void +nx_delete(cw_nx_t *a_nx) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + a_nx->shutdown = TRUE; + /* All objects must be destroyed before name_hash is deleted, in order to + * avoid a circular shutdown dependency. */ + nxa_l_shutdown(&a_nx->nxa); + dch_delete(&a_nx->name_hash); +#ifdef CW_THREADS + mtx_delete(&a_nx->name_lock); +#endif + nxa_l_delete(&a_nx->nxa); + + if (a_nx->is_malloced) + { + cw_free(a_nx); + } +#ifdef CW_DBG + else + { + memset(a_nx, 0x5a, sizeof(cw_nx_t)); + } +#endif +} + +void +nx_stdin_set(cw_nx_t *a_nx, cw_nxo_t *a_stdin) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + nxo_dup(&a_nx->stdin_nxo, a_stdin); +} + +void +nx_stdout_set(cw_nx_t *a_nx, cw_nxo_t *a_stdout) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + nxo_dup(&a_nx->stdout_nxo, a_stdout); +} + +void +nx_stderr_set(cw_nx_t *a_nx, cw_nxo_t *a_stderr) +{ + cw_check_ptr(a_nx); + cw_dassert(a_nx->magic == CW_NX_MAGIC); + + nxo_dup(&a_nx->stderr_nxo, a_stderr); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx.nx.in b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx.nx.in new file mode 100644 index 000000000..cb0eae74f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx.nx.in @@ -0,0 +1,996 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# This file is processed by nx_gen.nx to produce a more compact embedded version +# in nx_nxcode.c (normal build) and nx_bootstrap.c (development bootstrap). In +# order to make changes to this file take effect in the bootstrap interpreter, +# either type: +# +# cook bootstrap +# +# or +# +# cat nx.nx | onyx nx_gen.nx > nx_boostrap.c +# +# The end result of executing this file is a procedure (executable array). In +# order to support output that differs according to configuration options, a +# string is constructed, then evaluated. +# +# The output of running sprints on the procedure must be evaluatable, which +# means that certain language features such as immediate evaluation must be +# avoided. +# +################################################################################ + +# Initial string with an opening brace to defer execution, to which other +# strings are catenated. +`{' + +` +systemdict begin + +# +# sprintsdict implements syntactic printing to strings for every type. +# +$sprintsdict < + $arraytype { + # #array #depth + dup 0 gt { + over dup echeck { + pop + `_{' + }{ + xcheck { + `{' + }{ + `[' + } ifelse + } ifelse + + # #array #depth #accum + 2 idup length 1 gt { + # #array #depth #accum + 0 1 4 idup length 2 sub { + # #array #depth #accum #i + 3 idup exch get + 2 idup 1 sub + # #array #depth #accum #el #rdepth + over type sprintsdict exch get eval + cat + # #array #depth #accum #el #rdepth + ` ' cat + } for + } if + # #array #depth #accum + + 2 idup length 0 gt { + 2 idup dup length 1 sub get + 2 idup 1 sub + # #array #depth #accum #el #rdepth + over type sprintsdict exch get eval + cat + } if + # #array #depth #accum + + nip + # #array #accum + exch dup echeck { + pop + `}_' + }{ + xcheck { + `}' + }{ + `]' + } ifelse + } ifelse + cat + # #accum + }{ + pop pop + `-array-' + } ifelse + } + $booleantype { + pop + cvs + } +' cat +@enable_threads@ 1 eq { + ` + $conditiontype { + pop pop + `-condition-' + } + ' cat +} if +` + $dicttype { + # #dict #depth + dup 0 gt { + # Update recursion depth. + 1 sub + + 0 + `<' + + # #dict #rdepth #i #accum + 3 idup { + # #dict #rdepth #i #accum #key #value + exch 4 idup + # #dict #rdepth #i #accum #value #key #rdepth + over type sprintsdict exch get eval + ` ' cat + # #dict #rdepth #accum #i #value #keystr + exch 4 idup + # #dict #rdepth #i #accum #keystr #value #rdepth + over type sprintsdict exch get eval + # #dict #rdepth #i #accum #keystr #valstr + cat cat + # #dict #rdepth #i #accum + + # Update counter. + exch 1 add dup 4 idup length lt { + # #dict #rdepth #accum #i + exch + ` ' cat + # #dict #rdepth #i #accum + }{ + # Last element. + exch + # #dict #rdepth #accum + } ifelse + } foreach + # #dict #rdepth #i #accum + + 4 nup pop pop pop + # #accum + `>' + cat + # #accum + }{ + pop pop + `-dict-' + } ifelse + } + $filetype { + pop pop + `-file-' + } + $finotype { + pop pop + `-fino-' + } + $hooktype { + # #hook #depth + exch hooktag + # #depth #tag + dup type $nulltype ne { + exch 1 sub + # #tag #rdepth + over type sprintsdict exch get eval + # #tagstr + `=' exch cat + `=' cat + }{ + pop pop + `-hook-' + } ifelse + } + $integertype { + pop + cvs + } + $marktype { + pop pop + `-mark-' + } +' cat +@enable_threads@ 1 eq { + ` + $mutextype { + pop pop + `-mutex-' + } + ' cat +} if +` + $nametype { + # #name #depth + pop + dup cvs exch + # #str #name + dup xcheck not { + # Literal. + pop + `$' exch cat + }{ + echeck { + # Evaluatable. + `!' exch cat + } if + } ifelse + } + $nulltype { + pop pop + `null' + } + $operatortype { + pop + cvs + dup `-operator-' ne { + `--' tuck + cat cat + } if + } + $pmarktype { + pop pop + `-pmark-' + } +' cat + +@enable_real@ 1 eq { + ` + $realtype { + pop + cvs + } + ' cat +} if +@enable_regex@ 1 eq { + ` + $regextype { + pop pop + `-regex-' + } + $regsubtype { + pop pop + `-regsub-' + } + ' cat +} if +` + $stacktype { + # #stack #depth + dup 0 gt { + `(' + + # #stack #depth #accum + 2 idup scount 1 gt { + # #stack #depth #accum + 2 idup scount 1 sub -1 1 { + # #stack #depth #accum #i + 3 idup dup dn sidup spop + 2 idup 1 sub + # #stack #depth #accum #el #rdepth + over type sprintsdict exch get eval + cat + # #stack #depth #accum #el #rdepth + ` ' cat + } for + } if + # #stack #depth #accum + + 2 idup scount 0 gt { + 2 idup dup sdup spop + 2 idup 1 sub + # #stack #depth #accum #el #rdepth + over type sprintsdict exch get eval + cat + } if + # #stack #depth #accum + + up 2 npop + # #accum + `)' + cat + # #accum + }{ + pop pop + `-stack-' + } ifelse + } + $stringtype { + pop + cvs + } + $threadtype { + pop pop + `-thread-' + } +> def + +# #object #depth sprints #string +$sprints { + over type sprintsdict exch get eval +} def + +$sprint { + sprints print + `\n' print flush +} def + +# +# outputsdict implements formatted output to strings for every type. +# +$outputsdict < + $integertype { + # #int #flags + + # Get the base. + dup $b known { + dup $b get + }{ + 10 + } ifelse + # #int #flags #base + + 2 idup exch cvrs + # #int #flags #str + + # Prepend the sign if necessary. + over $s known { + over $s get $+ eq { + 2 idup 0 ge { + `+' exch cat + } if + } if + } if + # #int #flags #str + dn pop + # #flags #str + exch + # #str #flags + outputsdict $stringtype get eval + # #str + } +' cat +@enable_real@ 1 eq { + ` + $realtype { + # #real #flags + + # Determine precision past decimal point. + dup $d known { + dup $d get + }{ + 6 + } ifelse + # #real #flags #precision + + # Determine whether to use decimal or exponential notation. + over $e known { + over $e get + }{ + false + } ifelse + # #real #flags #precision #exp? + + 3 idup up + # #real #flags #real #precision #exp? + { + # Use exponential notation. + cves + }{ + # Use decimal notation. + cvds + } ifelse + # #real #flags #str + + # Prepend the sign if necessary. + over $s known { + over $s get $+ eq { + 2 idup 0 ge { + `+' exch cat + } if + } if + } if + # #real #flags #str + dn pop exch + # #str #flags + + outputsdict $stringtype get eval + # #str + } + ' cat +} if +` + # Temporarily define. + $_s { + # Check for $w flag. $w takes precedence over $n. + dup $w known { + # Get padding character. + dup $p known { + dup $p get + }{ + ` ' + } ifelse + # #str #flags #pad + + over $w get + # #str #flags #pad #width + 3 idup length + # #str #flags #pad #width #len + + dup 2 idup le { + # Pad string. + # #str #flags #pad #width #len + + over string + # #str #flags #pad #width #len #pstr + + # Fill #pstr with #pad. + 0 1 4 idup 1 sub { + over exch 5 idup putinterval + } for + # #str #flags #pad #width #len #pstr + 3 ipop + # #str #flags #width #len #pstr + + # Get the justification. + 3 idup $j known { + 3 idup $j get + }{ + $r + } ifelse + # #str #flags #width #len #pstr #just + + dup $r eq { + pop + # Right justify. + # #str #flags #width #len #pstr + up sub + }{ + $l eq { + # Left justify. + # #str #flags #width #len #pstr + up 2 npop + 0 + }{ + # Center. + # #str #flags #width #len #pstr + up sub 2 idiv + } ifelse + } ifelse + # #str #flags #pstr #offset + + over exch + # #str #flags #pstr #pstr #offset + 5 ndn + # #flags #pstr #pstr #offset #str + putinterval + # #flags #pstr + exch + # #pstr #flags + }{ + # No padding necessary. + pop pop pop + } ifelse + # #str #flags + }{ + # #str #flags + dup $n known { + # Truncate the string if it is too long. + over length + over $n get + # #str #flags #len #max + dup 2 idup lt { + # Truncate. + nip + dup string + # #str #flags #max #nstr + dup + # #str #flags #max #nstr #nstr + 5 ndn + # #flags #max #nstr #nstr #str + 4 ndn + # #flags #nstr #nstr #str #max + 0 exch getinterval + # #flags #nstr #nstr #substr + 0 exch putinterval + # #flags #nstr + exch + }{ + pop pop + } ifelse + # #nstr #flags + } if + # #str #flags + } ifelse + # #str #flags + + pop + # #str + } def + $stringtype $_s load + + # Most types can be handled identically. The following code uses the + # same procedure body for all of those types. + # + # The following block of code looks scary because it avoids deferred + # execution in order to "bind" things correctly (we cannot use immediate + # evaluation in this file). + [ + # #object #flags + + # Get recursion depth. + $dup cvx $r $known cvx [ + $dup cvx $r $get cvx + ] cvx [ + 1 + ] cvx $ifelse cvx + # #object #flags #rdepth + + $dn cvx $exch cvx + # #flags #object #rdepth + $sprints cvx $exch cvx + # #str #flags + $_s load cve + # #str + ] cvx bind + [ + $arraytype + $booleantype +' cat +@enable_threads@ 1 eq { + ` + $conditiontype + ' cat +} if +` + $dicttype + $filetype + $finotype + $hooktype + $marktype +' cat +@enable_threads@ 1 eq { + ` + $mutextype + ' cat +} if +` + $nametype + $nulltype + $operatortype + $pmarktype +' cat +@enable_regex@ 1 eq { + ` + $regextype + $regsubtype + ' cat +} if +` + $stacktype + $threadtype + ]{ + # #proc #name + exch dup + # #name #proc #proc + } foreach + # Get rid of the extra copy of #proc. + pop + + # Now that we are done using _s, undef it. + currentdict $_s undef +> def + +# +# Formatted output to a string. Supported flags: +# +# All types: +# +# $n : maximum width +# : #integer +# $w : minimum width +# : #integer +# $j : justification +# : $l, $c, $r +# $p : padding character +# : `?' +# $r : recursion depth +# : 0..n +# +# Integers only: +# +# $b : base +# : 2..36 +# $s : sign +# : $+ $- +# +# Reals only: +# +# $d : digits of precision past decimal +# : #integer (default 6) +# $e : exponential notation +# : #boolean (default false) +# +# #obj #flags outputs #string +$outputs { + dup type $dicttype ne { + $typecheck throw + } if + over type + # #obj #flags #type + outputsdict exch get eval +} def + +#obj #flags output - +$output { + outputs print +} def + +# - product #string +$product `Canonware Onyx' def + +# - pstack - +$pstack { + ostack { + 1 sprint + } foreach + flush +} def + +# +# #string #pattern search #post #pattern #pre true +# #string #pattern search #string false +# +$search { + # Make sure the arguments are strings. + # Pattern. + dup type $stringtype ne { + $typecheck throw + } if + # String. + over type $stringtype ne { + $typecheck throw + } if + + # Make sure substring is not longer than string. + dup length 2 idup length le { + # Use a nested looping algorithm. The outer loop advances the + # offset #s_i at which to start the search in the string #s, + # and the inner loop compares byte by byte with the pattern #p. + # + # Take care not to cause a rangecheck error. + 0 1 3 idup length 3 idup length sub { + # #s #p #s_i + + # Create a substring #s_sub of #s that is the same + # length as #p, starting at #s_i. + dup 3 idup exch 3 idup length getinterval + + # #s #p #s_i #s_sub + dup length 1 sub 0 1 + dn + { + # #s #p #s_i #s_sub #offset + dup 2 idup exch get + exch 4 idup exch get + ne { + # Not equal. Exit the inner loop. + false exit + } if + } for + + # Check to see if the substring match failed. + dup type $booleantype eq { + # #s #p #s_i #s_sub# false + # Failure. Clean up. + pop pop pop + }{ + # #s #p #s_i #s_sub + # Success. + 2 ipop + # #s #s_i# #s_sub + + # Contstruct pre string #s_pre. + up dup 2 idup exch 0 exch + # #s_sub #s #s_i #s 0 #s_i + getinterval + # #s_sub #s #s_i #s_pre + up + # #s_sub #s_pre #s #s_i + + # Contstruct post string #s_post. + 3 idup length add dup + 2 idup length exch sub + getinterval + # #s_sub #s_pre #s_post + up + + true + # #s_post #s_sub #s_pre true + exit + } ifelse + } for + + # Check to see if we succeeded. If not, set up the stack to + # return failure. + dup type $booleantype ne { + # Failure. + pop false + } if + }{ + # Substring is too long. + pop false + } ifelse +} def +' cat +@enable_posix@ 1 eq { + ` +# [`' `'...] system #exit_code +$system { + # Make sure argument is an array. + dup type $arraytype ne { + $typecheck throw + } if + # Make sure array is non-empty. + dup length 0 eq { + $rangecheck throw + } if + # Make sure array elements are strings. + dup { + { + type $stringtype ne { + stop + } if + } foreach + } stopped { + $typecheck throw + } if + + forkexec + waitpid +} def + ' cat +} if + +@enable_modules@ 1 eq { + ` +# Define require and mrequire configuration parameters in onyxdict. By default, +# the search order is: +# +# 1) Absolute path: `'. +# 2) Relative path: `.'. +# 3) $ONYX_[MR]PATH: Colon-separated string in envdict. +# 4) `@prefix@/share/onyx-@onyx_version@/nx[m]': Standard installation location. +onyxdict begin +$rpath_pre [`' `.'] def +$rpath_post [@rpath_post@] def + +$mpath_pre [`' `.'] def +$mpath_post [@mpath_post@] def +end # onyxdict. + +# #filename require - +$require { + # Make sure the argument is a string. + dup type $stringtype ne { + $typecheck throw + } if + + { + [ + onyxdict $rpath_pre get + + envdict $ONYX_RPATH 2 ndup known { + get + + # Push mark that denotes start of array. + [ exch + { + # [ ... #cpath + `:' search { + # #post `:' #dir + nip exch + # [ ... #dir #post + }{ + # Last path component. + # #dir + exit + } ifelse + } loop + # Create array. + ] + }{ + 2 npop + } ifelse + + onyxdict $rpath_post get + ]{ + # #filename #path + { + # #filename #dir + `/' cat + over cat + # #filename #full_path + dup `f' test { + # Found. + # #filename #full_path + `r' open cvx eval + # #filename + pop + stop # Success. + }{ + # Not found. + # #filename #full_path + pop + } ifelse + } foreach + } foreach + } stopped not { + # Failure. + $undefinedfilename throw + } if +} def + +# #filename #symbol mrequire - +$mrequire { + # Make sure the arguments are strings. + over type $stringtype ne { + $typecheck throw + } if + dup type $stringtype ne { + $typecheck throw + } if + + exch + # #symbol #filename + { + [ + onyxdict $mpath_pre get + + envdict $ONYX_MPATH 2 ndup known { + get + + # Push mark that denotes start of array. + [ exch + { + # [ ... #cpath + `:' search { + # #post `:' #dir + nip exch + # [ ... #dir #post + }{ + # Last path component. + # #dir + exit + } ifelse + } loop + # Create array. + ] + }{ + 2 npop + } ifelse + + onyxdict $mpath_post get + ]{ + # #symbol #filename #path + { + # #symbol #filename #dir + `/' cat + over cat + # #symbol #filename #full_path + dup `f' test { + # Found. + # #symbol #filename #full_path + dn modload + # #filename + pop + stop # Success. + }{ + # Not found. + # #symbol #filename #full_path + pop + } ifelse + } foreach + } foreach + } stopped not { + # Failure. + # #symbol #filename + exch + $undefinedfilename throw + } if +} def + ' cat +} if +` +# $errorname throw - +$throw { + # Do some sanity checking, to try to avoid going infinitely recursive + # in the error handling machinery. + { + {$errordict where {pop true}{false} ifelse} + {!errordict $handleerror known} + {!errordict $stop known} + {$currenterror where {pop true}{false} ifelse} + }{ + eval not { + stderr `Onyx: Missing errordict or currenterror defs\n' + {write}{} until + + # Print stack dumps. + stderr `ostack: ' {write}{} until + ostack 2 sprints stderr exch {write}{} until + + stderr `\ndstack: ' {write}{} until + stderr dstack 2 sprints {write}{} until + + stderr `\nestack: ' {write}{} until + stderr estack 2 sprints {write}{} until + + stderr `\nistack: ' {write}{} until + stderr istack 2 sprints {write}{} until + + stderr `\nOnyx: dieing\n' {write}{} until + 1 die + } if + } foreach + + # Make sure the argument is a name. + dup type $nametype ne { + $typecheck !throw + } if + + !currenterror begin + + # Set newerror to true to indicate there is an error. It is up to the + # application to clear this afterwards if it wants to make newerror + # meaningful in the face of multiple errors. + $newerror true def + + # Set errorname to the argument passed in. + dup $errorname exch cvlit def + + # ostack. Get rid of $errorname in the snapshot. Ordering is important + # to keep from polluting the snapshot. + ostack dup spop pop $ostack exch def + + # dstack. Do not include the top element, which is the copy of + # currenterror that we pushed. + $dstack dstack dup spop pop def + + # estack. Remove this procedure from the snapshot. + $estack estack dup spop pop def + + # istack. Remove this procedure from the snapshot. + $istack istack dup spop pop def + + # Push the offending object onto ostack. + !estack dup sdup spop + exch + # #object #errorname + + end # currenterror. + + # If there is an error handler for the error name, call it. Otherwise, + # call the errordict handleerror, then call the errordict stop. + !errordict + # #object #errorname #errordict + dup 2 idup known { + # Call error handler. + exch get eval + }{ + # No error handler. + nip + dup $handleerror get eval + $stop get eval + } ifelse +} def + +# - version #string +$version `' def + +end # systemdict. +' cat + +# Final closing brace. +`}' cat cvx eval diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx_bootstrap.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx_bootstrap.c new file mode 100644 index 000000000..adb865f01 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx_bootstrap.c @@ -0,0 +1,24 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "libonyx/libonyx.h" + +void +nx_p_nxcode(cw_nx_t *a_nx) +{ + cw_nxo_t thread; + + nxo_thread_new(&thread, a_nx); + cw_onyx_code(&thread, "<$p~xcheck$o~write$n~until$m~type$l~true$k~systemdict$j~sub$i~string$h~stopped$g~stop$f~stderr$e~spop$d~scount$c~putinterval$b~print$a~pop$Z~ostack$Y~not$X~nip$W~ne$V~load$U~length$T~known$S~idup$R~ifelse$Q~if$P~gt$O~getinterval$N~get$M~foreach$L~flush$K~false$J~exch$I~eval$H~eq$G~echeck$F~dup$E~def$D~cvx$C~cvs$B~cat$A~begin>begin{k A $sprintsdict < $arraytype {F 0 P {over F G {a `_{'} {p {`{'} {`['} R} R 2 S U 1 P {0 1 4 S U 2 j {3 S J N 2 S 1 j over m sprintsdict J N I B ` ' B} for} Q 2 S U 0 P {2 S F U 1 j N 2 S 1 j over m sprintsdict J N I B} Q X J F G {a `}_'} {p {`}'} {`]'} R} R B} {a a `-array-'} R} $booleantype {a C} $conditiontype {a a `-condition-'} $dicttype {F 0 P {1 j 0 `<' 3 S {J 4 S over m sprintsdict J N I ` ' B J 4 S over m sprintsdict J N I B B J 1 add F 4 S U lt {J ` ' B} {J} R} M 4 nup a a a `>' B} {a a `-dict-'} R} $filetype {a a `-file-'} $finotype {a a `-fino-'} $hooktype {J hooktag F m $nulltype W {J 1 j over m sprintsdict J N I `=' J B `=' B} {a a `-hook-'} R} $integertype {a C} $marktype {a a `-mark-'} $mutextype {a a `-mutex-'} $nametype {a F C J F p Y {a `$' J B} {G {`!' J B} Q} R} $nulltype {a a `null'} $operatortype {a C F `-operator-' W {`--' tuck B B} Q} $pmarktype {a a `-pmark-'} $realtype {a C} $stacktype {F 0 P {`(' 2 S d 1 P {2 S d 1 j -1 1 {3 S F dn sidup e 2 S 1 j over m sprintsdict J N I B ` ' B} for} Q 2 S d 0 P {2 S F sdup e 2 S 1 j over m sprintsdict J N I B} Q up 2 npop `)' B} {a a `-stack-'} R} $stringtype {a C} $threadtype {a a `-thread-'} > E $sprints {over m sprintsdict J N I} E $sprint {sprints b `\n' b L} E $outputsdict < $integertype {F $b T {F $b N} {10} R 2 S J cvrs over $s T {over $s N $+ H {2 S 0 ge {`+' J B} Q} Q} Q dn a J outputsdict $stringtype N I} $realtype {F $d T {F $d N} {6} R over $e T {over $e N} {K} R 3 S up {cves} {cvds} R over $s T {over $s N $+ H {2 S 0 ge {`+' J B} Q} Q} Q dn a J outputsdict $stringtype N I} $_s {F $w T {F $p T {F $p N} {` '} R over $w N 3 S U F 2 S le {over i 0 1 4 S 1 j {over J 5 S c} for 3 ipop 3 S $j T {3 S $j N} {$r} R F $r H {a up j} {$l H {up 2 npop 0} {up j 2 idiv} R} R over J 5 ndn c J} {a a a} R} {F $n T {over U over $n N F 2 S lt {X F i F 5 ndn 4 ndn 0 J O 0 J c J} {a a} R} Q} R a} E $stringtype $_s V [ $dup D $r $known D [ $dup D $r $get D ] D [ 1 ] D $ifelse D $dn D $exch D $sprints D $exch D $_s V cve ] D bind [ $arraytype $booleantype $conditiontype $dicttype $filetype $finotype $hooktype $marktype $mutextype $nametype $nulltype $operatortype $pmarktype $stacktype $threadtype ] {J F} M a currentdict $_s undef > E $outputs {F m $dicttype W {$typecheck throw} Q over m outputsdict J N I} E $output {outputs b} E $product `Canonware Onyx' E $pstack {Z {1 sprint} M L} E $search {F m $stringtype W {$typecheck throw} Q over m $stringtype W {$typecheck throw} Q F U 2 S U le {0 1 3 S U 3 S U j {F 3 S J 3 S U O F U 1 j 0 1 dn {F 2 S J N J 4 S J N W {K exit} Q} for F m $booleantype H {a a a} {2 ipop up F 2 S J 0 J O up 3 S U add F 2 S U J j O up l exit} R} for F m $booleantype W {a K} Q} {a K} R} E $system {F m $arraytype W {$typecheck throw} Q F U 0 H {$rangecheck throw} Q F {{m $stringtype W {g} Q} M} h {$typecheck throw} Q forkexec waitpid} E onyxdict A $rpath_pre [ `' `.' ] E $rpath_post [ `/usr/local/share/onyx-devel/nx' ] E $mpath_pre [ `' `.' ] E $mpath_post [ `/usr/local/share/onyx-devel/nxm' ] E end $require {F m $stringtype W {$typecheck throw} Q {[ onyxdict $rpath_pre N envdict $ONYX_RPATH 2 ndup T {N [ J {`:' search {X J} {exit} R} loop ]} {2 npop} R onyxdict $rpath_post N ] {{`/' B over B F `f' test {`r' open D I a g} {a} R} M} M} h Y {$undefinedfilename throw} Q} E $mrequire {over m $stringtype W {$typecheck throw} Q F m $stringtype W {$typecheck throw} Q J {[ onyxdict $mpath_pre N envdict $ONYX_MPATH 2 ndup T {N [ J {`:' search {X J} {exit} R} loop ]} {2 npop} R onyxdict $mpath_post N ] {{`/' B over B F `f' test {dn modload a g} {a} R} M} M} h Y {J $undefinedfilename throw} Q} E $throw {{{$errordict where {a l} {K} R} {!errordict $handleerror T} {!errordict $stop T} {$currenterror where {a l} {K} R}} {I Y {f `Onyx: Missing errordict or currenterror defs\n' {o} {} n f `ostack: ' {o} {} n Z 2 sprints f J {o} {} n f `\ndstack: ' {o} {} n f dstack 2 sprints {o} {} n f `\nestack: ' {o} {} n f estack 2 sprints {o} {} n f `\nistack: ' {o} {} n f istack 2 sprints {o} {} n f `\nOnyx: dieing\n' {o} {} n 1 die} Q} M F m $nametype W {$typecheck !throw} Q !currenterror A $newerror l E F $errorname J cvlit E Z F e a $ostack J E $dstack dstack F e a E $estack estack F e a E $istack istack F e a E !estack F sdup e J end !errordict F 2 S T {J N I} {X F $handleerror N I $stop N I} R} E $version `' E end}bind eval end"); + nxo_thread_exit(&thread); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx_gen.nx b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx_gen.nx new file mode 100644 index 000000000..4426d6e52 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nx_gen.nx @@ -0,0 +1,158 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# Read onyx code from stdin and output a compacted version to stdout. The +# output code defines the C function nx_p_nxcode(). +# +# This program is run by the 'bootstrap' build system target. +# +################################################################################ + +# Create an encoding dictionary for various operators. The values must not +# correspond to an existing name in dstack. The byte overhead is the length of +# the name plus three. So, a name must show up at least as many times as in +# the following table to bother adding an entry: +# +# Length | Minimum use | Transform +# -------+-------------+------------------------------------------------------ +# 2 | 5 | xx xx xx xx --> $X~x x x x x +# 3 | 4 | xxx xxx xxx --> $X~xxx x x x +# 4 | 3 | xxxx xxxx xxxx --> $X~xxxx x x x +# 5 | 3 | xxxxx xxxxx xxxxx --> $X~xxxxx x x x +# 6 | 2 | xxxxxx xxxxxx --> $X~xxxxxx x x +# >7 | 2 +# +$_encdict < + $begin $A # 4 + $cat $B # 19 + $cvs $C # 6 + $cvx $D # 13 + $def $E # ~21 + $dup $F # ~37 + $echeck $G # 3 + $eq $H # 6 + $eval $I # 14 + $exch $J # ~57 + $false $K # 5 + $flush $L # 3 + $foreach $M # 9 + $get $N # 32 + $getinterval $O # 4 + $gt $P # 7 + $if $Q # 29 + $ifelse $R # 20 + $idup $S # ~66 + $known $T # 8 + $length $U # 16 + $load $V # 9 + $ne $W # 13 + $nip $X # 4 + $not $Y # 4 + $ostack $Z # 3 + $pop $a # ~69 + $print $b # 3 + $putinterval $c # 3 + $scount $d # 3 + $spop $e # 7 + $stderr $f # 10 + $stop $g # 3 + $stopped $h # 3 + $string $i # 2 + $sub $j # 15 + $systemdict $k # 3 + $true $l # 4 + $type $m # >= 17 + $until $n # 10 + $write $o # 10 + $xcheck $p # 3 +> def + +# #proc _encarr - +$_encarr { + 0 1 2 idup length 1 sub { + # #proc #i + 1 idup 1 idup get + # #proc #i #el + dup type $nametype eq { + dup dup xcheck exch echeck not and { + # Executable Name. Try to replace. + _encdict 1 idup known { + _encdict exch get cvx + # #proc #i #e + 2 idup 3 1 roll + # #proc #proc #i #e + put + }{ + pop pop + } ifelse + }{ + pop pop + } ifelse + }{ + dup type $arraytype eq { + # Array. Recurse. + _encarr + pop + }{ + # Other. Do nothing. + pop pop + } ifelse + } ifelse + # #proc + } for + pop +} def + +# Output the header. +`/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "libonyx/libonyx.h" + +void +nx_p_nxcode(cw_nx_t *a_nx) +{ + cw_nxo_t thread; + + nxo_thread_new(&thread, a_nx); + cw_onyx_code(&thread, "' print + +# Output the translation dictionary. +`<' print +_encdict { + 1 sprints print + `~' print cvx 1 sprints print +} foreach +`>begin' print + +# Read in the code. +stdin cvx eval + +# We now have an array of code. Recursively iterate through the elements of +# the array and replace executable names with their equivalents in the +# temporary shorthand dictionary. +dup _encarr + +# Output the procedure, using a recursion depth large enough to meet or exceed +# the depth of nested braces in the code. +1000 sprints print +`bind eval end"); + nxo_thread_exit(&thread); +} +' print diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxa.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxa.c new file mode 100644 index 000000000..c5d55613b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxa.c @@ -0,0 +1,1129 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * nxa uses a Baker's Treadmill (an elegant form of mark and sweep) to + * implement garbage collection. The collector is atomic, which means that all + * "mutator" threads must be suspended during the marking phase. Although no + * other threads can do any work during marking, the collector does not have to + * (nor is it allowed to) do any locking, which is a significant performance + * gain. The total amount of work that the garbage collector has to do is + * reduced, which improves overall program throughput. + * + * The downside of atomic collection is that if marking takes more than about + * 100 milliseconds, the user may notice a lag. In practice, the collector + * appears to perform very well; marking is fast enough to stay well below the + * threshold of user awareness, unless memory is low enough that system paging + * becomes a factor. + * + * For situations where a significant amount of allocation is done over a short + * period of time, or where no allocation whatsoever is happening, the collector + * can be suspended/resumed/forced in order to improve performance or decrease + * memory footprint. + * + * The following diagram depicts a treadmill as it exists during the mark phase: + * + * -------------------\ + * \ + * /--\ \ + * |W | \ + * /--\ \--/ /--\ \ + * |G | ^ |W | \ + * \--/ | \--/ \ + * | \ + * white \ + * /--\ /--\ \ + * |G |<-- gray |W | \ + * \--/ \--/ \ + * | + * | + * | + * /--\ /--\ \|/ + * |B | |W | V + * \--/ \--/ + * + * + * + * /--\ /--\ + * |B |<-- black |W | + * \--/ \--/ + * + * + * /--\ /--\ + * |W | |W | + * \--/ /--\ \--/ + * |W | + * \--/ + * + * Black (fully scanned) objects are all the objects between 'black' (inclusive) + * and 'gray' (exclusive). + * + * Gray (reached, not fully scanned) objects are all the objects + * between 'gray' (inclusive) and 'white' (exclusive). + * + * White (unreached/unreachable) objects are all the objects between 'white' + * (inclusive) and 'black' (exclusive). + * + ******************************************************************************/ + +#define CW_NXA_C_ + +#include "../include/libonyx/libonyx.h" + +#include + +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_array_l.h" +#ifdef CW_THREADS +#include "../include/libonyx/nxo_condition_l.h" +#endif +#include "../include/libonyx/nxo_dict_l.h" +#include "../include/libonyx/nxo_file_l.h" +#include "../include/libonyx/nxo_hook_l.h" +#ifdef CW_THREADS +#include "../include/libonyx/nxo_mutex_l.h" +#endif +#include "../include/libonyx/nxo_name_l.h" +#ifdef CW_REGEX +#include "../include/libonyx/nxo_regex_l.h" +#include "../include/libonyx/nxo_regsub_l.h" +#endif +#include "../include/libonyx/nxo_stack_l.h" +#include "../include/libonyx/nxo_string_l.h" +#include "../include/libonyx/nxo_thread_l.h" + +static void +nxa_p_collect(cw_nxa_t *a_nxa); +#ifdef CW_PTHREADS +static void * +nxa_p_gc_entry(void *a_arg); +#endif + +void +nxa_l_new(cw_nxa_t *a_nxa, cw_nx_t *a_nx) +{ +#ifdef CW_PTHREADS + sigset_t sig_mask, old_mask; +#endif + volatile cw_uint32_t try_stage = 0; + + xep_begin(); + xep_try + { + a_nxa->nx = a_nx; + +#ifdef CW_THREADS + mtx_new(&a_nxa->lock); + try_stage = 1; +#endif + +#ifdef CW_THREADS + mtx_new(&a_nxa->seq_mtx); +#endif + ql_new(&a_nxa->seq_set); + a_nxa->white = FALSE; + try_stage = 2; + +#ifdef CW_PTHREADS + mq_new(&a_nxa->gc_mq, NULL, sizeof(cw_nxam_t)); +#endif + a_nxa->gc_pending = FALSE; + a_nxa->gc_allocated = FALSE; + try_stage = 3; + +#ifdef CW_DBG + a_nxa->magic = CW_NXA_MAGIC; +#endif + + /* Initialize gcdict state. */ + a_nxa->gcdict_active = FALSE; +#ifdef CW_PTHREADS + a_nxa->gcdict_period = CW_LIBONYX_GCDICT_PERIOD; +#endif + a_nxa->gcdict_threshold = CW_LIBONYX_GCDICT_THRESHOLD; + a_nxa->gcdict_count = 0; + memset(a_nxa->gcdict_current, 0, sizeof(cw_nxoi_t) * 3); + memset(a_nxa->gcdict_maximum, 0, sizeof(cw_nxoi_t) * 3); + memset(a_nxa->gcdict_sum, 0, sizeof(cw_nxoi_t) * 3); + +#ifdef CW_PTHREADS + /* Block all signals during thread creation, so that the GC thread does + * not receive any signals. Doing this here rather than in the GC + * thread itself avoids a race condition where signals can be delivered + * to the GC thread. */ + sigfillset(&sig_mask); + thd_sigmask(SIG_BLOCK, &sig_mask, &old_mask); + a_nxa->gc_thd = thd_new(nxa_p_gc_entry, (void *) a_nxa, FALSE); + thd_sigmask(SIG_SETMASK, &old_mask, NULL); + try_stage = 4; +#endif + } + xep_catch(CW_ONYXX_OOM) + { + switch (try_stage) + { + case 4: + case 3: +#ifdef CW_PTHREADS + { + mq_delete(&a_nxa->gc_mq); + } +#endif + case 2: + { +#ifdef CW_THREADS + mtx_delete(&a_nxa->seq_mtx); + } + case 1: + { + mtx_delete(&a_nxa->lock); +#endif + break; + } + default: + { + cw_not_reached(); + } + } + } + xep_end(); +} + +void +nxa_l_shutdown(cw_nxa_t *a_nxa) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS +#ifdef CW_PTHREADS + mq_put(&a_nxa->gc_mq, NXAM_SHUTDOWN); + + thd_join(a_nxa->gc_thd); + mq_delete(&a_nxa->gc_mq); +#endif +#ifdef CW_PTH + mtx_lock(&a_nxa->lock); + nxa_p_collect(a_nxa); + mtx_unlock(&a_nxa->lock); +#endif + mtx_delete(&a_nxa->seq_mtx); +#else + nxa_p_collect(a_nxa); +#endif +} + +void +nxa_l_delete(cw_nxa_t *a_nxa) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_delete(&a_nxa->lock); +#endif +} + +void * +nxa_malloc_e(cw_nxa_t *a_nxa, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + nxa_l_count_adjust(a_nxa, (cw_nxoi_t) a_size); + + return mem_malloc_e(cw_g_mem, a_size, a_filename, a_line_num); +} + +void * +nxa_realloc_e(cw_nxa_t *a_nxa, void *a_ptr, size_t a_size, size_t a_old_size, + const char *a_filename, cw_uint32_t a_line_num) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + nxa_l_count_adjust(a_nxa, (cw_nxoi_t) a_size - (cw_nxoi_t) a_old_size); + + return mem_realloc_e(cw_g_mem, a_ptr, a_size, a_old_size, a_filename, + a_line_num); +} + +void +nxa_free_e(cw_nxa_t *a_nxa, void *a_ptr, size_t a_size, const char *a_filename, + cw_uint32_t a_line_num) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + nxa_l_count_adjust(a_nxa, -(cw_nxoi_t)a_size); + + mem_free_e(cw_g_mem, a_ptr, a_size, a_filename, a_line_num); +} + +void +nxa_collect(cw_nxa_t *a_nxa) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + if (a_nxa->gc_pending == FALSE) + { + a_nxa->gc_pending = TRUE; +#ifdef CW_PTHREADS + mq_put(&a_nxa->gc_mq, NXAM_COLLECT); +#else + if (a_nxa->gcdict_active) + { + nxa_p_collect(a_nxa); + } +#endif + } +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif +} + +cw_bool_t +nxa_active_get(cw_nxa_t *a_nxa) +{ + cw_bool_t retval; + + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + retval = a_nxa->gcdict_active; +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif + + return retval; +} + +void +nxa_active_set(cw_nxa_t *a_nxa, cw_bool_t a_active) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + a_nxa->gcdict_active = a_active; + if (a_active && a_nxa->gcdict_threshold > 0 && a_nxa->gcdict_threshold + <= a_nxa->gcdict_count - a_nxa->gcdict_current[0]) + { + if (a_nxa->gc_pending == FALSE) + { + a_nxa->gc_pending = TRUE; +#ifdef CW_PTHREADS + mq_put(&a_nxa->gc_mq, NXAM_COLLECT); +#else + if (a_nxa->gcdict_active) + { + nxa_p_collect(a_nxa); + } +#endif + } + } +#ifdef CW_PTHREADS + else + { + if (a_nxa->gc_pending == FALSE) + { + mq_put(&a_nxa->gc_mq, NXAM_RECONFIGURE); + } + } +#endif +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif +} + +#ifdef CW_PTHREADS +cw_nxoi_t +nxa_period_get(cw_nxa_t *a_nxa) +{ + cw_nxoi_t retval; + + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + mtx_lock(&a_nxa->lock); + retval = a_nxa->gcdict_period; + mtx_unlock(&a_nxa->lock); + + return retval; +} + +void +nxa_period_set(cw_nxa_t *a_nxa, cw_nxoi_t a_period) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + cw_assert(a_period >= 0); + + mtx_lock(&a_nxa->lock); + a_nxa->gcdict_period = a_period; + mq_put(&a_nxa->gc_mq, NXAM_RECONFIGURE); + mtx_unlock(&a_nxa->lock); +} +#endif + +cw_nxoi_t +nxa_threshold_get(cw_nxa_t *a_nxa) +{ + cw_nxoi_t retval; + + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + retval = a_nxa->gcdict_threshold; +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif + + return retval; +} + +void +nxa_threshold_set(cw_nxa_t *a_nxa, cw_nxoi_t a_threshold) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + cw_assert(a_threshold >= 0); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + a_nxa->gcdict_threshold = a_threshold; + if (a_threshold > 0 + && a_threshold <= a_nxa->gcdict_count - a_nxa->gcdict_current[0] + && a_nxa->gcdict_active) + { + if (a_nxa->gc_pending == FALSE) + { + a_nxa->gc_pending = TRUE; +#ifdef CW_PTHREADS + mq_put(&a_nxa->gc_mq, NXAM_COLLECT); +#else + if (a_nxa->gcdict_active) + { + nxa_p_collect(a_nxa); + } +#endif + } + } +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif +} + +void +nxa_stats_get(cw_nxa_t *a_nxa, cw_nxoi_t *r_collections, cw_nxoi_t *r_count, + cw_nxoi_t *r_ccount, cw_nxoi_t *r_cmark, cw_nxoi_t *r_csweep, + cw_nxoi_t *r_mcount, cw_nxoi_t *r_mmark, cw_nxoi_t *r_msweep, + cw_nxoi_t *r_scount, cw_nxoi_t *r_smark, cw_nxoi_t *r_ssweep) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + + /* collections. */ + if (r_collections != NULL) + { + *r_collections = a_nxa->gcdict_collections; + } + + /* count. */ + if (r_count != NULL) + { + *r_count = a_nxa->gcdict_count; + } + + /* current. */ + if (r_ccount != NULL) + { + *r_ccount = a_nxa->gcdict_current[0]; + } + if (r_cmark != NULL) + { + *r_cmark = a_nxa->gcdict_current[1]; + } + if (r_csweep != NULL) + { + *r_csweep = a_nxa->gcdict_current[2]; + } + + /* maximum. */ + if (r_mcount != NULL) + { + *r_mcount = a_nxa->gcdict_maximum[0]; + } + if (r_mmark != NULL) + { + *r_mmark = a_nxa->gcdict_maximum[1]; + } + if (r_msweep != NULL) + { + *r_msweep = a_nxa->gcdict_maximum[2]; + } + + /* sum. */ + if (r_scount != NULL) + { + *r_scount = a_nxa->gcdict_sum[0]; + } + if (r_smark != NULL) + { + *r_smark = a_nxa->gcdict_sum[1]; + } + if (r_ssweep != NULL) + { + *r_ssweep = a_nxa->gcdict_sum[2]; + } + +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif +} + +void +nxa_l_gc_register(cw_nxa_t *a_nxa, cw_nxoe_t *a_nxoe) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->seq_mtx); +#endif + cw_assert(nxoe_l_registered_get(a_nxoe) == FALSE); + cw_assert(qr_next(a_nxoe, link) == a_nxoe); + cw_assert(qr_prev(a_nxoe, link) == a_nxoe); + + /* Set the color to white, set the registered bit, and insert into the + * object ring. */ + nxoe_l_color_set(a_nxoe, a_nxa->white); + nxoe_l_registered_set(a_nxoe, TRUE); + ql_tail_insert(&a_nxa->seq_set, a_nxoe, link); + +#ifdef CW_THREADS + mtx_unlock(&a_nxa->seq_mtx); +#endif +} + +void +nxa_l_gc_reregister(cw_nxa_t *a_nxa, cw_nxoe_t *a_nxoe) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->seq_mtx); +#endif + cw_assert(nxoe_l_registered_get(a_nxoe)); + + /* This is only called in nxo_name_new() in the case that a name object is + * already registered. By setting the color to white, the collector thread + * will notice that this object has been re-registered in + * nxoe_l_name_delete(), and will finish the normal registration process. + * If the object is not being swept, its color is already white, and this + * function has no effect. */ + nxoe_l_color_set(a_nxoe, a_nxa->white); + +#ifdef CW_THREADS + mtx_unlock(&a_nxa->seq_mtx); +#endif +} + +void +nxa_l_count_adjust(cw_nxa_t *a_nxa, cw_nxoi_t a_adjust) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + + /* Update count. */ + a_nxa->gcdict_count += a_adjust; + + if (a_adjust > 0) + { + if (a_nxa->gcdict_count > a_nxa->gcdict_maximum[0]) + { + /* Maximum amount of allocated memory seen. */ + a_nxa->gcdict_maximum[0] = a_nxa->gcdict_count; + } + + /* Note that allocation has been done. */ + a_nxa->gc_allocated = TRUE; + + /* Adjust the total allocation sum. */ + a_nxa->gcdict_sum[0] += a_adjust; + + /* Trigger a collection if the threshold was reached. */ + if (a_nxa->gcdict_count - a_nxa->gcdict_current[0] + >= a_nxa->gcdict_threshold && a_nxa->gcdict_active + && a_nxa->gcdict_threshold != 0) + { + if (a_nxa->gc_pending == FALSE) + { + a_nxa->gc_pending = TRUE; +#ifdef CW_PTHREADS + mq_put(&a_nxa->gc_mq, NXAM_COLLECT); +#else + if (a_nxa->gcdict_active) + { + nxa_p_collect(a_nxa); + } +#endif + } + } + } +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif +} + +cw_bool_t +nxa_l_white_get(cw_nxa_t *a_nxa) +{ + cw_check_ptr(a_nxa); + cw_dassert(a_nxa->magic == CW_NXA_MAGIC); + + /* This function is only called in nxoe_l_name_delete(), which is executed + * in the context of the GC thread, so no locking is necessary. */ + return a_nxa->white; +} + +/* Find roots, if any. Return TRUE if there are roots, FALSE otherwise. Upon + * return, a_nxa->seq_set points to the first object in the root set. */ +CW_P_INLINE cw_bool_t +nxa_p_roots(cw_nxa_t *a_nxa, cw_uint32_t *r_nroot) +{ + cw_bool_t retval = FALSE; + cw_nxoe_t *nxoe, *gray; + cw_uint32_t nroot = 0; + + /* Iterate through the root set and mark it gray. + * + * Each set of *_ref_iter() calls on a particular object must start with a + * call with (a_reset == TRUE), and repeated calls until NULL is + * returned. */ + for (nxoe = nx_l_ref_iter(a_nxa->nx, TRUE); + nxoe != NULL; + nxoe = nx_l_ref_iter(a_nxa->nx, FALSE)) + { + if (nxoe_l_registered_get(nxoe)) + { + /* Paint object gray. */ + nroot++; + cw_assert(nxoe_l_color_get(nxoe) == a_nxa->white); + nxoe_l_color_set(nxoe, !a_nxa->white); + if (retval) + { + qr_remove(nxoe, link); + qr_after_insert(gray, nxoe, link); + } + else + { + ql_first(&a_nxa->seq_set) = nxoe; + retval = TRUE; + } + /* Set gray to nxoe, since we inserted at the head of the list. */ + gray = nxoe; + } + } + + *r_nroot = nroot; + return retval; +} + +/* Mark. Return a pointer to a ring of garbage, if any, otherwise NULL. */ +CW_P_INLINE cw_nxoe_t * +nxa_p_mark(cw_nxa_t *a_nxa, cw_uint32_t *r_nreachable) +{ + cw_nxoe_t *retval, *gray, *nxoe; + cw_uint32_t nreachable = 0; + cw_bool_t reset; + + /* Iterate through the gray objects and process them until only black and + * white objects are left. */ + gray = ql_first(&a_nxa->seq_set); + do + { + cw_assert(nxoe_l_color_get(gray) != a_nxa->white); + + reset = TRUE; + for (reset = TRUE;; reset = FALSE) + { + switch (nxoe_l_type_get(gray)) + { + case NXOT_ARRAY: + { + nxoe = nxoe_l_array_ref_iter(gray, reset); + break; + } +#ifdef CW_THREADS + case NXOT_CONDITION: + { + nxoe = nxoe_l_condition_ref_iter(gray, reset); + break; + } +#endif + case NXOT_DICT: + { + nxoe = nxoe_l_dict_ref_iter(gray, reset); + break; + } + case NXOT_FILE: + { + nxoe = nxoe_l_file_ref_iter(gray, reset); + break; + } + case NXOT_HOOK: + { + nxoe = nxoe_l_hook_ref_iter(gray, reset); + break; + } +#ifdef CW_THREADS + case NXOT_MUTEX: + { + nxoe = nxoe_l_mutex_ref_iter(gray, reset); + break; + } +#endif + case NXOT_NAME: + { + nxoe = nxoe_l_name_ref_iter(gray, reset); + break; + } +#ifdef CW_REGEX + case NXOT_REGEX: + { + nxoe = nxoe_l_regex_ref_iter(gray, reset); + break; + } + case NXOT_REGSUB: + { + nxoe = nxoe_l_regsub_ref_iter(gray, reset); + break; + } +#endif + case NXOT_STACK: + { + nxoe = nxoe_l_stack_ref_iter(gray, reset); + break; + } + case NXOT_STRING: + { + nxoe = nxoe_l_string_ref_iter(gray, reset); + break; + } + case NXOT_THREAD: + { + nxoe = nxoe_l_thread_ref_iter(gray, reset); + break; + } + default: + { + cw_not_reached(); + break; + } + } + + if (nxoe == NULL) + { + break; + } + + /* If object is white and registered, color it. */ + if (nxoe_l_color_get(nxoe) == a_nxa->white + && nxoe_l_registered_get(nxoe)) + { + nxoe_l_color_set(nxoe, !a_nxa->white); + nreachable++; + /* Move the object to the gray region, if it isn't already + * adjacent to (and thereby part of) it. */ + if (nxoe_l_color_get(qr_prev(nxoe, link)) == a_nxa->white) + { + qr_remove(nxoe, link); + qr_after_insert(gray, nxoe, link); + } + } + } + gray = qr_next(gray, link); + } while (nxoe_l_color_get(gray) != a_nxa->white + && gray != ql_first(&a_nxa->seq_set)); + + /* Split the white objects into a separate ring. If there is garbage, + * 'gray' points to the first garbage object in the ring. */ + if (gray != ql_first(&a_nxa->seq_set)) + { + /* Split the ring. */ + qr_split(ql_first(&a_nxa->seq_set), gray, cw_nxoe_t, link); + retval = gray; + } + else + { + retval = NULL; + } + + *r_nreachable = nreachable; + return retval; +} + +/* Clean up unreferenced objects. */ +CW_P_INLINE void +nxa_p_sweep(cw_nxa_t *a_nxa, cw_nxoe_t *a_garbage) +{ + cw_nxoe_t *last, *defer, *nxoe; + cw_uint32_t i; + cw_bool_t again, notyet; + + /* Iterate through the garbage objects and delete them. If nxoe_l_delete() + * returns TRUE, the object deletion is deferred until a later pass. + * Repeatedly iterate through undeleted objects until no objects defer + * deletion. */ + for (defer = a_garbage, nxoe = NULL, again = TRUE, i = 0; + again == TRUE; + i++) + { + again = FALSE; + last = defer; + do + { + nxoe = qr_next(defer, link); + qr_remove(nxoe, link); + switch (nxoe_l_type_get(nxoe)) + { + case NXOT_ARRAY: + { + notyet = nxoe_l_array_delete(nxoe, a_nxa, i); + break; + } +#ifdef CW_THREADS + case NXOT_CONDITION: + { + notyet = nxoe_l_condition_delete(nxoe, a_nxa, i); + break; + } +#endif + case NXOT_DICT: + { + notyet = nxoe_l_dict_delete(nxoe, a_nxa, i); + break; + } + case NXOT_FILE: + { + notyet = nxoe_l_file_delete(nxoe, a_nxa, i); + break; + } + case NXOT_HOOK: + { + notyet = nxoe_l_hook_delete(nxoe, a_nxa, i); + break; + } +#ifdef CW_THREADS + case NXOT_MUTEX: + { + notyet = nxoe_l_mutex_delete(nxoe, a_nxa, i); + break; + } +#endif + case NXOT_NAME: + { + notyet = nxoe_l_name_delete(nxoe, a_nxa, i); + break; + } +#ifdef CW_REGEX + case NXOT_REGEX: + { + notyet = nxoe_l_regex_delete(nxoe, a_nxa, i); + break; + } + case NXOT_REGSUB: + { + notyet = nxoe_l_regsub_delete(nxoe, a_nxa, i); + break; + } +#endif + case NXOT_STACK: + { + notyet = nxoe_l_stack_delete(nxoe, a_nxa, i); + break; + } + case NXOT_STRING: + { + notyet = nxoe_l_string_delete(nxoe, a_nxa, i); + break; + } + case NXOT_THREAD: + { + notyet = nxoe_l_thread_delete(nxoe, a_nxa, i); + break; + } + default: + { + cw_not_reached(); + break; + } + } + + if (notyet) + { + again = TRUE; + qr_after_insert(defer, nxoe, link); + defer = nxoe; + } + } while (nxoe != last); + } +} + +/* Collect garbage using a Baker's Treadmill. a_nxa->lock is held upon entry + * into this function. */ +static void +nxa_p_collect(cw_nxa_t *a_nxa) +{ + cw_uint32_t nroot, nreachable; + cw_nxoe_t *garbage; + struct timeval t_tv; + cw_nxoi_t start_us, mark_us, sweep_us; + + /* Reset the pending flag. */ + a_nxa->gc_pending = FALSE; + + /* Reset the allocated flag. */ + a_nxa->gc_allocated = FALSE; + + /* Release the lock before entering the single section to avoid lock order + * reversal due to mutators calling nxa_malloc() within critical sections. + * We don't need the lock anyway, except to protect the GC statistics and + * the gc_pending flag. */ +#ifdef CW_THREADS + mtx_unlock(&a_nxa->lock); +#endif + + /* Record the start time. */ + gettimeofday(&t_tv, NULL); + start_us = t_tv.tv_sec; + start_us *= 1000000; + start_us += t_tv.tv_usec; + + /* Prevent new registrations until after the mark phase is completed. */ +#ifdef CW_THREADS + mtx_lock(&a_nxa->seq_mtx); +#endif + +#ifdef CW_THREADS + /* Stop mutator threads. */ + thd_single_enter(); +#endif + + /* Mark the root set gray. If there are any objects in the root set, mark + * all objects reachable from the root set. Otherwise, everything is + * garbage. */ + if (nxa_p_roots(a_nxa, &nroot)) + { + garbage = nxa_p_mark(a_nxa, &nreachable); + } + else + { + garbage = ql_first(&a_nxa->seq_set); + ql_first(&a_nxa->seq_set) = NULL; + } + +#ifdef CW_THREADS + /* Allow mutator threads to run. */ + thd_single_leave(); +#endif + + /* Flip the value of white. */ + a_nxa->white = !a_nxa->white; + + /* New registrations are safe again. */ +#ifdef CW_THREADS + mtx_unlock(&a_nxa->seq_mtx); +#endif + + /* Record the mark finish time and calculate mark_us. */ + gettimeofday(&t_tv, NULL); + mark_us = t_tv.tv_sec; + mark_us *= 1000000; + mark_us += t_tv.tv_usec; + mark_us -= start_us; + + /* If there is garbage, discard it. */ + if (garbage != NULL) + { + nxa_p_sweep(a_nxa, garbage); + } + + /* Record the sweep finish time and calculate sweep_us. */ + gettimeofday(&t_tv, NULL); + sweep_us = t_tv.tv_sec; + sweep_us *= 1000000; + sweep_us += t_tv.tv_usec; + sweep_us -= start_us; + sweep_us -= mark_us; + + /* Protect statistics updates. */ +#ifdef CW_THREADS + mtx_lock(&a_nxa->lock); +#endif + + /* Update statistics. */ + /* count. Since sweeping occurs asynchronously, it is possible that the + * current count is not an accurate reflection of what the lowest memory + * usage since the mark phase completed. We don't need to worry about + * this too much, since, the race only exists for threaded versions of + * onyx, and periodic collection will happen. */ + a_nxa->gcdict_current[0] = a_nxa->gcdict_count; + + /* mark. */ + a_nxa->gcdict_current[1] = mark_us; + if (mark_us > a_nxa->gcdict_maximum[1]) + { + a_nxa->gcdict_maximum[1] = mark_us; + } + a_nxa->gcdict_sum[1] += mark_us; + + /* sweep. */ + a_nxa->gcdict_current[2] = sweep_us; + if (sweep_us > a_nxa->gcdict_maximum[2]) + { + a_nxa->gcdict_maximum[2] = sweep_us; + } + a_nxa->gcdict_sum[2] += sweep_us; + + /* Increment the collections counter. */ + a_nxa->gcdict_collections++; +} + +#ifdef CW_PTHREADS +static void * +nxa_p_gc_entry(void *a_arg) +{ + cw_nxa_t *nxa = (cw_nxa_t *) a_arg; + struct timespec period; + cw_nxam_t message; + cw_bool_t allocated, shutdown; + + /* Any of the following conditions will cause a collection: + * + * 1) Enough allocation was done to trigger immediate collection. + * + * 2) Some registrations were done, followed by a period of no + * registrations for more than gcdict_period seconds. + * + * 3) Collection was explicitly requested. + */ + period.tv_nsec = 0; + for (allocated = shutdown = FALSE; shutdown == FALSE;) + { + mtx_lock(&nxa->lock); + period.tv_sec = nxa->gcdict_period; + mtx_unlock(&nxa->lock); + + if (period.tv_sec > 0) + { + if (mq_timedget(&nxa->gc_mq, &period, &message)) + { + message = NXAM_NONE; + } + } + else + { + mq_get(&nxa->gc_mq, &message); + } + + switch (message) + { + case NXAM_NONE: + { + mtx_lock(&nxa->lock); + if (nxa->gcdict_active) + { + if (nxa->gc_allocated) + { + /* Record the fact that there has been allocation + * activity. */ + allocated = TRUE; + } + + if (nxa->gc_allocated == FALSE) + { + if (allocated) + { + /* No additional registrations have happened since + * the last mq_timedget() timeout and some + * allocation has occurred; collect. */ + nxa_p_collect(nxa); + allocated = FALSE; + } + } + else + { + /* Reset the allocated flag so that at the next timeout, + * we can tell if there has been any allocation + * activity. */ + nxa->gc_allocated = FALSE; + } + } + mtx_unlock(&nxa->lock); + + break; + } + case NXAM_COLLECT: + { + mtx_lock(&nxa->lock); + nxa_p_collect(nxa); + allocated = FALSE; + mtx_unlock(&nxa->lock); + break; + } + case NXAM_RECONFIGURE: + { + /* Don't do anything here. */ + break; + } + case NXAM_SHUTDOWN: + { + shutdown = TRUE; + mtx_lock(&nxa->lock); + nxa_p_collect(nxa); + mtx_unlock(&nxa->lock); + break; + } + default: + { + cw_not_reached(); + } + } + } + + return NULL; +} +#endif diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxn.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxn.c new file mode 100644 index 000000000..b7521a7f7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxn.c @@ -0,0 +1,16 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- +****************************************************************************** +* +* +* +* +****************************************************************************** +* +* Version: Onyx +* +******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define CW_NXN_C_ +#include "../include/libonyx/nxn.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo.c new file mode 100644 index 000000000..b464fb895 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo.c @@ -0,0 +1,385 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" + +/* nxo. */ +cw_sint32_t +nxo_compare(const cw_nxo_t *a_a, const cw_nxo_t *a_b) +{ + cw_sint32_t retval; + + switch (nxo_type_get(a_a)) + { + case NXOT_ARRAY: +#ifdef CW_THREADS + case NXOT_CONDITION: +#endif + case NXOT_DICT: + case NXOT_FILE: + case NXOT_HOOK: +#ifdef CW_THREADS + case NXOT_MUTEX: +#endif +#ifdef CW_REGEX + case NXOT_REGEX: + case NXOT_REGSUB: +#endif + case NXOT_STACK: + case NXOT_THREAD: + { + if (nxo_type_get(a_a) == nxo_type_get(a_b) + && a_a->o.nxoe == a_b->o.nxoe) + { + retval = 0; + } + else + { + retval = 1; + } + break; + } + case NXOT_OPERATOR: + { + if (nxo_type_get(a_b) == NXOT_OPERATOR + && a_a->o.oper.f == a_b->o.oper.f) + { + retval = 0; + } + else + { + retval = 1; + } + break; + } + case NXOT_NAME: + case NXOT_STRING: + { + const cw_uint8_t *str_a, *str_b; + cw_uint32_t len_a, len_b; +#ifdef CW_THREADS + cw_bool_t lock_a, lock_b; +#endif + + if (nxo_type_get(a_a) == NXOT_NAME) + { + str_a = nxo_name_str_get(a_a); + len_a = nxo_name_len_get(a_a); +#ifdef CW_THREADS + lock_a = FALSE; +#endif + } + else + { + str_a = nxo_string_get(a_a); + len_a = nxo_string_len_get(a_a); +#ifdef CW_THREADS + lock_a = TRUE; +#endif + } + + if (nxo_type_get(a_b) == NXOT_NAME) + { + str_b = nxo_name_str_get(a_b); + len_b = nxo_name_len_get(a_b); +#ifdef CW_THREADS + lock_b = FALSE; +#endif + } + else if (nxo_type_get(a_b) == NXOT_STRING) + { + str_b = nxo_string_get(a_b); + len_b = nxo_string_len_get(a_b); +#ifdef CW_THREADS + lock_b = TRUE; +#endif + } + else + { + retval = 2; + break; + } + +#ifdef CW_THREADS + if (lock_a) + { + nxo_string_lock((cw_nxo_t *) a_a); + } + if (lock_b) + { + nxo_string_lock((cw_nxo_t *) a_b); + } +#endif + if (len_a == len_b) + { + retval = strncmp(str_a, str_b, len_a); + } + else if (len_a < len_b) + { + retval = strncmp(str_a, str_b, len_a); + if (retval == 0) + { + retval = -1; + } + } + else + { + retval = strncmp(str_a, str_b, len_b); + if (retval == 0) + { + retval = 1; + } + } +#ifdef CW_THREADS + if (lock_b) + { + nxo_string_unlock((cw_nxo_t *) a_b); + } + if (lock_a) + { + nxo_string_unlock((cw_nxo_t *) a_a); + } +#endif + break; + } + case NXOT_BOOLEAN: + { + if (nxo_type_get(a_b) != NXOT_BOOLEAN) + { + retval = 2; + break; + } + + if (a_a->o.boolean.val == a_b->o.boolean.val) + { + retval = 0; + } + else + { + retval = 1; + } + break; + } + case NXOT_INTEGER: + { + switch (nxo_type_get(a_b)) + { + case NXOT_INTEGER: + { + if (a_a->o.integer.i < a_b->o.integer.i) + { + retval = -1; + } + else if (a_a->o.integer.i == a_b->o.integer.i) + { + retval = 0; + } + else + { + retval = 1; + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + if (((cw_nxor_t) a_a->o.integer.i) < a_b->o.real.r) + { + retval = -1; + } + else if (((cw_nxor_t) a_a->o.integer.i) == a_b->o.real.r) + { + retval = 0; + } + else + { + retval = 1; + } + + break; + } +#endif + default: + { + retval = 2; + break; + } + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + switch (nxo_type_get(a_b)) + { + case NXOT_INTEGER: + { + if (a_a->o.real.r < ((cw_nxor_t) a_b->o.integer.i)) + { + retval = -1; + } + else if (a_a->o.real.r == ((cw_nxor_t) a_b->o.integer.i)) + { + retval = 0; + } + else + { + retval = 1; + } + break; + } + case NXOT_REAL: + { + if (a_a->o.real.r < a_b->o.real.r) + { + retval = -1; + } + else if (a_a->o.real.r == a_b->o.real.r) + { + retval = 0; + } + else + { + retval = 1; + } + break; + } + default: + { + retval = 2; + break; + } + } + break; + } +#endif + case NXOT_FINO: + case NXOT_MARK: + case NXOT_NULL: + case NXOT_PMARK: + { + if (nxo_type_get(a_a) == nxo_type_get(a_b)) + { + retval = 0; + } + else + { + retval = 2; + } + break; + } + default: + { + cw_not_reached(); + } + } + + return retval; +} + +cw_nxoe_t * +nxo_nxoe_get(const cw_nxo_t *a_nxo) +{ + cw_nxoe_t *retval; + + cw_check_ptr(a_nxo); + cw_assert(a_nxo->magic == CW_NXO_MAGIC || nxo_type_get(a_nxo) == NXOT_NO); + + switch (nxo_type_get(a_nxo)) + { + case NXOT_ARRAY: +#ifdef CW_THREADS + case NXOT_CONDITION: +#endif + case NXOT_DICT: + case NXOT_FILE: + case NXOT_HOOK: +#ifdef CW_THREADS + case NXOT_MUTEX: +#endif + case NXOT_NAME: +#ifdef CW_REGEX + case NXOT_REGEX: + case NXOT_REGSUB: +#endif + case NXOT_STACK: + case NXOT_STRING: + case NXOT_THREAD: + { + retval = a_nxo->o.nxoe; + break; + } + default: + { + retval = NULL; + } + } + + return retval; +} + +#ifdef CW_THREADS +cw_bool_t +nxo_lcheck(cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + +#ifdef CW_DBG + switch (nxo_type_get(a_nxo)) + { + case NXOT_ARRAY: + case NXOT_DICT: + case NXOT_FILE: + case NXOT_STACK: + case NXOT_STRING: + { + retval = a_nxo->o.nxoe->locking; + break; + } + default: + { + cw_not_reached(); + } + } +#else + retval = a_nxo->o.nxoe->locking; +#endif + + return retval; +} +#endif + +/* nxoe. */ +/* Can be called at any time during nxoe_* initialization. */ +void +nxoe_l_new(cw_nxoe_t *a_nxoe, cw_nxot_t a_type, cw_bool_t a_locking) +{ + /* Initialize the common section. */ + memset(a_nxoe, 0, sizeof(cw_nxoe_t)); + + qr_new(a_nxoe, link); + a_nxoe->type = a_type; +#ifdef CW_THREADS + a_nxoe->locking = a_locking; +#endif +#ifdef CW_DBG + a_nxoe->magic = CW_NXOE_MAGIC; +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_array.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_array.c new file mode 100644 index 000000000..d74b2438a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_array.c @@ -0,0 +1,298 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +/* Compile non-inlined functions if not using inlines. */ +#define CW_NXO_ARRAY_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_array_l.h" +#include "../include/libonyx/nxa_l.h" + +void +nxo_array_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, + cw_uint32_t a_len) +{ + cw_nxoe_array_t *array; + cw_nxa_t *nxa; + cw_uint32_t i; + + nxa = nx_nxa_get(a_nx); + + array = (cw_nxoe_array_t *) nxa_malloc(nxa, sizeof(cw_nxoe_array_t)); + + nxoe_l_new(&array->nxoe, NXOT_ARRAY, a_locking); +#ifdef CW_THREADS + if (a_locking) + { + mtx_new(&array->lock); + } +#endif + array->e.a.len = a_len; + array->e.a.alloc_len = a_len; + if (array->e.a.len > 0) + { + array->e.a.arr = (cw_nxo_t *) nxa_malloc(nxa, sizeof(cw_nxo_t) * + array->e.a.alloc_len); + for (i = 0; i < array->e.a.len; i++) + { + nxo_null_new(&array->e.a.arr[i]); + } + } + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) array; + nxo_p_type_set(a_nxo, NXOT_ARRAY); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) array); +} + +void +nxo_array_subarray_new(cw_nxo_t *a_nxo, cw_nxo_t *a_array, cw_nx_t *a_nx, + cw_uint32_t a_offset, cw_uint32_t a_len) +{ + cw_nxoe_array_t *array, *orig; + + cw_check_ptr(a_nxo); + + orig = (cw_nxoe_array_t *) a_array->o.nxoe; + cw_check_ptr(orig); + cw_dassert(orig->nxoe.magic == CW_NXOE_MAGIC); + + array = (cw_nxoe_array_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_array_t)); + + nxoe_l_new(&array->nxoe, NXOT_ARRAY, FALSE); + array->nxoe.indirect = TRUE; + + if (orig->nxoe.indirect) + { + cw_assert(a_offset + a_len + orig->e.i.beg_offset + <= orig->e.i.array->e.a.len); + array->e.i.array = orig->e.i.array; + array->e.i.beg_offset = a_offset + orig->e.i.beg_offset; + } + else + { + cw_assert(a_offset + a_len <= orig->e.a.len); + array->e.i.array = orig; + array->e.i.beg_offset = a_offset; + } + array->e.i.len = a_len; + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) array; + nxo_p_type_set(a_nxo, NXOT_ARRAY); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) array); +} + +void +nxo_array_copy(cw_nxo_t *a_to, cw_nxo_t *a_from) +{ + cw_nxoe_array_t *array_fr, *array_fr_i = NULL, *array_fr_l; + cw_nxoe_array_t *array_to, *array_to_i = NULL, *array_to_l; + cw_nxo_t *arr_fr, *arr_to; + cw_uint32_t i, len_fr, len_to; +#ifdef CW_THREADS + cw_bool_t locking_fr, locking_to; +#endif + + /* Set array pointers. */ + array_fr = (cw_nxoe_array_t *) a_from->o.nxoe; + if (array_fr->nxoe.indirect) + { + array_fr_i = array_fr->e.i.array; + } + array_to = (cw_nxoe_array_t *) a_to->o.nxoe; + if (array_to->nxoe.indirect) + { + array_to_i = array_to->e.i.array; + } + + /* Set arr_fr and len_fr according to whether array_fr is an indirect + * object. */ + if (array_fr_i != NULL) + { + array_fr_l = array_fr_i; + arr_fr = &array_fr_i->e.a.arr[array_fr->e.i.beg_offset]; + len_fr = array_fr->e.i.len; + cw_assert(len_fr + array_fr->e.i.beg_offset <= array_fr_i->e.a.len); + } + else + { + array_fr_l = array_fr; + arr_fr = array_fr->e.a.arr; + len_fr = array_fr->e.a.len; + } + + /* Set arr_to and len_to according to whether array_to is an indirect + * object. */ + if (array_to_i != NULL) + { + array_to_l = array_to_i; + arr_to = &array_to_i->e.a.arr[array_to->e.i.beg_offset]; + len_to = array_to->e.i.len; + } + else + { + array_to_l = array_to; + arr_to = array_to->e.a.arr; + len_to = array_to->e.a.len; + } + + /* Make sure destination is large enough. */ + cw_assert(len_fr <= len_to); + + /* Iteratively copy elements. Only copy one level deep (not recursively), + * by using dup. */ +#ifdef CW_THREADS + if (array_fr_l->nxoe.locking && array_fr_l->nxoe.indirect == FALSE) + { + locking_fr = TRUE; + mtx_lock(&array_fr_l->lock); + } + else + { + locking_fr = FALSE; + } + + if (array_to_l->nxoe.locking && array_to_l->nxoe.indirect == FALSE) + { + locking_to = TRUE; + mtx_lock(&array_to_l->lock); + } + else + { + locking_to = FALSE; + } +#endif + for (i = 0; i < len_fr; i++) + { + nxo_dup(&arr_to[i], &arr_fr[i]); + } +#ifdef CW_THREADS + if (locking_fr) + { + mtx_unlock(&array_fr_l->lock); + } +#endif + + /* Truncate the destination array if it is shorter than the source array. */ + if (len_to > len_fr) + { + if (array_to_i != NULL) + { + array_to->e.i.len = len_fr; + } + else + { + array_to->e.a.len = len_fr; + } + } +#ifdef CW_THREADS + if (locking_to) + { + mtx_unlock(&array_to_l->lock); + } +#endif +} + +cw_uint32_t +nxo_array_len_get(const cw_nxo_t *a_nxo) +{ + cw_uint32_t retval; + cw_nxoe_array_t *array; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + array = (cw_nxoe_array_t *) a_nxo->o.nxoe; + cw_dassert(array->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(array->nxoe.type == NXOT_ARRAY); + + if (array->nxoe.indirect == FALSE) + { + retval = array->e.a.len; + } + else + { + retval = array->e.i.len; + } + + return retval; +} + +#ifdef CW_USE_INLINES +void +nxo_array_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_nxo_t *r_el) +{ + nxo_l_array_el_get(a_nxo, a_offset, r_el); +} +#endif + +void +nxo_array_el_set(cw_nxo_t *a_nxo, cw_nxo_t *a_el, cw_nxoi_t a_offset) +{ + cw_nxoe_array_t *array; +#ifdef CW_THREADS + cw_bool_t locking; +#endif + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_ARRAY); + + array = (cw_nxoe_array_t *) a_nxo->o.nxoe; + + cw_check_ptr(array); + cw_dassert(array->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(array->nxoe.type == NXOT_ARRAY); + + if (array->nxoe.indirect) + { + a_offset += array->e.i.beg_offset; + array = array->e.i.array; +#ifdef CW_THREADS + locking = FALSE; +#endif + } +#ifdef CW_THREADS + else + { + if (array->nxoe.locking) + { + locking = TRUE; + } + else + { + locking = FALSE; + } + } + + if (locking) + { + mtx_lock(&array->lock); + } +#endif + cw_assert(array->nxoe.indirect == FALSE); + + cw_assert(a_offset >= 0 && a_offset < array->e.a.len); + nxo_no_new(&array->e.a.arr[a_offset]); + nxo_dup(&array->e.a.arr[a_offset], a_el); +#ifdef CW_THREADS + if (locking) + { + mtx_unlock(&array->lock); + } +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_boolean.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_boolean.c new file mode 100644 index 000000000..3ea3c7f04 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_boolean.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_BOOLEAN_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_condition.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_condition.c new file mode 100644 index 000000000..1100ba643 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_condition.c @@ -0,0 +1,135 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_CONDITION_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_condition_l.h" +#include "../include/libonyx/nxo_mutex_l.h" + +void +nxo_condition_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx) +{ + cw_nxoe_condition_t *condition; + + condition = (cw_nxoe_condition_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_condition_t)); + + nxoe_l_new(&condition->nxoe, NXOT_CONDITION, FALSE); + cnd_new(&condition->condition); + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) condition; + nxo_p_type_set(a_nxo, NXOT_CONDITION); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) condition); +} + +void +nxo_condition_signal(cw_nxo_t *a_nxo) +{ + cw_nxoe_condition_t *condition; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_CONDITION); + + condition = (cw_nxoe_condition_t *) a_nxo->o.nxoe; + + cw_check_ptr(condition); + cw_dassert(condition->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(condition->nxoe.type == NXOT_CONDITION); + + cnd_signal(&condition->condition); +} + +void +nxo_condition_broadcast(cw_nxo_t *a_nxo) +{ + cw_nxoe_condition_t *condition; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_CONDITION); + + condition = (cw_nxoe_condition_t *) a_nxo->o.nxoe; + + cw_check_ptr(condition); + cw_dassert(condition->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(condition->nxoe.type == NXOT_CONDITION); + + cnd_broadcast(&condition->condition); +} + +void +nxo_condition_wait(cw_nxo_t *a_nxo, cw_nxo_t *a_mutex) +{ + cw_nxoe_condition_t *condition; + cw_nxoe_mutex_t *mutex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_CONDITION); + + condition = (cw_nxoe_condition_t *) a_nxo->o.nxoe; + + cw_check_ptr(condition); + cw_dassert(condition->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(condition->nxoe.type == NXOT_CONDITION); + + cw_check_ptr(a_mutex); + cw_dassert(a_mutex->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_mutex) == NXOT_MUTEX); + + mutex = (cw_nxoe_mutex_t *) a_mutex->o.nxoe; + + cw_check_ptr(mutex); + cw_dassert(mutex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(mutex->nxoe.type == NXOT_MUTEX); + + cnd_wait(&condition->condition, &mutex->lock); +} + +cw_bool_t +nxo_condition_timedwait(cw_nxo_t *a_nxo, cw_nxo_t *a_mutex, + const struct timespec *a_timeout) +{ + cw_bool_t retval; + cw_nxoe_condition_t *condition; + cw_nxoe_mutex_t *mutex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_CONDITION); + + condition = (cw_nxoe_condition_t *) a_nxo->o.nxoe; + + cw_check_ptr(condition); + cw_dassert(condition->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(condition->nxoe.type == NXOT_CONDITION); + + cw_check_ptr(a_mutex); + cw_dassert(a_mutex->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_mutex) == NXOT_MUTEX); + + mutex = (cw_nxoe_mutex_t *) a_mutex->o.nxoe; + + cw_check_ptr(mutex); + cw_dassert(mutex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(mutex->nxoe.type == NXOT_MUTEX); + + retval = cnd_timedwait(&condition->condition, &mutex->lock, a_timeout); + + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_dict.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_dict.c new file mode 100644 index 000000000..25a6f0558 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_dict.c @@ -0,0 +1,713 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_DICT_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_dict_l.h" +#include "../include/libonyx/nxo_name_l.h" + +static cw_uint32_t +nxo_p_dict_hash(const void *a_key); +static cw_bool_t +nxo_p_dict_key_comp(const void *a_k1, const void *a_k2); + +#ifdef CW_THREADS +#define nxoe_p_dict_lock(a_nxoe) \ + do \ + { \ + if ((a_nxoe)->nxoe.locking) \ + { \ + mtx_lock(&(a_nxoe)->lock); \ + } \ + } while (0) +#define nxoe_p_dict_unlock(a_nxoe) \ + do \ + { \ + if ((a_nxoe)->nxoe.locking) \ + { \ + mtx_unlock(&(a_nxoe)->lock); \ + } \ + } while (0) +#endif + +void +nxo_dict_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, + cw_uint32_t a_dict_size) +{ + cw_nxoe_dict_t *dict; + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + + dict = (cw_nxoe_dict_t *) nxa_malloc(nxa, sizeof(cw_nxoe_dict_t)); + + nxoe_l_new(&dict->nxoe, NXOT_DICT, a_locking); +#ifdef CW_THREADS + if (a_locking) + mtx_new(&dict->lock); +#endif + + if (a_dict_size < CW_LIBONYX_DICT_SIZE) + { + cw_uint32_t i; + + dict->is_hash = FALSE; + dict->array_iter = 0; + for (i = 0; i < CW_LIBONYX_DICT_SIZE; i++) + { + nxo_no_new(&dict->data.array[i].key); + } + } + else + { + dict->is_hash = TRUE; + + /* Don't let the table get more than 80% full, or less than 25% full, + * when shrinking. */ + dch_new(&dict->data.hash, (cw_opaque_alloc_t *) nxa_malloc_e, + (cw_opaque_dealloc_t *) nxa_free_e, nxa, a_dict_size * 1.25, + a_dict_size, a_dict_size / 4, nxo_p_dict_hash, + nxo_p_dict_key_comp); + } + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) dict; + nxo_p_type_set(a_nxo, NXOT_DICT); + + nxa_l_gc_register(nxa, (cw_nxoe_t *) dict); +} + +CW_P_INLINE void +nxoe_p_dict_def(cw_nxoe_dict_t *a_dict, cw_nx_t *a_nx, cw_nxo_t *a_key, + cw_nxo_t *a_val) +{ + cw_nxoe_dicto_t *dicto; + + if (a_dict->is_hash) + { + if (dch_search(&a_dict->data.hash, (void *) a_key, (void **) &dicto) + == FALSE) + { + /* a_key is already defined. */ + nxo_dup(&dicto->val, a_val); + + /* If (a_key == &dicto->val), things will break badly. However, I + * can't think of a way that this could possibly happen in real use, + * so just assert. */ + cw_assert(a_key != &dicto->val); + } + else + { + cw_chi_t *chi; + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + + /* Allocate and initialize. */ + dicto = (cw_nxoe_dicto_t *) nxa_malloc(nxa, + sizeof(cw_nxoe_dicto_t)); + chi = (cw_chi_t *) nxa_malloc(nxa, sizeof(cw_chi_t)); + nxo_no_new(&dicto->key); + nxo_dup(&dicto->key, a_key); + nxo_no_new(&dicto->val); + nxo_dup(&dicto->val, a_val); + + /* Insert. */ +#ifdef CW_THREADS + thd_crit_enter(); +#endif + dch_insert(&a_dict->data.hash, (void *) &dicto->key, (void *) dicto, + chi); +#ifdef CW_THREADS + thd_crit_leave(); +#endif + } + } + else + { + cw_bool_t done = FALSE; + cw_uint32_t i; + + /* Search for an existing definition. If one exists, replace the + * value. Otherwise, insert into the array if there is room, or convert + * to a hash then insert if there is not room. */ + + for (i = 0, dicto = NULL; i < CW_LIBONYX_DICT_SIZE; i++) + { + if (nxo_type_get(&a_dict->data.array[i].key) != NXOT_NO) + { + if (nxo_compare(&a_dict->data.array[i].key, a_key) == 0) + { + nxo_dup(&a_dict->data.array[i].val, a_val); + done = TRUE; + break; + } + } + else if (dicto == NULL) + { + dicto = &a_dict->data.array[i]; + } + } + + if (done == FALSE) + { + if (dicto != NULL) + { + nxo_dup(&dicto->key, a_key); + nxo_no_new(&dicto->val); + nxo_dup(&dicto->val, a_val); + } + else + { + cw_nxoe_dicto_t tarray[CW_LIBONYX_DICT_SIZE]; + cw_chi_t *chi; + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + + memcpy(tarray, &a_dict->data.array, sizeof(tarray)); + +#ifdef CW_THREADS + thd_crit_enter(); +#endif + /* Create a dch that initially has twice the capacity of what + * can fit in the array. This has the advantage of avoiding a + * rehash when populating it below, but the disadvantage is that + * the dict can't ever shrink down below this size. Oh well; + * converting from the array to a dch is a one way process + * anyway. + * + * Don't let the table get more than 80% full, or less than 25% + * full, when shrinking. */ + dch_new(&a_dict->data.hash, (cw_opaque_alloc_t *) nxa_malloc_e, + (cw_opaque_dealloc_t *) nxa_free_e, nx_nxa_get(a_nx), + CW_LIBONYX_DICT_SIZE * 2.5, CW_LIBONYX_DICT_SIZE * 2, + CW_LIBONYX_DICT_SIZE / 2, + nxo_p_dict_hash, nxo_p_dict_key_comp); + for (i = 0; i < CW_LIBONYX_DICT_SIZE; i++) + { + if (nxo_type_get(&tarray[i].key) != NXOT_NO) + { + /* Allocate and initialize. */ + dicto = (cw_nxoe_dicto_t *) + nxa_malloc(nxa, sizeof(cw_nxoe_dicto_t)); + chi = (cw_chi_t *) nxa_malloc(nxa, sizeof(cw_chi_t)); + nxo_no_new(&dicto->key); + nxo_dup(&dicto->key, &tarray[i].key); + nxo_no_new(&dicto->val); + nxo_dup(&dicto->val, &tarray[i].val); + + /* Insert. */ + dch_insert(&a_dict->data.hash, (void *) &dicto->key, + (void *) dicto, chi); + } + } + + /* The conversion to a hash is complete. */ + a_dict->is_hash = TRUE; + + /* Finally, do the insertion. */ + + /* Allocate and initialize. */ + dicto = (cw_nxoe_dicto_t *) nxa_malloc(nxa, + sizeof(cw_nxoe_dicto_t)); + chi = (cw_chi_t *) nxa_malloc(nxa, sizeof(cw_chi_t)); + nxo_no_new(&dicto->key); + nxo_dup(&dicto->key, a_key); + nxo_no_new(&dicto->val); + nxo_dup(&dicto->val, a_val); + + /* Insert. */ + dch_insert(&a_dict->data.hash, (void *) &dicto->key, + (void *) dicto, chi); + +#ifdef CW_THREADS + thd_crit_leave(); +#endif + } + } + } +} + +CW_P_INLINE cw_nxo_t * +nxoe_p_dict_lookup(cw_nxoe_dict_t *a_dict, const cw_nxo_t *a_key) +{ + cw_nxo_t *retval; + + if (a_dict->is_hash) + { + cw_nxoe_dicto_t *dicto; + + if (dch_search(&a_dict->data.hash, (void *) a_key, (void **) &dicto) + == FALSE) + { + retval = &dicto->val; + } + else + { + retval = NULL; + } + } + else + { + cw_uint32_t i; + + retval = NULL; + for (i = 0; i < CW_LIBONYX_DICT_SIZE; i++) + { + if (nxo_type_get(&a_dict->data.array[i].key) != NXOT_NO + && nxo_compare(&a_dict->data.array[i].key, a_key) == 0) + { + retval = &a_dict->data.array[i].val; + break; + } + } + } + + return retval; +} + +void +nxo_dict_copy(cw_nxo_t *a_to, cw_nxo_t *a_from, cw_nx_t *a_nx) +{ + cw_nxoe_dict_t *to, *from; + cw_uint32_t i; + cw_nxoe_dicto_t *dicto_from; + + cw_check_ptr(a_to); + cw_dassert(a_to->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_to) == NXOT_DICT); + to = (cw_nxoe_dict_t *) a_to->o.nxoe; + cw_check_ptr(to); + cw_dassert(to->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(to->nxoe.type == NXOT_DICT); + + cw_check_ptr(a_from); + cw_dassert(a_from->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_from) == NXOT_DICT); + from = (cw_nxoe_dict_t *) a_from->o.nxoe; + cw_check_ptr(from); + cw_dassert(from->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(from->nxoe.type == NXOT_DICT); + + /* Deep (but not recursive) copy. */ +#ifdef CW_THREADS + nxoe_p_dict_lock(from); + nxoe_p_dict_lock(to); +#endif + if (from->is_hash) + { + cw_uint32_t count; + + for (i = 0, count = dch_count(&from->data.hash); i < count; i++) + { + /* Get a dicto. */ + dch_get_iterate(&from->data.hash, NULL, (void **) &dicto_from); + + nxoe_p_dict_def(to, a_nx, &dicto_from->key, &dicto_from->val); + } + } + else + { + for (i = 0; i < CW_LIBONYX_DICT_SIZE; i++) + { + if (nxo_type_get(&from->data.array[i].key) != NXOT_NO) + { + dicto_from = &from->data.array[i]; + nxoe_p_dict_def(to, a_nx, &dicto_from->key, &dicto_from->val); + } + } + + } +#ifdef CW_THREADS + nxoe_p_dict_unlock(to); + nxoe_p_dict_unlock(from); +#endif +} + +void +nxo_dict_def(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_nxo_t *a_key, cw_nxo_t *a_val) +{ + cw_nxoe_dict_t *dict; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_DICT); + + dict = (cw_nxoe_dict_t *) a_nxo->o.nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + nxoe_p_dict_lock(dict); +#endif + nxoe_p_dict_def(dict, a_nx, a_key, a_val); +#ifdef CW_THREADS + nxoe_p_dict_unlock(dict); +#endif +} + +void +nxo_dict_undef(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_nxo_t *a_key) +{ + cw_nxoe_dict_t *dict; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_DICT); + + dict = (cw_nxoe_dict_t *) a_nxo->o.nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + nxoe_p_dict_lock(dict); +#endif + if (dict->is_hash) + { + cw_nxoe_dicto_t *dicto; + cw_chi_t *chi; + cw_bool_t error; + +#ifdef CW_THREADS + thd_crit_enter(); +#endif + error = dch_remove(&dict->data.hash, (void *) a_key, NULL, + (void **) &dicto, &chi); +#ifdef CW_THREADS + thd_crit_leave(); +#endif + + if (error == FALSE) + { + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + + nxa_free(nxa, dicto, sizeof(cw_nxoe_dicto_t)); + nxa_free(nxa, chi, sizeof(cw_chi_t)); + } + } + else + { + cw_uint32_t i; + + for (i = 0; i < CW_LIBONYX_DICT_SIZE; i++) + { + if (nxo_type_get(&dict->data.array[i].key) != NXOT_NO + && nxo_compare(&dict->data.array[i].key, a_key) == 0) + { + nxo_no_new(&dict->data.array[i].key); + break; + } + } + } +#ifdef CW_THREADS + nxoe_p_dict_unlock(dict); +#endif +} + +cw_bool_t +nxo_dict_lookup(const cw_nxo_t *a_nxo, const cw_nxo_t *a_key, cw_nxo_t *r_nxo) +{ + cw_bool_t retval; + cw_nxoe_dict_t *dict; + cw_nxo_t *nxo; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_DICT); + + dict = (cw_nxoe_dict_t *) a_nxo->o.nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + nxoe_p_dict_lock(dict); +#endif + nxo = nxoe_p_dict_lookup(dict, a_key); + if (nxo != NULL) + { + if (r_nxo != NULL) + { + nxo_dup(r_nxo, nxo); + } + retval = FALSE; + } + else + { + retval = TRUE; + } +#ifdef CW_THREADS + nxoe_p_dict_unlock(dict); +#endif + + return retval; +} + +/* This function is generally unsafe to use, since the return value can + * disappear due to GC before the pointer is turned into a legitimate reference. + * However, the GC itself needs to cache pointers to the actual values inside + * the dict for performance reasons, so it uses this function. */ +cw_nxo_t * +nxo_l_dict_lookup(const cw_nxo_t *a_nxo, const cw_nxo_t *a_key) +{ + cw_nxo_t *retval; + cw_nxoe_dict_t *dict; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_DICT); + + dict = (cw_nxoe_dict_t *) a_nxo->o.nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + nxoe_p_dict_lock(dict); +#endif + retval = nxoe_p_dict_lookup(dict, a_key); +#ifdef CW_THREADS + nxoe_p_dict_unlock(dict); +#endif + + return retval; +} + +cw_uint32_t +nxo_dict_count(const cw_nxo_t *a_nxo) +{ + cw_uint32_t retval; + cw_nxoe_dict_t *dict; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_DICT); + + dict = (cw_nxoe_dict_t *) a_nxo->o.nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + nxoe_p_dict_lock(dict); +#endif + if (dict->is_hash) + { + retval = dch_count(&dict->data.hash); + } + else + { + cw_uint32_t i; + + for (i = retval = 0; i < CW_LIBONYX_DICT_SIZE; i++) + { + if (nxo_type_get(&dict->data.array[i].key) != NXOT_NO) + { + retval++; + } + } + } +#ifdef CW_THREADS + nxoe_p_dict_unlock(dict); +#endif + + return retval; +} + +cw_bool_t +nxo_dict_iterate(cw_nxo_t *a_nxo, cw_nxo_t *r_nxo) +{ + cw_bool_t retval; + cw_nxoe_dict_t *dict; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_DICT); + + dict = (cw_nxoe_dict_t *) a_nxo->o.nxoe; + + cw_check_ptr(dict); + cw_dassert(dict->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(dict->nxoe.type == NXOT_DICT); + +#ifdef CW_THREADS + nxoe_p_dict_lock(dict); +#endif + if (dict->is_hash) + { + cw_nxo_t *nxo; + + retval = dch_get_iterate(&dict->data.hash, (void **) &nxo, NULL); + if (retval == FALSE) + { + nxo_dup(r_nxo, nxo); + } + } + else + { + cw_uint32_t i; + + for (retval = TRUE, i = 0; + retval == TRUE && i < CW_LIBONYX_DICT_SIZE; + i++, dict->array_iter = (dict->array_iter + 1) + % CW_LIBONYX_DICT_SIZE) + { + if (nxo_type_get(&dict->data.array[dict->array_iter].key) + != NXOT_NO) + { + nxo_dup(r_nxo, &dict->data.array[dict->array_iter].key); + retval = FALSE; + } + } + } +#ifdef CW_THREADS + nxoe_p_dict_unlock(dict); +#endif + + return retval; +} + +/* Hash any nxo, but optimize for name hashing. */ +static cw_uint32_t +nxo_p_dict_hash(const void *a_key) +{ + cw_uint32_t retval; + cw_nxo_t *key = (cw_nxo_t *) a_key; + + cw_check_ptr(key); + cw_dassert(key->magic == CW_NXO_MAGIC); + + switch (nxo_type_get(key)) + { + case NXOT_ARRAY: +#ifdef CW_THREADS + case NXOT_CONDITION: +#endif + case NXOT_DICT: + case NXOT_FILE: + case NXOT_HOOK: +#ifdef CW_THREADS + case NXOT_MUTEX: +#endif + case NXOT_NAME: +#ifdef CW_REGEX + case NXOT_REGEX: + case NXOT_REGSUB: +#endif + case NXOT_STACK: + case NXOT_THREAD: + { + retval = ch_direct_hash((void *) key->o.nxoe); + break; + } + case NXOT_OPERATOR: + { + retval = ch_direct_hash((void *) key->o.oper.f); + break; + } + case NXOT_STRING: + { + cw_uint8_t *str; + cw_uint32_t i, len; + + str = nxo_string_get(key); + len = nxo_string_len_get(key); + nxo_string_lock(key); + for (i = retval = 0; i < len; i++) + { + retval = retval * 33 + str[i]; + } + nxo_string_unlock(key); + break; + } + case NXOT_BOOLEAN: + { + retval = (cw_uint32_t) key->o.boolean.val; + break; + } + case NXOT_INTEGER: + { + retval = (cw_uint32_t) key->o.integer.i; + break; + } + case NXOT_MARK: + case NXOT_NULL: + case NXOT_PMARK: + { + retval = UINT_MAX; + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + /* This could be vastly improved. */ + retval = (cw_uint32_t) key->o.real.r; + break; + } +#endif + default: + { + cw_not_reached(); + } + } + + return retval; +} + +/* Compare nxo's, but optimize for name comparison. */ +static cw_bool_t +nxo_p_dict_key_comp(const void *a_k1, const void *a_k2) +{ + cw_bool_t retval; + cw_nxo_t *k1 = (cw_nxo_t *) a_k1; + cw_nxo_t *k2 = (cw_nxo_t *) a_k2; + + cw_check_ptr(k1); + cw_dassert(k1->magic == CW_NXO_MAGIC); + cw_check_ptr(k2); + cw_dassert(k2->magic == CW_NXO_MAGIC); + + if ((nxo_type_get(k1) == NXOT_NAME) + && (nxo_type_get(k1) == NXOT_NAME)) + { + cw_nxoe_name_t *n1, *n2; + + n1 = (cw_nxoe_name_t *) k1->o.nxoe; + n2 = (cw_nxoe_name_t *) k2->o.nxoe; + + retval = (n1 == n2) ? TRUE : FALSE; + } + else if (nxo_type_get(k1) != nxo_type_get(k2)) + { + retval = FALSE; + } + else + { + retval = nxo_compare(k1, k2) ? FALSE : TRUE; + } + + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_file.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_file.c new file mode 100644 index 000000000..49382432a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_file.c @@ -0,0 +1,1678 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_FILE_C_ + +#include "../include/libonyx/libonyx.h" + +#ifdef CW_POSIX_FILE +#include +#include +#include +#include +#ifdef HAVE_POLL +#include +#else +#include "poll.c" +#endif +#endif + +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_file_l.h" + +#ifdef CW_THREADS +#define nxoe_p_file_lock(a_nxoe) \ + do \ + { \ + if ((a_nxoe)->nxoe.locking) \ + { \ + mtx_lock(&(a_nxoe)->lock); \ + } \ + } while (0) +#define nxoe_p_file_unlock(a_nxoe) \ + do \ + { \ + if ((a_nxoe)->nxoe.locking) \ + { \ + mtx_unlock(&(a_nxoe)->lock); \ + } \ + } while (0) +#endif + +void +nxo_file_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking) +{ + cw_nxoe_file_t *file; + + file = (cw_nxoe_file_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_file_t)); + + nxoe_l_new(&file->nxoe, NXOT_FILE, a_locking); +#ifdef CW_THREADS + if (a_locking) + { + mtx_new(&file->lock); + } +#endif + file->nx = a_nx; + file->mode = FILE_NONE; +#ifdef CW_POSIX_FILE + file->nonblocking = FALSE; +#endif + + file->buffer = NULL; + file->buffer_mode = BUFFER_EMPTY; + file->buffer_size = 0; + file->buffer_offset = 0; + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) file; + nxo_p_type_set(a_nxo, NXOT_FILE); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) file); +} + +#ifdef CW_POSIX_FILE +void +nxo_file_fd_wrap(cw_nxo_t *a_nxo, cw_uint32_t a_fd) +{ + cw_nxoe_file_t *file; + int flags; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + cw_assert(file->mode == FILE_NONE); + + file->mode = FILE_POSIX; + if ((flags = fcntl(file->f.p.fd, F_GETFL, O_NONBLOCK)) != -1 + && (flags & O_NONBLOCK)) + { + file->nonblocking = TRUE; + } + else + { + file->nonblocking = FALSE; + } + + file->f.p.fd = a_fd; + file->f.p.wrapped = TRUE; +} +#endif + +void +nxo_file_synthetic(cw_nxo_t *a_nxo, cw_nxo_file_read_t *a_read, + cw_nxo_file_write_t *a_write, + cw_nxo_file_ref_iter_t *a_ref_iter, + cw_nxo_file_delete_t *a_delete, void *a_arg) +{ + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + cw_assert(file->mode == FILE_NONE); + + file->mode = FILE_SYNTHETIC; +#ifdef CW_POSIX_FILE + file->nonblocking = FALSE; +#endif + file->f.s.read_f = a_read; + file->f.s.write_f = a_write; + file->f.s.ref_iter_f = a_ref_iter; + file->f.s.delete_f = a_delete; + file->f.s.arg = a_arg; + file->f.s.position = 0; +} + +#ifdef CW_POSIX_FILE +/* NXN_ioerror, + * NXN_limitcheck, + * NXN_invalidfileaccess */ +cw_nxn_t +nxo_file_open(cw_nxo_t *a_nxo, const cw_uint8_t *a_filename, cw_uint32_t a_nlen, + const cw_uint8_t *a_flags, cw_uint32_t a_flen, mode_t a_mode) +{ + cw_nxn_t retval; + cw_nxoe_file_t *file; + cw_uint8_t filename[PATH_MAX], flags[3]; + int access; + + /* Copy the arguments to local buffers in order to assure '\0' + * termination. */ + if (a_nlen >= sizeof(filename)) + { + retval = NXN_limitcheck; + goto RETURN; + } + memcpy(filename, a_filename, a_nlen); + filename[a_nlen] = '\0'; + + if (a_flen >= sizeof(flags)) + { + retval = NXN_limitcheck; + goto RETURN; + } + memcpy(flags, a_flags, a_flen); + flags[a_flen] = '\0'; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (file->mode != FILE_NONE) + { + retval = NXN_invalidfileaccess; + goto URETURN; + } + + /* Convert a_flags to the integer representation. */ + switch (flags[0]) + { + case 'r': + { + switch (flags[1]) + { + case '\0': + { + access = O_RDONLY; + break; + } + case '+': + { + access = O_RDWR; + break; + } + default: + { + retval = NXN_invalidfileaccess; + goto URETURN; + } + } + break; + } + case 'w': + { + switch (flags[1]) + { + case '\0': + { + access = O_WRONLY | O_CREAT | O_TRUNC; + break; + } + case '+': + { + access = O_RDWR | O_CREAT | O_TRUNC; + break; + } + default: + { + retval = NXN_invalidfileaccess; + goto URETURN; + } + } + break; + } + case 'a': + { + switch (flags[1]) + { + case '\0': + { + access = O_WRONLY | O_APPEND | O_CREAT; + break; + } + case '+': + { + access = O_RDWR | O_APPEND | O_CREAT; + break; + } + default: + { + retval = NXN_invalidfileaccess; + goto URETURN; + } + } + break; + } + default: + { + retval = NXN_invalidfileaccess; + goto URETURN; + } + } + + file->f.p.fd = open(filename, access, a_mode); + if (file->f.p.fd == -1) + { + switch (errno) + { + case ENOSPC: + case EMFILE: + case ENFILE: + { + retval = NXN_ioerror; + goto URETURN; + } + default: + { + retval = NXN_invalidfileaccess; + goto URETURN; + } + } + } + + file->mode = FILE_POSIX; + file->nonblocking = FALSE; + file->f.p.wrapped = FALSE; + + retval = NXN_ZERO; + URETURN: +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + RETURN: + return retval; +} +#endif + +/* NXN_ioerror */ +cw_nxn_t +nxo_file_close(cw_nxo_t *a_nxo) +{ + cw_nxn_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (file->mode == FILE_NONE) + { + retval = NXN_ioerror; + goto RETURN; + } + + /* Flush and get rid of the buffer if necessary. */ + retval = nxo_p_file_buffer_flush(file); + if (retval) + { + goto RETURN; + } + if (file->buffer != NULL) + { + nxa_free(nx_nxa_get(file->nx), file->buffer, file->buffer_size); + file->buffer = NULL; + file->buffer_size = 0; + file->buffer_mode = BUFFER_EMPTY; + } + + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + file->mode = FILE_NONE; + file->nonblocking = FALSE; + if (file->f.p.wrapped == FALSE) + { + if (close(file->f.p.fd) == -1) + { + retval = NXN_ioerror; + goto RETURN; + } + } + break; + } +#endif + case FILE_SYNTHETIC: + { + file->mode = FILE_NONE; +#ifdef CW_POSIX_FILE + file->nonblocking = FALSE; +#endif + if (file->f.s.delete_f != NULL) + { + file->f.s.delete_f(file->f.s.arg, file->nx); + } + break; + } + } + + retval = NXN_ZERO; + RETURN: +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} + +#ifdef CW_POSIX_FILE +cw_sint32_t +nxo_file_fd_get(const cw_nxo_t *a_nxo) +{ + cw_sint32_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + switch (file->mode) + { + case FILE_NONE: + case FILE_SYNTHETIC: + { + retval = -1; + break; + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + retval = file->f.p.fd; + break; + } +#endif + } + +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} +#endif + +cw_bool_t +nxo_file_nonblocking_get(const cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + retval = file->nonblocking; +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + + return retval; +} + +cw_bool_t +nxo_file_nonblocking_set(cw_nxo_t *a_nxo, cw_bool_t a_nonblocking) +{ + cw_bool_t retval; + cw_nxoe_file_t *file; +#ifdef CW_POSIX_FILE + int flags; +#endif + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif +#ifdef CW_POSIX_FILE + if (file->mode != FILE_POSIX) + { + retval = TRUE; + goto RETURN; + } + + /* Get current flags. */ + flags = fcntl(file->f.p.fd, F_GETFL); + if (flags == -1) + { + retval = TRUE; + goto RETURN; + } + + /* Set flags. */ + if (a_nonblocking) + { + flags |= O_NONBLOCK; + } + else + { + flags &= ~O_NONBLOCK; + } + if (fcntl(file->f.p.fd, F_SETFL, flags) == -1) + { + retval = TRUE; + goto RETURN; + } + + file->nonblocking = a_nonblocking; + retval = FALSE; + RETURN: +#else + retval = TRUE; +#endif +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} + +/* -1: NXN_ioerror */ +cw_sint32_t +nxo_file_read(cw_nxo_t *a_nxo, cw_uint32_t a_len, cw_uint8_t *r_str) +{ + cw_sint32_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (file->mode == FILE_NONE) + { + retval = -1; + goto RETURN; + } + + /* Use the internal buffer if it exists. If there aren't enough data in the + * buffer to fill r_str, copy what we have to r_str, then do a readv() to + * fill r_str and the buffer. If the buffer is empty, also do a readv() to + * replenish it (unless the file is nonblocking). */ + if (file->buffer != NULL) + { + if ((file->buffer_mode == BUFFER_READ) + && (a_len <= file->buffer_offset)) + { + /* We had enough buffered data. */ + memcpy(r_str, file->buffer, a_len); + memmove(file->buffer, &file->buffer[a_len], + file->buffer_offset - a_len); + retval = a_len; + file->buffer_offset -= a_len; + if (file->buffer_offset == 0) + { + file->buffer_mode = BUFFER_EMPTY; + } + } + else + { + ssize_t nread; + + /* Copy any buffered before reading more data. */ + if (file->buffer_mode == BUFFER_READ) + { + memcpy(r_str, file->buffer, file->buffer_offset); + retval = file->buffer_offset; + r_str += file->buffer_offset; + a_len -= file->buffer_offset; + } + else + { + retval = 0; + } + /* Clear the buffer. */ + file->buffer_offset = 0; + file->buffer_mode = BUFFER_EMPTY; + + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + struct pollfd events; + struct iovec iov[2]; + + if (retval == 0 && file->nonblocking == FALSE) + { + /* No data read yet. Sleep until some data are + * available. */ + events.fd = file->f.p.fd; + events.events = POLLIN +#ifdef POLLRDNORM + | POLLRDNORM +#endif + ; + while ((poll(&events, 1, -1)) == -1 && errno == EINTR) + { + /* EINTR; try again. */ + } + + /* Finish filling r_str and replenish the internal + * buffer. */ + iov[0].iov_base = r_str; + iov[0].iov_len = a_len; + iov[1].iov_base = file->buffer; + iov[1].iov_len = file->buffer_size; + + while ((nread = readv(file->f.p.fd, iov, 2)) == -1) + { + if (errno != EINTR) + { + break; + } + } + } + else + { + int nready; + + /* Only read if data are available. */ + events.fd = file->f.p.fd; + events.events = POLLIN +#ifdef POLLRDNORM + | POLLRDNORM +#endif + ; + while ((nready = poll(&events, 1, 0)) == -1 + && errno == EINTR) + { + /* EINTR; try again. */ + } + + if (nready == 1) + { + /* Finish filling r_str and replenish the internal + * buffer. */ + iov[0].iov_base = r_str; + iov[0].iov_len = a_len; + iov[1].iov_base = file->buffer; + iov[1].iov_len = file->buffer_size; + + while ((nread = readv(file->f.p.fd, iov, 2)) == -1) + { + if (errno != EINTR) + { + break; + } + } + } + else + { + nread = 0; + } + } + break; + } +#endif + case FILE_SYNTHETIC: + { + /* Use the read wrapper function. */ + nread = file->f.s.read_f(file->f.s.arg, a_nxo, a_len, + r_str); + break; + } + } + + /* Handle various read return values. */ + if (nread == -1) + { + if (retval == 0) + { + retval = -1; + goto RETURN; + } + /* There was an error, but we already managed to provide some + * data, so don't report an error this time around. */ + } + else if (nread <= a_len) + { + /* We didn't get enough data to start filling the internal + * buffer. */ + retval += nread; + } + else + { + retval += a_len; + file->buffer_offset = nread - a_len; + file->buffer_mode = BUFFER_READ; + } + } + } + else + { + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + while ((retval = read(file->f.p.fd, r_str, a_len)) == -1) + { + if (errno != EINTR) + { + break; + } + } + break; + } +#endif + case FILE_SYNTHETIC: + { + retval = file->f.s.read_f(file->f.s.arg, a_nxo, a_len, r_str); + break; + } + } + } + + if (retval == 0 && file->buffer != NULL) + { + file->buffer_offset = 0; + file->buffer_mode = BUFFER_EMPTY; + } + RETURN: + if (file->mode == FILE_SYNTHETIC && retval != -1) + { + file->f.s.position += retval; + } +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} + +/* NXN_ioerror */ +cw_nxn_t +nxo_file_readline(cw_nxo_t *a_nxo, cw_bool_t a_locking, cw_nxo_t *r_string, + cw_bool_t *r_eof) +{ + cw_nxn_t retval; + cw_nxoe_file_t *file; + cw_uint8_t *line, s_line[CW_NXO_FILE_READLINE_BUFSIZE]; + cw_uint32_t i, maxlen; + cw_sint32_t nread; + enum {NORMAL, CR} state; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + + line = s_line; + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (file->mode == FILE_NONE) + { + retval = NXN_ioerror; + goto RETURN; + } + + /* Copy bytes until we see a \n or EOF. Note that \r\n is converted to + * \n. */ + if (file->buffer != NULL) + { + cw_uint32_t offset; + + /* Flush the internal buffer if it has write data. */ + if (file->buffer_mode == BUFFER_WRITE) + { + retval = nxo_p_file_buffer_flush(file); + if (retval) + { + goto RETURN; + } + } + + /* Copy bytes from the internal buffer, one at a time, replenishing the + * internal buffer as necessary. */ + for (i = 0, offset = 0, maxlen = CW_NXO_FILE_READLINE_BUFSIZE, + state = NORMAL;; i++) { + /* If we're about to overflow the line buffer, expand it. */ + if (i == maxlen) + { + if (line == s_line) + { + /* First expansion. */ + line = (cw_uint8_t *) nxa_malloc(nx_nxa_get(file->nx), + maxlen << 1); + memcpy(line, s_line, maxlen); + } + else + { + cw_uint8_t *oldline; + + /* We've already expanded at least once. */ + oldline = line; + line = (cw_uint8_t *) nxa_malloc(nx_nxa_get(file->nx), + maxlen << 1); + memcpy(line, oldline, maxlen); + nxa_free(nx_nxa_get(file->nx), oldline, + maxlen); + } + maxlen <<= 1; + } + + if (offset >= file->buffer_offset + || file->buffer_mode == BUFFER_EMPTY) + { + /* Replenish the internal buffer. */ + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + while ((nread = read(file->f.p.fd, + file->buffer, file->buffer_size)) + == -1) + { + if (errno != EINTR) + { + break; + } + } + break; + } +#endif + case FILE_SYNTHETIC: + { + /* Use the read wrapper function. */ + nread = file->f.s.read_f(file->f.s.arg, + a_nxo, file->buffer_size, + file->buffer); + break; + } + } + + if (file->nonblocking && nread == 0) + { + retval = NXN_ioerror; + goto RETURN; + } + else if (nread <= 0) + { + /* EOF. */ + file->buffer_offset = 0; + file->buffer_mode = BUFFER_EMPTY; + + nxo_string_new(r_string, file->nx, + a_locking, i); + nxo_string_lock(r_string); + nxo_string_set(r_string, 0, line, i); + nxo_string_unlock(r_string); + + if (file->mode == FILE_SYNTHETIC) + { + file->f.s.position += i; + } + + retval = NXN_ZERO; + *r_eof = TRUE; + goto RETURN; + } + + file->buffer_mode = BUFFER_READ; + file->buffer_offset = nread; + offset = 0; + } + + line[i] = file->buffer[offset]; + offset++; + + switch (line[i]) + { + case '\r': + { + state = CR; + break; + } + case '\n': + { + if (state == CR) + { + /* Throw away the preceding \r. */ + i--; + } + nxo_string_new(r_string, file->nx, a_locking, i); + nxo_string_lock(r_string); + nxo_string_set(r_string, 0, line, i); + nxo_string_unlock(r_string); + + if (file->mode == FILE_SYNTHETIC) + { + file->f.s.position += i; + } + + /* Shift the remaining buffered data to the beginning of the + * buffer. */ + if (file->buffer_offset - offset > 0) + { + memmove(file->buffer, &file->buffer[offset], + file->buffer_offset - offset); + file->buffer_offset -= offset; + } + else + { + file->buffer_offset = 0; + file->buffer_mode = BUFFER_EMPTY; + } + + retval = NXN_ZERO; + *r_eof = FALSE; + goto RETURN; + } + default: + { + state = NORMAL; + break; + } + } + } + } + else + { + /* There is no internal buffer, so we must read one byte at a time from + * the file. This is horribly inneficient, but we don't have anywhere + * to unput characters past a newline. */ + for (i = 0, maxlen = CW_NXO_FILE_READLINE_BUFSIZE, state = NORMAL;; i++) + { + /* If we're about to overflow the line buffer, expand it. */ + if (i == maxlen) + { + if (line == s_line) + { + /* First expansion. */ + line = (cw_uint8_t *) nxa_malloc(nx_nxa_get(file->nx), + maxlen << 1); + memcpy(line, s_line, maxlen); + } + else + { + cw_uint8_t *oldline; + + /* We've already expanded at least once. */ + oldline = line; + line = (cw_uint8_t *) nxa_malloc(nx_nxa_get(file->nx), + maxlen << 1); + memcpy(line, oldline, maxlen); + nxa_free(nx_nxa_get(file->nx), oldline, + maxlen); + } + maxlen <<= 1; + } + + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + while ((nread = read(file->f.p.fd, &line[i], 1)) == -1) + { + if (errno != EINTR) + { + break; + } + } + break; + } +#endif + case FILE_SYNTHETIC: + { + /* Use the read wrapper function. */ + nread = file->f.s.read_f(file->f.s.arg, a_nxo, 1, &line[i]); + break; + } + } + + if (file->nonblocking && nread == 0) + { + retval = NXN_ioerror; + goto RETURN; + } + else if (nread <= 0) + { + /* EOF. */ + nxo_string_new(r_string, file->nx, a_locking, i); + nxo_string_lock(r_string); + nxo_string_set(r_string, 0, line, i); + nxo_string_unlock(r_string); + + if (file->mode == FILE_SYNTHETIC) + { + file->f.s.position += i; + } + + retval = NXN_ZERO; + *r_eof = TRUE; + goto RETURN; + } + + switch (line[i]) + { + case '\r': + { + state = CR; + break; + } + case '\n': + { + if (state == CR) + { + /* Throw away the preceding \r. */ + i--; + } + nxo_string_new(r_string, file->nx, a_locking, i); + nxo_string_lock(r_string); + nxo_string_set(r_string, 0, line, i); + nxo_string_unlock(r_string); + + if (file->mode == FILE_SYNTHETIC) + { + file->f.s.position += i; + } + + retval = NXN_ZERO; + *r_eof = FALSE; + goto RETURN; + } + default: + { + state = NORMAL; + break; + } + } + } + } + + RETURN: +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + if (line != s_line) + { + nxa_free(nx_nxa_get(file->nx), line, maxlen); + } + return retval; +} + +/* NXN_ioerror */ +cw_nxn_t +nxo_file_write(cw_nxo_t *a_nxo, const cw_uint8_t *a_str, cw_uint32_t a_len, + cw_uint32_t *r_count) +{ + cw_nxn_t retval; + cw_uint32_t retcount; + cw_nxoe_file_t *file; +#ifdef CW_POSIX_FILE + int count; +#endif + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (file->mode == FILE_NONE) + { + retval = NXN_ioerror; + goto RETURN; + } + + if (file->buffer != NULL) + { + /* Discard cached read data if necessary. */ + if (file->buffer_mode == BUFFER_READ) + { + file->buffer_mode = BUFFER_EMPTY; + file->buffer_offset = 0; + } + + /* Use the internal buffer. If a_str won't entirely fit, do a writev() + * for a normal file descriptor, or a straight write for a wrapped + * file. */ + if (a_len <= file->buffer_size - file->buffer_offset) + { + /* a_str will fit. */ + memcpy(&file->buffer[file->buffer_offset], a_str, a_len); + file->buffer_mode = BUFFER_WRITE; + file->buffer_offset += a_len; + retcount = a_len; + } + else + { + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + struct iovec iov[2]; + cw_uint32_t remcount; + + /* a_str won't fit. Do a writev(). */ + + retcount = 0; + do + { + remcount = a_len - retcount; + + iov[0].iov_base = file->buffer; + iov[0].iov_len = file->buffer_offset; + iov[1].iov_base = (char *) &a_str[retcount]; + iov[1].iov_len = remcount; + + while ((count = writev(file->f.p.fd, iov, 2)) == -1) + { + if (errno != EINTR) + { + retval = NXN_ioerror; + goto RETURN; + } + } + + if (count >= file->buffer_offset) + { + /* At least the buffer got written. */ + count -= file->buffer_offset; + + if (count == remcount) + { + /* a_str got written too. */ + file->buffer_mode = BUFFER_EMPTY; + file->buffer_offset = 0; + retcount += count; + } + else + { + /* a_str didn't get completely written. Copy of + * much of it as possible to the buffer. */ + if (remcount - count <= file->buffer_size) + { + memcpy(&file->buffer[0], + &a_str[retcount + count], + remcount - count); + file->buffer_offset = remcount - count; + retcount += remcount; + } + else + { + memcpy(&file->buffer[0], + &a_str[retcount + count], + file->buffer_size); + file->buffer_offset = file->buffer_size; + retcount += count + file->buffer_size; + } + } + } + else + { + /* Not all of the buffer got written. Adjust the + * buffer. */ + memmove(&file->buffer[0], &file->buffer[count], + file->buffer_offset - count); + file->buffer_offset -= count; + } + + /* Writing to blocking files must always succeed in + * full, unless there is an ioerror. */ + } while (retcount < a_len && file->nonblocking == FALSE); + + break; + } +#endif + case FILE_SYNTHETIC: + { + /* a_str won't fit. Flush the buffer and call the write + * wrapper function. */ + retval = nxo_p_file_buffer_flush(file); + if (retval) + { + goto RETURN; + } + + if (file->f.s.write_f(file->f.s.arg, a_nxo, a_str, a_len)) + { + retval = NXN_ioerror; + goto RETURN; + } + file->f.s.position += a_len; + retcount = a_len; + } + } + } + } + else + { + switch (file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + while ((count = write(file->f.p.fd, a_str, a_len)) == -1) + { + if (errno != EINTR) + { + retval = NXN_ioerror; + goto RETURN; + } + } + retcount = count; + break; + } +#endif + case FILE_SYNTHETIC: + { + if (file->f.s.write_f(file->f.s.arg, a_nxo, a_str, a_len)) + { + retval = NXN_ioerror; + goto RETURN; + } + file->f.s.position += a_len; + retcount = a_len; + } + } + } + + retval = NXN_ZERO; + if (r_count != NULL) + { + *r_count = retcount; + } + RETURN: +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} + +#ifdef CW_POSIX_FILE +/* NXN_ioerror */ +cw_nxn_t +nxo_file_truncate(cw_nxo_t *a_nxo, off_t a_length) +{ + cw_nxn_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + switch (file->mode) + { + case FILE_NONE: + case FILE_SYNTHETIC: + { + retval = NXN_ioerror; + goto RETURN; + } + case FILE_POSIX: + { + nxo_p_file_buffer_flush(file); + if (ftruncate(file->f.p.fd, a_length)) + { + retval = NXN_ioerror; + goto RETURN; + } + } + } + + retval = NXN_ZERO; + RETURN: +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} +#endif + +/* -1: NXN_ioerror */ +cw_nxoi_t +nxo_file_position_get(cw_nxo_t *a_nxo) +{ + cw_nxoi_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + + switch (file->mode) + { + case FILE_NONE: + { + retval = -1; + break; + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + /* Flush the file in case there are buffered data that have yet to + * be written. */ + retval = nxo_p_file_buffer_flush(file); + if (retval) + { + break; + } + retval = lseek(file->f.p.fd, 0, SEEK_CUR); + break; + } +#endif + case FILE_SYNTHETIC: + { + retval = file->f.s.position; + } + } + +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} + +#ifdef CW_POSIX_FILE +/* NXN_ioerror */ +cw_nxn_t +nxo_file_position_set(cw_nxo_t *a_nxo, cw_nxoi_t a_position) +{ + cw_nxn_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + switch (file->mode) + { + case FILE_NONE: + case FILE_SYNTHETIC: + { + retval = NXN_ioerror; + break; + } + case FILE_POSIX: + { + retval = nxo_p_file_buffer_flush(file); + if (retval) + { + break; + } + + if (lseek(file->f.p.fd, a_position, SEEK_SET) == -1) + { + retval = NXN_ioerror; + } + } + } + +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + return retval; +} +#endif + +cw_uint32_t +nxo_file_buffer_size_get(const cw_nxo_t *a_nxo) +{ + cw_uint32_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + retval = file->buffer_size; +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + + return retval; +} + +void +nxo_file_buffer_size_set(cw_nxo_t *a_nxo, cw_uint32_t a_size) +{ + cw_nxoe_file_t *file; + cw_nxa_t *nxa; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + + nxa = nx_nxa_get(file->nx); +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (a_size == 0) + { + if (file->buffer != NULL) + { + nxa_free(nxa, file->buffer, file->buffer_size); + file->buffer = NULL; + file->buffer_size = 0; + } + } + else + { + if (file->buffer != NULL) + { + nxa_free(nxa, file->buffer, file->buffer_size); + } + file->buffer = (cw_uint8_t *) nxa_malloc(nx_nxa_get(file->nx), a_size); + file->buffer_size = a_size; + } + file->buffer_mode = BUFFER_EMPTY; + file->buffer_offset = 0; +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif +} + +cw_nxoi_t +nxo_file_buffer_count(const cw_nxo_t *a_nxo) +{ + cw_nxoi_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + if (file->mode != FILE_NONE + && file->buffer != NULL + && file->buffer_mode != BUFFER_WRITE) + { + retval = file->buffer_offset; + } + else + { + retval = 0; + } +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + + return retval; +} + +/* NXN_ioerror */ +cw_nxn_t +nxo_file_buffer_flush(cw_nxo_t *a_nxo) +{ + cw_nxn_t retval; + cw_nxoe_file_t *file; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_FILE); + + file = (cw_nxoe_file_t *) a_nxo->o.nxoe; + + cw_check_ptr(file); + cw_dassert(file->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(file->nxoe.type == NXOT_FILE); + +#ifdef CW_THREADS + nxoe_p_file_lock(file); +#endif + retval = nxo_p_file_buffer_flush(file); +#ifdef CW_THREADS + nxoe_p_file_unlock(file); +#endif + + return retval; +} + +cw_nxn_t +nxo_p_file_buffer_flush(cw_nxoe_file_t *a_file) +{ + cw_nxn_t retval; + + if (a_file->mode == FILE_NONE) + { + retval = NXN_ioerror; + goto RETURN; + } + + if (a_file->buffer != NULL) + { + /* Only write if the buffered data is for writing. */ + if (a_file->buffer_mode == BUFFER_WRITE) + { + switch (a_file->mode) + { + case FILE_NONE: + { + cw_not_reached(); + } +#ifdef CW_POSIX_FILE + case FILE_POSIX: + { + int flags; + + if (a_file->nonblocking) + { + /* Turn off non-blocking mode temporarily. */ + flags = fcntl(a_file->f.p.fd, F_GETFL); + if (flags == -1) + { + retval = NXN_ioerror; + goto RETURN; + } + + if (fcntl(a_file->f.p.fd, F_SETFL, + flags | (~O_NONBLOCK)) == -1) + { + retval = NXN_ioerror; + goto RETURN; + } + } + + while (write(a_file->f.p.fd, a_file->buffer, + a_file->buffer_offset) == -1) + { + if (errno != EINTR) + { + a_file->nonblocking = FALSE; + retval = NXN_ioerror; + goto RETURN; + } + } + + if (a_file->nonblocking) + { + /* Restore non-blocking mode. */ + if (fcntl(a_file->f.p.fd, F_SETFL, flags) == -1) + { + a_file->nonblocking = FALSE; + retval = NXN_ioerror; + goto RETURN; + } + } + break; + } +#endif + case FILE_SYNTHETIC: + { + cw_nxo_t tnxo; + + /* Fake up a file object. */ + nxo_p_new(&tnxo, NXOT_FILE); + tnxo.o.nxoe = (cw_nxoe_t *) a_file; + + /* Use the write wrapper function. */ + if (a_file->f.s.write_f(a_file->f.s.arg, &tnxo, + a_file->buffer, + a_file->buffer_offset)) + { + retval = NXN_ioerror; + goto RETURN; + } + } + } + } + /* Reset the buffer to being empty, regardless of the type of buffered + * data. */ + a_file->buffer_mode = BUFFER_EMPTY; + a_file->buffer_offset = 0; + } + + retval = NXN_ZERO; + RETURN: + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_fino.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_fino.c new file mode 100644 index 000000000..9d94d4b49 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_fino.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_FINO_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_hook.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_hook.c new file mode 100644 index 000000000..6bdec1cea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_hook.c @@ -0,0 +1,133 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_HOOK_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_hook_l.h" + +void +nxo_hook_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, void *a_data, + cw_nxo_hook_eval_t *a_eval_f, cw_nxo_hook_ref_iter_t *a_ref_iter_f, + cw_nxo_hook_delete_t *a_delete_f) +{ + cw_nxoe_hook_t *hook; + + hook = (cw_nxoe_hook_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_hook_t)); + + nxoe_l_new(&hook->nxoe, NXOT_HOOK, FALSE); + nxo_null_new(&hook->tag); + hook->data = a_data; + hook->eval_f = a_eval_f; + hook->ref_iter_f = a_ref_iter_f; + hook->delete_f = a_delete_f; + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) hook; + nxo_p_type_set(a_nxo, NXOT_HOOK); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) hook); +} + +cw_nxo_t * +nxo_hook_tag_get(const cw_nxo_t *a_nxo) +{ + cw_nxo_t *retval; + cw_nxoe_hook_t *hook; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_HOOK); + + hook = (cw_nxoe_hook_t *) a_nxo->o.nxoe; + + cw_check_ptr(hook); + cw_dassert(hook->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(hook->nxoe.type == NXOT_HOOK); + + retval = &hook->tag; + + return retval; +} + +void * +nxo_hook_data_get(const cw_nxo_t *a_nxo) +{ + void *retval; + cw_nxoe_hook_t *hook; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_HOOK); + + hook = (cw_nxoe_hook_t *) a_nxo->o.nxoe; + + cw_check_ptr(hook); + cw_dassert(hook->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(hook->nxoe.type == NXOT_HOOK); + + retval = hook->data; + + return retval; +} + +void +nxo_hook_data_set(cw_nxo_t *a_nxo, void *a_data) +{ + cw_nxoe_hook_t *hook; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_HOOK); + + hook = (cw_nxoe_hook_t *) a_nxo->o.nxoe; + + cw_check_ptr(hook); + cw_dassert(hook->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(hook->nxoe.type == NXOT_HOOK); + + hook->data = a_data; +} + +void +nxo_hook_eval(cw_nxo_t *a_nxo, cw_nxo_t *a_thread) +{ + cw_nxoe_hook_t *hook; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_HOOK); + + hook = (cw_nxoe_hook_t *) a_nxo->o.nxoe; + + cw_check_ptr(hook); + cw_dassert(hook->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(hook->nxoe.type == NXOT_HOOK); + + if (hook->eval_f != NULL) + { + hook->eval_f(hook->data, a_thread); + } + else + { + cw_nxo_t *ostack, *nxo; + + /* This hook can't be executed, so push it onto ostack just like a + * normal literal object would be. */ + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, a_nxo); + } +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_integer.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_integer.c new file mode 100644 index 000000000..7c5729af9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_integer.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_INTEGER_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_mark.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_mark.c new file mode 100644 index 000000000..5d2f6859d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_mark.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_MARK_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_mutex.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_mutex.c new file mode 100644 index 000000000..6dd8c55cd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_mutex.c @@ -0,0 +1,94 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_MUTEX_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_mutex_l.h" + +void +nxo_mutex_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx) +{ + cw_nxoe_mutex_t *mutex; + + mutex = (cw_nxoe_mutex_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_mutex_t)); + + nxoe_l_new(&mutex->nxoe, NXOT_MUTEX, FALSE); + mtx_new(&mutex->lock); + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) mutex; + nxo_p_type_set(a_nxo, NXOT_MUTEX); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) mutex); +} + +void +nxo_mutex_lock(cw_nxo_t *a_nxo) +{ + cw_nxoe_mutex_t *mutex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_MUTEX); + + mutex = (cw_nxoe_mutex_t *) a_nxo->o.nxoe; + + cw_check_ptr(mutex); + cw_dassert(mutex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(mutex->nxoe.type == NXOT_MUTEX); + + mtx_lock(&mutex->lock); +} + +cw_bool_t +nxo_mutex_trylock(cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + cw_nxoe_mutex_t *mutex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_MUTEX); + + mutex = (cw_nxoe_mutex_t *) a_nxo->o.nxoe; + + cw_check_ptr(mutex); + cw_dassert(mutex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(mutex->nxoe.type == NXOT_MUTEX); + + retval = mtx_trylock(&mutex->lock); + + return retval; +} + +void +nxo_mutex_unlock(cw_nxo_t *a_nxo) +{ + cw_nxoe_mutex_t *mutex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_MUTEX); + + mutex = (cw_nxoe_mutex_t *) a_nxo->o.nxoe; + + cw_check_ptr(mutex); + cw_dassert(mutex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(mutex->nxoe.type == NXOT_MUTEX); + + mtx_unlock(&mutex->lock); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_name.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_name.c new file mode 100644 index 000000000..35148fcc8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_name.c @@ -0,0 +1,193 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_NAME_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_name_l.h" + +void +nxo_name_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_str, + cw_uint32_t a_len, cw_bool_t a_is_static) +{ + cw_nxoe_name_t *name, key; +#ifdef CW_THREADS + cw_mtx_t *name_lock; +#endif + cw_dch_t *name_hash; + cw_nxa_t *nxa; + cw_bool_t do_register; + + /* Fake up a key so that we can search the hash tables. */ + key.str = a_str; + key.len = a_len; + +#ifdef CW_THREADS + name_lock = nx_l_name_lock_get(a_nx); +#endif + name_hash = nx_l_name_hash_get(a_nx); + + /* Look in the global hash for the name. If the name doesn't exist, create + * it. */ +#ifdef CW_THREADS + mtx_lock(name_lock); + thd_crit_enter(); +#endif + if (dch_search(name_hash, (void *) &key, (void **) &name)) + { + /* Not found in the name hash. Create, initialize, and insert a new + * entry. */ + nxa = nx_nxa_get(a_nx); + name = (cw_nxoe_name_t *) nxa_malloc(nxa, sizeof(cw_nxoe_name_t)); + + nxoe_l_new(&name->nxoe, NXOT_NAME, FALSE); + name->nxoe.name_static = a_is_static; + name->len = a_len; + + if (a_is_static == FALSE) + { + name->str = nxa_malloc(nxa, a_len); + /* Cast away the const here; it's one of two places that the string + * is allowed to be modified, and this cast is better than dropping + * the const altogether. */ + memcpy((cw_uint8_t *) name->str, a_str, a_len); + } + else + { + name->str = a_str; + } + + dch_insert(name_hash, (void *) name, (void **) name, + (cw_chi_t *) nxa_malloc(nx_nxa_get(a_nx), sizeof(cw_chi_t))); + + do_register = TRUE; + } + else + { + do_register = FALSE; + } + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) name; + nxo_p_type_set(a_nxo, NXOT_NAME); +#ifdef CW_THREADS + thd_crit_leave(); +#endif + + /* Registration must be done outside the critical region to avoid + * deadlock. */ + if (do_register) + { + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) name); + } + else + { + nxa_l_gc_reregister(nx_nxa_get(a_nx), (cw_nxoe_t *) name); + } + +#ifdef CW_THREADS + mtx_unlock(name_lock); +#endif +} + +/* Hash {name string, length}. */ +cw_uint32_t +nxo_l_name_hash(const void *a_key) +{ + cw_uint32_t retval, i; + cw_nxoe_name_t *key = (cw_nxoe_name_t *) a_key; + const cw_uint8_t *str; + + cw_check_ptr(a_key); + + for (i = 0, retval = 5381, str = key->str; i < key->len; i++, str++) + { + retval = ((retval << 5) + retval) + *str; + } + + return retval; +} + +/* Compare keys {name string, length}. */ +cw_bool_t +nxo_l_name_key_comp(const void *a_k1, const void *a_k2) +{ + cw_bool_t retval; + cw_nxoe_name_t *k1 = (cw_nxoe_name_t *) a_k1; + cw_nxoe_name_t *k2 = (cw_nxoe_name_t *) a_k2; + + cw_check_ptr(a_k1); + cw_check_ptr(a_k2); + + if (k1->len == k2->len) + { + if (strncmp((char *) k1->str, (char *) k2->str, k1->len) == 0) + { + retval = TRUE; + } + else + { + retval = FALSE; + } + } + else + { + retval = FALSE; + + } + + return retval; +} + +const cw_uint8_t * +nxo_name_str_get(const cw_nxo_t *a_nxo) +{ + const cw_uint8_t *retval; + cw_nxoe_name_t *name; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_NAME); + + name = (cw_nxoe_name_t *) a_nxo->o.nxoe; + + cw_check_ptr(name); + cw_dassert(name->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(name->nxoe.type == NXOT_NAME); + + retval = name->str; + + return retval; +} + +cw_uint32_t +nxo_name_len_get(const cw_nxo_t *a_nxo) +{ + cw_uint32_t retval; + cw_nxoe_name_t *name; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_NAME); + + name = (cw_nxoe_name_t *) a_nxo->o.nxoe; + + cw_check_ptr(name); + cw_dassert(name->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(name->nxoe.type == NXOT_NAME); + + retval = name->len; + + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_null.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_null.c new file mode 100644 index 000000000..4e69c5bf4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_null.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_NULL_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_operator.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_operator.c new file mode 100644 index 000000000..04fc7334f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_operator.c @@ -0,0 +1,31 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_OPERATOR_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxo_l.h" + +#define nxo_p_operator_nxn_set(a_nxo, a_nxn) \ + do \ + { \ + (a_nxo)->flags = ((a_nxo)->flags & 0xfffc00ff) | \ + ((a_nxn) << 8); \ + } while (0) + +void +nxo_operator_new(cw_nxo_t *a_nxo, cw_op_t *a_op, cw_nxn_t a_nxn) +{ + nxo_p_new(a_nxo, NXOT_OPERATOR); + a_nxo->o.oper.f = a_op; + nxo_p_operator_nxn_set(a_nxo, a_nxn); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_pmark.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_pmark.c new file mode 100644 index 000000000..a51f295fd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_pmark.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_PMARK_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_real.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_real.c new file mode 100644 index 000000000..536f90c9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_real.c @@ -0,0 +1,15 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_REAL_C_ + +#include "../include/libonyx/libonyx.h" diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_regex.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_regex.c new file mode 100644 index 000000000..585964901 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_regex.c @@ -0,0 +1,573 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + ******************************************************************************/ + +#define CW_NXO_REGEX_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_regex_l.h" +#include "../include/libonyx/nxo_thread_l.h" + +/* Do the work of initializing a regex, but don't do any of the typical + * GC-related initialization, so that this function can be used for the case + * where a regex is temporarily constructed for a single match. */ +static cw_nxn_t +nxo_p_regex_init(cw_nxoe_regex_t *a_regex, cw_nxa_t *a_nxa, + const cw_uint8_t *a_pattern, cw_uint32_t a_len, + cw_bool_t a_cont, cw_bool_t a_global, cw_bool_t a_insensitive, + cw_bool_t a_multiline, cw_bool_t a_singleline) +{ + cw_nxn_t retval; + char *pattern; + const char *errptr; + int options, erroffset, capturecount; + + nxoe_l_new(&a_regex->nxoe, NXOT_REGEX, FALSE); + + /* Create a '\0'-terminated copy of a_pattern. */ + pattern = (char *) nxa_malloc(a_nxa, a_len + 1); + memcpy(pattern, a_pattern, a_len); + pattern[a_len] = '\0'; + + /* Translate options to a format usable by pcre_compile(). */ + options = 0; + /* $i. */ + if (a_insensitive) + { + options |= PCRE_CASELESS; + } + /* $m. */ + if (a_multiline) + { + options |= PCRE_MULTILINE; + } + /* $s. */ + if (a_singleline) + { + options |= PCRE_DOTALL; + } + + /* Store the cont and global flags. This information is not needed in this + * function, but gets used when actually doing matches. */ + a_regex->cont = a_cont; + a_regex->global = a_global; + + /* Compile the regex. */ + a_regex->pcre = pcre_compile(pattern, options, &errptr, &erroffset, NULL); + nxa_free(a_nxa, pattern, a_len + 1); + if (a_regex->pcre == NULL) + { + retval = NXN_regexerror; + goto RETURN; + } + + /* Call pcre_study(), which may improve matching performance. */ + a_regex->extra = pcre_study(a_regex->pcre, 0, &errptr); + if (errptr != NULL) + { + free(a_regex->pcre); + retval = NXN_regexerror; + goto RETURN; + } + + /* Get capturecount and the amount of space that was allocated for + * a_regex->pcre and a_regex->extra. */ + if ((pcre_fullinfo(a_regex->pcre, a_regex->extra, PCRE_INFO_CAPTURECOUNT, + &capturecount) != 0) + || (pcre_fullinfo(a_regex->pcre, a_regex->extra, PCRE_INFO_SIZE, + &a_regex->size) != 0) +#ifdef PCRE_INFO_EXTRASIZE + || (pcre_fullinfo(a_regex->pcre, a_regex->extra, PCRE_INFO_EXTRASIZE, + &a_regex->extrasize) != 0) +#endif + ) + { + free(a_regex->pcre); + if (a_regex->extra != NULL) + { + free(a_regex->extra); + } + retval = NXN_regexerror; + goto RETURN; + } + + /* Use capturecount to calculate the size of vector needed for pcre_exec() + * calls. */ + a_regex->ovcnt = (capturecount + 1) * 3; + + retval = NXN_ZERO; + RETURN: + return retval; +} + +/* Returns TRUE if match is successful. */ +static cw_bool_t +nxo_p_regex_match(cw_nxoe_regex_t *a_regex, cw_nxo_t *a_thread, + cw_nxo_t *a_input) +{ + cw_bool_t retval; + cw_nxo_regex_cache_t *cache; + cw_nx_t *nx; + cw_nxa_t *nxa; + int ioff; + + cache = nxo_l_thread_regex_cache_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + + if (nxo_string_len_get(a_input) == 0) + { + cache->mcnt = -1; + retval = FALSE; + goto RETURN; + } + + /* Allocate or extend the vector for passing to pcre_exec(), if + * necessary. */ + if (cache->ovp == NULL) + { + cache->ovp = nxa_malloc(nxa, sizeof(int) * a_regex->ovcnt); + cache->ovcnt = a_regex->ovcnt; + } + else if (cache->ovcnt < a_regex->ovcnt) + { + cache->ovp = nxa_realloc(nxa, cache->ovp, sizeof(int) * a_regex->ovcnt, + sizeof(int) * cache->ovcnt); + cache->ovcnt = a_regex->ovcnt; + } + + /* Determine where in the string to start searching. This depends on + * whether $c or $g is set, as well as whether the previous match was + * against the same string. */ + if (a_regex->cont || a_regex->global) + { + if (nxo_type_get(&cache->input) == NXOT_STRING + && nxo_compare(&cache->input, a_input) == 0) + { + ioff = cache->cont; + if ((cw_uint32_t) ioff >= nxo_string_len_get(a_input)) + { + cache->mcnt = -1; + retval = FALSE; + goto NOMATCH; + } + } + else + { + ioff = 0; + } + } + else + { + ioff = 0; + } + + /* Look for a match. */ + nxo_string_lock(a_input); + cache->mcnt = pcre_exec(a_regex->pcre, a_regex->extra, + (char *) nxo_string_get(a_input), + (int) nxo_string_len_get(a_input), + ioff, 0, cache->ovp, cache->ovcnt); + nxo_string_unlock(a_input); + if (cache->mcnt <= 0) + { + switch (cache->mcnt) + { + case 0: + case PCRE_ERROR_NOMATCH: + { + /* No match found. Not an error. */ + retval = FALSE; + break; + } + case PCRE_ERROR_NOMEMORY: + { + xep_throw(CW_ONYXX_OOM); + } + case PCRE_ERROR_NULL: + case PCRE_ERROR_BADOPTION: + case PCRE_ERROR_BADMAGIC: + case PCRE_ERROR_UNKNOWN_NODE: + default: + { + cw_not_reached(); + } + } + } + else + { + retval = TRUE; + } + + NOMATCH: + /* Store the location to start the next search from, if $c or $g is set. + * Also set the cached input string accordingly. */ + if (a_regex->cont) + { + if (cache->mcnt > 0) + { + nxo_dup(&cache->input, a_input); + cache->cont = cache->ovp[1]; + } + } + else if (a_regex->global) + { + if (cache->mcnt > 0) + { + nxo_dup(&cache->input, a_input); + cache->cont = cache->ovp[1]; + } + else + { + nxo_no_new(&cache->input); + cache->cont = 0; + } + } + else + { + if (cache->mcnt > 0) + { + nxo_dup(&cache->input, a_input); + } + else + { + nxo_no_new(&cache->input); + } + } + + RETURN: + return retval; +} + +static void +nxo_p_regex_split(cw_nxoe_regex_t *a_regex, cw_nxo_t *a_thread, + cw_uint32_t a_limit, cw_nxo_t *a_input, cw_nxo_t *r_array) +{ + cw_nxo_regex_cache_t *cache; + cw_nxo_t *tstack, *tnxo; + cw_nx_t *nx; + cw_nxa_t *nxa; + cw_uint8_t *istr; + int ilen, ioff; + cw_uint32_t i, acnt; + + cache = nxo_l_thread_regex_cache_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + + istr = nxo_string_get(a_input); + ilen = (int) nxo_string_len_get(a_input); + if (ilen == 0) + { + cache->mcnt = -1; + acnt = 0; + goto NOMATCH; + } + + /* Allocate or extend the vector for passing to pcre_exec(), if + * necessary. */ + if (cache->ovp == NULL) + { + cache->ovp = nxa_malloc(nxa, sizeof(int) * a_regex->ovcnt); + cache->ovcnt = a_regex->ovcnt; + } + else if (cache->ovcnt < a_regex->ovcnt) + { + cache->ovp = nxa_realloc(nxa, cache->ovp, sizeof(int) * a_regex->ovcnt, + sizeof(int) * cache->ovcnt); + cache->ovcnt = a_regex->ovcnt; + } + + /* Iteratively search for matches with the splitting pattern and create + * substrings until there is no more text, or the split limit has been + * reached. */ + for (acnt = ioff = 0; + ioff < ilen && (acnt + 1 < a_limit || a_limit == 0); + ) + { + /* Look for a match. */ + nxo_string_lock(a_input); + cache->mcnt = pcre_exec(a_regex->pcre, a_regex->extra, + (char *) istr, ilen, ioff, 0, + cache->ovp, cache->ovcnt); + nxo_string_unlock(a_input); + if (cache->mcnt <= 0) + { + switch (cache->mcnt) + { + case 0: + case PCRE_ERROR_NOMATCH: + { + /* No match found. Not an error. */ + goto DONE; + } + case PCRE_ERROR_NOMEMORY: + { + xep_throw(CW_ONYXX_OOM); + } + case PCRE_ERROR_NULL: + case PCRE_ERROR_BADOPTION: + case PCRE_ERROR_BADMAGIC: + case PCRE_ERROR_UNKNOWN_NODE: + default: + { + cw_not_reached(); + } + } + } + + /* Create a substring of the text that falls between the previous match + * and this match. */ + tnxo = nxo_stack_push(tstack); + if (cache->ovp[0] < cache->ovp[1]) + { + /* Create a substring (normal case). */ + nxo_string_substring_new(tnxo, a_input, nx, ioff, + cache->ovp[0] - ioff); + ioff = cache->ovp[1]; + } + else + { + /* The pattern matches the empty string, so split a single character + * to avoid an infinite loop. */ + nxo_string_substring_new(tnxo, a_input, nx, ioff, 1); + ioff++; + } + acnt++; + + /* If there were capturing subpatterns that matched, create substrings + * of them. If there are interspersed subpatterns that did not match, + * create null objects for them. */ + if (cache->mcnt > 1) + { + for (i = 1; i < cache->mcnt; i++) + { + tnxo = nxo_stack_push(tstack); + nxo_string_substring_new(tnxo, a_input, nx, + cache->ovp[i * 2], + cache->ovp[i * 2 + 1] + - cache->ovp[i * 2]); + acnt++; + } + } + } + DONE: + /* If there are trailing bytes after the last match, create a substring and + * push it onto tstack. */ + if (ioff < ilen) + { + tnxo = nxo_stack_push(tstack); + nxo_string_substring_new(tnxo, a_input, nx, ioff, + nxo_string_len_get(a_input) + - (cw_uint32_t) ioff); + acnt++; + } + + NOMATCH: + /* Create an array that contains the substrings on tstack. */ + nxo_array_new(r_array, nx, nxo_thread_currentlocking(a_thread), acnt); + + /* Dup the substrings into r_matches. */ + for (i = 0, tnxo = nxo_stack_get(tstack); + i < acnt; + i++, tnxo = nxo_stack_down_get(tstack, tnxo)) + { + nxo_array_el_set(r_array, tnxo, acnt - 1 - i); + } + + /* Clean up tstack. */ + nxo_stack_npop(tstack, acnt); +} + +cw_nxn_t +nxo_regex_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_pattern, + cw_uint32_t a_len, cw_bool_t a_cont, cw_bool_t a_global, + cw_bool_t a_insensitive, cw_bool_t a_multiline, + cw_bool_t a_singleline) +{ + cw_nxn_t retval; + cw_nxoe_regex_t *regex; + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + + regex = (cw_nxoe_regex_t *) nxa_malloc(nxa, sizeof(cw_nxoe_regex_t)); + + retval = nxo_p_regex_init(regex, nxa, a_pattern, a_len, a_cont, a_global, + a_insensitive, a_multiline, a_singleline); + if (retval) + { + nxa_free(nxa, regex, sizeof(cw_nxoe_regex_t)); + goto RETURN; + } + + /* Tell the GC about the space being taken up by regex->pcre and + * regex->extra. */ + nxa_l_count_adjust(nxa, (cw_nxoi_t) regex->size +#ifdef PCRE_INFO_EXTRASIZE + + regex->extrasize +#endif + ); + + /* Create a reference to the regex object. */ + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) regex; + nxo_p_type_set(a_nxo, NXOT_REGEX); + + /* Register the regex object with the GC. */ + nxa_l_gc_register(nxa, (cw_nxoe_t *) regex); + + retval = NXN_ZERO; + RETURN: + return retval; +} + +void +nxo_regex_match(cw_nxo_t *a_nxo, cw_nxo_t *a_thread, cw_nxo_t *a_input, + cw_bool_t *r_match) +{ + cw_nxoe_regex_t *regex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_REGEX); + + regex = (cw_nxoe_regex_t *) a_nxo->o.nxoe; + + cw_check_ptr(regex); + cw_dassert(regex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(regex->nxoe.type == NXOT_REGEX); + + *r_match = nxo_p_regex_match(regex, a_thread, a_input); +} + +/* Do a match without creating a regex object, in order to avoid putting + * pressure on the GC. */ +cw_nxn_t +nxo_regex_nonew_match(cw_nxo_t *a_thread, const cw_uint8_t *a_pattern, + cw_uint32_t a_len, cw_bool_t a_cont, cw_bool_t a_global, + cw_bool_t a_insensitive, cw_bool_t a_multiline, + cw_bool_t a_singleline, cw_nxo_t *a_input, + cw_bool_t *r_match) +{ + cw_nxn_t retval; + cw_nxoe_regex_t regex; + cw_nx_t *nx; + cw_nxa_t *nxa; + + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + + retval = nxo_p_regex_init(®ex, nxa, a_pattern, a_len, a_cont, a_global, + a_insensitive, a_multiline, a_singleline); + if (retval) + { + goto RETURN; + } + + *r_match = nxo_p_regex_match(®ex, a_thread, a_input); + + /* Clean up memory. */ + free(regex.pcre); + if (regex.extra != NULL) + { + free(regex.extra); + } + + retval = NXN_ZERO; + RETURN: + return retval; +} + +void +nxo_regex_split(cw_nxo_t *a_nxo, cw_nxo_t *a_thread, cw_uint32_t a_limit, + cw_nxo_t *a_input, cw_nxo_t *r_array) +{ + cw_nxoe_regex_t *regex; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_REGEX); + + regex = (cw_nxoe_regex_t *) a_nxo->o.nxoe; + + cw_check_ptr(regex); + cw_dassert(regex->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(regex->nxoe.type == NXOT_REGEX); + + nxo_p_regex_split(regex, a_thread, a_limit, a_input, r_array); +} + +/* Do a split without creating a regex object, in order to avoid putting + * pressure on the GC. */ +cw_nxn_t +nxo_regex_nonew_split(cw_nxo_t *a_thread, const cw_uint8_t *a_pattern, + cw_uint32_t a_len, cw_bool_t a_insensitive, + cw_bool_t a_multiline, cw_bool_t a_singleline, + cw_uint32_t a_limit, cw_nxo_t *a_input, cw_nxo_t *r_array) +{ + cw_nxn_t retval; + cw_nxoe_regex_t regex; + cw_nx_t *nx; + cw_nxa_t *nxa; + + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + + retval = nxo_p_regex_init(®ex, nxa, a_pattern, a_len, FALSE, FALSE, + a_insensitive, a_multiline, a_singleline); + if (retval) + { + goto RETURN; + } + + nxo_p_regex_split(®ex, a_thread, a_limit, a_input, r_array); + + /* Clean up memory. */ + free(regex.pcre); + if (regex.extra != NULL) + { + free(regex.extra); + } + + retval = NXN_ZERO; + RETURN: + return retval; +} + +void +nxo_regex_submatch(cw_nxo_t *a_thread, cw_uint32_t a_capture, cw_nxo_t *r_match) +{ + cw_nxo_regex_cache_t *cache; + + cache = nxo_l_thread_regex_cache_get(a_thread); + + if ((int) a_capture < cache->mcnt + && nxo_type_get(&cache->input) == NXOT_STRING + && cache->ovp[a_capture * 2] != -1) + { + /* Create a substring for the capturing subpattern. */ + nxo_string_substring_new(r_match, &cache->input, + nxo_thread_nx_get(a_thread), + cache->ovp[a_capture * 2], + cache->ovp[a_capture * 2 + 1] + - cache->ovp[a_capture * 2]); + } + else + { + /* This subpattern wasn't matched (possible when the capture is for an + * alternative). */ + nxo_null_new(r_match); + } +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_regsub.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_regsub.c new file mode 100644 index 000000000..f9b40ae2b --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_regsub.c @@ -0,0 +1,580 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + ******************************************************************************/ + +#define CW_NXO_REGSUB_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_regex_l.h" +#include "../include/libonyx/nxo_regsub_l.h" +#include "../include/libonyx/nxo_thread_l.h" + +/* Do the work of initializing a regsub, but don't do any of the typical + * GC-related initialization, so that this function can be used for the case + * where a regsub is temporarily constructed for a single subst. */ +static cw_nxn_t +nxo_p_regsub_init(cw_nxoe_regsub_t *a_regsub, cw_nxa_t *a_nxa, + const cw_uint8_t *a_pattern, cw_uint32_t a_plen, + cw_bool_t a_global, cw_bool_t a_insensitive, + cw_bool_t a_multiline, cw_bool_t a_singleline, + const cw_uint8_t *a_template, cw_uint32_t a_tlen) +{ + cw_nxn_t retval; + char *pattern; + const char *errptr; + int options, erroffset, capturecount; + enum + { + TSTATE_START, + TSTATE_BS_CONT + } tstate; + cw_uint32_t i, beg, end, voff; + + nxoe_l_new(&a_regsub->nxoe, NXOT_REGSUB, FALSE); + + /* Create a '\0'-terminated copy of a_pattern. */ + pattern = (char *) nxa_malloc(a_nxa, a_plen + 1); + memcpy(pattern, a_pattern, a_plen); + pattern[a_plen] = '\0'; + + /* Translate options to a format usable by pcre_compile(). */ + options = 0; + /* $i. */ + if (a_insensitive) + { + options |= PCRE_CASELESS; + } + /* $m. */ + if (a_multiline) + { + options |= PCRE_MULTILINE; + } + /* $s. */ + if (a_singleline) + { + options |= PCRE_DOTALL; + } + + /* Store the global flag. This information is not needed in this function, + * but gets used when actually doing substitutions. */ + a_regsub->global = a_global; + + /* Compile the regex. */ + a_regsub->pcre = pcre_compile(pattern, options, &errptr, &erroffset, NULL); + nxa_free(a_nxa, pattern, a_plen + 1); + if (a_regsub->pcre == NULL) + { + retval = NXN_regexerror; + goto RETURN; + } + + /* Call pcre_study(), which may improve matching performance. */ + a_regsub->extra = pcre_study(a_regsub->pcre, 0, &errptr); + if (errptr != NULL) + { + free(a_regsub->pcre); + retval = NXN_regexerror; + goto RETURN; + } + + /* Get capturecount and the amount of space that was allocated for + * a_regsub->pcre and a_regsub->extra. */ + if ((pcre_fullinfo(a_regsub->pcre, a_regsub->extra, PCRE_INFO_CAPTURECOUNT, + &capturecount) != 0) + || (pcre_fullinfo(a_regsub->pcre, a_regsub->extra, PCRE_INFO_SIZE, + &a_regsub->size) != 0) +#ifdef PCRE_INFO_EXTRASIZE + || (pcre_fullinfo(a_regsub->pcre, a_regsub->extra, PCRE_INFO_EXTRASIZE, + &a_regsub->extrasize) != 0) +#endif + ) + { + free(a_regsub->pcre); + if (a_regsub->extra != NULL) + { + free(a_regsub->extra); + } + retval = NXN_regexerror; + goto RETURN; + } + + /* Use capturecount to calculate the size of vector needed for pcre_exec() + * calls. */ + a_regsub->ovcnt = (capturecount + 1) * 3; + + /* Make a copy of a_template. */ + if (a_tlen > 0) + { + a_regsub->template = (cw_uint8_t *) nxa_malloc(a_nxa, a_tlen); + memcpy(a_regsub->template, a_template, a_tlen); + } + else + { + a_regsub->template = NULL; + } + a_regsub->tlen = a_tlen; + + /* Parse a_template and construct a vector from it. Do this in two passes, + * since having to reallocate is likely to be more expensive than parsing + * twice. */ + for (i = beg = end = a_regsub->vlen = 0, tstate = TSTATE_START; + i < a_tlen; + i++) + { + switch (tstate) + { + case TSTATE_START: + { + switch (a_regsub->template[i]) + { + case '\\': + { + end = i; + tstate = TSTATE_BS_CONT; + break; + } + default: + { + break; + } + } + break; + } + case TSTATE_BS_CONT: + { + switch (a_regsub->template[i]) + { + case '1': case '2': case '3': case '4': case '5': case '6': + case '7': case '8': case '9': + { + /* Preceding plain text, if any. */ + if (end > beg) + { + a_regsub->vlen++; + } + + /* Subpattern substitution. */ + a_regsub->vlen++; + beg = end = i + 1; + tstate = TSTATE_START; + break; + } + case '\\': + { + /* Stay in this state (ignore extra leading '\' + * characters. */ + end = i; + break; + } + default: + { + /* Ignore. */ + tstate = TSTATE_START; + break; + } + } + break; + } + default: + { + cw_not_reached(); + } + } + } + if (beg < i) + { + /* Normal characters after last subpattern substitution. */ + a_regsub->vlen++; + } + + /* Initialize the vector, now that we know how big to make it. */ + if (a_regsub->vlen > 0) + { + a_regsub->vec + = (cw_nxoe_regsub_telm_t *) nxa_malloc(a_nxa, + sizeof(cw_nxoe_regsub_telm_t) + * a_regsub->vlen); + } + else + { + a_regsub->vec = NULL; + } + + for (i = beg = end = voff = 0, tstate = TSTATE_START; + i < a_tlen; + i++) + { + switch (tstate) + { + case TSTATE_START: + { + switch (a_regsub->template[i]) + { + case '\\': + { + end = i; + tstate = TSTATE_BS_CONT; + break; + } + default: + { + break; + } + } + break; + } + case TSTATE_BS_CONT: + { + switch (a_regsub->template[i]) + { + case '1': case '2': case '3': case '4': case '5': case '6': + case '7': case '8': case '9': + { + /* Preceding plain text, if any. */ + if (end > beg) + { + a_regsub->vec[voff].str = &a_regsub->template[beg]; + a_regsub->vec[voff].len = end - beg; + voff++; + } + + /* Subpattern substitution. */ + a_regsub->vec[voff].str = NULL; + a_regsub->vec[voff].len + = (cw_uint32_t) (a_regsub->template[i] - '0'); + voff++; + beg = end = i + 1; + tstate = TSTATE_START; + break; + } + case '\\': + { + /* Stay in this state (ignore extra leading '\' + * characters. */ + end = i; + break; + } + default: + { + /* Ignore. */ + tstate = TSTATE_START; + break; + } + } + break; + } + default: + { + cw_not_reached(); + } + } + } + if (beg < i) + { + /* Normal characters after last subpattern substitution. */ + a_regsub->vec[voff].str = &a_regsub->template[beg]; + a_regsub->vec[voff].len = i - beg; +#ifdef CW_DBG + /* Make following assertion possible. */ + voff++; +#endif + } + cw_assert(voff == a_regsub->vlen); + + retval = NXN_ZERO; + RETURN: + return retval; +} + +CW_P_INLINE void +nxo_p_regsub_append(cw_uint8_t **r_ostr, cw_uint32_t *r_omax, + cw_uint32_t *r_olen, const cw_uint8_t *a_istr, + cw_uint32_t a_ilen, cw_nxa_t *a_nxa) +{ + cw_uint32_t omax; + + /* Expand *r_ostr, if necessary. */ + for (omax = *r_omax; *r_olen + a_ilen > omax; omax *= 2) + { + /* Do nothing. */ + } + if (omax != *r_omax) + { + *r_ostr = nxa_realloc(a_nxa, *r_ostr, omax, *r_omax); + *r_omax = omax; + } + + /* Copy and adjust *r_olen. */ + memcpy(&(*r_ostr)[*r_olen], a_istr, a_ilen); + *r_olen += a_ilen; +} + +static cw_uint32_t +nxo_p_regsub_subst(cw_nxoe_regsub_t *a_regsub, cw_nxo_t *a_thread, + cw_nxo_t *a_input, cw_nxo_t *r_output) +{ + cw_bool_t retval = 0; + cw_nxo_regex_cache_t *cache; + cw_nx_t *nx; + cw_nxa_t *nxa; + cw_uint32_t scnt, ilen, ioff, olen, omax, v; + cw_uint8_t *istr, *ostr; + + cache = nxo_l_thread_regex_cache_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + + /* Allocate or extend the vector for passing to pcre_exec(), if + * necessary. */ + if (cache->ovp == NULL) + { + cache->ovp = nxa_malloc(nxa, sizeof(int) * a_regsub->ovcnt); + cache->ovcnt = a_regsub->ovcnt; + } + else if (cache->ovcnt < a_regsub->ovcnt) + { + cache->ovp = nxa_realloc(nxa, cache->ovp, sizeof(int) * a_regsub->ovcnt, + sizeof(int) * cache->ovcnt); + cache->ovcnt = a_regsub->ovcnt; + } + + /* Allocate a temporary output string that is as large as the input string. + * If ostr overflows, iteratively double its size. omax tracks the current + * allocation size of ostr, and olen tracks how full ostr is. */ + ilen = omax = nxo_string_len_get(a_input); + olen = 0; + if (omax == 0) + { + /* It is possible for a pattern to match the empty string, then + * substitute a non-empty string. Therefore, handle the empty input + * string case. */ + omax = 8; + } + istr = nxo_string_get(a_input); + ostr = nxa_malloc(nxa, omax); + + /* Iteratively look for matches. */ + for (scnt = ioff = 0; + ioff < ilen && (a_regsub->global || scnt < 1); + scnt++, ioff = (cw_uint32_t) cache->ovp[1]) + { + /* Look for a match. */ + nxo_string_lock(a_input); + cache->mcnt = pcre_exec(a_regsub->pcre, a_regsub->extra, (char *) istr, + ilen, ioff, 0, cache->ovp, cache->ovcnt); + nxo_string_unlock(a_input); + if (cache->mcnt <= 0) + { + switch (cache->mcnt) + { + case 0: + case PCRE_ERROR_NOMATCH: + { + /* No match found. Not an error. */ + goto DONE; + } + case PCRE_ERROR_NOMEMORY: + { + xep_throw(CW_ONYXX_OOM); + } + case PCRE_ERROR_NULL: + case PCRE_ERROR_BADOPTION: + case PCRE_ERROR_BADMAGIC: + case PCRE_ERROR_UNKNOWN_NODE: + default: + { + cw_not_reached(); + } + } + } + + /* Copy any data between the end of the previous substitution and the + * beginning of the current substitution. */ + if (ioff < (cw_uint32_t) cache->ovp[0]) + { + nxo_p_regsub_append(&ostr, &omax, &olen, + &istr[ioff], + (cw_uint32_t) cache->ovp[0] - ioff, nxa); + } + + /* Substitute. */ + for (v = 0; v < a_regsub->vlen; v++) + { + if (a_regsub->vec[v].str != NULL) + { + /* Copy from template string. */ + nxo_p_regsub_append(&ostr, &omax, &olen, a_regsub->vec[v].str, + a_regsub->vec[v].len, nxa); + } + else + { + /* Substitute subpattern match, if the subpattern was + * matched. */ + if (a_regsub->vec[v].len < cache->mcnt + && cache->ovp[a_regsub->vec[v].len * 2] != -1) + { + + nxo_p_regsub_append(&ostr, &omax, &olen, + &istr + [cache->ovp[a_regsub->vec[v].len * 2]], + cache->ovp[a_regsub->vec[v].len * 2 + 1] + - cache->ovp[a_regsub->vec[v].len * 2], + nxa); + } + } + } + + /* Increment substitution count. */ + retval++; + } + DONE: + /* If there are trailing bytes after the last match, copy them. */ + if (ioff < ilen) + { + nxo_p_regsub_append(&ostr, &omax, &olen, &istr[ioff], ilen - ioff, nxa); + } + + /* Create an Onyx string and copy ostr to it. */ + if (retval > 0) + { + nxo_string_new(r_output, nx, nxo_thread_currentlocking(a_thread), olen); + if (olen > 0) + { + nxo_string_set(r_output, 0, ostr, olen); + } + } + else + { + /* No substitution done. Dup the input string. */ + nxo_dup(r_output, a_input); + } + + /* Clean up. */ + nxa_free(nxa, ostr, omax); + + return retval; +} + +cw_nxn_t +nxo_regsub_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_pattern, + cw_uint32_t a_plen, cw_bool_t a_global, cw_bool_t a_insensitive, + cw_bool_t a_multiline, cw_bool_t a_singleline, + const cw_uint8_t *a_template, cw_uint32_t a_tlen) +{ + cw_nxn_t retval; + cw_nxoe_regsub_t *regsub; + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + + regsub = (cw_nxoe_regsub_t *) nxa_malloc(nxa, sizeof(cw_nxoe_regsub_t)); + + retval = nxo_p_regsub_init(regsub, nxa, a_pattern, a_plen, a_global, + a_insensitive, a_multiline, a_singleline, + a_template, a_tlen); + if (retval) + { + nxa_free(nxa, regsub, sizeof(cw_nxoe_regsub_t)); + goto RETURN; + } + + /* Tell the GC about the space being taken up by regsub->pcre and + * regsub->extra. */ + nxa_l_count_adjust(nxa, (cw_nxoi_t) regsub->size +#ifdef PCRE_INFO_EXTRASIZE + + regsub->extrasize +#endif + ); + + /* Create a reference to the regsub object. */ + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) regsub; + nxo_p_type_set(a_nxo, NXOT_REGSUB); + + /* Register the regsub object with the GC. */ + nxa_l_gc_register(nxa, (cw_nxoe_t *) regsub); + + retval = NXN_ZERO; + RETURN: + return retval; +} + +void +nxo_regsub_subst(cw_nxo_t *a_nxo, cw_nxo_t *a_thread, cw_nxo_t *a_input, + cw_nxo_t *r_output, cw_uint32_t *r_count) +{ + cw_nxoe_regsub_t *regsub; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_REGSUB); + + regsub = (cw_nxoe_regsub_t *) a_nxo->o.nxoe; + + cw_check_ptr(regsub); + cw_dassert(regsub->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(regsub->nxoe.type == NXOT_REGSUB); + + *r_count = nxo_p_regsub_subst(regsub, a_thread, a_input, r_output); +} + +/* Do a subst without creating a regsub object, in order to avoid putting + * pressure on the GC. */ +cw_nxn_t +nxo_regsub_nonew_subst(cw_nxo_t *a_thread, const cw_uint8_t *a_pattern, + cw_uint32_t a_plen, cw_bool_t a_global, + cw_bool_t a_insensitive, cw_bool_t a_multiline, + cw_bool_t a_singleline, const cw_uint8_t *a_template, + cw_uint32_t a_tlen, cw_nxo_t *a_input, + cw_nxo_t *r_output, cw_uint32_t *r_count) +{ + cw_nxn_t retval; + cw_nxoe_regsub_t regsub; + cw_nx_t *nx; + cw_nxa_t *nxa; + + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + + retval = nxo_p_regsub_init(®sub, nxa, a_pattern, a_plen, a_global, + a_insensitive, a_multiline, a_singleline, + a_template, a_tlen); + if (retval) + { + goto RETURN; + } + + *r_count = nxo_p_regsub_subst(®sub, a_thread, a_input, r_output); + + /* Clean up memory. */ + + if (regsub.vec != NULL) + { + nxa_free(nxa, regsub.vec, sizeof(cw_nxoe_regsub_telm_t) * regsub.vlen); + } + + if (regsub.template != NULL) + { + nxa_free(nxa, regsub.template, regsub.tlen); + } + + free(regsub.pcre); + if (regsub.extra != NULL) + { + free(regsub.extra); + } + + retval = NXN_ZERO; + RETURN: + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_stack.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_stack.c new file mode 100644 index 000000000..0d355ea16 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_stack.c @@ -0,0 +1,293 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Stack object space is allocated on a per-element basis, and a certain number + * of elements are cached to avoid allocation/deallocation overhead in the + * common case. Doing chunked allocation of stack elements would be slightly + * more memory efficient (and probably more cache friendly) in the common case, + * but would require extra code complexity in the critical paths of pushing and + * popping. + * + * By keeping the re-allocation algorithm simple, we are able to make common + * stack operations very fast. + * + * Using a ring makes it relatively efficient (if not simple for the reference + * iterator) to make all the stack operations GC-safe. + * + ******************************************************************************/ + +/* Compile non-inlined functions if not using inlines. */ +#define CW_NXO_STACK_C_ + +#include "../include/libonyx/libonyx.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_stack_l.h" + +void +nxo_stack_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking) +{ + cw_nxoe_stack_t *stack; + + stack = (cw_nxoe_stack_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_stack_t)); + + nxoe_l_new(&stack->nxoe, NXOT_STACK, a_locking); +#ifdef CW_THREADS + if (a_locking) + { + mtx_new(&stack->lock); + } +#endif + + stack->nxa = nx_nxa_get(a_nx); + ql_new(&stack->stack); + + stack->count = 0; + stack->nspare = 0; + + ql_elm_new(&stack->under, link); + ql_head_insert(&stack->stack, &stack->under, link); + +#ifdef CW_THREADS + stack->below = NULL; +#endif + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) stack; + nxo_p_type_set(a_nxo, NXOT_STACK); + + nxa_l_gc_register(stack->nxa, (cw_nxoe_t *) stack); +} + +void +nxo_stack_copy(cw_nxo_t *a_to, cw_nxo_t *a_from) +{ + cw_nxo_t *nxo_to, *nxo_fr; + cw_uint32_t i, count; + + cw_check_ptr(a_to); + cw_dassert(a_to->magic == CW_NXO_MAGIC); + + cw_check_ptr(a_from); + cw_dassert(a_from->magic == CW_NXO_MAGIC); + + for (i = 0, count = nxo_stack_count(a_from), nxo_fr = NULL, nxo_to = NULL; + i < count; + i++) + { + nxo_fr = nxo_stack_down_get(a_from, nxo_fr); + nxo_to = nxo_stack_under_push(a_to, nxo_to); + nxo_dup(nxo_to, nxo_fr); + } +} + +/* This function handles a special case for nxo_stack_push(), but is done as a + * separate function to keep nxo_stack_push() small. */ +cw_nxoe_stacko_t * +nxoe_p_stack_push(cw_nxoe_stack_t *a_stack) +{ + cw_nxoe_stacko_t *retval; + + /* No spares. Allocate and insert one. */ + retval = (cw_nxoe_stacko_t *) nxa_malloc(a_stack->nxa, + sizeof(cw_nxoe_stacko_t)); + qr_new(retval, link); + nxo_no_new(&retval->nxo); + qr_after_insert(&a_stack->under, retval, link); + + return retval; +} + +/* This function handles a special case for nxo_stack_bpush(), but is done as a + * separate function to keep nxo_stack_bpush() small. */ +cw_nxoe_stacko_t * +nxoe_p_stack_bpush(cw_nxoe_stack_t *a_stack) +{ + cw_nxoe_stacko_t *retval; + + /* No spares. Allocate and insert one. */ + retval = (cw_nxoe_stacko_t *) nxa_malloc(a_stack->nxa, + sizeof(cw_nxoe_stacko_t)); + qr_new(retval, link); + + return retval; +} + +/* This function handles a special case for nxo_stack_pop(), but is done as a + * separate function to keep nxo_stack_pop() small. */ +void +nxoe_p_stack_pop(cw_nxoe_stack_t *a_stack) +{ + cw_nxoe_stacko_t *stacko; + + cw_assert(a_stack->nspare == CW_LIBONYX_STACK_CACHE); + + /* Throw the popped element away. */ + stacko = ql_first(&a_stack->stack); + ql_first(&a_stack->stack) = qr_next(ql_first(&a_stack->stack), link); + qr_remove(stacko, link); + nxa_free(a_stack->nxa, stacko, sizeof(cw_nxoe_stacko_t)); +} + +/* This function handles a special case for nxo_stack_npop(), but is done as a + * separate function to keep nxo_stack_npop() small. */ +void +nxoe_p_stack_npop(cw_nxoe_stack_t *a_stack, cw_uint32_t a_count) +{ + cw_uint32_t i; + cw_nxoe_stacko_t *top, *stacko, *tstacko; +#ifdef CW_DBG + cw_nxoe_stacko_t *spare = ql_first(&a_stack->stack); + cw_uint32_t nspares; +#endif + + /* We need to discard some spares, so get a pointer to the beginning of the + * region to be removed from the ring. */ + for (i = 0, stacko = ql_first(&a_stack->stack); + i < CW_LIBONYX_STACK_CACHE - a_stack->nspare; + i++) + { + stacko = qr_next(stacko, link); + } +#ifdef CW_DBG + nspares = i; +#endif + for (top = stacko; i < a_count; i++) + { + top = qr_next(top, link); + } + + /* We now have: + * + * ql_first(&a_stack->stack) --> /----------\ \ + * | | | + * | | | + * | | | + * | | | + * | | | + * \----------/ \ a_count + * stacko --> /----------\ / \ + * | | | | + * | | | \ nspare + * | | | / + a_count + * | | | | - max cache + * | | | / + * \----------/ / + * top --> /----------\ + * | | + * | | + * | | + * | | + * | | + * \----------/ + * + * Remove the region from stacko (inclusive) down to top + * (exclusive), then deallocate those stacko's. */ + ql_first(&a_stack->stack) = top; + qr_split(stacko, top, cw_nxoe_stacko_t, link); + + for (i = 0; i < a_stack->nspare + a_count - CW_LIBONYX_STACK_CACHE; i++) + { + tstacko = qr_next(stacko, link); + qr_remove(tstacko, link); + nxa_free(a_stack->nxa, tstacko, sizeof(cw_nxoe_stacko_t)); + } + + a_stack->nspare = CW_LIBONYX_STACK_CACHE; + +#ifdef CW_DBG + for (i = 0; i < nspares; i++, spare = qr_next(spare, link)) + { + memset(&spare->nxo, 0x5a, sizeof(cw_nxo_t)); + } +#endif +} + +/* This function handles a special case for nxo_stack_nbpop(), but is done as a + * separate function to keep nxo_stack_nbpop() small. */ +void +nxoe_p_stack_nbpop(cw_nxoe_stack_t *a_stack, cw_uint32_t a_count) +{ + cw_uint32_t i; + cw_nxoe_stacko_t *bottom, *stacko, *tstacko; +#ifdef CW_DBG + cw_uint32_t nspares; +#endif + + /* We need to discard some spares, so get a pointer to the beginning of the + * region to be removed from the ring. */ + for (i = 0, stacko = &a_stack->under; + i < CW_LIBONYX_STACK_CACHE - a_stack->nspare; + i++) + { + stacko = qr_prev(stacko, link); + } +#ifdef CW_DBG + nspares = i; +#endif + for (bottom = stacko; i < a_count; i++) + { + bottom = qr_prev(bottom, link); + } + + /* We now have: + * + * ql_first(&a_stack->stack) --> /----------\ + * | | + * | | + * | | + * | | + * | | + * \----------/ + * bottom --> /----------\ \ + * | | | + * | | | + * | | | + * | | | + * | | | + * \----------/ \ a_count + * stacko --> /----------\ / \ + * | | | | + * | | | | + * | | | \ max cache - nspare + * | | | / + * | | | | + * \----------/ / / + * stack.under --> /----------\ + * | | + * : : + * : : + * + * 1) Split bottom/under. + * 2) Split bottom/stacko. + * 3) Meld first/stacko. + * 4) Deallocate the ring pointed to by bottom. */ + + qr_split(bottom, &a_stack->under, cw_nxoe_stacko_t, link); + qr_split(bottom, stacko, cw_nxoe_stacko_t, link); + qr_meld(ql_first(&a_stack->stack), stacko, cw_nxoe_stacko_t, link); + + for (i = 0; i < a_stack->nspare + a_count - CW_LIBONYX_STACK_CACHE; i++) + { + tstacko = qr_next(bottom, link); + qr_remove(tstacko, link); + nxa_free(a_stack->nxa, tstacko, sizeof(cw_nxoe_stacko_t)); + } + + a_stack->nspare = CW_LIBONYX_STACK_CACHE; + +#ifdef CW_DBG + for (i = 0; i < nspares; i++, stacko = qr_next(stacko, link)) + { + memset(&stacko->nxo, 0x5a, sizeof(cw_nxo_t)); + } +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_string.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_string.c new file mode 100644 index 000000000..a2706e0cf --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_string.c @@ -0,0 +1,418 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_STRING_C_ + +#include "../include/libonyx/libonyx.h" + +#include +#include + +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_string_l.h" + +#ifdef CW_THREADS +#define nxoe_p_string_lock(a_nxoe) \ + do \ + { \ + if ((a_nxoe)->nxoe.locking && !(a_nxoe)->nxoe.indirect) \ + { \ + mtx_lock(&(a_nxoe)->lock); \ + } \ + } while (0) +#define nxoe_p_string_unlock(a_nxoe) \ + do \ + { \ + if ((a_nxoe)->nxoe.locking && !(a_nxoe)->nxoe.indirect) \ + { \ + mtx_unlock(&(a_nxoe)->lock); \ + } \ + } while (0) +#endif + +void +nxo_string_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, + cw_uint32_t a_len) +{ + cw_nxoe_string_t *string; + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_nx); + string = (cw_nxoe_string_t *) nxa_malloc(nxa, sizeof(cw_nxoe_string_t)); + + nxoe_l_new(&string->nxoe, NXOT_STRING, a_locking); +#ifdef CW_THREADS + if (a_locking) + { + mtx_new(&string->lock); + } +#endif + string->e.s.len = a_len; + string->e.s.alloc_len = a_len; + if (string->e.s.len > 0) + { + string->e.s.str = (cw_uint8_t *) nxa_malloc(nxa, + string->e.s.alloc_len); + memset(string->e.s.str, 0, string->e.s.len); + } + else + { + string->e.s.str = NULL; + } + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) string; + nxo_p_type_set(a_nxo, NXOT_STRING); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) string); +} + +void +nxo_string_substring_new(cw_nxo_t *a_nxo, cw_nxo_t *a_string, cw_nx_t *a_nx, + cw_uint32_t a_offset, cw_uint32_t a_len) +{ + cw_nxoe_string_t *string, *orig; + + cw_check_ptr(a_nxo); + + orig = (cw_nxoe_string_t *) a_string->o.nxoe; + cw_check_ptr(orig); + cw_dassert(orig->nxoe.magic == CW_NXOE_MAGIC); + + string = (cw_nxoe_string_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_string_t)); + + nxoe_l_new(&string->nxoe, NXOT_STRING, FALSE); + string->nxoe.indirect = TRUE; + + if (orig->nxoe.indirect) + { + cw_assert(a_offset + a_len + orig->e.i.beg_offset + <= orig->e.i.string->e.s.len); + string->e.i.string = orig->e.i.string; + string->e.i.beg_offset = a_offset + orig->e.i.beg_offset; + } + else + { + cw_assert(a_offset + a_len <= orig->e.s.len); + string->e.i.string = orig; + string->e.i.beg_offset = a_offset; + } + string->e.i.len = a_len; + + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) string; + nxo_p_type_set(a_nxo, NXOT_STRING); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) string); +} + +void +nxo_string_copy(cw_nxo_t *a_to, cw_nxo_t *a_from) +{ + cw_nxoe_string_t *string_fr, *string_fr_i = NULL, *string_fr_l; + cw_nxoe_string_t *string_to, *string_to_i = NULL, *string_to_l; + cw_uint8_t *str_fr, *str_to; + cw_uint32_t len_fr, len_to; + + /* Set string pointers. */ + string_fr = (cw_nxoe_string_t *) a_from->o.nxoe; + if (string_fr->nxoe.indirect) + { + string_fr_i = string_fr->e.i.string; + } + string_to = (cw_nxoe_string_t *) a_to->o.nxoe; + if (string_to->nxoe.indirect) + { + string_to_i = string_to->e.i.string; + } + + /* Set str_fr and len_fr according to whether string_fr is an indirect + * object. */ + if (string_fr_i != NULL) + { + string_fr_l = string_fr_i; + str_fr = &string_fr_i->e.s.str[string_fr->e.i.beg_offset]; + len_fr = string_fr->e.i.len; + cw_assert(len_fr + string_fr->e.i.beg_offset <= string_fr_i->e.s.len); + } + else + { + string_fr_l = string_fr; + str_fr = string_fr->e.s.str; + len_fr = string_fr->e.s.len; + } + + /* Set str_to and len_to according to whether string_to is an indirect + * object. */ + if (string_to_i != NULL) + { + string_to_l = string_to_i; + str_to = &string_to_i->e.s.str[string_to->e.i.beg_offset]; + len_to = string_to->e.i.len; + } + else + { + string_to_l = string_to; + str_to = string_to->e.s.str; + len_to = string_to->e.s.len; + } + + /* Make sure destination is large enough. */ + cw_assert(len_fr <= len_to); + + /* Copy bytes. */ +#ifdef CW_THREADS + nxoe_p_string_lock(string_fr_l); + nxoe_p_string_lock(string_to_l); +#endif + memcpy(str_to, str_fr, len_fr); +#ifdef CW_THREADS + nxoe_p_string_unlock(string_fr_l); +#endif + + /* Truncate the destination string if it is shorter than the source + * string. */ + if (len_to > len_fr) + { + if (string_to_i != NULL) + { + string_to->e.i.len = len_fr; + } + else + { + string_to->e.s.len = len_fr; + } + } +#ifdef CW_THREADS + nxoe_p_string_unlock(string_to_l); +#endif +} + +void +nxo_string_cstring(cw_nxo_t *a_to, cw_nxo_t *a_from, cw_nxo_t *a_thread) +{ + cw_uint32_t from_len; + + cw_assert(nxo_type_get(a_from) == NXOT_STRING + || nxo_type_get(a_from) == NXOT_NAME); + + /* Create a copy of a_from, but with a trailing '\0' so that it can be used + * in calls to standard C functions. */ + if (nxo_type_get(a_from) == NXOT_STRING) + { + from_len = nxo_string_len_get(a_from); + nxo_string_new(a_to, nxo_thread_nx_get(a_thread), FALSE, from_len + 1); + nxo_string_lock(a_from); + nxo_string_set(a_to, 0, nxo_string_get(a_from), from_len); + nxo_string_el_set(a_to, '\0', from_len); + nxo_string_unlock(a_from); + } + else + { + from_len = nxo_name_len_get(a_from); + nxo_string_new(a_to, nxo_thread_nx_get(a_thread), FALSE, from_len + 1); + nxo_string_set(a_to, 0, nxo_name_str_get(a_from), from_len); + nxo_string_el_set(a_to, '\0', from_len); + } +} + +cw_uint32_t +nxo_string_len_get(const cw_nxo_t *a_nxo) +{ + cw_uint32_t retval; + cw_nxoe_string_t *string; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect) + { + retval = string->e.i.len; + } + else + { + retval = string->e.s.len; + } + + return retval; +} + +void +nxo_string_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_uint8_t *r_el) +{ + cw_nxoe_string_t *string; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect) + { + a_offset += string->e.i.beg_offset; + string = string->e.i.string; + } + cw_assert(string->nxoe.indirect == FALSE); + + cw_assert(a_offset >= 0 && a_offset < string->e.s.len); + *r_el = string->e.s.str[a_offset]; +} + +void +nxo_string_el_set(cw_nxo_t *a_nxo, cw_uint8_t a_el, cw_nxoi_t a_offset) +{ + cw_nxoe_string_t *string; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect) + { + a_offset += string->e.i.beg_offset; + string = string->e.i.string; + } + cw_assert(string->nxoe.indirect == FALSE); + + cw_assert(a_offset >= 0 && a_offset < string->e.s.len); + string->e.s.str[a_offset] = a_el; +} + +#ifdef CW_THREADS +void +nxo_string_lock(cw_nxo_t *a_nxo) +{ + cw_nxoe_string_t *string; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect) + { + string = string->e.i.string; + } + cw_assert(string->nxoe.indirect == FALSE); + + nxoe_p_string_lock(string); +} + +void +nxo_string_unlock(cw_nxo_t *a_nxo) +{ + cw_nxoe_string_t *string; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect) + { + string = string->e.i.string; + } + cw_assert(string->nxoe.indirect == FALSE); + + nxoe_p_string_unlock(string); +} +#endif + +cw_uint8_t * +nxo_string_get(const cw_nxo_t *a_nxo) +{ + cw_uint8_t *retval; + cw_nxoe_string_t *string; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + if (string->nxoe.indirect) + { + retval = &string->e.i.string->e.s.str[string->e.i.beg_offset]; + } + else + { + retval = string->e.s.str; + } + + return retval; +} + +void +nxo_string_set(cw_nxo_t *a_nxo, cw_uint32_t a_offset, const cw_uint8_t *a_str, + cw_uint32_t a_len) +{ + cw_nxoe_string_t *string; + cw_uint8_t *str; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + cw_assert(nxo_type_get(a_nxo) == NXOT_STRING); + + string = (cw_nxoe_string_t *) a_nxo->o.nxoe; + + cw_check_ptr(string); + cw_dassert(string->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(string->nxoe.type == NXOT_STRING); + + /* Get the string pointer. */ + if (string->nxoe.indirect) + { + a_offset += string->e.i.beg_offset; + cw_assert(a_offset + a_len <= string->e.i.string->e.s.len); + str = string->e.i.string->e.s.str; + } + else + { + cw_assert(a_offset + a_len <= string->e.s.len); + str = string->e.s.str; + } + memcpy(&str[a_offset], a_str, a_len); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread.c new file mode 100644 index 000000000..de70e6c14 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread.c @@ -0,0 +1,2581 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_NXO_THREAD_C_ + +#include "../include/libonyx/libonyx.h" + +#include +#include +#include +#ifdef CW_REAL +#include +#endif + +#include "../include/libonyx/nx_l.h" +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_array_l.h" +#ifdef CW_REGEX +#include "../include/libonyx/nxo_regex_l.h" +#endif +#include "../include/libonyx/nxo_thread_l.h" + +#define CW_NXO_THREAD_GETC(a_i) a_thread->tok_str[(a_i)] + +#define CW_NXO_THREAD_PUTC(a_c) \ + do \ + { \ + if (a_thread->index >= CW_NXO_THREAD_BUFFER_SIZE) \ + { \ + nxoe_p_thread_tok_str_expand(a_thread); \ + } \ + a_thread->tok_str[a_thread->index] = (a_c); \ + a_thread->index++; \ + } while (0) + +/* Make a note that a '\n' was just seen. The line and column counters will be + * updated before the next character is seen. */ +#define CW_NXO_THREAD_NEWLINE() newline = 1 + +/* Prototype for automatically generated function. */ +void +nxo_p_thread_nxcode(cw_nxo_t *a_thread); + +#ifdef CW_THREADS +static void * +nxo_p_thread_entry(void *a_arg); +#endif +static cw_uint32_t +nxoe_p_thread_feed(cw_nxoe_thread_t *a_thread, cw_nxo_threadp_t *a_threadp, + cw_bool_t a_token, const cw_uint8_t *a_str, + cw_uint32_t a_len); +static void +nxoe_p_thread_tok_str_expand(cw_nxoe_thread_t *a_thread); +static void +nxoe_p_thread_syntax_error(cw_nxoe_thread_t *a_thread, + cw_nxo_threadp_t *a_threadp, + cw_uint32_t a_defer_base, cw_uint8_t *a_prefix, + cw_uint8_t *a_suffix, cw_sint32_t a_c); +static void +nxoe_p_thread_reset(cw_nxoe_thread_t *a_thread); +static cw_bool_t +nxoe_p_thread_integer_accept(cw_nxoe_thread_t *a_thread); +#ifdef CW_REAL +static cw_bool_t +nxoe_p_thread_real_accept(cw_nxoe_thread_t *a_thread); +#endif +static void +nxoe_p_thread_procedure_accept(cw_nxoe_thread_t *a_thread); +static void +nxoe_p_thread_name_accept(cw_nxoe_thread_t *a_thread); + +#ifdef CW_DBG +#define CW_NXO_THREADP_MAGIC 0xdfe76a68 +#endif + +/* nxo_threadp. */ +void +nxo_threadp_new(cw_nxo_threadp_t *a_threadp) +{ + cw_check_ptr(a_threadp); + + a_threadp->line = 1; + a_threadp->column = 0; + +#ifdef CW_DBG + a_threadp->magic = CW_NXO_THREADP_MAGIC; +#endif +} + +void +nxo_threadp_delete(cw_nxo_threadp_t *a_threadp, cw_nxo_t *a_thread) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_thread); + cw_dassert(a_thread->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_thread->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + switch (thread->state) + { + case THREADTS_START: + { + + /* No problem. */ + break; + } + + case THREADTS_COMMENT: + { + + /* No problem. */ + nxoe_p_thread_reset(thread); + break; + } + case THREADTS_STRING: + case THREADTS_STRING_NEWLINE_CONT: + case THREADTS_STRING_PROT_CONT: + case THREADTS_STRING_CRLF_CONT: + case THREADTS_STRING_CTRL_CONT: + case THREADTS_STRING_HEX_CONT: + case THREADTS_STRING_HEX_FINISH: + { + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_thread); + cw_dassert(a_thread->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_thread->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + nxoe_p_thread_syntax_error(thread, a_threadp, 0, "`", "", -1); + break; + } + case THREADTS_NAME_START: + { + cw_nxoe_thread_t *thread; + cw_uint8_t suffix[2] = "?"; + + cw_check_ptr(a_thread); + cw_dassert(a_thread->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_thread->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + switch (thread->m.m.action) + { + case ACTION_EXECUTE: + { + suffix[0] = '\0'; + break; + } + case ACTION_EVALUATE: + { + suffix[0] = '!'; + break; + } + case ACTION_LITERAL: + { + suffix[0] = '$'; + break; + } + case ACTION_IMMEDIATE: + { + suffix[0] = '~'; + break; + } + default: + { + cw_not_reached(); + } + } + + nxoe_p_thread_syntax_error(thread, a_threadp, 0, "", suffix, -1); + break; + } + case THREADTS_INTEGER: + case THREADTS_INTEGER_RADIX: + case THREADTS_NAME: + { + /* Accept the name or integer. */ + nxo_thread_flush(a_thread, a_threadp); + break; + } + default: + { + cw_not_reached(); + } + } + +#ifdef CW_DBG + memset(a_threadp, 0x5a, sizeof(cw_nxo_threadp_t)); +#endif +} + +void +nxo_threadp_position_get(const cw_nxo_threadp_t *a_threadp, cw_uint32_t *r_line, + cw_uint32_t *r_column) +{ + cw_check_ptr(a_threadp); + cw_dassert(a_threadp->magic == CW_NXO_THREADP_MAGIC); + + *r_line = a_threadp->line; + *r_column = a_threadp->column; +} + +void +nxo_threadp_position_set(cw_nxo_threadp_t *a_threadp, cw_uint32_t a_line, + cw_uint32_t a_column) +{ + cw_check_ptr(a_threadp); + cw_dassert(a_threadp->magic == CW_NXO_THREADP_MAGIC); + + a_threadp->line = a_line; + a_threadp->column = a_column; +} + +/* nxo_thread. */ +void +nxo_thread_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx) +{ + cw_nxoe_thread_t *thread; + cw_nxo_t *nxo; + + thread = (cw_nxoe_thread_t *) nxa_malloc(nx_nxa_get(a_nx), + sizeof(cw_nxoe_thread_t)); + memset(thread, 0, sizeof(cw_nxoe_thread_t)); + + nxoe_l_new(&thread->nxoe, NXOT_THREAD, FALSE); + + /* Set things to a state that won't cause the GC (or any thread-related + * operators) to puke. */ + + /* Fake up a nxo for self. */ + nxo_p_new(&thread->self, NXOT_THREAD); + thread->self.o.nxoe = (cw_nxoe_t *) thread; + + thread->nx = a_nx; + thread->tok_str = thread->buffer; + + nxo_no_new(&thread->estack); + nxo_no_new(&thread->istack); + nxo_no_new(&thread->ostack); + nxo_no_new(&thread->dstack); + nxo_no_new(&thread->tstack); + nxo_no_new(&thread->stdin_nxo); + nxo_no_new(&thread->stdout_nxo); + nxo_no_new(&thread->stderr_nxo); +#ifdef CW_REGEX + nxo_l_regex_cache_new(&thread->regex_cache); +#endif + + /* Register this thread with the interpreter so that the GC will be able to + * get to it. */ + nx_l_thread_insert(a_nx, &thread->self); + + /* Register with the GC so that this thread will be iterated on during + * GC. */ + nxo_no_new(a_nxo); + a_nxo->o.nxoe = (cw_nxoe_t *) thread; +#ifdef CW_DBG + a_nxo->magic = CW_NXO_MAGIC; +#endif + nxo_p_type_set(a_nxo, NXOT_THREAD); + + nxa_l_gc_register(nx_nxa_get(a_nx), (cw_nxoe_t *) thread); + + /* Finish setting up the internals. */ + nxo_stack_new(&thread->estack, a_nx, FALSE); + nxo_stack_new(&thread->istack, a_nx, FALSE); + nxo_stack_new(&thread->ostack, a_nx, FALSE); + nxo_stack_new(&thread->dstack, a_nx, FALSE); + nxo_stack_new(&thread->tstack, a_nx, FALSE); + + nxo_dup(&thread->stdin_nxo, nx_stdin_get(a_nx)); + nxo_dup(&thread->stdout_nxo, nx_stdout_get(a_nx)); + nxo_dup(&thread->stderr_nxo, nx_stderr_get(a_nx)); + + /* Push threaddict, systemdict, and globaldict, onto the dictionary stack. + * The embedded onyx initialization code creates userdict. */ + nxo = nxo_stack_push(&thread->dstack); + nxo_dict_new(nxo, a_nx, FALSE, CW_LIBONYX_THREADDICT_HASH); + + nxo = nxo_stack_push(&thread->dstack); + nxo_dup(nxo, nx_systemdict_get(a_nx)); + + nxo = nxo_stack_push(&thread->dstack); + nxo_dup(nxo, nx_globaldict_get(a_nx)); + + /* Run per-thread embedded initialization code. */ + nxo_p_thread_nxcode(&thread->self); + + /* Execute the thread initialization hook if set. */ + if (nx_l_thread_init(a_nx) != NULL) + { + nx_l_thread_init(a_nx)(&thread->self); + } +} + +void +nxo_thread_start(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + cw_nxo_t *start; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + start = nxo_stack_push(&thread->estack); + nxo_operator_new(start, systemdict_start, NXN_start); + nxo_attr_set(start, NXOA_EXECUTABLE); + + nxo_thread_loop(a_nxo); +} + +void +nxo_thread_exit(cw_nxo_t *a_nxo) +{ + nx_l_thread_remove(nxo_thread_nx_get(a_nxo), a_nxo); +} + +#ifdef CW_THREADS +static void * +nxo_p_thread_entry(void *a_arg) +{ + cw_nxoe_thread_t *thread = (cw_nxoe_thread_t *) a_arg; + + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + /* Run. */ + nxo_thread_start(&thread->self); + + /* Wait to be joined or detated, if not already so. */ + mtx_lock(&thread->lock); + thread->done = TRUE; + while (thread->detached == FALSE && thread->joined == FALSE) + { + cnd_wait(&thread->done_cnd, &thread->lock); + } + if (thread->detached) + { + mtx_unlock(&thread->lock); + + /* Clean up. */ + cnd_delete(&thread->join_cnd); + cnd_delete(&thread->done_cnd); + mtx_delete(&thread->lock); + nx_l_thread_remove(thread->nx, &thread->self); + thd_delete(thread->thd); + } + else if (thread->joined) + { + /* Wake the joiner back up. */ + cnd_signal(&thread->join_cnd); + /* We're done. The joiner will clean up. */ + thread->gone = TRUE; + mtx_unlock(&thread->lock); + } + else + { + cw_not_reached(); + } + + return NULL; +} + +void +nxo_thread_thread(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + mtx_new(&thread->lock); + cnd_new(&thread->done_cnd); + cnd_new(&thread->join_cnd); + thread->done = FALSE; + thread->gone = FALSE; + thread->detached = FALSE; + thread->joined = FALSE; + + thread->thd = thd_new(nxo_p_thread_entry, (void *) thread, TRUE); +} + +void +nxo_thread_detach(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + mtx_lock(&thread->lock); + thread->detached = TRUE; + if (thread->done) + { + /* The thread is already done, so wake it back up. */ + cnd_signal(&thread->done_cnd); + } + mtx_unlock(&thread->lock); +} + +void +nxo_thread_join(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + mtx_lock(&thread->lock); + thread->joined = TRUE; + if (thread->done) + { + /* The thread is already done, so wake it back up. */ + cnd_signal(&thread->done_cnd); + } + /* Wait for the thread to totally go away. */ + while (thread->gone == FALSE) + { + cnd_wait(&thread->join_cnd, &thread->lock); + } + mtx_unlock(&thread->lock); + + /* Clean up. */ + cnd_delete(&thread->join_cnd); + cnd_delete(&thread->done_cnd); + mtx_delete(&thread->lock); + thd_join(thread->thd); + + nx_l_thread_remove(nxo_thread_nx_get(a_nxo), a_nxo); +} +#endif + +cw_nxo_threadts_t +nxo_thread_state(const cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return thread->state; +} + +cw_bool_t +nxo_thread_deferred(cw_nxo_t *a_nxo) +{ + cw_bool_t retval; + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + if (thread->defer_count != 0) + { + retval = TRUE; + } + else + { + retval = FALSE; + } + + return retval; +} + +void +nxo_thread_reset(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + thread->defer_count = 0; + nxoe_p_thread_reset(thread); +} + +void +nxo_thread_loop(cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + cw_nxo_t *nxo, *tnxo, *inxo; + cw_uint32_t sdepth, cdepth; +#ifdef CW_DBG + cw_uint32_t tdepth; +#endif + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + +#ifdef CW_DBG + /* The assertions about stack depth in this function check for tstack leaks + * in operators. */ + tdepth = nxo_stack_count(&thread->tstack); +#endif + /* Push an integer onto istack that corresponds to the object on estack + * we're executing. */ + inxo = nxo_stack_push(&thread->istack); + nxo_integer_new(inxo, 0); + cw_assert(nxo_stack_count(&thread->estack) == + nxo_stack_count(&thread->istack)); + + for (sdepth = cdepth = nxo_stack_count(&thread->estack); + cdepth >= sdepth; + cdepth = nxo_stack_count(&thread->estack)) + { + if (cdepth == CW_LIBONYX_ESTACK_MAX + 1) + { + nxo_thread_nerror(a_nxo, NXN_estackoverflow); + } + + nxo = nxo_stack_get(&thread->estack); + if (nxo_attr_get(nxo) == NXOA_LITERAL) + { + /* Always push literal objects onto the operand stack. */ + tnxo = nxo_stack_push(&thread->ostack); + nxo_dup(tnxo, nxo); + nxo_stack_pop(&thread->estack); + continue; + } + + switch (nxo_type_get(nxo)) + { + case NXOT_BOOLEAN: +#ifdef CW_THREADS + case NXOT_CONDITION: +#endif + case NXOT_DICT: + case NXOT_FINO: + case NXOT_INTEGER: + case NXOT_MARK: +#ifdef CW_THREADS + case NXOT_MUTEX: +#endif + case NXOT_PMARK: +#ifdef CW_REAL + case NXOT_REAL: +#endif +#ifdef CW_REGEX + case NXOT_REGEX: + case NXOT_REGSUB: +#endif + case NXOT_STACK: + case NXOT_THREAD: + { + /* Always push the object onto the operand stack, even though it + * isn't literal. */ + tnxo = nxo_stack_push(&thread->ostack); + nxo_dup(tnxo, nxo); + nxo_stack_pop(&thread->estack); + break; + } + case NXOT_NULL: + { + /* Do nothing. */ + nxo_stack_pop(&thread->estack); + break; + } + case NXOT_ARRAY: + { + cw_uint32_t i, len; + cw_nxo_t *el; + cw_nxoa_t attr; + + len = nxo_array_len_get(nxo); + if (len == 0) + { + nxo_stack_pop(&thread->estack); + break; + } + + /* Iterate through the array and execute each element in turn. + * The generic algorithm is simply to push an element onto + * estack and recurse, but the overhead of the pushing, + * recursion, and popping is excessive for the common cases of a + * simple object or operator. Therefore, check for the most + * common simple cases and handle them specially. */ + el = nxo_stack_push(&thread->tstack); + for (i = 0; i < len - 1; i++) + { + nxo_l_array_el_get(nxo, i, el); + attr = nxo_attr_get(el); + if (attr == NXOA_LITERAL) + { + /* Always push literal objects onto the operand + * stack. */ + tnxo = nxo_stack_push(&thread->ostack); + nxo_dup(tnxo, el); + continue; + } + + /* Set the execution index. */ + nxo_integer_set(inxo, i); + + switch (nxo_type_get(el)) + { + case NXOT_ARRAY: + { + /* Only execute nested arrays that have the + * evaluatable attribute. */ + if (attr == NXOA_EVALUATABLE) + { + tnxo = nxo_stack_push(&thread->estack); + nxo_dup(tnxo, el); + nxo_thread_loop(a_nxo); + } + else + { + tnxo = nxo_stack_push(&thread->ostack); + nxo_dup(tnxo, el); + } + break; + } + case NXOT_OPERATOR: + { + nxo_operator_f(el)(a_nxo); + break; + } + default: + { + /* Not a simple common case, so use the generic + * algorithm. */ + tnxo = nxo_stack_push(&thread->estack); + nxo_dup(tnxo, el); + nxo_thread_loop(a_nxo); + } + } + cw_assert(nxo_stack_count(&thread->tstack) == tdepth + 1); + } + + /* Set the index back to 0 now that we're not executing an array + * any more. */ + nxo_integer_set(inxo, 0); + + /* If recursion is possible and likely, make tail recursion safe + * by replacing the array with its last element before executing + * the last element. */ + nxo_l_array_el_get(nxo, i, el); + attr = nxo_attr_get(el); + if ((attr == NXOA_LITERAL) + || (nxo_type_get(el) == NXOT_ARRAY + && attr == NXOA_EXECUTABLE)) + { + /* Always push literal objects and nested executable (not + * evaluatable) arrays onto the operand stack. */ + tnxo = nxo_stack_push(&thread->ostack); + nxo_dup(tnxo, el); + nxo_stack_pop(&thread->estack); + } + else + { + /* Possible recursion. */ + nxo_dup(nxo, el); + } + nxo_stack_pop(&thread->tstack); + break; + } + case NXOT_STRING: + { + cw_nxo_threadp_t threadp; + + /* Use the string as a source of code. */ + nxo_threadp_new(&threadp); +#ifdef CW_THREADS + nxo_string_lock(nxo); +#endif + nxo_thread_interpret(a_nxo, &threadp, nxo_string_get(nxo), + nxo_string_len_get(nxo)); +#ifdef CW_THREADS + nxo_string_unlock(nxo); +#endif + nxo_thread_flush(a_nxo, &threadp); + nxo_threadp_delete(&threadp, a_nxo); + nxo_stack_pop(&thread->estack); + + break; + } + case NXOT_NAME: + { + cw_nxo_t *name; + + /* Search for a value associated with the name in the dictionary + * stack, and put it on the execution stack, in preparation for + * the next iteration through the execution loop. Thus, nested + * name lookups work correctly. */ + name = nxo_stack_push(&thread->tstack); + nxo_dup(name, nxo); + if (nxo_thread_dstack_search(a_nxo, name, nxo)) + { + nxo_thread_nerror(a_nxo, NXN_undefined); + nxo_stack_pop(&thread->estack); + } + nxo_stack_pop(&thread->tstack); + break; + } + case NXOT_OPERATOR: + { + nxo_operator_f(nxo)(a_nxo); + nxo_stack_pop(&thread->estack); + break; + } + case NXOT_FILE: + { + cw_nxo_threadp_t threadp; + cw_sint32_t nread; + cw_uint8_t buffer[CW_LIBONYX_FILE_EVAL_READ_SIZE]; + + nxo_threadp_new(&threadp); + /* Read data from the file and interpret it until an EOF (0 byte + * read). */ + for (nread = nxo_file_read(nxo, CW_LIBONYX_FILE_EVAL_READ_SIZE, + buffer); + nread > 0; + nread = nxo_file_read(nxo, CW_LIBONYX_FILE_EVAL_READ_SIZE, + buffer)) + { + nxo_thread_interpret(a_nxo, &threadp, buffer, nread); + } + /* Do not flush, so that syntax errors get caught. */ + nxo_threadp_delete(&threadp, a_nxo); + + nxo_stack_pop(&thread->estack); + break; + } + case NXOT_HOOK: + { + nxo_hook_eval(nxo, a_nxo); + + nxo_stack_pop(&thread->estack); + break; + } + default: + { + cw_not_reached(); + } + } + cw_assert(nxo_stack_count(&thread->tstack) == tdepth); + } + + /* Pop the execution index for this onyx stack frame. */ + nxo_stack_pop(&thread->istack); + cw_assert(nxo_stack_count(&thread->estack) == + nxo_stack_count(&thread->istack)); +} + +void +nxo_thread_interpret(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp, const + cw_uint8_t *a_str, cw_uint32_t a_len) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + nxoe_p_thread_feed(thread, a_threadp, FALSE, a_str, a_len); +} + +void +nxo_thread_flush(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp) +{ + cw_nxoe_thread_t *thread; + static const cw_uint8_t str[] = "\n"; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + nxoe_p_thread_feed(thread, a_threadp, FALSE, str, sizeof(str) - 1); +} + +void +nxo_thread_nerror(cw_nxo_t *a_nxo, cw_nxn_t a_nxn) +{ + nxo_thread_serror(a_nxo, nxn_str(a_nxn), nxn_len(a_nxn)); +} + +void +nxo_thread_serror(cw_nxo_t *a_nxo, const cw_uint8_t *a_str, cw_uint32_t a_len) +{ + cw_nxoe_thread_t *thread; + cw_nxo_t *errorname; + cw_uint32_t defer_count; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + /* Convert a_str to a name object on ostack. */ + errorname = nxo_stack_push(&thread->ostack); + nxo_name_new(errorname, thread->nx, a_str, a_len, FALSE); + + /* Shut off deferral temporarily. It is possible for this C stack frame to + * never be returned to, due to an exception (stop, quit, exit), in which + * case, deferral will never be turned back on. That's fine, since the user + * is going to have to patch things up by hand in that case anyway. */ + defer_count = thread->defer_count; + thread->defer_count = 0; + + /* Throw an error. */ + cw_onyx_code(a_nxo, "throw"); + + /* Turn deferral back on. */ + thread->defer_count = defer_count; +} + +cw_bool_t +nxo_thread_dstack_search(cw_nxo_t *a_nxo, cw_nxo_t *a_key, cw_nxo_t *r_value) +{ + cw_bool_t retval; + cw_nxoe_thread_t *thread; + cw_nxo_t *dict; + cw_uint32_t i, depth; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + /* Iteratively search the dictionaries on the dictionary stack for + * a_key. */ + for (i = 0, depth = nxo_stack_count(&thread->dstack), dict = NULL; + i < depth; + i++) + { + dict = nxo_stack_down_get(&thread->dstack, dict); + if (nxo_dict_lookup(dict, a_key, r_value) == FALSE) + { + /* Found. */ + retval = FALSE; + goto RETURN; + } + } + + retval = TRUE; + RETURN: + return retval; +} + +#ifdef CW_THREADS +cw_bool_t +nxo_thread_currentlocking(const cw_nxo_t *a_nxo) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return thread->locking; +} + +void +nxo_thread_setlocking(cw_nxo_t *a_nxo, cw_bool_t a_locking) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + thread->locking = a_locking; +} +#endif + +void +nxo_thread_stdin_set(cw_nxo_t *a_nxo, cw_nxo_t *a_stdin) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + cw_check_ptr(a_stdin); + cw_assert(a_stdin->magic == CW_NXO_MAGIC); + + nxo_dup(&thread->stdin_nxo, a_stdin); +} + +void +nxo_thread_stdout_set(cw_nxo_t *a_nxo, cw_nxo_t *a_stdout) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + cw_check_ptr(a_stdout); + cw_assert(a_stdout->magic == CW_NXO_MAGIC); + + nxo_dup(&thread->stdout_nxo, a_stdout); +} + +void +nxo_thread_stderr_set(cw_nxo_t *a_nxo, cw_nxo_t *a_stderr) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + cw_check_ptr(a_stderr); + cw_assert(a_stderr->magic == CW_NXO_MAGIC); + + nxo_dup(&thread->stderr_nxo, a_stderr); +} + +cw_uint32_t +nxo_l_thread_token(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp, const + cw_uint8_t *a_str, cw_uint32_t a_len) +{ + cw_nxoe_thread_t *thread; + + cw_check_ptr(a_nxo); + cw_dassert(a_nxo->magic == CW_NXO_MAGIC); + + thread = (cw_nxoe_thread_t *) a_nxo->o.nxoe; + cw_dassert(thread->nxoe.magic == CW_NXOE_MAGIC); + cw_assert(thread->nxoe.type == NXOT_THREAD); + + return nxoe_p_thread_feed(thread, a_threadp, TRUE, a_str, a_len); +} + +static cw_uint32_t +nxoe_p_thread_feed(cw_nxoe_thread_t *a_thread, cw_nxo_threadp_t *a_threadp, + cw_bool_t a_token, const cw_uint8_t *a_str, + cw_uint32_t a_len) +{ + cw_uint32_t retval, i, newline, defer_base; + cw_uint8_t c; + cw_nxo_t *nxo; + cw_bool_t token; + + if (a_token) + { + /* Artificially inflate the defer count so that when we accept a token, + * it doesn't get evaluated. */ + defer_base = 1; + a_thread->defer_count++; + /* The value of token is only used when a_token is true, so only bother + * to initialize it in this case. */ + token = FALSE; + } + else + { + defer_base = 0; + } + + /* All the grossness surrounding newline avoids doing any branches when + * calculating the line and column number. This may be overzealous + * optimization, but the logic is relatively simple. We do the update of + * both line and column number here so that they are correct at all times + * during the main part of the loop. */ + for (i = newline = 0; + i < a_len; + i++, a_threadp->line += newline, + a_threadp->column = ((a_threadp->column + 1) * !newline), + newline = 0) + { + c = a_str[i]; + + /* If a special character causes the end of the previous token, the + * state machine builds the object, then restarts the state machine + * without incrementing the input character index. This is done in + * order to avoid having to duplicate the THREADTS_START code. */ + RESTART: + + switch (a_thread->state) + { + case THREADTS_START: + { + cw_assert(a_thread->index == 0); + + if (a_token) + { + /* token is TRUE if a token has been accepted. We look for + * the situation where token is TRUE and + * a_thread->defer_count is only 1 (artificially raised). + * If these conditions are met, then we've managed to scan + * an entire token, as defined by the token operator. */ + if (token && a_thread->defer_count == 1) + { + /* Return the offset of the next character. */ + retval = i; + goto RETURN; + } + } + + switch (c) + { + case '`': + { + a_thread->state = THREADTS_STRING; + a_thread->m.s.q_depth = 1; + break; + } + case '\'': + { + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "", "", c); + if (a_token) + { + goto RETURN; + } + break; + } + case '<': case '>': case '(': case ')': case '[': case ']': + { + CW_NXO_THREAD_PUTC(c); + token = TRUE; + a_thread->m.m.action = ACTION_EXECUTE; + nxoe_p_thread_name_accept(a_thread); + break; + } + case '{': + { + a_thread->defer_count++; + nxo = nxo_stack_push(&a_thread->ostack); + nxo_pmark_new(nxo); + break; + } + case '}': + { + if (a_thread->defer_count > defer_base) + { + token = TRUE; + a_thread->defer_count--; + nxoe_p_thread_procedure_accept( + a_thread); + } + else + { + /* Missing '{'. */ + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "", "", c); + if (a_token) + { + goto RETURN; + } + } + break; + } + case '!': + { + a_thread->state = THREADTS_NAME_START; + a_thread->m.m.action = ACTION_EVALUATE; + break; + } + case '$': + { + a_thread->state = THREADTS_NAME_START; + a_thread->m.m.action = ACTION_LITERAL; + break; + } + case '~': + { + a_thread->state = THREADTS_NAME_START; + a_thread->m.m.action = ACTION_IMMEDIATE; + break; + } + case '#': + { + a_thread->state = THREADTS_COMMENT; + break; + } + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + { + /* Swallow. */ + break; + } + case '+': + { + a_thread->state = THREADTS_INTEGER; + a_thread->m.n.mant_neg = FALSE; + a_thread->m.n.radix_base = 10; + a_thread->m.n.whole = FALSE; +#ifdef CW_REAL + a_thread->m.n.frac = FALSE; + a_thread->m.n.exp = FALSE; +#endif + CW_NXO_THREAD_PUTC(c); + break; + } + case '-': + { + a_thread->state = THREADTS_INTEGER; + a_thread->m.n.mant_neg = TRUE; + a_thread->m.n.radix_base = 10; + a_thread->m.n.whole = FALSE; +#ifdef CW_REAL + a_thread->m.n.frac = FALSE; + a_thread->m.n.exp = FALSE; +#endif + CW_NXO_THREAD_PUTC(c); + break; + } +#ifdef CW_REAL + case '.': + { + a_thread->state = THREADTS_REAL_FRAC; + a_thread->m.n.mant_neg = FALSE; + a_thread->m.n.radix_base = 10; + a_thread->m.n.whole = FALSE; + a_thread->m.n.frac = FALSE; + a_thread->m.n.exp = FALSE; + break; + } +#endif + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + { + a_thread->state = THREADTS_INTEGER; + a_thread->m.n.mant_neg = FALSE; + a_thread->m.n.radix_base = 10; + a_thread->m.n.whole = TRUE; + a_thread->m.n.whole_off = 0; +#ifdef CW_REAL + a_thread->m.n.frac = FALSE; + a_thread->m.n.exp = FALSE; +#endif + CW_NXO_THREAD_PUTC(c); + break; + } + default: + { + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + case THREADTS_COMMENT: + { + cw_assert(a_thread->index == 0); + + switch (c) + { + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '\f': + { + /* Fall through. */ + } + case '\r': + { + a_thread->state = THREADTS_START; + break; + } + default: + { + break; + } + } + break; + } + case THREADTS_INTEGER: + { + cw_bool_t restart = FALSE; + + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + { + if (a_thread->m.n.whole == FALSE) + { + a_thread->m.n.whole = TRUE; + a_thread->m.n.whole_off = a_thread->index; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '@': + { + cw_uint32_t digit, ndigits; + + /* Convert the string to a base (interpreted as base + * 10). */ + if (a_thread->m.n.whole) + { + a_thread->m.n.whole_len = a_thread->index + - a_thread->m.n.whole_off; + ndigits = a_thread->m.n.whole_len; + } + else + { + ndigits = 0; + } + switch (ndigits) + { + case 2: + { + digit = + CW_NXO_THREAD_GETC(a_thread->m.n.whole_off) + - '0'; + if (digit == 0) + { + /* Leading '0' in radix not allowed. */ + break; + } + a_thread->m.n.radix_base = digit * 10; + + digit + = CW_NXO_THREAD_GETC(a_thread->m.n.whole_off + + 1) - '0'; + a_thread->m.n.radix_base += digit; + break; + } + case 1: + { + digit = + CW_NXO_THREAD_GETC(a_thread->m.n.whole_off) + - '0'; + a_thread->m.n.radix_base = digit; + break; + } + default: + { + /* Too many, or not enough digits. */ + a_thread->m.n.radix_base = 0; + break; + } + } + + if (a_thread->m.n.radix_base < 2 + || a_thread->m.n.radix_base > 36) + { + /* Base too small or too large. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + } + else + { + a_thread->m.n.whole = FALSE; + a_thread->state = THREADTS_INTEGER_RADIX; + } + CW_NXO_THREAD_PUTC(c); + break; + } +#ifdef CW_REAL + case '.': + { + a_thread->state = THREADTS_REAL_FRAC; + if (a_thread->m.n.whole) + { + a_thread->m.n.whole_len = a_thread->index + - a_thread->m.n.whole_off; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case 'e': case 'E': + { + a_thread->state = THREADTS_REAL_EXP; + a_thread->m.n.exp_sign = FALSE; + a_thread->m.n.exp_neg = FALSE; + if (a_thread->m.n.whole) + { + a_thread->m.n.whole_len = a_thread->index + - a_thread->m.n.whole_off; + } + CW_NXO_THREAD_PUTC(c); + break; + } +#endif + case '\n': + { + restart = TRUE; /* Inverted below. */ + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '(': case ')': case '`': case '\'': case '<': case '>': + case '[': case ']': case '{': case '}': case '!': case '$': + case '~': case '#': + { + /* New token. */ + /* Invert, in case we fell through from above. */ + restart = !restart; + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + { + if (a_thread->m.n.whole) + { + a_thread->m.n.whole_len = a_thread->index + - a_thread->m.n.whole_off; + } + if (nxoe_p_thread_integer_accept(a_thread)) + { + /* Conversion error. Accept as a name. */ + a_thread->m.m.action = ACTION_EXECUTE; + nxoe_p_thread_name_accept(a_thread); + } + token = TRUE; + if (restart) + { + goto RESTART; + } + break; + } + default: + { + /* Not a number character. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + case THREADTS_INTEGER_RADIX: + { + cw_bool_t restart = FALSE; + + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + { + if (a_thread->m.n.whole == FALSE) + { + a_thread->m.n.whole = TRUE; + a_thread->m.n.whole_off = a_thread->index; + } + if (a_thread->m.n.radix_base + <= (10 + ((cw_uint32_t) (c - 'a')))) + { + /* Too big for this base. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + { + if (a_thread->m.n.whole == FALSE) + { + a_thread->m.n.whole = TRUE; + a_thread->m.n.whole_off = a_thread->index; + } + if (a_thread->m.n.radix_base + <= (10 + ((cw_uint32_t) (c - 'A')))) + { + /* Too big for this base. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + { + if (a_thread->m.n.whole == FALSE) + { + a_thread->m.n.whole = TRUE; + a_thread->m.n.whole_off = a_thread->index; + } + if (a_thread->m.n.radix_base + <= ((cw_uint32_t) (c - '0'))) + { + /* Too big for this base. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '\n': + { + restart = TRUE; /* Inverted below. */ + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '(': case ')': case '`': case '\'': case '<': case '>': + case '[': case ']': case '{': case '}': case '!': case '$': + case '~': case '#': + { + /* New token. */ + /* Invert, in case we fell through from above. */ + restart = !restart; + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + { + if (a_thread->m.n.whole) + { + a_thread->m.n.whole_len = a_thread->index + - a_thread->m.n.whole_off; + } + if (a_thread->m.n.whole == FALSE + || nxoe_p_thread_integer_accept(a_thread)) + { + /* Conversion error. Accept as a name. */ + a_thread->m.m.action = ACTION_EXECUTE; + nxoe_p_thread_name_accept(a_thread); + } + token = TRUE; + if (restart) + { + goto RESTART; + } + break; + } + default: + { + /* Not a number character. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } +#ifdef CW_REAL + case THREADTS_REAL_FRAC: + { + cw_bool_t restart = FALSE; + + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + { + if (a_thread->m.n.frac == FALSE) + { + a_thread->m.n.frac = TRUE; + a_thread->m.n.frac_off = a_thread->index; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case 'e': case 'E': + { + a_thread->state = THREADTS_REAL_EXP; + a_thread->m.n.exp_sign = FALSE; + a_thread->m.n.exp_neg = FALSE; + if (a_thread->m.n.frac) + { + a_thread->m.n.frac_len = a_thread->index + - a_thread->m.n.frac_off; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '\n': + { + restart = TRUE; /* Inverted below. */ + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '(': case ')': case '`': case '\'': case '<': case '>': + case '[': case ']': case '{': case '}': case '!': case '$': + case '~': case '#': + { + /* New token. */ + /* Invert, in case we fell through from above. */ + restart = !restart; + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + { + if (a_thread->m.n.frac) + { + a_thread->m.n.frac_len = a_thread->index + - a_thread->m.n.frac_off; + } + if (nxoe_p_thread_real_accept(a_thread)) + { + /* Conversion error. Accept as a name. */ + a_thread->m.m.action = ACTION_EXECUTE; + nxoe_p_thread_name_accept(a_thread); + } + token = TRUE; + if (restart) + { + goto RESTART; + } + break; + } + default: + { + /* Not a number character. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + case THREADTS_REAL_EXP: + { + cw_bool_t restart = FALSE; + + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + { + if (a_thread->m.n.exp == FALSE) + { + a_thread->m.n.exp = TRUE; + a_thread->m.n.exp_off = a_thread->index; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '+': + { + if (a_thread->m.n.exp_sign == FALSE + && a_thread->m.n.exp == FALSE) + { + a_thread->m.n.exp_sign = TRUE; + } + else + { + /* Sign specified more than once. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '-': + { + if (a_thread->m.n.exp_sign == FALSE + && a_thread->m.n.exp == FALSE) + { + a_thread->m.n.exp_sign = TRUE; + a_thread->m.n.exp_neg = TRUE; + } + else + { + /* Sign specified more than once. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + } + CW_NXO_THREAD_PUTC(c); + break; + } + case '\n': + { + restart = TRUE; /* Inverted below. */ + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '(': case ')': case '`': case '\'': case '<': case '>': + case '[': case ']': case '{': case '}': case '!': case '$': + case '~': case '#': + { + /* New token. */ + /* Invert, in case we fell through from above. */ + restart = !restart; + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + { + if (a_thread->m.n.exp) + { + a_thread->m.n.exp_len = a_thread->index + - a_thread->m.n.exp_off; + } + if (a_thread->m.n.exp == FALSE + || nxoe_p_thread_real_accept(a_thread)) + { + /* Conversion error. Accept as a name. */ + a_thread->m.m.action = ACTION_EXECUTE; + nxoe_p_thread_name_accept(a_thread); + } + token = TRUE; + if (restart) + { + goto RESTART; + } + break; + } + default: + { + /* Not a number character. */ + a_thread->state = THREADTS_NAME; + a_thread->m.m.action = ACTION_EXECUTE; + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } +#endif + case THREADTS_STRING: + { + /* The CRLF code jumps here if there was no LF. */ + STRING_CONTINUE: + + switch (c) + { + case '\\': + { + a_thread->state = THREADTS_STRING_PROT_CONT; + break; + } + case '`': + { + a_thread->m.s.q_depth++; + CW_NXO_THREAD_PUTC(c); + break; + } + case '\'': + { + a_thread->m.s.q_depth--; + if (a_thread->m.s.q_depth == 0) + { + token = TRUE; + nxo = nxo_stack_push(&a_thread->ostack); +#ifdef CW_THREADS + nxo_string_new(nxo, a_thread->nx, a_thread->locking, + a_thread->index); +#else + nxo_string_new(nxo, a_thread->nx, FALSE, + a_thread->index); +#endif + nxo_string_set(nxo, 0, a_thread->tok_str, + a_thread->index); + + nxoe_p_thread_reset(a_thread); + } + else + { + CW_NXO_THREAD_PUTC(c); + } + break; + } + case '\r': + { + a_thread->state = THREADTS_STRING_NEWLINE_CONT; + break; + } + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + default: + { + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + case THREADTS_STRING_NEWLINE_CONT: + { + /* All cases in the switch statement do this. */ + CW_NXO_THREAD_PUTC('\n'); + a_thread->state = THREADTS_STRING; + switch (c) + { + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + break; + } + default: + { + /* '\r' was not followed by a '\n'. Translate the '\r' + * to a '\n' and jump back up to the string scanning + * state to scan c again. */ + goto STRING_CONTINUE; + } + } + break; + } + case THREADTS_STRING_PROT_CONT: + { + switch (c) + { + case '`': case '\'': case '\\': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC(c); + break; + } + case '0': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\0'); + break; + } + case 'n': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\n'); + break; + } + case 'r': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\r'); + break; + } + case 't': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\t'); + break; + } + case 'a': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\a'); + break; + } + case 'b': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\b'); + break; + } + case 'e': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\x1b'); + break; + } + case 'f': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\f'); + break; + } + case 'c': + { + a_thread->state = THREADTS_STRING_CTRL_CONT; + break; + } + case 'x': + { + a_thread->state = THREADTS_STRING_HEX_CONT; + break; + } + case '\r': + { + a_thread->state = THREADTS_STRING_CRLF_CONT; + break; + } + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + + /* Ignore. */ + a_thread->state = THREADTS_STRING; + break; + } + default: + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC('\\'); + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + case THREADTS_STRING_CRLF_CONT: + { + switch (c) + { + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + + /* Ignore. */ + a_thread->state = THREADTS_STRING; + break; + } + default: + { + goto STRING_CONTINUE; + } + } + break; + } + case THREADTS_STRING_CTRL_CONT: + { + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC(c - 'a' + 1); + break; + } + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + { + a_thread->state = THREADTS_STRING; + CW_NXO_THREAD_PUTC(c - 'A' + 1); + break; + } + + default: + { + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "`", "\\c", c); + if (a_token) + { + goto RETURN; + } + } + } + break; + } + case THREADTS_STRING_HEX_CONT: + { + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case 'a': case 'b': + case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': + case 'C': case 'D': case 'E': case 'F': + { + a_thread->state = THREADTS_STRING_HEX_FINISH; + a_thread->m.s.hex_val = c; + break; + } + default: + { + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "`", "\\x", c); + if (a_token) + { + goto RETURN; + } + } + } + break; + } + case THREADTS_STRING_HEX_FINISH: + { + switch (c) + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case 'a': case 'b': + case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': + case 'C': case 'D': case 'E': case 'F': + { + cw_uint8_t val; + + a_thread->state = THREADTS_STRING; + switch (a_thread->m.s.hex_val) + { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + val = (a_thread->m.s.hex_val - '0') << 4; + break; + } + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': + { + val = ((a_thread->m.s.hex_val - 'a') + 10) << 4; + break; + } + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': + { + val = ((a_thread->m.s.hex_val - 'A') + 10) << 4; + break; + } + default: + { + cw_not_reached(); + } + } + switch (c) + { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + val |= (c - '0'); + break; + } + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': + { + val |= ((c - 'a') + 10); + break; + } + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': + { + val |= ((c - 'A') + 10); + break; + } + default: + { + cw_not_reached(); + } + } + CW_NXO_THREAD_PUTC(val); + break; + } + default: + { + cw_uint8_t suffix[] = "\\x?"; + + suffix[2] = a_thread->m.s.hex_val; + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "`", suffix, c); + if (a_token) + { + goto RETURN; + } + } + } + break; + } + case THREADTS_NAME_START: + { + cw_assert(a_thread->index == 0); + + switch (c) + { + case '\n': + { + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + case '(': case ')': case '`': case '\'': case '<': case '>': + case '[': case ']': case '{': case '}': case '!': case '$': + case '~': case '#': + { + cw_uint8_t suffix[2] = "?"; + + switch (a_thread->m.m.action) + { + case ACTION_EXECUTE: + { + suffix[0] = '\0'; + break; + } + case ACTION_EVALUATE: + { + suffix[0] = '!'; + break; + } + case ACTION_LITERAL: + { + suffix[0] = '$'; + break; + } + case ACTION_IMMEDIATE: + { + suffix[0] = '~'; + break; + } + default: + { + cw_not_reached(); + } + } + + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "", suffix, c); + if (a_token) + { + goto RETURN; + } + break; + } + default: + { + a_thread->state = THREADTS_NAME; + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + case THREADTS_NAME: + { + cw_bool_t restart = FALSE; + + switch (c) + { + case '\n': + { + restart = TRUE; /* Inverted below. */ + CW_NXO_THREAD_NEWLINE(); + /* Fall through. */ + } + case '(': case ')': case '`': case '\'': case '<': case '>': + case '[': case ']': case '{': case '}': case '!': case '$': + case '~': case '#': + { + /* New token. */ + /* Invert, in case we fell through from above. */ + restart = !restart; + /* Fall through. */ + } + case '\0': case '\t': case '\f': case '\r': case ' ': + { + /* End of name. */ + if (a_thread->index > 0) + { + token = TRUE; + nxoe_p_thread_name_accept(a_thread); + } + else + { + cw_uint8_t suffix[2] = "?"; + + switch (a_thread->m.m.action) + { + case ACTION_EXECUTE: + { + suffix[0] = '\0'; + break; + } + case ACTION_EVALUATE: + { + suffix[0] = '!'; + break; + } + case ACTION_LITERAL: + { + suffix[0] = '$'; + break; + } + case ACTION_IMMEDIATE: + { + suffix[0] = '~'; + break; + } + default: + { + cw_not_reached(); + } + } + + nxoe_p_thread_syntax_error(a_thread, a_threadp, + defer_base, "", suffix, + c); + if (a_token) + { + goto RETURN; + } + } + if (restart) + { + goto RESTART; + } + break; + } + default: + { + CW_NXO_THREAD_PUTC(c); + break; + } + } + break; + } + default: + { + cw_not_reached(); + } + } + } + + retval = i; + RETURN: + if (a_token) + { + a_thread->defer_count--; + } + return retval; +} + +static void +nxoe_p_thread_tok_str_expand(cw_nxoe_thread_t *a_thread) +{ + cw_nxa_t *nxa; + + nxa = nx_nxa_get(a_thread->nx); + + if (a_thread->index == CW_NXO_THREAD_BUFFER_SIZE) + { + /* First overflow, initial expansion needed. */ + a_thread->tok_str = (cw_uint8_t *) nxa_malloc(nxa, a_thread->index * 2); + a_thread->buffer_len = a_thread->index * 2; + memcpy(a_thread->tok_str, a_thread->buffer, a_thread->index); + } + else if (a_thread->index == a_thread->buffer_len) + { + cw_uint8_t *t_str; + + /* Overflowed, and additional expansion needed. */ + t_str = (cw_uint8_t *) nxa_malloc(nxa, a_thread->index * 2); + a_thread->buffer_len = a_thread->index * 2; + memcpy(t_str, a_thread->tok_str, a_thread->index); + nxa_free(nxa, a_thread->tok_str, a_thread->index); + a_thread->tok_str = t_str; + } +} + +/* Create a string that represents the code that caused the syntax error and + * push it onto ostack. This means that syntax errors cause two objects to be + * pushed onto ostack rather than just the standard one, but if we don't do + * this, the invalid code gets lost forever. + * + * If a_c is -1, no current character is inserted into the error string. This + * is necessary for syntax errors at EOF. */ +static void +nxoe_p_thread_syntax_error(cw_nxoe_thread_t *a_thread, + cw_nxo_threadp_t *a_threadp, + cw_uint32_t a_defer_base, cw_uint8_t *a_prefix, + cw_uint8_t *a_suffix, cw_sint32_t a_c) +{ + cw_nxo_t *nxo; + cw_uint32_t defer_count, line, column; + + nxo = nxo_stack_push(&a_thread->ostack); + +#ifdef CW_THREADS + nxo_string_new(nxo, a_thread->nx, a_thread->locking, + strlen((char *) a_prefix) + a_thread->index + + strlen((char *) a_suffix) + ((a_c >= 0) ? 1 : 0)); +#else + nxo_string_new(nxo, a_thread->nx, FALSE, + strlen((char *) a_prefix) + a_thread->index + + strlen((char *) a_suffix) + ((a_c >= 0) ? 1 : 0)); +#endif + nxo_attr_set(nxo, NXOA_EXECUTABLE); + + /* Prefix. */ + nxo_string_set(nxo, 0, a_prefix, strlen((char *) a_prefix)); + + /* Main text. */ + nxo_string_set(nxo, strlen((char *) a_prefix), a_thread->tok_str, + a_thread->index); + + /* Suffix. */ + nxo_string_set(nxo, strlen((char *) a_prefix) + a_thread->index, a_suffix, + strlen((char *) a_suffix)); + + /* Current character, if any. */ + if (a_c >= 0) + { + cw_uint8_t c = (cw_uint8_t) a_c; + + nxo_string_set(nxo, strlen((char *) a_prefix) + a_thread->index + + strlen((char *) a_suffix), &c, 1); + } + + nxoe_p_thread_reset(a_thread); + + /* Push line and column onto ostack. They are used in the embedded onyx + * code below to set line and column in currenterror. */ + nxo_threadp_position_get(a_threadp, &line, &column); + + /* line. */ + nxo = nxo_stack_push(&a_thread->ostack); + nxo_integer_new(nxo, (cw_nxoi_t) line); + + /* column. */ + nxo = nxo_stack_push(&a_thread->ostack); + /* If the syntax error happened at a newline, the column number won't be + * correct, so use 0. */ + if (column == -1) + { + nxo_integer_new(nxo, 0); + } + else + { + nxo_integer_new(nxo, (cw_nxoi_t) column); + } + + /* Shut off deferral temporarily. It is possible for this C stack frame to + * never be returned to, due to an exception (stop, quit, exit), in which + * case, deferral will never be turned back on. That's fine, since the user + * is going to have to patch things up by hand in that case anyway. */ + defer_count = a_thread->defer_count; + a_thread->defer_count = 0; + + cw_onyx_code(&a_thread->self, + "currenterror begin $column exch def $line exch def end" + " $syntaxerror throw"); + + + /* Turn deferral back on. */ + a_thread->defer_count = defer_count; +} + +static void +nxoe_p_thread_reset(cw_nxoe_thread_t *a_thread) +{ + a_thread->state = THREADTS_START; + if (a_thread->index > CW_NXO_THREAD_BUFFER_SIZE) + { + nxa_free(nx_nxa_get(a_thread->nx), a_thread->tok_str, + a_thread->buffer_len); + a_thread->tok_str = a_thread->buffer; + } + a_thread->index = 0; +} + +static cw_bool_t +nxoe_p_thread_integer_accept(cw_nxoe_thread_t *a_thread) +{ + cw_bool_t retval; + + if (a_thread->m.n.whole) + { + cw_nxo_t *nxo; + cw_nxoi_t val; + cw_uint32_t i; + cw_uint64_t threshold, maxlast, sum, digit; + cw_uint8_t c; + + /* Determine threshold value at which overflow is a risk. If the + * threshold is exceeded, then overflow occurred. If the threshold + * value is reached and the next digit exceeds a certain value + * (maxlast), overflow occurred. */ + if (a_thread->m.n.mant_neg) + { + threshold = 0x8000000000000000ULL; + } + else + { + threshold = 0x7fffffffffffffffULL; + } + maxlast = threshold % a_thread->m.n.radix_base; + threshold /= a_thread->m.n.radix_base; + + /* Iterate from right to left through the digits. */ + sum = 0; + for (i = 0; i < a_thread->m.n.whole_len; i++) + { + c = CW_NXO_THREAD_GETC(a_thread->m.n.whole_off + i); + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + { + digit = 10 + ((cw_uint64_t) (c - 'a')); + break; + } + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + { + digit = 10 + ((cw_uint64_t) (c - 'A')); + break; + } + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + { + digit = (cw_uint64_t) (c - '0'); + /* Fall through. */ + } + default: + { + break; + } + } + + if ((sum > threshold) || (sum == threshold && digit > maxlast)) + { + /* Overflow. */ + retval = TRUE; + goto RETURN; + } + + sum *= a_thread->m.n.radix_base; + sum += digit; + } + + if (a_thread->m.n.mant_neg) + { + val = -sum; + } + else + { + val = sum; + } + + /* Create an integer on ostack. */ + nxo = nxo_stack_push(&a_thread->ostack); + nxo_integer_new(nxo, val); + nxoe_p_thread_reset(a_thread); + } + else + { + /* No number specified. */ + retval = TRUE; + goto RETURN; + } + + retval = FALSE; + RETURN: + return retval; +} + +#ifdef CW_REAL +static cw_bool_t +nxoe_p_thread_real_accept(cw_nxoe_thread_t *a_thread) +{ + cw_bool_t retval; + cw_nxo_t *nxo; + cw_nxor_t val; + + /* Convert string to real. Do the conversion before mucking with the stack + * in case there is a conversion error. + * + * The state created by the scanner is enough to allow us to do the + * conversion more efficiently than possible via strtod(), but the + * conversion process is quite complex, so just use strtod(). + */ + a_thread->tok_str[a_thread->index] = '\0'; + errno = 0; + val = strtod(a_thread->tok_str, NULL); + if (errno == ERANGE && (val == HUGE_VAL || val == -HUGE_VAL)) + { + retval = TRUE; + goto RETURN; + } + + /* Create a real on ostack. */ + nxo = nxo_stack_push(&a_thread->ostack); + nxo_real_new(nxo, val); + nxoe_p_thread_reset(a_thread); + + retval = FALSE; + RETURN: + return retval; +} +#endif + +static void +nxoe_p_thread_procedure_accept(cw_nxoe_thread_t *a_thread) +{ + cw_nxo_t *tnxo, *nxo; + cw_uint32_t nelements, i, depth; + + /* Find the pmark. */ + for (i = 0, depth = nxo_stack_count(&a_thread->ostack), nxo = NULL; + i < depth; + i++) + { + nxo = nxo_stack_down_get(&a_thread->ostack, nxo); + if (nxo_type_get(nxo) == NXOT_PMARK) + { + break; + } + } + cw_assert(i < depth); + + /* i is the index of the mark, and nxo points to the mark. Set nelements + * accordingly. When we pop the nxo's off the stack, we'll have to pop + * (nelements + 1) nxo's. */ + nelements = i; + + tnxo = nxo_stack_push(&a_thread->tstack); +#ifdef CW_THREADS + nxo_array_new(tnxo, a_thread->nx, a_thread->locking, nelements); +#else + nxo_array_new(tnxo, a_thread->nx, FALSE, nelements); +#endif + nxo_attr_set(tnxo, NXOA_EXECUTABLE); + + /* Traverse down the stack, moving nxo's to the array. */ + for (i = nelements, nxo = NULL; i > 0; i--) + { + nxo = nxo_stack_down_get(&a_thread->ostack, nxo); + nxo_array_el_set(tnxo, nxo, i - 1); + } + + /* Pop the nxo's off the stack now. */ + nxo_stack_npop(&a_thread->ostack, nelements + 1); + + /* Push the array onto the stack. */ + nxo = nxo_stack_push(&a_thread->ostack); + nxo_dup(nxo, tnxo); + nxo_stack_pop(&a_thread->tstack); +} + +static void +nxoe_p_thread_name_accept(cw_nxoe_thread_t *a_thread) +{ + cw_nxo_t *nxo; + + switch (a_thread->m.m.action) + { + case ACTION_EXECUTE: + case ACTION_EVALUATE: + { + if (a_thread->defer_count == 0) + { + /* Find the the value associated with the name in the dictionary + * stack, push it onto the execution stack, and run the + * execution loop. */ + nxo = nxo_stack_push(&a_thread->estack); + nxo_name_new(nxo, a_thread->nx, a_thread->tok_str, + a_thread->index, FALSE); + nxo_attr_set(nxo, a_thread->m.m.action); + + nxoe_p_thread_reset(a_thread); + nxo_thread_loop(&a_thread->self); + } + else + { + /* Push the name object onto the operand stack. */ + nxo = nxo_stack_push(&a_thread->ostack); + nxo_name_new(nxo, a_thread->nx, a_thread->tok_str, + a_thread->index, FALSE); + nxo_attr_set(nxo, a_thread->m.m.action); + nxoe_p_thread_reset(a_thread); + } + break; + } + case ACTION_LITERAL: + { + /* Push the name object onto the operand stack. */ + nxo = nxo_stack_push(&a_thread->ostack); + nxo_name_new(nxo, a_thread->nx, a_thread->tok_str, a_thread->index, + FALSE); + nxoe_p_thread_reset(a_thread); + break; + } + case ACTION_IMMEDIATE: + { + cw_nxo_t *key; + + /* Find the value associated with the name in the dictionary stack + * and push the value onto the operand stack. */ + key = nxo_stack_push(&a_thread->tstack); + nxo_name_new(key, a_thread->nx, a_thread->tok_str, a_thread->index, + FALSE); + nxoe_p_thread_reset(a_thread); + + nxo = nxo_stack_push(&a_thread->ostack); + if (nxo_thread_dstack_search(&a_thread->self, key, nxo)) + { + /* Push the name onto ostack before throwing the error. This + * results in both the name and the source being pushed onto + * ostack, which is useful, depending on the source. */ + nxo_dup(nxo, key); + + /* Reset the deferral count before throwing the error. */ + a_thread->defer_count = 0; + + nxo_thread_nerror(&a_thread->self, NXN_undefined); + } + else if (nxo_type_get(nxo) == NXOT_ARRAY + && nxo_attr_get(nxo) == NXOA_EXECUTABLE) + { + /* Set the evaluatable attribute so that the array will still be + * executed when interpreted. */ + nxo_attr_set(nxo, NXOA_EVALUATABLE); + } + nxo_stack_pop(&a_thread->tstack); + + break; + } + default: + { + cw_not_reached(); + } + } +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread.nx.in b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread.nx.in new file mode 100644 index 000000000..b50a20ac4 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread.nx.in @@ -0,0 +1,152 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# This file is processed by nxo_thread_gen.nx to produce a more compact +# embedded version in nxo_thread_nxcode.c (normal build) and +# nxo_thread_bootstrap.c (development bootstrap). In order to make changes to +# this file take effect in the bootstrap interpreter, either type: +# +# cook bootstrap +# +# or +# +# cat nxo_thread.nx | onyx nxo_thread_gen.nx > nxo_thread_boostrap.c +# +# The end result of executing this file is a procedure (executable array). In +# order to support output that differs according to configuration options, a +# string is constructed, then evaluated. +# +# The output of running sprints on the procedure must be evaluatable, which +# means that certain language features such as immediate evaluation must be +# avoided. +# +################################################################################ + +# Initial string with an opening brace to defer execution, to which other +# strings are catenated. +`{' + +` +# userdict does not exist yet. This code pushes it onto dstack, then defines it +# in threaddict. +dict begin +$userdict currentdict +dstack dup sbdup dup spop begin pop +$threaddict currentdict def +def + +# Define and initialize currenterror. +$currenterror < + $newerror false + $errorname `' + $estack stack + $istack stack + $ostack stack + $dstack stack + $line 1 + $column 0 +> def + +# Define and initialize errordict. +$errordict < + $stop $stop load + + # - handleerror - + $handleerror { + !currenterror begin + + # If this is a syntaxerror, print the line and column numbers. + !errorname $syntaxerror eq { + stderr dup `At line ' {write}{} until + dup !line cvs {write}{} until + dup `, column ' {write}{} until + dup !column cvs {write}{} until + `: ' {write}{} until + } if + + # Print the errorname. + stderr dup `Error ' {write}{} until + dup !errorname 1 sprints {write}{} until + + # Print ostack and dstack using sprint. + dup `\nostack: ' {write}{} until + dup !ostack 1 sprints {write}{} until + dup `\ndstack: ' {write}{} until + dup !dstack 1 sprints {write}{} until + `\n' {write}{} until + + # Print a stack trace that depicts the currently executing element of + # arrays. + !estack scount 1 sub dup 0 gt { + stderr dup `estack/istack trace (0..' {write}{} until + over cvs stderr exch {write}{} until + `):\n' {write}{} until + } if + + # For each element in estack: + 0 1 dn { + # #edepth + # If this element is an array, print it specially. + dup cvs stderr exch {write}{} until + dup !estack dup dn sidup spop + # #edepth #array + + dup type $arraytype eq { + # Array. + `: {\n' stderr exch {write}{} until + # #edepth #array + dup length 1 sub 0 1 dn { + # #edepth #array #aindex + 2 idup !istack + dup dn sidup spop + # #edepth #array #aindex #iindex + over + # #edepth #array #aindex #iindex #aindex + eq { + dup <$w 3> outputs + stderr exch {write}{} until + `:--> ' + }{ + `\t' + } ifelse + stderr exch {write}{} until + # #edepth #array #aindex + over exch get 1 sprints + stderr exch {write}{} until + stderr `\n' {write}{} until + # #edepth #array + } for + stderr `}\n' {write}{} until + # #edepth #array + pop + # #edepth + }{ + # Non-array. + stderr `:\t' {write}{} until + # #edepth #array + 1 sprints stderr exch {write}{} until + stderr `\n' {write}{} until + # #edepth + } ifelse + # #edepth + pop + } for + + end # currenterror. + + # Make sure the output gets written before stop. + flush + } bind +> def + +end # threaddict. +' cat + +# Final closing brace. +`}' cat cvx eval diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread_bootstrap.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread_bootstrap.c new file mode 100644 index 000000000..acabce005 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread_bootstrap.c @@ -0,0 +1,20 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "libonyx/libonyx.h" + +void +nxo_p_thread_nxcode(cw_nxo_t *a_thread) +{ + cw_onyx_code(a_thread, "{dict begin $userdict currentdict dstack dup sbdup dup spop begin pop $threaddict currentdict def def $currenterror < $newerror false $errorname `' $estack stack $istack stack $ostack stack $dstack stack $line 1 $column 0 > def $errordict < $stop $stop load $handleerror {!currenterror begin !errorname $syntaxerror eq {stderr dup `At line ' {write} {} until dup !line cvs {write} {} until dup `, column ' {write} {} until dup !column cvs {write} {} until `: ' {write} {} until} if stderr dup `Error ' {write} {} until dup !errorname 1 sprints {write} {} until dup `\nostack: ' {write} {} until dup !ostack 1 sprints {write} {} until dup `\ndstack: ' {write} {} until dup !dstack 1 sprints {write} {} until `\n' {write} {} until !estack scount 1 sub dup 0 gt {stderr dup `estack/istack trace (0..' {write} {} until over cvs stderr exch {write} {} until `):\n' {write} {} until} if 0 1 dn {dup cvs stderr exch {write} {} until dup !estack dup dn sidup spop dup type $arraytype eq {`: {\n' stderr exch {write} {} until dup length 1 sub 0 1 dn {2 idup !istack dup dn sidup spop over eq {dup < $w 3 > outputs stderr exch {write} {} until `:--> '} {`\t'} ifelse stderr exch {write} {} until over exch get 1 sprints stderr exch {write} {} until stderr `\n' {write} {} until} for stderr `}\n' {write} {} until pop} {stderr `:\t' {write} {} until 1 sprints stderr exch {write} {} until stderr `\n' {write} {} until} ifelse pop} for end flush} bind > def end}eval"); +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread_gen.nx b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread_gen.nx new file mode 100644 index 000000000..8ff6d00be --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/nxo_thread_gen.nx @@ -0,0 +1,48 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +# Read onyx code from stdin and output a compacted version to stdout. The +# output code defines the C function nxo_p_thread_nxcode(). +# +# This program is run by the 'bootstrap' build system target. +# +################################################################################ + +# Output the header. +`/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + * This file is automatically generated. + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "libonyx/libonyx.h" + +void +nxo_p_thread_nxcode(cw_nxo_t *a_thread) +{ + cw_onyx_code(a_thread, "' print + +# Read in the code. +stdin cvx eval + +# Output the procedure, using a recursion depth large enough to meet or exceed +# the depth of nested braces in the code. +1000 sprints print + +# Output the footer. +`eval"); +} +' print diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/poll.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/poll.c new file mode 100644 index 000000000..0807f12bb --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/poll.c @@ -0,0 +1,204 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Compatibility shim for poll() that uses select(). + * + ******************************************************************************/ + +#include +#include +#include +#include + +struct pollfd +{ + int fd; + short events; + short revents; +}; + +#define POLLIN 0x0001 +#define POLLRDNORM 0x0002 +#define POLLRDBAND 0x0004 +#define POLLPRI 0x0008 +#define POLLOUT 0x0010 +#define POLLWRNORM 0x0020 +#define POLLWRBAND 0x0040 +#define POLLERR 0x0080 +#define POLLHUP 0x0100 +#define POLLNVAL 0x0200 + +static int +poll(struct pollfd *fds, unsigned int nfds, int timeout) +{ + int retval, maxfd = 0; + fd_set rfds, wfds, efds, ifds; + struct timeval *tout, toutbuf; + unsigned i; + + FD_ZERO(&ifds); + + /* Loop in the case of a select() error due to an exceptional event. */ + while (1) + { + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + + /* Iterate through fds and set appropriate bits in rfds, wfds, and efds + * in preparation for the select() call. */ + for (i = 0; i < nfds; i++) + { + cw_assert(fds[i].fd >= 0); + + /* Only process this element if it was not marked to be ignored. */ + if (FD_ISSET(fds[i].fd, &ifds) == 0) + { + /* Check for read events? */ + if (fds[i].events & (POLLIN | POLLRDNORM)) + { + FD_SET(fds[i].fd, &rfds); + if (fds[i].fd > maxfd) + { + maxfd = fds[i].fd; + } + } + + /* Check for write events? */ + if (fds[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND)) + { + FD_SET(fds[i].fd, &wfds); + if (fds[i].fd > maxfd) + { + maxfd = fds[i].fd; + } + } + + /* Check for exceptional events? */ + if (fds[i].events & (POLLRDBAND | POLLPRI)) + { + FD_SET(fds[i].fd, &efds); + if (fds[i].fd > maxfd) + { + maxfd = fds[i].fd; + } + } + + /* Clear revents. */ + fds[i].revents = 0; + } + } + + /* Convert timeout. */ + if (timeout >= 0) + { + toutbuf.tv_sec = timeout / 1000; + toutbuf.tv_usec = (timeout % 1000) * 1000; + tout = &toutbuf; + } + else + { + tout = NULL; + } + + /* Make the call. */ + retval = select(maxfd + 1, &rfds, &wfds, &efds, tout); + + /* Check for an error, and retry if the error is due to an invalid file + * descriptor. */ + if (retval != -1) + { + break; + } + else + { + if (errno == EBADF) + { + struct stat buf; + + /* Determine which file descriptor caused the error. Multiple + * errors cause multiple iterations through the enclosing while + * loop. */ + for (i = 0; i < nfds; i++) + { + retval = fstat(fds[i].fd, &buf); + if (retval == -1 && errno == EBADF) + { + FD_SET(fds[i].fd, &ifds); + continue; + } + } + continue; + } + else + { + goto RETURN; + } + } + } + + /* Iterate through fds and check if interesting bits were set by + * select(). */ + for (i = retval = 0; i < nfds; i++) + { + if (FD_ISSET(fds[i].fd, &ifds)) + { + fds[i].revents = POLLNVAL; + } + else + { + if (FD_ISSET(fds[i].fd, &rfds)) + { + if (fds[i].events & POLLIN) + { + fds[i].revents |= POLLIN; + } + if (fds[i].events & POLLRDNORM) + { + fds[i].revents |= POLLRDNORM; + } + } + if (FD_ISSET(fds[i].fd, &wfds)) + { + if (fds[i].events & POLLOUT) + { + fds[i].revents |= POLLOUT; + } + if (fds[i].events & POLLWRNORM) + { + fds[i].revents |= POLLWRNORM; + } + if (fds[i].events & POLLWRBAND) + { + fds[i].revents |= POLLWRBAND; + } + } + if (FD_ISSET(fds[i].fd, &efds)) + { + if (fds[i].events & POLLRDBAND) + { + fds[i].revents |= POLLRDBAND; + } + if (fds[i].events & POLLPRI) + { + fds[i].revents |= POLLPRI; + } + } + } + + if (fds[i].revents != 0) + { + retval++; + } + } + + RETURN: + return retval; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/systemdict.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/systemdict.c new file mode 100644 index 000000000..3942cede5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/systemdict.c @@ -0,0 +1,12975 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#define CW_SYSTEMDICT_C_ + +#include "../include/libonyx/libonyx.h" + +#include +#include /* For realtime operator. */ +#include /* For nanosleep(). */ +#include +#include +#include +#include +#include +#include +#include /* For dirforeach operator. */ +#ifdef CW_SOCKET +#include +#include +#include +#ifndef CW_HAVE_SOCKLEN_T +/* socklen_t is missing on Mac OS X <= 10.2. */ +typedef int socklen_t; +#endif +#endif +#ifdef CW_REAL +#ifndef HAVE_ASPRINTF +#include "asprintf.c" +#endif +#endif +#ifdef CW_MODULES +#include /* For modload operator. */ +#endif +#ifdef CW_POSIX +#ifdef HAVE_POLL +#include +#else +#include "poll.c" +#endif +#endif +#ifdef CW_REAL +#include +#endif + +#include "../include/libonyx/nxa_l.h" +#include "../include/libonyx/nxo_l.h" +#include "../include/libonyx/nxo_array_l.h" +#include "../include/libonyx/nxo_operator_l.h" +#ifdef CW_REGEX +#include "../include/libonyx/nxo_regex_l.h" +#endif +#include "../include/libonyx/nxo_thread_l.h" + +#ifdef CW_SOCKET +struct cw_systemdict_name_arg +{ + cw_nxn_t nxn; + int arg; +}; + +/* Compare a_name to the names in a_arg. If successful, return the index of the + * matching element. Otherwise, return a_argcnt. */ +static cw_uint32_t +systemdict_p_name_arg(cw_nxo_t *a_name, + const struct cw_systemdict_name_arg *a_arg, + cw_uint32_t a_argcnt) +{ + const cw_uint8_t *str; + cw_uint32_t len, i; + + cw_assert(nxo_type_get(a_name) == NXOT_NAME); + + str = nxo_name_str_get(a_name); + len = nxo_name_len_get(a_name); + for (i = 0; i < a_argcnt; i++) + { + if (nxn_len(a_arg[i].nxn) == len + && memcmp(nxn_str(a_arg[i].nxn), str, len) == 0) + { + break; + } + } + + return i; +} +#endif + +struct cw_systemdict_entry +{ + cw_nxn_t nxn; + cw_op_t *op_f; +}; + +#define ENTRY(name) {NXN_##name, systemdict_##name} + +/* Array of operators in systemdict. */ +static const struct cw_systemdict_entry systemdict_ops[] = { + ENTRY(abs), +#ifdef CW_SOCKET + ENTRY(accept), +#endif +#ifdef CW_REAL + ENTRY(acos), + ENTRY(acosh), +#endif + ENTRY(add), + ENTRY(adn), + ENTRY(and), + ENTRY(array), +#ifdef CW_REAL + ENTRY(asin), + ENTRY(asinh), + ENTRY(atan), + ENTRY(atan2), + ENTRY(atanh), +#endif + ENTRY(aup), + ENTRY(bdup), + ENTRY(begin), + ENTRY(bind), +#ifdef CW_SOCKET + ENTRY(bindsocket), +#endif + ENTRY(bpop), +#ifdef CW_THREADS + ENTRY(broadcast), +#endif + ENTRY(bytesavailable), + ENTRY(cat), +#ifdef CW_POSIX + ENTRY(cd), +#endif +#ifdef CW_REAL + ENTRY(ceiling), +#endif +#ifdef CW_POSIX + ENTRY(chmod), + ENTRY(chown), + ENTRY(chroot), +#endif + ENTRY(clear), + ENTRY(cleartomark), +#ifdef CW_POSIX + ENTRY(close), +#endif +#ifdef CW_THREADS + ENTRY(condition), +#endif +#ifdef CW_SOCKET + ENTRY(connect), +#endif + ENTRY(copy), +#ifdef CW_REAL + ENTRY(cos), + ENTRY(cosh), +#endif + ENTRY(count), + ENTRY(countdstack), + ENTRY(countestack), + ENTRY(counttomark), + ENTRY(currentdict), +#ifdef CW_THREADS + ENTRY(currentlocking), +#endif +#ifdef CW_REAL + ENTRY(cvds), +#endif + ENTRY(cve), +#ifdef CW_REAL + ENTRY(cves), +#endif + ENTRY(cvlit), + ENTRY(cvn), + ENTRY(cvrs), + ENTRY(cvs), + ENTRY(cvx), + ENTRY(dec), + ENTRY(def), +#ifdef CW_THREADS + ENTRY(detach), +#endif + ENTRY(dict), + ENTRY(die), +#ifdef CW_POSIX + ENTRY(dirforeach), +#endif +#ifdef CW_REAL + ENTRY(div), +#endif + ENTRY(dn), + ENTRY(dstack), + ENTRY(dup), + ENTRY(echeck), +#ifdef CW_POSIX + ENTRY(egid), +#endif + ENTRY(end), + ENTRY(eq), + ENTRY(estack), +#ifdef CW_POSIX + ENTRY(euid), +#endif + ENTRY(eval), + ENTRY(exch), +#ifdef CW_POSIX + ENTRY(exec), +#endif + ENTRY(exit), +#ifdef CW_REAL + ENTRY(exp), + ENTRY(floor), +#endif + ENTRY(flush), + ENTRY(flushfile), + ENTRY(for), + ENTRY(foreach), +#ifdef CW_POSIX + ENTRY(forkexec), +#endif + ENTRY(ge), + ENTRY(get), + ENTRY(getinterval), +#ifdef CW_POSIX + ENTRY(gid), +#endif +#ifdef CW_THREADS + ENTRY(gstderr), + ENTRY(gstdin), + ENTRY(gstdout), +#endif + ENTRY(gt), + ENTRY(hooktag), + ENTRY(ibdup), + ENTRY(ibpop), + ENTRY(idiv), + ENTRY(idup), + ENTRY(if), + ENTRY(ifelse), + ENTRY(inc), + ENTRY(iobuf), + ENTRY(ipop), + ENTRY(istack), +#ifdef CW_THREADS + ENTRY(join), +#endif + ENTRY(known), +#ifdef CW_THREADS + ENTRY(lcheck), +#endif + ENTRY(le), + ENTRY(length), +#ifdef CW_POSIX + ENTRY(link), +#endif +#ifdef CW_SOCKET + ENTRY(listen), +#endif +#ifdef CW_REAL + ENTRY(ln), +#endif + ENTRY(load), +#ifdef CW_THREADS + ENTRY(lock), +#endif +#ifdef CW_REAL + ENTRY(log), +#endif + ENTRY(loop), + ENTRY(lt), +#ifdef CW_REGEX + ENTRY(match), +#endif +#ifdef CW_POSIX + ENTRY(mkdir), + ENTRY(mkfifo), +#endif + ENTRY(mod), +#ifdef CW_MODULES + ENTRY(modload), +#endif +#ifdef CW_THREADS + ENTRY(monitor), +#endif + ENTRY(mul), +#ifdef CW_THREADS + ENTRY(mutex), +#endif + ENTRY(nbpop), + ENTRY(ncat), + ENTRY(ndn), + ENTRY(ndup), + ENTRY(ne), + ENTRY(neg), + ENTRY(nip), + ENTRY(nonblocking), + ENTRY(not), + ENTRY(npop), +#ifdef CW_POSIX + ENTRY(nsleep), +#endif + ENTRY(nup), +#ifdef CW_REGEX + ENTRY(offset), +#endif +#ifdef CW_POSIX + ENTRY(open), +#endif + ENTRY(or), + ENTRY(ostack), + ENTRY(over), +#ifdef CW_SOCKET + ENTRY(peername), +#endif +#ifdef CW_POSIX + ENTRY(pid), + ENTRY(pipe), + ENTRY(poll), +#endif + ENTRY(pop), + ENTRY(pow), +#ifdef CW_POSIX + ENTRY(ppid), +#endif + ENTRY(print), + ENTRY(put), + ENTRY(putinterval), +#ifdef CW_POSIX + ENTRY(pwd), +#endif + ENTRY(quit), + ENTRY(rand), + ENTRY(read), + ENTRY(readline), +#ifdef CW_POSIX + ENTRY(readlink), + ENTRY(realtime), +#endif +#ifdef CW_SOCKET + ENTRY(recv), +#endif +#ifdef CW_REGEX + ENTRY(regex), + ENTRY(regsub), +#endif +#ifdef CW_POSIX + ENTRY(rename), +#endif + ENTRY(repeat), +#ifdef CW_POSIX + ENTRY(rmdir), +#endif + ENTRY(roll), + ENTRY(rot), +#ifdef CW_REAL + ENTRY(round), +#endif + ENTRY(sadn), + ENTRY(saup), + ENTRY(sbdup), + ENTRY(sbpop), + ENTRY(sbpush), + ENTRY(sclear), + ENTRY(scleartomark), + ENTRY(scount), + ENTRY(scounttomark), + ENTRY(sdn), + ENTRY(sdup), +#ifdef CW_POSIX + ENTRY(seek), +#endif + ENTRY(self), +#ifdef CW_SOCKET + ENTRY(send), + ENTRY(serviceport), +#endif +#ifdef CW_POSIX + ENTRY(setegid), + ENTRY(setenv), + ENTRY(seteuid), + ENTRY(setgid), +#endif +#ifdef CW_THREADS + ENTRY(setgstderr), + ENTRY(setgstdin), + ENTRY(setgstdout), +#endif + ENTRY(setiobuf), +#ifdef CW_THREADS + ENTRY(setlocking), +#endif + ENTRY(setnonblocking), +#ifdef CW_SOCKET + ENTRY(setsockopt), +#endif + ENTRY(setstderr), + ENTRY(setstdin), + ENTRY(setstdout), +#ifdef CW_POSIX + ENTRY(setuid), +#endif + ENTRY(sexch), + ENTRY(shift), + ENTRY(sibdup), + ENTRY(sibpop), + ENTRY(sidup), +#ifdef CW_THREADS + ENTRY(signal), +#endif +#ifdef CW_REAL + ENTRY(sin), + ENTRY(sinh), +#endif + ENTRY(sipop), + ENTRY(snbpop), + ENTRY(sndn), + ENTRY(sndup), + ENTRY(snip), + ENTRY(snpop), + ENTRY(snup), +#ifdef CW_SOCKET + ENTRY(socket), + ENTRY(socketpair), + ENTRY(sockname), + ENTRY(sockopt), +#endif + ENTRY(sover), +#ifdef CW_REGEX + ENTRY(split), +#endif + ENTRY(spop), + ENTRY(spush), +#ifdef CW_REAL + ENTRY(sqrt), +#endif +#ifdef CW_POSIX + ENTRY(srand), +#endif + ENTRY(sroll), + ENTRY(srot), + ENTRY(stack), + ENTRY(start), +#ifdef CW_POSIX + ENTRY(status), +#endif + ENTRY(stderr), + ENTRY(stdin), + ENTRY(stdout), + ENTRY(stop), + ENTRY(stopped), + ENTRY(string), + ENTRY(stuck), + ENTRY(sub), +#ifdef CW_REGEX + ENTRY(submatch), + ENTRY(subst), +#endif + ENTRY(sunder), + ENTRY(sup), + ENTRY(sym_lp), + ENTRY(sym_rp), + ENTRY(sym_gt), + ENTRY(sym_rb), +#ifdef CW_POSIX + ENTRY(symlink), +#endif +#ifdef CW_REAL + ENTRY(tan), + ENTRY(tanh), +#endif + ENTRY(tell), +#ifdef CW_POSIX + ENTRY(test), +#endif +#ifdef CW_THREADS + ENTRY(thread), +#endif + ENTRY(threaddstack), + ENTRY(threadestack), + ENTRY(threadistack), + ENTRY(threadostack), +#ifdef CW_THREADS + ENTRY(threadsdict), + ENTRY(timedwait), +#endif + ENTRY(token), +#ifdef CW_REAL + ENTRY(trunc), +#endif +#ifdef CW_POSIX + ENTRY(truncate), +#endif +#ifdef CW_THREADS + ENTRY(trylock), +#endif + ENTRY(tuck), + ENTRY(type), +#ifdef CW_POSIX + ENTRY(uid), + ENTRY(umask), +#endif + ENTRY(undef), + ENTRY(under), +#ifdef CW_POSIX + ENTRY(unlink), +#endif +#ifdef CW_THREADS + ENTRY(unlock), +#endif +#ifdef CW_POSIX + ENTRY(unsetenv), +#endif + ENTRY(until), + ENTRY(up), +#ifdef CW_THREADS + ENTRY(wait), +#endif +#ifdef CW_POSIX + ENTRY(waitpid), +#endif + ENTRY(where), + ENTRY(while), + ENTRY(write), + ENTRY(xcheck), + ENTRY(xor) +#ifdef CW_THREADS + , + ENTRY(yield) +#endif +}; + +void +systemdict_l_populate(cw_nxo_t *a_dict, cw_nx_t *a_nx, int a_argc, + char **a_argv) +{ + cw_uint32_t i; + cw_nxo_t name, value; + +/* Number of names that are defined below, but not as operators. */ +#ifdef CW_POSIX +#define NEXTRA 12 +#else +#define NEXTRA 11 +#endif +#define NOPS \ + (sizeof(systemdict_ops) / sizeof(struct cw_systemdict_entry)) + + nxo_dict_new(a_dict, a_nx, TRUE, + NOPS + NEXTRA + CW_LIBONYX_SYSTEMDICT_HASH_SPARE); + + /* Operators. */ + for (i = 0; i < NOPS; i++) + { + nxo_name_new(&name, a_nx, nxn_str(systemdict_ops[i].nxn), + nxn_len(systemdict_ops[i].nxn), TRUE); + nxo_operator_new(&value, systemdict_ops[i].op_f, systemdict_ops[i].nxn); + nxo_attr_set(&value, NXOA_EXECUTABLE); + + nxo_dict_def(a_dict, a_nx, &name, &value); + } + + /* Initialize entries that are not operators. */ + + /* globaldict. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_globaldict), nxn_len(NXN_globaldict), + TRUE); + nxo_dup(&value, nx_globaldict_get(a_nx)); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* systemdict. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_systemdict), nxn_len(NXN_systemdict), + TRUE); + nxo_dup(&value, nx_systemdict_get(a_nx)); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* gcdict. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_gcdict), nxn_len(NXN_gcdict), TRUE); + nxo_dup(&value, nxa_gcdict_get(nx_nxa_get(a_nx))); + nxo_dict_def(a_dict, a_nx, &name, &value); + +#ifdef CW_POSIX + /* envdict. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_envdict), nxn_len(NXN_envdict), TRUE); + nxo_dup(&value, nx_envdict_get(a_nx)); + nxo_dict_def(a_dict, a_nx, &name, &value); +#endif + + /* onyxdict. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_onyxdict), nxn_len(NXN_onyxdict), + TRUE); + nxo_dict_new(&value, a_nx, TRUE, CW_LIBONYX_ONYXDICT_HASH); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* argv. */ + { + int i; + cw_sint32_t len; + cw_nxo_t argv_nxo, str_nxo; + cw_uint8_t *t_str; + + /* Create the argv array and populate it. */ + nxo_array_new(&argv_nxo, a_nx, TRUE, a_argc); + for (i = 0; i < a_argc; i++) + { + len = strlen(a_argv[i]); + nxo_string_new(&str_nxo, a_nx, TRUE, len); + t_str = nxo_string_get(&str_nxo); + memcpy(t_str, a_argv[i], len); + + nxo_array_el_set(&argv_nxo, &str_nxo, i); + } + + /* Insert argv into systemdict. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_argv), nxn_len(NXN_argv), TRUE); + nxo_dict_def(a_dict, a_nx, &name, &argv_nxo); + } + + /* true. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_true), nxn_len(NXN_true), TRUE); + nxo_boolean_new(&value, TRUE); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* false. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_false), nxn_len(NXN_false), TRUE); + nxo_boolean_new(&value, FALSE); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* mark. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_mark), nxn_len(NXN_mark), TRUE); + nxo_mark_new(&value); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* <. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_sym_lt), nxn_len(NXN_sym_lt), TRUE); + nxo_mark_new(&value); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* [. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_sym_lb), nxn_len(NXN_sym_lb), TRUE); + nxo_mark_new(&value); + nxo_dict_def(a_dict, a_nx, &name, &value); + + /* null. */ + nxo_name_new(&name, a_nx, nxn_str(NXN_null), nxn_len(NXN_null), TRUE); + nxo_null_new(&value); + nxo_dict_def(a_dict, a_nx, &name, &value); + + cw_assert(nxo_dict_count(a_dict) == NOPS + NEXTRA); +#undef NOPS +#undef NEXTRA +} + +void +systemdict_abs(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *a; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(a, ostack, a_thread); + switch (nxo_type_get(a)) + { + case NXOT_INTEGER: + { + if (nxo_integer_get(a) < 0) + { + nxo_integer_set(a, -nxo_integer_get(a)); + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + if (nxo_real_get(a) < 0) + { + nxo_real_set(a, -nxo_real_get(a)); + } + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +#ifdef CW_SOCKET +static cw_bool_t +systemdict_p_sock_family(cw_nxo_t *a_thread, int a_fd, cw_bool_t a_peer, + sa_family_t *r_family) +{ + cw_bool_t retval; + int error; +/* Stevens hard codes 128 in his unp.h header. This seems sketchy to me, but + * should work fine for the limited types of sockets Onyx supports. */ +#define CW_MAXSOCKADDR 128 + union + { + struct sockaddr sa; + char pad[CW_MAXSOCKADDR]; + } u; + socklen_t len; + + len = CW_MAXSOCKADDR; +#undef CW_MAXSOCKADDR + if (a_peer) + { + error = getpeername(a_fd, &u.sa, &len); + } + else + { + error = getsockname(a_fd, &u.sa, &len); + } + if (error == -1) + { + switch (errno) + { + case EBADF: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + retval = TRUE; + goto RETURN; + } + case ECONNRESET: + case ENOTCONN: + { + nxo_thread_nerror(a_thread, NXN_neterror); + retval = TRUE; + goto RETURN; + } + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + retval = TRUE; + goto RETURN; + } + case ENOBUFS: + { + xep_throw(CW_ONYXX_OOM); + /* Not reached. */ + } + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + retval = TRUE; + goto RETURN; + } + } + } + + *r_family = u.sa.sa_family; + + retval = FALSE; + RETURN: + return retval; +} + +void +systemdict_accept(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *sock; + sa_family_t family; + int sockfd; + socklen_t sockaddrlen; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(sock, ostack, a_thread); + if (nxo_type_get(sock) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Get the socket family. */ + if (systemdict_p_sock_family(a_thread, nxo_file_fd_get(sock), FALSE, + &family)) + { + return; + } + + switch (family) + { + case AF_INET: + { + struct sockaddr_in sockaddr; + + sockaddrlen = sizeof(sockaddr); + sockfd = accept(nxo_file_fd_get(sock), (struct sockaddr *)&sockaddr, + &sockaddrlen); + break; + } + case AF_LOCAL: + { + struct sockaddr_un sockaddr; + + sockaddrlen = sizeof(sockaddr); + sockfd = accept(nxo_file_fd_get(sock), (struct sockaddr *)&sockaddr, + &sockaddrlen); + break; + } + default: + { + cw_not_reached(); + } + } + + if (sockfd == -1) + { + switch (errno) + { + case ECONNABORTED: + { + nxo_thread_nerror(a_thread, NXN_neterror); + return; + } + case EINTR: + case EWOULDBLOCK: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case ENOTSOCK: + case EOPNOTSUPP: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + case EPERM: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + case EBADF: + case EFAULT: + case EINVAL: + case EMFILE: + case ENFILE: + case ENOBUFS: + case ENOMEM: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + nxo_file_new(sock, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_file_fd_wrap(sock, sockfd); +} +#endif + +#ifdef CW_REAL +void +systemdict_acos(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + if (fabs(real) > 1.0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_real_new(nxo, acos(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_acosh(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + if (real < 1.0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_real_new(nxo, acosh(real)); +} +#endif + +void +systemdict_add(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_nxoi_t integer_a, integer_b; +#ifdef CW_REAL + cw_bool_t do_real; + cw_nxor_t real_a, real_b; +#endif + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + do_real = FALSE; +#endif + integer_a = nxo_integer_get(nxo_a); + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + do_real = TRUE; + real_a = nxo_real_get(nxo_a); + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + if (do_real) + { + real_b = (cw_nxor_t) nxo_integer_get(nxo_b); + } + else +#endif + { + integer_b = nxo_integer_get(nxo_b); + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + real_b = nxo_real_get(nxo_b); + if (do_real == FALSE) + { + do_real = TRUE; + real_a = (cw_nxor_t) integer_a; + } + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + +#ifdef CW_REAL + if (do_real) + { + /* nxo_a may be an integer, so use nxo_real_new() rather than + * nxo_real_set(). */ + nxo_real_new(nxo_a, real_a + real_b); + } + else +#endif + { + nxo_integer_set(nxo_a, integer_a + integer_b); + } + + nxo_stack_pop(ostack); +} + +void +systemdict_adn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *bnxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_BGET(bnxo, ostack, a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, bnxo); + nxo_stack_bpop(ostack); +} + +void +systemdict_and(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + if (nxo_type_get(nxo_a) == NXOT_BOOLEAN + && nxo_type_get(nxo_b) == NXOT_BOOLEAN) + { + cw_bool_t and; + + if (nxo_boolean_get(nxo_a) && nxo_boolean_get(nxo_b)) + { + and = TRUE; + } + else + { + and = FALSE; + } + nxo_boolean_new(nxo_a, and); + } + else if (nxo_type_get(nxo_a) == NXOT_INTEGER + && nxo_type_get(nxo_b) == NXOT_INTEGER) + { + nxo_integer_set(nxo_a, nxo_integer_get(nxo_a) & nxo_integer_get(nxo_b)); + } + else + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_stack_pop(ostack); +} + +void +systemdict_array(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxoi_t len; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + len = nxo_integer_get(nxo); + if (len < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_array_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len); +} + +#ifdef CW_REAL +void +systemdict_asin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + if (fabs(real) > 1.0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_real_new(nxo, asin(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_asinh(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_real_new(nxo, asinh(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_atan(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_real_new(nxo, atan(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_atan2(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_x, *nxo_y; + cw_nxor_t x, y; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo_x, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_y, ostack, a_thread, nxo_x); + switch (nxo_type_get(nxo_y)) + { + case NXOT_INTEGER: + { + y = (cw_nxor_t) nxo_integer_get(nxo_y); + break; + } + case NXOT_REAL: + { + y = nxo_real_get(nxo_y); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_x)) + { + case NXOT_INTEGER: + { + x = (cw_nxor_t) nxo_integer_get(nxo_x); + break; + } + case NXOT_REAL: + { + x = nxo_real_get(nxo_x); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_real_new(nxo_y, atan2(y, x)); + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_REAL +void +systemdict_atanh(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + if (fabs(real) > 1.0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_real_new(nxo, atanh(real)); +} +#endif + +void +systemdict_aup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *bnxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + bnxo = nxo_stack_bpush(ostack); + nxo_dup(bnxo, nxo); + nxo_stack_pop(ostack); +} + +void +systemdict_bdup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *orig, *dup; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_BGET(orig, ostack, a_thread); + dup = nxo_stack_push(ostack); + nxo_dup(dup, orig); +} + +void +systemdict_begin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *dstack; + cw_nxo_t *nxo, *dict; + + dstack = nxo_thread_dstack_get(a_thread); + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(dict, ostack, a_thread); + if (nxo_type_get(dict) != NXOT_DICT) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo = nxo_stack_push(dstack); + nxo_dup(nxo, dict); + nxo_stack_pop(ostack); +} + +static void +systemdict_p_bind(cw_nxo_t *a_proc, cw_nxo_t *a_thread) +{ + cw_nxo_t *tstack; + cw_nxo_t *el, *val; + cw_uint32_t i, count; + cw_nxot_t type; + cw_nxoa_t attr; + + tstack = nxo_thread_tstack_get(a_thread); + + val = nxo_stack_push(tstack); + el = nxo_stack_push(tstack); + + nxo_l_array_bound_set(a_proc); + + for (i = 0, count = nxo_array_len_get(a_proc); i < count; i++) + { + nxo_array_el_get(a_proc, i, el); + attr = nxo_attr_get(el); + if (attr == NXOA_LITERAL) + { + continue; + } + + switch (nxo_type_get(el)) + { + case NXOT_ARRAY: + { + if (nxo_l_array_bound_get(el) == FALSE) + { + systemdict_p_bind(el, a_thread); + } + break; + } + case NXOT_NAME: + { + if (attr == NXOA_EVALUATABLE) + { + /* Do not bind evaluatable names. */ + continue; + } + + if (nxo_thread_dstack_search(a_thread, el, val) == FALSE) + { + type = nxo_type_get(val); + + /* Bind under any of the following conditions: + * + * 1) Literal object. + * + * 2) Operator. + * + * 3) Hook. + * + * 4) Array. (Set attribute to evaluatable.) */ + if (nxo_attr_get(val) == NXOA_LITERAL + || type == NXOT_OPERATOR || type == NXOT_HOOK) + { + nxo_array_el_set(a_proc, val, i); + } + else if (type == NXOT_ARRAY) + { + nxo_attr_set(val, NXOA_EVALUATABLE); + nxo_array_el_set(a_proc, val, i); + } + } + } + default: + { + break; + } + } + } + + nxo_stack_npop(tstack, 2); +} + +void +systemdict_bind(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *array; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(array, ostack, a_thread); + if (nxo_type_get(array) != NXOT_ARRAY) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + if (nxo_l_array_bound_get(array) == FALSE) + { + systemdict_p_bind(array, a_thread); + } +} + +#ifdef CW_SOCKET +void +systemdict_bindsocket(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *sock, *addr, *taddr; + cw_uint32_t npop; + sa_family_t family; + int sockport, error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(addr, ostack, a_thread); + if (nxo_type_get(addr) == NXOT_INTEGER) + { + sockport = nxo_integer_get(addr); + NXO_STACK_DOWN_GET(addr, ostack, a_thread, addr); + npop = 3; + } + else + { + /* Let the OS choose a port. */ + sockport = 0; + npop = 2; + } + NXO_STACK_DOWN_GET(sock, ostack, a_thread, addr); + if (nxo_type_get(sock) != NXOT_FILE || nxo_type_get(addr) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Get the socket family. */ + if (systemdict_p_sock_family(a_thread, nxo_file_fd_get(sock), FALSE, + &family)) + { + return; + } + + /* Create a '\0'-terminated copy of addr. */ + taddr = nxo_stack_push(tstack); + nxo_string_cstring(taddr, addr, a_thread); + + switch (family) + { + case AF_INET: + { + struct sockaddr_in sockaddr; + + /* Begin initialization of sockaddr. */ + memset(&sockaddr, 0, sizeof(struct sockaddr_in)); + sockaddr.sin_family = family; + sockaddr.sin_port = htons(sockport); + + error = inet_pton(family, nxo_string_get(taddr), + &sockaddr.sin_addr); + if (error < 0) + { + nxo_thread_nerror(a_thread, NXN_argcheck); + goto ERROR; + } + else if (error == 0) + { + struct hostent *ent; + struct in_addr *iaddr; + + /* Not a dotted number IP address. Try it as a hostname. */ +#ifdef CW_THREADS + mtx_lock(&cw_g_gethostbyname_mtx); +#endif + ent = gethostbyname(nxo_string_get(taddr)); + if (ent == NULL) + { +#ifdef CW_THREADS + mtx_unlock(&cw_g_gethostbyname_mtx); +#endif + nxo_thread_nerror(a_thread, NXN_argcheck); + goto ERROR; + } + + iaddr = (struct in_addr *) ent->h_addr_list[0]; + + sockaddr.sin_addr = *iaddr; + } + +#ifdef CW_THREADS + mtx_unlock(&cw_g_gethostbyname_mtx); +#endif + + /* Bind. */ + error = bind(nxo_file_fd_get(sock), + (struct sockaddr *) &sockaddr, + sizeof(sockaddr)); + + break; + } + case AF_LOCAL: + { + struct sockaddr_un sockaddr; + + if (npop == 3) + { + /* Port shouldn't be specified for a Unix domain socket. */ + nxo_thread_nerror(a_thread, NXN_typecheck); + goto ERROR; + } + + if (nxo_string_len_get(taddr) > sizeof(sockaddr.sun_path)) + { + /* Not enough room for path. */ + nxo_thread_nerror(a_thread, NXN_rangecheck); + goto ERROR; + } + + /* Initialize sockaddr. */ + memset(&sockaddr, 0, sizeof(struct sockaddr_un)); + sockaddr.sun_family = family; + memcpy(sockaddr.sun_path, nxo_string_get(taddr), + nxo_string_len_get(taddr)); + + /* Bind. */ + error = bind(nxo_file_fd_get(sock), + (struct sockaddr *) &sockaddr, + sizeof(sockaddr)); + + break; + } + default: + { + cw_not_reached(); + } + } + + /* Check for bind() error. */ + if (error == -1) + { + switch (errno) + { + case EADDRINUSE: + case EADDRNOTAVAIL: + { + nxo_thread_nerror(a_thread, NXN_neterror); + goto ERROR; + } + case EACCES: + case EINVAL: + case EIO: + case EISDIR: + case ELOOP: + case ENAMETOOLONG: + case ENOENT: + case EROFS: + case ENOTDIR: + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + goto ERROR; + } + case EAGAIN: + case EBADF: + case EFAULT: + case ENOMEM: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + goto ERROR; + } + } + } + + nxo_stack_npop(ostack, npop); + ERROR: + nxo_stack_pop(tstack); +} +#endif + +void +systemdict_bpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_BPOP(ostack, a_thread); +} + +#ifdef CW_THREADS +void +systemdict_broadcast(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *condition; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(condition, ostack, a_thread); + if (nxo_type_get(condition) != NXOT_CONDITION) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_condition_broadcast(condition); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_bytesavailable(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + cw_uint32_t bytes; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + bytes = nxo_file_buffer_count(file); + nxo_integer_new(file, bytes); +} + +void +systemdict_cat(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *a, *b, *r; + cw_uint32_t i, len_a, len_b; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(b, ostack, a_thread); + NXO_STACK_DOWN_GET(a, ostack, a_thread, b); + if (nxo_type_get(a) != nxo_type_get(b) + || (nxo_type_get(a) != NXOT_ARRAY + && nxo_type_get(a) != NXOT_STACK + && nxo_type_get(a) != NXOT_STRING)) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + r = nxo_stack_under_push(ostack, a); + + switch (nxo_type_get(a)) + { + case NXOT_ARRAY: + { + cw_nxo_t *tstack, *tnxo; + + tstack = nxo_thread_tstack_get(a_thread); + tnxo = nxo_stack_push(tstack); + + len_a = nxo_array_len_get(a); + len_b = nxo_array_len_get(b); + + nxo_array_new(r, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len_a + len_b); + + for (i = 0; i < len_a; i++) + { + nxo_array_el_get(a, i, tnxo); + nxo_array_el_set(r, tnxo, i); + } + for (i = 0; i < len_b; i++) + { + nxo_array_el_get(b, i, tnxo); + nxo_array_el_set(r, tnxo, i + len_a); + } + + nxo_stack_pop(tstack); + + break; + } + case NXOT_STACK: + { + cw_nxo_t *fr, *to; + + nxo_stack_new(r, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + + for (fr = nxo_stack_get(b); + fr != NULL; + fr = nxo_stack_down_get(b, fr)) + { + to = nxo_stack_bpush(r); + nxo_dup(to, fr); + } + for (fr = nxo_stack_get(a); + fr != NULL; + fr = nxo_stack_down_get(a, fr)) + { + to = nxo_stack_bpush(r); + nxo_dup(to, fr); + } + + break; + } + case NXOT_STRING: + { + len_a = nxo_string_len_get(a); + len_b = nxo_string_len_get(b); + + nxo_string_new(r, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len_a + len_b); + + nxo_string_lock(a); + nxo_string_set(r, 0, nxo_string_get(a), len_a); + nxo_string_unlock(a); + + nxo_string_lock(b); + nxo_string_set(r, len_a, nxo_string_get(b), len_b); + nxo_string_unlock(b); + + break; + } + default: + { + cw_not_reached(); + } + } + + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_POSIX +void +systemdict_cd(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *path, *tpath; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(path, ostack, a_thread); + if (nxo_type_get(path) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of the path with an extra byte to store a '\0' + * terminator. */ + tpath = nxo_stack_push(tstack); + nxo_string_cstring(tpath, path, a_thread); + + error = chdir(nxo_string_get(tpath)); + if (error == -1) + { + nxo_string_unlock(tpath); + switch (errno) + { + case EIO: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_invalidaccess); + } + } + goto ERROR; + } + + nxo_stack_pop(ostack); + + ERROR: + nxo_stack_pop(tstack); +} +#endif + +#ifdef CW_REAL +void +systemdict_ceiling(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + break; + } + case NXOT_REAL: + { + nxo_integer_new(nxo, (cw_nxoi_t) ceil(nxo_real_get(nxo))); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} +#endif + +#ifdef CW_POSIX +void +systemdict_chmod(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *file, *mode; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(mode, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, mode); + if ((nxo_type_get(mode) != NXOT_INTEGER) + || (nxo_type_get(file) != NXOT_FILE + && nxo_type_get(file) != NXOT_STRING)) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(mode) < 0 || nxo_integer_get(mode) > 0xfff) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + if (nxo_type_get(file) == NXOT_FILE) + { + int fd; + + fd = nxo_file_fd_get(file); + if (fd < 0) + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + + error = fchmod(fd, nxo_integer_get(mode)); + } + else + { + cw_nxo_t *tstack, *tfile; + + tstack = nxo_thread_tstack_get(a_thread); + + /* Create a copy of file with an extra byte to store a '\0' + * terminator. */ + tfile = nxo_stack_push(tstack); + nxo_string_cstring(tfile, file, a_thread); + + error = chmod(nxo_string_get(tfile), nxo_integer_get(mode)); + + nxo_stack_pop(tstack); + } + + if (error == -1) + { + switch (errno) + { + case EIO: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EACCES: +#ifdef EFTYPE + case EFTYPE: +#endif + case EINVAL: + case ELOOP: + case ENAMETOOLONG: + case ENOENT: + case ENOTDIR: + case EPERM: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_POSIX +void +systemdict_chown(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *file, *uid, *gid; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(gid, ostack, a_thread); + NXO_STACK_DOWN_GET(uid, ostack, a_thread, gid); + NXO_STACK_DOWN_GET(file, ostack, a_thread, uid); + if ((nxo_type_get(file) != NXOT_FILE && nxo_type_get(file) != NXOT_STRING) + || nxo_type_get(gid) != NXOT_INTEGER + || nxo_type_get(uid) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(uid) < 0 || nxo_integer_get(gid) < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + if (nxo_type_get(file) == NXOT_FILE) + { + int fd; + + fd = nxo_file_fd_get(file); + if (fd < 0) + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + + error = fchown(fd, nxo_integer_get(uid), nxo_integer_get(gid)); + } + else + { + cw_nxo_t *tstack, *tfile; + + tstack = nxo_thread_tstack_get(a_thread); + + /* Create a copy of file with an extra byte to store a '\0' + * terminator. */ + tfile = nxo_stack_push(tstack); + nxo_string_cstring(tfile, file, a_thread); + + error = chown(nxo_string_get(tfile), nxo_integer_get(uid), + nxo_integer_get(gid)); + + nxo_stack_pop(tstack); + } + + if (error == -1) + { + switch (errno) + { + case EIO: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EACCES: + case EINVAL: + case ELOOP: + case ENAMETOOLONG: + case ENOENT: + case ENOTDIR: + case EPERM: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_npop(ostack, 3); +} +#endif + +#ifdef CW_POSIX +void +systemdict_chroot(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *path, *tpath; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(path, ostack, a_thread); + if (nxo_type_get(path) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of the path with an extra byte to store a '\0' + * terminator. */ + tpath = nxo_stack_push(tstack); + nxo_string_cstring(tpath, path, a_thread); + + error = chroot(nxo_string_get(tpath)); + if (error == -1) + { + nxo_string_unlock(tpath); + switch (errno) + { + case EIO: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_invalidaccess); + } + } + goto ERROR; + } + + nxo_stack_pop(ostack); + + ERROR: + nxo_stack_pop(tstack); +} +#endif + +void +systemdict_clear(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_uint32_t count; + + ostack = nxo_thread_ostack_get(a_thread); + count = nxo_stack_count(ostack); + if (count > 0) + { + nxo_stack_npop(ostack, count); + } +} + +void +systemdict_cleartomark(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_uint32_t i, depth; + + ostack = nxo_thread_ostack_get(a_thread); + + for (i = 0, depth = nxo_stack_count(ostack), nxo = NULL; i < depth; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + if (nxo_type_get(nxo) == NXOT_MARK) + { + break; + } + } + if (i == depth) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + + nxo_stack_npop(ostack, i + 1); +} + +#ifdef CW_POSIX +void +systemdict_close(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = nxo_file_close(nxo); + if (error) + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_THREADS +void +systemdict_condition(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *condition; + + ostack = nxo_thread_ostack_get(a_thread); + condition = nxo_stack_push(ostack); + nxo_condition_new(condition, nxo_thread_nx_get(a_thread)); +} +#endif + +#ifdef CW_SOCKET +void +systemdict_connect(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *sock, *addr, *taddr; + cw_uint32_t npop; + sa_family_t family; + int sockport, error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(addr, ostack, a_thread); + if (nxo_type_get(addr) == NXOT_INTEGER) + { + sockport = nxo_integer_get(addr); + NXO_STACK_DOWN_GET(addr, ostack, a_thread, addr); + npop = 3; + } + else + { + npop = 2; + } + NXO_STACK_DOWN_GET(sock, ostack, a_thread, addr); + if (nxo_type_get(sock) != NXOT_FILE || nxo_type_get(addr) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Get the socket family. */ + if (systemdict_p_sock_family(a_thread, nxo_file_fd_get(sock), FALSE, + &family)) + { + return; + } + + /* Create a '\0'-terminated copy of addr. */ + taddr = nxo_stack_push(tstack); + nxo_string_cstring(taddr, addr, a_thread); + + switch (family) + { + case AF_INET: + { + struct sockaddr_in sockaddr; + + if (npop != 3) + { + /* Port must be specified for an IP connection. */ + nxo_thread_nerror(a_thread, NXN_typecheck); + goto ERROR; + } + + /* Begin initialization of sockaddr. */ + memset(&sockaddr, 0, sizeof(struct sockaddr_in)); + sockaddr.sin_family = family; + sockaddr.sin_port = htons(sockport); + + error = inet_pton(family, nxo_string_get(taddr), + &sockaddr.sin_addr); + if (error < 0) + { + nxo_thread_nerror(a_thread, NXN_argcheck); + goto ERROR; + } + else if (error == 0) + { + struct hostent *ent; + struct in_addr *iaddr; + + /* Not a dotted number IP address. Try it as a hostname. */ +#ifdef CW_THREADS + mtx_lock(&cw_g_gethostbyname_mtx); +#endif + ent = gethostbyname(nxo_string_get(taddr)); + if (ent == NULL) + { +#ifdef CW_THREADS + mtx_unlock(&cw_g_gethostbyname_mtx); +#endif + nxo_thread_nerror(a_thread, NXN_argcheck); + goto ERROR; + } + + iaddr = (struct in_addr *) ent->h_addr_list[0]; + + sockaddr.sin_addr = *iaddr; + } + +#ifdef CW_THREADS + mtx_unlock(&cw_g_gethostbyname_mtx); +#endif + + /* Connect. */ + error = connect(nxo_file_fd_get(sock), + (struct sockaddr *) &sockaddr, + sizeof(sockaddr)); + + break; + } + case AF_LOCAL: + { + struct sockaddr_un sockaddr; + + if (npop == 3) + { + /* Port shouldn't be specified for a Unix domain connection. */ + nxo_thread_nerror(a_thread, NXN_typecheck); + goto ERROR; + } + + if (nxo_string_len_get(taddr) > sizeof(sockaddr.sun_path)) + { + /* Not enough room for path. */ + nxo_thread_nerror(a_thread, NXN_rangecheck); + goto ERROR; + } + + /* Initialize sockaddr. */ + memset(&sockaddr, 0, sizeof(struct sockaddr_un)); + sockaddr.sun_family = family; + memcpy(sockaddr.sun_path, nxo_string_get(taddr), + nxo_string_len_get(taddr)); + + /* Connect. */ + error = connect(nxo_file_fd_get(sock), + (struct sockaddr *) &sockaddr, + sizeof(sockaddr)); + + break; + } + default: + { + cw_not_reached(); + } + } + + /* Check for connect() error. */ + if (error == -1) + { + switch (errno) + { + case EADDRINUSE: + case ECONNREFUSED: + case ETIMEDOUT: + case ENETUNREACH: + { + nxo_thread_nerror(a_thread, NXN_neterror); + goto ERROR; + } + case EINPROGRESS: + case EALREADY: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + goto ERROR; + } + case EAFNOSUPPORT: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + goto ERROR; + } + case EACCES: + case EISCONN: + case ENOTSOCK: + case EPERM: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + goto ERROR; + } + case EAGAIN: + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + goto ERROR; + } + } + } + + nxo_stack_npop(ostack, npop); + ERROR: + nxo_stack_pop(tstack); +} +#endif + +void +systemdict_copy(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + switch (nxo_type_get(nxo)) + { + case NXOT_ARRAY: + { + cw_nxo_t *orig; + + NXO_STACK_DOWN_GET(orig, ostack, a_thread, nxo); + if (nxo_type_get(orig) != NXOT_ARRAY) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_array_len_get(nxo) < nxo_array_len_get(orig)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_array_copy(nxo, orig); + + nxo_stack_exch(ostack); + nxo_stack_pop(ostack); + break; + } + case NXOT_DICT: + { + cw_nxo_t *orig; + + NXO_STACK_DOWN_GET(orig, ostack, a_thread, nxo); + if (nxo_type_get(orig) != NXOT_DICT) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_dict_copy(nxo, orig, nxo_thread_nx_get(a_thread)); + + nxo_stack_exch(ostack); + nxo_stack_pop(ostack); + break; + } + case NXOT_STACK: + { + cw_nxo_t *orig; + + NXO_STACK_DOWN_GET(orig, ostack, a_thread, nxo); + if (nxo_type_get(orig) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_stack_copy(nxo, orig); + + nxo_stack_exch(ostack); + nxo_stack_pop(ostack); + break; + } + case NXOT_STRING: + { + cw_nxo_t *orig; + + NXO_STACK_DOWN_GET(orig, ostack, a_thread, nxo); + if (nxo_type_get(orig) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_string_len_get(nxo) < nxo_string_len_get(orig)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_string_copy(nxo, orig); + + nxo_stack_exch(ostack); + nxo_stack_pop(ostack); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +#ifdef CW_REAL +void +systemdict_cos(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_real_new(nxo, cos(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_cosh(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_real_new(nxo, cosh(real)); +} +#endif + +void +systemdict_count(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, nxo_stack_count(ostack) - 1); +} + +void +systemdict_countdstack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *dstack; + cw_nxo_t *nxo; + + dstack = nxo_thread_dstack_get(a_thread); + ostack = nxo_thread_ostack_get(a_thread); + + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, nxo_stack_count(dstack)); +} + +void +systemdict_countestack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack; + cw_nxo_t *nxo; + + estack = nxo_thread_estack_get(a_thread); + ostack = nxo_thread_ostack_get(a_thread); + + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, nxo_stack_count(estack)); +} + +void +systemdict_counttomark(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_uint32_t i, depth; + + ostack = nxo_thread_ostack_get(a_thread); + + for (i = 0, depth = nxo_stack_count(ostack), nxo = NULL; i < depth; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + if (nxo_type_get(nxo) == NXOT_MARK) + { + break; + } + } + if (i == depth) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, i); +} + +void +systemdict_currentdict(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *dstack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + dstack = nxo_thread_dstack_get(a_thread); + + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_stack_get(dstack)); +} + +#ifdef CW_THREADS +void +systemdict_currentlocking(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_boolean_new(nxo, nxo_thread_currentlocking(a_thread)); +} +#endif + +#ifdef CW_REAL +void +systemdict_cvds(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *real, *precision; + char *result; + cw_sint32_t len; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(precision, ostack, a_thread); + NXO_STACK_DOWN_GET(real, ostack, a_thread, precision); + if (nxo_type_get(precision) != NXOT_INTEGER + || nxo_type_get(real) != NXOT_REAL) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + if ((int) nxo_integer_get(precision) < 0) + { + len = asprintf(&result, "%.*g", -(int)nxo_integer_get(precision), + nxo_real_get(real)); + } + else + { + len = asprintf(&result, "%.*f", (int) nxo_integer_get(precision), + nxo_real_get(real)); + } + if (len == -1) + { + xep_throw(CW_ONYXX_OOM); + } + + nxo_string_new(real, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len); + nxo_string_lock(real); + nxo_string_set(real, 0, result, len); + nxo_string_unlock(real); + free(result); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_cve(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + nxo_attr_set(nxo, NXOA_EVALUATABLE); +} + +#ifdef CW_REAL +void +systemdict_cves(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *real, *precision; + char *result; + cw_sint32_t len; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(precision, ostack, a_thread); + NXO_STACK_DOWN_GET(real, ostack, a_thread, precision); + if (nxo_type_get(precision) != NXOT_INTEGER + || nxo_type_get(real) != NXOT_REAL) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + len = asprintf(&result, "%.*e", (int) nxo_integer_get(precision), + nxo_real_get(real)); + if (len == -1) + { + xep_throw(CW_ONYXX_OOM); + } + + nxo_string_new(real, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len); + nxo_string_lock(real); + nxo_string_set(real, 0, result, len); + nxo_string_unlock(real); + free(result); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_cvlit(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + nxo_attr_set(nxo, NXOA_LITERAL); +} + +void +systemdict_cvn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *tnxo; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + + nxo_name_new(nxo, nxo_thread_nx_get(a_thread), nxo_string_get(tnxo), + nxo_string_len_get(tnxo), FALSE); + nxo_attr_set(nxo, nxo_attr_get(tnxo)); + + nxo_stack_pop(tstack); +} + +static cw_uint32_t +systemdict_p_integer_render(cw_nxoi_t a_integer, cw_uint32_t a_base, + cw_uint8_t *r_buf) +{ + cw_uint32_t retval, i; + cw_uint64_t t = (cw_uint64_t) a_integer; + cw_bool_t negative; + cw_uint8_t *syms = "0123456789abcdefghijklmnopqrstuvwxyz"; + /* Since we're printing a signed integer, the most we ever need is 1 sign + * byte and 63 digit bytes. */ + cw_uint8_t *result, s_result[65] = + "0000000000000000000000000000000000000000000000000000000000000000"; + + /* Leave space for a leading sign. */ + result = &s_result[1]; + + /* Print the sign if a negative number. */ + if ((t & (((cw_uint64_t) 1) << 63)) != 0) + { + /* Convert two's complement to positive. We have to use an unsigned + * integer and do all this manually in case the integer is the minimum + * negative value, which is not representable as a negated (to positive) + * signed integer. */ + t ^= 0xffffffffffffffffLL; + t++; + + negative = TRUE; + } + else + { + negative = FALSE; + } + + /* Render. */ + if (t == 0) + { + result += 62; + } + else + { + if (a_base == 16) + { + for (i = 62; t != 0; i--) + { + result[i] = syms[t & 0xf]; + t >>= 4; + } + } + else + { + for (i = 62; t != 0; i--) + { + result[i] = syms[t % a_base]; + t /= a_base; + } + } + result += i + 1; + } + + /* If negative, show the sign. */ + if (negative) + { + result--; + result[0] = '-'; + } + + /* Calculate the length an copy to the return buffer. */ + retval = &s_result[64] - result; + memcpy(r_buf, result, retval); + + return retval; +} + +void +systemdict_cvrs(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *num, *radix; + cw_uint64_t val; + cw_uint32_t rlen, base; + cw_uint8_t *str; + cw_uint8_t result[66]; /* Sign, 64 bits, terminator. */ + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(radix, ostack, a_thread); + NXO_STACK_DOWN_GET(num, ostack, a_thread, radix); + if ((nxo_type_get(num) != NXOT_INTEGER) + || (nxo_type_get(radix) != NXOT_INTEGER)) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + base = nxo_integer_get(radix); + if (base < 2 || base > 36) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + val = nxo_integer_get(num); + + rlen = systemdict_p_integer_render(val, base, result); + cw_assert(rlen <= 65); + + nxo_string_new(num, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), rlen); + + str = nxo_string_get(num); + nxo_string_lock(num); + memcpy(str, result, rlen); + nxo_string_unlock(num); + + nxo_stack_pop(ostack); +} + +void +systemdict_cvs(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + switch (nxo_type_get(nxo)) + { + case NXOT_BOOLEAN: + { + cw_onyx_code(a_thread, "{`true'} {`false'} ifelse"); + break; + } + case NXOT_INTEGER: + { + cw_uint8_t result[21]; + cw_sint32_t len; + + len = systemdict_p_integer_render(nxo_integer_get(nxo), 10, + result); + + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len); + nxo_string_lock(nxo); + nxo_string_set(nxo, 0, result, len); + nxo_string_unlock(nxo); + break; + } + case NXOT_NAME: + { + cw_nxo_t *tstack; + cw_nxo_t *tnxo; + + tstack = nxo_thread_tstack_get(a_thread); + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), + nxo_name_len_get(tnxo)); + nxo_string_lock(nxo); + nxo_string_set(nxo, 0, nxo_name_str_get(tnxo), + nxo_name_len_get(tnxo)); + nxo_string_unlock(nxo); + + nxo_stack_pop(tstack); + break; + } + case NXOT_OPERATOR: + { + cw_nxn_t nxn; + + nxn = nxo_l_operator_nxn_get(nxo); + if (nxn == NXN_ZERO) + { + cw_onyx_code(a_thread, "pop `-operator-'"); + } + else + { + cw_nxo_t *tstack; + cw_nxo_t *tnxo; + + cw_assert(nxn <= NXN_LAST); + tstack = nxo_thread_tstack_get(a_thread); + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), + nxn_len(nxn)); + nxo_string_lock(nxo); + nxo_string_set(nxo, 0, nxn_str(nxn), nxn_len(nxn)); + nxo_string_unlock(nxo); + + nxo_stack_pop(tstack); + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + cw_uint8_t result[15]; /* "-9.999999e+307\0" */ + cw_sint32_t len; + + len = snprintf(result, sizeof(result), "%e", nxo_real_get(nxo)); + + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len); + nxo_string_lock(nxo); + nxo_string_set(nxo, 0, result, len); + nxo_string_unlock(nxo); + break; + } +#endif + case NXOT_STRING: + { + cw_nxo_t *tstack, *tnxo; + cw_uint32_t i, j, len, newlen; + cw_uint8_t *str, *newstr; + cw_uint8_t syms[] = "0123456789abcdef"; + + /* The source is already a string, but here we convert non-printing + * characters. */ + + tstack = nxo_thread_tstack_get(a_thread); + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + + str = nxo_string_get(tnxo); + len = nxo_string_len_get(tnxo); + + /* The source string must not change between the first and second + * passes. The destination string need not be locked, since no + * other threads have a possible way of accessing it yet. */ + + /* Calculate the length of the new string. */ + for (i = 0, newlen = 2; i < len; i++) + { + switch (str[i]) + { + case '\0': case '\x1b': /* \e */ + case '\a': case '\b': case '\f': case '\n': case '\r': + case '\t': case '\\': case '`': case '\'': + { + newlen += 2; + break; + } + case '\x01': case '\x02': case '\x03': case '\x04': + case '\x05': case '\x06': + /* case '\x07': \a */ + /* case '\x08': \b */ + /* case '\x09': \t */ + /* case '\x0a': \n */ + case '\x0b': + /* case '\x0c': \f */ + /* case '\x0d': \r */ + case '\x0e': case '\x0f': case '\x10': case '\x11': + case '\x12': case '\x13': case '\x14': case '\x15': + case '\x16': case '\x17': case '\x18': case '\x19': + case '\x1a': + { + newlen += 3; + break; + } + default: + { + if (isprint(str[i])) + { + newlen++; + } + else + { + newlen += 4; + } + break; + } + } + } + + /* Create new string. */ + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), newlen); + newstr = nxo_string_get(nxo); + + /* Convert old string to new string. */ + newstr[0] = '`'; + newstr[newlen - 1] = '\''; + for (i = 0, j = 1; i < len; i++) + { + switch (str[i]) + { + case '\0': + { + newstr[j] = '\\'; + newstr[j + 1] = '0'; + j += 2; + break; + } + case '\x1b': + { + newstr[j] = '\\'; + newstr[j + 1] = 'e'; + j += 2; + break; + } + case '\a': + { + newstr[j] = '\\'; + newstr[j + 1] = 'a'; + j += 2; + break; + } + case '\b': + { + newstr[j] = '\\'; + newstr[j + 1] = 'b'; + j += 2; + break; + } + case '\f': + { + newstr[j] = '\\'; + newstr[j + 1] = 'f'; + j += 2; + break; + } + case '\n': + { + newstr[j] = '\\'; + newstr[j + 1] = 'n'; + j += 2; + break; + } + case '\r': + { + newstr[j] = '\\'; + newstr[j + 1] = 'r'; + j += 2; + break; + } + case '\t': + { + newstr[j] = '\\'; + newstr[j + 1] = 't'; + j += 2; + break; + } + case '\\': + { + newstr[j] = '\\'; + newstr[j + 1] = '\\'; + j += 2; + break; + } + case '`': + { + newstr[j] = '\\'; + newstr[j + 1] = '`'; + j += 2; + break; + } + case '\'': + { + newstr[j] = '\\'; + newstr[j + 1] = '\''; + j += 2; + break; + } + case '\x01': case '\x02': case '\x03': case '\x04': + case '\x05': case '\x06': + /* case '\x07': \a */ + /* case '\x08': \b */ + /* case '\x09': \t */ + /* case '\x0a': \n */ + case '\x0b': + /* case '\x0c': \f */ + /* case '\x0d': \r */ + case '\x0e': case '\x0f': case '\x10': case '\x11': + case '\x12': case '\x13': case '\x14': case '\x15': + case '\x16': case '\x17': case '\x18': case '\x19': + case '\x1a': + { + newstr[j] = '\\'; + newstr[j + 1] = 'c'; + newstr[j + 2] = str[i] - 1 + 'a'; + j += 3; + break; + } + default: + { + if (isprint(str[i])) + { + newstr[j] = str[i]; + j++; + } + else + { + newstr[j] = '\\'; + newstr[j + 1] = 'x'; + newstr[j + 2] = syms[str[i] >> 4]; + newstr[j + 3] = syms[str[i] & 0xf]; + j += 4; + } + break; + } + } + } + + nxo_stack_pop(tstack); + break; + } + case NXOT_ARRAY: +#ifdef CW_THREADS + case NXOT_CONDITION: +#endif + case NXOT_DICT: + case NXOT_FILE: + case NXOT_FINO: + case NXOT_HOOK: + case NXOT_MARK: +#ifdef CW_THREADS + case NXOT_MUTEX: +#endif + case NXOT_NULL: + case NXOT_PMARK: +#ifdef CW_REGEX + case NXOT_REGEX: + case NXOT_REGSUB: +#endif + case NXOT_STACK: + case NXOT_THREAD: + { + cw_onyx_code(a_thread, "pop `--nostringval--'"); + break; + } + case NXOT_NO: + default: + { + cw_not_reached(); + } + } +} + +void +systemdict_cvx(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + nxo_attr_set(nxo, NXOA_EXECUTABLE); +} + +void +systemdict_dec(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nxo_integer_set(nxo, nxo_integer_get(nxo) - 1); +} + +void +systemdict_def(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *dstack; + cw_nxo_t *dict, *key, *val; + + ostack = nxo_thread_ostack_get(a_thread); + dstack = nxo_thread_dstack_get(a_thread); + + dict = nxo_stack_get(dstack); + NXO_STACK_GET(val, ostack, a_thread); + NXO_STACK_DOWN_GET(key, ostack, a_thread, val); + + nxo_dict_def(dict, nxo_thread_nx_get(a_thread), key, val); + + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_THREADS +void +systemdict_detach(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *thread; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(thread, ostack, a_thread); + if (nxo_type_get(thread) != NXOT_THREAD) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_thread_detach(thread); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_dict(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *dict; + + ostack = nxo_thread_ostack_get(a_thread); + + dict = nxo_stack_push(ostack); + nxo_dict_new(dict, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), CW_SYSTEMDICT_DICT_SIZE); +} + +void +systemdict_die(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *code; + cw_nxoi_t ecode; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(code, ostack, a_thread); + if (nxo_type_get(code) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + ecode = nxo_integer_get(code); + if (ecode < 0 || ecode > 255) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + _exit(ecode); +} + +#ifdef CW_POSIX +void +systemdict_dirforeach(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *nxo, *tnxo, *path, *proc, *entry; + cw_nx_t *nx; + cw_bool_t currentlocking, dot; + DIR *dir; + cw_uint32_t edepth, tdepth; + struct dirent *entp; +#ifndef CW_HAVE_DIRENT_NAMLEN + size_t namlen; +#endif +#ifdef HAVE_READDIR_R + struct dirent ent; + int error; +#endif + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + nx = nxo_thread_nx_get(a_thread); + currentlocking = nxo_thread_currentlocking(a_thread); + + NXO_STACK_GET(tnxo, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, tnxo); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Make a copy of the procedure to execute. */ + proc = nxo_stack_push(tstack); + nxo_dup(proc, tnxo); + + /* Create a copy of the path with an extra byte to store a '\0' + * terminator. */ + path = nxo_stack_push(tstack); + nxo_string_cstring(path, nxo, a_thread); + + /* Open the directory. */ + dir = opendir(nxo_string_get(path)); + if (dir == NULL) + { + nxo_stack_npop(tstack, 2); + nxo_thread_nerror(a_thread, NXN_invalidaccess); + return; + } + + /* Pop the path and proc off ostack before going into the loop. */ + nxo_stack_npop(ostack, 2); + + xep_begin(); + xep_try + { + /* Iterate through the directory. */ +#ifdef HAVE_READDIR_R + while ((error = readdir_r(dir, &ent, &entp) == 0) && entp == &ent) +#else + errno = 0; + while ((entp = readdir(dir)) != NULL) +#endif + { + /* Ignore "." and "..". */ +#ifdef CW_HAVE_DIRENT_NAMLEN + switch (entp->d_namlen) +#else + namlen = strlen(entp->d_name); + switch (namlen) +#endif + { + case 2: + { + if (entp->d_name[1] != '.') + { + dot = FALSE; + break; + } + /* Fall through. */ + } + case 1: + { + if (entp->d_name[0] != '.') + { + dot = FALSE; + break; + } + else + { + dot = TRUE; + } + break; + } + default: + { + dot = FALSE; + } + } + if (dot == FALSE) + { + /* Push a string onto ostack that represents the directory + * entry. */ + entry = nxo_stack_push(ostack); +#ifdef CW_HAVE_DIRENT_NAMLEN + nxo_string_new(entry, nx, currentlocking, entp->d_namlen); + nxo_string_set(entry, 0, entp->d_name, entp->d_namlen); +#else + nxo_string_new(entry, nx, currentlocking, namlen); + nxo_string_set(entry, 0, entp->d_name, namlen); +#endif + + /* Evaluate proc. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, proc); + nxo_thread_loop(a_thread); + } + } +#ifdef HAVE_READDIR_R + if (error && entp != NULL) +#else + if (errno != 0) +#endif + { + /* The loop terminated due to an error. */ + nxo_thread_nerror(a_thread, NXN_ioerror); + } + } + xep_catch(CW_ONYXX_EXIT) + { + cw_nxo_t *istack; + + xep_handled(); + + /* Clean up estack and istack. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) - + nxo_stack_count(estack)); + } + xep_acatch + { + /* Close the directory. */ + closedir(dir); + } + xep_end(); + + /* Close the directory. */ + closedir(dir); + + /* Clean up tstack. */ + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); +} +#endif + +#ifdef CW_REAL +void +systemdict_div(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_nxor_t real_a, real_b; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: + { + real_a = (cw_nxor_t) nxo_integer_get(nxo_a); + break; + } + case NXOT_REAL: + { + real_a = nxo_real_get(nxo_a); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: + { + real_b = (cw_nxor_t) nxo_integer_get(nxo_b); + break; + } + case NXOT_REAL: + { + real_b = nxo_real_get(nxo_b); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + if (real_b == 0) + { + nxo_thread_nerror(a_thread, NXN_undefinedresult); + return; + } + + nxo_real_new(nxo_a, real_a / real_b); + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_dn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + + ostack = nxo_thread_ostack_get(a_thread); + if (nxo_stack_count(ostack) < 3) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_roll(ostack, 3, -1); +} + +void +systemdict_dstack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *dstack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + dstack = nxo_thread_dstack_get(a_thread); + + stack = nxo_stack_push(ostack); + nxo_stack_new(stack, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_stack_copy(stack, dstack); +} + +void +systemdict_dup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *orig, *dup; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(orig, ostack, a_thread); + dup = nxo_stack_push(ostack); + nxo_dup(dup, orig); +} + +void +systemdict_echeck(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + if (nxo_attr_get(nxo) == NXOA_EVALUATABLE) + { + nxo_boolean_new(nxo, TRUE); + } + else + { + nxo_boolean_new(nxo, FALSE); + } +} + +#ifdef CW_POSIX +void +systemdict_egid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, getegid()); +} +#endif + +void +systemdict_end(cw_nxo_t *a_thread) +{ + cw_nxo_t *dstack; + + dstack = nxo_thread_dstack_get(a_thread); + + NXO_STACK_POP(dstack, a_thread); +} + +void +systemdict_eq(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_sint32_t result; + cw_bool_t eq; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + result = nxo_compare(nxo_a, nxo_b); + if (result == 0) + { + eq = TRUE; + } + else + { + eq = FALSE; + } + + nxo_boolean_new(nxo_a, eq); + + nxo_stack_pop(ostack); +} + +void +systemdict_estack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + + stack = nxo_stack_push(ostack); + nxo_stack_new(stack, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_stack_copy(stack, estack); +} + +#ifdef CW_POSIX +void +systemdict_euid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, geteuid()); +} +#endif + +void +systemdict_eval(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack; + cw_nxo_t *orig, *new; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + + NXO_STACK_GET(orig, ostack, a_thread); + new = nxo_stack_push(estack); + nxo_dup(new, orig); + nxo_stack_pop(ostack); + + nxo_thread_loop(a_thread); +} + +void +systemdict_exch(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + + ostack = nxo_thread_ostack_get(a_thread); + + if (nxo_stack_exch(ostack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + } +} + +#ifdef CW_POSIX +static cw_bool_t +systemdict_p_exec_prepare(cw_nxo_t *a_thread, char **r_path, char ***r_argv, + char ***r_envp) +{ + cw_nxo_t *ostack, *tstack, *array, *el, *key, *val; + cw_uint32_t i, slen, argc, dcount, key_len, val_len; + char *path, **argv, **envp, *entry; + cw_nxn_t error; + + /* This function does a bunch of memory allocation, which must be done with + * great care, since an exception will cause us to leak all of the allocated + * memory. For example, a user can cause an exception in + * nxo_thread_nerror(), so we must do all cleanup before throwing the + * error. */ + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + el = nxo_stack_push(tstack); + + array = nxo_stack_get(ostack); + if (array == NULL) + { + error = NXN_stackunderflow; + goto VALIDATION_ERROR; + } + if (nxo_type_get(array) != NXOT_ARRAY) + { + error = NXN_typecheck; + goto VALIDATION_ERROR; + } + argc = nxo_array_len_get(array); + if (argc < 1) + { + error = NXN_rangecheck; + goto VALIDATION_ERROR; + } + for (i = 0; i < argc; i++) + { + nxo_array_el_get(array, i, el); + if (nxo_type_get(el) != NXOT_STRING) + { + error = NXN_typecheck; + goto VALIDATION_ERROR; + } + } + + /* Construct path. */ + nxo_array_el_get(array, 0, el); + if (nxo_type_get(el) != NXOT_STRING) + { + error = NXN_typecheck; + goto PATH_ERROR; + } + slen = nxo_string_len_get(el); + path = (char *) cw_malloc(slen + 1); + nxo_string_lock(el); + memcpy(path, nxo_string_get(el), slen); + nxo_string_unlock(el); + path[slen] = '\0'; + + /* Construct argv. */ + argv = (char **) cw_calloc(argc + 1, sizeof(char *)); + for (i = 0; i < argc; i++) + { + nxo_array_el_get(array, i, el); + if (nxo_type_get(el) != NXOT_STRING) + { + error = NXN_typecheck; + goto ARGV_ERROR; + } + slen = nxo_string_len_get(el); + argv[i] = (char *) cw_malloc(slen + 1); + nxo_string_lock(el); + memcpy(argv[i], nxo_string_get(el), slen); + nxo_string_unlock(el); + argv[i][slen] = '\0'; + } + argv[i] = NULL; + + /* Construct envp. */ + key = el; + val = nxo_stack_push(tstack); + + dcount = nxo_dict_count(nx_envdict_get(nxo_thread_nx_get(a_thread))); + envp = (char **) cw_calloc(dcount + 1, sizeof(char *)); + for (i = 0; i < dcount; i++) + { + /* Get key and val. */ + nxo_dict_iterate(nx_envdict_get(nxo_thread_nx_get(a_thread)), key); + nxo_dict_lookup(nx_envdict_get(nxo_thread_nx_get(a_thread)), key, + val); + if (nxo_type_get(key) != NXOT_NAME || nxo_type_get(val) != NXOT_STRING) + { + error = NXN_typecheck; + goto ENVP_ERROR; + } + + /* Create string that looks like "=\0". */ + key_len = nxo_name_len_get(key); + val_len = nxo_string_len_get(val); + entry = (char *) cw_malloc(key_len + val_len + 2); + + memcpy(entry, nxo_name_str_get(key), key_len); + entry[key_len] = '='; + nxo_string_lock(val); + memcpy(&entry[key_len + 1], nxo_string_get(val), val_len); + nxo_string_unlock(val); + entry[key_len + 1 + val_len] = '\0'; + + envp[i] = entry; + } + envp[i] = NULL; + + nxo_stack_npop(tstack, 2); + + *r_path = path; + *r_argv = argv; + *r_envp = envp; + return FALSE; + + ENVP_ERROR: + nxo_stack_npop(tstack, 2); + for (i = 0; envp[i] != NULL; i++) + { + cw_free(envp[i]); + } + cw_free(envp); + ARGV_ERROR: + for (i = 0; argv[i] != NULL; i++) + { + cw_free(argv[i]); + } + cw_free(argv); + cw_free(path); + PATH_ERROR: + VALIDATION_ERROR: + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, error); + + return TRUE; +} +void +systemdict_exec(cw_nxo_t *a_thread) +{ + char *path, **argv, **envp; + + if (systemdict_p_exec_prepare(a_thread, &path, &argv, &envp) == FALSE) + { + execve(path, argv, envp); + /* If we get here, then the execve() call failed. Get an error back to + * the parent. */ + _exit(1); + } +} +#endif + +void +systemdict_exit(cw_nxo_t *a_thread) +{ + xep_throw(CW_ONYXX_EXIT); +} + +#ifdef CW_REAL +void +systemdict_exp(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_real_new(nxo, exp(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_floor(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + break; + } + case NXOT_REAL: + { + nxo_integer_new(nxo, (cw_nxoi_t) floor(nxo_real_get(nxo))); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} +#endif + +void +systemdict_flush(cw_nxo_t *a_thread) +{ + cw_nxn_t error; + + error = nxo_file_buffer_flush(nxo_thread_stdout_get(a_thread)); + if (error) + { + nxo_thread_nerror(a_thread, error); + } +} + +void +systemdict_flushfile(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = nxo_file_buffer_flush(file); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_stack_pop(ostack); +} + +void +systemdict_for(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *exec, *onxo, *enxo, *tnxo; + cw_nxoi_t i, inc, limit, edepth, tdepth; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(exec, ostack, a_thread); + + NXO_STACK_DOWN_GET(onxo, ostack, a_thread, exec); + if (nxo_type_get(onxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + limit = nxo_integer_get(onxo); + + NXO_STACK_DOWN_GET(onxo, ostack, a_thread, onxo); + if (nxo_type_get(onxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + inc = nxo_integer_get(onxo); + + NXO_STACK_DOWN_GET(onxo, ostack, a_thread, onxo); + if (nxo_type_get(onxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + i = nxo_integer_get(onxo); + + /* Move the object to be executed to tstack. */ + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, exec); + nxo_stack_npop(ostack, 4); + + /* Record stack depths so that we can clean up if necessary. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + /* Catch an exit exception, if thrown, but do not continue executing the + * loop. */ + xep_begin(); + xep_try + { + if (inc >= 0) + { + for (; i <= limit; i += inc) + { + /* Dup the object to execute onto the execution stack. */ + enxo = nxo_stack_push(estack); + nxo_dup(enxo, tnxo); + + /* Push the control variable onto the data stack. */ + onxo = nxo_stack_push(ostack); + nxo_integer_new(onxo, i); + + nxo_thread_loop(a_thread); + } + } + else + { + for (; i >= limit; i += inc) + { + /* Dup the object to execute onto the execution stack. */ + enxo = nxo_stack_push(estack); + nxo_dup(enxo, tnxo); + + /* Push the control variable onto the data stack. */ + onxo = nxo_stack_push(ostack); + nxo_integer_new(onxo, i); + + nxo_thread_loop(a_thread); + } + } + } + xep_catch(CW_ONYXX_EXIT) + { + cw_nxo_t *istack; + + xep_handled(); + + /* Clean up stacks. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) + - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); + } + xep_end(); + + /* An object is pushed before tdepth is stored, so we can unconditionally + * pop it here. */ + nxo_stack_pop(tstack); +} + +void +systemdict_foreach(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *nxo, *what, *proc; + cw_uint32_t edepth, tdepth; + cw_nxoi_t i, count; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(proc, ostack, a_thread); + NXO_STACK_DOWN_GET(what, ostack, a_thread, proc); + switch (nxo_type_get(what)) + { + case NXOT_ARRAY: + case NXOT_DICT: + case NXOT_STACK: + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + /* Record stack depths so that we can clean up if necessary. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + xep_begin(); + xep_try + { + switch (nxo_type_get(what)) + { + case NXOT_ARRAY: + { + cw_nxo_t *el; + + /* Move proc and array to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, proc); + proc = nxo; + + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, what); + what = nxo; + + nxo_stack_npop(ostack, 2); + + /* Iterate through the array, push each element onto ostack, and + * execute proc. */ + el = nxo_stack_push(tstack); + for (i = 0, count = nxo_array_len_get(what); i < count; i++) + { + nxo_array_el_get(what, i, el); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, el); + + nxo = nxo_stack_push(estack); + nxo_dup(nxo, proc); + nxo_thread_loop(a_thread); + } + break; + } + case NXOT_DICT: + { + cw_nxo_t *key, *val; + + /* Move proc and dict to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, proc); + proc = nxo; + + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, what); + what = nxo; + + nxo_stack_npop(ostack, 2); + + for (i = 0, count = nxo_dict_count(what); i < count; i++) + { + /* Push key and val onto ostack. */ + key = nxo_stack_push(ostack); + val = nxo_stack_push(ostack); + + /* Get next key. */ + nxo_dict_iterate(what, key); + + /* Use key to get val. */ + nxo_dict_lookup(what, key, val); + + /* Push proc onto estack and execute it. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, proc); + nxo_thread_loop(a_thread); + } + break; + } + case NXOT_STACK: { + cw_nxo_t *el; + + /* Move proc to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, proc); + proc = nxo; + + /* Copy the contents of stack onto tstack. */ + nxo_stack_copy(tstack, what); + + nxo_stack_npop(ostack, 2); + + /* Iterate through the stack element (sitting on tstack), push + * each one onto ostack, and execute proc. */ + for (el = nxo_stack_get(tstack); + el != proc; + el = nxo_stack_get(tstack)) + { + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, el); + nxo_stack_pop(tstack); + + nxo = nxo_stack_push(estack); + nxo_dup(nxo, proc); + nxo_thread_loop(a_thread); + } + break; + } + case NXOT_STRING: + { + cw_uint8_t el; + + /* Move proc and array to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, proc); + proc = nxo; + + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, what); + what = nxo; + + nxo_stack_npop(ostack, 2); + + /* Iterate through the string, push each element onto ostack, + * and execute proc. */ + for (i = 0, count = nxo_string_len_get(what); i < count; i++) + { + nxo_string_el_get(what, i, &el); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, (cw_nxoi_t) el); + + nxo = nxo_stack_push(estack); + nxo_dup(nxo, proc); + nxo_thread_loop(a_thread); + } + break; + } + default: + { + cw_not_reached(); + } + } + } + xep_catch(CW_ONYXX_EXIT) + { + cw_nxo_t *istack; + + xep_handled(); + + /* Clean up estack. tstack is handled later, so don't bother cleaning + * it up here. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) - + nxo_stack_count(estack)); + } + xep_end(); + + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); +} + +#ifdef CW_POSIX +void +systemdict_forkexec(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + char *path, **argv, **envp; + pid_t pid; + cw_uint32_t i; + + if (systemdict_p_exec_prepare(a_thread, &path, &argv, &envp) == FALSE) + { + pid = fork(); + if (pid == 0) + { + /* Child. */ + execve(path, argv, envp); + /* If we get here, then the execve() call failed. Get an error back + * to the parent. */ + _exit(1); + } + else + { + /* Parent. */ + + /* Clean up memory allocation. */ + for (i = 0; envp[i] != NULL; i++) + { + cw_free(envp[i]); + } + cw_free(envp); + + for (i = 0; argv[i] != NULL; i++) + { + cw_free(argv[i]); + } + cw_free(argv); + + cw_free(path); + + if (pid == -1) + { + /* Error, related to some form of resource exhaustion. */ + nxo_thread_nerror(a_thread, NXN_limitcheck); + return; + } + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_get(ostack); + nxo_integer_new(nxo, pid); + } + } +} +#endif + +void +systemdict_ge(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_sint32_t result; + cw_bool_t ge; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + result = nxo_compare(nxo_a, nxo_b); + if (result == 2) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + else if (result >= 0) + { + ge = TRUE; + } + else + { + ge = FALSE; + } + + nxo_boolean_new(nxo_a, ge); + + nxo_stack_pop(ostack); +} + +void +systemdict_get(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *from, *with; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(with, ostack, a_thread); + NXO_STACK_DOWN_GET(from, ostack, a_thread, with); + + switch (nxo_type_get(from)) + { + case NXOT_ARRAY: + { + cw_nxoi_t index; + + if (nxo_type_get(with) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(with); + + if (index < 0 || index >= nxo_array_len_get(from)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_array_el_get(from, index, with); + + nxo_stack_exch(ostack); + nxo_stack_pop(ostack); + break; + } + case NXOT_DICT: + { + cw_nxo_t *val; + + val = nxo_stack_push(ostack); + if (nxo_dict_lookup(from, with, val)) + { + nxo_stack_pop(ostack); + nxo_thread_nerror(a_thread, NXN_undefined); + return; + } + nxo_stack_remove(ostack, with); + nxo_stack_remove(ostack, from); + break; + } + case NXOT_STRING: + { + cw_nxoi_t index; + cw_uint8_t el; + + if (nxo_type_get(with) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(with); + + if (index < 0 || index >= nxo_string_len_get(from)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_string_el_get(from, index, &el); + nxo_integer_set(with, (cw_nxoi_t) el); + + nxo_stack_exch(ostack); + nxo_stack_pop(ostack); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +void +systemdict_getinterval(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *from, *with, *count; + cw_nxoi_t index, len; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(count, ostack, a_thread); + NXO_STACK_DOWN_GET(with, ostack, a_thread, count); + NXO_STACK_DOWN_GET(from, ostack, a_thread, with); + + if ((nxo_type_get(with) != NXOT_INTEGER) + || (nxo_type_get(count) != NXOT_INTEGER)) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(with); + len = nxo_integer_get(count); + if (index < 0 || len < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + switch (nxo_type_get(from)) + { + case NXOT_ARRAY: + { + if (index + len > nxo_array_len_get(from)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_array_subarray_new(count, from, nxo_thread_nx_get(a_thread), + index, len); + break; + } + case NXOT_STRING: + { + if (index + len > nxo_string_len_get(from)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_string_substring_new(count, from, nxo_thread_nx_get(a_thread), + index, len); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_stack_remove(ostack, with); + nxo_stack_remove(ostack, from); +} + +#ifdef CW_POSIX +void +systemdict_gid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, getgid()); +} +#endif + +#ifdef CW_THREADS +void +systemdict_gstderr(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nx_stderr_get(nxo_thread_nx_get(a_thread))); +} +#endif + +#ifdef CW_THREADS +void +systemdict_gstdin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nx_stdin_get(nxo_thread_nx_get(a_thread))); +} +#endif + +#ifdef CW_THREADS +void +systemdict_gstdout(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nx_stdout_get(nxo_thread_nx_get(a_thread))); +} +#endif + +void +systemdict_gt(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_sint32_t result; + cw_bool_t gt; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + result = nxo_compare(nxo_a, nxo_b); + if (result == 2) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + else if (result == 1) + { + gt = TRUE; + } + else + { + gt = FALSE; + } + + nxo_boolean_new(nxo_a, gt); + + nxo_stack_pop(ostack); +} + +void +systemdict_hooktag(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *nxo, *tnxo, *tag; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_HOOK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + + tag = nxo_hook_tag_get(tnxo); + nxo_dup(nxo, tag); + + nxo_stack_pop(tstack); +} + +void +systemdict_ibdup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo, *orig; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (index >= nxo_stack_count(ostack) - 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + orig = nxo_stack_nbget(ostack, index); + nxo_dup(nxo, orig); +} + +void +systemdict_ibpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (index >= nxo_stack_count(ostack) - 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo = nxo_stack_nbget(ostack, index); + nxo_stack_remove(ostack, nxo); + nxo_stack_pop(ostack); +} + +void +systemdict_idiv(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *a, *b; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(b, ostack, a_thread); + NXO_STACK_DOWN_GET(a, ostack, a_thread, b); + if (nxo_type_get(a) != NXOT_INTEGER || nxo_type_get(b) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(b) == 0) + { + nxo_thread_nerror(a_thread, NXN_undefinedresult); + return; + } + + nxo_integer_set(a, nxo_integer_get(a) / nxo_integer_get(b)); + nxo_stack_pop(ostack); +} + +void +systemdict_idup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo, *orig; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + NXO_STACK_NGET(orig, ostack, a_thread, index + 1); + nxo_dup(nxo, orig); +} + +void +systemdict_if(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *cond, *exec; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(exec, ostack, a_thread); + NXO_STACK_DOWN_GET(cond, ostack, a_thread, exec); + if (nxo_type_get(cond) != NXOT_BOOLEAN) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + if (nxo_boolean_get(cond)) + { + cw_nxo_t *estack; + cw_nxo_t *nxo; + + estack = nxo_thread_estack_get(a_thread); + nxo = nxo_stack_push(estack); + nxo_dup(nxo, exec); + nxo_stack_npop(ostack, 2); + nxo_thread_loop(a_thread); + } + else + { + nxo_stack_npop(ostack, 2); + } +} + +void +systemdict_ifelse(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack; + cw_nxo_t *cond, *exec_if, *exec_else, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + + NXO_STACK_GET(exec_else, ostack, a_thread); + + NXO_STACK_DOWN_GET(exec_if, ostack, a_thread, exec_else); + + NXO_STACK_DOWN_GET(cond, ostack, a_thread, exec_if); + if (nxo_type_get(cond) != NXOT_BOOLEAN) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo = nxo_stack_push(estack); + if (nxo_boolean_get(cond)) + { + nxo_dup(nxo, exec_if); + } + else + { + nxo_dup(nxo, exec_else); + } + nxo_stack_npop(ostack, 3); + nxo_thread_loop(a_thread); +} + +void +systemdict_inc(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nxo_integer_set(nxo, nxo_integer_get(nxo) + 1); +} + +void +systemdict_iobuf(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nxo_integer_new(nxo, nxo_file_buffer_size_get(nxo)); +} + +void +systemdict_ipop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + NXO_STACK_NGET(nxo, ostack, a_thread, index + 1); + nxo_stack_remove(ostack, nxo); + nxo_stack_pop(ostack); +} + +void +systemdict_istack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *istack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + istack = nxo_thread_istack_get(a_thread); + + stack = nxo_stack_push(ostack); + nxo_stack_new(stack, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_stack_copy(stack, istack); +} + +#ifdef CW_THREADS +void +systemdict_join(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *thread; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(thread, ostack, a_thread); + if (nxo_type_get(thread) != NXOT_THREAD) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_thread_join(thread); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_known(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *dict, *key; + cw_bool_t known; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(key, ostack, a_thread); + NXO_STACK_DOWN_GET(dict, ostack, a_thread, key); + if (nxo_type_get(dict) != NXOT_DICT) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + known = !nxo_dict_lookup(dict, key, NULL); + nxo_boolean_new(dict, known); + + nxo_stack_pop(ostack); +} + +#ifdef CW_THREADS +void +systemdict_lcheck(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_bool_t locking; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + switch (nxo_type_get(nxo)) + { + case NXOT_BOOLEAN: + case NXOT_CONDITION: + case NXOT_FINO: + case NXOT_HOOK: + case NXOT_INTEGER: + case NXOT_MARK: + case NXOT_MUTEX: + case NXOT_NAME: + case NXOT_NULL: + case NXOT_OPERATOR: + case NXOT_PMARK: +#ifdef CW_REAL + case NXOT_REAL: +#endif +#ifdef CW_REGEX + case NXOT_REGEX: + case NXOT_REGSUB: +#endif + case NXOT_THREAD: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + case NXOT_ARRAY: + case NXOT_DICT: + case NXOT_FILE: + case NXOT_STACK: + case NXOT_STRING: + { + locking = nxo_lcheck(nxo); + break; + } + case NXOT_NO: + default: + { + cw_not_reached(); + } + } + nxo_boolean_new(nxo, locking); +} +#endif + +void +systemdict_le(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_sint32_t result; + cw_bool_t le; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + result = nxo_compare(nxo_a, nxo_b); + if (result == 2) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + else if (result <= 0) + { + le = TRUE; + } + else + { + le = FALSE; + } + + nxo_boolean_new(nxo_a, le); + + nxo_stack_pop(ostack); +} + +void +systemdict_length(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxoi_t len; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_ARRAY: + { + len = nxo_array_len_get(nxo); + break; + } + case NXOT_DICT: + { + len = nxo_dict_count(nxo); + break; + } + case NXOT_NAME: + { + len = nxo_name_len_get(nxo); + break; + } + case NXOT_STRING: + { + len = nxo_string_len_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_integer_new(nxo, len); +} + +#ifdef CW_POSIX +void +systemdict_link(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *filename, *linkname, *tfilename, *tlinkname; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(linkname, ostack, a_thread); + NXO_STACK_DOWN_GET(filename, ostack, a_thread, linkname); + if (nxo_type_get(filename) != NXOT_STRING + || nxo_type_get(linkname) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of filename with an extra byte to store a '\0' + * terminator. */ + tfilename = nxo_stack_push(tstack); + nxo_string_cstring(tfilename, filename, a_thread); + + /* Create a copy of linkname with an extra byte to store a '\0' + * terminator. */ + tlinkname = nxo_stack_push(tstack); + nxo_string_cstring(tlinkname, linkname, a_thread); + + error = link(nxo_string_get(tfilename), nxo_string_get(tlinkname)); + nxo_stack_npop(tstack, 2); + if (error == -1) + { + switch (errno) + { + case EIO: + case EDQUOT: + case EMLINK: + case ENOSPC: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EEXIST: + case ENOENT: + case ENOTDIR: + case EOPNOTSUPP: + { + nxo_thread_nerror(a_thread, NXN_undefinedfilename); + break; + } + case EACCES: + case ENAMETOOLONG: + case ELOOP: + case EPERM: + case EXDEV: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_SOCKET +void +systemdict_listen(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *sock; + cw_uint32_t npop; + int backlog, error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(sock, ostack, a_thread); + if (nxo_type_get(sock) == NXOT_INTEGER) + { + backlog = (int) nxo_integer_get(sock); + NXO_STACK_DOWN_GET(sock, ostack, a_thread, sock); + npop = 2; + } + else + { + /* Maximum backlog. */ + backlog = -1; + npop = 1; + } + if (nxo_type_get(sock) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = listen(nxo_file_fd_get(sock), backlog); + if (error == -1) + { + switch (errno) + { + case EADDRINUSE: + case EOPNOTSUPP: + { + nxo_thread_nerror(a_thread, NXN_neterror); + return; + } + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + case EBADF: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + nxo_stack_npop(ostack, npop); +} +#endif + +#ifdef CW_REAL +void +systemdict_ln(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + if (real <= 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_real_new(nxo, log(real)); +} +#endif + +void +systemdict_load(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *key, *val; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(key, ostack, a_thread); + val = nxo_stack_push(tstack); + + if (nxo_thread_dstack_search(a_thread, key, val)) + { + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, NXN_undefined); + return; + } + nxo_dup(key, val); + nxo_stack_pop(tstack); +} + +#ifdef CW_THREADS +void +systemdict_lock(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *mutex; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(mutex, ostack, a_thread); + if (nxo_type_get(mutex) != NXOT_MUTEX) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_mutex_lock(mutex); + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_REAL +void +systemdict_log(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + if (real <= 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_real_new(nxo, log10(real)); +} +#endif + +void +systemdict_loop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *istack, *tstack; + cw_nxo_t *exec, *nxo, *tnxo; + cw_uint32_t edepth, tdepth; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + istack = nxo_thread_istack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(exec, ostack, a_thread); + + /* Record stack depths so that we can clean up later. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + /* Move the object to be executed to tstack. */ + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, exec); + nxo_stack_pop(ostack); + + /* Catch an exit exception, if thrown, but do not continue executing the + * loop. */ + xep_begin(); + xep_try + { + for (;;) + { + nxo = nxo_stack_push(estack); + nxo_dup(nxo, tnxo); + nxo_thread_loop(a_thread); + } + } + xep_catch(CW_ONYXX_EXIT) + { + xep_handled(); + } + xep_end(); + + /* Clean up stacks. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + nxo_stack_npop(istack, nxo_stack_count(istack) - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); +} + +void +systemdict_lt(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_sint32_t result; + cw_bool_t lt; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: +#ifdef CW_REAL + case NXOT_REAL: +#endif + case NXOT_STRING: + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + result = nxo_compare(nxo_a, nxo_b); + if (result == 2) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + else if (result == -1) + { + lt = TRUE; + } + else + { + lt = FALSE; + } + + nxo_boolean_new(nxo_a, lt); + + nxo_stack_pop(ostack); +} + +#ifdef CW_REGEX +/* Get flags in preparation for calling nxo_regex_new(). */ +CW_P_INLINE cw_nxn_t +systemdict_p_regex_flags_get(cw_nxo_t *a_flags, cw_nxo_t *a_thread, + cw_bool_t *r_cont, cw_bool_t *r_global, + cw_bool_t *r_insensitive, cw_bool_t *r_multiline, + cw_bool_t *r_singleline) +{ + cw_nxn_t retval; + cw_nxo_t *tstack, *tkey, *tval; + cw_nx_t *nx; + + tstack = nxo_thread_tstack_get(a_thread); + tkey = nxo_stack_push(tstack); + tval = nxo_stack_push(tstack); + nx = nxo_thread_nx_get(a_thread); + +#define REGEX_FLAG_GET(a_nxn, a_var) \ + do \ + { \ + if ((a_var) != NULL) \ + { \ + nxo_name_new(tkey, nx, nxn_str(a_nxn), nxn_len(a_nxn), \ + TRUE); \ + if (nxo_dict_lookup(a_flags, tkey, tval)) \ + { \ + *(a_var) = FALSE; \ + } \ + else \ + { \ + if (nxo_type_get(tval) != NXOT_BOOLEAN) \ + { \ + retval = NXN_typecheck; \ + goto RETURN; \ + } \ + \ + *(a_var) = nxo_boolean_get(tval); \ + } \ + } \ + } while (0) + + REGEX_FLAG_GET(NXN_c, r_cont); + REGEX_FLAG_GET(NXN_g, r_global); + REGEX_FLAG_GET(NXN_i, r_insensitive); + REGEX_FLAG_GET(NXN_m, r_multiline); + REGEX_FLAG_GET(NXN_s, r_singleline); + +#undef REGEX_FLAG_GET + + retval = NXN_ZERO; + RETURN: + nxo_stack_npop(tstack, 2); + return retval; +} + +void +systemdict_match(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *flags, *pattern, *input; + cw_uint32_t npop; + cw_bool_t match; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + + npop = 0; + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_DICT: + { + npop++; + flags = nxo; + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Fall through. */ + } + case NXOT_STRING: + { + cw_bool_t cont, global, insensitive, multiline, singleline; + + /* Get regex flags. */ + if (npop != 0) + { + error = systemdict_p_regex_flags_get(flags, a_thread, + &cont, &global, + &insensitive, &multiline, + &singleline); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + } + else + { + cont = FALSE; + global = FALSE; + insensitive = FALSE; + multiline = FALSE; + singleline = FALSE; + } + + /* Get pattern. */ + pattern = nxo; + + npop++; + + /* Get input string. */ + NXO_STACK_DOWN_GET(input, ostack, a_thread, nxo); + if (nxo_type_get(input) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_string_lock(pattern); + error = nxo_regex_nonew_match(a_thread, nxo_string_get(pattern), + nxo_string_len_get(pattern), cont, + global, insensitive, multiline, + singleline, input, &match); + nxo_string_unlock(pattern); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + + break; + } + case NXOT_REGEX: + { + cw_nxo_t *regex; + + npop++; + regex = nxo; + + /* Get input string. */ + NXO_STACK_DOWN_GET(input, ostack, a_thread, nxo); + if (nxo_type_get(input) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_regex_match(regex, a_thread, input, &match); + + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_boolean_new(input, match); + nxo_stack_npop(ostack, npop); +} +#endif + +#ifdef CW_POSIX +void +systemdict_mkdir(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *tnxo; + cw_uint32_t npop; + mode_t mode; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) == NXOT_INTEGER) + { + /* Mode specified. */ + npop = 2; + mode = (mode_t) nxo_integer_get(nxo); + if ((mode & 0777) != mode) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + } + else + { + npop = 1; + mode = 0777; + } + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tnxo = nxo_stack_push(tstack); + nxo_string_cstring(tnxo, nxo, a_thread); + + error = mkdir(nxo_string_get(tnxo), mode); + nxo_stack_pop(tstack); + + if (error == -1) + { + switch (errno) + { + case EIO: + case EDQUOT: + case ENOSPC: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EACCES: + case EEXIST: + case ELOOP: + case ENOENT: + case ENOTDIR: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_npop(ostack, npop); +} +#endif + +#ifdef CW_POSIX +void +systemdict_mkfifo(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *tnxo; + cw_uint32_t npop; + mode_t mode; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) == NXOT_INTEGER) + { + /* Mode specified. */ + npop = 2; + mode = (mode_t) nxo_integer_get(nxo); + if ((mode & 0777) != mode) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + } + else + { + npop = 1; + mode = 0777; + } + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tnxo = nxo_stack_push(tstack); + nxo_string_cstring(tnxo, nxo, a_thread); + + error = mkfifo(nxo_string_get(tnxo), mode); + nxo_stack_pop(tstack); + + if (error == -1) + { + switch (errno) + { + case ENOSPC: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case EACCES: + case EEXIST: + case ENOTDIR: + case ENOENT: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + nxo_stack_npop(ostack, npop); +} +#endif + +void +systemdict_mod(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *a, *b; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(b, ostack, a_thread); + NXO_STACK_DOWN_GET(a, ostack, a_thread, b); + switch (nxo_type_get(a)) + { + case NXOT_INTEGER: + { + switch (nxo_type_get(b)) + { + case NXOT_INTEGER: + { + if (nxo_integer_get(b) == 0) + { + nxo_thread_nerror(a_thread, NXN_undefinedresult); + return; + } + nxo_integer_set(a, nxo_integer_get(a) % nxo_integer_get(b)); + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + if (nxo_real_get(b) == 0.0) + { + nxo_thread_nerror(a_thread, NXN_undefinedresult); + return; + } + nxo_real_new(a, fmod(nxo_integer_get(a), nxo_real_get(b))); + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + switch (nxo_type_get(b)) + { + case NXOT_INTEGER: + { + if (nxo_integer_get(b) == 0) + { + nxo_thread_nerror(a_thread, NXN_undefinedresult); + return; + } + nxo_real_new(a, fmod(nxo_real_get(a), nxo_integer_get(b))); + break; + } + case NXOT_REAL: + { + if (nxo_real_get(b) == 0.0) + { + nxo_thread_nerror(a_thread, NXN_undefinedresult); + return; + } + nxo_real_set(a, fmod(nxo_real_get(a), nxo_real_get(b))); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_stack_pop(ostack); +} + +#ifdef CW_MODULES +/* #define CW_MODLOAD_VERBOSE */ +static cw_nxmod_t * +systemdict_p_nxmod_new(cw_nx_t *a_nx, void *a_handle) +{ + cw_nxmod_t *retval; + + retval = (cw_nxmod_t *) nxa_malloc(nx_nxa_get(a_nx), sizeof(cw_nxmod_t)); + /* Set the default iteration for module destruction to 1. This number can + * be overridden on a per-module basis in the module initialization code. */ + retval->iter = 1; + retval->dlhandle = a_handle; + + return retval; +} + +static cw_nxoe_t * +systemdict_p_nxmod_ref_iter(void *a_data, cw_bool_t a_reset) +{ + return NULL; +} + +static cw_bool_t +systemdict_p_nxmod_delete(void *a_data, cw_nx_t *a_nx, cw_uint32_t a_iter) +{ + cw_bool_t retval; + cw_nxmod_t *nxmod = (cw_nxmod_t *) a_data; + + if (a_iter != nxmod->iter) + { + retval = TRUE; + goto RETURN; + } + +#ifdef CW_MODLOAD_VERBOSE + fprintf(stderr, "dlclose(%p)\n", nxmod->dlhandle); +#endif + dlclose(nxmod->dlhandle); + nxa_free(nx_nxa_get(a_nx), a_data, sizeof(cw_nxmod_t)); + + retval = FALSE; + RETURN: + return retval; +} + +void +systemdict_modload(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *path, *sym, *nxo; + cw_nx_t *nx; + cw_nxmod_t *nxmod; + cw_uint8_t *str; + void *symbol, *handle = NULL; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + NXO_STACK_GET(sym, ostack, a_thread); + NXO_STACK_DOWN_GET(path, ostack, a_thread, sym); + if (nxo_type_get(path) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create '\0'-terminated copy of path. */ + nxo = nxo_stack_push(tstack); + nxo_string_cstring(nxo, path, a_thread); + str = nxo_string_get(nxo); + + /* Try to dlopen(). */ + handle = dlopen(str, RTLD_LAZY); + if (handle == NULL) + { +#ifdef CW_DBG + fprintf(stderr, "dlopen() error: %s\n", dlerror()); +#endif + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } +#ifdef CW_MODLOAD_VERBOSE + fprintf(stderr, "dlopen(\"%s\") handle: %p\n", str, handle); +#endif + + /* Create '\0'-terminated copy of sym. */ + nxo_string_cstring(nxo, sym, a_thread); + str = nxo_string_get(nxo); + + /* Look up symbol. */ +#ifdef CW_MODLOAD_VERBOSE + fprintf(stderr, "dlsym(\"%s\")\n", str); +#endif + symbol = dlsym(handle, str); + + /* Pop nxo. */ + nxo_stack_pop(tstack); + + if (symbol == NULL) + { + /* Couldn't find the symbol. */ +#ifdef CW_DBG + fprintf(stderr, "dlsym() error: %s\n", dlerror()); +#endif + dlclose(handle); + nxo_thread_nerror(a_thread, NXN_undefined); + return; + } + + /* Create a hook whose data pointer is a (cw_nxmod_t), and whose evaluation + * function is the symbol we just looked up. */ + nxmod = systemdict_p_nxmod_new(nx, handle); + nxo = nxo_stack_push(estack); + nxo_hook_new(nxo, nx, nxmod, symbol, systemdict_p_nxmod_ref_iter, + systemdict_p_nxmod_delete); + nxo_dup(nxo_hook_tag_get(nxo), sym); + nxo_attr_set(nxo, NXOA_EXECUTABLE); + + /* Pop the arguments before recursing. */ + nxo_stack_npop(ostack, 2); + + /* Recurse on the hook. */ + nxo_thread_loop(a_thread); +} +#endif + +#ifdef CW_THREADS +void +systemdict_monitor(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack, *proc, *mutex, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(proc, ostack, a_thread); + NXO_STACK_DOWN_GET(mutex, ostack, a_thread, proc); + if (nxo_type_get(mutex) != NXOT_MUTEX) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Dup proc to estack. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, proc); + + /* Dup mutex to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, mutex); + + /* Remove args from ostack. */ + nxo_stack_npop(ostack, 2); + + /* Lock mutex. */ + nxo_mutex_lock(nxo); + + /* Make sure that the mutex gets unlocked, even in the face of + * exceptions. */ + xep_begin(); + xep_try + { + /* Execute proc. */ + nxo_thread_loop(a_thread); + } + xep_acatch + { + /* Don't handle the exception, but unlock mutex. */ + nxo_mutex_unlock(nxo); + } + xep_end(); + + /* Unlock mutex. */ + nxo_mutex_unlock(nxo); + + /* Pop mutex off of tstack. */ + nxo_stack_pop(tstack); +} +#endif + +void +systemdict_mul(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_nxoi_t integer_a, integer_b; +#ifdef CW_REAL + cw_bool_t do_real; + cw_nxor_t real_a, real_b; +#endif + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + do_real = FALSE; +#endif + integer_a = nxo_integer_get(nxo_a); + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + do_real = TRUE; + real_a = nxo_real_get(nxo_a); + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + if (do_real) + { + real_b = (cw_nxor_t) nxo_integer_get(nxo_b); + } + else +#endif + { + integer_b = nxo_integer_get(nxo_b); + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + real_b = nxo_real_get(nxo_b); + if (do_real == FALSE) + { + do_real = TRUE; + real_a = (cw_nxor_t) integer_a; + } + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + +#ifdef CW_REAL + if (do_real) + { + /* nxo_a may be an integer, so use nxo_real_new() rather than + * nxo_real_set(). */ + nxo_real_new(nxo_a, real_a * real_b); + } + else +#endif + { + nxo_integer_set(nxo_a, integer_a * integer_b); + } + + nxo_stack_pop(ostack); +} + +#ifdef CW_THREADS +void +systemdict_mutex(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *mutex; + + ostack = nxo_thread_ostack_get(a_thread); + mutex = nxo_stack_push(ostack); + nxo_mutex_new(mutex, nxo_thread_nx_get(a_thread)); +} +#endif + +void +systemdict_nbpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(ostack) - 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + /* Pop the argument off as well as the count. */ + nxo_stack_pop(ostack); + nxo_stack_nbpop(ostack, count); +} + +void +systemdict_ncat(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *tnxo, *r; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + if (count > 0) + { + cw_nxot_t type; + cw_uint32_t i, j; + + tnxo = nxo; + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + type = nxo_type_get(nxo); + nxo = tnxo; + switch (type) + { + case NXOT_ARRAY: + { + cw_uint32_t len, off, nelms = 0; + + /* Check argument type and add up the total number of + * elements. */ + for (i = 0; i < count; i++) + { + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_ARRAY) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nelms += nxo_array_len_get(nxo); + } + + /* Allocate the array. */ + r = nxo_stack_under_push(ostack, nxo); + nxo_array_new(r, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), nelms); + + /* Fill in the array. */ + for (i = off = 0; i < count; i++) + { + len = nxo_array_len_get(nxo); + for (j = 0; j < len; j++) + { + nxo_array_el_get(nxo, j, tnxo); + nxo_array_el_set(r, tnxo, off); + off++; + } + + nxo = nxo_stack_up_get(ostack, nxo); + } + + break; + } + case NXOT_STACK: + { + cw_nxo_t *tstack, *to, *fr; + + /* Iterate over the stacks to be catenated in one pass, since + * there is no actual need for a first pass to calculate the + * final stack size, unlike with arrays and strings. */ + + tstack = nxo_thread_tstack_get(a_thread); + + /* Allocate the stack. */ + r = nxo_stack_push(tstack); + nxo_stack_new(r, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + + /* Fill in the stack. */ + for (i = 0; i < count; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + if (nxo == NULL) + { + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + if (nxo_type_get(nxo) != NXOT_STACK) + { + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + for (fr = nxo_stack_get(nxo); + fr != NULL; + fr = nxo_stack_down_get(nxo, fr)) + { + to = nxo_stack_bpush(r); + nxo_dup(to, fr); + } + } + + nxo = nxo_stack_under_push(ostack, nxo); + nxo_dup(nxo, r); + nxo_stack_pop(tstack); + + break; + } + case NXOT_STRING: + { + cw_uint32_t len, off, nelms = 0; + + /* Check argument type and add up the total number of + * elements. */ + for (i = 0; i < count; i++) + { + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nelms += nxo_string_len_get(nxo); + } + + /* Allocate the string. */ + r = nxo_stack_under_push(ostack, nxo); + nxo_string_new(r, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), nelms); + + /* Fill in the string. */ + for (i = off = 0; i < count; i++) + { + len = nxo_string_len_get(nxo); + nxo_string_lock(nxo); + nxo_string_set(r, off, nxo_string_get(nxo), len); + nxo_string_unlock(nxo); + off += len; + + nxo = nxo_stack_up_get(ostack, nxo); + } + + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + } + + nxo_stack_npop(ostack, count + 1); +} + +void +systemdict_ndn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(ostack) - 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_pop(ostack); + /* nxo_stack_roll() doesn't allow a count of 0. */ + if (count > 0) + { + nxo_stack_roll(ostack, count, -1); + } +} + +void +systemdict_ndup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *dup; + cw_uint32_t i; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(ostack) - 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + nxo_stack_pop(ostack); + + /* Iterate down the stack, creating dup's along the way. Since we're going + * down, it's necessary to use nxo_stack_under_push() to preserve order. */ + for (i = 0, nxo = NULL, dup = NULL; i < count; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + dup = nxo_stack_under_push(ostack, dup); + nxo_dup(dup, nxo); + } +} + +void +systemdict_ne(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_sint32_t result; + cw_bool_t ne; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + result = nxo_compare(nxo_a, nxo_b); + if (result == 0) + { + ne = FALSE; + } + else + { + ne = TRUE; + } + + nxo_boolean_new(nxo_a, ne); + + nxo_stack_pop(ostack); +} + +void +systemdict_neg(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *a; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(a, ostack, a_thread); + switch (nxo_type_get(a)) + { + case NXOT_INTEGER: + { + nxo_integer_set(a, -nxo_integer_get(a)); + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + nxo_real_set(a, -nxo_real_get(a)); + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +void +systemdict_nip(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_NGET(nxo, ostack, a_thread, 1); + nxo_stack_remove(ostack, nxo); +} + +void +systemdict_nonblocking(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_bool_t nonblocking; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nonblocking = nxo_file_nonblocking_get(nxo); + nxo_boolean_new(nxo, nonblocking); +} + +void +systemdict_not(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + + if (nxo_type_get(nxo) == NXOT_BOOLEAN) + { + nxo_boolean_set(nxo, !nxo_boolean_get(nxo)); + } + else if (nxo_type_get(nxo) == NXOT_INTEGER) + { + nxo_integer_set(nxo, ~nxo_integer_get(nxo)); + } + else + { + nxo_thread_nerror(a_thread, NXN_typecheck); + } +} + +void +systemdict_npop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + /* Pop the argument off as well as the count. */ + NXO_STACK_NPOP(ostack, a_thread, count + 1); +} + +#ifdef CW_POSIX +void +systemdict_nsleep(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + int error; + struct timespec sleeptime, remainder; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(nxo) <= 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + sleeptime.tv_sec = nxo_integer_get(nxo) / 1000000000LL; + sleeptime.tv_nsec = nxo_integer_get(nxo) % 1000000000LL; + + for (;;) + { + error = nanosleep(&sleeptime, &remainder); + if (error == 0) + { + /* We've slept the entire time. */ + break; + } + /* A signal interrupted us. Sleep some more. */ + memcpy(&sleeptime, &remainder, sizeof(struct timespec)); + } + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_nup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(ostack) - 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_pop(ostack); + /* nxo_stack_roll() doesn't allow a count of 0. */ + if (count > 0) + { + nxo_stack_roll(ostack, count, 1); + } +} + +#ifdef CW_REGEX +void +systemdict_offset(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *input, *submatch; + cw_uint8_t *instr, *inend, *smstr, *smend; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(submatch, ostack, a_thread); + NXO_STACK_DOWN_GET(input, ostack, a_thread, submatch); + if (nxo_type_get(input) != NXOT_STRING + || nxo_type_get(submatch) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Get pointers that bound the input string. */ + instr = nxo_string_get(input); + inend = &instr[nxo_string_len_get(input)]; + + /* Get substring. */ + smstr = nxo_string_get(submatch); + smend = &smstr[nxo_string_len_get(submatch)]; + + /* Make sure smstr really is a substring of instr (or equal in position and + * length). */ + if (smstr < instr || smstr >= inend || smend > inend) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + /* Calculate the substring offset and store it on ostack. */ + nxo_integer_new(input, (cw_nxoi_t) (smstr - instr)); + + /* Clean up ostack. */ + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_POSIX +void +systemdict_open(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *name, *flags, *file; + cw_uint32_t npop; + mode_t mode; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(flags, ostack, a_thread); + if (nxo_type_get(flags) == NXOT_INTEGER) + { + /* Mode specified. */ + npop = 2; + mode = (mode_t) nxo_integer_get(flags); + if ((mode & 0777) != mode) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + NXO_STACK_DOWN_GET(flags, ostack, a_thread, flags); + } + else + { + npop = 1; + mode = 0777; + } + NXO_STACK_DOWN_GET(name, ostack, a_thread, flags); + if (nxo_type_get(name) != NXOT_STRING || nxo_type_get(flags) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + file = nxo_stack_push(tstack); + nxo_file_new(file, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_string_lock(name); + error = nxo_file_open(file, nxo_string_get(name), + nxo_string_len_get(name), nxo_string_get(flags), + nxo_string_len_get(flags), mode); + nxo_string_unlock(name); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_file_buffer_size_set(file, CW_LIBONYX_FILE_BUFFER_SIZE); + + nxo_stack_npop(ostack, npop); + nxo_dup(name, file); + nxo_stack_pop(tstack); +} +#endif + +void +systemdict_or(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + if (nxo_type_get(nxo_a) == NXOT_BOOLEAN + && nxo_type_get(nxo_b) == NXOT_BOOLEAN) + { + cw_bool_t or; + + if (nxo_boolean_get(nxo_a) || nxo_boolean_get(nxo_b)) + or = TRUE; + else + or = FALSE; + nxo_boolean_new(nxo_a, or); + } + else if (nxo_type_get(nxo_a) == NXOT_INTEGER + && nxo_type_get(nxo_b) == NXOT_INTEGER) + { + nxo_integer_set(nxo_a, nxo_integer_get(nxo_a) | nxo_integer_get(nxo_b)); + } + else + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_stack_pop(ostack); +} + +void +systemdict_ostack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + stack = nxo_stack_push(ostack); + nxo_stack_new(stack, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_stack_copy(stack, ostack); + + /* Pop the top element off the stack, since it's a reference to the stack + * itself. */ + nxo_stack_pop(stack); +} + +void +systemdict_over(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *under, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_NGET(under, ostack, a_thread, 1); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, under); +} + +#ifdef CW_SOCKET +static void +systemdict_p_peername(cw_nxo_t *a_thread, cw_bool_t a_peer) +{ + cw_nxo_t *ostack, *tstack, *nxo, *tkey, *tval; + cw_nx_t *nx; + sa_family_t family; + int len, error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Get the socket family. */ + if (systemdict_p_sock_family(a_thread, nxo_file_fd_get(nxo), a_peer, + &family)) + { + return; + } + + switch (family) + { + case AF_INET: + { + struct sockaddr_in sa; + + len = sizeof(sa); + if (a_peer) + { + error = getpeername(nxo_file_fd_get(nxo), + (struct sockaddr *) &sa, &len); + } + else + { + error = getsockname(nxo_file_fd_get(nxo), + (struct sockaddr *) &sa, &len); + } + if (error == -1) + { + switch (errno) + { + case EBADF: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + case ENOBUFS: + { + xep_throw(CW_ONYXX_OOM); + /* Not reached. */ + } + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + tkey = nxo_stack_push(tstack); + tval = nxo_stack_push(tstack); + + nxo_dict_new(nxo, nx, nxo_thread_currentlocking(a_thread), 3); + + /* family. */ + nxo_name_new(tkey, nx, nxn_str(NXN_family), nxn_len(NXN_family), + TRUE); + nxo_name_new(tval, nx, nxn_str(NXN_AF_INET), nxn_len(NXN_AF_INET), + TRUE); + nxo_dict_def(nxo, nx, tkey, tval); + + /* address. */ + nxo_name_new(tkey, nx, nxn_str(NXN_address), nxn_len(NXN_address), + TRUE); + nxo_integer_new(tval, ntohl(sa.sin_addr.s_addr)); + nxo_dict_def(nxo, nx, tkey, tval); + + /* port. */ + nxo_name_new(tkey, nx, nxn_str(NXN_port), nxn_len(NXN_port), + TRUE); + nxo_integer_new(tval, ntohs(sa.sin_port)); + nxo_dict_def(nxo, nx, tkey, tval); + + nxo_stack_npop(tstack, 2); + break; + } + case AF_LOCAL: + { + struct sockaddr_un sa; + cw_uint32_t pathlen; + + len = sizeof(sa); + if (a_peer) + { + error = getpeername(nxo_file_fd_get(nxo), + (struct sockaddr *) &sa, &len); + } + else + { + error = getsockname(nxo_file_fd_get(nxo), + (struct sockaddr *) &sa, &len); + } + if (error == -1) + { + switch (errno) + { + case EBADF: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + case ENOBUFS: + { + xep_throw(CW_ONYXX_OOM); + /* Not reached. */ + } + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + tkey = nxo_stack_push(tstack); + tval = nxo_stack_push(tstack); + + nxo_dict_new(nxo, nx, nxo_thread_currentlocking(a_thread), 2); + + /* family. */ + nxo_name_new(tkey, nx, nxn_str(NXN_family), nxn_len(NXN_family), + TRUE); + nxo_name_new(tval, nx, nxn_str(NXN_AF_LOCAL), nxn_len(NXN_AF_LOCAL), + TRUE); + nxo_dict_def(nxo, nx, tkey, tval); + + /* path. */ + pathlen = strlen(sa.sun_path); + nxo_name_new(tkey, nx, nxn_str(NXN_path), nxn_len(NXN_path), + TRUE); + nxo_string_new(tval, nx, nxo_thread_currentlocking(a_thread), + pathlen); + nxo_string_set(tval, 0, sa.sun_path, pathlen); + nxo_dict_def(nxo, nx, tkey, tval); + + nxo_stack_npop(tstack, 2); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } +} + +void +systemdict_peername(cw_nxo_t *a_thread) +{ + systemdict_p_peername(a_thread, TRUE); +} +#endif + +#ifdef CW_POSIX +void +systemdict_pid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, getpid()); +} +#endif + +#ifdef CW_POSIX +void +systemdict_pipe(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + int filedes[2], error; + + ostack = nxo_thread_ostack_get(a_thread); + + error = pipe(filedes); + if (error == -1) + { + switch (errno) + { + case EMFILE: + case ENFILE: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + /* Read fd. */ + nxo = nxo_stack_push(ostack); + nxo_file_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_file_fd_wrap(nxo, filedes[0]); + + /* Write fd. */ + nxo = nxo_stack_push(ostack); + nxo_file_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_file_fd_wrap(nxo, filedes[1]); +} +#endif + +#ifdef CW_POSIX +void +systemdict_poll(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *dict, *file, *flags, *flag; + cw_nxo_t *pollin, *pollrdnorm, *pollrdband, *pollpri; + cw_nxo_t *pollout, *pollwrnorm, *pollwrband; + cw_nxo_t *pollerr, *pollhup, *pollnval; + cw_nxo_t boolean_true, boolean_false; + cw_nx_t *nx; + cw_nxa_t *nxa; + struct pollfd *fds; + unsigned i, nfds; + int nready; + cw_uint32_t j, nflags; + cw_bool_t changed; + cw_uint32_t tcount; + cw_nxoi_t timeout; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + tcount = nxo_stack_count(tstack); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + timeout = nxo_integer_get(nxo); + if (timeout < -1 || timeout > INT_MAX) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_DICT) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + dict = nxo_stack_push(tstack); + nxo_dup(dict, nxo); + + nx = nxo_thread_nx_get(a_thread); + nxa = nx_nxa_get(nx); + nxo_boolean_new(&boolean_true, TRUE); + nxo_boolean_new(&boolean_false, FALSE); + + /* Create names for flags. */ +#define POLLFLAGNAME(a_name, a_nxn) \ + do \ + { \ + (a_name) = nxo_stack_push(tstack); \ + nxo_name_new((a_name), nx, nxn_str(a_nxn), \ + nxn_len(a_nxn), TRUE); \ + } while (0) + + POLLFLAGNAME(pollin, NXN_POLLIN); + POLLFLAGNAME(pollrdnorm, NXN_POLLRDNORM); + POLLFLAGNAME(pollrdband, NXN_POLLRDBAND); + POLLFLAGNAME(pollpri, NXN_POLLPRI); + POLLFLAGNAME(pollout, NXN_POLLOUT); + POLLFLAGNAME(pollwrnorm, NXN_POLLWRNORM); + POLLFLAGNAME(pollwrband, NXN_POLLWRBAND); + POLLFLAGNAME(pollerr, NXN_POLLERR); + POLLFLAGNAME(pollhup, NXN_POLLHUP); + POLLFLAGNAME(pollnval, NXN_POLLNVAL); +#undef POLLFLAGNAME + + file = nxo_stack_push(tstack); + flag = nxo_stack_push(tstack); + flags = nxo_stack_push(tstack); + + /* Convert the dict of file/flags pairs to an array of struct pollfd + * structures. */ + nfds = nxo_dict_count(dict); + if (nfds == 0) + { + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tcount); + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + fds = nxa_malloc(nxa, nfds * sizeof(struct pollfd)); + + /* Iterate through files. */ + for (i = 0; i < nfds; i++) + { + nxo_dict_iterate(dict, file); + nxo_dict_lookup(dict, file, flags); + if (nxo_type_get(file) != NXOT_FILE || nxo_type_get(flags) != NXOT_DICT) + { + nxa_free(nxa, fds, nfds * sizeof(struct pollfd)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tcount); + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + fds[i].fd = nxo_file_fd_get(file); + fds[i].events = 0; + nflags = nxo_dict_count(flags); + if (nflags == 0) + { + nxa_free(nxa, fds, nfds * sizeof(struct pollfd)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tcount); + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + /* Iterate through flags. */ + for (j = 0; j < nflags; j++) + { + nxo_dict_iterate(flags, flag); + if (nxo_type_get(flag) == NXOT_NAME) + { +#define ADDPOLLFLAG(a_name, a_flag) \ + if (nxo_compare(flag, (a_name)) == 0) \ + { \ + fds[i].events |= (a_flag); \ + nxo_dict_def(flags, nx, flag, &boolean_false); \ + } +#define CLEARPOLLERROR(a_name, a_flag) \ + if (nxo_compare(flag, (a_name)) == 0) \ + { \ + nxo_dict_def(flags, nx, flag, &boolean_false); \ + } + + /* List these in order of most to least used. */ + ADDPOLLFLAG(pollin, POLLIN) + else ADDPOLLFLAG(pollout, POLLOUT) + else ADDPOLLFLAG(pollrdnorm, POLLRDNORM) + else ADDPOLLFLAG(pollwrnorm, POLLWRNORM) + else ADDPOLLFLAG(pollrdband, POLLRDBAND) + else ADDPOLLFLAG(pollwrband, POLLWRBAND) + else ADDPOLLFLAG(pollpri, POLLPRI) + else CLEARPOLLERROR(pollerr, POLLERR) + else CLEARPOLLERROR(pollhup, POLLHUP) + else CLEARPOLLERROR(pollnval, POLLNVAL); +#undef ADDPOLLFLAG +#undef CLEARPOLLERROR + } + } + } + + /* Call poll(). */ + while ((nready = poll(fds, nfds, (int) timeout)) == -1 && errno == EINTR) + { + /* EINTR; try again. */ + } + if (nready == -1) + { + switch (errno) + { + case ENOMEM: + { + xep_throw(CW_ONYXX_OOM); + } + default: + { + cw_not_reached(); + } + } + } + + /* Translate the results. */ + nxo_array_new(nxo, nx, nxo_thread_currentlocking(a_thread), nready); + for (i = j = 0, changed = FALSE; i < nfds && j < nready; i++) + { + nxo_dict_iterate(dict, file); + nxo_dict_lookup(dict, file, flags); + cw_assert(nxo_file_fd_get(file) == fds[i].fd); + +#define CHECKPOLLFLAG(a_var, a_flag) \ + if ((fds[i].events & (a_flag)) && (fds[i].revents & (a_flag))) \ + { \ + nxo_dict_def(flags, nx, (a_var), &boolean_true); \ + nxo_array_el_set(nxo, file, j); \ + changed = TRUE; \ + } +#define CHECKPOLLERROR(a_var, a_flag) \ + if (fds[i].revents & (a_flag)) \ + { \ + nxo_dict_def(flags, nx, (a_var), &boolean_true); \ + nxo_array_el_set(nxo, file, j); \ + changed = TRUE; \ + } + + CHECKPOLLFLAG(pollin, POLLIN); + CHECKPOLLFLAG(pollrdnorm, POLLRDNORM); + CHECKPOLLFLAG(pollrdband, POLLRDBAND); + CHECKPOLLFLAG(pollpri, POLLPRI); + CHECKPOLLFLAG(pollout, POLLOUT); + CHECKPOLLFLAG(pollwrnorm, POLLWRNORM); + CHECKPOLLFLAG(pollwrband, POLLWRBAND); + CHECKPOLLERROR(pollerr, POLLERR); + CHECKPOLLERROR(pollhup, POLLHUP); + CHECKPOLLERROR(pollnval, POLLNVAL); + +#undef CHECKPOLLFLAG +#undef CHECKPOLLERROR + + if (changed) + { + changed = FALSE; + j++; + } + } + + nxo_stack_pop(ostack); + nxa_free(nxa, fds, nfds * sizeof(struct pollfd)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tcount); +} +#endif + +void +systemdict_pop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_POP(ostack, a_thread); +} + +void +systemdict_pow(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *base, *exp; + cw_nxoi_t integer_base, integer_exp; +#ifdef CW_REAL + cw_bool_t do_real; + cw_nxor_t real_base, real_exp; +#endif + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(exp, ostack, a_thread); + NXO_STACK_DOWN_GET(base, ostack, a_thread, exp); + switch (nxo_type_get(base)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + do_real = FALSE; +#endif + integer_base = nxo_integer_get(base); + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + do_real = TRUE; + real_base = nxo_real_get(base); + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(exp)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + if (do_real) + { + real_exp = (cw_nxor_t) nxo_integer_get(exp); + } + else +#endif + { + integer_exp = nxo_integer_get(exp); + if (integer_exp < 0) + { +#ifdef CW_REAL + do_real = TRUE; + real_base = (cw_nxor_t) integer_base; + real_exp = (cw_nxor_t) integer_exp; +#else + /* The rangecheck error for exp is not documented in the + * reference manual, since a non-standard configuration is + * required for this code to be compiled in. */ + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; +#endif + } + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + real_exp = nxo_real_get(exp); + if (do_real == FALSE) + { + do_real = TRUE; + real_base = (cw_nxor_t) integer_base; + } + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + +#ifdef CW_REAL + if (do_real) + { + /* base may be an integer, so use nxo_real_new() rather than + * nxo_real_set(). */ + nxo_real_new(base, pow(real_base, real_exp)); + } + else +#endif + { + cw_uint32_t i; + cw_nxoi_t r; + + if (integer_exp != 0) + { + for (i = 1, r = integer_base; i < integer_exp; i++) + { + r *= integer_base; + } + } + else + { + /* base^0 --> 1. */ + r = 1; + } + + nxo_integer_set(base, r); + } + + nxo_stack_pop(ostack); +} + +#ifdef CW_POSIX +void +systemdict_ppid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, getppid()); +} +#endif + +void +systemdict_print(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo, *stdout_nxo; + cw_nxn_t error; + cw_bool_t nonblocking; + + ostack = nxo_thread_ostack_get(a_thread); + stdout_nxo = nxo_thread_stdout_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nonblocking = nxo_file_nonblocking_get(stdout_nxo); + if (nonblocking) + { + nxo_file_nonblocking_set(stdout_nxo, FALSE); + } + + nxo_string_lock(nxo); + error = nxo_file_write(stdout_nxo, nxo_string_get(nxo), + nxo_string_len_get(nxo), NULL); + nxo_string_unlock(nxo); + + if (nonblocking) + { + nxo_file_nonblocking_set(stdout_nxo, TRUE); + } + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_stack_pop(ostack); +} + +void +systemdict_put(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *into, *with, *what; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(what, ostack, a_thread); + NXO_STACK_DOWN_GET(with, ostack, a_thread, what); + NXO_STACK_DOWN_GET(into, ostack, a_thread, with); + + switch (nxo_type_get(into)) + { + case NXOT_ARRAY: + { + cw_nxoi_t index; + + if (nxo_type_get(with) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(with); + + if (index < 0 || index >= nxo_array_len_get(into)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_array_el_set(into, what, index); + break; + } + case NXOT_DICT: + { + nxo_dict_def(into, nxo_thread_nx_get(a_thread), with, what); + break; + } + case NXOT_STRING: + { + cw_nxoi_t index; + cw_uint8_t val; + + if ((nxo_type_get(with) != NXOT_INTEGER) + || nxo_type_get(what) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(with); + val = nxo_integer_get(what); + + if (index < 0 || index >= nxo_string_len_get(into)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_string_el_set(into, val, index); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_stack_npop(ostack, 3); +} + +void +systemdict_putinterval(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *into, *with, *what; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(what, ostack, a_thread); + NXO_STACK_DOWN_GET(with, ostack, a_thread, what); + NXO_STACK_DOWN_GET(into, ostack, a_thread, with); + + if (nxo_type_get(with) != NXOT_INTEGER + || nxo_type_get(what) != nxo_type_get(into)) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(with); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + switch (nxo_type_get(into)) + { + case NXOT_ARRAY: + { + cw_nxo_t *tstack; + cw_nxo_t *el; + cw_uint32_t i, len; + + tstack = nxo_thread_tstack_get(a_thread); + el = nxo_stack_push(tstack); + len = nxo_array_len_get(what); + if (index + len > nxo_array_len_get(into)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + nxo_stack_pop(tstack); + return; + } + for (i = 0; i < len; i++) + { + nxo_array_el_get(what, i, el); + nxo_array_el_set(into, el, i + index); + } + nxo_stack_pop(tstack); + break; + } + case NXOT_STRING: + { + cw_uint8_t *str; + cw_uint32_t len; + + str = nxo_string_get(what); + len = nxo_string_len_get(what); + if (index + len > nxo_string_len_get(into)) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_string_lock(what); + nxo_string_lock(into); + nxo_string_set(into, index, str, len); + nxo_string_unlock(into); + nxo_string_unlock(what); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_stack_npop(ostack, 3); +} + +#ifdef CW_POSIX +void +systemdict_pwd(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + char *str; + + str = getcwd(NULL, 0); + if (str == NULL) + { + nxo_thread_nerror(a_thread, NXN_invalidaccess); + return; + } + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), strlen(str)); + nxo_string_lock(nxo); + nxo_string_set(nxo, 0, str, nxo_string_len_get(nxo)); + nxo_string_unlock(nxo); + + free(str); +} +#endif + +void +systemdict_quit(cw_nxo_t *a_thread) +{ + xep_throw(CW_ONYXX_QUIT); +} + +void +systemdict_rand(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *num; + + ostack = nxo_thread_ostack_get(a_thread); + + num = nxo_stack_push(ostack); + /* random() returns 31 bits. */ + nxo_integer_new(num, + ((cw_nxoi_t) (random() & 1)) + | (((cw_nxoi_t) random()) << 1) + | (((cw_nxoi_t) random()) << 32)); +} + +void +systemdict_read(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + cw_uint8_t val; + cw_sint32_t nread; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + switch (nxo_type_get(file)) + { + case NXOT_FILE: + { + cw_nxo_t *value, *code; + + /* Character read. */ + value = nxo_stack_push(ostack); + code = nxo_stack_push(ostack); + + nread = nxo_file_read(file, 1, &val); + if (nread == -1) + { + nxo_stack_npop(ostack, 2); + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + + if (nread == 0) + { + nxo_integer_new(value, 0); + nxo_boolean_new(code, TRUE); + } + else + { + nxo_integer_new(value, (cw_nxoi_t) val); + nxo_boolean_new(code, FALSE); + } + + nxo_stack_remove(ostack, file); + break; + } + case NXOT_STRING: + { + cw_nxo_t *string; + + /* String read. */ + string = file; + NXO_STACK_DOWN_GET(file, ostack, a_thread, string); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_string_lock(string); + nread = nxo_file_read(file, nxo_string_len_get(string), + nxo_string_get(string)); + nxo_string_unlock(string); + if (nread == -1) + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + + if (nread == 0) + { + /* EOF. */ + nxo_boolean_new(file, TRUE); + nxo_string_new(string, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), 0); + nxo_stack_exch(ostack); + } + else if (nread < nxo_string_len_get(string)) + { + cw_nxo_t *value, *code; + + /* We didn't fill the string, so we can't just use it as the + * result. Create a copy. */ + value = nxo_stack_under_push(ostack, file); + nxo_string_substring_new(value, string, + nxo_thread_nx_get(a_thread), 0, nread); + code = nxo_stack_under_push(ostack, file); + nxo_boolean_new(code, FALSE); + + nxo_stack_npop(ostack, 2); + } + else + { + /* The string is full, so doesn't need modified. */ + nxo_boolean_new(file, FALSE); + nxo_stack_exch(ostack); + } + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +void +systemdict_readline(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *tfile; + cw_nxn_t error; + cw_bool_t eof; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tfile = nxo_stack_push(tstack); + nxo_dup(tfile, nxo); + error = nxo_file_readline(tfile, nxo_thread_currentlocking(a_thread), nxo, + &eof); + if (error) + { + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, error); + return; + } + nxo_stack_pop(tstack); + + nxo = nxo_stack_push(ostack); + nxo_boolean_new(nxo, eof); +} + +#ifdef CW_POSIX +void +systemdict_readlink(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *nxo, *tnxo, *link; + struct stat sb; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of the string with an extra byte to store a '\0' + * terminator. */ + tnxo = nxo_stack_push(tstack); + nxo_string_cstring(tnxo, nxo, a_thread); + + error = lstat(nxo_string_get(tnxo), &sb); + if (error == -1) + { + nxo_stack_pop(tstack); + + switch (errno) + { + case EACCES: + { + nxo_thread_nerror(a_thread, NXN_invalidaccess); + return; + } + case ENOENT: + case ENOTDIR: + { + nxo_thread_nerror(a_thread, NXN_undefinedfilename); + return; + } + case EIO: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case ELOOP: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + case EOVERFLOW: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + link = nxo_stack_push(ostack); + nxo_string_new(link, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), sb.st_size); + + error = readlink(nxo_string_get(tnxo), nxo_string_get(link), sb.st_size); + if (error == -1) + { + nxo_stack_pop(ostack); + nxo_stack_pop(tstack); + + switch (errno) + { + case EACCES: + { + nxo_thread_nerror(a_thread, NXN_invalidaccess); + return; + } + case ENOENT: + case ENOTDIR: + case EINVAL: + { + nxo_thread_nerror(a_thread, NXN_undefinedfilename); + return; + } + case EIO: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case ELOOP: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + case EFAULT: + case ENOMEM: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + nxo_stack_remove(ostack, nxo); + nxo_stack_pop(tstack); +} +#endif + +#ifdef CW_POSIX +void +systemdict_realtime(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + struct timeval tv; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + + gettimeofday(&tv, NULL); + nxo_integer_new(nxo, (((cw_nxoi_t) tv.tv_sec * (cw_nxoi_t) 1000000000) + + ((cw_nxoi_t) tv.tv_usec * (cw_nxoi_t) 1000))); +} +#endif + +#ifdef CW_SOCKET +static const struct cw_systemdict_name_arg send_recv_flag[] = +{ + {NXN_MSG_OOB, MSG_OOB}, + {NXN_MSG_PEEK, MSG_PEEK}, + {NXN_MSG_WAITALL, MSG_WAITALL} +}; + +void +systemdict_recv(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *sock, *nxo; + cw_uint32_t npop; + int flags, nread; + + ostack = nxo_thread_ostack_get(a_thread); + + /* Process flags array, if specified. */ + NXO_STACK_GET(nxo, ostack, a_thread); + flags = 0; + if (nxo_type_get(nxo) == NXOT_ARRAY) + { + cw_nxo_t *tstack, *el; + cw_uint32_t i, count, argcnt, argind; + + tstack = nxo_thread_tstack_get(a_thread); + el = nxo_stack_push(tstack); + + argcnt = sizeof(send_recv_flag) / sizeof(struct cw_systemdict_name_arg); + for (i = 0, count = nxo_array_len_get(nxo); i < count; i++) + { + nxo_array_el_get(nxo, i, el); + argind = systemdict_p_name_arg(nxo, send_recv_flag, argcnt); + if (argind == argcnt) + { + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + flags |= send_recv_flag[argind].arg; + } + + nxo_stack_pop(tstack); + + /* Get string. */ + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + npop = 2; + } + else + { + npop = 1; + } + NXO_STACK_DOWN_GET(sock, ostack, a_thread, nxo); + if (nxo_type_get(sock) != NXOT_FILE || nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_string_lock(nxo); + nread = recv(nxo_file_fd_get(sock), nxo_string_get(nxo), + nxo_string_len_get(nxo), flags); + nxo_string_unlock(nxo); + + if (nread == -1) + { + switch (errno) + { + case EWOULDBLOCK: + { + /* Failed non-blocking read. */ + nread = 0; + break; + } + case ENOTCONN: + { + nxo_thread_nerror(a_thread, NXN_neterror); + return; + } + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + case EBADF: + case EFAULT: + case EINTR: + case EINVAL: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + if (nread < nxo_string_len_get(nxo)) + { + /* Create a substring. */ + nxo_string_substring_new(sock, nxo, nxo_thread_nx_get(a_thread), + 0, (cw_uint32_t) nread); + } + else + { + /* Entire string filled; return it as-is. */ + nxo_dup(sock, nxo); + } + + nxo_stack_npop(ostack, npop); +} +#endif + +#ifdef CW_POSIX +void +systemdict_rename(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *from, *to, *tfrom, *tto; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(to, ostack, a_thread); + NXO_STACK_DOWN_GET(from, ostack, a_thread, to); + + if (nxo_type_get(from) != NXOT_STRING + || nxo_type_get(to) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_string_len_get(from) >= PATH_MAX + || nxo_string_len_get(to) >= PATH_MAX) + { + nxo_thread_nerror(a_thread, NXN_limitcheck); + return; + } + + tto = nxo_stack_push(tstack); + nxo_string_cstring(tto, to, a_thread); + + tfrom = nxo_stack_push(tstack); + nxo_string_cstring(tfrom, from, a_thread); + + if (rename(nxo_string_get(tfrom), nxo_string_get(tto)) == -1) + { + switch (errno) + { + case EACCES: + case EPERM: + case EROFS: + case EINVAL: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + } + case ENAMETOOLONG: + case ENOENT: + case ENOTDIR: + { + nxo_thread_nerror(a_thread, NXN_undefinedfilename); + } + default: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + } + } + nxo_stack_npop(tstack, 2); + return; + } + + nxo_stack_npop(tstack, 2); + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_REGEX +void +systemdict_regex(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *pattern, *nxo; + cw_nxn_t error; + cw_uint32_t npop; + cw_bool_t cont, global, insensitive, multiline, singleline; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(pattern, ostack, a_thread); + switch (nxo_type_get(pattern)) + { + case NXOT_DICT: + { + cw_nxo_t *flags; + + flags = pattern; + npop = 2; + NXO_STACK_DOWN_GET(pattern, ostack, a_thread, pattern); + if (nxo_type_get(pattern) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = systemdict_p_regex_flags_get(flags, a_thread, &cont, + &global, &insensitive, + &multiline, &singleline); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + break; + } + case NXOT_STRING: + { + npop = 1; + + cont = FALSE; + global = FALSE; + insensitive = FALSE; + multiline = FALSE; + singleline = FALSE; + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + /* Create the regex object. */ + nxo = nxo_stack_under_push(ostack, pattern); + nxo_string_lock(pattern); + error = nxo_regex_new(nxo, nxo_thread_nx_get(a_thread), + nxo_string_get(pattern), + nxo_string_len_get(pattern), cont, global, + insensitive, multiline, singleline); + nxo_string_unlock(pattern); + if (error) + { + nxo_stack_remove(ostack, nxo); + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_stack_npop(ostack, npop); +} +#endif + +#ifdef CW_REGEX +void +systemdict_regsub(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *pattern, *template, *nxo; + cw_nxn_t error; + cw_uint32_t npop; + cw_bool_t global, insensitive, multiline, singleline; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(template, ostack, a_thread); + switch (nxo_type_get(template)) + { + case NXOT_DICT: + { + cw_nxo_t *flags; + + flags = template; + npop = 3; + NXO_STACK_DOWN_GET(template, ostack, a_thread, template); + if (nxo_type_get(template) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = systemdict_p_regex_flags_get(flags, a_thread, NULL, + &global, &insensitive, + &multiline, &singleline); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + break; + } + case NXOT_STRING: + { + npop = 2; + + global = FALSE; + insensitive = FALSE; + multiline = FALSE; + singleline = FALSE; + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + NXO_STACK_DOWN_GET(pattern, ostack, a_thread, template); + if (nxo_type_get(pattern) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create the regex object. */ + nxo = nxo_stack_under_push(ostack, pattern); + nxo_string_lock(pattern); + nxo_string_lock(template); + error = nxo_regsub_new(nxo, nxo_thread_nx_get(a_thread), + nxo_string_get(pattern), + nxo_string_len_get(pattern), global, + insensitive, multiline, singleline, + nxo_string_get(template), + nxo_string_len_get(template)); + nxo_string_unlock(template); + nxo_string_unlock(pattern); + if (error) + { + nxo_stack_remove(ostack, nxo); + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_stack_npop(ostack, npop); +} +#endif + +void +systemdict_repeat(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *count, *exec, *nxo, *tnxo; + cw_nxoi_t i, cnt; + cw_uint32_t edepth, tdepth; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(exec, ostack, a_thread); + NXO_STACK_DOWN_GET(count, ostack, a_thread, exec); + if (nxo_type_get(count) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + cnt = nxo_integer_get(count); + if (cnt < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, exec); + + nxo_stack_npop(ostack, 2); + + /* Record stack depths so that we can clean up if necessary. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + /* Catch an exit exception, if thrown, but do not continue executing the + * loop. */ + xep_begin(); + xep_try + { + for (i = 0; i < cnt; i++) + { + nxo = nxo_stack_push(estack); + nxo_dup(nxo, tnxo); + nxo_thread_loop(a_thread); + } + } + xep_catch(CW_ONYXX_EXIT) + { + cw_nxo_t *istack; + + xep_handled(); + + /* Clean up stacks. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) + - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); + } + xep_end(); + + /* An object is pushed before tdepth is stored, so we can unconditionally + * pop it here. */ + nxo_stack_pop(tstack); +} + +#ifdef CW_POSIX +void +systemdict_rmdir(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *path, *tpath; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(path, ostack, a_thread); + if (nxo_type_get(path) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of path with an extra byte to store a '\0' terminator. */ + tpath = nxo_stack_push(tstack); + nxo_string_cstring(tpath, path, a_thread); + + error = rmdir(nxo_string_get(tpath)); + + nxo_stack_pop(tstack); + + if (error == -1) + { + switch (errno) + { + case EBUSY: + case EIO: + case ENOTEMPTY: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EACCES: + case ELOOP: + case ENOENT: + case ENOTDIR: + case ENAMETOOLONG: + case EPERM: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_roll(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxoi_t count, amount; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + amount = nxo_integer_get(nxo); + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 1) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_stack_npop(ostack, 2); + if (nxo_stack_roll(ostack, count, amount)) + { + cw_nxo_t *nxo; + + /* Stack underflow. Restore the stack to its original state, then throw + * an error. */ + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, count); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, amount); + + nxo_thread_nerror(a_thread, NXN_stackunderflow); + } +} + +void +systemdict_rot(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t amount; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + amount = nxo_integer_get(nxo); + if (nxo_stack_count(ostack) < 2) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + nxo_stack_pop(ostack); + nxo_stack_rot(ostack, amount); +} + +#ifdef CW_REAL +void +systemdict_round(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + break; + } + case NXOT_REAL: + { + nxo_integer_new(nxo, (cw_nxoi_t) rint(nxo_real_get(nxo))); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} +#endif + +void +systemdict_sadn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo, *bnxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_BGET(bnxo, stack, a_thread); + nxo = nxo_stack_push(stack); + nxo_dup(nxo, bnxo); + nxo_stack_bpop(stack); + + nxo_stack_pop(ostack); +} + +void +systemdict_saup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo, *bnxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_GET(nxo, stack, a_thread); + bnxo = nxo_stack_bpush(stack); + nxo_dup(bnxo, nxo); + nxo_stack_pop(stack); + + nxo_stack_pop(ostack); +} + +void +systemdict_sbdup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *orig, *dup; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_BGET(orig, stack, a_thread); + dup = nxo_stack_push(stack); + nxo_dup(dup, orig); + + nxo_stack_pop(ostack); +} + +void +systemdict_sbpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *snxo, *onxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_BGET(snxo, stack, a_thread); + onxo = nxo_stack_under_push(ostack, stack); + nxo_dup(onxo, snxo); + + nxo_stack_bpop(stack); + nxo_stack_pop(ostack); +} + +void +systemdict_sbpush(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *nnxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nnxo = nxo_stack_bpush(stack); + nxo_dup(nnxo, nxo); + nxo_stack_npop(ostack, 2); +} + +void +systemdict_sclear(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack; + cw_uint32_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + count = nxo_stack_count(stack); + if (count > 0) + { + nxo_stack_npop(stack, count); + } + + nxo_stack_pop(ostack); +} + +void +systemdict_scleartomark(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo; + cw_uint32_t i, depth; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + for (i = 0, depth = nxo_stack_count(stack), nxo = NULL; i < depth; i++) + { + nxo = nxo_stack_down_get(stack, nxo); + if (nxo == NULL) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + if (nxo_type_get(nxo) == NXOT_MARK) + { + break; + } + } + if (i == depth) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + + nxo_stack_npop(stack, i + 1); + + nxo_stack_pop(ostack); +} + +void +systemdict_scount(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_integer_new(nxo, nxo_stack_count(nxo)); +} + +void +systemdict_scounttomark(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo; + cw_uint32_t i; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + for (i = 0, nxo = nxo_stack_get(stack); + nxo != NULL && nxo_type_get(nxo) != NXOT_MARK; + i++, nxo = nxo_stack_down_get(stack, nxo)) + { + /* Do nothing. */ + } + + if (nxo == NULL) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + + nxo_integer_new(stack, i); +} + +void +systemdict_sdn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_stack_count(stack) < 3) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_roll(stack, 3, -1); + + nxo_stack_pop(ostack); +} + +void +systemdict_sdup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *orig, *dup; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_GET(orig, stack, a_thread); + dup = nxo_stack_push(stack); + nxo_dup(dup, orig); + + nxo_stack_pop(ostack); +} + +#ifdef CW_POSIX +void +systemdict_seek(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file, *position; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(position, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, position); + + if (nxo_type_get(file) != NXOT_FILE + || nxo_type_get(position) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = nxo_file_position_set(file, nxo_integer_get(position)); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_stack_npop(ostack, 2); +} +#endif + +void +systemdict_self(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *thread; + + ostack = nxo_thread_ostack_get(a_thread); + thread = nxo_stack_push(ostack); + nxo_dup(thread, a_thread); +} + +#ifdef CW_SOCKET +void +systemdict_send(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *sock, *nxo; + cw_uint32_t npop; + int flags, nwrite; + + ostack = nxo_thread_ostack_get(a_thread); + + /* Process flags array, if specified. */ + NXO_STACK_GET(nxo, ostack, a_thread); + flags = 0; + if (nxo_type_get(nxo) == NXOT_ARRAY) + { + cw_nxo_t *tstack, *el; + cw_uint32_t i, count, argcnt, argind; + + tstack = nxo_thread_tstack_get(a_thread); + el = nxo_stack_push(tstack); + + argcnt = sizeof(send_recv_flag) / sizeof(struct cw_systemdict_name_arg); + for (i = 0, count = nxo_array_len_get(nxo); i < count; i++) + { + nxo_array_el_get(nxo, i, el); + argind = systemdict_p_name_arg(nxo, send_recv_flag, argcnt); + if (argind == argcnt) + { + nxo_stack_pop(tstack); + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + flags |= send_recv_flag[argind].arg; + } + + nxo_stack_pop(tstack); + + /* Get string. */ + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + npop = 2; + } + else + { + npop = 1; + } + NXO_STACK_DOWN_GET(sock, ostack, a_thread, nxo); + if (nxo_type_get(sock) != NXOT_FILE || nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_string_lock(nxo); + nwrite = send(nxo_file_fd_get(sock), nxo_string_get(nxo), + nxo_string_len_get(nxo), flags); + nxo_string_unlock(nxo); + + if (nwrite == -1) + { + switch (errno) + { + case EWOULDBLOCK: + { + /* Failed non-blocking write. */ + nwrite = 0; + break; + } + case ECONNREFUSED: + case EHOSTDOWN: + case EHOSTUNREACH: + case EMSGSIZE: + case ENOTCONN: + { + nxo_thread_nerror(a_thread, NXN_neterror); + return; + } + case ENOTSOCK: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + case EBADF: + case EFAULT: + case ENOBUFS: + case EINTR: + case EINVAL: + case ENOMEM: + case EPIPE: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + + nxo_integer_new(sock, (cw_nxoi_t) nwrite); + + nxo_stack_npop(ostack, npop); +} +#endif + +#ifdef CW_SOCKET +void +systemdict_serviceport(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *nxo, *tnxo; + struct servent *ent; + cw_nxoi_t port; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tnxo = nxo_stack_push(tstack); + nxo_string_cstring(tnxo, nxo, a_thread); + +#ifdef CW_THREADS + mtx_lock(&cw_g_getservbyname_mtx); +#endif + setservent(0); + ent = getservbyname(nxo_string_get(tnxo), NULL); + if (ent == NULL) + { + port = 0; + } + else + { + port = ntohs(ent->s_port); + } + endservent(); +#ifdef CW_THREADS + mtx_unlock(&cw_g_getservbyname_mtx); +#endif + + nxo_stack_pop(tstack); + nxo_integer_new(nxo, port); +} +#endif + +#ifdef CW_POSIX +void +systemdict_setegid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t egid; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread);; + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + egid = nxo_integer_get(nxo); + if (egid < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + error = setegid((gid_t) egid); + nxo_boolean_new(nxo, error == 0 ? FALSE : TRUE); +} +#endif + +#ifdef CW_POSIX +void +systemdict_setenv(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *envdict; + cw_nxo_t *key, *val, *tnxo; + cw_nx_t *nx; + cw_uint32_t klen, vlen; + const cw_uint8_t *str; + cw_uint8_t *tstr; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + envdict = nx_envdict_get(nx); + NXO_STACK_GET(val, ostack, a_thread); + NXO_STACK_DOWN_GET(key, ostack, a_thread, val); + if (nxo_type_get(key) != NXOT_NAME) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_type_get(val) != NXOT_STRING) + { + systemdict_cvs(a_thread); + /* Get val again, since it may have changed. */ + val = nxo_stack_get(ostack); + } + + /* Create a new string big enough for: KEY=val\0 */ + klen = nxo_name_len_get(key); + vlen = nxo_string_len_get(val); + tnxo = nxo_stack_push(tstack); + nxo_string_new(tnxo, nx, nxo_thread_currentlocking(a_thread), + klen + vlen + 2); + + /* Copy the key and value. */ + tstr = nxo_string_get(tnxo); + str = nxo_name_str_get(key); + memcpy(tstr, str, klen); + + tstr[klen] = '='; + + str = nxo_string_get(val); + nxo_string_lock(val); + memcpy(&tstr[klen + 1], str, vlen); + nxo_string_unlock(val); + + tstr[klen + vlen + 1] = '\0'; + + /* Do the putenv(). */ + if (putenv(tstr) == -1) + { + xep_throw(CW_ONYXX_OOM); + } + nxo_stack_pop(tstack); + + /* Insert the key/value pair into envdict. */ + nxo_dict_def(envdict, nx, key, val); + + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_POSIX +void +systemdict_seteuid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t euid; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread);; + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + euid = nxo_integer_get(nxo); + if (euid < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + error = seteuid((uid_t) euid); + nxo_boolean_new(nxo, error == 0 ? FALSE : TRUE); +} +#endif + +#ifdef CW_POSIX +void +systemdict_setgid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t gid; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread);; + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + gid = nxo_integer_get(nxo); + if (gid < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + error = setgid((gid_t) gid); + nxo_boolean_new(nxo, error == 0 ? FALSE : TRUE); +} +#endif + +#ifdef CW_THREADS +void +systemdict_setgstderr(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nx_stderr_set(nxo_thread_nx_get(a_thread), file); + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_THREADS +void +systemdict_setgstdin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nx_stdin_set(nxo_thread_nx_get(a_thread), file); + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_THREADS +void +systemdict_setgstdout(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nx_stdout_set(nxo_thread_nx_get(a_thread), file); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_setiobuf(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *file, *iobuf; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(iobuf, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, iobuf); + if (nxo_type_get(file) != NXOT_FILE || nxo_type_get(iobuf) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nxo_file_buffer_size_set(file, nxo_integer_get(iobuf)); + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_THREADS +void +systemdict_setlocking(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_BOOLEAN) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nxo_thread_setlocking(a_thread, nxo_boolean_get(nxo)); + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_setnonblocking(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *file, *nonblocking; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nonblocking, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, nonblocking); + if (nxo_type_get(file) != NXOT_FILE + || nxo_type_get(nonblocking) != NXOT_BOOLEAN) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_file_nonblocking_set(file, nxo_boolean_get(nonblocking))) + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_SOCKET +static const struct cw_systemdict_name_arg sock_opt[] = +{ + {NXN_SO_DEBUG, SO_DEBUG}, + {NXN_SO_REUSEADDR, SO_REUSEADDR}, +#ifdef SO_REUSEPORT + {NXN_SO_REUSEPORT, SO_REUSEPORT}, +#endif + {NXN_SO_KEEPALIVE, SO_KEEPALIVE}, + {NXN_SO_DONTROUTE, SO_DONTROUTE}, + {NXN_SO_LINGER, SO_LINGER}, + {NXN_SO_BROADCAST, SO_BROADCAST}, + {NXN_SO_OOBINLINE, SO_OOBINLINE}, + {NXN_SO_SNDBUF, SO_SNDBUF}, + {NXN_SO_RCVBUF, SO_RCVBUF}, + {NXN_SO_SNDLOWAT, SO_SNDLOWAT}, + {NXN_SO_RCVLOWAT, SO_RCVLOWAT}, + {NXN_SO_SNDTIMEO, SO_SNDTIMEO}, + {NXN_SO_RCVTIMEO, SO_RCVTIMEO}, + {NXN_SO_TYPE, SO_TYPE}, + {NXN_SO_ERROR, SO_ERROR} +}; + +static const struct cw_systemdict_name_arg sock_opt_level[] = +{ + {NXN_SOL_SOCKET, SOL_SOCKET} +}; + +static void +systemdict_p_sockopt(cw_nxo_t *a_thread, cw_bool_t a_set) +{ + cw_nxo_t *ostack, *nxo, *nxoval; + cw_uint32_t argcnt, argind, npop; + int opt, level; + union + { + int i; + struct linger l; + struct timeval t; + } optval; + + ostack = nxo_thread_ostack_get(a_thread); + + if (a_set) + { + /* Get option value. */ + NXO_STACK_GET(nxoval, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxoval); + npop = 1; + } + else + { + NXO_STACK_GET(nxo, ostack, a_thread); + npop = 0; + } + + /* Get option name. */ + if (nxo_type_get(nxo) != NXOT_NAME) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + argcnt = sizeof(sock_opt) / sizeof(struct cw_systemdict_name_arg); + argind = systemdict_p_name_arg(nxo, sock_opt, argcnt); + if (argind == argcnt) + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + opt = sock_opt[argind].arg; + + /* Get level. */ + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) == NXOT_NAME) + { + /* If level is $SOL_SOCKET, simply use SOL_SOCKET. Otherwise, use the + * name as a protocol to look up the associated protocol number. */ + argcnt = sizeof(sock_opt_level) / sizeof(struct cw_systemdict_name_arg); + argind = systemdict_p_name_arg(nxo, sock_opt_level, argcnt); + if (argind != argcnt) + { + level = SOL_SOCKET; + } + else + { + cw_nxo_t *tstack, *tnxo; + struct protoent *ent; + + tstack = nxo_thread_tstack_get(a_thread); + tnxo = nxo_stack_push(tstack); + nxo_string_cstring(tnxo, nxo, a_thread); + +#ifdef CW_THREADS + mtx_lock(&cw_g_getprotobyname_mtx); +#endif + setprotoent(0); + ent = getprotobyname(nxo_string_get(tnxo)); + + nxo_stack_pop(tstack); + + if (ent == NULL) + { + /* Not a socket protocol. */ + endprotoent(); +#ifdef CW_THREADS + mtx_unlock(&cw_g_getprotobyname_mtx); +#endif + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + + level = ent->p_proto; + } + + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + npop += 2; + } + else if (nxo_type_get(nxo) == NXOT_FILE) + { + level = SOL_SOCKET; + npop++; + } + else + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + /* nxo is the socket. */ + + if (a_set) + { + npop++; + + switch (opt) + { + case SO_DEBUG: + case SO_REUSEADDR: +#ifdef SO_REUSEPORT + case SO_REUSEPORT: +#endif + case SO_KEEPALIVE: + case SO_DONTROUTE: + case SO_BROADCAST: + case SO_OOBINLINE: + case SO_SNDBUF: + case SO_RCVBUF: + case SO_SNDLOWAT: + case SO_RCVLOWAT: + case SO_TYPE: + case SO_ERROR: + { + if (nxo_type_get(nxoval) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + optval.i = nxo_integer_get(nxoval); + + break; + } + case SO_LINGER: + { + cw_nxo_t *tstack, *tkey, *tval; + cw_nx_t *nx; + + if (nxo_type_get(nxoval) != NXOT_DICT) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + tkey = nxo_stack_push(tstack); + tval = nxo_stack_push(tstack); + + + /* on. */ + nxo_name_new(tkey, nx, nxn_str(NXN_on), nxn_len(NXN_on), + TRUE); + if (nxo_dict_lookup(nxoval, tkey, tval)) + { + nxo_stack_npop(tstack, 2); + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + if (nxo_type_get(tval) != NXOT_BOOLEAN) + { + nxo_stack_npop(tstack, 2); + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + optval.l.l_onoff = nxo_boolean_get(tval); + + /* time. */ + nxo_name_new(tkey, nx, nxn_str(NXN_time), nxn_len(NXN_time), + TRUE); + if (nxo_dict_lookup(nxoval, tkey, tval)) + { + nxo_stack_npop(tstack, 2); + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + if (nxo_type_get(tval) != NXOT_INTEGER) + { + nxo_stack_npop(tstack, 2); + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + optval.l.l_linger = nxo_integer_get(tval); + + nxo_stack_npop(tstack, 2); + break; + } + case SO_SNDTIMEO: + case SO_RCVTIMEO: + { + if (nxo_type_get(nxoval) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + optval.t.tv_sec = nxo_integer_get(nxoval) / 1000000000LL; + optval.t.tv_usec = (nxo_integer_get(nxoval) % 1000000000LL) + / 1000; + break; + } + default: + { + cw_not_reached(); + } + } + + if (setsockopt(nxo_file_fd_get(nxo), level, opt, &optval, + sizeof(optval)) == -1) + { + switch (errno) + { + case ENOTSOCK: + case ENOPROTOOPT: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + break; + } + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + } + else + { + socklen_t optlen; + + optlen = sizeof(optval); + if (getsockopt(nxo_file_fd_get(nxo), level, opt, &optval, &optlen) + == -1) + { + switch (errno) + { + case ENOTSOCK: + case ENOPROTOOPT: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + break; + } + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + switch (opt) + { + case SO_DEBUG: + case SO_REUSEADDR: +#ifdef SO_REUSEPORT + case SO_REUSEPORT: +#endif + case SO_KEEPALIVE: + case SO_DONTROUTE: + case SO_BROADCAST: + case SO_OOBINLINE: + case SO_SNDBUF: + case SO_RCVBUF: + case SO_SNDLOWAT: + case SO_RCVLOWAT: + case SO_TYPE: + case SO_ERROR: + { + nxo_integer_new(nxo, optval.i); + break; + } + case SO_LINGER: + { + cw_nxo_t *tstack, *tkey, *tval; + cw_nx_t *nx; + + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + tkey = nxo_stack_push(tstack); + tval = nxo_stack_push(tstack); + + nxo_dict_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), 2); + + /* on. */ + nxo_name_new(tkey, nx, nxn_str(NXN_on), nxn_len(NXN_on), + TRUE); + nxo_boolean_new(tval, optval.l.l_onoff ? TRUE : FALSE); + nxo_dict_def(nxo, nx, tkey, tval); + + /* time. */ + nxo_name_new(tkey, nx, nxn_str(NXN_time), nxn_len(NXN_time), + TRUE); + nxo_integer_new(tval, optval.l.l_linger); + nxo_dict_def(nxo, nx, tkey, tval); + + nxo_stack_npop(tstack, 2); + break; + } + case SO_SNDTIMEO: + case SO_RCVTIMEO: + { + nxo_integer_new(nxo, + (((cw_nxoi_t) optval.t.tv_sec + * (cw_nxoi_t) 1000000000) + + ((cw_nxoi_t) optval.t.tv_usec + * (cw_nxoi_t) 1000))); + break; + } + default: + { + cw_not_reached(); + } + } + } + + nxo_stack_npop(ostack, npop); +} + +void +systemdict_setsockopt(cw_nxo_t *a_thread) +{ + systemdict_p_sockopt(a_thread, TRUE); +} +#endif + +void +systemdict_setstderr(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_thread_stderr_set(a_thread, file); + + nxo_stack_pop(ostack); +} + +void +systemdict_setstdin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_thread_stdin_set(a_thread, file); + + nxo_stack_pop(ostack); +} + +void +systemdict_setstdout(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_thread_stdout_set(a_thread, file); + + nxo_stack_pop(ostack); +} + +#ifdef CW_POSIX +void +systemdict_setuid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + cw_nxoi_t uid; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread);; + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + uid = nxo_integer_get(nxo); + if (uid < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + error = setuid((uid_t) uid); + nxo_boolean_new(nxo, error == 0 ? FALSE : TRUE); +} +#endif + +void +systemdict_sexch(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + if (nxo_stack_exch(stack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + } + + nxo_stack_pop(ostack); +} + +void +systemdict_shift(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *integer, *shift; + cw_nxoi_t nshift; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(shift, ostack, a_thread); + NXO_STACK_DOWN_GET(integer, ostack, a_thread, shift); + + if (nxo_type_get(integer) != NXOT_INTEGER + || nxo_type_get(shift) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nshift = nxo_integer_get(shift); + + /* Specially handle situations where the shift amount is more than 63 + * bits. */ + if (nshift < -63) + { + nxo_integer_set(integer, 0); + } + else if (nshift < 0) + { + nxo_integer_set(integer, + nxo_integer_get(integer) >> -nxo_integer_get(shift)); + } + else if (nshift > 63) + { + nxo_integer_set(integer, 0); + } + else if (nshift > 0) + { + nxo_integer_set(integer, + nxo_integer_get(integer) << nxo_integer_get(shift)); + } + + nxo_stack_pop(ostack); +} + +void +systemdict_sibdup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *orig; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + NXO_STACK_NBGET(orig, stack, a_thread, index); + nxo = nxo_stack_push(stack); + nxo_dup(nxo, orig); + + nxo_stack_npop(ostack, 2); +} + +void +systemdict_sibpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *inxo; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + NXO_STACK_NBGET(inxo, stack, a_thread, index); + nxo_dup(nxo, inxo); + nxo_stack_remove(stack, inxo); + + nxo_stack_remove(ostack, stack); +} + +void +systemdict_sidup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *orig; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + NXO_STACK_NGET(orig, stack, a_thread, index); + nxo = nxo_stack_push(stack); + nxo_dup(nxo, orig); + + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_THREADS +void +systemdict_signal(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *condition; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(condition, ostack, a_thread); + if (nxo_type_get(condition) != NXOT_CONDITION) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_condition_signal(condition); + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_REAL +void +systemdict_sin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_real_new(nxo, sin(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_sinh(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_real_new(nxo, sinh(real)); +} +#endif + +void +systemdict_sipop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *inxo; + cw_nxoi_t index; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + index = nxo_integer_get(nxo); + if (index < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + NXO_STACK_NGET(inxo, stack, a_thread, index); + nxo_dup(nxo, inxo); + nxo_stack_remove(stack, inxo); + + nxo_stack_remove(ostack, stack); +} + +void +systemdict_snbpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *snxo; + cw_nxoi_t count; + cw_uint32_t i; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(stack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_array_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), count); + + /* Iteratively create dup's and bpop.. */ + for (i = 0, snxo = NULL; i < count; i++) + { + snxo = nxo_stack_bget(stack); + nxo_array_el_set(nxo, snxo, i); + nxo_stack_bpop(stack); + } + + nxo_stack_remove(ostack, stack); +} + +void +systemdict_sndn(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 1) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(stack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_roll(stack, count, -1); + nxo_stack_npop(ostack, 2); +} + +void +systemdict_sndup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo, *dup; + cw_uint32_t i; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(stack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + /* Iterate down the stack, creating dup's along the way. Since we're going + * down, it's necessary to use nxo_stack_under_push() to preserve order. */ + for (i = 0, nxo = NULL, dup = NULL; i < count; i++) + { + nxo = nxo_stack_down_get(stack, nxo); + if (nxo == NULL) + { + /* This is very bad, and means that another thread is mucking with + * the stack. The right thing to do is try to restore the stack + * state, but there's no way to know for sure what state the stack + * is in. Throw an error. */ + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + dup = nxo_stack_under_push(stack, dup); + nxo_dup(dup, nxo); + } + + nxo_stack_npop(ostack, 2); +} + +void +systemdict_snip(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *snxo, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_NGET(snxo, stack, a_thread, 1); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, snxo); + nxo_stack_remove(stack, snxo); + nxo_stack_remove(ostack, stack); +} + +void +systemdict_snpop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *snxo; + cw_nxoi_t count; + cw_uint32_t i; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(stack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_array_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), count); + + /* Iteratively create dup's and pop. */ + for (i = 0, snxo = NULL; i < count; i++) + { + snxo = nxo_stack_get(stack); + nxo_array_el_set(nxo, snxo, count - 1 - i); + nxo_stack_pop(stack); + } + + nxo_stack_remove(ostack, stack); +} + +void +systemdict_snup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo; + cw_nxoi_t count; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 1) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + if (count > nxo_stack_count(stack)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_roll(stack, count, 1); + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_SOCKET +static const struct cw_systemdict_name_arg socket_family[] = +{ + {NXN_AF_INET, AF_INET}, + {NXN_AF_LOCAL, AF_LOCAL} +}; + +static const struct cw_systemdict_name_arg socket_type[] = +{ + {NXN_SOCK_STREAM, SOCK_STREAM}, + {NXN_SOCK_DGRAM, SOCK_DGRAM} +}; + +static void +systemdict_p_socket(cw_nxo_t *a_thread, cw_bool_t a_pair) +{ + cw_nxo_t *ostack, *nxo; + cw_uint32_t argcnt, argind, npop; + int family, type, protocol = 0; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_NAME) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + /* See if nxo is a socket type. */ + argcnt = sizeof(socket_type) / sizeof(struct cw_systemdict_name_arg); + argind = systemdict_p_name_arg(nxo, socket_type, argcnt); + if (argind != argcnt) + { + /* Socket type. */ + type = socket_type[argind].arg; + + npop = 2; + } + else + { + cw_nxo_t *tstack, *tnxo; + struct protoent *ent; + + /* Not a socket type. Try it as a socket protocol. */ + + tstack = nxo_thread_tstack_get(a_thread); + tnxo = nxo_stack_push(tstack); + nxo_string_cstring(tnxo, nxo, a_thread); + +#ifdef CW_THREADS + mtx_lock(&cw_g_getprotobyname_mtx); +#endif + setprotoent(0); + ent = getprotobyname(nxo_string_get(tnxo)); + + nxo_stack_pop(tstack); + + if (ent == NULL) + { + /* Not a socket protocol. */ + endprotoent(); +#ifdef CW_THREADS + mtx_unlock(&cw_g_getprotobyname_mtx); +#endif + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + + protocol = ent->p_proto; + endprotoent(); +#ifdef CW_THREADS + mtx_unlock(&cw_g_getprotobyname_mtx); +#endif + + /* The next argument must be the socket type. */ + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_NAME) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + argcnt = sizeof(socket_type) + / sizeof(struct cw_systemdict_name_arg); + argind = systemdict_p_name_arg(nxo, socket_type, argcnt); + if (argind != argcnt) + { + /* Socket type. */ + type = socket_type[argind].arg; + } + else + { + /* Not a socket type. */ + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + + npop = 3; + } + + /* Get the socket family. */ + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_NAME) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + argcnt = sizeof(socket_family) / sizeof(struct cw_systemdict_name_arg); + argind = systemdict_p_name_arg(nxo, socket_family, argcnt); + if (argind != argcnt) + { + /* Socket family. */ + family = socket_family[argind].arg; + } + else + { + /* Not a socket family. */ + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + + if (a_pair == FALSE) + { + int sockfd; + + sockfd = socket(family, type, protocol); + if (sockfd == -1) + { + goto ERROR; + } + /* Wrap sockfd. */ + nxo = nxo_stack_under_push(ostack, nxo); + nxo_file_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_file_fd_wrap(nxo, sockfd); + } + else + { + cw_uint32_t i; + int sockfds[2]; + + if (socketpair(family, type, protocol, sockfds)) + { + goto ERROR; + } + + /* Wrap sockfds. */ + for (i = 0; i < 2; i++) { + nxo = nxo_stack_under_push(ostack, nxo); + nxo_file_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + nxo_file_fd_wrap(nxo, sockfds[i]); + } + } + + /* Pop inputs. */ + nxo_stack_npop(ostack, npop); + return; + + ERROR: + switch (errno) + { + case EAFNOSUPPORT: + case EPFNOSUPPORT: + case EOPNOTSUPP: + case EPROTONOSUPPORT: + case ESOCKTNOSUPPORT: + { + nxo_thread_nerror(a_thread, NXN_argcheck); + return; + } + case EACCES: + { + nxo_thread_nerror(a_thread, NXN_invalidaccess); + return; + } + case ENFILE: + case EMFILE: + case ENOBUFS: + case ENOMEM: + { + xep_throw(CW_ONYXX_OOM); + } + case EINVAL: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } +} +#endif + +#ifdef CW_SOCKET +void +systemdict_socket(cw_nxo_t *a_thread) +{ + systemdict_p_socket(a_thread, FALSE); +} +#endif + +#ifdef CW_SOCKET +void +systemdict_socketpair(cw_nxo_t *a_thread) +{ + systemdict_p_socket(a_thread, TRUE); +} +#endif + +#ifdef CW_SOCKET +void +systemdict_sockopt(cw_nxo_t *a_thread) +{ + systemdict_p_sockopt(a_thread, FALSE); +} +#endif + +#ifdef CW_SOCKET +void +systemdict_sockname(cw_nxo_t *a_thread) +{ + systemdict_p_peername(a_thread, FALSE); +} +#endif + +void +systemdict_sover(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *sunder, *snxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_NGET(sunder, stack, a_thread, 1); + snxo = nxo_stack_push(stack); + nxo_dup(snxo, sunder); + + nxo_stack_pop(ostack); +} + +#ifdef CW_REGEX +void +systemdict_split(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *flags, *pattern, *input, *output; + cw_uint32_t npop; + cw_nxn_t error; + cw_nxoi_t limit; + + ostack = nxo_thread_ostack_get(a_thread); + + /* Get limit, if specified. */ + npop = 1; + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) == NXOT_INTEGER) + { + npop++; + limit = nxo_integer_get(nxo); + if (limit < 0LL) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + } + else + { + limit = 0; + } + + flags = NULL; + switch (nxo_type_get(nxo)) + { + case NXOT_DICT: + { + npop++; + flags = nxo; + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Fall through. */ + } + case NXOT_STRING: + { + cw_bool_t insensitive, multiline, singleline; + + /* Get regex flags. */ + if (flags != NULL) + { + error = systemdict_p_regex_flags_get(flags, a_thread, + NULL, NULL, + &insensitive, &multiline, + &singleline); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + } + else + { + insensitive = FALSE; + multiline = FALSE; + singleline = FALSE; + } + + /* Get pattern. */ + pattern = nxo; + + /* Get input string. */ + npop++; + NXO_STACK_DOWN_GET(input, ostack, a_thread, nxo); + if (nxo_type_get(input) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + output = nxo_stack_under_push(ostack, input); + nxo_string_lock(pattern); + error = nxo_regex_nonew_split(a_thread, nxo_string_get(pattern), + nxo_string_len_get(pattern), + insensitive, multiline, singleline, + (cw_uint32_t) limit, input, output); + nxo_string_unlock(pattern); + if (error) + { + nxo_stack_remove(ostack, output); + nxo_thread_nerror(a_thread, error); + return; + } + + break; + } + case NXOT_REGEX: + { + cw_nxo_t *regex; + + regex = nxo; + + /* Get input string. */ + npop++; + NXO_STACK_DOWN_GET(input, ostack, a_thread, nxo); + if (nxo_type_get(input) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + output = nxo_stack_under_push(ostack, input); + nxo_regex_split(regex, a_thread, (cw_uint32_t) limit, input, + output); + + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_stack_npop(ostack, npop); +} +#endif + +void +systemdict_spop(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *snxo, *onxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_GET(snxo, stack, a_thread); + onxo = nxo_stack_under_push(ostack, stack); + nxo_dup(onxo, snxo); + + nxo_stack_pop(stack); + nxo_stack_pop(ostack); +} + +void +systemdict_spush(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *stack, *nnxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nnxo = nxo_stack_push(stack); + nxo_dup(nnxo, nxo); + nxo_stack_npop(ostack, 2); +} + +#ifdef CW_REAL +void +systemdict_sqrt(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + if (real < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_real_new(nxo, sqrt(real)); +} +#endif + +#ifdef CW_POSIX +void +systemdict_srand(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxoi_t seed; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + seed = nxo_integer_get(nxo); + if (seed < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + srandom((unsigned long)seed); + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_sroll(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo; + cw_nxoi_t count, amount; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + amount = nxo_integer_get(nxo); + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + count = nxo_integer_get(nxo); + if (count < 1) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + if (nxo_stack_roll(stack, count, amount)) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_npop(ostack, 3); +} + +void +systemdict_srot(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *nxo; + cw_nxoi_t amount; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_INTEGER || nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + amount = nxo_integer_get(nxo); + + if (nxo_stack_count(stack) < 1) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + nxo_stack_rot(stack, amount); + nxo_stack_npop(ostack, 2); +} + +void +systemdict_stack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nstack; + + ostack = nxo_thread_ostack_get(a_thread); + nstack = nxo_stack_push(ostack); + nxo_stack_new(nstack, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); +} + +void +systemdict_start(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *istack, *tstack; + cw_nxo_t *onxo, *enxo; + cw_uint32_t edepth, tdepth; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + istack = nxo_thread_istack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + /* Record stack depths so that we can clean up later. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + NXO_STACK_GET(onxo, ostack, a_thread); + enxo = nxo_stack_push(estack); + nxo_dup(enxo, onxo); + nxo_stack_pop(ostack); + + xep_begin(); + xep_try + { + nxo_thread_loop(a_thread); + } + xep_catch(CW_ONYXX_EXIT) + xep_mcatch(CW_ONYXX_QUIT) + xep_mcatch(CW_ONYXX_STOP) + { + xep_handled(); + } + xep_end(); + + /* Pop all objects off estack, istack, and tstack that weren't there before + * entering this function. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + nxo_stack_npop(istack, nxo_stack_count(istack) - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); +} + +#ifdef CW_POSIX +void +systemdict_status(cw_nxo_t *a_thread) +{ + cw_nx_t *nx; + cw_nxo_t *ostack, *tstack, *file; + cw_nxo_t *dict, *name, *value; + int error; + struct stat sb; + + nx = nxo_thread_nx_get(a_thread); + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(file, ostack, a_thread); + if (nxo_type_get(file) != NXOT_FILE && nxo_type_get(file) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + if (nxo_type_get(file) == NXOT_FILE) + { + int fd; + + fd = nxo_file_fd_get(file); + if (fd < 0) + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + + error = fstat(fd, &sb); + } + else + { + cw_nxo_t *tfile; + + /* Create a copy of file with an extra byte to store a '\0' + * terminator. */ + tfile = nxo_stack_push(tstack); + nxo_string_cstring(tfile, file, a_thread); + + error = stat(nxo_string_get(tfile), &sb); + + nxo_stack_pop(tstack); + } + + if (error == -1) + { + switch (errno) + { + case EIO: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EACCES: + case ELOOP: + case ENAMETOOLONG: + case ENOENT: + case ENOTDIR: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_pop(ostack); + + /* We now have a valid stat buffer. Create a dictionary that represents + * it. */ + dict = nxo_stack_push(ostack); + nxo_dict_new(dict, nx, nxo_thread_currentlocking(a_thread), 13); + + name = nxo_stack_push(tstack); + value = nxo_stack_push(tstack); + + /* dev. */ + nxo_name_new(name, nx, nxn_str(NXN_dev), nxn_len(NXN_dev), TRUE); + nxo_integer_new(value, sb.st_dev); + nxo_dict_def(dict, nx, name, value); + + /* ino. */ + nxo_name_new(name, nx, nxn_str(NXN_ino), nxn_len(NXN_ino), TRUE); + nxo_integer_new(value, sb.st_ino); + nxo_dict_def(dict, nx, name, value); + + /* mode. */ + nxo_name_new(name, nx, nxn_str(NXN_mode), nxn_len(NXN_mode), TRUE); + nxo_integer_new(value, sb.st_mode); + nxo_dict_def(dict, nx, name, value); + + /* nlink. */ + nxo_name_new(name, nx, nxn_str(NXN_nlink), nxn_len(NXN_nlink), TRUE); + nxo_integer_new(value, sb.st_nlink); + nxo_dict_def(dict, nx, name, value); + + /* uid. */ + nxo_name_new(name, nx, nxn_str(NXN_uid), nxn_len(NXN_uid), TRUE); + nxo_integer_new(value, sb.st_uid); + nxo_dict_def(dict, nx, name, value); + + /* gid. */ + nxo_name_new(name, nx, nxn_str(NXN_gid), nxn_len(NXN_gid), TRUE); + nxo_integer_new(value, sb.st_gid); + nxo_dict_def(dict, nx, name, value); + + /* rdev. */ + nxo_name_new(name, nx, nxn_str(NXN_rdev), nxn_len(NXN_rdev), TRUE); + nxo_integer_new(value, sb.st_rdev); + nxo_dict_def(dict, nx, name, value); + + /* size. */ + nxo_name_new(name, nx, nxn_str(NXN_size), nxn_len(NXN_size), TRUE); + nxo_integer_new(value, sb.st_size); + nxo_dict_def(dict, nx, name, value); + + /* atime. */ + nxo_name_new(name, nx, nxn_str(NXN_atime), nxn_len(NXN_atime), TRUE); +#ifdef CW_LIBONYX_USE_STAT_ATIMESPEC + nxo_integer_new(value, + ((cw_nxoi_t) sb.st_atimespec.tv_sec * + (cw_nxoi_t) 1000000000) + + (cw_nxoi_t) sb.st_atimespec.tv_nsec); +#else + nxo_integer_new(value, ((cw_nxoi_t) sb.st_atime * (cw_nxoi_t) 1000000000)); +#endif + nxo_dict_def(dict, nx, name, value); + + /* mtime. */ + nxo_name_new(name, nx, nxn_str(NXN_mtime), nxn_len(NXN_mtime), TRUE); +#ifdef CW_LIBONYX_USE_STAT_MTIMESPEC + nxo_integer_new(value, + ((cw_nxoi_t) sb.st_mtimespec.tv_sec + * (cw_nxoi_t) 1000000000) + + (cw_nxoi_t) sb.st_mtimespec.tv_nsec); +#else + nxo_integer_new(value, ((cw_nxoi_t) sb.st_mtime * (cw_nxoi_t) 1000000000)); +#endif + nxo_dict_def(dict, nx, name, value); + + /* ctime. */ + nxo_name_new(name, nx, nxn_str(NXN_ctime), nxn_len(NXN_ctime), TRUE); +#ifdef CW_LIBONYX_USE_STAT_CTIMESPEC + nxo_integer_new(value, + ((cw_nxoi_t) sb.st_ctimespec.tv_sec + * (cw_nxoi_t) 1000000000) + + (cw_nxoi_t) sb.st_ctimespec.tv_nsec); +#else + nxo_integer_new(value, ((cw_nxoi_t) sb.st_ctime * (cw_nxoi_t) 1000000000)); +#endif + nxo_dict_def(dict, nx, name, value); + + /* blksize. */ + nxo_name_new(name, nx, nxn_str(NXN_blksize), nxn_len(NXN_blksize), TRUE); + nxo_integer_new(value, sb.st_blksize); + nxo_dict_def(dict, nx, name, value); + + /* blocks. */ + nxo_name_new(name, nx, nxn_str(NXN_blocks), nxn_len(NXN_blocks), TRUE); + nxo_integer_new(value, sb.st_blocks); + nxo_dict_def(dict, nx, name, value); + + nxo_stack_npop(tstack, 2); +} +#endif + +void +systemdict_stderr(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_stderr_get(a_thread)); +} + +void +systemdict_stdin(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_stdin_get(a_thread)); +} + +void +systemdict_stdout(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_stdout_get(a_thread)); +} + +void +systemdict_stop(cw_nxo_t *a_thread) +{ + xep_throw(CW_ONYXX_STOP); +} + +void +systemdict_stopped(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *exec, *nxo; + cw_bool_t result = FALSE; + cw_uint32_t edepth, tdepth; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(exec, ostack, a_thread); + + /* Record stack depths so that we can clean up if necessary. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + nxo = nxo_stack_push(estack); + nxo_dup(nxo, exec); + nxo_stack_pop(ostack); + + /* Catch a stop exception, if thrown. */ + xep_begin(); + xep_try + { + nxo_thread_loop(a_thread); + } + xep_catch(CW_ONYXX_STOP) + { + cw_nxo_t *istack; + + xep_handled(); + result = TRUE; + + /* Clean up stacks. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) + - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); + } + xep_catch(CW_ONYXX_EXIT) + { + /* This is a serious program error, and we've already unwound the C + * stack, so there's no going back. After throwing an error, do the + * equivalent of what the quit operator does, so that we'll unwind to + * the innermost start context. */ + xep_handled(); + + nxo_thread_nerror(a_thread, NXN_invalidexit); + + xep_throw(CW_ONYXX_QUIT); + } + xep_end(); + + nxo = nxo_stack_push(ostack); + nxo_boolean_new(nxo, result); +} + +void +systemdict_string(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxoi_t len; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + len = nxo_integer_get(nxo); + if (len < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_string_new(nxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), len); +} + +void +systemdict_stuck(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *stop, *snxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_GET(stop, stack, a_thread); + NXO_STACK_DOWN_GET(snxo, stack, a_thread, stop); + snxo = nxo_stack_under_push(stack, snxo); + nxo_dup(snxo, stop); + + nxo_stack_pop(ostack); +} + +void +systemdict_sub(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + cw_nxoi_t integer_a, integer_b; +#ifdef CW_REAL + cw_bool_t do_real; + cw_nxor_t real_a, real_b; +#endif + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + switch (nxo_type_get(nxo_a)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + do_real = FALSE; +#endif + integer_a = nxo_integer_get(nxo_a); + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + do_real = TRUE; + real_a = nxo_real_get(nxo_a); + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + switch (nxo_type_get(nxo_b)) + { + case NXOT_INTEGER: + { +#ifdef CW_REAL + if (do_real) + { + real_b = (cw_nxor_t) nxo_integer_get(nxo_b); + } + else +#endif + { + integer_b = nxo_integer_get(nxo_b); + } + break; + } +#ifdef CW_REAL + case NXOT_REAL: + { + real_b = nxo_real_get(nxo_b); + if (do_real == FALSE) + { + do_real = TRUE; + real_a = (cw_nxor_t) integer_a; + } + break; + } +#endif + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + +#ifdef CW_REAL + if (do_real) + { + /* nxo_a may be an integer, so use nxo_real_new() rather than + * nxo_real_set(). */ + nxo_real_new(nxo_a, real_a - real_b); + } + else +#endif + { + nxo_integer_set(nxo_a, integer_a - integer_b); + } + + nxo_stack_pop(ostack); +} + +#ifdef CW_REGEX +void +systemdict_submatch(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + nxo_regex_submatch(a_thread, nxo_integer_get(nxo), nxo); +} +#endif + +#ifdef CW_REGEX +void +systemdict_subst(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo, *flags, *template, *pattern, *input, *output; + cw_uint32_t npop, count; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + + flags = NULL; + npop = 0; + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_DICT: + { + flags = nxo; + + /* Get template. */ + npop++; + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, nxo); + if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Fall through. */ + } + case NXOT_STRING: + { + cw_bool_t global, insensitive, multiline, singleline; + + /* Get regex flags. */ + if (flags != NULL) + { + error = systemdict_p_regex_flags_get(flags, a_thread, NULL, + &global, &insensitive, + &multiline, &singleline); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + } + else + { + global = FALSE; + insensitive = FALSE; + multiline = FALSE; + singleline = FALSE; + } + + template = nxo; + + /* Get pattern. */ + npop++; + NXO_STACK_DOWN_GET(pattern, ostack, a_thread, nxo); + if (nxo_type_get(pattern) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Get input string. */ + npop++; + NXO_STACK_DOWN_GET(input, ostack, a_thread, pattern); + if (nxo_type_get(input) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + output = nxo_stack_under_push(ostack, input); + nxo_string_lock(pattern); + nxo_string_lock(template); + error = nxo_regsub_nonew_subst(a_thread, nxo_string_get(pattern), + nxo_string_len_get(pattern), global, + insensitive, multiline, singleline, + nxo_string_get(template), + nxo_string_len_get(template), input, + output, &count); + nxo_string_unlock(template); + nxo_string_unlock(pattern); + if (error) + { + nxo_stack_remove(ostack, output); + nxo_thread_nerror(a_thread, error); + return; + } + + break; + } + case NXOT_REGSUB: + { + cw_nxo_t *regsub; + + regsub = nxo; + + /* Get input string. */ + npop++; + NXO_STACK_DOWN_GET(input, ostack, a_thread, nxo); + if (nxo_type_get(input) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + output = nxo_stack_under_push(ostack, input); + nxo_regsub_subst(regsub, a_thread, input, output, &count); + + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + nxo_integer_new(input, (cw_nxoi_t) count); + nxo_stack_npop(ostack, npop); +} +#endif + +void +systemdict_sunder(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack, *sunder, *snxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + NXO_STACK_NGET(sunder, stack, a_thread, 1); + snxo = nxo_stack_under_push(stack, sunder); + nxo_dup(snxo, sunder); + + nxo_stack_pop(ostack); +} + +void +systemdict_sup(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *stack; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(stack, ostack, a_thread); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_stack_count(stack) < 3) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_roll(stack, 3, 1); + + nxo_stack_pop(ostack); +} + +/* ( */ +void +systemdict_sym_lp(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_fino_new(nxo); +} + +/* ) */ +void +systemdict_sym_rp(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nstack, *tnxo, *nxo; + cw_sint32_t nelements, i, depth; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + /* Find the fino. */ + for (i = 0, depth = nxo_stack_count(ostack), nxo = NULL; i < depth; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + if (nxo_type_get(nxo) == NXOT_FINO) + { + break; + } + } + if (i == depth) + { + nxo_thread_nerror(a_thread, NXN_unmatchedfino); + return; + } + + /* i is the index of the fino, and nxo points to the fino. Set nelements + * accordingly. */ + nelements = i; + + nstack = nxo_stack_push(tstack); + nxo_stack_new(nstack, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread)); + + /* Push objects onto tstack and pop them off ostack. */ + for (i = 0; i < nelements; i++) + { + nxo = nxo_stack_get(ostack); + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + nxo_stack_pop(ostack); + } + + /* Pop the fino off ostack. */ + nxo_stack_pop(ostack); + + /* Push objects onto nstack and pop them off tstack. */ + for (i = 0; i < nelements; i++) + { + nxo = nxo_stack_get(tstack); + tnxo = nxo_stack_push(nstack); + nxo_dup(tnxo, nxo); + nxo_stack_pop(tstack); + } + + /* Push nstack onto ostack and pop it off of tstack. */ + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nstack); + nxo_stack_pop(tstack); +} + +/* > */ +void +systemdict_sym_gt(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *dict, *key, *val; + cw_uint32_t npairs, i, depth; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + /* Find the mark. */ + for (i = 0, depth = nxo_stack_count(ostack), nxo = NULL; i < depth; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + if (nxo_type_get(nxo) == NXOT_MARK) + { + break; + } + } + if (i == depth) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + if ((i & 1) == 1) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + /* i is the index of the mark, and nxo points to the mark. Set npairs + * accordingly. When we pop the nxo's off the stack, we'll have to pop + * (npairs << 1 + 1) nxo's. */ + npairs = i >> 1; + + dict = nxo_stack_push(tstack); + nxo_dict_new(dict, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), npairs); + + /* Traverse down the stack, moving nxo's to the dict. */ + for (i = 0, key = NULL; i < npairs; i++) + { + val = nxo_stack_down_get(ostack, key); + key = nxo_stack_down_get(ostack, val); + nxo_dict_def(dict, nxo_thread_nx_get(a_thread), key, val); + } + + /* Pop the nxo's off the stack now. */ + nxo_stack_npop(ostack, (npairs << 1) + 1); + + /* Push the dict onto the stack. */ + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, dict); + + nxo_stack_pop(tstack); +} + +/* ] */ +void +systemdict_sym_rb(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *tnxo, *nxo; + cw_sint32_t nelements, i, depth; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + /* Find the mark. */ + for (i = 0, depth = nxo_stack_count(ostack), nxo = NULL; i < depth; i++) + { + nxo = nxo_stack_down_get(ostack, nxo); + if (nxo_type_get(nxo) == NXOT_MARK) + { + break; + } + } + if (i == depth) + { + nxo_thread_nerror(a_thread, NXN_unmatchedmark); + return; + } + + /* i is the index of the mark, and nxo points to the mark. Set nelements + * accordingly. When we pop the nxo's off the stack, we'll have to pop + * (nelements + 1) nxo's. */ + nelements = i; + + tnxo = nxo_stack_push(tstack); + nxo_array_new(tnxo, nxo_thread_nx_get(a_thread), + nxo_thread_currentlocking(a_thread), nelements); + + /* Traverse down the stack, moving nxo's to the array. */ + for (i = nelements - 1, nxo = NULL; i >= 0; i--) + { + nxo = nxo_stack_down_get(ostack, nxo); + nxo_array_el_set(tnxo, nxo, i); + } + + /* Pop the nxo's off the stack now. */ + nxo_stack_npop(ostack, nelements + 1); + + /* Push the array onto the stack. */ + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, tnxo); + + nxo_stack_pop(tstack); +} + +#ifdef CW_POSIX +void +systemdict_symlink(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *filename, *linkname, *tfilename, *tlinkname; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(linkname, ostack, a_thread); + NXO_STACK_DOWN_GET(filename, ostack, a_thread, linkname); + if (nxo_type_get(filename) != NXOT_STRING + || nxo_type_get(linkname) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of filename with an extra byte to store a '\0' + * terminator. */ + tfilename = nxo_stack_push(tstack); + nxo_string_cstring(tfilename, filename, a_thread); + + /* Create a copy of linkname with an extra byte to store a '\0' + * terminator. */ + tlinkname = nxo_stack_push(tstack); + nxo_string_cstring(tlinkname, linkname, a_thread); + + error = symlink(nxo_string_get(tfilename), nxo_string_get(tlinkname)); + nxo_stack_npop(tstack, 2); + if (error == -1) + { + switch (errno) + { + case EDQUOT: + case EIO: + case EMLINK: + case ENOSPC: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case EEXIST: + case ENOENT: + case ENOTDIR: + { + nxo_thread_nerror(a_thread, NXN_undefinedfilename); + break; + } + case EACCES: + case ELOOP: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_REAL +void +systemdict_tan(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + + if (fabs(fmod(real, M_PI/2) - M_PI/2) < 1.0E-6) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + nxo_real_new(nxo, tan(real)); +} +#endif + +#ifdef CW_REAL +void +systemdict_tanh(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxor_t real; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + real = (cw_nxor_t) nxo_integer_get(nxo); + break; + } + case NXOT_REAL: + { + real = nxo_real_get(nxo); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } + nxo_real_new(nxo, tanh(real)); +} +#endif + +void +systemdict_tell(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file; + cw_nxoi_t position; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(file, ostack, a_thread); + + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + position = nxo_file_position_get(file); + if (position == -1) + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + nxo_integer_new(file, position); +} + +#ifdef CW_POSIX +void +systemdict_test(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *file, *test; + cw_uint8_t c; + cw_bool_t result; + cw_sint32_t fd = -1; + int error; + struct stat sb; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(test, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, test); + if ((nxo_type_get(file) != NXOT_FILE && nxo_type_get(file) != NXOT_STRING) + || nxo_type_get(test) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_string_len_get(test) != 1) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + nxo_string_el_get(test, 0, &c); + switch (c) + { + case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'k': + case 'p': case 'r': case 's': case 't': case 'u': case 'w': case 'x': + case 'L': case 'O': case 'G': case 'S': + { + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + } + + /* We haven't determined which test to perform yet, but in any case, we will + * need the results of a stat()/fstat() call. Do this first, then use the + * data as appropriate later. */ + if (nxo_type_get(file) == NXOT_FILE) + { + fd = nxo_file_fd_get(file); + if (fd < 0) + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + + error = fstat(fd, &sb); + } + else + { + cw_nxo_t *tstack, *tfile; + + tstack = nxo_thread_tstack_get(a_thread); + + /* Create a copy of file with an extra byte to store a '\0' + * terminator. */ + tfile = nxo_stack_push(tstack); + nxo_string_cstring(tfile, file, a_thread); + + error = lstat(nxo_string_get(tfile), &sb); + + nxo_stack_pop(tstack); + } + + if (error == -1) + { + /* There was a stat error. If this is because the file doesn't exist, + * set result to FALSE. Otherwise, throw an error. */ + switch (errno) + { + case EACCES: + case ENOENT: + case ENOTDIR: + { + result = FALSE; + break; + } + case EIO: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + return; + } + case ELOOP: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + return; + } + case EBADF: + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + return; + } + } + } + else + { + switch (c) + { + case 'b': + { + /* Block special device? */ + result = (sb.st_mode & S_IFBLK) ? TRUE : FALSE; + break; + } + case 'c': + { + /* Character special device? */ + result = S_ISCHR(sb.st_mode) ? TRUE : FALSE; + break; + } + case 'd': + { + /* Directory? */ + result = S_ISDIR(sb.st_mode) ? TRUE : FALSE; + break; + } + case 'e': + { + /* Exists? */ + /* There was no stat error, so the file must exist. */ + result = TRUE; + break; + } + case 'f': + { + /* Regular file? */ + result = S_ISREG(sb.st_mode) ? TRUE : FALSE; + break; + } + case 'g': + { + /* Setgid? */ + result = (sb.st_mode & S_ISGID) ? TRUE : FALSE; + break; + } + case 'k': + { + /* Sticky? */ + result = (sb.st_mode & S_ISVTX) ? TRUE : FALSE; + break; + } + case 'p': + { + /* Named pipe? */ + result = S_ISFIFO(sb.st_mode) ? TRUE : FALSE; + break; + } + case 'r': + { + /* Readable? */ + result = (sb.st_mode & S_IRUSR) ? TRUE : FALSE; + break; + } + case 's': + { + /* Size greater than 0? */ + result = (sb.st_size > 0) ? TRUE : FALSE; + break; + } + case 't': + { + /* tty? */ + /* fd only. If a string was passed in, return false. */ + if (fd == -1) + { + result = FALSE; + } + else + { + result = (isatty(fd)) ? TRUE : FALSE; + } + break; + } + case 'u': + { + /* Setuid? */ + result = (sb.st_mode & S_ISUID) ? TRUE : FALSE; + break; + } + case 'w': + { + /* Write bit set? */ + result = (sb.st_mode & S_IWUSR) ? TRUE : FALSE; + break; + } + case 'x': + { + /* Executable bit set? */ + result = (sb.st_mode & S_IXUSR) ? TRUE : FALSE; + break; + } + case 'L': + { + /* Symbolic link? */ + result = S_ISLNK(sb.st_mode) ? TRUE : FALSE; + break; + } + case 'O': + { + /* Owner matches effective uid? */ + result = (geteuid() == sb.st_uid) ? TRUE : FALSE; + break; + } + case 'G': + { + /* Group matches effective gid? */ + result = (getegid() == sb.st_gid) ? TRUE : FALSE; + break; + } + case 'S': + { + /* Socket? */ + result = S_ISSOCK(sb.st_mode) ? TRUE : FALSE; + break; + } + default: + { + cw_not_reached(); + } + } + } + + nxo_stack_pop(ostack); + nxo_boolean_new(file, result); +} +#endif + +#ifdef CW_THREADS +void +systemdict_thread(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *stack; + cw_nxo_t *entry, *thread, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(entry, ostack, a_thread); + NXO_STACK_DOWN_GET(stack, ostack, a_thread, entry); + if (nxo_type_get(stack) != NXOT_STACK) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create the new thread. */ + thread = nxo_stack_under_push(ostack, stack); + nxo_thread_new(thread, nxo_thread_nx_get(a_thread)); + + /* Set up the new thread's ostack. */ + nxo_stack_copy(nxo_thread_ostack_get(thread), stack); + nxo = nxo_stack_push(nxo_thread_ostack_get(thread)); + nxo_dup(nxo, entry); + + /* Clean up. */ + nxo_stack_npop(ostack, 2); + + /* Start the thread. */ + nxo_thread_thread(thread); +} +#endif + +void +systemdict_threaddstack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *thread, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(thread, ostack, a_thread); + if (nxo_type_get(thread) != NXOT_THREAD) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_dstack_get(thread)); + + nxo_stack_remove(ostack, thread); +} + +void +systemdict_threadestack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *thread, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(thread, ostack, a_thread); + if (nxo_type_get(thread) != NXOT_THREAD) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_estack_get(thread)); + + nxo_stack_remove(ostack, thread); +} + +void +systemdict_threadistack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *thread, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(thread, ostack, a_thread); + if (nxo_type_get(thread) != NXOT_THREAD) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_istack_get(thread)); + + nxo_stack_remove(ostack, thread); +} + +void +systemdict_threadostack(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *thread, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(thread, ostack, a_thread); + if (nxo_type_get(thread) != NXOT_THREAD) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nxo_thread_ostack_get(thread)); + + nxo_stack_remove(ostack, thread); +} + +#ifdef CW_THREADS +void +systemdict_threadsdict(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, nx_threadsdict_get(nxo_thread_nx_get(a_thread))); +} +#endif + +#ifdef CW_THREADS +void +systemdict_timedwait(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *condition, *mutex, *nsecs; + struct timespec timeout; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nsecs, ostack, a_thread); + NXO_STACK_DOWN_GET(mutex, ostack, a_thread, nsecs); + NXO_STACK_DOWN_GET(condition, ostack, a_thread, mutex); + if (nxo_type_get(condition) != NXOT_CONDITION + || nxo_type_get(mutex) != NXOT_MUTEX + || nxo_type_get(nsecs) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + if (nxo_integer_get(nsecs) < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + /* Convert integer to timespec. */ + timeout.tv_nsec = nxo_integer_get(nsecs) % 1000000000; + timeout.tv_sec = nxo_integer_get(nsecs) / 1000000000; + + nxo_boolean_new(condition, nxo_condition_timedwait(condition, mutex, + &timeout)); + + nxo_stack_npop(ostack, 2); +} +#endif + +void +systemdict_token(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *nxo, *tnxo; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_STRING: + { + cw_nxo_threadp_t threadp; + cw_uint32_t nscanned, scount; + cw_bool_t success; + + scount = nxo_stack_count(ostack); + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + nxo_threadp_new(&threadp); + + xep_begin(); + xep_try + { + nxo_string_lock(tnxo); + nscanned = nxo_l_thread_token(a_thread, &threadp, + nxo_string_get(tnxo), + nxo_string_len_get(tnxo)); + } + xep_acatch + { + nxo_string_unlock(tnxo); + nxo_stack_pop(tstack); + nxo_threadp_delete(&threadp, a_thread); + } + xep_end(); + nxo_string_unlock(tnxo); + + if (nxo_thread_state(a_thread) == THREADTS_START + && nxo_thread_deferred(a_thread) == FALSE + && nxo_stack_count(ostack) == scount + 1) + { + success = TRUE; + } + else + { + xep_begin(); + xep_try + { + /* Flush, but do it such that execution is deferred. */ + nxo_l_thread_token(a_thread, &threadp, "\n", 1); + } + xep_acatch + { + nxo_stack_pop(tstack); + nxo_threadp_delete(&threadp, a_thread); + } + xep_end(); + + if (nxo_thread_state(a_thread) == THREADTS_START + && nxo_thread_deferred(a_thread) == FALSE + && nxo_stack_count(ostack) == scount + 1) + { + success = TRUE; + } + else + { + success = FALSE; + } + } + + if (success) + { + nxo_string_substring_new(nxo, tnxo, nxo_thread_nx_get(a_thread), + nscanned, + nxo_string_len_get(tnxo) - nscanned); + nxo = nxo_stack_push(ostack); + nxo_boolean_new(nxo, TRUE); + } + else + { + cw_uint32_t i; + + /* We failed to scan a token. Reset a_thread and clean up + * ostack. */ + nxo_thread_reset(a_thread); + for (i = nxo_stack_count(ostack); i > scount; i--) + { + nxo_stack_pop(ostack); + } + + nxo_boolean_new(nxo, FALSE); + } + nxo_threadp_delete(&threadp, a_thread); + nxo_stack_pop(tstack); + break; + } + case NXOT_FILE: + { + cw_nxo_threadp_t threadp; + cw_sint32_t nread; + cw_uint32_t scount; + cw_uint8_t c; + + scount = nxo_stack_count(ostack); + tnxo = nxo_stack_push(tstack); + nxo_dup(tnxo, nxo); + nxo_threadp_new(&threadp); + + /* Feed the scanner one byte at a time, checking after every + * character whether a token was accepted. If we run out of data, + * flush the scanner in the hope of causing token acceptance. */ + for (nread = nxo_file_read(tnxo, 1, &c); + nread > 0; + nread = nxo_file_read(tnxo, 1, &c)) + { + xep_begin(); + xep_try + { + nxo_l_thread_token(a_thread, &threadp, &c, 1); + } + xep_acatch + { + nxo_stack_pop(tstack); + nxo_threadp_delete(&threadp, a_thread); + } + xep_end(); + + if (nxo_thread_state(a_thread) == THREADTS_START + && nxo_thread_deferred(a_thread) == FALSE + && nxo_stack_count(ostack) == scount + 1) + { + goto SUCCESS; + } + } + xep_begin(); + xep_try + { + /* Flush, but do it such that execution is deferred. */ + nxo_l_thread_token(a_thread, &threadp, "\n", 1); + } + xep_acatch + { + nxo_stack_pop(tstack); + nxo_threadp_delete(&threadp, a_thread); + } + xep_end(); + + if (nxo_thread_state(a_thread) == THREADTS_START + && nxo_thread_deferred(a_thread) == FALSE + && nxo_stack_count(ostack) == scount + 1) + { + /* Success. */ + SUCCESS: + nxo_boolean_new(nxo, TRUE); + nxo_stack_exch(ostack); + } + else + { + cw_uint32_t i; + + /* We failed to scan a token. Reset a_thread and clean up + * ostack. */ + nxo_thread_reset(a_thread); + for (i = nxo_stack_count(ostack); i > scount; i--) + { + nxo_stack_pop(ostack); + } + + nxo_boolean_new(nxo, FALSE); + } + nxo_threadp_delete(&threadp, a_thread); + nxo_stack_pop(tstack); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +#ifdef CW_REAL +void +systemdict_trunc(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + switch (nxo_type_get(nxo)) + { + case NXOT_INTEGER: + { + break; + } + case NXOT_REAL: + { + nxo_integer_new(nxo, (cw_nxoi_t) nxo_real_get(nxo)); + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} +#endif + +#ifdef CW_POSIX +void +systemdict_truncate(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file, *length; + cw_nxoi_t len; + cw_nxn_t error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(length, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, length); + if (nxo_type_get(file) != NXOT_FILE || nxo_type_get(length) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + len = nxo_integer_get(length); + if (len < 0) + { + nxo_thread_nerror(a_thread, NXN_rangecheck); + return; + } + + error = nxo_file_truncate(file, len); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_THREADS +void +systemdict_trylock(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *mutex; + cw_bool_t error; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(mutex, ostack, a_thread); + if (nxo_type_get(mutex) != NXOT_MUTEX) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + error = nxo_mutex_trylock(mutex); + + nxo_boolean_new(mutex, error); +} +#endif + +void +systemdict_tuck(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *top, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(top, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo, ostack, a_thread, top); + nxo = nxo_stack_under_push(ostack, nxo); + nxo_dup(nxo, top); +} + +void +systemdict_type(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + cw_nxot_t type; + /* Must be kept in sync with cw_nxot_t. */ + static const cw_nxn_t typenames[] = { + 0, + NXN_arraytype, + NXN_booleantype, +#ifdef CW_THREADS + NXN_conditiontype, +#endif + NXN_dicttype, + NXN_filetype, + NXN_finotype, + NXN_hooktype, + NXN_integertype, + NXN_marktype, +#ifdef CW_THREADS + NXN_mutextype, +#endif + NXN_nametype, + NXN_nulltype, + NXN_operatortype, + NXN_pmarktype, +#ifdef CW_REAL + NXN_realtype, +#endif +#ifdef CW_REGEX + NXN_regextype, + NXN_regsubtype, +#endif + NXN_stacktype, + NXN_stringtype, + NXN_threadtype + }; + cw_assert(sizeof(typenames) / sizeof(cw_nxn_t) == NXOT_LAST + 1); + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + type = nxo_type_get(nxo); + cw_assert(type > NXOT_NO && type <= NXOT_LAST); + + nxo_name_new(nxo, nxo_thread_nx_get(a_thread), nxn_str(typenames[type]), + nxn_len(typenames[type]), TRUE); + nxo_attr_set(nxo, NXOA_EXECUTABLE); +} + +#ifdef CW_POSIX +void +systemdict_uid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + nxo = nxo_stack_push(ostack); + nxo_integer_new(nxo, getuid()); +} +#endif + +#ifdef CW_POSIX +void +systemdict_umask(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *nxo; + mode_t omode, nmode; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + omode = nxo_integer_get(nxo); + nmode = umask(omode); + nxo_integer_new(nxo, nmode); +} +#endif + +void +systemdict_undef(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *dict, *key; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(key, ostack, a_thread); + NXO_STACK_DOWN_GET(dict, ostack, a_thread, key); + if (nxo_type_get(dict) != NXOT_DICT) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_dict_undef(dict, nxo_thread_nx_get(a_thread), key); + + nxo_stack_npop(ostack, 2); +} + +void +systemdict_under(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *under, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_NGET(under, ostack, a_thread, 1); + nxo = nxo_stack_under_push(ostack, under); + nxo_dup(nxo, under); +} + +#ifdef CW_POSIX +void +systemdict_unlink(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack; + cw_nxo_t *filename, *tfilename; + int error; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + NXO_STACK_GET(filename, ostack, a_thread); + + if (nxo_type_get(filename) != NXOT_STRING) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + /* Create a copy of filename with an extra byte to store a '\0' + * terminator. */ + tfilename = nxo_stack_push(tstack); + nxo_string_cstring(tfilename, filename, a_thread); + + error = unlink(nxo_string_get(tfilename)); + + nxo_stack_pop(tstack); + + if (error == -1) + { + switch (errno) + { + case EIO: + case EBUSY: + case ELOOP: + case EROFS: + { + nxo_thread_nerror(a_thread, NXN_ioerror); + break; + } + case ENOENT: + case ENOTDIR: + case ENAMETOOLONG: + { + nxo_thread_nerror(a_thread, NXN_undefinedfilename); + break; + } + case EACCES: + case EPERM: + { + nxo_thread_nerror(a_thread, NXN_invalidfileaccess); + break; + } + case EFAULT: + default: + { + nxo_thread_nerror(a_thread, NXN_unregistered); + } + } + return; + } + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_THREADS +void +systemdict_unlock(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *mutex; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(mutex, ostack, a_thread); + if (nxo_type_get(mutex) != NXOT_MUTEX) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_mutex_unlock(mutex); + + nxo_stack_pop(ostack); +} +#endif + +#ifdef CW_POSIX +void +systemdict_unsetenv(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *tstack, *envdict; + cw_nxo_t *key, *tkey; + cw_nx_t *nx; + cw_uint32_t len; + + ostack = nxo_thread_ostack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + nx = nxo_thread_nx_get(a_thread); + envdict = nx_envdict_get(nx); + NXO_STACK_GET(key, ostack, a_thread); + if (nxo_type_get(key) != NXOT_NAME) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + tkey = nxo_stack_push(tstack); + len = nxo_name_len_get(key); +#ifdef HAVE_UNSETENV + /* Create a copy of the key with an extra byte to store a '\0' + * terminator. */ + nxo_string_new(tkey, nx, FALSE, len + 1); + nxo_string_set(tkey, 0, nxo_name_str_get(key), len); + nxo_string_el_set(tkey, '\0', len); + + /* Do the unsetenv(). */ + unsetenv(nxo_string_get(tkey)); +#else + /* Create a copy of the key with an extra 2 bytes to append "=\0". */ + nxo_string_new(tkey, nx, FALSE, len + 2); + nxo_string_set(tkey, 0, nxo_name_str_get(key), len); + nxo_string_set(tkey, len, "=\0", 2); + + /* Do the putenv(). */ + if (putenv(nxo_string_get(tkey)) == -1) + { + xep_throw(CW_ONYXX_OOM); + } +#endif + nxo_stack_pop(tstack); + + /* Undefine the key/value pair in envdict. */ + nxo_dict_undef(envdict, nx, key); + + nxo_stack_pop(ostack); +} +#endif + +void +systemdict_until(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *nxo, *exec, *cond; + cw_uint32_t edepth, tdepth; + cw_bool_t do_exec; + cw_nxn_t nerror; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(cond, ostack, a_thread); + NXO_STACK_DOWN_GET(exec, ostack, a_thread, cond); + + /* Move exec and cond to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, exec); + exec = nxo; + + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, cond); + cond = nxo; + + nxo_stack_npop(ostack, 2); + + /* Record stack depths so that we can clean up if necessary. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + /* Catch an exit exception, if thrown, but do not continue executing the + * loop. */ + xep_begin(); + xep_try + { + while (1) + { + /* Execute the body of the until statement. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, exec); + nxo_thread_loop(a_thread); + + /* Execute the conditional. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, cond); + nxo_thread_loop(a_thread); + + /* Get the conditional result. */ + nxo = nxo_stack_get(ostack); + if (nxo == NULL) + { + nerror = NXN_stackunderflow; + } + else if (nxo_type_get(nxo) != NXOT_BOOLEAN) + { + nerror = NXN_typecheck; + } + else + { + nerror = NXN_ZERO; + } + + if (nerror != NXN_ZERO) + { + /* Push the inputs back onto ostack before throwing an error. */ + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, exec); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, cond); + + nxo_stack_npop(tstack, 2); + + nxo_thread_nerror((a_thread), nerror); + return; + } + + /* Get the result of the conditional, and break out of the loop if + * the result was FALSE. */ + do_exec = nxo_boolean_get(nxo); + nxo_stack_pop(ostack); + if (do_exec == FALSE) + { + break; + } + } + } + xep_catch(CW_ONYXX_EXIT) + { + cw_nxo_t *istack; + + xep_handled(); + + /* Clean up stacks. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) + - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); + } + xep_end(); + + /* Remove exec and cond from tstack. */ + nxo_stack_npop(tstack, 2); +} + +void +systemdict_up(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + + ostack = nxo_thread_ostack_get(a_thread); + if (nxo_stack_count(ostack) < 3) + { + nxo_thread_nerror(a_thread, NXN_stackunderflow); + return; + } + + nxo_stack_roll(ostack, 3, 1); +} + +#ifdef CW_THREADS +void +systemdict_wait(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *condition, *mutex; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(mutex, ostack, a_thread); + NXO_STACK_DOWN_GET(condition, ostack, a_thread, mutex); + if (nxo_type_get(condition) != NXOT_CONDITION + || nxo_type_get(mutex) != NXOT_MUTEX) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_condition_wait(condition, mutex); + + nxo_stack_npop(ostack, 2); +} +#endif + +#ifdef CW_POSIX +void +systemdict_waitpid(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + pid_t pid; + int status; + cw_nxoi_t result; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + if (nxo_type_get(nxo) != NXOT_INTEGER) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + pid = nxo_integer_get(nxo); + + waitpid(pid, &status, 0); + if (WIFEXITED(status)) + { + /* Normal program exit. */ + result = WEXITSTATUS(status); + } + else + { + /* Program termination due to a signal. Set a negative return value. */ + result = -WTERMSIG(status); + } + + nxo_integer_new(nxo, result); +} +#endif + +void +systemdict_where(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *dstack; + cw_nxo_t *dict, *key, *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + dstack = nxo_thread_dstack_get(a_thread); + + NXO_STACK_GET(key, ostack, a_thread); + + /* Iteratively search the dictionaries on the dictionary stack for key. */ + for (dict = nxo_stack_get(dstack); + dict != NULL; + dict = nxo_stack_down_get(dstack, dict)) + { + if (nxo_dict_lookup(dict, key, NULL) == FALSE) + { + /* Found. */ + nxo = nxo_stack_push(ostack); + nxo_dup(key, dict); + nxo_boolean_new(nxo, TRUE); + return; + } + } + /* Not found. */ + nxo_boolean_new(key, FALSE); +} + +void +systemdict_while(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *estack, *tstack; + cw_nxo_t *nxo, *exec, *cond; + cw_uint32_t edepth, tdepth; + cw_bool_t do_exec; + cw_nxn_t nerror; + + ostack = nxo_thread_ostack_get(a_thread); + estack = nxo_thread_estack_get(a_thread); + tstack = nxo_thread_tstack_get(a_thread); + + NXO_STACK_GET(exec, ostack, a_thread); + NXO_STACK_DOWN_GET(cond, ostack, a_thread, exec); + + /* Move exec and cond to tstack. */ + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, cond); + cond = nxo; + + nxo = nxo_stack_push(tstack); + nxo_dup(nxo, exec); + exec = nxo; + + nxo_stack_npop(ostack, 2); + + /* Record stack depths so that we can clean up if necessary. */ + edepth = nxo_stack_count(estack); + tdepth = nxo_stack_count(tstack); + + /* Catch an exit exception, if thrown, but do not continue executing the + * loop. */ + xep_begin(); + xep_try + { + while (1) + { + /* Execute the conditional. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, cond); + nxo_thread_loop(a_thread); + + /* Get the conditional result. */ + nxo = nxo_stack_get(ostack); + if (nxo == NULL) + { + nerror = NXN_stackunderflow; + } + else if (nxo_type_get(nxo) != NXOT_BOOLEAN) + { + nerror = NXN_typecheck; + } + else + { + nerror = NXN_ZERO; + } + + if (nerror != NXN_ZERO) + { + /* Push the inputs back onto ostack before throwing an error. */ + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, cond); + nxo = nxo_stack_push(ostack); + nxo_dup(nxo, exec); + + nxo_stack_npop(tstack, 2); + + nxo_thread_nerror((a_thread), nerror); + return; + } + + /* Get the result of the conditional, and break out of the loop if + * the result was FALSE. */ + do_exec = nxo_boolean_get(nxo); + nxo_stack_pop(ostack); + if (do_exec == FALSE) + { + break; + } + + /* Execute the body of the while statement. */ + nxo = nxo_stack_push(estack); + nxo_dup(nxo, exec); + nxo_thread_loop(a_thread); + } + } + xep_catch(CW_ONYXX_EXIT) + { + cw_nxo_t *istack; + + xep_handled(); + + /* Clean up stacks. */ + nxo_stack_npop(estack, nxo_stack_count(estack) - edepth); + istack = nxo_thread_istack_get(a_thread); + nxo_stack_npop(istack, nxo_stack_count(istack) + - nxo_stack_count(estack)); + nxo_stack_npop(tstack, nxo_stack_count(tstack) - tdepth); + } + xep_end(); + + /* Remove exec and cond from tstack. */ + nxo_stack_npop(tstack, 2); +} + +void +systemdict_write(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *file, *value; + cw_nxn_t error; + cw_uint32_t count; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(value, ostack, a_thread); + NXO_STACK_DOWN_GET(file, ostack, a_thread, value); + + if (nxo_type_get(file) != NXOT_FILE) + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + switch (nxo_type_get(value)) + { + case NXOT_INTEGER: + { + cw_uint8_t val; + + val = (cw_uint8_t) nxo_integer_get(value); + error = nxo_file_write(file, &val, 1, &count); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + if (count == 1) + { + /* Successful write. */ + nxo_boolean_new(file, FALSE); + nxo_stack_pop(ostack); + } + else + { + /* Short write. */ + nxo_dup(file, value); + nxo_boolean_new(value, TRUE); + } + break; + } + case NXOT_STRING: + { + cw_uint32_t len; + + nxo_string_lock(value); + len = nxo_string_len_get(value); + error = nxo_file_write(file, nxo_string_get(value), len, &count); + nxo_string_unlock(value); + if (error) + { + nxo_thread_nerror(a_thread, error); + return; + } + if (count == len) + { + /* Successful write. */ + nxo_boolean_new(file, FALSE); + nxo_stack_pop(ostack); + } + else + { + /* Short write. */ + nxo_string_substring_new(file, value, + nxo_thread_nx_get(a_thread), + count, len - count); + nxo_boolean_new(value, TRUE); + } + break; + } + default: + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + } +} + +void +systemdict_xcheck(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo; + + ostack = nxo_thread_ostack_get(a_thread); + NXO_STACK_GET(nxo, ostack, a_thread); + + if (nxo_attr_get(nxo) == NXOA_LITERAL) + { + nxo_boolean_new(nxo, FALSE); + } + else + { + nxo_boolean_new(nxo, TRUE); + } +} + +void +systemdict_xor(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack; + cw_nxo_t *nxo_a, *nxo_b; + + ostack = nxo_thread_ostack_get(a_thread); + + NXO_STACK_GET(nxo_b, ostack, a_thread); + NXO_STACK_DOWN_GET(nxo_a, ostack, a_thread, nxo_b); + + if (nxo_type_get(nxo_a) == NXOT_BOOLEAN + && nxo_type_get(nxo_b) == NXOT_BOOLEAN) + { + cw_bool_t xor; + + if (nxo_boolean_get(nxo_a) || nxo_boolean_get(nxo_b)) + { + if (nxo_boolean_get(nxo_a) == nxo_boolean_get(nxo_b)) + { + xor = FALSE; + } + else + { + xor = TRUE; + } + } + else + { + xor = FALSE; + } + nxo_boolean_new(nxo_a, xor); + } + else if (nxo_type_get(nxo_a) == NXOT_INTEGER + && nxo_type_get(nxo_b) == NXOT_INTEGER) + { + nxo_integer_set(nxo_a, nxo_integer_get(nxo_a) ^ nxo_integer_get(nxo_b)); + } + else + { + nxo_thread_nerror(a_thread, NXN_typecheck); + return; + } + + nxo_stack_pop(ostack); +} + +#ifdef CW_THREADS +void +systemdict_yield(cw_nxo_t *a_thread) +{ + thd_yield(); +} +#endif diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/thd.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/thd.c new file mode 100644 index 000000000..e04637119 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/thd.c @@ -0,0 +1,814 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#include +#include + +#ifdef CW_FTHREADS +#include +#endif + +#ifdef CW_STHREADS +#include +#endif + +#ifdef CW_DBG +#define CW_THD_MAGIC 0x5638638e +#endif + +struct cw_thd_s +{ +#ifdef CW_DBG + cw_uint32_t magic; +#endif + void *(*start_func)(void *); + void *start_arg; + cw_mtx_t mtx; +#ifdef CW_PTH + pth_t pth; +#endif +#ifdef CW_PTHREADS + pthread_t pthread; +#endif +#ifdef CW_MTHREADS + thread_t mthread; +#endif + cw_bool_t suspendible:1; + cw_bool_t suspended:1; /* Suspended by thd_suspend()? */ + cw_bool_t singled:1; /* Suspended by thd_single_enter()? */ + qr(cw_thd_t) link; + cw_bool_t delete:1; +}; + +#ifdef CW_DBG +static cw_bool_t cw_g_thd_initialized = FALSE; +#endif + +#ifdef CW_PTH +/* Thread attribute object used for all thread creations. */ +static pth_attr_t cw_g_thd_attr; +#endif + +#ifdef CW_PTHREADS +/* Thread attribute object used for all thread creations. */ +static pthread_attr_t cw_g_thd_attr; +#endif + +/* Special thd structure for initial thread, needed for critical sections. */ +static cw_thd_t cw_g_thd; + +/* Protects the ring of thd's in thd_single_{enter,leave}(). */ +static cw_mtx_t cw_g_thd_single_lock; + +#ifdef CW_THD_GENERIC_SR +/* For interlocking of suspend. */ +static sem_t cw_g_thd_sem; +#endif + +/* For thd_self(). */ +static cw_tsd_t cw_g_thd_self_key; + +static void +thd_p_delete(cw_thd_t *a_thd); +static void * +thd_p_start_func(void *a_arg); +static void +thd_p_suspend(cw_thd_t *a_thd); +static void +thd_p_resume(cw_thd_t *a_thd); + +#ifdef CW_THD_GENERIC_SR +static void +thd_p_suspend_handle(int a_signal); +static void +thd_p_resume_handle(int a_signal); +#endif + +void +thd_l_init(void) +{ +#ifdef CW_PTH + unsigned stacksize; +#endif +#ifdef CW_PTHREADS + size_t stacksize; +#endif + +#ifdef CW_THD_GENERIC_SR + int error; + struct sigaction action; + + /* Install signal handlers for suspend and resume. Restart system calls in + * order to reduce the impact of signals on the application. */ + action.sa_flags = SA_RESTART; + action.sa_handler = thd_p_suspend_handle; + sigemptyset(&action.sa_mask); + sigaddset(&action.sa_mask, CW_THD_SIGRESUME); + error = sigaction(CW_THD_SIGSUSPEND, &action, NULL); + if (error == -1) + { + fprintf(stderr, "%s:%u:%s(): Error in sigaction(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } + + action.sa_flags = SA_RESTART; + action.sa_handler = thd_p_resume_handle; + sigemptyset(&action.sa_mask); + error = sigaction(CW_THD_SIGRESUME, &action, NULL); + if (error == -1) + { + fprintf(stderr, "%s:%u:%s(): Error in sigaction(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } + + /* Initialize the semaphore that is used for suspend interlocking. */ + error = sem_init(&cw_g_thd_sem, 0, 0); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in sem_init(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif + cw_assert(cw_g_thd_initialized == FALSE); + +#ifdef CW_PTH + if (pth_init() == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_init(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + + /* Create a thread attribute object to be used for all thread creations. + * Make sure that the thread stack size isn't too tiny. */ + cw_g_thd_attr = pth_attr_new(); + if (pth_attr_get(cw_g_thd_attr, PTH_ATTR_STACK_SIZE, &stacksize) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_attr_get(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + if (stacksize < CW_THD_MINSTACK) + { + if (pth_attr_set(cw_g_thd_attr, PTH_ATTR_STACK_SIZE, CW_THD_MINSTACK) + == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_attr_set(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + } +#endif +#ifdef CW_PTHREADS + /* Create a thread attribute object to be used for all thread creations. + * Make sure that the thread stack size isn't too tiny. */ + pthread_attr_init(&cw_g_thd_attr); + pthread_attr_getstacksize(&cw_g_thd_attr, &stacksize); + if (stacksize < CW_THD_MINSTACK) + { + pthread_attr_setstacksize(&cw_g_thd_attr, CW_THD_MINSTACK); + } +#endif + + mtx_new(&cw_g_thd_single_lock); + tsd_new(&cw_g_thd_self_key, NULL); + + /* Initialize the main thread's thd structure. */ + cw_g_thd.start_func = NULL; + cw_g_thd.start_arg = NULL; + mtx_new(&cw_g_thd.mtx); + mtx_lock(&cw_g_thd.mtx); +#ifdef CW_PTH + cw_g_thd.pth = pth_self(); +#endif +#ifdef CW_PTHREADS + cw_g_thd.pthread = pthread_self(); +#endif +#ifdef CW_MTHREADS + cw_g_thd.mthread = mach_thread_self(); +#endif + cw_g_thd.suspendible = TRUE; + cw_g_thd.suspended = FALSE; + cw_g_thd.singled = FALSE; + qr_new(&cw_g_thd, link); +#ifdef CW_DBG + cw_g_thd.magic = CW_THD_MAGIC; +#endif + /* Make thd_self() work for the main thread. */ + tsd_set(&cw_g_thd_self_key, (void *) &cw_g_thd); + mtx_unlock(&cw_g_thd.mtx); + +#ifdef CW_DBG + cw_g_thd_initialized = TRUE; +#endif +} + +void +thd_l_shutdown(void) +{ +#ifdef CW_THD_GENERIC_SR + int error; +#endif + + cw_assert(cw_g_thd_initialized); + +#ifdef CW_PTHREADS + pthread_attr_destroy(&cw_g_thd_attr); +#endif +#ifdef CW_PTH + if (pth_attr_destroy(cw_g_thd_attr) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_attr_destroy(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + + if (pth_kill() == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_kill(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif + + mtx_delete(&cw_g_thd.mtx); +#ifdef CW_THD_GENERIC_SR + error = sem_destroy(&cw_g_thd_sem); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in sem_destroy(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif + tsd_delete(&cw_g_thd_self_key); + mtx_delete(&cw_g_thd_single_lock); +#ifdef CW_DBG + memset(&cw_g_thd, 0x5a, sizeof(cw_thd_t)); + cw_g_thd_initialized = FALSE; +#endif +} + +cw_thd_t * +thd_new(void *(*a_start_func)(void *), void *a_arg, cw_bool_t a_suspendible) +{ + cw_thd_t *retval; +#ifdef CW_PTH + pth_t pth; +#endif +#ifdef CW_PTHREADS + pthread_t pthread; + int error; +#endif + + cw_assert(cw_g_thd_initialized); + + retval = (cw_thd_t *) cw_malloc(sizeof(cw_thd_t)); + + retval->start_func = a_start_func; + retval->start_arg = a_arg; + mtx_new(&retval->mtx); + mtx_lock(&retval->mtx); + retval->suspendible = a_suspendible; + retval->suspended = FALSE; + retval->singled = FALSE; + retval->delete = FALSE; +#ifdef CW_DBG + retval->magic = CW_THD_MAGIC; +#endif + mtx_unlock(&retval->mtx); + + /* Thread creation and setting retval->pthread must be atomic with respect + * to thread suspension if the new thread is suspendible. There are + * multiple ways of trying to write this code, and all of them end up + * requiring that an interlock be used (to avoid race conditions and/or + * deadlocks, depending on the approach). Since an interlock + * (cw_g_thd_single_lock; using retval->mtx could result in deadlock) is + * mandatory anyway, the pthread field of thd's is universally protected by + * cw_g_thd_single_lock. */ + mtx_lock(&cw_g_thd_single_lock); + +#ifdef CW_PTH + pth = pth_spawn(cw_g_thd_attr, thd_p_start_func, (void *) retval); + if (pth == NULL) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_spawn(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + + /* Set retval->pthread here rather than in thd_p_start_func(), since it's + * possible to call something like thd_join() before the new thread even + * gets as far as initializing itself. */ + retval->pth = pth; +#endif +#ifdef CW_PTHREADS + error = pthread_create(&pthread, &cw_g_thd_attr, + thd_p_start_func, (void *) retval); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_create(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } + + /* Set retval->pthread here rather than in thd_p_start_func(), since it's + * possible to call something like thd_join() before the new thread even + * gets as far as initializing itself. */ + retval->pthread = pthread; +#endif + + mtx_unlock(&cw_g_thd_single_lock); + + return retval; +} + +void +thd_delete(cw_thd_t *a_thd) +{ +#ifdef CW_PTH + pth_t pth; + pth_attr_t attr; +#endif +#ifdef CW_PTHREADS + pthread_t pthread; + int error; +#endif + + cw_check_ptr(a_thd); + cw_dassert(a_thd->magic == CW_THD_MAGIC); + cw_assert(cw_g_thd_initialized); + +#ifdef CW_PTH + mtx_lock(&cw_g_thd_single_lock); + pth = a_thd->pth; + mtx_unlock(&cw_g_thd_single_lock); + + attr = pth_attr_of(pth); + if (attr == NULL) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_attr_of(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + if (pth_attr_set(attr, PTH_ATTR_JOINABLE, FALSE) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_attr_set(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } + if (pth_attr_destroy(attr) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_attr_destroy(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + mtx_lock(&cw_g_thd_single_lock); + pthread = a_thd->pthread; + mtx_unlock(&cw_g_thd_single_lock); + + error = pthread_detach(pthread); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_detach(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif + + thd_p_delete(a_thd); +} + +void * +thd_join(cw_thd_t *a_thd) +{ + void *retval; +#ifdef CW_PTH + pth_t pth; +#endif +#ifdef CW_PTHREADS + pthread_t pthread; + int error; +#endif + + cw_check_ptr(a_thd); + cw_dassert(a_thd->magic == CW_THD_MAGIC); + cw_assert(cw_g_thd_initialized); + +#ifdef CW_PTH + mtx_lock(&cw_g_thd_single_lock); + pth = a_thd->pth; + mtx_unlock(&cw_g_thd_single_lock); + + if (pth_join(pth, &retval) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_join(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + mtx_lock(&cw_g_thd_single_lock); + pthread = a_thd->pthread; + mtx_unlock(&cw_g_thd_single_lock); + + error = pthread_join(pthread, &retval); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_join(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif + mtx_delete(&a_thd->mtx); + cw_free(a_thd); + return retval; +} + +cw_thd_t * +thd_self(void) +{ + cw_thd_t *retval; + + retval = (cw_thd_t *) tsd_get(&cw_g_thd_self_key); + + cw_check_ptr(retval); + cw_dassert(retval->magic == CW_THD_MAGIC); + cw_assert(cw_g_thd_initialized); + + return retval; +} + +void +thd_sigmask(int a_how, const sigset_t *a_set, sigset_t *r_oset) +{ + cw_assert(a_how == SIG_BLOCK || a_how == SIG_UNBLOCK + || a_how == SIG_SETMASK); + +#ifdef CW_PTH + pth_sigmask(a_how, a_set, r_oset); +#endif +#ifdef CW_PTHREADS +#ifdef CW_THD_GENERIC_SR + { + sigset_t set; + + /* Make a local copy of the signal mask, then modify it appropriately to + * keep from breaking suspend/resume. */ + memcpy(&set, a_set, sizeof(sigset_t)); + sigdelset(&set, CW_THD_SIGSUSPEND); + sigdelset(&set, CW_THD_SIGRESUME); + pthread_sigmask(a_how, &set, r_oset); + } +#else + pthread_sigmask(a_how, a_set, r_oset); +#endif +#endif +} + +void +thd_crit_enter(void) +{ + cw_thd_t *thd; + + cw_assert(cw_g_thd_initialized); + + thd = thd_self(); + cw_check_ptr(thd); + cw_dassert(thd->magic == CW_THD_MAGIC); + mtx_lock(&thd->mtx); +} + +void +thd_crit_leave(void) +{ + cw_thd_t *thd; + + cw_assert(cw_g_thd_initialized); + + thd = thd_self(); + cw_check_ptr(thd); + cw_dassert(thd->magic == CW_THD_MAGIC); + mtx_unlock(&thd->mtx); +} + +void +thd_single_enter(void) +{ + cw_thd_t *self, *thd; + + cw_assert(cw_g_thd_initialized); + + self = thd_self(); + cw_check_ptr(self); + cw_dassert(self->magic == CW_THD_MAGIC); + + mtx_lock(&cw_g_thd_single_lock); + qr_foreach(thd, &cw_g_thd, link) + { + if (thd != self && thd->suspended == FALSE) + { + mtx_lock(&thd->mtx); + thd_p_suspend(thd); + thd->singled = TRUE; + } + } +} + +void +thd_single_leave(void) +{ + cw_thd_t *thd; + + cw_assert(cw_g_thd_initialized); + + qr_foreach(thd, &cw_g_thd, link) + { + if (thd->singled) + { + thd->singled = FALSE; + thd_p_resume(thd); + } + } + mtx_unlock(&cw_g_thd_single_lock); +} + +void +thd_suspend(cw_thd_t *a_thd) +{ + cw_check_ptr(a_thd); + cw_dassert(a_thd->magic == CW_THD_MAGIC); + cw_assert(cw_g_thd_initialized); + + /* Protect suspension so that we don't risk deadlocking with a thread + * entering a single section. */ + mtx_lock(&cw_g_thd_single_lock); + mtx_lock(&a_thd->mtx); + thd_p_suspend(a_thd); + mtx_unlock(&cw_g_thd_single_lock); +} + +cw_bool_t +thd_trysuspend(cw_thd_t *a_thd) +{ + cw_bool_t retval; + + cw_check_ptr(a_thd); + cw_dassert(a_thd->magic == CW_THD_MAGIC); + cw_assert(cw_g_thd_initialized); + + mtx_lock(&cw_g_thd_single_lock); + if (mtx_trylock(&a_thd->mtx)) + { + retval = TRUE; + goto RETURN; + } + thd_p_suspend(a_thd); + + retval = FALSE; + RETURN: + mtx_unlock(&cw_g_thd_single_lock); + return retval; +} + +void +thd_resume(cw_thd_t *a_thd) +{ + cw_check_ptr(a_thd); + cw_dassert(a_thd->magic == CW_THD_MAGIC); + cw_assert(cw_g_thd_initialized); + +#ifdef CW_THD_GENERIC_SR + mtx_lock(&cw_g_thd_single_lock); +#endif + + thd_p_resume(a_thd); + +#ifdef CW_THD_GENERIC_SR + mtx_unlock(&cw_g_thd_single_lock); +#endif +} + +static void +thd_p_delete(cw_thd_t *a_thd) +{ + cw_bool_t delete; + + /* Determine whether to delete the object now. */ + mtx_lock(&a_thd->mtx); + if (a_thd->delete) + { + delete = TRUE; + } + else + { + delete = FALSE; + a_thd->delete = TRUE; + } + mtx_unlock(&a_thd->mtx); + + if (delete) + { + mtx_delete(&a_thd->mtx); + cw_free(a_thd); + } +} + +static void * +thd_p_start_func(void *a_arg) +{ + void *retval; + cw_thd_t *thd = (cw_thd_t *) a_arg; + + cw_assert(cw_g_thd_initialized); + + tsd_set(&cw_g_thd_self_key, (void *) thd); + + if (thd->suspendible) + { + /* Insert this thread into the thread ring. */ + mtx_lock(&cw_g_thd_single_lock); +#ifdef CW_MTHREADS + thd->mthread = mach_thread_self(); +#endif + qr_before_insert(&cw_g_thd, thd, link); + mtx_unlock(&cw_g_thd_single_lock); + + retval = thd->start_func(thd->start_arg); + + /* Remove this thread from the thread ring. */ + mtx_lock(&cw_g_thd_single_lock); + qr_remove(thd, link); + mtx_unlock(&cw_g_thd_single_lock); + } + else + { + retval = thd->start_func(thd->start_arg); + } + + thd_p_delete(thd); + + return retval; +} + +static void +thd_p_suspend(cw_thd_t *a_thd) +{ +#ifdef CW_MTHREADS + kern_return_t mach_error; +#endif +#if (defined(CW_THD_GENERIC_SR) || defined(CW_FTHREADS) || defined(CW_STHREADS)) + int error; +#endif + + a_thd->suspended = TRUE; +#ifdef CW_PTH + if (pth_suspend(a_thd->pth) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_suspend(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_THD_GENERIC_SR + error = pthread_kill(a_thd->pthread, CW_THD_SIGSUSPEND); + if (error != 0) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_kill(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } + if (sem_wait(&cw_g_thd_sem) != 0) + { + fprintf(stderr, "%s:%u:%s(): Error in sem_wait(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_FTHREADS + error = pthread_suspend_np(a_thd->pthread); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_suspend_np(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +#ifdef CW_STHREADS + error = thr_suspend(a_thd->pthread); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in thr_suspend(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +#ifdef CW_MTHREADS + mach_error = thread_suspend(a_thd->mthread); + if (mach_error != KERN_SUCCESS) + { + fprintf(stderr, "%s:%u:%s(): Error in thread_suspend(): %d\n", + __FILE__, __LINE__, __FUNCTION__, mach_error); + abort(); + } +#endif +} + +static void +thd_p_resume(cw_thd_t *a_thd) +{ +#ifdef CW_PTH + if (pth_resume(a_thd->pth) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_resume(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_THD_GENERIC_SR + int error; + + error = pthread_kill(a_thd->pthread, CW_THD_SIGRESUME); + if (error != 0) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_kill(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +#ifdef CW_FTHREADS + int error; + + error = pthread_resume_np(a_thd->pthread); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_resume_np(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +#ifdef CW_STHREADS + int error; + + error = thr_continue(a_thd->pthread); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in thr_continue(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +#ifdef CW_MTHREADS + kern_return_t mach_error; + + mach_error = thread_resume(a_thd->mthread); + if (mach_error != KERN_SUCCESS) + { + fprintf(stderr, "%s:%u:%s(): Error in thread_resume(): %d\n", + __FILE__, __LINE__, __FUNCTION__, mach_error); + abort(); + } +#endif + a_thd->suspended = FALSE; + mtx_unlock(&a_thd->mtx); +} + +#ifdef CW_THD_GENERIC_SR +static void +thd_p_suspend_handle(int a_signal) +{ + sigset_t set; + + /* Block all signals except CW_THD_SIGRESUME while suspended. */ + sigfillset(&set); + sigdelset(&set, CW_THD_SIGRESUME); + /* Tell suspender we're suspended. */ + sem_post(&cw_g_thd_sem); + + /* Suspend until CW_THD_SIGRESUME is delivered and handled. */ + sigsuspend(&set); +} + +static void +thd_p_resume_handle(int a_signal) +{ + /* Do nothing. This function only exists to allow the suspended thread to + * return from the sigsuspend() call in thd_p_suspend_handle(). */ +} +#endif diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/tsd.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/tsd.c new file mode 100644 index 000000000..69493a122 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/tsd.c @@ -0,0 +1,117 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#include +#include + +void +tsd_new(cw_tsd_t *a_tsd, void (*a_func)(void *)) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_tsd); + +#ifdef CW_PTH + if (pth_key_create(&a_tsd->key, a_func) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_key_create(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_key_create(&a_tsd->key, a_func); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_key_create(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void +tsd_delete(cw_tsd_t *a_tsd) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_tsd); + +#ifdef CW_PTH + if (pth_key_delete(a_tsd->key) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_key_delete(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_key_delete(a_tsd->key); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_key_delete(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} + +void * +tsd_get(cw_tsd_t *a_tsd) +{ + void *retval; + + cw_check_ptr(a_tsd); + +#ifdef CW_PTH + retval = pth_key_getdata(a_tsd->key); +#endif +#ifdef CW_PTHREADS + retval = pthread_getspecific(a_tsd->key); +#endif + + return retval; +} + +void +tsd_set(cw_tsd_t *a_tsd, void *a_val) +{ +#ifdef CW_PTHREADS + int error; +#endif + + cw_check_ptr(a_tsd); + +#ifdef CW_PTH + if (pth_key_setdata(a_tsd->key, a_val) == FALSE) + { + fprintf(stderr, "%s:%u:%s(): Error in pth_key_setdata(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(errno)); + abort(); + } +#endif +#ifdef CW_PTHREADS + error = pthread_setspecific(a_tsd->key, a_val); + if (error) + { + fprintf(stderr, "%s:%u:%s(): Error in pthread_setspecific(): %s\n", + __FILE__, __LINE__, __FUNCTION__, strerror(error)); + abort(); + } +#endif +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/src/xep.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/xep.c new file mode 100644 index 000000000..a310cef09 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/src/xep.c @@ -0,0 +1,260 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#ifdef CW_DBG +static cw_bool_t cw_g_xep_initialized = FALSE; +#endif +#ifdef CW_THREADS +static cw_tsd_t cw_g_xep_key; +#else +static cw_xep_t *cw_g_xep_first; +#endif + +void +xep_l_init(void) +{ + cw_assert(cw_g_xep_initialized == FALSE); + +#ifdef CW_THREADS + tsd_new(&cw_g_xep_key, NULL); +#else + cw_g_xep_first = NULL; +#endif +#ifdef CW_DBG + cw_g_xep_initialized = TRUE; +#endif +} + +void +xep_l_shutdown(void) +{ + cw_assert(cw_g_xep_initialized); + +#ifdef CW_THREADS + tsd_delete(&cw_g_xep_key); +#endif +#ifdef CW_DBG + cw_g_xep_initialized = FALSE; +#endif +} + +void +xep_throw_e(cw_xepv_t a_value, volatile const char *a_filename, + cw_uint32_t a_line_num) +{ + cw_xep_t *xep_first, *xep; + + cw_assert(cw_g_xep_initialized); + cw_assert(a_value > CW_XEPS_CATCH); + + /* Iterate backward through the exception handlers until the exception is + * handled or there are no more exception handlers. */ +#ifdef CW_THREADS + xep = xep_first = (cw_xep_t *) tsd_get(&cw_g_xep_key); +#else + xep = xep_first = cw_g_xep_first; +#endif + if (xep_first != NULL) + { + xep = qr_prev(xep_first, link); + } + else + { + /* No exception handlers at all. */ + fprintf(stderr, "%s(): Unhandled exception %u thrown at %s:%u\n", + __FUNCTION__, a_value, a_filename, a_line_num); + abort(); + } + + do + { + xep->is_handled = FALSE; + xep->filename = a_filename; + xep->line_num = a_line_num; + + switch (xep->state) + { + case CW_XEPS_TRY: + { + /* Execute the handler. */ + xep->value = a_value; + xep->state = CW_XEPS_CATCH; + longjmp(xep->context, (int)a_value); + cw_not_reached(); + } + case CW_XEPS_CATCH: + { + /* Exception thrown within handler; propagate. */ + break; + } + default: + { + cw_not_reached(); + } + } + + xep = qr_prev(xep, link); + } while (xep != xep_first); + + /* No more exception handlers. */ + fprintf(stderr, "%s(): Unhandled exception %u thrown at %s:%u\n", + __FUNCTION__, a_value, xep->filename, xep->line_num); + abort(); +} + +void +xep_p_retry(cw_xep_t *a_xep) +{ + cw_assert(cw_g_xep_initialized); + +#ifdef CW_DBG + switch (a_xep->state) + { + case CW_XEPS_CATCH: + { + break; + } + case CW_XEPS_TRY: + { + cw_error("Exception retry outside handler"); + } + default: + { + cw_not_reached(); + } + } +#endif + a_xep->value = CW_XEPV_NONE; + a_xep->state = CW_XEPS_TRY; + a_xep->is_handled = TRUE; + longjmp(a_xep->context, (int)CW_XEPV_CODE); + cw_not_reached(); +} + +void +xep_p_handled(cw_xep_t *a_xep) +{ + cw_assert(cw_g_xep_initialized); + +#ifdef CW_DBG + switch (a_xep->state) + { + case CW_XEPS_CATCH: + { + break; + } + case CW_XEPS_TRY: + { + cw_error("Exception handled outside handler"); + } + default: + { + cw_not_reached(); + } + } +#endif + + a_xep->is_handled = TRUE; + xep_p_unlink(a_xep); +} + +void +xep_p_link(cw_xep_t *a_xep) +{ + cw_xep_t *xep_first; + + cw_assert(cw_g_xep_initialized); + +#ifdef CW_THREADS + xep_first = (cw_xep_t *) tsd_get(&cw_g_xep_key); +#else + xep_first = cw_g_xep_first; +#endif + + /* Link into the xep ring, if it exists. */ + qr_new(a_xep, link); + if (xep_first != NULL) + { + cw_check_ptr(qr_prev(xep_first, link)); + cw_check_ptr(qr_next(xep_first, link)); + + qr_before_insert(xep_first, a_xep, link); + } + else + { +#ifdef CW_THREADS + tsd_set(&cw_g_xep_key, (void *) a_xep); +#else + cw_g_xep_first = a_xep; +#endif + } + + a_xep->value = CW_XEPV_NONE; + a_xep->state = CW_XEPS_TRY; + a_xep->is_handled = TRUE; + a_xep->is_linked = TRUE; +} + +void +xep_p_unlink(cw_xep_t *a_xep) +{ + cw_xep_t *xep_first; + + cw_assert(cw_g_xep_initialized); + + if (a_xep->is_linked) + { +#ifdef CW_THREADS + xep_first = (cw_xep_t *) tsd_get(&cw_g_xep_key); +#else + xep_first = cw_g_xep_first; +#endif + cw_check_ptr(qr_prev(xep_first, link)); + cw_check_ptr(qr_next(xep_first, link)); + + /* Remove handler from ring. */ + if (a_xep != xep_first) + { + qr_remove(a_xep, link); + } + else + { +#ifdef CW_THREADS + tsd_set(&cw_g_xep_key, NULL); +#else + cw_g_xep_first = NULL; +#endif + } + a_xep->is_linked = FALSE; + + if (a_xep->is_handled == FALSE) + { + if (a_xep != xep_first) + { + /* Propagate exception. */ + xep_throw_e(a_xep->value, a_xep->filename, + a_xep->line_num); + } + else + { + /* No more exception handlers. */ + fprintf(stderr, "%s(): Unhandled exception " + "%u thrown at %s:%u\n", __FUNCTION__, + a_xep->value, a_xep->filename, + a_xep->line_num); + abort(); + } + } + } +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/.cvsignore b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/.cvsignore new file mode 100644 index 000000000..58003acb7 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/.cvsignore @@ -0,0 +1,9 @@ +*.[do]_a +*.out +*.diff +*.perf +*_[a-z] +b_*_[a-z] +p*.pl +*.nx +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/Cookfile b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ch_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ch_a.c new file mode 100644 index 000000000..4570408fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ch_a.c @@ -0,0 +1,270 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * ch (chained hash) test. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +int +main() +{ + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* ch_new(), ch_delete(). */ + { + cw_ch_t *ch_a, ch_b; + + ch_a = ch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 2, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(ch_a); + ch_delete(ch_a); + + cw_assert(ch_new(&ch_b, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 1, + ch_direct_hash, ch_direct_key_comp) == &ch_b); + ch_delete(&ch_b); + } + + /* ch_count(), ch_insert(). */ + { + cw_ch_t *ch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + + ch = ch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(ch); + cw_assert(ch_count(ch) == 0); + + ch_insert(ch, a, a, NULL); + cw_assert(ch_count(ch) == 1); + + ch_insert(ch, b, b, NULL); + cw_assert(ch_count(ch) == 2); + + ch_insert(ch, c, c, NULL); + cw_assert(ch_count(ch) == 3); + + ch_insert(ch, d, d, NULL); + cw_assert(ch_count(ch) == 4); + + ch_insert(ch, d, d, NULL); + cw_assert(ch_count(ch) == 5); + + ch_delete(ch); + } + + /* ch_count, ch_remove(). */ + { + cw_ch_t *ch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + char *k, *v; + + ch = ch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(ch); + cw_assert(ch_count(ch) == 0); + + ch_insert(ch, a, a, NULL); + cw_assert(ch_count(ch) == 1); + + ch_insert(ch, b, b, NULL); + cw_assert(ch_count(ch) == 2); + + ch_insert(ch, c, c, NULL); + cw_assert(ch_count(ch) == 3); + + ch_insert(ch, d, d, NULL); + cw_assert(ch_count(ch) == 4); + + cw_assert(ch_remove(ch, a, (void **) &k, (void **) &v, NULL) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + cw_assert(ch_count(ch) == 3); + + cw_assert(ch_remove(ch, a, NULL, NULL, NULL)); + + cw_assert(ch_remove(ch, b, NULL, NULL, NULL) == FALSE); + cw_assert(ch_count(ch) == 2); + + cw_assert(ch_remove(ch, c, (void **) &k, (void **) &v, NULL) == FALSE); + cw_assert(k == d); + cw_assert(v == d); + cw_assert(ch_count(ch) == 1); + + cw_assert(ch_remove(ch, c, NULL, NULL, NULL) == FALSE); + cw_assert(ch_count(ch) == 0); + + cw_assert(ch_remove(ch, d, NULL, NULL, NULL)); + cw_assert(ch_count(ch) == 0); + + cw_assert(ch_remove(ch, a, NULL, NULL, NULL)); + + ch_delete(ch); + } + + /* ch_search(). */ + { + cw_ch_t*ch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + char *v; + + ch = ch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(ch); + + ch_insert(ch, a, a, NULL); + ch_insert(ch, b, b, NULL); + ch_insert(ch, c, c, NULL); + ch_insert(ch, d, d, NULL); + + cw_assert(ch_search(ch, "foo", (void **) &v)); + + cw_assert(ch_search(ch, a, (void **) &v) == FALSE); + cw_assert(v == a); + + cw_assert(ch_search(ch, b, (void **) &v) == FALSE); + cw_assert(v == b); + + cw_assert(ch_search(ch, c, (void **) &v) == FALSE); + cw_assert(v == d); + + cw_assert(ch_search(ch, d, (void **) &v) == FALSE); + cw_assert(v == d); + + while (ch_remove_iterate(ch, NULL, NULL, NULL) == FALSE) + { + } + + ch_delete(ch); + } + + /* ch_get_iterate(), ch_remove_iterate(). */ + { + cw_ch_t *ch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + char *k, *v; + + ch = ch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(ch); + + /* Iterate with 0 items. */ + /* Round 1. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == TRUE); + /* Round 2. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == TRUE); + + ch_insert(ch, a, a, NULL); + /* Iterate with 1 item. */ + /* Round 1. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + /* Round 2. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + ch_insert(ch, b, b, NULL); + ch_insert(ch, c, c, NULL); + ch_insert(ch, d, d, NULL); + + /* Iterate with 4 items. */ + /* Round 1. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == b); + cw_assert(v == b); + + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == c); + cw_assert(v == c); + + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == d); + cw_assert(v == d); + + /* Round 2. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == b); + cw_assert(v == b); + + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == c); + cw_assert(v == c); + + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == d); + cw_assert(v == d); + + /* Start round 3. */ + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + /* Remove. */ + cw_assert(ch_remove_iterate(ch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == b); + cw_assert(v == b); + + cw_assert(ch_remove_iterate(ch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == c); + cw_assert(v == c); + + cw_assert(ch_remove_iterate(ch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == d); + cw_assert(v == d); + + cw_assert(ch_remove_iterate(ch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + cw_assert(ch_remove_iterate(ch, (void **) &k, (void **) &v, NULL)); + cw_assert(ch_get_iterate(ch, (void **) &k, (void **) &v)); + + ch_delete(ch); + } + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ch_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ch_a.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ch_a.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/cnd_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/cnd_a.c new file mode 100644 index 000000000..75b0f6c14 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/cnd_a.c @@ -0,0 +1,124 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * cnd test. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define CW_TEST_NUM_THREADS 10 + +struct cw_foo_s +{ + cw_uint32_t *num_waiting; + cw_cnd_t *cond; + cw_mtx_t *mutex; +}; + +void * +thread_entry_func(void *a_arg) +{ + struct cw_foo_s *foo_var = (struct cw_foo_s *) a_arg; + + mtx_lock(foo_var->mutex); + (*foo_var->num_waiting)++; + + cnd_wait(foo_var->cond, foo_var->mutex); + + fprintf(stderr, "%s(): After cnd_wait() call\n", __FUNCTION__); + + mtx_unlock(foo_var->mutex); + + return NULL; +} + +int +main() +{ + cw_cnd_t cond; + cw_mtx_t mutex; + cw_thd_t *threads[CW_TEST_NUM_THREADS], *thread; + struct cw_foo_s foo_var; + struct timespec timeout; + cw_uint32_t i; + cw_uint32_t num_waiting; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + mtx_new(&mutex); + + cnd_new(&cond); + /* These should do nothing. */ + cnd_signal(&cond); + cnd_broadcast(&cond); + + /* Set timeout for 1 second. */ + timeout.tv_sec = 1; + timeout.tv_nsec = 0; + + mtx_lock(&mutex); + cw_assert(cnd_timedwait(&cond, &mutex, &timeout)); + mtx_unlock(&mutex); + + /* Create argument for thd_new(). */ + num_waiting = 0; + foo_var.num_waiting = &num_waiting; + foo_var.cond = &cond; + foo_var.mutex = &mutex; + + /* Test cnd_signal. */ + thread = thd_new(thread_entry_func, (void *) &foo_var, TRUE); + + /* Bad programming practice, but it works for this test. */ + mtx_lock(&mutex); + while (num_waiting < 1) + { + mtx_unlock(&mutex); + thd_yield(); + mtx_lock(&mutex); + } + + cnd_signal(&cond); + mtx_unlock(&mutex); + thd_join(thread); + + /* Test cnd_broadcast. */ + num_waiting = 0; + for (i = 0; i < CW_TEST_NUM_THREADS; i++) + { + threads[i] = thd_new(thread_entry_func, (void *) &foo_var, TRUE); + } + + /* Bad programming practice, but it works for this test. */ + mtx_lock(&mutex); + while (num_waiting < CW_TEST_NUM_THREADS) + { + mtx_unlock(&mutex); + thd_yield(); + mtx_lock(&mutex); + } + + cnd_broadcast(&cond); + mtx_unlock(&mutex); + + for (i = 0; i < CW_TEST_NUM_THREADS; i++) + { + thd_join(threads[i]); + } + + cnd_delete(&cond); + mtx_delete(&mutex); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/cnd_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/cnd_a.exp new file mode 100644 index 000000000..e86853984 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/cnd_a.exp @@ -0,0 +1,13 @@ +Test begin +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +thread_entry_func(): After cnd_wait() call +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/dch_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/dch_a.c new file mode 100644 index 000000000..bc8993d62 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/dch_a.c @@ -0,0 +1,234 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * dch (dynamic chained chained hash) test. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +int +main() +{ + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* dch_new(), dch_delete(). */ + { + cw_dch_t *dch_a, dch_b; + + dch_a = dch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 2, 2, 1, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(dch_a); + dch_delete(dch_a); + + cw_assert(dch_new(&dch_b, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, 3, 1, + ch_direct_hash, ch_direct_key_comp) == &dch_b); + dch_delete(&dch_b); + } + + /* dch_count(), dch_insert(). */ + { + cw_dch_t *dch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + + dch = dch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, 2, 1, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(dch); + cw_assert(dch_count(dch) == 0); + + dch_insert(dch, a, a, NULL); + cw_assert(dch_count(dch) == 1); + + dch_insert(dch, b, b, NULL); + cw_assert(dch_count(dch) == 2); + + dch_insert(dch, c, c, NULL); + cw_assert(dch_count(dch) == 3); + + dch_insert(dch, d, d, NULL); + cw_assert(dch_count(dch) == 4); + + dch_insert(dch, d, d, NULL); + cw_assert(dch_count(dch) == 5); + + dch_delete(dch); + } + + /* dch_count, dch_remove(). */ + { + cw_dch_t *dch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + char *k, *v; + + dch = dch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, 2, 1, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(dch); + cw_assert(dch_count(dch) == 0); + + dch_insert(dch, a, a, NULL); + cw_assert(dch_count(dch) == 1); + + dch_insert(dch, b, b, NULL); + cw_assert(dch_count(dch) == 2); + + dch_insert(dch, c, c, NULL); + cw_assert(dch_count(dch) == 3); + + dch_insert(dch, d, d, NULL); + cw_assert(dch_count(dch) == 4); + + cw_assert(dch_remove(dch, a, (void **) &k, (void **) &v, NULL) == + FALSE); + cw_assert(k == a); + cw_assert(v == a); + cw_assert(dch_count(dch) == 3); + + cw_assert(dch_remove(dch, a, NULL, NULL, NULL)); + + cw_assert(dch_remove(dch, b, NULL, NULL, NULL) == FALSE); + cw_assert(dch_count(dch) == 2); + + cw_assert(dch_remove(dch, c, (void **) &k, (void **) &v, NULL) == + FALSE); + cw_assert(k == d); + cw_assert(v == d); + cw_assert(dch_count(dch) == 1); + + cw_assert(dch_remove(dch, c, NULL, NULL, NULL) == FALSE); + cw_assert(dch_count(dch) == 0); + + cw_assert(dch_remove(dch, d, NULL, NULL, NULL)); + cw_assert(dch_count(dch) == 0); + + cw_assert(dch_remove(dch, a, NULL, NULL, NULL)); + + dch_delete(dch); + } + + /* dch_search(). */ + { + cw_dch_t *dch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + char *v; + + dch = dch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 4, 2, 1, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(dch); + + dch_insert(dch, a, a, NULL); + dch_insert(dch, b, b, NULL); + dch_insert(dch, c, c, NULL); + dch_insert(dch, d, d, NULL); + + cw_assert(dch_search(dch, "foo", (void **) &v)); + + cw_assert(dch_search(dch, a, (void **) &v) == FALSE); + cw_assert(v == a); + + cw_assert(dch_search(dch, b, (void **) &v) == FALSE); + cw_assert(v == b); + + cw_assert(dch_search(dch, c, (void **) &v) == FALSE); + cw_assert(v == d); + + cw_assert(dch_search(dch, d, (void **) &v) == FALSE); + cw_assert(v == d); + + while (dch_remove_iterate(dch, NULL, NULL, NULL) == FALSE) + { + } + + dch_delete(dch); + } + + /* dch_get_iterate(), dch_remove_iterate(). */ + { + cw_dch_t *dch; + char *a = "a string"; + char *b = "A string"; + char *c = "two of these"; + char *d = "two of these\0foo"; + char *k, *v; + + dch = dch_new(NULL, (cw_opaque_alloc_t *) mem_malloc_e, + (cw_opaque_dealloc_t *) mem_free_e, cw_g_mem, 3, 2, 1, + ch_string_hash, ch_string_key_comp); + cw_check_ptr(dch); + + dch_insert(dch, a, a, NULL); + dch_insert(dch, b, b, NULL); + dch_insert(dch, c, c, NULL); + dch_insert(dch, d, d, NULL); + + cw_assert(dch_get_iterate(dch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + cw_assert(dch_get_iterate(dch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == b); + cw_assert(v == b); + + cw_assert(dch_get_iterate(dch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == c); + cw_assert(v == c); + + cw_assert(dch_get_iterate(dch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == d); + cw_assert(v == d); + + cw_assert(dch_get_iterate(dch, (void **) &k, (void **) &v) == FALSE); + cw_assert(k == a); + cw_assert(v == a); + + cw_assert(dch_remove_iterate(dch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == b); + cw_assert(v == b); + + cw_assert(dch_remove_iterate(dch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == c); + cw_assert(v == c); + + cw_assert(dch_remove_iterate(dch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(k == d); + cw_assert(v == d); + + cw_assert(dch_remove_iterate(dch, (void **) &k, (void **) &v, NULL) + == FALSE); + cw_assert(a == k); + cw_assert(a == v); + + cw_assert(dch_remove_iterate(dch, (void **) &k, (void **) &v, NULL)); + cw_assert(dch_get_iterate(dch, (void **) &k, (void **) &v)); + + dch_delete(dch); + } + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/dch_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/dch_a.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/dch_a.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/hook_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/hook_a.c new file mode 100644 index 000000000..7debf7abd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/hook_a.c @@ -0,0 +1,109 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define NAME_anon_hook "anon_hook" +#define NAME_mark_hook "mark_hook" + +const cw_uint8_t *data = "hook data"; + +void +hook_eval(void *a_data, cw_nxo_t *a_thread) +{ + cw_assert(a_data == data); + + cw_onyx_code(a_thread, "`Evaluated hook\n' print"); +} + +cw_nxoe_t * +hook_ref_iter(void *a_data, cw_bool_t a_reset) +{ + cw_assert(a_data == data); + + return NULL; +} + +cw_bool_t +hook_delete(void *a_data, cw_nx_t *a_nx, cw_uint32_t a_iter) +{ + cw_assert(a_data == data); + + return FALSE; +} + +void +anon_hook(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *hook; + + ostack = nxo_thread_ostack_get(a_thread); + hook = nxo_stack_push(ostack); + nxo_hook_new(hook, nxo_thread_nx_get(a_thread), (void *) data, hook_eval, + hook_ref_iter, hook_delete); + nxo_attr_set(hook, NXOA_EXECUTABLE); +} + +void +mark_hook(cw_nxo_t *a_thread) +{ + cw_nxo_t *ostack, *hook, *tag; + + anon_hook(a_thread); + + ostack = nxo_thread_ostack_get(a_thread); + hook = nxo_stack_get(ostack); + tag = nxo_hook_tag_get(hook); + nxo_mark_new(tag); +} + +int +main(int argc, char **argv, char **envp) +{ + cw_nx_t nx; + cw_nxo_t thread, *ostack, *name, *operator; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + cw_assert(nx_new(&nx, NULL, argc, argv, envp) == &nx); + nxo_thread_new(&thread, &nx); + + /* Define anon_hook and mark_hook. */ + ostack = nxo_thread_ostack_get(&thread); + + name = nxo_stack_push(ostack); + operator = nxo_stack_push(ostack); + nxo_name_new(name, &nx, NAME_anon_hook, strlen(NAME_anon_hook), FALSE); + nxo_operator_new(operator, anon_hook, NXN_ZERO); + nxo_attr_set(operator, NXOA_EXECUTABLE); + cw_onyx_code(&thread, "def"); + + name = nxo_stack_push(ostack); + operator = nxo_stack_push(ostack); + nxo_name_new(name, &nx, NAME_mark_hook, strlen(NAME_mark_hook), FALSE); + nxo_operator_new(operator, mark_hook, NXN_ZERO); + nxo_attr_set(operator, NXOA_EXECUTABLE); + cw_onyx_code(&thread, "def"); + + cw_onyx_code(&thread, "\n\ +anon_hook 1 sprint\n\ +anon_hook eval\n\ +mark_hook 1 sprint\n\ +mark_hook eval\n\ +"); + nx_delete(&nx); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/hook_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/hook_a.exp new file mode 100644 index 000000000..38bf2bbea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/hook_a.exp @@ -0,0 +1,6 @@ +Test begin +-hook- +Evaluated hook +=-mark-= +Evaluated hook +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/libonyx_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/libonyx_a.c new file mode 100644 index 000000000..d58974949 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/libonyx_a.c @@ -0,0 +1,50 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +void +do_mem(void) +{ + void *p; + + p = cw_malloc(1024); + cw_check_ptr(p); + + p = cw_realloc(p, 2048); + cw_check_ptr(p); + + cw_free(p); + + p = cw_calloc(8, 128); + cw_check_ptr(p); + + cw_free(p); +} + +int +main() +{ + fprintf(stderr, "Test begin\n"); + do_mem(); + + fprintf(stderr, "libonyx_init()\n"); + libonyx_init(); + do_mem(); + + fprintf(stderr, "libonyx_shutdown()\n"); + libonyx_shutdown(); + do_mem(); + + fprintf(stderr, "Test end\n"); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/libonyx_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/libonyx_a.exp new file mode 100644 index 000000000..3525b44e8 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/libonyx_a.exp @@ -0,0 +1,4 @@ +Test begin +libonyx_init() +libonyx_shutdown() +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mq_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mq_a.c new file mode 100644 index 000000000..9ec4e4e6f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mq_a.c @@ -0,0 +1,639 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Test the mq (message queue) class. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +int +main() +{ + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* mq_new(), mq_delete(). */ + { + cw_mq_t mq; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint32_t)); + mq_delete(&mq); + + mq_new(&mq, cw_g_mem, sizeof(cw_uint64_t)); + mq_delete(&mq); + } + + /* mq_tryget(), mq_put(). */ + { + cw_mq_t mq; + cw_uint8_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint8_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint16_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint16_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint32_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint32_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint64_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint64_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + + /* mq_timedget(), mq_put(). */ + { + cw_mq_t mq; + cw_uint8_t i = 1, j = 2, k = 3, t; + struct timespec timeout = {0, 10000}; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint8_t)); + + cw_assert(mq_timedget(&mq, &timeout)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint16_t i = 1, j = 2, k = 3, t; + struct timespec timeout = {0, 10000}; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint16_t)); + + cw_assert(mq_timedget(&mq, &timeout)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint32_t i = 1, j = 2, k = 3, t; + struct timespec timeout = {0, 10000}; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint32_t)); + + cw_assert(mq_timedget(&mq, &timeout)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint64_t i = 1, j = 2, k = 3, t; + struct timespec timeout = {0, 10000}; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint64_t)); + + cw_assert(mq_timedget(&mq, &timeout)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_timedget(&mq, &timeout, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_timedget(&mq, &timeout, &t)); + + mq_delete(&mq); + } + + /* mq_get(), mq_put(), mq_tryget(). */ + { + cw_mq_t mq; + cw_uint8_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint8_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint16_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint16_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint32_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint32_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint64_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint64_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == k); + cw_assert(mq_get(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + + /* mq_get_start(), mq_get_stop(), mq_tryget(), mq_put(). */ + { + cw_mq_t mq; + cw_uint8_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint8_t)); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_get(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint16_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint16_t)); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_get(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint32_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint32_t)); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_get(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint64_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint64_t)); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + + cw_assert(mq_get_stop(&mq) == FALSE); + cw_assert(mq_get_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_get(&mq, &t)); + + cw_assert(mq_get_start(&mq) == FALSE); + cw_assert(mq_get_start(&mq)); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + cw_assert(mq_put(&mq, k) == 0); + + mq_delete(&mq); + } + + /* mq_put_start(), mq_put_stop(), mq_tryget(), mq_put(). */ + { + cw_mq_t mq; + cw_uint8_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint8_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(1 == mq_put(&mq, i)); + + cw_assert(mq_put_start(&mq) == FALSE); + cw_assert(mq_put_start(&mq)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_put(&mq, k) == 1); + + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint16_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint16_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(1 == mq_put(&mq, i)); + + cw_assert(mq_put_start(&mq) == FALSE); + cw_assert(mq_put_start(&mq)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_put(&mq, k) == 1); + + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint32_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint32_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(1 == mq_put(&mq, i)); + + cw_assert(mq_put_start(&mq) == FALSE); + cw_assert(mq_put_start(&mq)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_put(&mq, k) == 1); + + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + { + cw_mq_t mq; + cw_uint64_t i = 1, j = 2, k = 3, t; + + mq_new(&mq, cw_g_mem, sizeof(cw_uint64_t)); + + cw_assert(mq_tryget(&mq, &t)); + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_tryget(&mq, &t)); + + cw_assert(1 == mq_put(&mq, i)); + + cw_assert(mq_put_start(&mq) == FALSE); + cw_assert(mq_put_start(&mq)); + cw_assert(mq_put(&mq, i) == 0); + cw_assert(mq_put(&mq, j) == 0); + + cw_assert(mq_put_stop(&mq) == FALSE); + cw_assert(mq_put_stop(&mq)); + cw_assert(mq_put(&mq, k) == 1); + + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == i); + cw_assert(mq_tryget(&mq, &t) == FALSE); + cw_assert(t == j); + cw_assert(mq_tryget(&mq, &t)); + + mq_delete(&mq); + } + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mq_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mq_a.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mq_a.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mtx_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mtx_a.c new file mode 100644 index 000000000..a066bccea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mtx_a.c @@ -0,0 +1,96 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * mtx test. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define CW_TEST_COUNT 50 + +cw_uint32_t g_count = 0; + +void * +thread_entry_func(void *a_arg) +{ + cw_uint32_t i, temp; + cw_mtx_t *mutex = (cw_mtx_t *) a_arg; + + for (i = 0; i < CW_TEST_COUNT; i++) + { + mtx_lock(mutex); + temp = g_count; + usleep(1); + temp++; + g_count = temp; + mtx_unlock(mutex); + } + + return NULL; +} + +int +main() +{ + cw_thd_t *thread_a, *thread_b; + cw_mtx_t mutex_a, mutex_b; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + mtx_new(&mutex_a); + /* Unlocked. */ + mtx_lock(&mutex_a); + /* Locked. */ + mtx_unlock(&mutex_a); + /* Unlocked. */ + cw_assert(mtx_trylock(&mutex_a) == FALSE); + /* Locked. */ +#ifndef CW_PTH + /* pth only has recursive mutexes, so don't check for failure of recursive + * locks when using pth. */ + cw_assert(mtx_trylock(&mutex_a)); +#endif + mtx_unlock(&mutex_a); + /* Unlocked. */ + cw_assert(mtx_trylock(&mutex_a) == FALSE); + /* Locked. */ + mtx_unlock(&mutex_a); + /* Unlocked. */ + mtx_delete(&mutex_a); + + mtx_new(&mutex_b); + mtx_lock(&mutex_b); +#ifndef CW_PTH + /* pth only has recursive mutexes, so don't check for failure of recursive + * locks when using pth. */ + cw_assert(mtx_trylock(&mutex_b)); +#endif + mtx_unlock(&mutex_b); + mtx_delete(&mutex_b); + + /* See if the mutex actually locks other threads out of critical + * sections. */ + mtx_new(&mutex_a); + + thread_a = thd_new(thread_entry_func, (void *) &mutex_a, TRUE); + thread_b = thd_new(thread_entry_func, (void *) &mutex_a, TRUE); + + thd_join(thread_a); + thd_join(thread_b); + mtx_delete(&mutex_a); + + fprintf(stderr, "g_count: %u\n", g_count); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mtx_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mtx_a.exp new file mode 100644 index 000000000..76706385d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/mtx_a.exp @@ -0,0 +1,3 @@ +Test begin +g_count: 100 +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ql_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ql_a.c new file mode 100644 index 000000000..8b2c10211 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ql_a.c @@ -0,0 +1,478 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +/* Number of queue entries (<= 26, preferrably). */ +#define NENTRIES 8 + +typedef struct list_s list_t; + +struct list_s +{ + ql_elm(list_t) link; + cw_uint8_t id; +}; + +int +main() +{ + cw_uint32_t i; + list_t entries[NENTRIES], *t; + ql_head(list_t) head; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* Initialize entries. */ + fprintf(stderr, "ql_new()\n"); + ql_new(&head); + for (i = 0; i < NENTRIES; i++) + { + entries[i].id = 'a' + i; + ql_elm_new(&entries[i], link); + } + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, + link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " ql_reverse_foreach():"); + ql_reverse_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_foreach(t, &head, link) + { + if (ql_next(&head, t, link) != NULL) + { + fprintf(stderr, " ql_next(%c): %c\n", t->id, + ql_next(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_next(%c): NULL\n", t->id); + } + } + ql_reverse_foreach(t, &head, link) + { + if (ql_prev(&head, t, link) != NULL) + { + fprintf(stderr, " ql_prev(%c): %c\n", t->id, + ql_prev(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_prev(%c): NULL\n", t->id); + } + } + + /* Link the entries together. */ + fprintf(stderr, "ql_tail_insert()\n"); + for (i = 0; i < NENTRIES; i++) + { + ql_tail_insert(&head, &entries[i], link); + } + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " ql_reverse_foreach():"); + ql_reverse_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_foreach(t, &head, link) + { + if (ql_next(&head, t, link) != NULL) + { + fprintf(stderr, " ql_next(%c): %c\n", t->id, + ql_next(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_next(%c): NULL\n", t->id); + } + } + ql_reverse_foreach(t, &head, link) + { + if (ql_prev(&head, t, link) != NULL) + { + fprintf(stderr, " ql_prev(%c): %c\n", t->id, + ql_prev(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_prev(%c): NULL\n", t->id); + } + } + + fprintf(stderr, "ql_tail_remove()\n"); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " --> Iteration %u\n", i); + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_tail_remove(&head, list_t, link); + } + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " ql_reverse_foreach():"); + ql_reverse_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_foreach(t, &head, link) + { + if (ql_next(&head, t, link) != NULL) + { + fprintf(stderr, " ql_next(%c): %c\n", t->id, + ql_next(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_next(%c): NULL\n", t->id); + } + } + ql_reverse_foreach(t, &head, link) + { + if (ql_prev(&head, t, link) != NULL) + { + fprintf(stderr, " ql_prev(%c): %c\n", t->id, + ql_prev(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_prev(%c): NULL\n", t->id); + } + } + + /* Link the entries together. */ + fprintf(stderr, "ql_head_insert()\n"); + for (i = 0; i < NENTRIES; i++) + { + ql_head_insert(&head, &entries[i], link); + } + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " ql_reverse_foreach():"); + ql_reverse_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_foreach(t, &head, link) + { + if (ql_next(&head, t, link) != NULL) + { + fprintf(stderr, " ql_next(%c): %c\n", t->id, + ql_next(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_next(%c): NULL\n", t->id); + } + } + ql_reverse_foreach(t, &head, link) + { + if (ql_prev(&head, t, link) != NULL) + { + fprintf(stderr, " ql_prev(%c): %c\n", t->id, + ql_prev(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_prev(%c): NULL\n", t->id); + } + } + + fprintf(stderr, "ql_head_remove()\n"); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " --> Iteration %u\n", i); + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_head_remove(&head, list_t, link); + } + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " ql_reverse_foreach():"); + ql_reverse_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_foreach(t, &head, link) + { + if (ql_next(&head, t, link) != NULL) + { + fprintf(stderr, " ql_next(%c): %c\n", t->id, + ql_next(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_next(%c): NULL\n", t->id); + } + } + ql_reverse_foreach(t, &head, link) + { + if (ql_prev(&head, t, link) != NULL) + { + fprintf(stderr, " ql_prev(%c): %c\n", t->id, + ql_prev(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_prev(%c): NULL\n", t->id); + } + } + + /* ql_remove(), ql_before_insert(), and ql_after_insert() are used + * internally by other macros that are already tested, so there's no need to + * test them completely. However, insertion/deletion from the middle of + * lists is not tested, so do that here. */ + fprintf(stderr, "ql_tail_insert(), ql_before_insert()," + " ql_after_insert()\n"); + ql_tail_insert(&head, &entries[0], link); + ql_before_insert(&head, &entries[0], &entries[1], link); + ql_before_insert(&head, &entries[0], &entries[2], link); + ql_after_insert(&entries[0], &entries[3], link); + ql_after_insert(&entries[0], &entries[4], link); + ql_before_insert(&head, &entries[1], &entries[5], link); + ql_after_insert(&entries[2], &entries[6], link); + ql_before_insert(&head, &entries[3], &entries[7], link); + + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " ql_reverse_foreach():"); + ql_reverse_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + ql_foreach(t, &head, link) + { + if (ql_next(&head, t, link) != NULL) + { + fprintf(stderr, " ql_next(%c): %c\n", t->id, + ql_next(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_next(%c): NULL\n", t->id); + } + } + ql_reverse_foreach(t, &head, link) + { + if (ql_prev(&head, t, link) != NULL) + { + fprintf(stderr, " ql_prev(%c): %c\n", t->id, + ql_prev(&head, t, link)->id); + } + else + { + fprintf(stderr, " ql_prev(%c): NULL\n", t->id); + } + } + + fprintf(stderr, "ql_remove()\n"); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " --> Iteration %u\n", i); + ql_remove(&head, &entries[i], link); + if (ql_first(&head) != NULL) + { + fprintf(stderr, " ql_first(): %c\n", ql_first(&head)->id); + } + else + { + fprintf(stderr, " ql_first(): NULL\n"); + } + if (ql_last(&head, link) != NULL) + { + fprintf(stderr, " ql_last(): %c\n", ql_last(&head, link)->id); + } + else + { + fprintf(stderr, " ql_last(): NULL\n"); + } + fprintf(stderr, " ql_foreach():"); + ql_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ql_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ql_a.exp new file mode 100644 index 000000000..5bf8afc6e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/ql_a.exp @@ -0,0 +1,177 @@ +Test begin +ql_new() + ql_first(): NULL + ql_last(): NULL + ql_foreach(): + ql_reverse_foreach(): +ql_tail_insert() + ql_first(): a + ql_last(): h + ql_foreach(): a b c d e f g h + ql_reverse_foreach(): h g f e d c b a + ql_next(a): b + ql_next(b): c + ql_next(c): d + ql_next(d): e + ql_next(e): f + ql_next(f): g + ql_next(g): h + ql_next(h): NULL + ql_prev(h): g + ql_prev(g): f + ql_prev(f): e + ql_prev(e): d + ql_prev(d): c + ql_prev(c): b + ql_prev(b): a + ql_prev(a): NULL +ql_tail_remove() + --> Iteration 0 + ql_first(): a + ql_last(): h + ql_foreach(): a b c d e f g h + --> Iteration 1 + ql_first(): a + ql_last(): g + ql_foreach(): a b c d e f g + --> Iteration 2 + ql_first(): a + ql_last(): f + ql_foreach(): a b c d e f + --> Iteration 3 + ql_first(): a + ql_last(): e + ql_foreach(): a b c d e + --> Iteration 4 + ql_first(): a + ql_last(): d + ql_foreach(): a b c d + --> Iteration 5 + ql_first(): a + ql_last(): c + ql_foreach(): a b c + --> Iteration 6 + ql_first(): a + ql_last(): b + ql_foreach(): a b + --> Iteration 7 + ql_first(): a + ql_last(): a + ql_foreach(): a + ql_first(): NULL + ql_last(): NULL + ql_foreach(): + ql_reverse_foreach(): +ql_head_insert() + ql_first(): h + ql_last(): a + ql_foreach(): h g f e d c b a + ql_reverse_foreach(): a b c d e f g h + ql_next(h): g + ql_next(g): f + ql_next(f): e + ql_next(e): d + ql_next(d): c + ql_next(c): b + ql_next(b): a + ql_next(a): NULL + ql_prev(a): b + ql_prev(b): c + ql_prev(c): d + ql_prev(d): e + ql_prev(e): f + ql_prev(f): g + ql_prev(g): h + ql_prev(h): NULL +ql_head_remove() + --> Iteration 0 + ql_first(): h + ql_last(): a + ql_foreach(): h g f e d c b a + --> Iteration 1 + ql_first(): g + ql_last(): a + ql_foreach(): g f e d c b a + --> Iteration 2 + ql_first(): f + ql_last(): a + ql_foreach(): f e d c b a + --> Iteration 3 + ql_first(): e + ql_last(): a + ql_foreach(): e d c b a + --> Iteration 4 + ql_first(): d + ql_last(): a + ql_foreach(): d c b a + --> Iteration 5 + ql_first(): c + ql_last(): a + ql_foreach(): c b a + --> Iteration 6 + ql_first(): b + ql_last(): a + ql_foreach(): b a + --> Iteration 7 + ql_first(): a + ql_last(): a + ql_foreach(): a + ql_first(): NULL + ql_last(): NULL + ql_foreach(): + ql_reverse_foreach(): +ql_tail_insert(), ql_before_insert(), ql_after_insert() + ql_first(): f + ql_last(): d + ql_foreach(): f b c g a e h d + ql_reverse_foreach(): d h e a g c b f + ql_next(f): b + ql_next(b): c + ql_next(c): g + ql_next(g): a + ql_next(a): e + ql_next(e): h + ql_next(h): d + ql_next(d): NULL + ql_prev(d): h + ql_prev(h): e + ql_prev(e): a + ql_prev(a): g + ql_prev(g): c + ql_prev(c): b + ql_prev(b): f + ql_prev(f): NULL +ql_remove() + --> Iteration 0 + ql_first(): f + ql_last(): d + ql_foreach(): f b c g e h d + --> Iteration 1 + ql_first(): f + ql_last(): d + ql_foreach(): f c g e h d + --> Iteration 2 + ql_first(): f + ql_last(): d + ql_foreach(): f g e h d + --> Iteration 3 + ql_first(): f + ql_last(): h + ql_foreach(): f g e h + --> Iteration 4 + ql_first(): f + ql_last(): h + ql_foreach(): f g h + --> Iteration 5 + ql_first(): g + ql_last(): h + ql_foreach(): g h + --> Iteration 6 + ql_first(): h + ql_last(): h + ql_foreach(): h + --> Iteration 7 + ql_first(): NULL + ql_last(): NULL + ql_foreach(): +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qr_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qr_a.c new file mode 100644 index 000000000..2056d4053 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qr_a.c @@ -0,0 +1,330 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +/* Number of ring entries (<= 26, preferrably). */ +#define NENTRIES 8 + +typedef struct ring_s ring_t; + +struct ring_s +{ + qr(ring_t) link; + cw_uint8_t id; +}; + +int +main() +{ + cw_uint32_t i; + ring_t entries[NENTRIES], *t; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* Initialize entries. */ + fprintf(stderr, "qr_new()\n"); + for (i = 0; i < NENTRIES; i++) + { + qr_new(&entries[i], link); + entries[i].id = 'a' + i; + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach_reverse(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_next(&entries[i], link); + fprintf(stderr, " qr_next(%c): %c\n", entries[i].id, t->id); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_prev(&entries[i], link); + fprintf(stderr, " qr_prev(%c): %c\n", entries[i].id, t->id); + } + + /* Link the entries together. */ + fprintf(stderr, "qr_after_insert()\n"); + for (i = 1; i < NENTRIES; i++) + { + qr_after_insert(&entries[i - 1], &entries[i], link); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_reverse_foreach(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_next(&entries[i], link); + fprintf(stderr, " qr_next(%c): %c\n", entries[i].id, t->id); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_prev(&entries[i], link); + fprintf(stderr, " qr_prev(%c): %c\n", entries[i].id, t->id); + } + + fprintf(stderr, "qr_remove()\n"); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c): ", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " qr_reverse_foreach(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + qr_remove(&entries[i], link); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_reverse_foreach(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_next(&entries[i], link); + fprintf(stderr, " qr_next(%c): %c\n", entries[i].id, t->id); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_prev(&entries[i], link); + fprintf(stderr, " qr_prev(%c): %c\n", entries[i].id, t->id); + } + + /* Link the entries together. */ + fprintf(stderr, "qr_before_insert()\n"); + for (i = 1; i < NENTRIES; i++) + { + qr_before_insert(&entries[i - 1], &entries[i], link); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_reverse_foreach(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_next(&entries[i], link); + fprintf(stderr, " qr_next(%c): %c\n", entries[i].id, t->id); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_prev(&entries[i], link); + fprintf(stderr, " qr_prev(%c): %c\n", entries[i].id, t->id); + } + + fprintf(stderr, "qr_remove()\n"); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c): ", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + fprintf(stderr, " qr_reverse_foreach(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + qr_remove(&entries[i], link); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_reverse_foreach(%c):", entries[i].id); + qr_reverse_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_next(&entries[i], link); + fprintf(stderr, " qr_next(%c): %c\n", entries[i].id, t->id); + } + for (i = 0; i < NENTRIES; i++) + { + t = qr_prev(&entries[i], link); + fprintf(stderr, " qr_prev(%c): %c\n", entries[i].id, t->id); + } + + /* meld, split */ + fprintf(stderr, "qr_split(a, e)\n"); + for (i = 1; i < NENTRIES; i++) + { + qr_after_insert(&entries[i - 1], &entries[i], link); + } + qr_split(&entries[0], &entries[4], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_meld(a, e)\n"); + qr_meld(&entries[0], &entries[4], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_meld(a, e)\n"); + qr_meld(&entries[0], &entries[4], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_split(a, e)\n"); + qr_split(&entries[0], &entries[4], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_split(a, a)\n"); + qr_split(&entries[0], &entries[0], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_meld(a, a)\n"); + qr_meld(&entries[0], &entries[0], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_split(a, b)\n"); + qr_split(&entries[0], &entries[1], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "qr_meld(a, b)\n"); + qr_meld(&entries[0], &entries[1], ring_t, link); + for (i = 0; i < NENTRIES; i++) + { + fprintf(stderr, " qr_foreach(%c):", entries[i].id); + qr_foreach(t, &entries[i], link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + } + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qr_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qr_a.exp new file mode 100644 index 000000000..20c12ff9e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qr_a.exp @@ -0,0 +1,271 @@ +Test begin +qr_new() + qr_foreach(a): a + qr_foreach(b): b + qr_foreach(c): c + qr_foreach(d): d + qr_foreach(e): e + qr_foreach(f): f + qr_foreach(g): g + qr_foreach(h): h + qr_foreach_reverse(a): a + qr_foreach_reverse(b): b + qr_foreach_reverse(c): c + qr_foreach_reverse(d): d + qr_foreach_reverse(e): e + qr_foreach_reverse(f): f + qr_foreach_reverse(g): g + qr_foreach_reverse(h): h + qr_next(a): a + qr_next(b): b + qr_next(c): c + qr_next(d): d + qr_next(e): e + qr_next(f): f + qr_next(g): g + qr_next(h): h + qr_prev(a): a + qr_prev(b): b + qr_prev(c): c + qr_prev(d): d + qr_prev(e): e + qr_prev(f): f + qr_prev(g): g + qr_prev(h): h +qr_after_insert() + qr_foreach(a): a b c d e f g h + qr_foreach(b): b c d e f g h a + qr_foreach(c): c d e f g h a b + qr_foreach(d): d e f g h a b c + qr_foreach(e): e f g h a b c d + qr_foreach(f): f g h a b c d e + qr_foreach(g): g h a b c d e f + qr_foreach(h): h a b c d e f g + qr_reverse_foreach(a): h g f e d c b a + qr_reverse_foreach(b): a h g f e d c b + qr_reverse_foreach(c): b a h g f e d c + qr_reverse_foreach(d): c b a h g f e d + qr_reverse_foreach(e): d c b a h g f e + qr_reverse_foreach(f): e d c b a h g f + qr_reverse_foreach(g): f e d c b a h g + qr_reverse_foreach(h): g f e d c b a h + qr_next(a): b + qr_next(b): c + qr_next(c): d + qr_next(d): e + qr_next(e): f + qr_next(f): g + qr_next(g): h + qr_next(h): a + qr_prev(a): h + qr_prev(b): a + qr_prev(c): b + qr_prev(d): c + qr_prev(e): d + qr_prev(f): e + qr_prev(g): f + qr_prev(h): g +qr_remove() + qr_foreach(a): a b c d e f g h + qr_reverse_foreach(a): h g f e d c b a + qr_foreach(b): b c d e f g h + qr_reverse_foreach(b): h g f e d c b + qr_foreach(c): c d e f g h + qr_reverse_foreach(c): h g f e d c + qr_foreach(d): d e f g h + qr_reverse_foreach(d): h g f e d + qr_foreach(e): e f g h + qr_reverse_foreach(e): h g f e + qr_foreach(f): f g h + qr_reverse_foreach(f): h g f + qr_foreach(g): g h + qr_reverse_foreach(g): h g + qr_foreach(h): h + qr_reverse_foreach(h): h + qr_foreach(a): a + qr_foreach(b): b + qr_foreach(c): c + qr_foreach(d): d + qr_foreach(e): e + qr_foreach(f): f + qr_foreach(g): g + qr_foreach(h): h + qr_reverse_foreach(a): a + qr_reverse_foreach(b): b + qr_reverse_foreach(c): c + qr_reverse_foreach(d): d + qr_reverse_foreach(e): e + qr_reverse_foreach(f): f + qr_reverse_foreach(g): g + qr_reverse_foreach(h): h + qr_next(a): a + qr_next(b): b + qr_next(c): c + qr_next(d): d + qr_next(e): e + qr_next(f): f + qr_next(g): g + qr_next(h): h + qr_prev(a): a + qr_prev(b): b + qr_prev(c): c + qr_prev(d): d + qr_prev(e): e + qr_prev(f): f + qr_prev(g): g + qr_prev(h): h +qr_before_insert() + qr_foreach(a): a h g f e d c b + qr_foreach(b): b a h g f e d c + qr_foreach(c): c b a h g f e d + qr_foreach(d): d c b a h g f e + qr_foreach(e): e d c b a h g f + qr_foreach(f): f e d c b a h g + qr_foreach(g): g f e d c b a h + qr_foreach(h): h g f e d c b a + qr_reverse_foreach(a): b c d e f g h a + qr_reverse_foreach(b): c d e f g h a b + qr_reverse_foreach(c): d e f g h a b c + qr_reverse_foreach(d): e f g h a b c d + qr_reverse_foreach(e): f g h a b c d e + qr_reverse_foreach(f): g h a b c d e f + qr_reverse_foreach(g): h a b c d e f g + qr_reverse_foreach(h): a b c d e f g h + qr_next(a): h + qr_next(b): a + qr_next(c): b + qr_next(d): c + qr_next(e): d + qr_next(f): e + qr_next(g): f + qr_next(h): g + qr_prev(a): b + qr_prev(b): c + qr_prev(c): d + qr_prev(d): e + qr_prev(e): f + qr_prev(f): g + qr_prev(g): h + qr_prev(h): a +qr_remove() + qr_foreach(a): a h g f e d c b + qr_reverse_foreach(a): b c d e f g h a + qr_foreach(b): b h g f e d c + qr_reverse_foreach(b): c d e f g h b + qr_foreach(c): c h g f e d + qr_reverse_foreach(c): d e f g h c + qr_foreach(d): d h g f e + qr_reverse_foreach(d): e f g h d + qr_foreach(e): e h g f + qr_reverse_foreach(e): f g h e + qr_foreach(f): f h g + qr_reverse_foreach(f): g h f + qr_foreach(g): g h + qr_reverse_foreach(g): h g + qr_foreach(h): h + qr_reverse_foreach(h): h + qr_foreach(a): a + qr_foreach(b): b + qr_foreach(c): c + qr_foreach(d): d + qr_foreach(e): e + qr_foreach(f): f + qr_foreach(g): g + qr_foreach(h): h + qr_reverse_foreach(a): a + qr_reverse_foreach(b): b + qr_reverse_foreach(c): c + qr_reverse_foreach(d): d + qr_reverse_foreach(e): e + qr_reverse_foreach(f): f + qr_reverse_foreach(g): g + qr_reverse_foreach(h): h + qr_next(a): a + qr_next(b): b + qr_next(c): c + qr_next(d): d + qr_next(e): e + qr_next(f): f + qr_next(g): g + qr_next(h): h + qr_prev(a): a + qr_prev(b): b + qr_prev(c): c + qr_prev(d): d + qr_prev(e): e + qr_prev(f): f + qr_prev(g): g + qr_prev(h): h +qr_split(a, e) + qr_foreach(a): a b c d + qr_foreach(b): b c d a + qr_foreach(c): c d a b + qr_foreach(d): d a b c + qr_foreach(e): e f g h + qr_foreach(f): f g h e + qr_foreach(g): g h e f + qr_foreach(h): h e f g +qr_meld(a, e) + qr_foreach(a): a b c d e f g h + qr_foreach(b): b c d e f g h a + qr_foreach(c): c d e f g h a b + qr_foreach(d): d e f g h a b c + qr_foreach(e): e f g h a b c d + qr_foreach(f): f g h a b c d e + qr_foreach(g): g h a b c d e f + qr_foreach(h): h a b c d e f g +qr_meld(a, e) + qr_foreach(a): a b c d + qr_foreach(b): b c d a + qr_foreach(c): c d a b + qr_foreach(d): d a b c + qr_foreach(e): e f g h + qr_foreach(f): f g h e + qr_foreach(g): g h e f + qr_foreach(h): h e f g +qr_split(a, e) + qr_foreach(a): a b c d e f g h + qr_foreach(b): b c d e f g h a + qr_foreach(c): c d e f g h a b + qr_foreach(d): d e f g h a b c + qr_foreach(e): e f g h a b c d + qr_foreach(f): f g h a b c d e + qr_foreach(g): g h a b c d e f + qr_foreach(h): h a b c d e f g +qr_split(a, a) + qr_foreach(a): a b c d e f g h + qr_foreach(b): b c d e f g h a + qr_foreach(c): c d e f g h a b + qr_foreach(d): d e f g h a b c + qr_foreach(e): e f g h a b c d + qr_foreach(f): f g h a b c d e + qr_foreach(g): g h a b c d e f + qr_foreach(h): h a b c d e f g +qr_meld(a, a) + qr_foreach(a): a b c d e f g h + qr_foreach(b): b c d e f g h a + qr_foreach(c): c d e f g h a b + qr_foreach(d): d e f g h a b c + qr_foreach(e): e f g h a b c d + qr_foreach(f): f g h a b c d e + qr_foreach(g): g h a b c d e f + qr_foreach(h): h a b c d e f g +qr_split(a, b) + qr_foreach(a): a + qr_foreach(b): b c d e f g h + qr_foreach(c): c d e f g h b + qr_foreach(d): d e f g h b c + qr_foreach(e): e f g h b c d + qr_foreach(f): f g h b c d e + qr_foreach(g): g h b c d e f + qr_foreach(h): h b c d e f g +qr_meld(a, b) + qr_foreach(a): a b c d e f g h + qr_foreach(b): b c d e f g h a + qr_foreach(c): c d e f g h a b + qr_foreach(d): d e f g h a b c + qr_foreach(e): e f g h a b c d + qr_foreach(f): f g h a b c d e + qr_foreach(g): g h a b c d e f + qr_foreach(h): h a b c d e f g +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qs_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qs_a.c new file mode 100644 index 000000000..a06a28b8e --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qs_a.c @@ -0,0 +1,191 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +/* Number of ring entries (<= 26, preferrably). */ +#define NENTRIES 8 + +typedef struct qstack_s qstack_t; + +struct qstack_s { + qs_elm(qstack_t) link; + cw_uint8_t id; +}; + +int +main() +{ + cw_uint32_t i; + qstack_t entries[NENTRIES], *t; + qs_head(qstack_t) head; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* Initialize entries. */ + fprintf(stderr, "qs_new(), qs_elm_new()\n"); + qs_new(&head); + for (i = 0; i < NENTRIES; i++) + { + qs_elm_new(&entries[i], link); + entries[i].id = 'a' + i; + } + fprintf(stderr, " qs_foreach():"); + qs_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + if (qs_top(&head) != NULL) + { + fprintf(stderr, " qs_top(): %c\n", qs_top(&head)->id); + if (qs_down(qs_top(&head), link) != NULL) + { + fprintf(stderr, " qs_down(qs_top()): %c\n", + qs_down(qs_top(&head), link)->id); + } + else + { + fprintf(stderr, " qs_down(qs_top()): NULL\n"); + } + } + else + { + fprintf(stderr, " qs_top(): NULL\n"); + } + + fprintf(stderr, "qs_push()\n"); + for (i = 0; i < NENTRIES; i++) + { + qs_push(&head, &entries[i], link); + fprintf(stderr, " -->Iteration %u\n", i); + fprintf(stderr, " qs_foreach():"); + qs_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + if (qs_top(&head) != NULL) + { + fprintf(stderr, " qs_top(): %c\n", qs_top(&head)->id); + if (qs_down(qs_top(&head), link) != NULL) + { + fprintf(stderr, " qs_down(qs_top()): %c\n", + qs_down(qs_top(&head), link)->id); + } + else + { + fprintf(stderr, " qs_down(qs_top()): NULL\n"); + } + } + else + { + fprintf(stderr, " qs_top(): NULL\n"); + } + } + + fprintf(stderr, "qs_pop()\n"); + for (i = 0; i < NENTRIES; i++) + { + qs_pop(&head, link); + fprintf(stderr, " -->Iteration %u\n", i); + fprintf(stderr, " qs_foreach():"); + qs_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + if (qs_top(&head) != NULL) + { + fprintf(stderr, " qs_top(): %c\n", qs_top(&head)->id); + if (qs_down(qs_top(&head), link) != NULL) + { + fprintf(stderr, " qs_down(qs_top()): %c\n", + qs_down(qs_top(&head), link)->id); + } + else + { + fprintf(stderr, " qs_down(qs_top()): NULL\n"); + } + } + else + { + fprintf(stderr, " qs_top(): NULL\n"); + } + } + + fprintf(stderr, "qs_under_push()\n"); + qs_push(&head, &entries[0], link); + for (i = 1; i < NENTRIES; i++) + { + qs_under_push(&entries[0], &entries[i], link); + fprintf(stderr, " -->Iteration %u\n", i); + fprintf(stderr, " qs_foreach():"); + qs_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + if (qs_top(&head) != NULL) + { + fprintf(stderr, " qs_top(): %c\n", qs_top(&head)->id); + if (qs_down(qs_top(&head), link) != NULL) + { + fprintf(stderr, " qs_down(qs_top()): %c\n", + qs_down(qs_top(&head), link)->id); + } + else + { + fprintf(stderr, " qs_down(qs_top()): NULL\n"); + } + } + else + { + fprintf(stderr, " qs_top(): NULL\n"); + } + } + + fprintf(stderr, "qs_pop()\n"); + for (i = 0; i < NENTRIES; i++) + { + qs_pop(&head, link); + fprintf(stderr, " -->Iteration %u\n", i); + fprintf(stderr, " qs_foreach():"); + qs_foreach(t, &head, link) + { + fprintf(stderr, " %c", t->id); + } + fprintf(stderr, "\n"); + if (qs_top(&head) != NULL) + { + fprintf(stderr, " qs_top(): %c\n", qs_top(&head)->id); + if (qs_down(qs_top(&head), link) != NULL) + { + fprintf(stderr, " qs_down(qs_top()): %c\n", + qs_down(qs_top(&head), link)->id); + } + else + { + fprintf(stderr, " qs_down(qs_top()): NULL\n"); + } + } + else + { + fprintf(stderr, " qs_top(): NULL\n"); + } + } + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qs_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qs_a.exp new file mode 100644 index 000000000..b1c054e97 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/qs_a.exp @@ -0,0 +1,131 @@ +Test begin +qs_new(), qs_elm_new() + qs_foreach(): + qs_top(): NULL +qs_push() + -->Iteration 0 + qs_foreach(): a + qs_top(): a + qs_down(qs_top()): NULL + -->Iteration 1 + qs_foreach(): b a + qs_top(): b + qs_down(qs_top()): a + -->Iteration 2 + qs_foreach(): c b a + qs_top(): c + qs_down(qs_top()): b + -->Iteration 3 + qs_foreach(): d c b a + qs_top(): d + qs_down(qs_top()): c + -->Iteration 4 + qs_foreach(): e d c b a + qs_top(): e + qs_down(qs_top()): d + -->Iteration 5 + qs_foreach(): f e d c b a + qs_top(): f + qs_down(qs_top()): e + -->Iteration 6 + qs_foreach(): g f e d c b a + qs_top(): g + qs_down(qs_top()): f + -->Iteration 7 + qs_foreach(): h g f e d c b a + qs_top(): h + qs_down(qs_top()): g +qs_pop() + -->Iteration 0 + qs_foreach(): g f e d c b a + qs_top(): g + qs_down(qs_top()): f + -->Iteration 1 + qs_foreach(): f e d c b a + qs_top(): f + qs_down(qs_top()): e + -->Iteration 2 + qs_foreach(): e d c b a + qs_top(): e + qs_down(qs_top()): d + -->Iteration 3 + qs_foreach(): d c b a + qs_top(): d + qs_down(qs_top()): c + -->Iteration 4 + qs_foreach(): c b a + qs_top(): c + qs_down(qs_top()): b + -->Iteration 5 + qs_foreach(): b a + qs_top(): b + qs_down(qs_top()): a + -->Iteration 6 + qs_foreach(): a + qs_top(): a + qs_down(qs_top()): NULL + -->Iteration 7 + qs_foreach(): + qs_top(): NULL +qs_under_push() + -->Iteration 1 + qs_foreach(): a b + qs_top(): a + qs_down(qs_top()): b + -->Iteration 2 + qs_foreach(): a c b + qs_top(): a + qs_down(qs_top()): c + -->Iteration 3 + qs_foreach(): a d c b + qs_top(): a + qs_down(qs_top()): d + -->Iteration 4 + qs_foreach(): a e d c b + qs_top(): a + qs_down(qs_top()): e + -->Iteration 5 + qs_foreach(): a f e d c b + qs_top(): a + qs_down(qs_top()): f + -->Iteration 6 + qs_foreach(): a g f e d c b + qs_top(): a + qs_down(qs_top()): g + -->Iteration 7 + qs_foreach(): a h g f e d c b + qs_top(): a + qs_down(qs_top()): h +qs_pop() + -->Iteration 0 + qs_foreach(): h g f e d c b + qs_top(): h + qs_down(qs_top()): g + -->Iteration 1 + qs_foreach(): g f e d c b + qs_top(): g + qs_down(qs_top()): f + -->Iteration 2 + qs_foreach(): f e d c b + qs_top(): f + qs_down(qs_top()): e + -->Iteration 3 + qs_foreach(): e d c b + qs_top(): e + qs_down(qs_top()): d + -->Iteration 4 + qs_foreach(): d c b + qs_top(): d + qs_down(qs_top()): c + -->Iteration 5 + qs_foreach(): c b + qs_top(): c + qs_down(qs_top()): b + -->Iteration 6 + qs_foreach(): b + qs_top(): b + qs_down(qs_top()): NULL + -->Iteration 7 + qs_foreach(): + qs_top(): NULL +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_a.c new file mode 100644 index 000000000..c6388c862 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_a.c @@ -0,0 +1,60 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * thd test. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +cw_mtx_t mtx; +cw_thd_t *thread_a, *thread_b; + +void * +thread_entry_func(void *a_arg) +{ + char *arg_str = (char *) a_arg; + + fprintf(stderr, "%s(): Argument string: \"%s\"\n", __FUNCTION__, arg_str); + + mtx_lock(&mtx); + fprintf(stderr, "%s(): thd_self() returns %s\n", __FUNCTION__, + (thd_self() == thread_a) ? "thread_a" : (thd_self() == thread_b) + ? "thread_b" : ""); + mtx_unlock(&mtx); + + return NULL; +} + +int +main() +{ + libonyx_init(); + fprintf(stderr, "Test begin\n"); + mtx_new(&mtx); + + thread_b = NULL; + mtx_lock(&mtx); + thread_a = thd_new(thread_entry_func, (void *)"Thread A argument", TRUE); + mtx_unlock(&mtx); + cw_assert(thd_join(thread_a) == NULL); + thread_a = NULL; + + mtx_lock(&mtx); + thread_b = thd_new(thread_entry_func, (void *)"Thread B argument", TRUE); + mtx_unlock(&mtx); + cw_assert(thd_join(thread_b) == NULL); + + mtx_delete(&mtx); + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_a.exp new file mode 100644 index 000000000..df749d8ea --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_a.exp @@ -0,0 +1,6 @@ +Test begin +thread_entry_func(): Argument string: "Thread A argument" +thread_entry_func(): thd_self() returns thread_a +thread_entry_func(): Argument string: "Thread B argument" +thread_entry_func(): thd_self() returns thread_b +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_b.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_b.c new file mode 100644 index 000000000..ffb9b2a94 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_b.c @@ -0,0 +1,99 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Test thread suspend/resume along with critical sections. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#include + +cw_thd_t *thd; +cw_uint32_t i; +cw_bool_t done = FALSE; + +void * +thread_entry_func(void *a_arg) +{ + for (i = 1; i != 0 && done == FALSE;) + { + thd_crit_enter(); + i++; + thd_crit_leave(); + + /* For non-concurrent thread libraries, don't use up the whole time + * quantum, in order to make this test complete faster. */ + if (i % 509989 == 0) + { + thd_yield(); + } + } + + return NULL; +} + +int +main() +{ + cw_uint32_t j, count; + struct timespec tout = {0, 1000000}; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + thd_crit_enter(); + thd_crit_leave(); + + thd = thd_new(thread_entry_func, NULL, TRUE); + nanosleep(&tout, NULL); + + fprintf(stderr, "thd_suspend()\n"); + for (j = 0; j < 7; j++) + { + thd_suspend(thd); + count = i; + nanosleep(&tout, NULL); +/* fprintf(stderr, "count(%u) == i(%u)\n", count, i); */ + cw_assert(count == i); + thd_resume(thd); + nanosleep(&tout, NULL); + thd_suspend(thd); +/* fprintf(stderr, "count(%u) <= i(%u)\n", count, i); */ + cw_assert(count <= i); + thd_resume(thd); + } + + fprintf(stderr, "thd_trysuspend()\n"); + for (j = 0; j < 7; j++) + { + while (thd_trysuspend(thd)); + { + count = i; + } + nanosleep(&tout, NULL); +/* fprintf(stderr, "count(%u) == i(%u)\n", count, i); */ + cw_assert(count == i); + thd_resume(thd); + nanosleep(&tout, NULL); + while (thd_trysuspend(thd)) + { + } +/* fprintf(stderr, "count(%u) <= i(%u)\n", count, i); */ + cw_assert(count <= i); + thd_resume(thd); + } + done = TRUE; + thd_join(thd); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_b.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_b.exp new file mode 100644 index 000000000..75cde997d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_b.exp @@ -0,0 +1,4 @@ +Test begin +thd_suspend() +thd_trysuspend() +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_c.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_c.c new file mode 100644 index 000000000..e1876de4c --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_c.c @@ -0,0 +1,70 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define NSUSPENDIBLE 10 +#define NSUSPENDERS 10 +#define NTHREADS (NSUSPENDIBLE + NSUSPENDERS) +#define NITERATIONS 100 + +cw_uint32_t count = 0; + +void * +thread_entry_func(void *a_arg) +{ + cw_uint32_t i; + + for (i = 0; i < NITERATIONS; i++) + { + thd_single_enter(); + count++; + thd_single_leave(); + } + + return NULL; +} + +int +main() +{ + cw_thd_t *thds[NTHREADS]; + cw_uint32_t i; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + /* Create threads that can be suspended. */ + for (i = 0; i < NSUSPENDIBLE; i++) + { + thds[i] = thd_new(thread_entry_func, NULL, TRUE); + } + /* Create threads that cannot be suspended. */ + for (; i < NTHREADS; i++) + { + thds[i] = thd_new(thread_entry_func, NULL, FALSE); + } + + /* The initial thread is suspendible. */ + thread_entry_func(NULL); + + for (i = 0; i < NTHREADS; i++) + { + thd_join(thds[i]); + } + + cw_assert(count == (NTHREADS + 1) * NITERATIONS); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_c.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_c.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/thd_c.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/tsd_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/tsd_a.c new file mode 100644 index 000000000..46bb8f20a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/tsd_a.c @@ -0,0 +1,65 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * tsd test. + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define NTHREADS 20 +#define NITERATIONS 1000 + +cw_tsd_t tsd; +cw_uint8_t arr[NITERATIONS]; + +void * +thread_entry_func(void *a_arg) +{ + cw_uint32_t i; + + for (i = 0; i < NITERATIONS; i++) + { + tsd_set(&tsd, (void *)&arr[i]); + thd_yield(); + cw_assert((cw_uint8_t *)tsd_get(&tsd) == &arr[i]); + thd_yield(); + } + + return NULL; +} + +int +main() +{ + cw_thd_t *thds[NTHREADS]; + cw_uint32_t i; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + tsd_new(&tsd, NULL); + + for (i = 0; i < NTHREADS; i++) + { + thds[i] = thd_new(thread_entry_func, NULL, TRUE); + } + + for (i = 0; i < NTHREADS; i++) + { + thd_join(thds[i]); + } + + tsd_delete(&tsd); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/tsd_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/tsd_a.exp new file mode 100644 index 000000000..369a88dd2 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/tsd_a.exp @@ -0,0 +1,2 @@ +Test begin +Test end diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/xep_a.c b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/xep_a.c new file mode 100644 index 000000000..404aabdfa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/xep_a.c @@ -0,0 +1,153 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "../include/libonyx/libonyx.h" + +#define CW_XEPV_FOO 128 +#define CW_XEPV_BAR 129 +#define CW_XEPV_BIZ 130 +#define CW_XEPV_BAZ 131 +#define CW_XEPV_BAM 132 + +void +func_a(void) +{ + xep_throw(CW_XEPV_BAR); +} + +void +func_b(void) +{ + xep_begin(); + xep_try + { + fprintf(stderr, "%s(): CW_XEPV_CODE\n", __FUNCTION__); + func_a(); + } + xep_catch(CW_XEPV_BAR) + { + fprintf(stderr, "%s(): CW_XEPV_BAR\n", __FUNCTION__); + xep_handled(); + } + xep_end(); +} + +void +func_c(void) +{ + xep_begin(); + xep_try + { + fprintf(stderr, "%s(): CW_XEPV_CODE\n", __FUNCTION__); + func_a(); + } + xep_end(); +} + +int +main() +{ + volatile cw_uint32_t i; + + libonyx_init(); + fprintf(stderr, "Test begin\n"); + + for (i = 0; i < 11; i++) + { + fprintf(stderr, "%s(): i == %u\n", __FUNCTION__, i); + xep_begin(); + xep_try + { + fprintf(stderr, "%s(): CW_XEPV_CODE\n", __FUNCTION__); + if (i == 2) + { + xep_throw(CW_XEPV_FOO); + } + if (i == 3) + { + func_a(); + } + if (i == 5) + { + func_b(); + } + if (i == 6) + { + func_c(); + } + if (i == 7) + { + xep_throw(CW_XEPV_BIZ); + } + if (i == 8) + { + xep_throw(CW_XEPV_BAZ); + } + if (i == 9) + { + xep_throw(CW_XEPV_BAM); + } + } + xep_catch(CW_XEPV_FOO) + { + cw_assert(xep_value() == CW_XEPV_FOO); + fprintf(stderr, "%s(): CW_XEPV_FOO\n", __FUNCTION__); + xep_handled(); + } + xep_catch(CW_XEPV_BAR) + { + cw_assert(xep_value() == CW_XEPV_BAR); + fprintf(stderr, "%s(): CW_XEPV_BAR\n", __FUNCTION__); + xep_handled(); + } + xep_catch(CW_XEPV_BIZ) + xep_mcatch(CW_XEPV_BAZ) + { + cw_assert(xep_value() == CW_XEPV_BIZ + || xep_value() == CW_XEPV_BAZ); + if (xep_value() == CW_XEPV_BIZ) + { + fprintf(stderr, "%s(): CW_XEPV_BIZ\n", __FUNCTION__); + i++; + xep_retry(); + } + else + { + fprintf(stderr, "%s(): CW_XEPV_BAZ\n", __FUNCTION__); + xep_handled(); + } + } + xep_acatch + { + if (xep_value() == CW_XEPV_BAM) + { + fprintf(stderr, "%s(): CW_XEPV_BAM\n", __FUNCTION__); + xep_handled(); + } + } + xep_end(); + } + + xep_begin(); + xep_try + { + } + xep_acatch + { + fprintf(stderr, "%s(): xep_acatch\n", __FUNCTION__); + } + xep_end(); + + fprintf(stderr, "Test end\n"); + libonyx_shutdown(); + return 0; +} diff --git a/tags/ONYX_4_3_1/devroot/lib/libonyx/test/xep_a.exp b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/xep_a.exp new file mode 100644 index 000000000..948e93950 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/lib/libonyx/test/xep_a.exp @@ -0,0 +1,32 @@ +Test begin +main(): i == 0 +main(): CW_XEPV_CODE +main(): i == 1 +main(): CW_XEPV_CODE +main(): i == 2 +main(): CW_XEPV_CODE +main(): CW_XEPV_FOO +main(): i == 3 +main(): CW_XEPV_CODE +main(): CW_XEPV_BAR +main(): i == 4 +main(): CW_XEPV_CODE +main(): i == 5 +main(): CW_XEPV_CODE +func_b(): CW_XEPV_CODE +func_b(): CW_XEPV_BAR +main(): i == 6 +main(): CW_XEPV_CODE +func_c(): CW_XEPV_CODE +main(): CW_XEPV_BAR +main(): i == 7 +main(): CW_XEPV_CODE +main(): CW_XEPV_BIZ +main(): CW_XEPV_CODE +main(): CW_XEPV_BAZ +main(): i == 9 +main(): CW_XEPV_CODE +main(): CW_XEPV_BAM +main(): i == 10 +main(): CW_XEPV_CODE +Test end diff --git a/tags/ONYX_4_3_1/devroot/mod/.cvsignore b/tags/ONYX_4_3_1/devroot/mod/.cvsignore new file mode 100644 index 000000000..82d4687e5 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/.cvsignore @@ -0,0 +1,2 @@ +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/mod/Cookfile b/tags/ONYX_4_3_1/devroot/mod/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/mod/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/mod/Cookfile.inc.in new file mode 100644 index 000000000..b266a0011 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/Cookfile.inc.in @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Top level Cookfile for modules. + * + ******************************************************************************/ + +#include-cooked [fromto % @objroot@/mod/%/Cookfile.inc @mods@] + +/* + * Targets. + */ +mods : @mods@; + +mods_tests : [addsuffix _mods_tests @mods@]; +mods_check : [addsuffix _mods_check @mods@]; +mods_check_update : [addsuffix _mods_check_update @mods@]; + +mods_install : [addsuffix _mods_install @mods@]; + +mods_uninstall : [addsuffix _mods_uninstall @mods@]; + +mods_clean : [addsuffix _mods_clean @mods@]; + +mods_distclean : [addsuffix _mods_distclean @mods@]; + +/* + * Build rules for module C files --> object files. + */ +@objroot@/mod/%0src/%1.o_s : @srcroot@/mod/%0src/%1.c + set mkdir +{ + [TCC] [S_CFLAGS] [CPPFLAGS] [CPPDEFS] -c @srcroot@/mod/%0src/%1.c + -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @srcroot@/mod/%0src/%1.c + "--prefix='"[target]" : "@srcroot@/mod/%0src/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto mod/%0src/%1.o_s mod/%0src/%1.d_s [target]]; +} + diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/.cvsignore b/tags/ONYX_4_3_1/devroot/mod/modprompt/.cvsignore new file mode 100644 index 000000000..8978511fa --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/.cvsignore @@ -0,0 +1,3 @@ +nxm +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/Cookfile b/tags/ONYX_4_3_1/devroot/mod/modprompt/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/mod/modprompt/Cookfile.inc.in new file mode 100644 index 000000000..9c2b1d9f3 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/Cookfile.inc.in @@ -0,0 +1,116 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Cookfile for modprompt. + * + ******************************************************************************/ + +/* Include generated dependency files. */ +#include-cooked [glob @objroot@/mod/modprompt/src/"*.d_*"] + +/* + * File lists. + */ + +/* Source files. */ +MODPROMPT_SRCS = [addprefix @srcroot@/mod/modprompt/src/ + modprompt.c + ]; + +/* Generated source code (created by configure). */ +MODPROMPT_NX_GEN = [fromto %.nx.in @objroot@/mod/modprompt/nx/modprompt/%.nx + modprompt_defs.nx.in + ]; + +MODPROMPT_NX = [addprefix @srcroot@/mod/modprompt/nx/modprompt/ + modprompt.nx + ]; + +/* Modules. */ +MODPROMPT = @objroot@/mod/modprompt/nxm/modprompt.nxm; + +/* + * User cook'ables. + */ + +modprompt : [MODPROMPT]; + +modprompt_mods_tests : +{ +} + +modprompt_mods_check : +{ +} + +modprompt_mods_check_update : +{ +} + +modprompt_mods_install : [MODPROMPT] +{ + @INSTALL@ -d [DATADIR]/onyx-@onyx_version@/nxm; + @INSTALL@ -m 0444 [MODPROMPT] [DATADIR]/onyx-@onyx_version@/nxm; + @INSTALL@ -d [DATADIR]/onyx-@onyx_version@/nx/modprompt; + + loop local f = [MODPROMPT_NX] [MODPROMPT_NX_GEN] + { + @INSTALL@ -m 0644 [f] [DATADIR]/onyx-@onyx_version@/nx/modprompt/; + } +} + +modprompt_mods_uninstall : +{ + rm -f [DATADIR]/onyx-@onyx_version@/nxm/modprompt.nxm; + rm -rf [DATADIR]/onyx-@onyx_version@/nx/modprompt; +} + +modprompt_mods_clean : +{ + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.d_s [MODPROMPT_SRCS]]; + rm -f [fromto @srcroot@/%0%.c @objroot@/%0%.o_s [MODPROMPT_SRCS]]; + rm -f [MODPROMPT]; +} + +modprompt_mods_distclean : +{ +} + +/* + * Various flags. + */ + +MODPROMPT_CPPFLAGS = @LIBEDIT_CPPFLAGS@ @MODPROMPT_CPPFLAGS@; +MODPROMPT_LDFLAGS = +#if [and [count @RPATH@] [count @LIBEDIT_PREFIX@]] + @RPATH@@LIBEDIT_PREFIX@/lib +#endif + @LIBEDIT_LDFLAGS@ + [LDFLAGS] @MODPROMPT_LDFLAGS@; + +CPPFLAGS = -I@srcroot@/mod/modprompt/include + -I@objroot@/mod/modprompt/include + [MODPROMPT_CPPFLAGS] [CPPFLAGS]; + +/* + * Dependencies. + */ + +[MODPROMPT] : [fromto @srcroot@/%0%.c @objroot@/%0%.o_s [MODPROMPT_SRCS]] + set mkdir +{ + [TCC] +#if [matches elf @abi@] + -shared +#elif [matches macho @abi@] + -undefined suppress -flat_namespace -bundle -all_load -bind_at_load +#endif + -o [target] [need] + [MODPROMPT_LDFLAGS]; +} diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/include/.cvsignore b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/.cvsignore new file mode 100644 index 000000000..b39834dfc --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/.cvsignore @@ -0,0 +1,2 @@ +modprompt_defs.h +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/include/Cookfile b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/include/modprompt.h b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/modprompt.h new file mode 100644 index 000000000..0e8b0270f --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/modprompt.h @@ -0,0 +1,16 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "modprompt_defs.h" + +void +modprompt_init(void *a_arg, cw_nxo_t *a_thread); diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/include/modprompt_defs.h.in b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/modprompt_defs.h.in new file mode 100644 index 000000000..2373196de --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/include/modprompt_defs.h.in @@ -0,0 +1,11 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/Cookfile b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/.cvsignore b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/.cvsignore new file mode 100644 index 000000000..05008dff9 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/.cvsignore @@ -0,0 +1,2 @@ +modprompt_defs.nx +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/Cookfile b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/modprompt.nx b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/modprompt.nx new file mode 100644 index 000000000..c409646dd --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/modprompt.nx @@ -0,0 +1,13 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ + +`modprompt/modprompt_defs.nx' require +`modprompt.nxm' `modprompt_init' mrequire diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/modprompt_defs.nx.in b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/modprompt_defs.nx.in new file mode 100644 index 000000000..3e65ecb20 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/nx/modprompt/modprompt_defs.nx.in @@ -0,0 +1,10 @@ +################################################################################ +# +# +# +# +################################################################################ +# +# Version: Onyx +# +################################################################################ diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/src/.cvsignore b/tags/ONYX_4_3_1/devroot/mod/modprompt/src/.cvsignore new file mode 100644 index 000000000..dc72264b0 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/src/.cvsignore @@ -0,0 +1,2 @@ +*.[do]_[asdp] +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/src/Cookfile b/tags/ONYX_4_3_1/devroot/mod/modprompt/src/Cookfile new file mode 100644 index 000000000..16af33e9d --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/src/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/mod/modprompt/src/modprompt.c b/tags/ONYX_4_3_1/devroot/mod/modprompt/src/modprompt.c new file mode 100644 index 000000000..4798ccae6 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/mod/modprompt/src/modprompt.c @@ -0,0 +1,620 @@ +/* -*- mode: c ; c-file-style: "canonware-c-style" -*- + ****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: Onyx + * + ******************************************************************************/ + +#include "libonyx/libonyx.h" +#include "../include/modprompt.h" + +#include +#include + +#define CW_PROMPT_STRLEN 80 +#define CW_BUFFER_SIZE 512 + +struct cw_modprompt_synth_s { +#ifdef CW_DBG +#define CW_MODPROMPT_SYNTH_MAGIC 0x32ad81a5 + cw_uint32_t magic; +#endif + cw_nxo_t modload_hook; + cw_nxo_t *thread; + cw_nxo_threadp_t threadp; + cw_bool_t continuation; +#ifdef CW_THREADS + cw_thd_t *read_thd; + volatile cw_bool_t quit; + volatile cw_bool_t resize; + + cw_mtx_t mtx; + cw_bool_t have_data; /* The writer wrote data. */ + cw_cnd_t put_cnd; /* The writer (libedit thread) waits on this. */ + cw_bool_t want_data; /* The reader wants data. */ + cw_cnd_t get_cnd; /* The reader (interpreter thread) waits on this. */ +#endif + + cw_uint8_t *buffer; + cw_uint32_t buffer_size; + cw_uint32_t buffer_count; + + EditLine *el; + History *hist; + HistEvent hevent; + cw_uint8_t prompt_str[CW_PROMPT_STRLEN]; +}; + +/* Globals. */ +/* This must be global so that the signal handler can get to it. */ +static struct cw_modprompt_synth_s *synth; + +/* Function prototypes. */ +static cw_nxoe_t * +modprompt_synth_ref_iter(void *a_data, cw_bool_t a_reset); + +static void +modprompt_synth_delete(void *a_data, cw_nx_t *a_nx); + +static cw_sint32_t +modprompt_read(void *a_data, cw_nxo_t *a_file, cw_uint32_t a_len, + cw_uint8_t *r_str); + +static char * +modprompt_prompt(EditLine *a_el); + +static void +modprompt_handlers_install(void); + +static void +modprompt_signal_handle(int a_signal); + +#ifdef CW_THREADS +static void * +modprompt_entry(void *a_arg); +#endif + +void +modprompt_init(void *a_arg, cw_nxo_t *a_thread) +{ + cw_nxo_t *estack, *file; + char *editor; +#ifdef CW_THREADS + sigset_t set, oset; +#endif + + synth = (struct cw_modprompt_synth_s *) + cw_malloc(sizeof(struct cw_modprompt_synth_s)); +#ifdef CW_DBG + memset(synth, 0xa5, sizeof(struct cw_modprompt_synth_s)); +#endif + + /* Initialize stdin. Only convert the initial thread's stdin, since it + * isn't safe for multiple threads to use the synthetic file. If the + * application is crazy enough use the initial thread's stdin in another + * thread, crashes are likely. */ + file = nxo_thread_stdin_get(a_thread); + nxo_file_new(file, nxo_thread_nx_get(a_thread), TRUE); + nxo_file_synthetic(file, modprompt_read, NULL, modprompt_synth_ref_iter, + modprompt_synth_delete, synth); + nxo_attr_set(file, NXOA_EXECUTABLE); + + /* The interpreter is currently executing a hook that holds a reference to + * the dynamically loaded module. Keep a reference to it, so that this + * module will not be unloaded until after the synthetic file object has + * been destroyed. */ + estack = nxo_thread_estack_get(a_thread); + nxo_no_new(&synth->modload_hook); + nxo_dup(&synth->modload_hook, nxo_stack_get(estack)); + + /* Finish initializing synth. */ + synth->thread = a_thread; + nxo_threadp_new(&synth->threadp); + synth->continuation = FALSE; +#ifdef CW_THREADS + synth->quit = FALSE; + synth->resize = FALSE; + mtx_new(&synth->mtx); + synth->have_data = FALSE; + cnd_new(&synth->put_cnd); + synth->want_data = FALSE; + cnd_new(&synth->get_cnd); +#endif + synth->buffer = NULL; + synth->buffer_size = 0; + synth->buffer_count = 0; + + /* Initialize the command editor. */ + synth->hist = history_init(); + history(synth->hist, &synth->hevent, H_SETSIZE, 512); + + synth->el = el_init("onyx", stdin, stdout, stderr); + el_set(synth->el, EL_HIST, history, synth->hist); + el_set(synth->el, EL_PROMPT, modprompt_prompt); + el_set(synth->el, EL_CLIENTDATA, synth); + + editor = getenv("ONYX_EDITOR"); + if (editor == NULL || (strcmp(editor, "emacs") && strcmp(editor, "vi"))) + { + /* Default to emacs key bindings, since they're more intuitive to the + * uninitiated. */ + editor = "emacs"; + } + el_set(synth->el, EL_EDITOR, editor); +#ifdef CW_DBG + synth->magic = CW_MODPROMPT_SYNTH_MAGIC; +#endif + +#ifdef CW_THREADS + /* Mask all signals that the read thread handles, so that they're always + * delivered there. */ + sigemptyset(&set); + sigaddset(&set, SIGINT); + sigaddset(&set, SIGTSTP); + sigaddset(&set, SIGSTOP); + sigaddset(&set, SIGQUIT); + sigaddset(&set, SIGHUP); + sigaddset(&set, SIGTERM); + sigaddset(&set, SIGCONT); + sigaddset(&set, SIGWINCH); + thd_sigmask(SIG_BLOCK, &set, &oset); + synth->read_thd = thd_new(modprompt_entry, synth, TRUE); +#else + /* Install signal handlers. */ + modprompt_handlers_install(); +#endif + + /* stdin is now a synthetic file. This does not change any file objects + * which may already be on estack, but under normal circumstances, this + * module is loaded by the bootstrap code, and stdin is not pushed onto + * estack and executed until after the bootstrap code has been completely + * executed. + * + * If this module is loaded later on, once stdin is being read from, loading + * this module will have no apparent effect unless something like the + * following code is recursed into: + * + * stdin cvx eval + * + * Strange things may happen though, since the file object already on estack + * may have already buffered data, but the data will not be evaluated until + * EOF is returned by the synthetic stdin. */ +} + +static cw_nxoe_t * +modprompt_synth_ref_iter(void *a_data, cw_bool_t a_reset) +{ + cw_nxoe_t *retval; + struct cw_modprompt_synth_s *synth = (struct cw_modprompt_synth_s *) a_data; + + cw_check_ptr(synth); + cw_dassert(synth->magic == CW_MODPROMPT_SYNTH_MAGIC); + + if (a_reset) + { + retval = nxo_nxoe_get(&synth->modload_hook); + } + else + { + retval = NULL; + } + + return retval; +} + +static void +modprompt_synth_delete(void *a_data, cw_nx_t *a_nx) +{ + struct cw_modprompt_synth_s *synth = (struct cw_modprompt_synth_s *) a_data; + + cw_check_ptr(synth); + cw_dassert(synth->magic == CW_MODPROMPT_SYNTH_MAGIC); + +#ifdef CW_THREADS + /* Tell the read thread to start shutting down. */ + mtx_lock(&synth->mtx); + synth->quit = TRUE; + cnd_signal(&synth->put_cnd); + mtx_unlock(&synth->mtx); + /* Wait for the read thread to exit. */ + thd_join(synth->read_thd); + /* Clean up. */ + mtx_delete(&synth->mtx); + cnd_delete(&synth->put_cnd); + cnd_delete(&synth->get_cnd); +#endif + + if (synth->buffer != NULL) + { + cw_free(synth->buffer); + } + + /* Clean up the command editor. */ + el_end(synth->el); + history_end(synth->hist); + + cw_free(synth); +} + +#ifdef CW_THREADS +static cw_sint32_t +modprompt_read(void *a_data, cw_nxo_t *a_file, cw_uint32_t a_len, + cw_uint8_t *r_str) +{ + cw_sint32_t retval; + struct cw_modprompt_synth_s *synth = (struct cw_modprompt_synth_s *) a_data; + + cw_check_ptr(synth); + cw_dassert(synth->magic == CW_MODPROMPT_SYNTH_MAGIC); + cw_assert(a_len > 0); + + mtx_lock(&synth->mtx); + + if (synth->buffer_count == 0) + { + /* Tell the main thread to read more data, then wait for it. */ + synth->want_data = TRUE; + cnd_signal(&synth->put_cnd); + synth->have_data = FALSE; + while (synth->have_data == FALSE) + { + cnd_wait(&synth->get_cnd, &synth->mtx); + } + } + cw_assert(synth->buffer_count > 0); + + /* Return as much of the data as possible. */ + if (synth->buffer_count > a_len) + { + /* There are more data than we can return. */ + retval = a_len; + memcpy(r_str, synth->buffer, a_len); + synth->buffer_count -= a_len; + memmove(synth->buffer, &synth->buffer[a_len], synth->buffer_count); + } + else + { + /* Return all the data. */ + retval = synth->buffer_count; + memcpy(r_str, synth->buffer, synth->buffer_count); + synth->buffer_count = 0; + } + + mtx_unlock(&synth->mtx); + return retval; +} +#else +static cw_sint32_t +modprompt_read(void *a_data, cw_nxo_t *a_file, cw_uint32_t a_len, + cw_uint8_t *r_str) +{ + cw_sint32_t retval; + struct cw_modprompt_synth_s *synth = (struct cw_modprompt_synth_s *) a_data; + const char *str; + int count = 0; + + cw_check_ptr(synth); + cw_dassert(synth->magic == CW_MODPROMPT_SYNTH_MAGIC); + cw_assert(a_len > 0); + + if (synth->buffer_count == 0) + { + /* Read more data. */ + while ((str = el_gets(synth->el, &count)) == NULL) + { + /* An interrupted system call (EINTR) caused an error in + * el_gets(). */ + } + cw_assert(count > 0); + + /* Update the command line history. */ + if ((nxo_thread_deferred(synth->thread) == FALSE) + && (nxo_thread_state(synth->thread) == THREADTS_START)) + { + /* Completion of a history element. Insert it, taking care to avoid + * simple (non-continued) duplicates and empty lines (simple + * carriage returns). */ + if (synth->continuation) + { + history(synth->hist, &synth->hevent, H_ENTER, str); + synth->continuation = FALSE; + } + else + { + if ((history(synth->hist, &synth->hevent, H_FIRST) == -1 + || strcmp(str, synth->hevent.str)) && strlen(str) > 1) + { + history(synth->hist, &synth->hevent, H_ENTER, str); + } + } + } + else + { + /* Continuation. Append it to the current history element. */ + history(synth->hist, &synth->hevent, H_ADD, str); + synth->continuation = TRUE; + } + + /* Copy the data to the synth buffer. */ + if (count > synth->buffer_size) + { + /* Expand the buffer. */ + if (synth->buffer == NULL) + { + synth->buffer = (cw_uint8_t *) cw_malloc(count); + } + else + { + synth->buffer = (cw_uint8_t *) cw_realloc(synth->buffer, count); + } + synth->buffer_size = count; + } + memcpy(synth->buffer, str, count); + synth->buffer_count = count; + } + cw_assert(synth->buffer_count > 0); + + /* Return as much of the data as possible. */ + if (synth->buffer_count > a_len) + { + /* There are more data than we can return. */ + retval = a_len; + memcpy(r_str, synth->buffer, a_len); + synth->buffer_count -= a_len; + memmove(synth->buffer, &synth->buffer[a_len], synth->buffer_count); + } + else + { + /* Return all the data. */ + retval = synth->buffer_count; + memcpy(r_str, synth->buffer, synth->buffer_count); + synth->buffer_count = 0; + } + + return retval; +} +#endif + +static char * +modprompt_prompt(EditLine *a_el) +{ + struct cw_modprompt_synth_s *synth; + + el_get(a_el, EL_CLIENTDATA, (void **)&synth); + + cw_check_ptr(synth); + cw_dassert(synth->magic == CW_MODPROMPT_SYNTH_MAGIC); + + if ((nxo_thread_deferred(synth->thread) == FALSE) + && (nxo_thread_state(synth->thread) == THREADTS_START)) + { + static const cw_uint8_t code[] = "promptstring"; + cw_uint8_t *pstr; + cw_uint32_t plen, maxlen; + cw_nxo_t *nxo; + cw_nxo_t *stack; + + stack = nxo_thread_ostack_get(synth->thread); + + /* Push the prompt onto the data stack. */ + nxo_thread_interpret(synth->thread, &synth->threadp, code, + sizeof(code) - 1); + nxo_thread_flush(synth->thread, &synth->threadp); + + /* Get the actual prompt string. */ + nxo = nxo_stack_get(stack); + if (nxo == NULL) + { + nxo_thread_nerror(synth->thread, NXN_stackunderflow); + maxlen = 0; + } + else if (nxo_type_get(nxo) != NXOT_STRING) + { + nxo_thread_nerror(synth->thread, NXN_typecheck); + maxlen = 0; + } + else + { + pstr = nxo_string_get(nxo); + plen = nxo_string_len_get(nxo); + + /* Copy the prompt string to a global buffer. */ + maxlen + = (plen > CW_PROMPT_STRLEN - 1) ? CW_PROMPT_STRLEN - 1 : plen; + strncpy(synth->prompt_str, pstr, maxlen); + } + + synth->prompt_str[maxlen] = '\0'; + + /* Pop the prompt string off the data stack. */ + nxo_stack_pop(stack); + } + else + { + /* One or both of: + * + * - Continuation of a string or similarly parsed token. + * - Execution is deferred due to unmatched {}'s. + * + * Don't print a prompt. */ + synth->prompt_str[0] = '\0'; + } + + return synth->prompt_str; +} + +static void +modprompt_handlers_install(void) +{ + struct sigaction action; +#ifdef CW_THREADS + sigset_t set, oset; +#endif + + /* Set up a signal handler for various signals that are important to an + * interactive program. */ + memset(&action, 0, sizeof(struct sigaction)); + action.sa_handler = modprompt_signal_handle; + sigemptyset(&action.sa_mask); +#define HANDLER_INSTALL(a_signal) \ + if (sigaction((a_signal), &action, NULL) == -1) \ + { \ + fprintf(stderr, "Error in sigaction(%s, ...): %s\n", \ + #a_signal, strerror(errno)); \ + abort(); \ + } + HANDLER_INSTALL(SIGHUP); + HANDLER_INSTALL(SIGWINCH); + HANDLER_INSTALL(SIGTSTP); + HANDLER_INSTALL(SIGCONT); + HANDLER_INSTALL(SIGINT); + HANDLER_INSTALL(SIGQUIT); + HANDLER_INSTALL(SIGTERM); +#undef HANDLER_INSTALL + +#ifdef CW_THREADS + sigemptyset(&set); + sigaddset(&set, SIGINT); + sigaddset(&set, SIGTSTP); + sigaddset(&set, SIGSTOP); + sigaddset(&set, SIGQUIT); + sigaddset(&set, SIGHUP); + sigaddset(&set, SIGTERM); + sigaddset(&set, SIGCONT); + sigaddset(&set, SIGWINCH); + thd_sigmask(SIG_UNBLOCK, &set, &oset); +#endif +} + +static void +modprompt_signal_handle(int a_signal) +{ + switch (a_signal) + { + case SIGWINCH: + { + el_resize(synth->el); + break; + } + case SIGTSTP: + { + /* Signal the process group. */ + kill(0, SIGSTOP); + break; + } + case SIGCONT: + { + break; + } + case SIGHUP: + case SIGINT: + case SIGQUIT: + case SIGTERM: + { + el_end(synth->el); + exit(0); + } + default: + { + fprintf(stderr, "Unexpected signal %d\n", a_signal); + abort(); + } + } +} + +#ifdef CW_THREADS +static void * +modprompt_entry(void *a_arg) +{ + struct cw_modprompt_synth_s *synth = (struct cw_modprompt_synth_s *) a_arg; + const char *str; + int count = 0; + + cw_check_ptr(synth); + cw_dassert(synth->magic == CW_MODPROMPT_SYNTH_MAGIC); + + /* Install signal handlers. */ + modprompt_handlers_install(); + + mtx_lock(&synth->mtx); + for (;;) + { + /* Wait for the interpreter thread to request data. */ + while (synth->want_data == FALSE && synth->quit == FALSE) + { + cnd_wait(&synth->put_cnd, &synth->mtx); + } + synth->want_data = FALSE; + if (synth->quit) + { + break; + } + + /* Read data. */ + cw_assert(synth->buffer_count == 0); + while ((str = el_gets(synth->el, &count)) == NULL) + { + /* An interrupted system call (EINTR) caused an error in + * el_gets(). Check to see if we should quit. */ + } + cw_assert(count > 0); + + /* Update the command line history. */ + if ((nxo_thread_deferred(synth->thread) == FALSE) + && (nxo_thread_state(synth->thread) == THREADTS_START)) + { + /* Completion of a history element. Insert it, taking care to avoid + * simple (non-continued) duplicates and empty lines (simple + * carriage returns). */ + if (synth->continuation) + { + history(synth->hist, &synth->hevent, H_ENTER, str); + synth->continuation = FALSE; + } + else + { + if ((history(synth->hist, &synth->hevent, H_FIRST) == -1 + || strcmp(str, synth->hevent.str)) && strlen(str) > 1) + { + history(synth->hist, &synth->hevent, H_ENTER, str); + } + } + } + else + { + /* Continuation. Append it to the current history element. */ + history(synth->hist, &synth->hevent, H_ADD, str); + synth->continuation = TRUE; + } + + /* Copy the data to the synth buffer. */ + if (count > synth->buffer_size) + { + /* Expand the buffer. */ + if (synth->buffer == NULL) + { + synth->buffer = (cw_uint8_t *) cw_malloc(count); + } + else + { + synth->buffer = (cw_uint8_t *) cw_realloc(synth->buffer, count); + } + synth->buffer_size = count; + } + memcpy(synth->buffer, str, count); + synth->buffer_count = count; + + /* Tell the interpreter thread that there are data available. */ + synth->have_data = TRUE; + cnd_signal(&synth->get_cnd); + } + mtx_unlock(&synth->mtx); + + return NULL; +} +#endif diff --git a/tags/ONYX_4_3_1/devroot/test/.cvsignore b/tags/ONYX_4_3_1/devroot/test/.cvsignore new file mode 100644 index 000000000..bdd797a15 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/test/.cvsignore @@ -0,0 +1,3 @@ +verify +Cookfile.inc +Cookfile.list diff --git a/tags/ONYX_4_3_1/devroot/test/Cookfile b/tags/ONYX_4_3_1/devroot/test/Cookfile new file mode 100644 index 000000000..dff9b0d2a --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/test/Cookfile @@ -0,0 +1,21 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Jump Cookfile. + * + ******************************************************************************/ + +% : { + dir = [dirname [shell pwd]]; + [print Entering directory \`[dir]\']; + cd ..\; [self] [options] %; + [print Leaving directory \`[dir]\']; +} + +all : ; diff --git a/tags/ONYX_4_3_1/devroot/test/Cookfile.inc.in b/tags/ONYX_4_3_1/devroot/test/Cookfile.inc.in new file mode 100644 index 000000000..c85bf4112 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/test/Cookfile.inc.in @@ -0,0 +1,68 @@ +/****************************************************************************** + * + * + * + * + ****************************************************************************** + * + * Version: + * + * Top level Cookfile for tests. + * + ******************************************************************************/ + +/* + * Targets. + */ +tests : onyx mods [addsuffix _tests bins mods libs]; +check : tests [addsuffix _check bins mods libs]; +check_update : tests [addsuffix _check_update bins mods libs]; + +tests_clean : +{ +} + +tests_distclean : +{ +} + +/* + * Build rules for tests. + */ +@objroot@/%0test/%1 : @objroot@/%0test/%1.o_a libs_s + set mkdir +{ + [TCC] [A_CFLAGS] -o [target] + @objroot@/%0test/%1.o_a +#if [count @RPATH@] + [split " " + [prepost [prepost @RPATH@ "/lib/" @abs_objroot@] + "/lib" + @libs@]] +#endif + [LDFLAGS] [subst lib -l [filter_out libedit @libs@]] @LIBS@; +} + +@objroot@/%0test/%1.o_a : @srcroot@/%0test/%1.c + set mkdir +{ + [TCC] [A_CFLAGS] [CPPFLAGS] [CPPDEFS] -DCW_ASSERT + -c @srcroot@/%0test/%1.c -o [target]; + + c_incl [CPPFLAGS] --no-cache -Absent_Local_Ignore -No_System + @srcroot@/%0test/%1.c + "--prefix='"[target]" : "@srcroot@/%0test/%1.c"'" + "--suffix='set nodefault;'" + -o [fromto %0test/%1.o_a %0test/%1.d_a [target]]; +} + +/* + * Add magic to onyx files. + */ +@objroot@/%0test/%.nx : @srcroot@/%0test/%.nx.in + set mkdir +{ + echo \"#!@TONYX@\" > [target]; + cat @srcroot@/%0test/%.nx.in >> [target]; + chmod u+x [target]; +} diff --git a/tags/ONYX_4_3_1/devroot/test/verify.in b/tags/ONYX_4_3_1/devroot/test/verify.in new file mode 100644 index 000000000..c6a846f81 --- /dev/null +++ b/tags/ONYX_4_3_1/devroot/test/verify.in @@ -0,0 +1,450 @@ +#!@PERL@ -w +#-*-mode:perl-*- +################################################################################ +# +# +# +# +################################################################################ +# +# Version: +# +# Test harness. +# +################################################################################ + +# Shut off buffering. +select(STDOUT); +$| = 1; + +# +# Parse command-line arguments. +# +use Getopt::Long; +Getopt::Long::config("bundling"); # Allow -hv rather than forcing -h -v. + +# Set option defaults for optional arguments. +$opt_help = 0; +$opt_verbose = 0; +$opt_quiet = 0; +$opt_srcdir = "."; +$opt_objdir = "."; +$opt_ustats = 0; +$opt_zero = 0; + +$opt_retval = +&GetOptions("h|help" => \$opt_help, + "v|verbose" => \$opt_verbose, + "q|quiet" => \$opt_quiet, + "s|srcdir=s" => \$opt_srcdir, + "o|objdir=s" => \$opt_objdir, + "u|ustats" => \$opt_ustats, + "z|zero" => \$opt_zero + ); + +if ($opt_help) +{ + &usage(); + exit(0); +} + +if ($opt_retval == 0) +{ + &usage(); + exit 1; +} + +if ($opt_verbose && $opt_quiet) +{ + print STDERR "-v and -q are incompatible\n"; + &usage(); + exit 1; +} + +if ($#ARGV + 1 == 0) +{ + print STDERR "No tests specified\n"; + &usage(); + exit 1; +} + +if ($opt_verbose) +{ + print STDERR "Option values: h:$opt_help, v:$opt_verbose, " + . "s:\"$opt_srcdir\", o:\"$opt_objdir\" " + . "q:$opt_quiet, u:$opt_ustats, z:$opt_zero\n"; + printf STDERR "Tests (%d total): @ARGV\n", $#ARGV + 1; +} + +# +# Create and print header. +# +@TSTATS = +( + "--------------------------------------------------------------------------\n", + "Test c_user c_system c_total chng\n", + " passed/FAILED h_user h_system h_total %% chng\n" + ); + +if (!$opt_quiet) +{ + foreach $line (@TSTATS) + { + printf STDOUT "$line"; + } +} + +# +# Run sequence test(s). +# +$total_utime = 0.0; # Total user time. +$total_stime = 0.0; # Total system time. +$total_hutime = 0.0; # Total historical user time. +$total_hstime = 0.0; # Total historical system time. +$total_ntime = 0.0; # Total time for tests that have historical data. + +foreach $test (@ARGV) +{ + # Strip out any whitespace in $test. + $test =~ s/^\s*(.*)\s*$/$1/; + + $okay = 1; + + if (-e "$opt_srcdir/$test.exp") + { + # Diff mode. + + ($okay, $utime, $stime) = &run_test($test); + + if (-e "$opt_objdir/$test.out") + { + `diff $opt_srcdir/$test.exp $opt_objdir/$test.out > $opt_objdir/$test.diff 2>&1`; + if ($?) + { + # diff returns non-zero if there is a difference. + $okay = 0; + } + } + else + { + $okay = 0; + if ($opt_verbose) + { + print STDERR + "Nonexistent output file \"$opt_objdir/$test.out\"\n"; + } + } + + ($hutime, $hstime) = &print_stats($test, $okay, 0, 0, $utime, $stime); + } + else + { + # Sequence mode. + + ($okay, $utime, $stime) = &run_test($test); + + if (open (STEST_OUT, "<$opt_objdir/$test.out")) + { + $num_subtests = 0; + $num_failed_subtests = 0; + + while (defined($line = )) + { + if ($line =~ /1\.\.(\d+)/) + { + $num_subtests = $1; + last; + } + } + if ($num_subtests == 0) + { + $okay = 0; + if ($opt_verbose) + { + print STDERR "Malformed or missing 1..n line\n"; + } + } + else + { + for ($subtest = 1; $subtest <= $num_subtests; $subtest++) + { + while (defined($line = )) + { + if ($line =~ /^not\s+ok\s+(\d+)?/) + { + $not = 1; + $test_num = $1; + last; + } + elsif ($line =~ /^ok\s+(\d+)?/) + { + $not = 0; + $test_num = $1; + last; + } + } + if (defined($line)) + { + if (defined($test_num) && ($test_num != $subtest)) + { + # There was no output printed for one or more tests. + for (; $subtest < $test_num; $subtest++) + { + $num_failed_subtests++; + } + } + if ($not) + { + $num_failed_subtests++; + } + } + else + { + for (; $subtest <= $num_subtests; $subtest++) + { + $num_failed_subtests++; + } + } + } + + if (0 < $num_failed_subtests) + { + $okay = 0; + } + } + } + else + { + if (!$opt_quiet) + { + print STDERR "Cannot open output file \"$opt_objdir/$test.out\"\n"; + } + exit 1; + } + + ($hutime, $hstime) = &print_stats($test, $okay, + $num_failed_subtests, $num_subtests, + $utime, $stime); + } + + $total_hutime += $hutime; + $total_hstime += $hstime; + + if ($okay) + { + $total_utime += $utime; + $total_stime += $stime; + } + else + { + @FAILED_TESTS = (@FAILED_TESTS, $test); + } + + # If there were historical data, add the run time to the total time to + # compare against the historical run time. + if (0 < ($hutime + $hstime)) + { + $total_ntime += $utime + $stime; + } +} + +# Print summary stats. +$tt_str = sprintf ("%d / %d passed (%5.2f%%%%)", + ($#ARGV + 1) - ($#FAILED_TESTS + 1), + $#ARGV + 1, + (($#ARGV + 1) - ($#FAILED_TESTS + 1)) + / ($#ARGV + 1) * 100); + +$t_str = sprintf ("Totals %7.2f %7.2f %7.2f" + . " %7.2f\n" + . " %s %7.2f %7.2f %7.2f %7.2f%%%%\n", + $total_utime, $total_stime, $total_utime + $total_stime, + ($total_ntime - ($total_hutime + $total_hstime)), + $tt_str . ' ' x (40 - length($tt_str)), + $total_hutime, $total_hstime, $total_hutime + $total_hstime, + ($total_hutime + $total_hstime == 0.0) ? 0.0 : + (($total_ntime + - ($total_hutime + $total_hstime)) + / ($total_hutime + $total_hstime) * 100)); + +@TSTATS = ("--------------------------------------------------------------------------\n", + $t_str, + "--------------------------------------------------------------------------\n" + ); +if (!$opt_quiet) +{ + foreach $line (@TSTATS) + { + printf STDOUT "$line"; + } +} + +if ($#FAILED_TESTS >= 0) +{ + # One or more tests failed, so return an error. + exit 1; +} +# End of main execution. + +sub run_test +{ + my ($test) = @_; + my ($okay) = 1; + my ($tutime, $tstime); + my ($utime, $stime, $cutime, $cstime); + my (@TSTATS, @TPATH); + my ($t_str); + my ($srcdir, $objdir); + + # Get the path component of $test, if any. + @TPATH = split(/\//, $test); + pop(@TPATH); + $srcdir = join('/', ($opt_srcdir, @TPATH)); + $objdir = join('/', ($opt_objdir, @TPATH)); + + @TSTATS = ("--------------------------------------------------------------------------\n"); + + $t_str = sprintf ("%s%s", $test, ' ' x (40 - length($test))); + @TSTATS = (@TSTATS, $t_str); + @STATS = (@STATS, @TSTATS); + if (!$opt_quiet) + { + foreach $line (@TSTATS) + { + printf STDOUT "$line"; + } + } + + ($utime, $stime, $cutime, $cstime) = times; + `$opt_objdir/$test $srcdir $objdir > $opt_objdir/$test.out 2>&1`; + ($utime, $stime, $tutime, $tstime) = times; + + # Subtract the before time from the after time. + $tutime -= $cutime; + $tstime -= $cstime; + + if ($opt_zero) + { + if ($?) + { + $okay = 0; + if ($opt_verbose) + { + print STDERR + "\"$opt_objdir/$test > $opt_objdir/$test.out 2>&1\" returned $?\n"; + } + } + } + + return ($okay, $tutime, $tstime); +} + +sub print_stats +{ + my ($test, $okay, $failed_subtests, $subtests, $utime, $stime) = @_; + my ($hutime, $hstime); +# my (TEST_PERF); + my (@TSTATS); + my ($t_str, $pass_str); + + $pass_str = $okay ? "passed" : "*** FAILED ***"; + if ((0 != $subtests) && (!$okay)) + { + $pass_str = $pass_str . " ($failed_subtests/$subtests failed)"; + } + $pass_str = $pass_str . ' ' x (39 - length($pass_str)); + + if (-r "$test.perf") + { + if (!open (TEST_PERF, "<$opt_objdir/$test.perf")) + { + print STDERR "Unable to open \"$opt_objdir/$test.perf\"\n"; + exit 1; + } + $_ = ; + + ($hutime, $hstime) = split; + close TEST_PERF; + + $t_str = sprintf (" %7.2f %7.2f %7.2f %7.2f\n" + . " %s %7.2f %7.2f %7.2f %7.2f%%%%\n", + $utime, $stime, $utime + $stime, + ($utime + $stime) - ($hutime + $hstime), + $pass_str, + $hutime, $hstime, $hutime + $hstime, + (($hutime + $hstime) == 0.0) ? 0.0 : + ((($utime + $stime) - ($hutime + $hstime)) + / ($hutime + $hstime) * 100)); + } + else + { + $hutime = 0.0; + $hstime = 0.0; + + $t_str = sprintf (" %7.2f %7.2f %7.2f \n" + . " %s\n", + $utime, $stime, $utime + $stime, + $pass_str); + } + @TSTATS = ($t_str); + if (!$opt_quiet) + { + foreach $line (@TSTATS) + { + printf STDOUT "$line"; + } + } + + if ($okay && $opt_ustats) + { + if (!open (TEST_PERF, ">$opt_objdir/$test.perf")) + { + if (!$opt_quiet) + { + print STDERR "Unable to update \"$opt_objdir/$test.perf\"\n"; + } + } + else + { + print TEST_PERF "$utime $stime\n"; + close TEST_PERF; + } + } + + return ($hutime, $hstime); +} + +sub usage +{ + print <] + + + Option | Description + --------------+------------------------------------------------------------- + -h --help | Print usage and exit. + -v --verbose | Verbose (incompatible with quiet). + -q --quiet | Quiet (incompatible with verbose). + -s --srcdir | Path to source tree (default is "."). + -o --objdir | Path to object tree (default is "."). + -u --ustats | Update historical statistics (stored in ".perf". + -z --zero | Consider non-zero exit code to be an error. + --------------+------------------------------------------------------------- + + If .exp exists, 's output is diff'ed with .exp. Any + difference is considered failure. + + If .exp does not exist, output to stdout of the following form is + expected: + + 1.. + {not }ok[ 1] + {not }ok[ 2] + ... + {not }ok[ n] + + 1 <= < 2^31 + + Lines which do not match the patterns shown above are ignored. +EOF +}