typedef int bool;
extern str NIL,EOL,OFS,IFS;
extern unsigned RANDOM_SEED;
-#define _EXPORT_GLOBALS str NIL="(null)", EOL="\n", OFS=" ", IFS=" \t\n"; unsigned RANDOM_SEED=0;
+#define _EXPORT_GLOBALS str NIL="(null)", EOL="\n", OFS=" ", IFS=" \t\n", LANG=NULL; unsigned RANDOM_SEED=0;
/* .----------------------------------------------------------------------.
/ 1. C<<1 then buddhist section, updated 2008-02-04 xCh.
'----------------------------------------------------------------------- */
/* .----------------------------------------------------------------------.
/ 4. C<<1 data declaration and allocation, updated 2008-01-31 xCh.
'----------------------------------------------------------------------- */
-#define def_mem(TYPE) typedef struct _##TYPE##_t * TYPE; struct _##TYPE##_t
+#define def_mem(TYPE) typedef struct _##TYPE##_t * TYPE; struct _##TYPE##_t
#define get_mem(TYPE) _GET_MEM(TYPE)
-#define Get_mem(ID,TYPE) TYPE ID=_GET_MEM(TYPE)
-#define mem_len(TYPE) sizeof(struct _##TYPE##_t)
-//#define mem_copy
+#define get_buf(SIZE) (buf)malloc(SIZE) /* temporary solution */
+#define size_of_mem(TYPE) sizeof(struct _##TYPE##_t)
+#define copy_of_mem(TYPE,SRC) _cll1_mem_cpy(sizeof(struct _##TYPE##_t),SRC)
#define list(TYPE) TYPE __next
#define tree(TYPE) TYPE __next; TYPE __seek
#define dict(TYPE) tree(TYPE); str __key
#define array(TYPE) tree(TYPE); int __key
-
+/* variable declarators */
+#define Get_mem(ID,TYPE) TYPE ID=get_mem(TYPE)
+#define Get_buf(ID,SIZE) buf ID=get_buf(SIZE)
/* .----------------------------------------------------------------------.
/ 5. C<<1 string manipulation, updated 2008-01-26 xCh.
'----------------------------------------------------------------------- */
#define get_str(...) _cll1_get_str(__VA_ARGS__,NIL)
#define eq(A,B) (!_cll1_str_cmp(A,B))
#define eqi(A,B) (!_cll1_str_cmpi(A,B))
-//#define str_eq(A,B) eq(A,B) ?
-//#define str_eqi(A,B) eqi(A,B)
#define str_order(A,B) _cll1_str_coll(A,B)
#define str_ascii(A,B) _cll1_str_cmp(A,B)
-#define str_len(...) _cll1__strlen(__VA_ARGS__,NIL)
+#define chars_in_str(...) _cll1_strlen(__VA_ARGS__,NIL)
+#define size_of_str(A) mbstowcs(NULL,A,0)
#define str_in(A,B) _cll1_str_str(A,B)
#define word_in(A,B) _cll1_wordinstr(A,B,0)
#define print(...) _cll1_print(__VA_ARGS__,NIL)
#define suffix(A,B,C) (((A=strrchr(B,C))&&!(*(A++)=0))||(A=B))
#define prefix(A,B,C) ((A=B),((B=strchr(B,C))&&!(*(B++)=0)||(B=A)))
#define tr(STR,B,C) _NEW(S,STR) while(S && *_S) { if(*_S==B)*_S=C; /* <-' */ _S++; }
+/* variable declarators */
+#define Get_str(ID,...) str ID=get_str(__VA_ARGS__)
/* .----------------------------------------------------------------------.
/ 6. C<<1 data container manipulation, updated 2008-01-26 xCh.
'----------------------------------------------------------------------- */
#define interface(TYPE) TYPE __interface
#define interface_of(SELF) SELF->__interface
#define method(NAME) (*NAME)
-#define construct(TYPE) TYPE _init_##TYPE(TYPE o,void *i) { o->__interface=i; return o; } TYPE __init__##TYPE
+#define construct(TYPE,INTERFACE) TYPE _init_##TYPE(TYPE o,INTERFACE i) { o->__interface=i; return o; } TYPE __init__##TYPE
#define get_obj(TYPE,INTERFACE,...) __init__##TYPE(_init_##TYPE(get_mem(TYPE),INTERFACE),__VA_ARGS__)
-#define Get_obj(ID,MEM,...) MEM ID=get_obj(MEM,__VA_ARGS__)
#define get_obj_as(COMMUNITY,MEM,INTERFACE,...) (COMMUNITY)get_obj(MEM,INTERFACE,__VA_ARGS__)
-#define Get_obj_as(ID,COMMUNITY,MEM,...) MEM ID=get_obj_as(COMMUNITY,MEM,INTERFACE,__VA_ARGS__)
#define _(METHOD,...) (((_ARG1(__VA_ARGS__,)) && (_ARG1(__VA_ARGS__,))->__interface->METHOD)?(*( (_ARG1(__VA_ARGS__,))->__interface->METHOD )) ((void *)__VA_ARGS__):0 )
#define __(METHOD,...) ( _ASSERT(ARG1(__VA_ARGS__,)), (*( __cll1_seekmethod(ARG1(__VA_ARGS__,),METHOD) )) ( __VA_ARGS__ ) )
#define call(OBJTYPE,METHOD,...) { int _N=0; OBJTYPE _OBJ; /* <-' */ while( (_OBJ=(OBJTYPE)_cll1_for_ptrs(_N++,__VA_ARGS__,NIL))!=(OBJTYPE)NIL ) _(_OBJ,METHOD); }
#define def_community(TYPE,INTERFACE) def_obj(TYPE) { INTERFACE __interface; };
#define anonymous void *
+/* variable declarators */
+#define Get_obj(ID,MEM,...) MEM ID=get_obj(MEM,__VA_ARGS__)
+#define Get_obj_as(ID,COMMUNITY,MEM,...) MEM ID=get_obj_as(COMMUNITY,MEM,INTERFACE,__VA_ARGS__)
#define I_am(MEM) MEM self=(MEM)community
/* .----------------------------------------------------------------------.
/ 9. implementation of C<<1 library functions, updated 2008-01-26 xCh.
#define _IMPLEMENT_CLL1_LIBRARY _INIT_VARIABLES _IMPL_FUNCTIONS _IMPL_INTERFACE
#define _PROGRAM _cll1_program
#define _DECLARE_PROGRAM void _PROGRAM(int argc, char **argv)
-#define program _IMPLEMENT_CLL1_LIBRARY _DECLARE_PROGRAM; int main(int argc, char **argv) { setlocale(LC_ALL, ""); _PROGRAM(argc,argv); return 0; } _DECLARE_PROGRAM
+#define program _IMPLEMENT_CLL1_LIBRARY _DECLARE_PROGRAM; int main(int argc, char **argv) { LANG=setlocale(LC_ALL, ""); _PROGRAM(argc,argv); return 0; } _DECLARE_PROGRAM
#ifdef USE_PREPROCESSOR
#include "_include.c"
#endif