/* * La procedure "fscanf_Bound" lit en ascii une surface. * Entree : * bp Surface a lire. */ void fscanf_Bound (Bound *bp) { /* Lecture du type polygonale de la surface. */ skip_keyword (T_TYPE, "bound: keyword \"type\" expected"); if (lex () != T_INT) lexerr ("start","bound_type: boolean expected (0=FALSE|~0=TRUE)", NULL); bp->is_polygonal = (myint ? 1 : 0); /* Lecture de la liste de points de la surface. */ skip_keyword (T_POINT_LIST, "bound: keyword \"point_list\" expected"); pusherr ("bound_point_list: "); fscanf_Point3f_list (&bp->point); poperr (); /* Lecture de la liste de faces de la surface. */ skip_keyword (T_FACE_LIST, "bound: keyword \"face_list\" expected"); pusherr ("bound_face_list: "); fscanf_Face_list (&bp->face); poperr (); }
/* * Check if the line begins with a special keyword; if so, return true while * pointing params to its parameters. */ static int begins_with(char *line, const char *keyword, char **params) { int i = skip_whitespace(line, 0); int j = skip_keyword(line, i); if ((j - i) == (int) strlen(keyword)) { char save = line[j]; line[j] = 0; if (!dlg_strcmp(keyword, line + i)) { *params = line + skip_whitespace(line, j + 1); return 1; } line[j] = save; } return 0; }
/* * La procedure "fscanf_View_parameters" lit en ascii les parametres * de visualisation. * Entree : * vp Parametres de visualisation a lire. */ void fscanf_View_parameters (View_parameters *vp) { /* Lecture du type de projection lors de la prise de vue. */ skip_keyword (T_TYPE, "view: keyword \"type\" expected"); switch (lex ()) { case T_PARALLEL : vp->type = PARALLEL; break; case T_PERSPECTIVE : vp->type = PERSPECTIVE; break; default : lexerr ("start", "view_type: keyword \"parallel|perspective\" expected"); break; } /* Lecture du centre de projection (oeil) de la prise de vue. */ skip_keyword (T_COP, "view: keyword \"cop\" expected"); pusherr ("view_cop: "); fscanf_Point3f (&vp->cop); poperr (); /* Lecture du point de reference (cible) a la prise de vue. */ skip_keyword (T_VRP, "view: keyword \"vrp\" expected"); pusherr ("view_vrp: "); fscanf_Point3f (&vp->vrp); poperr (); /* Lecture de la direction normale au plan de projection. */ skip_keyword (T_VPN, "view: keyword \"vpn\" expected"); pusherr ("view_vpn: "); fscanf_Vector (&vp->vpn); poperr (); /* Lecture de la direction indiquant le haut de la projection. */ skip_keyword (T_VUP, "view: keyword \"vup\" expected"); pusherr ("view_vup: "); fscanf_Vector (&vp->vup); poperr (); /* Lecture de la fenetre de projection de la prise de vue. */ skip_keyword (T_WINDOW, "view: keyword \"window\" expected"); pusherr ("view_window_umin: "); fscanf_float (&vp->vwd.umin); popuperr ("view_window_umax: "); fscanf_float (&vp->vwd.umax); popuperr ("view_window_vmin: "); fscanf_float (&vp->vwd.vmin); popuperr ("view_window_vmax: "); fscanf_float (&vp->vwd.vmax); poperr (); /* Lecture des profondeurs de decoupage avant et arriere. */ skip_keyword (T_DEPTH, "view: keyword \"depth\" expected"); pusherr ("view_depth_front: "); fscanf_float (&vp->depth.front); popuperr ("view_depth_back: "); fscanf_float (&vp->depth.back); poperr (); }
int process_statement( char *line, FILE *fo ) /*******************************************/ { char *separators = " ,\t|"; char buff1[ MAX_LINE_LEN + 1 ]; int len = 0; char *p; if( *line == '\0' ) return( 0 ); strcpy( buff1, skip_separator( line ) ); p = strtok( buff1, " ,\t|" ); if( p != NULL ) strcpy( dlg_item.name, p ); if( strncmp( dlg_item.name, "END", 3 ) == 0 ) { fprintf( fo, "%s%s\nEND\n", STR_SPC, dlg_item.name ); return( 1 ); } if( strcmp( dlg_item.name, "CONTROL" ) == 0 ) { p = skip_keyword( line, &len ); if( p != NULL ) { strncpy( dlg_item.text, p, len ); dlg_item.text[ len ] = '\0'; p += len; } p = strtok( p, separators ); if( p != NULL ) { strcpy( dlg_item.ID, p ); } else { strcpy( dlg_item.ID, "-1" ); } convert_buttons( dlg_item.ID, dlg_item.name, 1 ); add_parms_list( &dlg_item, separators, 0 ); get_rectangle_parms( &dlg_item ); } else { if(( strcmp( dlg_item.name, "COMBOBOX" ) == 0 ) || ( strcmp( dlg_item.name, "LISTBOX" ) == 0 ) || ( strcmp( dlg_item.name, "SCROLLBAR" ) == 0 ) || ( strcmp( dlg_item.name, "EDITTEXT" ) == 0 )) { strcpy( dlg_item.text, "\"\"" ); p = NULL; } else { p = skip_keyword( line, &len ); if( p != NULL ) { strncpy( dlg_item.text, p, len ); dlg_item.text[ len ] = '\0'; p += len; convert_buttons( dlg_item.text, dlg_item.text, 0 ); } else { strcpy( dlg_item.text, "\"\"" ); p = NULL; } } p = strtok( p, separators ); if( p != NULL ) { strcpy( dlg_item.ID, p ); } else { strcpy( dlg_item.ID, "-1" ); } convert_buttons( dlg_item.ID, dlg_item.name, 1 ); get_rectangle_list( &dlg_item, separators ); add_parms_list( &dlg_item, separators, 0 ); } if( !strcmp( dlg_item.name, "SCROLLBAR" ) ) { add_parms_item( dlg_item.parms, "WC_SCROLLBAR", ADD_BEFORE ); } process_style( dlg_item.parms, dlg_item.name ); dlg_item.y = dlg_hdr.dy - dlg_item.y - dlg_item.dy; fprintf( fo, "%s%s", STR_SPC STR_SPC, dlg_item.name ); if( strlen( dlg_item.name ) < 8 ) fprintf( fo, "\t" ); fprintf( fo, "\t" ); if( strcmp( dlg_item.name, "LISTBOX" ) ) fprintf( fo, "%s, ", dlg_item.text ); fprintf( fo, "%s, %d, %d, %d, %d", dlg_item.ID, dlg_item.x, dlg_item.y, dlg_item.dx, dlg_item.dy ); out_parms_style( fo, dlg_item.parms, dlg_item.name ); out_color_style( fo, &dlg_item ); return( 0 ); }