84
t_jit_err jit_linden_init(void);
t_jit_err jit_linden_init(void)
{
long attrflags=0;
t_jit_object *attr, *mop;
_jit_linden_class = jit_class_new("jit_linden",(method)jit_linden_new,(method)jit_linden_free,
sizeof(t_jit_linden),A_CANT,0L); //A_CANT = untyped
//add mop
mop = jit_object_new(_jit_sym_jit_mop,1,1); //#inputs,#outputs
jit_mop_single_type(mop,_jit_sym_char);
jit_mop_single_planecount(mop,1);
jit_class_addadornment(_jit_linden_class,mop);
//add methods
jit_class_addmethod(_jit_linden_class, (method)jit_linden_matrix_calc, "matrix_calc", A_CANT, 0L);
//add attributes
attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
// ignore -- sets symbols to ignore while context matching
attr = jit_object_new(_jit_sym_jit_attr_offset_array, "ignore", _jit_sym_symbol, 128,
attrflags, (method)0L, (method)0L, calcoffset(t_jit_linden, ignorecount),
calcoffset(t_jit_linden,ignoresym));
jit_class_addattr(_jit_linden_class,attr);
// production -- defines production rules for the L-system
attr = jit_object_new(_jit_sym_jit_attr_offset_array, "production", _jit_sym_symbol, 200,
attrflags, (method)0L, (method)0L, calcoffset(t_jit_linden, prodcount),
calcoffset(t_jit_linden,prodsym));
jit_class_addattr(_jit_linden_class,attr);
// wildcard -- sets wildcard character
attr = jit_object_new(_jit_sym_jit_attr_offset,"wildcard",_jit_sym_char,attrflags,
(method)0L,(method)0L,calcoffset(t_jit_linden,wildcard));
jit_class_addattr(_jit_linden_class,attr);
// leftbranch -- sets left branch character
attr = jit_object_new(_jit_sym_jit_attr_offset,"leftbranch",_jit_sym_char,attrflags,
(method)0L,(method)0L,calcoffset(t_jit_linden,leftbranch));
jit_class_addattr(_jit_linden_class,attr);
// rightbranch -- sets right branch character
attr = jit_object_new(_jit_sym_jit_attr_offset,"rightbranch",_jit_sym_char,attrflags,
(method)0L,(method)0L,calcoffset(t_jit_linden,rightbranch));
jit_class_addattr(_jit_linden_class,attr);
// boundmode -- sets wrapping flag
attr = jit_object_new(_jit_sym_jit_attr_offset,"boundmode",_jit_sym_long,attrflags,
(method)0L,(method)0L,calcoffset(t_jit_linden,boundmode));
jit_class_addattr(_jit_linden_class,attr);
jit_class_register(_jit_linden_class);
return JIT_ERR_NONE;
}
t_jit_err jit_linden_matrix_calc(t_jit_linden *x, void *inputs, void *outputs)
{
t_jit_err err=JIT_ERR_NONE;
long in_savelock,out_savelock, dimmode;
t_jit_matrix_info in_minfo,out_minfo;
char *in_bp,*out_bp;
long i,dimcount,planecount,dim[JIT_MATRIX_MAX_DIMCOUNT];
void *in_matrix, *out_matrix;
in_matrix = jit_object_method(inputs, _jit_sym_getindex, 0);
out_matrix = jit_object_method(outputs, _jit_sym_getindex, 0);
if (x&&in_matrix&&out_matrix) {
in_savelock = (long) jit_object_method(in_matrix,_jit_sym_lock,1);
out_savelock = (long) jit_object_method(out_matrix,_jit_sym_lock,1);
jit_object_method(in_matrix,_jit_sym_getinfo,&in_minfo);
jit_object_method(out_matrix,_jit_sym_getinfo,&out_minfo);