| Pragma declarationsThis is a quite complex an example of pragmas.
genwrite=false;
export(wdef_digit_box);
IncludeDirs(".",
"$HOME/work/cvswork/SYS/vsv",
"$HOME/work/cvswork/SYS/libcntxt",
"$HOME/work/cvswork/SYS/libipl",
"$HOME/work/cvswork/SYS/libterms")
Main(CONTEXT_DESCRIPTION);
CONTEXT_DESCRIPTION has
{
// Parameters(tp_sm_node);
Tags(CAMERA);
CAMERA is Subtree with
{
Attributes(cam_id = tp_sm_node->sm_camera.camera_id,
camera_name=tp_sm_node->sm_camera.camera_name,
img_width,
img_height);
Tags(Calibration_matrix,
Location,
Digit_box_list,
Referential);
}
Calibration_matrix is Subtree with
Attributes(m00 = tp_sm_node->sm_current_pp_matrix[0],
m01 = tp_sm_node->sm_current_pp_matrix[1],
m02 = tp_sm_node->sm_current_pp_matrix[2],
m03 = tp_sm_node->sm_current_pp_matrix[3],
m10 = tp_sm_node->sm_current_pp_matrix[4],
m11 = tp_sm_node->sm_current_pp_matrix[5],
m12 = tp_sm_node->sm_current_pp_matrix[6],
m13 = tp_sm_node->sm_current_pp_matrix[7],
m20 = tp_sm_node->sm_current_pp_matrix[8],
m21 = tp_sm_node->sm_current_pp_matrix[9],
m22 = tp_sm_node->sm_current_pp_matrix[10],
m23 = tp_sm_node->sm_current_pp_matrix[11]);
Location is Subtree with Attributes(x = tp_sm_node->sm_camera.x_location,
y = tp_sm_node->sm_camera.y_location,
z = tp_sm_node->sm_camera.z_location);
Digit_box_list is Subtree with Tags(Digit_box = tp_sm_node->sm_digit_boxes);
Referential is Subtree with Attributes(ref_name = tp_sm_node->sm_referential);
}
wdef_digit_box is LinkedListCell with Attributes(x_min, x_max, y_min, y_max);
We show the .c file only, the .h file being quite trivial.
/* ======================================*/
* ============= file generated automatically by xmlgen (Inria 2001)
Command: xmlgen_new -d xml_IO_context.dcl -o xml_IO_context_xmlgen multi_cntx.h world_def.h calib.h globals.h
============= */
/* ======================================*/
#include "xml_IO_context_xmlgen.h"
/* ======================================*/
/* ====== function definitions ==========*/
/* ======================================*/
void XML_read_wdef_digit_box(struct wdef_digit_box * x,RS_element * root)
{
x -> x_min = xml_getattrib_int(root,"x_min");
x -> x_max = xml_getattrib_int(root,"x_max");
x -> y_min = xml_getattrib_int(root,"y_min");
x -> y_max = xml_getattrib_int(root,"y_max");
x -> ident = xml_getelem_int(root,"ident");
}
struct wdef_digit_box * XML_read_listwdef_digit_box(RS_element * root,char * tag)
{
struct wdef_digit_box * prev = NULL;
struct wdef_digit_box * cur;
struct wdef_digit_box * res = NULL;
RS_element * p;
int i;
int dim = howManyKids(root,tag);
if(dim == 0)return res;
res
= (struct wdef_digit_box *)malloc(dim * sizeof(struct wdef_digit_box ));
for(i = 0 , p = getPtKid(root,tag);i < dim;i++ , prev = cur)
{
cur = & res[i];
XML_read_wdef_digit_box(cur,p);
if(prev)prev -> next = cur;
if(i + 1 < dim)p = getNextBrother(p,tag);
}
cur -> next = NULL;
return res;
}
void XML_read_CONTEXT_DESCRIPTION(RS_element * root)
{
RS_element * rpt1;
RS_element * rpt2;
rpt1 = getKid(root,"CAMERA");
tp_sm_node -> sm_camera . camera_id = xml_getattrib_int(rpt1,"cam_id");
tp_sm_node -> sm_camera . camera_name = xml_getattrib_string(rpt1,"camera_name");
img_width = xml_getattrib_int(rpt1,"img_width");
img_height = xml_getattrib_int(rpt1,"img_height");
rpt2 = getKid(rpt1,"Calibration_matrix");
tp_sm_node -> sm_current_pp_matrix[0] = xml_getattrib_double(rpt2,"m00");
tp_sm_node -> sm_current_pp_matrix[1] = xml_getattrib_double(rpt2,"m01");
tp_sm_node -> sm_current_pp_matrix[2] = xml_getattrib_double(rpt2,"m02");
tp_sm_node -> sm_current_pp_matrix[3] = xml_getattrib_double(rpt2,"m03");
tp_sm_node -> sm_current_pp_matrix[4] = xml_getattrib_double(rpt2,"m10");
tp_sm_node -> sm_current_pp_matrix[5] = xml_getattrib_double(rpt2,"m11");
tp_sm_node -> sm_current_pp_matrix[6] = xml_getattrib_double(rpt2,"m12");
tp_sm_node -> sm_current_pp_matrix[7] = xml_getattrib_double(rpt2,"m13");
tp_sm_node -> sm_current_pp_matrix[8] = xml_getattrib_double(rpt2,"m20");
tp_sm_node -> sm_current_pp_matrix[9] = xml_getattrib_double(rpt2,"m21");
tp_sm_node -> sm_current_pp_matrix[10] = xml_getattrib_double(rpt2,"m22");
tp_sm_node -> sm_current_pp_matrix[11] = xml_getattrib_double(rpt2,"m23");
rpt2 = getKid(rpt1,"Location");
tp_sm_node -> sm_camera . x_location = xml_getattrib_int(rpt2,"x");
tp_sm_node -> sm_camera . y_location = xml_getattrib_int(rpt2,"y");
tp_sm_node -> sm_camera . z_location = xml_getattrib_int(rpt2,"z");
rpt2 = getKid(rpt1,"Digit_box_list");
tp_sm_node -> sm_digit_boxes = XML_read_listwdef_digit_box(rpt2,"Digit_box");
rpt2 = getKid(rpt1,"Referential");
tp_sm_node -> sm_referential = xml_getattrib_string(rpt2,"ref_name");
}
|