[med-svn] [Git][med-team/libarb][master] 5 commits: Add symlink needed for PROBE_COM
Andreas Tille
gitlab at salsa.debian.org
Fri Jun 7 14:27:21 BST 2019
Andreas Tille pushed to branch master at Debian Med / libarb
Commits:
e3f08a3a by Andreas Tille at 2019-06-07T11:16:46Z
Add symlink needed for PROBE_COM
- - - - -
e3b6c501 by Andreas Tille at 2019-06-07T11:21:41Z
Keep all in AISC_COM/AISC since it seems to be needed by PROBE_COM
- - - - -
7d1ccade by Andreas Tille at 2019-06-07T11:22:37Z
New upstream version 6.0.6
- - - - -
8032890e by Andreas Tille at 2019-06-07T11:22:38Z
Update upstream source from tag 'upstream/6.0.6'
Update to upstream version '6.0.6'
with Debian dir ef0ffcec93ae61df8a7a2b1d368052a63f8962e8
- - - - -
4cb82a3c by Andreas Tille at 2019-06-07T13:26:08Z
Install static libs build in PROBE_COM
- - - - -
10 changed files:
- + AISC_COM/AISC/aisc.pa
- + AISC_COM/AISC/aisc_com.pa
- + AISC_COM/AISC/aisc_global.pa
- + AISC_COM/AISC/aisc_server.pa
- + AISC_COM/AISC/keys.README
- + AISC_COM/AISC/magic.lst
- debian/copyright
- debian/libarb-dev.install
- debian/patches/fix_main_makefile.patch
- debian/rules
Changes:
=====================================
AISC_COM/AISC/aisc.pa
=====================================
@@ -0,0 +1,206 @@
+GOTO main
+
+FUNCTION struct_contents
+ CREATE $(pre)
+ CREATE $(suf)
+
+ FOR $({/TYPE)
+ IF $(TYPE) = dllh
+ # dllh is "added" as base class by caller
+ ELSEIF $(REF) ~ %
+ ELSE
+ SET $(pre)
+ SET $(suf)
+ IF $(REF) ~ *
+ SET $(pre) *
+ ELSEIF $(REF) ~ v
+ SET $(suf) [$(SIZE|NO SIZE DEFINED)]
+ ENDIF
+ IF $(REF) ~ d
+ P dll_public$| p$(IDENT);
+ ENDIF
+ IF $(REF) ~ d,r,l,o
+ SET $(pre) $(pre)*
+ ENDIF
+ P $(TYPE|NO TYPE FOUND)$\
+ # align ' name' ' *name' '**name'
+ SET $(pre) '$(pre)'
+ P $|$(pre:''= :'*'= *:'**'=**:'=)$(IDENT)$(suf);$\
+ P $| // $(DOCU| *** )
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION define_type
+ P struct $(STRUCT) $\
+ FOR $({/TYPE.dllh)
+ P : public dll<$(STRUCT)> $\
+ ENDFOR
+ P { // $(SDOCU|$(STRUCT))
+ INDENT +1
+ CALL struct_contents
+ INDENT -1
+ P };
+RETURN
+
+FUNCTION datatypes
+ P // forward decl dll types
+ P struct dllpublic_ext;
+ P struct dllheader_ext;
+ --
+
+ FOR $(STRUCT.dll_public)
+ NEXT
+ ERROR mandatory STRUCT 'dll_public' is missing
+ ENDFOR
+ FOR $(STRUCT.dll_header)
+ NEXT
+ ERROR mandatory STRUCT 'dll_header' is missing
+ ENDFOR
+
+ P // "public" version of dll
+ FOR $(STRUCT.dll_public)
+ CALL define_type
+ ENDFOR
+ FOR $(STRUCT.dll_header)
+ CALL define_type
+ ENDFOR
+ --
+
+ P template <typename USERTYPE>
+ P struct dll {
+ INDENT +1
+ P dll_header mh; // ***ANOTHEROLIHACK**
+ P USERTYPE *previous, *next;
+ P int get_count() const { return mh.parent ? mh.parent->cnt : 0; }
+ INDENT -1
+ P };
+ --
+
+ P // "private" (i.e. real) version of dll (DoubledLinkedList)
+ P struct dllpublic_ext : public dll_public {
+ INDENT +1
+ P dllheader_ext$| *first;
+ INDENT -1
+ P };
+ P // pseudo-base-class of dll<USERTYPE> (bit-equal)
+ P struct dllheader_ext : dll<dllheader_ext> {}; // pseudo-base-class of dll<USERTYPE> (bit-equal)
+ --
+
+ P // forward decl user datatypes
+ FOR $(STRUCT)
+ IF $(STRUCT) ~ dll_header,dll_public
+ ELSE
+ P struct $(STRUCT);
+ ENDIF
+ ENDFOR
+ --
+
+ P // user defined datatypes
+ FOR $(STRUCT)
+ IF $(STRUCT) ~ dll_header,dll_public
+ ELSE
+ CALL define_type
+ ENDIF
+ ENDFOR
+ --
+
+RETURN
+
+FUNCTION constants
+ IF $(CONST)
+ P // some constants
+ FOR $(CONST)
+ P #define $(CONST) $|$(VALUE) $|// $(DOCU)
+ ENDFOR
+ --
+ ENDIF
+RETURN
+
+FUNCTION enums
+ IF $(ENUM)
+ ERROR never used before - please check generated code
+ P // the enums
+ FOR $(ENUM)
+ P $n// $(SDOCU|$(ENUM))
+ P typedef enum enum_$(ENUM) {
+ INDENT +1
+ FOR $({/VAR)
+ IF $(VAL)
+ P $(VAR)$| = $|$(VAL),$\
+ ELSE
+ P $(VAR),$|$\
+ ENDIF
+ IF $(DOCU)
+ P $|// $(DOCU)
+ ELSE
+ P
+ ENDIF
+ ENDFOR
+ INDENT -1
+ P } $(ENUM);
+ ENDFOR
+ --
+ ENDIF
+RETURN
+
+FUNCTION keys
+ P // the keys
+ P typedef enum enum_t_key {
+ INDENT +1
+ FOR $(STRUCT)
+ IF $(JOINED)
+ ELSEIF $(SKEY)
+ P KEY_$(OBJECT_KEY)_$(SKEY)$| = $|0x10000*$(SKEYC),
+ ENDIF
+ ENDFOR
+ P KEY_MAX
+ INDENT -1
+ P } t_key;
+ --
+RETURN
+
+# --------------------------------------------------------------------------------
+
+LABEL main
+IF $(argc) != 4
+ ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc.pa xxx.aisc outfile
+ENDIF
+
+DATA AISC { $(#FILE $(argv[2])) };
+DUMPDATA DUMP/aisc.pa__$(argv[2]).dump
+MOVETO $(/AISC/DATA/.)
+
+OPEN save $(argv[3])
+OUT save
+
+P // -----------------------------------------------------------------
+P // Created automagically from ../$(argv[2])
+P // using aisc-script '../AISC/aisc.pa'
+P // DO NOT EDIT THIS FILE!!!
+P // -----------------------------------------------------------------
+--
+P #ifndef AISC_GEN_SERVER_INCLUDED
+P #define AISC_GEN_SERVER_INCLUDED
+--
+P typedef char *aisc_string;
+P typedef const char *aisc_cstring;
+--
+P #ifndef AISC_GLOBAL_H
+P #include <aisc_global.h>
+P #endif
+P $(INCLUDE_INCLUDES)
+--
+CALL constants
+CALL enums
+CALL keys
+CALL datatypes
+P extern const char *aisc_server_error;
+--
+
+P #else
+P #error header included twice
+P #endif // AISC_GEN_SERVER_INCLUDED
+CLOSE save
+EXIT
+
=====================================
AISC_COM/AISC/aisc_com.pa
=====================================
@@ -0,0 +1,196 @@
+IF $(argc) != 4
+ ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc_com.pa xxx.aisc outfile
+ENDIF
+
+DATA AISC { $(#FILE $(argv[2])) };
+DUMPDATA DUMP/aisc_com.pa__$(argv[2]).dump
+
+OPEN save $(argv[3])
+MOVETO $(AISC/PROJECT)
+
+OUT save
+MOVETO $(DATA/.)
+
+P /* -----------------------------------------------------------------
+P * Created automagically from ../$(argv[2])
+P * using aisc-script '../AISC/aisc_com.pa'
+P * DO NOT EDIT THIS FILE!!!
+P * ----------------------------------------------------------------- */$n
+
+P #ifndef _LIMITS_H
+P #include <limits.h>
+P #endif
+P #ifndef AISC_GLOBAL_H
+P #include <aisc_global.h>
+P #endif
+
+P #ifndef AISC_MAX_OBJECT
+P # define AISC_MAX_OBJECT $(MAX_OBJECT)
+P # define AISC_MAX_ATTR $(MAX_KEY)
+P # define MAX_AISC_SET_GET $(MAX_PAR_CNT)
+P # define AISC_MAX_STRING_LEN $(MAX_STRING_LEN)
+P # define AISC_MESSAGE_BUFFER_LEN ((AISC_MAX_STRING_LEN/4+3)*($(MAX_PAR_CNT)+2))
+P # define AISC_MAGIC_NUMBER $(MAGIC_NUMBER)00
+--
+P struct aisc_com;
+--
+P const int AISC_GET $|= AISC_MAGIC_NUMBER+0;
+P const int AISC_SET $|= AISC_MAGIC_NUMBER+1;
+P const int AISC_NSET $|= AISC_MAGIC_NUMBER+2;
+P const int AISC_CREATE $|= AISC_MAGIC_NUMBER+3;
+P const int AISC_FIND $|= AISC_MAGIC_NUMBER+4;
+P const int AISC_COPY $|= AISC_MAGIC_NUMBER+5;
+P const int AISC_DELETE $|= AISC_MAGIC_NUMBER+6;
+P const int AISC_INIT $|= AISC_MAGIC_NUMBER+7;
+P const int AISC_DEBUG_INFO $|= AISC_MAGIC_NUMBER+8;
+--
+P const int AISC_CCOM_OK $|= AISC_MAGIC_NUMBER+0;
+P const int AISC_CCOM_ERROR $|= AISC_MAGIC_NUMBER+1;
+P const int AISC_CCOM_MESSAGE $|= AISC_MAGIC_NUMBER+2;
+--
+P #endif
+--
+FOR $(ENUM)
+ IF $(SKEY)
+ CREATE $(my_attribute[$(ENUM)]) $(OBJECT_KEY)_ATTR_$(SKEY)
+ ENDIF
+ENDFOR
+--
+P #define $(OBJECT_KEY)_ATTR_INT(a,b) $|(((a)+(b))|0x1000000)
+FOR $(ENUM)
+ IF $(SKEY)
+ P #define $(OBJECT_KEY)_ATTR_$(SKEY)(a,b) $|(((a)+(b))|0x1000000)
+ ENDIF
+ENDFOR
+P #define $(OBJECT_KEY)_ATTR_DOUBLE(a,b) $|(((a)+(b))|0x2000000)
+P #define $(OBJECT_KEY)_ATTR_STRING(a,b) $|(((a)+(b))|0x3000000)
+CREATE $(my_attribute[char]) $(OBJECT_KEY)_ATTR_INT
+CREATE $(my_attribute[int]) $(OBJECT_KEY)_ATTR_INT
+CREATE $(my_attribute[func]) $(OBJECT_KEY)_ATTR_INT
+CREATE $(my_attribute[t_key]) $(OBJECT_KEY)_ATTR_INT
+CREATE $(my_attribute[dllheader_ext]) $(OBJECT_KEY)_ATTR_INT
+CREATE $(my_attribute[double]) $(OBJECT_KEY)_ATTR_DOUBLE
+CREATE $(my_attribute[aisc_string]) $(OBJECT_KEY)_ATTR_STRING
+CREATE $(my_attribute[bytestring]) $(OBJECT_KEY)_ATTR_BYTES
+FOR $(STRUCT)
+ IF $(JOINED)
+ ELSEIF $(SKEY)
+ P #define $(OBJECT_KEY)_ATTR_$(SKEY)(a,b) $|(((a)+(b))|0x4000000)
+ CREATE $(my_attribute[$(STRUCT)]) $(OBJECT_KEY)_ATTR_$(SKEY)
+ ENDIF
+ENDFOR
+P #define $(OBJECT_KEY)_ATTR_BYTES(a,b) $|(((a)+(b))|0x5000000)
+--
+P enum Aisc_Object_Type {
+INDENT +1
+ FOR $(STRUCT)
+ IF $(JOINED)
+ ELSEIF $(SKEY)
+ P $(OBJECT_KEY)_$(SKEY) $|= 0x10000*$(SKEYC),
+ ENDIF
+ ENDFOR
+ P $(OBJECT_KEY)_MAX $|= 0x10000*$(MAX_OBJECT),
+ P $(OBJECT_KEY)_INDEX $|= 0x10000*0x1ff
+INDENT -1
+P };
+--
+FOR $(STRUCT)
+ IF $(JOINED)
+ ELSEIF $(SKEY)
+ P struct T_$(OBJECT_KEY)_$(SKEY) : public AISC_Object {
+ INDENT +1
+ P T_$(OBJECT_KEY)_$(SKEY)() : AISC_Object($(OBJECT_KEY)_$(SKEY)) {}
+ P void assign(const T_$(OBJECT_KEY)_$(SKEY)& o) { set(o.type(), o.get()); }
+ INDENT -1
+ P };
+ ENDIF
+ENDFOR
+--
+
+CREATE $(A)
+CREATE $(add) 0
+CREATE $(str) 0
+CREATE $(skey) 0
+CREATE $(struct) 0
+CREATE $(com)
+
+FOR $(STRUCT)
+ IF $(SKEY)
+ PUSH
+ IF $(JOINED)
+ ELSE
+ P enum $(OBJECT_KEY)_$(SKEY)_Attribute { // $(SKEY)
+ INDENT +1
+ ENDIF
+ SET $(skey) $(SKEY)
+ SET $(struct) $(STRUCT)
+ CALL insert_struct_attributes,0,$(SKEY)_,//
+ IF $(JOIN_NEXT)
+ ELSE
+ P $(SKEY)_FORCELONG $|= LONG_MAX
+ INDENT -1
+ P };
+ --
+ ENDIF
+ POP
+ ENDIF
+ENDFOR
+CLOSE save
+
+EXIT
+
+FUNCTION insert_struct_attributes,a,s,c
+ FOR $({/TYPE)
+ IF $(KEY)
+ IF $(TYPE) = dllh
+ P $(s)PRED $|= $\
+ P $(my_attribute[$(struct)])$\
+ P $|($(OBJECT_KEY)_$(skey), $(+ $(a)+$(KEYC))), $|// DO
+
+ P $(s)NEXT $|= $\
+ P $(my_attribute[$(struct)])$\
+ P $|($(OBJECT_KEY)_$(skey), $(+ 1+$(+ $(a)+$(KEYC)))), $|$(c)
+
+ SET $(add) $(+ $(a)+$(KEYC))
+ SET $(add) $(+ 2+$(add))
+ SET $(str) $(s)$(KEY)
+ PUSH
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ CALL insert_struct_attributes,$(add),$(str),$(c) H
+ POP
+ ELSEIF $(REF) ~ s
+ SET $(add) $(+ $(a),$(KEYC))
+ SET $(str) $(s)$(KEY)
+ SET $(com) $(c) S
+ PUSH
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ CALL insert_struct_attributes,$(add),$(str),$(com)
+ POP
+ ELSE
+ IF $(REF) ~ d
+ SET $(com) $(c) DL
+ ELSEIF $(REF) ~ v
+ SET $(com) $(c) [$(SIZE)]
+ ELSEIF $(REF) ~ *
+ SET $(com) $(c) []
+ ELSEIF $(TYPE) = func
+ SET $(com) $(c) FUNC
+ ELSE
+ SET $(com) $(c)
+ ENDIF
+ IF $(my_attribute[$(TYPE)])
+ P $(s)$(KEY) $|= $\
+ P $(my_attribute[$(TYPE)])$\
+ P $|($(OBJECT_KEY)_$(skey), $(+ $(a)+$(KEYC))), $|$(com)
+ ELSE
+ ERROR TYPE $(TYPE) unknown, no key build
+ ENDIF
+ IF $(REF) ~ d
+ P $(s)$(KEY)_CNT $|= $\
+ P $(my_attribute[int])$\
+ P $|($(OBJECT_KEY)_$(skey), $(+ 1,$(+ $(a)+$(KEYC)))), $|$(com)
+ ENDIF
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
=====================================
AISC_COM/AISC/aisc_global.pa
=====================================
@@ -0,0 +1,203 @@
+IF $(argc) < 5
+ ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc_global.pa xxx.aisc outfile extern_file
+ENDIF
+
+DATA AISC { $(#FILE $(argv[2])) };
+DUMPDATA DUMP/aisc_global.pa__$(argv[2]).dump
+OPEN save $(argv[3])
+
+MOVETO $(AISC/PROJECT)
+CREATE $(pre) = $(OBJECT_KEY)_
+CREATE $(max_key) = $(MAX_KEY)
+CREATE $(max_obj) = $(MAX_OBJECT)
+CREATE $(i)
+CREATE $(termlist) = $10$n};$n
+
+OUT save
+
+MOVETO $(DATA/.)
+
+P /* -----------------------------------------------------------------
+P * Created automagically from ../$(argv[2])
+P * and ../$(argv[4])
+P * using aisc-script '../AISC/aisc_global.pa'
+P * DO NOT EDIT THIS FILE!!!
+P * ----------------------------------------------------------------- */
+--
+P #include <aisc_server.h>
+--
+
+# create and clear obj and key list
+FOR $(i) = 0 TO $(max_obj)
+ CREATE $(obj[$(i)]) = 0,
+ENDFOR
+FOR $(i) = 0 TO $(max_key)
+ CREATE $(key[$(i)]) = 0,
+ENDFOR
+
+# generate object names struct
+FOR $(STRUCT)
+ IF $(SKEY)
+ IF $(obj[$(SKEYC)])
+ SET $(obj[$(SKEYC)]) = "$(pre)$(SKEY)",
+ ELSE
+ ERROR Increase definition of MAX_OBJECT to $(SKEYC)
+ ENDIF
+ ENDIF
+ENDFOR
+
+P const char *aisc_object_names[] = {
+GOSUB printobjlist
+P $(termlist)
+
+# generate attribute names structs
+CREATE $(nummer)
+CREATE $(aisc_string)
+FOR $(STRUCT)
+ IF $(SKEY)
+ GOSUB clearkeylist
+ SET $(nummer) = 0
+ SET $(aisc_string) = $(pre)$(SKEY)_
+ P static const char *$(pre)$(STRUCT)_attribute_names[] = {
+ GOSUB make_attr_names
+ GOSUB printkeylist
+ P $(termlist)
+ ENDIF
+ENDFOR
+P $n
+
+# generate attribute names struct list
+GOSUB clearobjlist
+P const char *aisc_attribute_names_list[] = {
+FOR $(STRUCT)
+ IF $(SKEY)
+ SET $(obj[$(SKEYC)]) = (const char *)$(pre)$(STRUCT)_attribute_names,
+ ENDIF
+ENDFOR
+GOSUB printobjlist
+P $(termlist)
+
+# generate function structs
+P typedef int* (*talking_function)(int *x, ...);
+P typedef talking_function *talking_function_ptr;
+--
+FOR $(STRUCT)
+ P extern talking_function aisc_talking_functions_create_$(STRUCT)[];
+ P extern int *((*(aisc_talking_functions_get_$(STRUCT)[]))());
+ P extern int *((*(aisc_talking_functions_find_$(STRUCT)[]))());
+ P extern int *((*(aisc_talking_functions_copy_$(STRUCT)[]))());
+ P extern int ((*(aisc_talking_functions_set_$(STRUCT)[]))());
+ --
+ENDFOR
+
+# generate d flags
+P int aisc_d_flags[] = {
+GOSUB clearkeylist
+FOR $(STRUCT)
+ IF $(SKEY)
+ SET $(i) = 0
+ FOR $({/TYPE)
+ IF $(TYPE) = dllh
+ SET $(i) = 1
+ ENDIF
+ ENDFOR
+ SET $(key[$(SKEYC)]) = $(i),$6// $(SKEY)
+ ENDIF
+ENDFOR
+GOSUB printkeylist
+P $(termlist)
+
+# generate callback tables
+P int *((**(aisc_talking_functions_get[]))()) = {
+GOSUB print_talking_table,aisc_talking_functions_get_
+
+P int ((**(aisc_talking_functions_set[]))()) = {
+GOSUB print_talking_table,aisc_talking_functions_set_
+
+P int *((**(aisc_talking_functions_find[]))()) = {
+GOSUB print_talking_table,aisc_talking_functions_find_
+
+P int *((**(aisc_talking_functions_copy[]))()) = {
+GOSUB print_talking_table,aisc_talking_functions_copy_
+
+P talking_function* aisc_talking_functions_create[] = {
+GOSUB print_talking_table,aisc_talking_functions_create_
+
+P aisc_destroy_callback aisc_talking_functions_delete[] = {
+GOSUB print_talking_table_casted,destroy_,(aisc_destroy_callback)
+
+# FINISH
+P #undef __P
+CLOSE save
+EXIT
+
+# -----------------
+# FUNCTIONS
+
+FUNCTION print_talking_table,name
+ CALL print_talking_table_casted,$(name),
+RETURN
+
+FUNCTION print_talking_table_casted,name,cast
+ GOSUB clearkeylist
+ FOR $(STRUCT)
+ IF $(SKEY)
+ SET $(key[$(SKEYC)]) = $(cast)$(name)$(STRUCT),
+ ENDIF
+ ENDFOR
+ GOSUB printkeylist
+ P $(termlist)
+RETURN
+
+FUNCTION make_attr_names
+ CREATE $(nr) = $(nummer)
+ CREATE $(s) = $(aisc_string)
+ FOR $({/TYPE)
+ IF $(KEY)
+ IF $(REF) ~ s
+ PUSH
+ SET $(nummer) = $(+ $(nr)+$(KEYC) )
+ SET $(aisc_string) = $(s)$(KEY)_
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ GOSUB make_attr_names
+ POP
+ ELSEIF $(REF) ~ d
+ SET $(key[$(+ $(+ $(nr)+1)+$(KEYC))])="$(s)$(KEY)CNT",
+ SET $(key[$(+ $(nr)+$(KEYC))]) = "$(s)$(KEY)",
+ ELSEIF $(TYPE) = dllh
+ PUSH
+ SET $(nummer) = $(+ 2+$(+ $(nr)+$(KEYC) ))
+ SET $(aisc_string) = $(s)$(KEY)
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ GOSUB make_attr_names
+ POP
+ SET $(key[$(+ $(nr)+0)]) = "$(s)PREVIOUS",
+ SET $(key[$(+ $(nr)+1)]) = "$(s)NEXT",
+ ELSE
+ SET $(key[$(+ $(nr)+$(KEYC))]) = "$(s)$(KEY)",
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION clearkeylist
+ FOR $(i) = 0 TO $(max_key)
+ SET $(key[$(i)]) = 0,
+ ENDFOR
+RETURN
+FUNCTION clearobjlist
+ FOR $(i) = 0 TO $(max_obj)
+ SET $(obj[$(i)]) = 0,
+ ENDFOR
+RETURN
+FUNCTION printkeylist
+ FOR $(i) = 0 TO $(max_key)
+ P $1$(key[$(i)])
+ ENDFOR
+RETURN
+FUNCTION printobjlist
+ FOR $(i) = 0 TO $(max_obj)
+ P $1$(obj[$(i)])
+ ENDFOR
+RETURN
+
=====================================
AISC_COM/AISC/aisc_server.pa
=====================================
@@ -0,0 +1,1157 @@
+# set to 1 to trace object creation/destruction
+CREATE $(TRACE) = 0
+
+GOTO main
+
+
+FUNCTION return_ifnot conds
+ IF $(conds) ~ &
+ P if (!($(conds:# && =))) return $(INIT|0);
+ ENDIF
+RETURN
+
+FUNCTION index_or_return index,return
+ IF $(index) !~ #
+ P int index = aisc_talking_get_index(0, $(index));
+ SET $(return) return $(return);
+ P if (aisc_server_error) $(return: ;=;);
+ ENDIF
+RETURN
+
+FUNCTION define_callback a,type,func
+ CONST $(a) # releative key
+ CONST $(type) # function type (get, set etc.)
+ CONST $(func) # function name
+
+ CREATE $(num) = $(+ $(a)+$(KEYC))
+ CREATE $(cb) $(type)_list[$(num)]
+ # $(cb) contains name of callback variable
+
+ IF $($(cb))
+ IF $($(cb)) ~ 0
+ ELSE
+ ERROR Number $(KEYC) for '$(func)' already in use by '$($(cb))'
+ ENDIF
+ ELSE
+ ERROR Invalid number $(KEYC) for '$(func)'. Increase MAX_KEY to $(num) in $(argv[2])
+ ENDIF
+ SET $($(cb)) = $(func)
+RETURN
+
+FUNCTION accessors struct,a,c
+ # struct = struct/member name
+ # a = relative key (int)
+ # c = conditions
+
+ CONST $(struct)
+ CONST $(a)
+ CONST $(c)
+
+ CREATE $(su) $(setup)
+ CREATE $(ac) $(access)
+ CREATE $(in) $(index)
+
+ CONST $(su)
+ CONST $(ac)
+ CONST $(in)
+
+ CREATE $(type)
+ CREATE $(member)
+ CREATE $(conds)
+ CREATE $(fun)
+
+ FOR $({/KEY)
+ SET $(member) $(struct)$(KEY)
+ SET $(conds) $(c)
+ SET $(setup) $(su)
+
+ IF $(TYPE) = dllh
+ SET $(fun) get_$(member)PRED
+ CALL define_callback $(a),get,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ P static $(maintype) *$(fun)(const $(maintype) *THIS) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ #P return ($(maintype) *)$(ac)previous;
+ P return $(ac)previous;
+ INDENT -1
+ P }
+ ENDIF
+
+ SET $(fun) get_$(member)NEXT
+ CALL define_callback $(+ $(a)+1),get,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ P static $(maintype) *$(fun)(const $(maintype) *THIS) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ #P return ($(maintype) *)$(ac)next;
+ P return $(ac)next;
+ INDENT -1
+ P }
+ ENDIF
+
+ PUSH
+ CREATE $(subadd) $(+ 2+$(+ $(a)+$(KEYC)))
+ SET $(access) $(ac)$(IDENT).
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ GOSUB accessors $(member),$(subadd),$(conds)
+ POP
+ CONTINUE
+ ENDIF
+
+ SET $(index) $(in)
+ SET $(access) $(ac)$(IDENT)
+
+ IF $(REF) ~ *
+ SET $(conds) $(conds) && $(access)
+ SET $(index) $(SIZE:THIS->=$(ac))
+ IF $(REF) ~ o,d,l,r
+ SET $(type) $(TYPE) *
+ ELSE
+ SET $(type) $(TYPE)
+ ENDIF
+ SET $(setup) $(setup)if (!$(access)) $(access) = ($(type)*)calloc(sizeof($(type)),$(index));$n
+ SET $(access) $(access)[index]
+ ELSEIF $(REF) ~ v
+ SET $(index) $(SIZE:THIS->=$(ac))
+ SET $(access) $(access)[index]
+ ENDIF
+
+ IF $(REF) ~ s
+ IF $(REF) ~ o,l,r
+ SET $(conds) $(conds) && $(access)
+ SET $(setup) $(setup)if (!$(access)) $(access) = create_$(TYPE)();$n
+ SET $(access) $(access)->
+ ELSEIF $(REF) ~ i
+ SET $(access) $(access).
+ ENDIF
+
+ PUSH
+ CREATE $(subadd) = $(+ $(a)+$(KEYC))
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ CALL accessors $(member),$(subadd),$(conds)
+ POP
+ CONTINUE
+ ENDIF
+
+ IF $(REF) ~ o,d
+ IF $(ACC) !~ c
+ ELSE
+ # CREATE FUNCTIONS
+ SET $(fun) create_$(member)
+ CALL define_callback $(a),create,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ P static $(TYPE) *$(fun)($(maintype) *THIS) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ CALL index_or_return $(index),0
+ P $(TYPE) *obj = create_$(TYPE)();
+ P if (obj) {
+ INDENT +1
+ P aisc_make_sets((long *)obj);
+ P if (aisc_server_error) {
+ INDENT +1
+ P destroy_$(TYPE)(obj);
+ P obj = NULL;
+ INDENT -1
+ P }
+ P else {
+ INDENT +1
+ IF $(REF) ~ d
+ P aisc_server_error = aisc_link((dllpublic_ext*)&($(ac)p$(IDENT)), (dllheader_ext*)obj);
+ ELSE
+ P if ($(access)) destroy_$(TYPE)($(access));
+ P $(access) = obj;
+ ENDIF
+ INDENT -1
+ P }
+ INDENT -1
+ P }
+ P return obj;
+ INDENT -1
+ P }
+ ENDIF
+
+ # COPY FUNCTIONS
+ SET $(fun) copy_$(member)
+ CALL define_callback $(a),copy,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ P static $(TYPE) *$(fun)($(maintype) *THIS) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ CALL index_or_return $(index),0
+ P trf_begin();
+ P $(TYPE) *obj = copy_$(TYPE)($(access));
+ P trf_commit(0);
+ P if (obj) {
+ INDENT +1
+ P aisc_make_sets((long *)obj);
+ P if (aisc_server_error) {
+ INDENT +1
+ P destroy_$(TYPE)(obj);
+ P obj = NULL;
+ INDENT -1
+ P }
+ P else {
+ INDENT +1
+ IF $(REF) ~ d
+ P aisc_server_error = aisc_link((dllpublic_ext*)&($(ac)p$(IDENT)), (dllheader_ext*)obj);
+ ELSE
+ P if ($(access)) destroy_$(TYPE)($(access));
+ P $(access) = obj;
+ ENDIF
+ INDENT -1
+ P }
+ INDENT -1
+ P }
+ P return obj;
+ INDENT -1
+ P }
+ ENDIF
+ ENDIF
+ # FIND FUNCTIONS
+ IF $(ACC) !~ f
+ ELSEIF $(REF) ~ d
+ SET $(fun) find_$(member)
+ CALL define_callback $(a),find,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ P static $(TYPE) *$(fun)(const $(maintype) *THIS, const char *key) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ P $(TYPE) *obj = ($(TYPE)*)aisc_read_hash((aisc_hash_node**)$(ac)p$(IDENT).hash, key);
+ P return obj;
+ INDENT -1
+ P }
+ ENDIF
+ ENDIF
+ # CNT FUNCTION
+ IF $(REF) ~ d
+ SET $(fun) get_$(member)_CNT
+ CALL define_callback $(+ $(a)+1),get,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ P static int $(fun)(const $(maintype) *THIS) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ P return $(ac)p$(IDENT).cnt;
+ INDENT -1
+ P }
+ ENDIF
+ ENDIF
+ ELSE
+ # not $(REF) ~ o,d
+
+ # SET FUNCTIONS
+ IF $(ACC) !~ w
+ ELSEIF $(REF) ~ $(v)
+ CALL define_callback $(a),set,$(IDENT)
+ IF $(extern_$(IDENT))
+ ELSE
+ OUT import # Generate Prototypes for import
+ P extern int $1$(IDENT)($(maintype)*, $(TYPE:bytestring=bytestring *));
+ OUT save
+ ENDIF
+ ELSE
+ SET $(fun) set_$(member)
+ CALL define_callback $(a),set,$(fun)
+ IF $(extern_$(fun))
+ ELSE
+ IF $(REF) ~ o,l,r
+ P static void $(fun)($(maintype) *THIS, const $(TYPE) *x) {
+ ELSEIF $(REF) ~ t,e
+ P static void $(fun)($(maintype) *THIS, $(TYPE:bytestring=const bytestring *) x) {
+ ELSE
+ ERROR UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+ INDENT +1
+ CALL index_or_return $(index),
+ P $(setup)$\
+ IF $(TYPE) = aisc_string
+ P freeset($(access), x);
+ ELSEIF $(TYPE) = bytestring
+ P if (x) {
+ P $1freeset($(access).data, x->data);
+ P $1$(access).size = x->size;
+ P }
+ P else {
+ P $1freenull($(access).data);
+ P $1$(access).size = 0;
+ P }
+ ELSE
+ IF $(REF) ~ o
+ P if ($(access)) destroy_$(TYPE)($(access));
+ ENDIF
+ P $(access) = x;
+ ENDIF
+ INDENT -1
+ P }
+ ENDIF
+ ENDIF
+ ENDIF
+
+ # GET FUNCTIONS
+ IF $(ACC) !~ r
+ ELSEIF $(REF) ~ $(v)
+ IF $(extern_$(IDENT))
+ CALL define_callback $(a),get,$(IDENT)
+ ELSE
+ IF $(IDENT) = aisc_get_keystring
+ # special cast for aisc_get_keystring
+ CALL define_callback $(a),get,(const char*(*)(int*))$(IDENT)
+ ELSE
+ # explicit cast to overloaded function type before casting to void
+ CALL define_callback $(a),get,($(TYPE:bytestring=bytestring *)(*)(const $(maintype)*))$(IDENT)
+ ENDIF
+ OUT import # Generate Prototypes for import
+ P extern $(TYPE:bytestring=bytestring *) $(IDENT)(const $(maintype)*);
+ OUT save
+ ENDIF
+ ELSE
+ CALL define_callback $(a),get,get_$(member)
+ IF $(extern_get_$(member))
+ ELSE
+ P static $\
+ IF $(REF) ~ o,l,r,d
+ P const $(TYPE) *get_$(member)$\
+ ELSEIF $(REF) ~ e,t
+ P $(TYPE:bytestring=const bytestring *:aisc_string=aisc_cstring) get_$(member)$\
+ ELSE
+ ERROR UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+ P (const $(maintype) *THIS) {
+ INDENT +1
+ CALL return_ifnot $(conds)
+ CALL index_or_return $(index),0
+ IF $(TYPE) = bytestring
+ P return &($(access));
+ ELSE
+ P return $(access);
+ ENDIF
+ INDENT -1
+ P }
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION accessor_table fun
+ P void *aisc_talking_functions_$(fun)_$(STRUCT)[] = {
+ INDENT +1
+ CREATE $(i)
+ CREATE $(cb)
+ CREATE $(zeros)
+ FOR $(i) = 0 TO $(MAX_KEY)
+ SET $(cb) = $($(fun)_list[$(i)])
+ IF $(cb) = 0
+ # collect multiple '0' to print them in one line
+ SET $(zeros) = $(zeros) 0,
+ ELSE
+ IF $(zeros) !=
+ P $(zeros)
+ SET $(zeros)
+ ENDIF
+
+ IF $(cb) ~ /*
+ SET $(cb) = $(cb:/*=,/*: ,/*=,/*:,/*=, /*)
+ ELSEIF $(cb) ~ //
+ SET $(cb) = $(cb://=,//: ,//=,//:,//=, //)
+ ELSE
+ SET $(cb) = $(cb),
+ ENDIF
+
+ P (void *)$(cb)
+ ENDIF
+ ENDFOR
+ IF $(zeros) !=
+ P $(zeros) 0
+ ELSE
+ P 0
+ ENDIF
+ INDENT -1
+ P };
+RETURN
+
+FUNCTION accessor_tables
+ CALL accessor_table get
+ CALL accessor_table set
+ CALL accessor_table create
+ CALL accessor_table find
+ CALL accessor_table copy
+ --
+RETURN
+
+FUNCTION build_accessors
+ # init callback tables
+ CREATE $(i) = 0
+ FOR $(i) = 0 TO $(MAX_KEY)
+ CREATE $(set_list[$(i)]) 0
+ CREATE $(get_list[$(i)]) 0
+ CREATE $(create_list[$(i)]) 0
+ CREATE $(find_list[$(i)]) 0
+ CREATE $(copy_list[$(i)]) 0
+ ENDFOR
+
+ #CREATE $(conds)
+ CREATE $(access)
+ CREATE $(maintype)
+ CREATE $(setup)
+ CREATE $(index) #
+
+ CREATE $(joined)
+
+ FOR $(STRUCT)
+ IF $(SKEY)
+ P // $(STRUCT) accessors
+ --
+
+ IF $(JOINED)
+ ELSE
+ FOR $(i) = 0 TO $(MAX_KEY)
+ SET $(set_list[$(i)]) 0
+ SET $(get_list[$(i)]) 0
+ SET $(create_list[$(i)]) 0
+ SET $(find_list[$(i)]) 0
+ SET $(copy_list[$(i)]) 0
+ ENDFOR
+ ENDIF
+ #SET $(conds) = #
+ SET $(access) THIS->
+ SET $(maintype) $(STRUCT)
+ # 'setup' can not be transformed to parameter, cause it is
+ # assigned sth containing ,; etc. so we need to use a global here :-(
+ SET $(setup)
+ SET $(index) #
+ GOSUB accessors $(SKEY)_,0,#
+ --
+
+ IF $(JOIN_NEXT)
+ SET $(joined) = $(joined) $(STRUCT)
+ ELSE
+ P // $(joined) $(STRUCT) callback tables
+ SET $(joined) =
+ GOSUB accessor_tables
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+# --------------------------------------------------------------------------------
+
+FUNCTION init_structure,self,deref
+ CREATE $(member)
+ CREATE $(isloop)
+
+ FOR $({/TYPE)
+ SET $(member) $(self)$(deref)$(IDENT)
+ SET $(isloop) 0
+ IF $(REF) ~ $(v)
+ ELSE
+ IF $(REF) ~ v
+ SET $(isloop) 1
+ PMSTART
+ PM for (int index = 0; index < $(SIZE:THIS->=$(self)$(deref)); index++) {
+ INDENT +1
+ SET $(member) $(member)[index]
+ ENDIF
+ IF $(TYPE) = dllh
+ P $(member).key $|= KEY_$(OBJECT_KEY)_$(SKEY|COMMON);
+ PUSH
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ GOSUB init_structure,$(member),.
+ POP
+ ELSEIF $(REF) ~ o
+ # just a NULL pointer - no init necessary
+ ELSEIF $(REF) ~ d
+ PUSH
+ SET $(member) = $(self)$(deref)p$(IDENT)
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ P $(member).parent $|= (dllheader_ext *)$(self);
+ P $(member).key $|= KEY_$(OBJECT_KEY)_$(SKEY|SKEY_missing);
+ POP
+ ELSEIF $(REF) ~ s
+ IF $(REF) ~ i
+ PUSH
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ GOSUB init_structure,$(member),.
+ POP
+ ENDIF
+ ELSEIF $(REF) ~ t,e,l
+ IF $(IDENT) = key
+ IF $(SKEY) !~ COMMON
+ P $(member) $|= KEY_$(OBJECT_KEY)_$(SKEY|COMMON);
+ ENDIF
+ ELSEIF $(INIT)
+ IF $(TYPE) = aisc_string
+ P $(member) $|= strdup($(INIT:THIS=$(self)));
+ ELSE
+ P $(member) $|= $(INIT:THIS=$(self));
+ ENDIF
+ ENDIF
+ ELSE
+ ERROR UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+ IF $(isloop) = 1
+ INDENT -1
+ PM }
+ PMEND
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION build_init
+ P // ------------
+ P // constructors
+ --
+ P inline void alloc_err(const char *objectname) {
+ P $1aisc_server_errorf("Could not allocate '%s'", objectname);
+ P }
+ --
+
+ FOR $(STRUCT)
+ IF $(extern_create_$(STRUCT))
+ ELSE
+ P $(STRUCT) *create_$(STRUCT)()$\
+ P {
+ INDENT +1
+ P $(STRUCT) *o = ($(STRUCT)*)calloc(sizeof(*o), 1);
+ P if (!o) alloc_err("$(STRUCT)");
+ PMSTART
+ PM else {
+ INDENT +1
+ GOSUB init_structure o,->
+ INDENT -1
+ PM }
+ PMEND
+ GOSUB trace "created $(STRUCT)"
+ P return o;
+ INDENT -1
+ P }
+ ENDIF
+ --
+ ENDFOR
+RETURN
+
+FUNCTION delete_structure,self,deref
+ CREATE $(member)
+ CREATE $(isloop)
+ CREATE $(isinif)
+ CREATE $(start)
+
+ FOR $({/TYPE)
+ SET $(member) $(self)$(deref)$(IDENT)
+ SET $(isloop) 0
+ SET $(isinif) 0
+
+ IF $(DESTROY)
+ P $(DESTROY:THIS=obj);
+ ELSEIF $(REF) ~ $(v)
+ # virtual function
+ ELSE
+ IF $(REF) ~ *,v
+ PMSTART
+ IF $(REF) ~ *
+ SET $(isinif) 1
+ PM if ($(member)) {
+ INDENT +1
+ ENDIF
+ SET $(isloop) 1
+ PM for (int index = 0; index < $(SIZE:THIS->=$(self)$(deref)); index++) {
+ INDENT +1
+ SET $(member) $(member)[index]
+ ENDIF
+ IF $(TYPE) = dllh
+ PUSH
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ GOSUB delete_structure,$(member),.
+ POP
+ ELSEIF $(REF) ~ s
+ IF $(REF) ~ o,d,i
+ PUSH
+ IF $(REF) ~ i
+ CREATE $(subderef) .
+ ELSE
+ P if ($(member)) {
+ INDENT +1
+ CREATE $(subderef) ->
+ ENDIF
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ GOSUB delete_structure,$(member),$(subderef)
+ POP
+ IF $(REF) !~ i
+ P free($(member));
+ INDENT -1
+ P }
+ ENDIF
+ ENDIF
+ ELSEIF $(REF) ~ d,o
+ IF $(REF) ~ d
+ P while $\
+ ELSE
+ P if $\
+ ENDIF
+ P ($(member)) {
+ INDENT +1
+ P destroy_$(TYPE)($(member));
+ P if (aisc_server_error) return;
+ INDENT -1
+ P }
+ ELSEIF $(REF) ~ t,e
+ IF $(TYPE) = aisc_string
+ P free($(member));
+ ELSEIF $(TYPE) = bytestring
+ P free($(member).data);
+ ENDIF
+ ELSEIF $(REF) ~ l
+ ELSE
+ ERROR UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+
+ IF $(isloop) = 1
+ INDENT -1
+ PM }
+ IF $(isinif) = 1
+ INDENT -1
+ PM }
+ ENDIF
+ PMEND
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION build_delete
+ P // -----------
+ P // destructors
+ --
+
+ FOR $(STRUCT)
+ IF $(extern_destroy_$(STRUCT))
+ ELSE
+ PUSH
+ CREATE $(islinked) = 0
+ CREATE $(ident)
+
+ PUSH
+ MOVETO $({/.)
+ IF $(TYPE) = dllh
+ SET $(islinked) = 1
+ SET $(ident) = $(IDENT)
+ ENDIF
+ POP
+
+ # pass pointers to not-linked objects by reference and set them to NULL below
+ # linked object-pointers are set to NULL by aisc_unlink
+ P void destroy_$(STRUCT)($(STRUCT)$\
+ IF $(islinked) = 1
+ P *obj$\
+ ELSE
+ P *& obj$\
+ ENDIF
+ P ) {
+ INDENT +1
+ IF $(islinked) = 1
+ P if (obj->$(ident).parent) {
+ INDENT +1
+ P aisc_unlink((dllheader_ext*)obj);
+ P if (aisc_server_error) return;
+ INDENT -1
+ P }
+ ENDIF
+ GOSUB delete_structure,obj,->
+ IF $(islinked) = 1
+ P free(obj);
+ ELSE
+ P freenull(obj);
+ ENDIF
+ GOSUB trace "destroyed $(STRUCT)"
+ INDENT -1
+ P }
+ --
+ POP
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION move_structure
+ CREATE $(isloop)
+ CREATE $(my_key)
+ CREATE $(index)
+ CREATE $(access)
+
+ FOR $({/TYPE)
+ SET $(index)
+ SET $(access) $(IDENT)
+ SET $(isloop) 0
+ IF $(REF) ~ $(v)
+ ELSEIF $(IDENT) = key
+ ELSE
+ IF $(REF) ~ *,v
+ IF $(SIZE)
+ SET $(index) $(SIZE:THIS->=sobj->)
+ ELSE
+ ERROR Missing SIZE in STRUCT $(STRUCT) ident $(IDENT)
+ ENDIF
+ IF $(REF) ~ *
+ P if (dobj->$(access))$\
+ ENDIF
+
+ SET $(isloop) 1
+ PMSTART
+ PM for (int index = 0; index < $(index); index++) {
+ INDENT +1
+ SET $(access) $(access)[index]
+ ENDIF
+ IF $(TYPE) = dllh
+ P move_dll_header(&(sobj->$(access)), &(dobj->$(access)));
+ ELSEIF $(REF) ~ l,r
+ P dobj->$(access) $|= sobj->$(access); $\
+ P $|trf_link((long)sobj->$(access), (long*)&dobj->$(access));
+ ELSEIF $(REF) ~ o
+ P dobj->$(access) $|= copy_$(TYPE)(sobj->$(access));
+ ELSEIF $(REF) ~ d
+ P for ($(TYPE) *cobj = sobj->$(access); cobj; cobj = cobj->next) {
+ INDENT +1
+ P $(TYPE) *d2obj = copy_$(TYPE)(cobj);
+ P if (!d2obj) return 1;
+ P aisc_server_error = aisc_link((dllpublic_ext*)&(dobj->p$(access)), (dllheader_ext*)d2obj);
+ P if (aisc_server_error) return 1;
+ INDENT -1
+ P }
+ ELSEIF $(REF) ~ s
+ IF $(REF) ~ i
+ P if (move_$(TYPE)(&(sobj->$(access)), &(dobj->$(access)))) return 1;
+ ENDIF
+ ELSEIF $(REF) ~ t,e
+ IF $(TYPE) = aisc_string
+ P dobj->$(access) $|= nulldup(sobj->$(access));
+ ELSEIF $(TYPE) = bytestring
+ P if (sobj->$(access).data) {
+ INDENT +1
+ P dobj->$(access).data = (char *)malloc(sobj->$(access).size);
+ P memcpy(dobj->$(access).data, sobj->$(access).data, sobj->$(access).size);
+ P dobj->$(access).size = sobj->$(access).size;
+ INDENT -1
+ P }
+ ELSE
+ P dobj->$(access) $|= sobj->$(access);
+ ENDIF
+ ELSE
+ PP UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+ IF $(isloop) = 1
+ INDENT -1
+ PM }
+ PMEND
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION build_move
+ P // ------------
+ P // move objects
+ --
+ FOR $(STRUCT)
+ IF $(extern_move_$(STRUCT))
+ ELSE
+ P static int move_$(STRUCT)(const $(STRUCT) *sobj, $(STRUCT) *dobj) {
+ INDENT +1
+ GOSUB move_structure
+ P return 0;
+ INDENT -1
+ P }
+ --
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION build_copy
+ P // ------------
+ P // copy objects
+ --
+ FOR $(STRUCT)
+ IF $(extern_copy_$(STRUCT))
+ ELSE
+ P $(STRUCT) *copy_$(STRUCT)(const $(STRUCT) *sobj) {
+ INDENT +1
+ P $(STRUCT) *dobj = NULL;
+ P if (sobj) {
+ INDENT +1
+ P dobj = create_$(STRUCT)();
+ P if (!dobj) alloc_err("$(STRUCT)");
+ P else {
+ INDENT +1
+ P trf_create((long)sobj, (long)dobj);
+ P if (move_$(STRUCT)(sobj, dobj)) {
+ INDENT +1
+ P destroy_$(STRUCT)(dobj);
+ P dobj = NULL;
+ INDENT -1
+ P }
+ INDENT -1
+ P }
+ INDENT -1
+ P }
+ GOSUB trace "copied $(STRUCT)"
+ P return dobj;
+ INDENT -1
+ P }
+ --
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION save_structure self,deref,prekey,fp
+ CREATE $(member)
+ CREATE $(isloop)
+ CREATE $(isinif)
+ CREATE $(saved_elems) = 0
+
+ FOR $({/TYPE)
+ SET $(member) $(self)$(deref)$(IDENT)
+ SET $(isloop) 0
+ SET $(isinif) 0
+
+ IF $(REF) ~ $(v)
+ # virtual function
+ ELSEIF $(SAVE)
+ SET $(saved_elems) = $(+ $(saved_elems)+1)
+ IF $(REF) ~ *,v
+ PMSTART
+ IF $(REF) ~ *
+ SET $(isinif) 1
+ PM if ($(access)) {
+ INDENT +1
+ ENDIF
+ SET $(isloop) 1
+ PM for (int index = 0; index < $(SIZE:THIS->=$(self)$(deref); index++) {
+ INDENT +1
+ SET $(member) $(member)[index]
+ ENDIF
+ IF $(TYPE) = dllh
+ PUSH
+ CREATE $(pk) $(prekey)$(KEY)
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ GOSUB save_structure,$(member),.,$(pk),$(fp)
+ POP
+ ELSEIF $(REF) ~ s
+ IF $(REF) ~ o,d,i
+ ERROR previously unused - check generated code!
+ PUSH
+ IF $(REF) ~ i
+ CREATE $(subderef) .
+ ELSE
+ PMSTART
+ PM if ($(member)) {
+ INDENT +1
+ CREATE $(subderef) ->
+ ENDIF
+ CREATE $(pk) $(prekey)$(KEY|NOKEYDEFINED)
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ GOSUB save_structure,$(member),$(subderef),$(pk),$(fp)
+ POP
+ IF $(REF) !~ i
+ INDENT -1
+ PM }
+ PMEND
+ ENDIF
+ ENDIF
+ ELSEIF $(REF) ~ d
+ IF $(saveable_$(TYPE)) = 0
+ ERROR Can't save $(TYPE) (has no saveable members)
+ ENDIF
+ P for ($(TYPE) *s = $(member); s; s = s->next) {
+ INDENT +1
+ P fputs("$(prekey)$(KEY|NOKEYDEFINED){ ", $(fp));
+ P save_$(TYPE)(s, $(fp));
+ P fputs("}\n", $(fp));
+ INDENT -1
+ P }
+ ELSEIF $(REF) ~ o
+ ERROR previously unused - check generated code!
+ IF $(saveable_$(TYPE)) = 0
+ ERROR Can't save $(TYPE) (has no saveable members)
+ ENDIF
+ P fputs("$(prekey)$(KEY) {\n", $(fp));
+ P save_$TYPE($(member), $(fp));
+ P fputs("}\n", $(fp));
+ ELSEIF $(REF) ~ t,e
+ IF $(TYPE) = aisc_string
+ P if ($(member)) $|save_string("$(prekey)$(KEY|NOKEYDEFINED)", $(member), $(fp));
+ ELSEIF $(TYPE) = int,long,char
+ P fprintf($(fp), "$(prekey)$(KEY|NOKEYDEFINED) %i\n", $(member));
+ ELSEIF $(TYPE) = float,double
+ P fprintf($(fp), "$(prekey)$(KEY|NOKEYDEFINED) %f\n", $(member));
+ ELSE
+ ERROR CANNOT SAVE TYPE '$(TYPE)'
+ ENDIF
+ ELSEIF $(REF) ~ l
+ P fprintf($(fp), "$(prekey)$(KEY|NOKEYDEFINED) %i", $(member));
+ ELSE
+ ERROR UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+ IF $(isloop) = 1
+ INDENT -1
+ PM }
+ IF $(isinif) = 1
+ INDENT -1
+ PM }
+ ENDIF
+ PMEND
+ ENDIF
+ ENDIF
+ ENDFOR
+ IF $(saved_elems) = 0
+ ERROR It makes no sense to save $(STRUCT), since it has no saveable data elements
+ ENDIF
+RETURN
+
+FUNCTION load_structure self,deref,prekey,fp
+ CREATE $(member)
+ CREATE $(isloop)
+ CREATE $(isinif)
+
+ FOR $({/TYPE)
+ SET $(member) $(self)$(deref)$(IDENT)
+ SET $(isloop) 0
+ SET $(isinif) 0
+
+ IF $(REF) ~ $(v)
+ # virtual function
+ ELSEIF $(SAVE)
+ IF $(REF) ~ *,v
+ PMSTART
+ IF $(REF) ~ *
+ SET $(isinif) 1
+ PM if ($(member)) {
+ INDENT +1
+ ENDIF
+ SET $(isloop) 1
+ PM for (int index = 0; index < $(SIZE:THIS->=$(self)$(deref); index++) {
+ INDENT +1
+ SET $(member) $(member)[index]
+ ENDIF
+ IF $(TYPE) = dllh
+ PUSH
+ CREATE $(pk) $(prekey)$(KEY)
+ MOVETO $(/AISC/DATA/STRUCT.dll_header)
+ GOSUB load_structure,$(member),.,$(pk),$(fp)
+ POP
+ ELSEIF $(REF) ~ s
+ IF $(REF) ~ o,d,i
+ ERROR previously unused - check generated code!
+ PUSH
+ IF $(REF) ~ i
+ CREATE $(subderef) .
+ ELSE
+ PMSTART
+ PM if ($(member)) {
+ INDENT +1
+ CREATE $(subderef) ->
+ ENDIF
+ CREATE $(pk) $(prekey)$(KEY|NOKEYDEFINED)
+ MOVETO $(/AISC/DATA/STRUCT.$(TYPE))
+ GOSUB load_structure,$(member),$(subderef),$(pk),$(fp)
+ POP
+ IF $(REF) !~ i
+ INDENT -1
+ PM }
+ PMEND
+ ENDIF
+ ENDIF
+ ELSEIF $(REF) ~ d
+ P if (strcmp("$(prekey)$(KEY|NOKEYDEFINED){", token)==0) {
+ INDENT +1
+ P $(TYPE) *cobj = create_$(TYPE)();
+ P if (cobj) {
+ INDENT +1
+ P if (load_$(TYPE)(cobj, $(fp))==0) {
+ INDENT +1
+ P aisc_link((dllpublic_ext*)&($(self)$(deref)p$(IDENT)), (dllheader_ext*)cobj);
+ P continue;
+ INDENT -1
+ P }
+ P destroy_$(TYPE)(cobj);
+ INDENT -1
+ P }
+ P return 1;
+ INDENT -1
+ P }
+ ELSEIF $(REF) ~ o
+ ERROR code generated here is broken (does save instead of load)
+ P fprintf($(fp),"$(prekey)$(KEY) {\n");
+ P { int error = save_$TYPE($(member),$(fp));
+ P if (error) return error; }
+ P fprintf($(fp),"}\n");
+ ELSEIF $(REF) ~ t,e
+ P if (strcmp("$(prekey)$(KEY|NOKEYDEFINED)", token)==0) {
+ INDENT +1
+ P if (aisc_server_load_token($(fp), token, $(TOKENSIZE))) return 1;
+ IF $(TYPE) = aisc_string
+ P $(member) = strdup(token);
+ ELSEIF $(TYPE) = int,long,char
+ P $(member) = atoi(token);
+ ELSEIF $(TYPE) = float,double
+ P $(member) = atof(token);
+ ELSE
+ ERROR Loading type '$(TYPE)' not implemented (yet)
+ ENDIF
+ P continue;
+ INDENT -1
+ P }
+ ELSEIF $(REF) ~ l
+ ERROR loading links not implemented (yet)
+ ELSE
+ ERROR UNKNOWN REF '$(REF|)' in $(STRUCT).$(TYPE)
+ ENDIF
+ IF $(isloop) = 1
+ INDENT -1
+ PM }
+ IF $(isinif) = 1
+ INDENT -1
+ PM }
+ ENDIF
+ PMEND
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION build_saveload
+ CREATE $(TOKENSIZE) 1024
+
+ P // -------------
+ P // save and load
+ --
+ P inline void warn_unknown_token(const char *token, const char *objectname) {
+ P $1fprintf(stderr, "Unknown token '%s' while loading '%s' (ignored)\n", token, objectname);
+ P }
+ --
+ P inline void save_string(const char *key, const char *value, FILE *out) {
+ INDENT +1
+ P fputs(key, out);
+ P fputc(' ', out);
+ P aisc_server_save_token(out, value, $(TOKENSIZE));
+ INDENT -1
+ P }
+ --
+
+ FOR $(STRUCT)
+ CREATE $(saveable_$(STRUCT)) = 0
+ FOR $({/TYPE)
+ IF $(SAVE)
+ SET $(saveable_$(STRUCT)) = 1
+ ENDIF
+ ENDFOR
+ #WARNING saveable_$(STRUCT) = $(saveable_$(STRUCT))
+ ENDFOR
+
+ FOR $(STRUCT)
+ IF $(saveable_$(STRUCT)) = 1
+ IF $(extern_save_$(STRUCT))
+ ELSE
+ P void save_$(STRUCT)(const $(STRUCT) *o, FILE *out) {
+ INDENT +1
+ GOSUB save_structure,o,->,,out
+ INDENT -1
+ P }
+ --
+ ENDIF
+ ENDIF
+ ENDFOR
+ FOR $(STRUCT)
+ IF $(saveable_$(STRUCT)) = 1
+ IF $(extern_load_$(STRUCT))
+ ELSE
+ P int load_$(STRUCT)($(STRUCT) *o, FILE *in) {
+ INDENT +1
+ P char token[$(TOKENSIZE)+1];
+ P while (aisc_server_load_token(in, token, $(TOKENSIZE))==0) {
+ INDENT +1
+ P if (*token == '}') break;
+ GOSUB load_structure,o,->,,in
+ P warn_unknown_token(token, "$(STRUCT)");
+ INDENT -1
+ P }
+ P return 0;
+ INDENT -1
+ P }
+ --
+ ENDIF
+ ENDIF
+ ENDFOR
+RETURN
+
+FUNCTION trace msg
+ IF $(TRACE) = 1
+ P fputs("AISC_SERVER_TRACE " $(msg) "\n", stderr); fflush(stderr);
+ ENDIF
+RETURN
+
+FUNCTION file_header
+ P // -----------------------------------------------------------------
+ P // Created automagically from ../$(argv[2])
+ P // and ../$(argv[4])
+ P // using aisc-script '../AISC/aisc_server.pa'
+ P // DO NOT EDIT THIS FILE!!!
+ P // -----------------------------------------------------------------
+ --
+RETURN
+
+# --------------------------------------------------------------------------------
+
+LABEL main
+IF $(argc) < 7
+ ERROR Wrong number of parameters[$(argc)]. Usage: aisc aisc_server.pa xxx.aisc outfile externfile.aisc import_proto globals.aisc
+ENDIF
+
+DATA AISC { $(#FILE $(argv[2])) }, EXTERN { $(#FILE $(argv[4])) }, GLOBALS { $(#FILE $(argv[6])) };
+DUMPDATA DUMP/aisc_server.pa__$(argv[2]).dump
+
+OPEN save $(argv[3])
+OPEN import $(argv[5])
+
+# set extern functions
+MOVETO $(EXTERN/.)
+FOR $(FUNCTION)
+ CREATE $(extern_$(FUNCTION))
+NEXT
+ ERROR no extern Functions found
+ENDFOR
+
+# set globals passed from Makefile
+MOVETO $(/GLOBALS/.)
+CREATE $(create_save_code) = $(AISC_SAVE)
+
+OUT import
+CALL file_header
+
+OUT save
+CALL file_header
+P $(#FILE C/aisc_server.h)
+
+MOVETO $(/AISC/DATA/.)
+
+CREATE $(v) = %
+
+CALL build_init
+CALL build_delete
+CALL build_move
+CALL build_copy
+CALL build_accessors
+
+IF $(create_save_code) = YES
+ CALL build_saveload
+ENDIF
+
+
+CLOSE save
+CLOSE import
+EXIT
+
=====================================
AISC_COM/AISC/keys.README
=====================================
@@ -0,0 +1,86 @@
+
+format of .aisc-files used for client/server interfaces
+-------------------------------------------------------
+
+PROJECT string // main name of program
+OBJECT_KEY string // prefix key for objects
+MAX_KEY num // maximum attribute number
+MAX_OBJECT num // maximum object number
+MAGIC_NUMBER num // server version (see magic.lst)
+
+DATA {
+
+ at CONST, @VALUE, @DOCU; // constants
+
+ at ENUM; // enum is unused and obsolete
+..., {;
+ @VAR, @VAL, @DOCU;
+};
+
+ at STRUCT, @SKEY, @SKEYC, @DOCU;
+
+my_struxt, MYKEY, 4711, (~ This is the docu ~), [SAVEDIRECTION VERTICAL,] {
+ @TYPE, @IDENT, @REF, @ACC, @SAVE, @KEY, @KEYC, @INIT, @DOCU;
+ ...;
+};
+
+};
+
+
+
+TYPE can be:
+
+ int,char,double,float
+
+ dllh header of DoubledLinkedList
+ aisc_string string
+ bytestring string
+
+ // [func function ]
+
+ or any user defined type
+
+REF can be:
+ % virtual (aka callback)
+
+ unspecified ( double char .... )
+eor i or owner by insertion
+eor o owner by pointer
+eor d special owner (double linked list with ident + hash)
+eor l link
+eor r reversed_link (only to those objects with dllh)
+
+ e enum type
+eor t terminal type
+eor s structure type /* unfold THIS structure else t */
+
+[ * resizeable vector of ... (key SIZE is size)
+eor v fixed vector of ... (key SIZE is size)]
+
+[ f forward reference ]
+ (THIS-> is father)
+
+z.B. os* Vector of unfold substructures
+
+
+ACC Accessiongrants
+ , read and write
+ r, readonly
+ w, writeonly
+ c, createonly
+ rw, read and write
+ privat,
+ public,
+
+SAVE version number for load/save (if AISC_SAVE=YES)
+
+KEY key name
+
+KEYC key number
+
+ Has to be unique inside each STRUCT.
+ Keys w/o keynumbers exist, but are not accessible via interface.
+ Several types use multiple KEYs (e.g. 'd' uses 2 keys (KEY and KEY+1)).
+
+INIT default value or call to init-funtion
+ 'THIS' is replaced by pointer to STRUCT
=====================================
AISC_COM/AISC/magic.lst
=====================================
@@ -0,0 +1,14 @@
+
+List of previously used magics
+------------------------------
+
+Note: Never reuse old magics! (MAGIC_NUMBER)
+
+PTSERVER: (see ../../PROBE_COM/PT.aisc at MAGIC_NUMBER)
+ 0x615054 (used since [7986])
+ 0x415054 (used since [7414])
+ 0x471100 (used since [2])
+
+NAMESERVER: (see ../../NAMES_COM/names.aisc at MAGIC_NUMBER)
+ 0x414e53 (used since [7414])
+ 0x927289 (used since [2])
=====================================
debian/copyright
=====================================
@@ -4,9 +4,6 @@ Upstream-Contact: Arb development team <devel at arb-home.de>,
Ralf Westram <ralf at arb-home.de>
Source: http://download.arb-home.de/release/
Files-Excluded: arbsrc*/AISC_COM/Makefile
- arbsrc*/AISC_COM/AISC/aisc*
- arbsrc*/AISC_COM/AISC/keys.README
- arbsrc*/AISC_COM/AISC/magic.lst
arbsrc*/ARB_GDE
arbsrc*/AW*
arbsrc*/BINDEP
=====================================
debian/libarb-dev.install
=====================================
@@ -1,2 +1,3 @@
#!/usr/bin/dh-exec
SL/*/*.a usr/lib/${DEB_HOST_MULTIARCH}/arb
+PROBE_COM/*.a usr/lib/${DEB_HOST_MULTIARCH}/arb/PROBE_COM
=====================================
debian/patches/fix_main_makefile.patch
=====================================
@@ -342,7 +342,7 @@ Description: Strip everything from ARB Makefiles that's not contained in the
@echo "Build time" > $(TIMELOG)
--- a/PROBE_COM/Makefile
+++ b/PROBE_COM/Makefile
-@@ -20,20 +20,28 @@ AISC_COMPILER=../AISC/aisc
+@@ -20,20 +20,32 @@ AISC_COMPILER=../AISC/aisc
AISC_PROTOTYPER=../AISC_MKPTPS/aisc_mkpt
AISC_DEPENDS = $(wildcard AISC/*.pa) $(AISC_COMPILER) $(AISC_PROTOTYPER)
@@ -355,6 +355,10 @@ Description: Strip everything from ARB Makefiles that's not contained in the
$(MAIN): server.a
server.a: $(MAIN_SOURCE) $(PRIVATE_SERVER_OBJECTS:.o=.c) $(PUBLIC_SOURCES) $(AISC_DEPENDS) $(MAIN_HEADER)
++ echo "Set missing links to GENH header files"
++ ln -s GENH/aisc_com.h PT_com.h
++ ln -s GENH/aisc.h PT_server.h
++ ln -s GENH/aisc_server_proto.h PT_server_prototypes.h
@$(MAKE) -r -f AISC/Makefile "AUTODEPENDS=0"
-depends:
=====================================
debian/rules
=====================================
@@ -41,6 +41,7 @@ override_dh_auto_build:
for header in CORE/*.h UNIT_TESTER/*.h SL/CB/*.h WINDOW/*.hxx ARBDB/*.h ; do ln -s ../$${header} INCLUDE/`basename $${header}` ; done
ln -s /usr/include/valgrind/valgrind.h INCLUDE/valgrind.h
ln -s ../AISC_COM/AISC PROBE_COM/AISC
+ ln -s ../AISC_COM/C PROBE_COM/C
mkdir bin
mkdir lib
dh_auto_build -- all # --sourcedirectory=CORE
@@ -53,6 +54,7 @@ override_dh_auto_clean: config.makefile
if [ ! -e config.makefile ] ; then echo "config.makefile missing" ; exit 1 ; fi
ln -s ../AISC_COM/AISC PROBE_COM/AISC
$(MAKE) clean
+ cd PROBE_COM; $(MAKE) clean; rm -f PT_*.h
rm -rf bin
rm -rf lib
rm -rf NAMES_COM
View it on GitLab: https://salsa.debian.org/med-team/libarb/compare/a71082c3bc00b68190f755964a36331eebf7744d...4cb82a3cac82bec00ee311c140eca17536607605
--
View it on GitLab: https://salsa.debian.org/med-team/libarb/compare/a71082c3bc00b68190f755964a36331eebf7744d...4cb82a3cac82bec00ee311c140eca17536607605
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190607/5d022b3b/attachment-0001.html>
More information about the debian-med-commit
mailing list