comparison interps/c-intercal/inst/share/ick-0.29/compunex.c @ 996:859f9b4339e6

<Gregor> tar xf egobot.tar.xz
author HackBot
date Sun, 09 Dec 2012 19:30:08 +0000
parents
children
comparison
equal deleted inserted replaced
995:6883f5911eb7 996:859f9b4339e6
1 /* Public domain, by Alex Smith.
2 An example of CREATing statements from C, in this case an example COMPUNEX
3 statement that does a computed NEXT. (Note that newly CREATEd statements
4 can't contain consecutive characters that spell an INTERCAL keyword; also,
5 I wanted a name that was 8 chars or shorter to serve as a DOS filename.)
6
7 Note that as a CREATEd command, COMPUNEX uses one NEXT stack entry itself,
8 meaning the COMPUNEX will take up two NEXT stack entries total. Programs
9 that do large RESUMEs will need to take this into account. (Tail call
10 optimisation would require some sort of GOTO, but ick_goto isn't documented
11 and therefore shouldn't be used, right? */
12 #include <ick_ec.h>
13
14 /* This name starts ick_, but isn't used; in general, the prefix ick_my_ is
15 reserved for expansion libraries (as are the line numbers 1600-1699) because
16 it doesn't conflict either with the compiler or with any linked-in C
17 programs. */
18 ICK_EC_FUNC_START(ick_my_compunex)
19 {
20 ick_startup( {
21 ick_create(".COMPUNEX",1600);
22 ick_create(";COMPUNEX",1600);
23 ick_create("~COMPUNEX",1600);
24 });
25 ick_linelabel(1600);
26 ick_next(ick_c_value(0));
27 ick_resume(1);
28 }
29 ICK_EC_FUNC_END