/* LTXFIN (GED) -- TXF Layout Data Input */ /* LTXFIN (GED) -- TXF Layout-Datenuebernahme */ /* // Copyright (c) 2003-2012 Oliver Bartels F+E, Muenchen // Author: Roman Ludwig // Changes History: // rl (120427) RELEASED FOR BAE V7.8. // rl (101019) RELEASED FOR BAE V7.6. // rl (091021) RELEASED FOR BAE V7.4. // rl (081014) RELEASED FOR BAE V7.2. // rl (071029) RELEASED FOR BAE V7.0. // rl (060829) RELEASED FOR BAE V6.8. // rl (060530) ENHANCEMENT: // Use checking parameters also as copper fill clearance. // Added automatic copper fill. // rl (060224) ENHANCEMENT: // Corrected top layer setting for old TXF versions. // rl (051207) ENHANCEMENT: // Added macro name prefix support. // rl (050906) RELEASED FOR BAE V6.6. // rl (041116) ENHANCEMENT: // Restricted padstack name length to 39 characters to ensure // router usability. // rl (040811) RELEASED FOR BAE V6.4. // rl (040623) ENHANCEMENT: // Added glue point support. // rl (040622) ENHANCEMENT: // Added middle and point 1 position convertion support. // rl (030213) ORIGINAL CODING. // // DESCRIPTION // // The ltxfin User Language program reads TXF layout data // from a selectable ASCII file and automatically performs // the therein defined part placement. */ // Includes #include "pop.ulh" // User Language popup utilities #include "lay.ulh" // User Language layout utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string REPPARSE = M("Lesen TXF-Daten '%s'...", "Reading TXF data '%s'..."); string REPDONE = M("Es wurden keine Fehler festgestellt.", "Operation completed."); string REPSYMNAME = M("%s -> %s\n","%s -> %s\n"); string UPRABORT = M_UPRABORT(); string UPRTXFFILE = M("TXF-Eingabedatei ? ","TXF Data File ? "); string UPRTDIR = M("TXF-Eingabeverzeichnis ? ", "TXF Data Directory ? "); string UPRPROCMODE = M("Bearbeitungsmodus selektieren!", "Select Process Mode!"); string UPRPROCALL = M("&Alles","&All"); string UPRPROCLIB = M("Nur &Bibliothek","&Library Only"); string UPRPROCSALL = M("%&Einzeldatei alles","%&Single Project All"); string UPRPROCSLIB = M("Einzel&datei nur Bibliothek", "&Single Project Library Only"); string ERRPLCPOLY = M("[%s/%d]: Fehler bei der Polygonerzeugung!\n", "[%s/%d]: Error generating polygon!\n"); string ERRPLCPATH = M("[%s/%d]: Fehler bei der Leiterbahnerzeugung!\n", "[%s/%d]: Error generating trace!\n"); string ERRPLCVIA = M("[%s/%d]: Fehler bei der Viaplatzierung '%s'!\n", "[%s/%d]: Error placing via '%s'!\n"); string ERRPLCTEXT = M("[%s/%d]: Fehler bei der Texterzeugung '%s'!\n", "[%s/%d]: Error generating text '%s'!\n"); string ERRLONGTEXT = M("[%s/%d]: Ueberlanger Text '%s' gekuerzt!\n", "[%s/%d]: Long text '%s' truncated!\n"); string ERRPLCPART = M("[%s/%d]: Fehler bei der Bauteilplatzierung '%s'/'%s'!\n", "[%s/%d]: Error placing part '%s'/'%s'!\n"); string ERRPLCPIN = M("[%s/%d]: Fehler bei der Pinplatzierung '%s'/'%s'!\n", "[%s/%d]: Error placing pin '%s'/'%s'!\n"); string ERRLONGSYMN = M("[%s/%d]: Ueberlanger Name '%s' gekuerzt!\n", "[%s/%d]: Long name '%s' truncated!\n"); // INI file parameter name definitions #define PAR_TXFPLANLAY "TXFPLANLAY%d_LAY" // Assembly plan doc. layers #define PAR_TXFINFOLAY "TXFINFOLAY%d_LAY" // Info doc. layers #define PAR_TXFMASKLAY "TXFMASKLAY_LAY" // Solder mask doc. layer #define PAR_TXFPASTELAY "TXFPASTELAY_LAY" // Solder paste doc. layer #define PAR_TXFDRILLLAY "TXFDRILLLAY_LAY" // Drill plan doc. layer #define PAR_TXFFRAMELAY "TXFFRAMELAY_LAY" // Frame doc. layer #define PAR_TXFPDRCLAY "TXFPDRCLAY_LAY" // Part DRC doc. layer #define PAR_TXFMIDPLAY "TXFMIDPLAY_LAY" // Middle point doc. layer #define PAR_TXFGLUELAY "TXFGLUELAY_LAY" // Glue point layer #define PAR_TXFMIDPSIZE "TXFMIDPSIZE_LAY" // Middle point text size #define PAR_TXFPIN1LAY "TXFPIN1LAY_LAY" // Pin 1 point doc. layer #define PAR_TXFPIN1SIZE "TXFPIN1SIZE_LAY" // Pin 1 point text size #define PAR_TXFNDKDRL "TXFNDKDRL_LAY" // NDK drill class #define PAR_TXFMACPREFIX "TXFMACPREFIX_STD" // Macro prefix #define PAR_TXFTYPATT "TXFTYPATT_STD" // Type attribute #define PAR_TXFTECATT "TXFTECATT_STD" // Technology attribute #define PAR_TXFREPLPAT "TXFREPLPAT_STD" // Name translation pattern #define PAR_TXFPWSCALE "TXFPWSCALE_STD" // Plot width scale factor #define PAR_TXFLAY01ALL "TXFLAY01ALL_LAY" // 0:1 layer is all layer pad // Layer definitins int LAYERMASK = bae_iniintval(PAR_TXFMASKLAY,0x410) /* Solder mask doc. layer */; int LAYERPASTE = bae_iniintval(PAR_TXFPASTELAY,0x470) /* Solder paste doc. layer */; int LAYERPLAN[] /* Assembly plan doc. layer */; int LAYERINFO[] /* Info doc. layer */; int LAYERDRILL = bae_iniintval(PAR_TXFDRILLLAY,0x420) /* Drill plan doc. layer */; int LAYERFRAME = bae_iniintval(PAR_TXFFRAMELAY,0x442) /* Frame doc. layer */; int LAYERPDRC = bae_iniintval(PAR_TXFPDRCLAY,0x450) /* Part DRC doc. layer */; int LAYMIDPPOINT = bae_iniintval(PAR_TXFMIDPLAY,0x491) /* Middle position doc. layer */; double MIDPPOINTSIZE = bae_inidblval(PAR_TXFMIDPSIZE,0.001) /* Middle position text size */; int LAYPIN1POINT = bae_iniintval(PAR_TXFPIN1LAY,0) /* Pin 1 position doc. layer */; double PIN1POINTSIZE = bae_inidblval(PAR_TXFPIN1SIZE,0.001) /* Pin 1 position text size */; int LAYERGLUE = bae_iniintval(PAR_TXFGLUELAY,0) /* Glue point doc. layer */; string MACPREFIX = bae_inistrval(PAR_TXFMACPREFIX,"") /* Macro name prefix */; string ATTRTYP = bae_inistrval(PAR_TXFTYPATT,"$typ") /* Type attribute name */; string ATTRTEC = bae_inistrval(PAR_TXFTECATT,"$val") /* Technology attribute name */; int NDKDRLCL = bae_iniintval(PAR_TXFNDKDRL,26) /* NDK drill class */; double PWSCALE = bae_inidblval(PAR_TXFPWSCALE,1.0) /* Plot width scale factor */; int LAY01ALL = bae_iniintval(PAR_TXFLAY01ALL,1) /* 0:1 layer is all layer pad */; // Scanner variables string quostr /* Current quoted string value */; string curname /* Current name */; string curdin /* Current designator */; string curcompname /* Current component shape name */; string curpinname /* Current pin name */; string curshapename /* Current shape name */; string curshapeorg /* Current shape original name */; double curcoord /* Current coordinate */; double curtdist /* Current track distance */; double curttdist /* Current track track distance */; double curx /* Current X coordinate */; double cury /* Current Y coordinate */; double curvx, curvy /* Current via coordinates */; double curxs, curys /* Current start coordinates */; double curxe, curye /* Current end coordinates */; double curpx, curpy /* Current pivot coordinates */; double cursx, cursy /* Current size */; double curcx, curcy /* Current component coordinates */; double currad /* Current radius */; double curwidth /* Current width */; double curpwidth /* Current plot width */; double curdia /* Current diameter */; double curndk = 0 /* Current ndk flag */; double minheight /* Min. height */; double maxheight /* Max. height */; double currot = 0.0 /* Current rotation angle */; double cura = 0.0 /* Current angle (default: 0.0) */; double curca = 0.0 /* Current component angle */; double curas /* Current start angle */; double curae /* Current end angle */; int curjustify = 0 /* Current justify option */; int curadjust = 8 /* Current adjust option */; int curadjust2 = 8 /* Current 2nd adjust option */; string curid /* Current identifier */; string curtypname /* Current typ name */; string curnetname /* Current net name */; int curplcstat /* Current placement status */; int curcplcstat /* Current component plc. status */; int curlaytyp /* Current layer type */; int curlayer /* Current layer code */; int curilayer /* Current layer index */; int curclayer /* Current component layer */; int curflayer /* Current first layer code */; int curllayer /* Current last layer code */; int curpstkproc = 0 /* Current padstack process flag */; int curpartproc = 0 /* Current part process flag */; int curlayproc = 0 /* Current layout process flag */; int curcopfcnt = 0 /* Current copper fill area count */; int libonly = 0 /* Current library process flag */; int sfileflag = 0 /* Single file process flag */; int curint /* Current integer value */; double curflt /* Current float value */; double curversion = 4.0 /* Current version */; double lenconv = 1.0/cvtlength(1.0,0,2) /* Length conv. fact. (default mm) */; double angconv = 1.0/cvtangle(1.0,0,1) /* Angle conv. fact. (def. degree) */; double PI = cvtangle(180.0,1,2) /* PI value */; // File definitions #define TXFEXT ".txf" // TXF data file name extension #define MSGEXT "_l.lst" // Message file name extension string txffname /* TXF input file name */; string ddbfname /* Output database file name */; string msgfname /* Message file name */; int mfh /* Message file handle */; // Polygon point definitions struct point { // Point descriptor double x,y /* Point coordinates */; int t /* Point type */; } curpolyl[], brdpolyl[] /* Polygon buffers */; int curpolyn = 0 /* Polygon buffer size */; int brdpolyn = 0 /* Border polygon buffer size */; double pwidth = 0.0 /* Polygon pen width */; int pfill /* Polygon fill flag */; int padvis /* Pad visiblity */; int padshape /* Pad shape */; struct point padcomppl[] /* Pad component side polygon */; int padcomppn /* Pad component side point count */; struct point padsoldpl[] /* Pad solder side polygon */; int padsoldpn /* Pad solder side point count */; struct compdes { // Component placement descriptor string name /* Component name */; string mac /* Component shape macro */; double x,y /* Component coordinates */; double ang /* Component placement angle */; int mirr /* Component mirror flag */; } cmpl[] /* Component list */; int cmpn = 0 /* Component count */; STRINGS vial /* Via padstack list */; int vian = 0 /* Via padstack count */; int pown = 0 /* Power layer count */; int layordl[] /* Layer order list */; int layordmax = (-1) /* Layer order max. known index */; int laytransl[] /* Layer translation list */; int laytransn = 0 /* Layer translation count */; int toplay = 1 /* Top layer */; struct pstkdes { // Pad style padstack descriptor string name /* Pad name */; string stk /* Padstack name */; double dia /* Padstack drill diameter */; int ndk /* Padstack ndk flag */; int lrn /* Pad layer range count */; int lrfl[] /* Pad first layer list */; int lrll[] /* Pad last layer list */; } pstkl[] /* Padstack list */; int pstkn = 0 /* Padstack count */; int stkreq = 0 /* Padstack creation request flag */; int lrn = 0 /* Current pad layer range count */; int lrfl[] /* Current pad first layer list */; int lrll[] /* Current pad last layer list */; struct repldes { /* String replacement descriptor */ string oldstr /* Old sub string */; string newstr /* New sub string */; }; struct repldes rplcstrl[] /* Replacement string list */; int rplcstrn /* Replacement string count */; string textid = creatextid() /* Get multiline text base ID */; int mtextcnt = 0 /* Multiline text count */; // Main program void main() { string startdir /* Start directory */; string fname /* File name */; string varname /* Variable name */; int len /* String length */; int i /* Loop control variable */; // Save current element with verification on request verifysave(); // Get and check the process mode bae_promptdialog(UPRPROCMODE); switch (bae_askmenu(5, UPRPROCALL,UPRPROCLIB,UPRPROCSALL,UPRPROCSLIB,UPRABORT)) { // Complete case 0 : libonly=0; break; // Library only case 1 : libonly=1; break; // Single project complete case 2 : libonly=0; sfileflag=1; break; // Single project cibrary only case 3 : libonly=1; sfileflag=1; break; default : error_abort(); } // Get the name translation patterns for (rplcstrn=0;rplcstrn<1000;rplcstrn++) { if ((rplcstrl[rplcstrn].oldstr=bae_inistrval( bae_inifieldvarname(PAR_TXFREPLPAT,rplcstrn,0),""))=="") break; rplcstrl[rplcstrn].newstr=bae_inistrval( bae_inifieldvarname(PAR_TXFREPLPAT,rplcstrn,1),""); } // Get the plan layer definitions for (i=0;i<=12;i++) { // Build variable name sprintf(varname,PAR_TXFPLANLAY,i); // Query layer variable if (varget(varname,LAYERPLAN[i])!=0) // No layer info available LAYERPLAN[i]=LAYERINV; } // Get the info layer definitions for (i=0;i<=127;i++) { // Build variable name sprintf(varname,PAR_TXFINFOLAY,i); // Query layer variable if (varget(varname,LAYERINFO[i])!=0) // No layer info available LAYERINFO[i]=LAYERINV; } if (sfileflag) { // Get the TXF file name if (bae_askfilename(txffname,TXFEXT,UPRTXFFILE) || txffname=="") error_abort(); // Save current state for undo bae_callmenu(MNU_BAESAVESTATE); procfile(txffname); } else { // Select source directory startdir=UINPOPABORT; if (bae_askdirname(startdir,getcwd(),UPRTDIR)!=0 || startdir==UINPOPABORT) error_abort(); // Save current state for undo bae_callmenu(MNU_BAESAVESTATE); // Scan the directory len=strlen(startdir)-1; if (startdir[len]=='/' || startdir[len]=='\\') startdir[len]='\0'; fname=""; while (scandirfnames(startdir,TXFEXT,fname)==1) // Build full TXF file name procfile(startdir+bae_swversion(4)+fname); } // Print done message bae_prtdialog(REPDONE); } void procfile(string fn) /* // Process an input file // Parameters : // string fn : File name */ { string msg /* Message string */; // Get the TXF file name txffname=fn; // Build the output database name ddbfname=convstring(txffname,0)+DDBEXT; // Create message file msgfname=convstring(txffname,0)+MSGEXT; mfh=fopen(msgfname,1); currot=cura=curca=pwidth=0.0; curpstkproc=curpartproc=curlayproc=curpolyn= brdpolyn=cmpn=vian=pown=laytransn=pstkn=stkreq=lrn=0; layordmax=(-1); toplay=1; // Parse the TXF file sprintf(msg,REPPARSE,txffname); bae_prtdialog(msg); parsefile(txffname); fclose(mfh); } /*________________________________________________________________*/ // TXF input data BNF syntax description #bnf { // TXF BNF input syntax definition txf_file : txf_sectionlist ; txf_sectionlist : txf_sectionlist txf_section | txf_section | ; txf_section : txf_head | txf_globaldata | txf_symboldefs | txf_gatedefs | txf_shapedefs | txf_typdefs | txf_complist | txf_netclasslist | txf_netclass_classlist | txf_netlist | txf_layout | txf_schematic ; txf_head : "header" "{" headcmds "}" ; txf_globaldata : "global_data" "{" global_datacmds "}" ; txf_symboldefs : "symbol_definitions" "{" symbollist "}" ; txf_gatedefs : "gate_definitions" "{" gatelist "}" ; txf_shapedefs : "shape_definitions" "{" shapelist "}" ; txf_typdefs : "typ_definitions" "{" typlist "}" ; txf_complist : "component_list" "{" componentlist "}" ; txf_netclasslist : "net_class_list" "{" net_classlist "}" ; txf_netclass_classlist : "net_class_class_list" "{" net_class_classlist "}" ; txf_netlist : "net_list" "{" netlist "}" ; txf_layout : "layout" (p_layout) "{" layoutcmds (p_layoutend) "}" ; txf_schematic : "schematic" "{" schematiccmds "}" ; headcmds : headcmds headcmd | headcmd | ; headcmd : unit | version | comment | terminal_grid | lib_name ; global_datacmds : global_datacmds global_datacmd | global_datacmd | ; global_datacmd : trackparameter | drillparameter | padparameter | padstacklist | boarddefinition | options | symbol_editor_options | package_editor_options | schematic_options | layer_parameter (p_layerparam) | layer_parameter_list | via_ranges | via_rules | via_parameter | attribute_definitions | attribute_list | variantname_list ; attribute_list : "attribute_list" "{" attributelist "}" ; attribute_definitions : "attribute_definitions" "{" attributelist "}" ; attributelist : attributelist attribute | attribute | ; attribute : "attribute" "{" attributecmds "}" ; attributecmds : attributecmds attributecmd | attributecmd | ; attributecmd : name | value ; variantname_list : "variant_list" "{" variantnamecmds "}" ; variantnamecmds : variantnamecmds variantnamecmd | variantnamecmd | ; variantnamecmd : name | activestr ; variant_list : "variant_list" "{" variantlist "}" ; variantlist : variantlist variant | variant | ; variant : "variant" "{" variantcmds "}" ; variantcmds : variantcmds variantcmd | variantcmd | ; variantcmd : name | place | typ | part_code | technologyref | reference | comment ; symbollist : symbollist symbol | symbol | ; symbol : "symbol" "{" symbolcmds "}" ; symbolcmds : symbolcmds symbolcmd | symbolcmd | ; symbolcmd : name | typ | size | offset | cell_size | width | origin_typ | xcount_typ | ycount_typ | symbolelements | symbolnet ; symbolelements : "elements" "{" symbolelementcmds "}" ; symbolelementcmds : symbolelementcmds symbolelementcmd | symbolelementcmd | ; symbolelementcmd : line | solid | rectangle | polygon | circle | arc | symboltext | place_holder ; line : "line" (p_resetwidth) "{" linecmds "}" ; linecmds : linecmds linecmd | linecmd | ; linecmd : start | end | layer | width | fixed | pattern | placeholder_list ; pattern : "pattern" "{" intnum "}" ; via : "via" "{" viacmds (p_via) "}" ; viacmds : viacmds viacmd | viacmd | ; viacmd : coor (p_viacoord) | name | rotation | fixed | arc | firstlayer | lastlayer ; airline : "air_line" "{" start end "}" ; track : "track" "{" trackcmds (p_track) "}" ; trackcmds : trackcmds trackcmd | trackcmd | ; trackcmd : start | end | layer | width | fixed ; circle : "circle" (p_polygonstart(0)) "{" circlecmds "}" ; circlecmds : circlecmds circlecmd | circlecmd | ; circlecmd : coor | radius | width | filled | layer ; arc : "arc" "{" arccmds "}" ; arccmds : arccmds arccmd | arccmd | ; arccmd : coor | radius | start_angle | end_angle | width | layer | fixed ; rectangle : "rectangle" (p_resetwidth) "{" rectanglecmds "}" ; rectanglecmds : rectanglecmds rectanglecmd | rectanglecmd | ; rectanglecmd : pivot | size | rotation | width | layer ; polyline : "polyline" (p_polylinestart) "{" polylinecmds "}" ; polylinecmds : polylinecmds polylinecmd | polylinecmd | ; polylinecmd : coor | width | layer ; polygon : "polygon" (p_polygonstart(0)) "{" polygoncmds "}" ; polygoncmds : polygoncmds polygoncmd | polygoncmd | ; polygoncmd : coor | arc_ccw | arc_cw | width | filled | layer ; solid : "solid" "{" solidcmds "}" ; solidcmds : solidcmds solidcmd | solidcmd | ; solidcmd : pivot | size | rotation | layer ; copper_area : "copper_area" (p_polygonstart(1)) "{" copper_areacmds (p_shapepoly) "}" ; copper_areacmds : copper_areacmds copper_areacmd | copper_areacmd | ; copper_areacmd : coor | arc_ccw | arc_cw | width | layer ; netcopper_area : "copper_area" (p_polygonstart(3)) "{" netcopper_areacmds "}" ; netcopper_areacmds : netcopper_areacmds netcopper_areacmd | netcopper_areacmd | ; netcopper_areacmd : width | layer | border (p_shapepoly) | polyborder | hole (p_shapepoly) | ring | style | fixed | islands | contact | max_thermals | min_thermals | contact_width | increase_gap | draw_distance ; border : "border" "{" (p_polygonstart(3)) polycmds "}" ; inner_border : "inner_border" "{" (p_polygonstart(3)) polycmds "}" ; hole : "hole" "{" (p_polygonstart(5)) polycmds "}" ; polyborder : "polygon" "{" subpolys "}" ; subpolys : subpolys subpoly | subpoly | ; subpoly : border (p_shapepoly) | inner_border (p_shapepoly) | hole (p_shapepoly) ; ring : "ring" "{" ringcmds "}" ; ringcmds : ringcmds ringcmd | ringcmd | ; ringcmd : border (p_shapepoly) | hole (p_shapepoly) ; polycmds : polycmds polycmd | polycmd | ; polycmd : coor | arc_ccw | arc_cw ; blocking_area : "blocking_area" (p_polygonstart(2)) "{" areacmds (p_shapepoly) "}" ; power_area : "power_area" (p_polygonstart(4)) "{" areacmds (p_shapepoly) "}" ; areacmds : areacmds areacmd | areacmd | ; areacmd : coor | arc_ccw | arc_cw | keepout_type | fixed | layer | width | "net_list" "{" areanetlist "}" | min_height | max_height ; areanetlist : areanetlist areanet | areanet | ; areanet : "net" "{" areanetcmds "}" ; areanetcmds : areanetcmds areanetcmd | areanetcmd | ; areanetcmd : name (p_netname) | quostr (p_quonetname) ; symbolnet : "net" "{" quostr "}" ; symboltext : "text" (p_resetwidth) "{" symboltextcmds "}" ; symboltextcmds : symboltextcmds symboltextcmd | symboltextcmd | ; symboltextcmd : pivot | size | rotation | no_mirror | adjust | aspect_ratio | right_reading | font | layer | width | text | fixed | variant_list ; placeholder_list : "placeholder_list" "{" place_holders "}" ; place_holders : place_holders place_holder | place_holder | ; place_holder : "place_holder" (p_resetwidth) "{" place_holder_cmds "}" ; place_holder_cmds : place_holder_cmds place_holder_cmd | place_holder_cmd | ; place_holder_cmd : pivot | size | rotation | no_mirror | adjust | text | typ (p_typname) | hidden | aspect_ratio | width | font | layer | fixed | right_reading ; terminal : "terminal" "{" terminalcmds "}" ; terminalcmds : terminalcmds terminalcmd | terminalcmd | ; terminalcmd : name | pivot | offset | size | rotation | hidden | adjust | aspect_ratio | offset2 | rotation2 | hidden2 | size2 | adjust2 | aspect_ratio2 | pintyp | pin_class | element_class | symbolnet | font | font2 ; intern_frame : "intern_frame" "{" intern_framecmds "}" ; intern_framecmds : intern_framecmds intern_framecmd | intern_framecmd | ; intern_framecmd : size | cell_size | width | origin_typ | xcount_typ | ycount_typ ; pinref : "pin" "{" quostr "}" ; pin : "pin" "{" pincmds "}" ; pincmds : pincmds pincmd | pincmd | ; pincmd : name (p_pinname) | pivot | rotation | "padstack" "{" quostr (p_name) "}" | "pad" (p_paddefstart) "{" paddefcmds "}" | "drill" "{" coorddim (p_diameter) "}" | "ndk" "{" intnum (p_ndk) "}" ; paddefcmds : paddefcmds paddefcmd | paddefcmd | ; paddefcmd : name | padlayers ; padlayers : "layer" "{" padlayerlist "}" ; padlayerlist : padlayerlist padlayerspec | padlayerspec | ; padlayerspec : layertype "{" padlayernum (p_padsinglelay) "}" | layertype "{" padlayernum (p_firstlayer) ":" padlayernum (p_lastlayer) "}" | layertype "{" padlayernum (p_firstlayer) ";" padlayernum (p_lastlayer) "}" ; padlayernum : intnum (p_layerspec(1)) ; point : "point" (p_pointstart) "{" pointcmds (p_pointend) "}" ; pointcmds : pointcmds pointcmd | pointcmd | ; pointcmd : coor | size | rotation | radius | filled | typ (p_typname) | layer | fixed ; text : "text" "{" quostr "}" ; adjust : "adjust" "{" adjustoption (p_adjust) "}" ; adjust2 : "adjust2" "{" adjustoption (p_adjust2) "}" ; adjustoption : "left" (p_justify(8)) | "center" (p_justify(9)) | "right" (p_justify(10)) | "centerleft" (p_justify(4)) | "centercenter" (p_justify(5)) | "centerright" (p_justify(6)) | "topleft" (p_justify(0)) | "topcenter" (p_justify(1)) | "topright" (p_justify(2)) ; origin_typ : "origin_typ" "{" origin_typ_option "}" ; origin_typ_option : "lower_left" | "upper_left" ; xcount_typ : "xcount_typ" "{" count_typ_option "}" ; ycount_typ : "ycount_typ" "{" count_typ_option "}" ; count_typ_option : "number" | "alpha" ; gatelist : gatelist gate | gate | ; gate : "gate" "{" gatecmds "}" ; gatecmds : gatecmds gatecmd | gatecmd | ; gatecmd : name | gatealternative_list ; gatealternative_list : "alternative_list" "{" gatealternativelist "}" ; gatealternativelist : gatealternativelist gatealternative | gatealternative | ; gatealternative : "alternative" "{" gatealternativecmds "}" ; gatealternativecmds : gatealternativecmds gatealternativecmd | gatealternativecmd | ; gatealternativecmd : name | pivot | radius | size | gatealternativeelements ; gatealternativeelements : "elements" "{" gatealternativeelementcmds "}" ; gatealternativeelementcmds : gatealternativeelementcmds gatealternativeelementcmd | gatealternativeelementcmd | ; gatealternativeelementcmd : line | solid | rectangle | polygon | circle | arc | symboltext | place_holder | terminal ; shapelist : shapelist shape | shape | ; shaperef : "shape" "{" quostr "}" ; shape : "shape" "{" shapecmds "}" ; shapecmds : shapecmds shapecmd | shapecmd | ; shapecmd : name (p_shapename) | shapealternative_list ; shapealternative_list : "alternative_list" "{" shapealternativelist "}" ; shapealternativelist : shapealternativelist shapealternative | shapealternative | ; shapealternative : "alternative" "{" shapealternativecmds (p_shapeend) "}" ; shapealternativecmds : shapealternativecmds shapealternativecmd | shapealternativecmd | ; shapealternativecmd : name (p_shapestart) | pivot (p_shapepivot) | size | radius | dummy | shapealternativeelements | attribute_list ; shapealternativeelements : "elements" "{" shapealternativeelementcmds "}" ; shapealternativeelementcmds : shapealternativeelementcmds shapealternativeelementcmd | shapealternativeelementcmd | ; shapealternativeelementcmd : line (p_shapeline) | solid (p_shapesolid) | rectangle (p_shaperectangle) | polygon (p_shapepoly) | polyline (p_shapepoly) | blocking_area (p_shapepoly) | copper_area (p_shapepoly) | circle (p_shapecircle) | arc (p_shapearc) | symboltext (p_text) | place_holder (p_shapeplaceholder) | pin (p_shapepinend) | point ; typlist : typlist typdef | typdef | ; typdef : "typ" "{" typdefcmds "}" ; typdefcmds : typdefcmds typdefcmd | typdefcmd | ; typdefcmd : name | lib_name | class | typ | show_id | subtyp | attribute_list | "technology_list" "{" technologylist "}" | "mapping_list" "{" mappinglist "}" ; technologylist : technologylist technology | technology | ; technology : "technology" "{" technologycmds "}" ; technologycmds : technologycmds technologycmd | technologycmd | ; technologycmd : valid | shaperef | part_code | technologyref | reference | mappingref | attribute_list ; technologyref : "technology" "{" quostr "}" ; mappingref : "mapping" "{" quostr "}" ; mappinglist : mappinglist mapping | mapping | ; mapping : "mapping" "{" mappingcmds "}" ; mappingcmds : mappingcmds mappingcmd | mappingcmd | ; mappingcmd : "name_list" "{" namelist "}" | "non_terminal_pin_list" "{" non_terminal_pinlist "}" | "gate_list" "{" mappinggatelist "}" | mappingref ; namelist : namelist name | name | ; non_terminal_pinlist : non_terminal_pinlist non_terminal_pin | non_terminal_pin | ; non_terminal_pin : "non_terminal_pin" "{" non_terminal_pincmds "}" ; non_terminal_pincmds : non_terminal_pincmds non_terminal_pincmd | non_terminal_pincmd | ; non_terminal_pincmd : pinref | connect ; mappinggatelist : mappinggatelist mappinggate | mappinggate | ; mappinggate : "gate" "{" mappinggatecmds "}" ; mappinggatecmds : mappinggatecmds mappinggatecmd | mappinggatecmd | ; mappinggatecmd : name | id | swappable | "terminal_list" "{" terminallist "}" ; terminallist : terminallist gateterminal | gateterminal | ; gateterminal : "terminal" "{" gateterminalcmds "}" ; gateterminalcmds : gateterminalcmds gateterminalcmd | gateterminalcmd | ; gateterminalcmd : name | element_class | pin_class | "pin_list" "{" pinlist "}" | symbolnet ; pinlist : pinlist pinlistcmd | pinlistcmd | ; pinlistcmd : pinref | terminal_pin ; terminal_pin : "terminal_pin" "{" terminal_pincmds "}" ; terminal_pincmds : terminal_pincmds terminal_pincmd | terminal_pincmd | ; terminal_pincmd : pinref | bridge_code ; componentlist : componentlist componentorgroup | componentorgroup | ; componentorgroup : component | compgroup ; compgroup : "group" "{" compgroupcmds "}" ; compgroupcmds : compgroupcmds compgroupcmd | compgroupcmd | ; compgroupcmd : name | "component" "{" quostr "}" ; component : "component" "{" componentcmds "}" ; componentcmds : componentcmds componentcmd | componentcmd | ; componentcmd : din | typ | show_id | componentsymbol | componentcomp | attribute_list | componentshape (p_componentshape) ; componentcomp : "component" "{" componentcompcmds "}" ; componentcompcmds : componentcompcmds componentcompcmd | componentcompcmd | ; componentcompcmd : symbolref | typ | technologyref | reference | comment | part_code | lib_name | class ; componentsymbol : "symbol" "{" componentsymbolcmds "}" ; componentsymbolcmds : componentsymbolcmds componentsymbolcmd | componentsymbolcmd | ; componentsymbolcmd : name | pivot | rotation | mirror | id | placed | componentsymbolelements ; componentsymbolelements : "elements" "{" componentsymbolelementcmds "}" ; componentsymbolelementcmds : componentsymbolelementcmds componentsymbolelementcmd | componentsymbolelementcmd | ; componentsymbolelementcmd : place_holder | terminal | symboltext ; componentshape : "shape" "{" componentshapecmds "}" ; componentshapecmds : componentshapecmds componentshapecmd | componentshapecmd | ; componentshapecmd : name (p_compshape) | pivot (p_comppos) | rotation (p_comprot) | layer (p_complay) | placed (p_compplaced) | typ | part_code | technologyref | mappingref | fixed | reference | comment | lib_name | class | dynamic_pads | componentshapeelements | attribute_list | variant_list ; componentshapeelements : "elements" "{" componentshapeelementcmds "}" ; componentshapeelementcmds : componentshapeelementcmds componentshapeelementcmd | componentshapeelementcmd | ; componentshapeelementcmd : place_holder | symboltext | pin ; net_classlist : net_classlist net_class | net_class | ; net_class : "net_class" "{" net_classcmds "}" ; net_classcmds : net_classcmds net_classcmd | net_classcmd | ; net_classcmd : name | std_netclass | "distance_list" "{" distancelist "}" | "via_list" "{" padstacks "}" | width | min_width | min_width_switch | max_width | max_width_switch | width_switch ; distancelist : distancelist distance | distance | ; net_class_classlist : net_class_classlist net_class_class | net_class_class | ; net_class_class : "net_class_class" "{" net_class_classcmds "}" ; net_class_classcmds : net_class_classcmds net_class_classcmd | net_class_classcmd | ; net_class_classcmd : net_classname | net_class2name | "distance_list" "{" distancelist "}" ; net_classname : "net_class" "{" quostr "}" ; net_class2name : "net_class2" "{" quostr "}" ; netlist : netlist net | net | ; net : "net" "{" netcmds "}" ; netcmds : netcmds netcmd | netcmd | ; netcmd : name | width | distanceval | min_width | min_width_switch | max_width | max_width_switch | width_switch | min_route_length | max_route_length | effective_via_length | trace_amplitude | trace_gap | junction_type | reconnect | via_switch | color | supply | "pin_list" "{" netpinlist "}" | "via_list" "{" padstacks "}" | net_classname ; netpinlist : netpinlist netpin | netpin | ; netpin : "pin" "{" netpincmds "}" ; netpincmds : netpincmds netpincmd | netpincmd | ; netpincmd : name | din | pin_class | gate_class | element_class | flooded | isolate | id | "net" "{" quostr "}" | slpname | width | arc | typ ; layoutcmds : layoutcmds layoutcmd | layoutcmd | ; layoutcmd : "net_list" "{" layout_netlist "}" | "text_list" "{" layout_textlist "}" | "power_areas_list" "{" layout_powerareas "}" | "graphic_elements" "{" layout_graphicelements "}" ; layout_netlist : layout_netlist layout_net | layout_net | ; layout_net : "net" "{" layout_netcmds "}" ; layout_netcmds : layout_netcmds layout_netcmd | layout_netcmd | ; layout_netcmd : name (p_netname) | track | arc (p_shapearc) | airline | via | netcopper_area | netpin ; layout_textlist : layout_textlist symboltext (p_text) | symboltext (p_text) | ; layout_powerareas : layout_powerareas power_area | power_area | ; layout_graphicelements : layout_graphicelements layout_graphicelement | layout_graphicelement | ; layout_graphicelement : blocking_area ; schematiccmds : schematiccmds schematiccmd | schematiccmd | ; schematiccmd : "folder" "{" foldercmds "}" ; foldercmds : foldercmds foldercmd | foldercmd | ; foldercmd : name | "frame" "{" quostr "}" | "frame_size" "{" xycoord "}" | "bus_definitions" "{" buslist "}" | "sheet" "{" sheetcmds "}" ; buslist : buslist busdef | buslist | ; busdef : "bus" "{" buscmds "}" ; buscmds : buscmds buscmd | buscmd | ; buscmd : name | "net_list" "{" areanetlist "}" ; sheetcmds : sheetcmds sheetcmd | sheetcmd | ; sheetcmd : "administration_information" "{" admincmds "}" | "symbol_list" "{" sheet_symbollist "}" | "net_list" "{" sheet_netlist "}" | "bus_list" "{" bus_list "}" | "graphic_elements" "{" schematic_graphicelements "}" | attribute_list ; admincmds : admincmds admincmd | admincmd | ; admincmd : title ; sheet_symbollist : sheet_symbollist sheet_symbol | sheet_symbol | ; sheet_symbol : "symbol" "{" sheet_symbolcmds "}" ; sheet_symbolcmds : sheet_symbolcmds sheet_symbolcmd | sheet_symbolcmd | ; sheet_symbolcmd : din | id | fixed ; sheet_netlist : sheet_netlist sheet_net | sheet_net | ; sheet_net : "net" "{" sheet_netcmds "}" ; sheet_netcmds : sheet_netcmds sheet_netcmd | sheet_netcmd | ; sheet_netcmd : name | line | point | netsymbol | netinfo ; netsymbol : "symbol" "{" netsymbolcmds "}" ; netsymbolcmds : netsymbolcmds netsymbolcmd | netsymbolcmd | ; netsymbolcmd : name | pivot | rotation | mirror ; netinfo : "info" "{" netinfocmds "}" ; netinfocmds : netinfocmds netinfocmd | netinfocmd | ; netinfocmd : name | pivot | rotation | size | mirror ; bus_list : bus_list busentry | busentry | ; busentry : "bus" "{" sheet_buscmds "}" ; sheet_buscmds : sheet_buscmds sheet_buscmd | sheet_buscmd | ; sheet_buscmd : name | line | point | netinfo ; schematic_graphicelements : schematic_graphicelements schematic_graphicelement | schematic_graphicelement | ; schematic_graphicelement : symboltext | line | arc | circle | rectangle | scmsymbol | scmframe | intern_frame ; symbolref : "symbol" "{" quostr "}" ; scmsymbol : "symbol" "{" scmsymbolcmds "}" ; scmsymbolcmds : scmsymbolcmds scmsymbolcmd | scmsymbolcmd | ; scmsymbolcmd : name | pivot | rotation | mirror ; scmframe : "frame" "{" scmframecmds "}" ; scmframecmds : scmframecmds scmframecmd | scmframecmd | ; scmframecmd : name ; via_parameter : "via_parameter" "{" via_list "}" ; via_list : via_list viadef | viadef | ; viadef : "via" "{" viadef_cmds (p_viaend) "}" ; viadef_cmds : viadef_cmds viadef_cmd | viadef_cmd | ; viadef_cmd : name | std_pad | smd_pad | "drill" "{" coorddim (p_diameter) "}" ; via_ranges : "via_ranges" "{" via_rangeslist "}" ; via_rangeslist : via_rangeslist via_range | via_range | ; via_range : "range" "{" indexspec layerrange "}" ; via_rules : "via_rules" "{" via_ruleslist "}" ; via_ruleslist : via_ruleslist via_rule | via_rule | ; via_rule : "via_rule" "{" via_rulecmds "}" ; via_rulecmds : via_rulecmds via_rulecmd | via_rulecmd | ; via_rulecmd : name | range ; layer_parameter_list : "layer_parameter_list" "{" layerparameters "}" ; layerparameters : layerparameters layer_parameter | layer_parameter | ; layer_parameter : "layer_parameter" "{" layer_parametercmds "}" ; layer_parametercmds : layer_parametercmds layer_parametercmd | layer_parametercmd | ; layer_parametercmd : name | layercmd ; layercmd : "layer" "{" layerdefs "}" ; layerdefs : layerdefs layerdef | layerdef | ; layerdef : layer | color | visible | active | pad_param | blocking_area_param | typ | name | layer_order (p_layerorder) ; schematic_options : "schematic_options" "{" schematic_optioncmds "}" ; schematic_optioncmds : schematic_optioncmds schematic_optioncmd | schematic_optioncmd | ; schematic_optioncmd : mm_mode | grid_size ; package_editor_options : "package_editor_options" "{" package_editor_optioncmds "}" ; package_editor_optioncmds : package_editor_optioncmds package_editor_optioncmd | package_editor_optioncmd | ; package_editor_optioncmd : mm_mode ; symbol_editor_options : "symbol_editor_options" "{" symbol_editor_optioncmds "}" ; symbol_editor_optioncmds : symbol_editor_optioncmds symbol_editor_optioncmd | symbol_editor_optioncmd | ; symbol_editor_optioncmd : mm_mode ; options : "options" "{" optioncmds "}" ; optioncmds : optioncmds optioncmd | optioncmd | ; optioncmd : default_text_name | default_text_pos | default_text_layer | default_text_lwidth | default_text_height | default_text_factor | default_text_rotation | default_text_box | mm_mode | pad_drawmode | track_drawmode | area_drawmode | airlines_calc | drc_calc | automove | components_only | components_top | components_bottom | mark_vias | mark_bb_vias | mark_micro_vias | components_refname | components_typname | histogramm | selection_frame | drill_deviation_visible | plated_drill_cover_visible | mark_fixed | cutmode | cutsize | vias_color | bb_vias_color | micro_vias_color | histogramm_color | fixed_color | selection_frame_color | curwidth | cur_copperwidth | snapcursor | default_copper_hatchdist | default_copper_type | default_copper_islands | default_copper_contact | default_copper_contact_width | default_layer | drawmode | cursor | grid | snap | shapefilter | trackfilter | viafilter | pinfilter | tpfilter | areafilter | keepoutfilter | textfilter | routing_rules | highspeed_rules | flooded | use_bb_vias | mm | mils | std_pins_cut | smd_pins_cut | grid_size | reference_libraries ; boarddefinition : "board_definition" "{" boarddefcmds "}" ; boarddefcmds : boarddefcmds boarddefcmd | boarddefcmd | ; boarddefcmd : min_dist (p_boarddistance) | same_net_pin_pin_distance | same_net_smd_via_distance | same_net_via_via_distance | same_net_pin_via_distance | rout_width | via_switch | default_via_list | min_width | max_width | min_route_length | max_route_length | effective_via_length | trace_amplitude | trace_gap | junction_type | solder_past_size | solder_mask_size | rest_ring | isolation_distance | heattrap_distance | heattrap_width | apgrid | reprotext | firmtext | companytext | comment | origin | size | testpoint_grid | testpoint_via | testpoint_std_pad | testpoint_smd_pad | testpoint_poly_pad | via_contact_mode | recreate_polygons | dynamic_vias | dynamic_pins | project_title | project_version | modification_date | modification_time | date | time | creator | modificator | board_outline | min_copper_arae | optimize_airlines | power_border_width ; padstacklist : "padstack_list" "{" padstacks "}" ; padstacks : padstacks padstack | padstack | ; padstack : "padstack" "{" padstackcmds "}" (p_padstackend) ; padstackcmds : padstackcmds padstackcmd | padstackcmd | ; padstackcmd : name (p_padstackstart) | pad (p_padstackpad) | diameter (p_padstackdrill) | drilldeviation | dnc | plated_drill_cover | typ | ident ; padparameter : "pad_parameter" "{" padlist "}" ; padlist : padlist pad | pad | ; pad : "pad" (p_padstart) "{" padcmds "}" (p_padend) ; pad_param : "pad" "{" intnum "}" ; padcmds : padcmds padcmd | padcmd | ; padcmd : name | placepadelem | layerrange | ident ; placepadelem : placepadelemname placepadcontactspec "{" place_padelemcmds (p_storepad) "}" ; placepadelemname : "place_comp" (p_padvis(1)) | "place_solder" (p_padvis(0)) ; placepadcontactspec : "contact" | "no_contact" (p_padvis(2)) | ; place_padelemcmds : place_padelemcmds place_padelempcmd | place_padelempcmd | ; place_padelempcmd : std_pad | smd_pad | poly_pad ; layerrange : firstlayer lastlayer ; firstlayer : "first_layer" "{" layerspec (p_firstlayer) "}" ; lastlayer : "last_layer" "{" layerspec (p_lastlayer) "}" ; layer : "layer" (p_layerinit) "{" layerspec "}" ; layerspec : layertype "{" intnum (p_layerspec(0)) "}" | intnum (p_layerdirect) | ; layertype : "soldermask" (p_layertyp(2)) | "solderpast" (p_layertyp(3)) | "track" (p_layertyp(0)) | "supply" (p_layertyp(1)) | "plan" (p_layertyp(4)) | "frame" (p_layertyp(6)) | "air_line" (p_layertyp(8)) | "shortcircuit" (p_layertyp(8)) | "drill" (p_layertyp(5)) | "point" (p_layertyp(8)) | "crossover" (p_layertyp(8)) | "info" (p_layertyp(7)) ; smd_pad : "smd_pad" "{" (p_clearradius) start end optradius (p_smdpad) "}" ; std_pad : "std_pad" "{" stdcmds (p_stdpad) "}" ; stdcmds : stdcmds stdcmd | stdcmd | ; stdcmd : diameter | padtyp ; padtyp : "typ" "{" intnum (p_padtyp) "}" ; poly_pad : "poly_pad" "{" polycmds "}" ; drillparameter : "drill_parameter" "{" drilllist "}" ; drilllist : drilllist drill | drill | ; drill : "drill" "{" drillcmds "}" ; drillcmds : drillcmds drillcmd | drillcmd | ; drillcmd : diameter | indexspec | typ ; trackparameter : "track_parameter" "{" tracklist "}" ; tracklist : tracklist track_param | track_param | ; track_param : "track" "{" track_paramcmds "}" ; track_paramcmds : track_paramcmds track_paramcmd | track_paramcmd | ; track_paramcmd : width | indexspec | coorddim ; active : "active" "{" intnum "}" ; activestr : "active" "{" quostr "}" ; blocking_area_param : "blocking_area" "{" intnum "}" ; color : "color" "{" intnum "}" ; supply : "supply" "{" intnum "}" ; font : "font" "{" intnum "}" ; font2 : "font2" "{" intnum "}" ; std_netclass : "std_netclass" "{" intnum "}" ; layer_order : "layer_order" "{" intnum "}" ; indexspec : "index" "{" intnum "}" ; visible : "visible" "{" intnum "}" ; default_text_name : "default_text_name" "{" ident "}" ; default_text_pos : "default_text_pos" "{" xycoord "}" ; default_text_layer : "default_text_layer" "{" layerspec "}" ; default_text_lwidth : "default_text_lwidth" "{" coorddim "}" ; default_text_height : "default_text_height" "{" coorddim "}" ; default_text_factor : "default_text_factor" "{" fltnum "}" ; default_text_rotation : "default_text_rotation" "{" fltnum "}" ; default_text_box : "default_text_box" "{" xycoord "}" ; mm_mode : "mm_mode" "{" intnum "}" ; pad_drawmode : "pad_drawmode" "{" intnum "}" ; track_drawmode : "track_drawmode" "{" intnum "}" ; area_drawmode : "area_drawmode" "{" intnum "}" ; airlines_calc : "airlines_calc" "{" intnum "}" ; drc_calc : "drc_calc" "{" intnum "}" ; automove : "automove" "{" intnum "}" ; components_only : "components_only" "{" intnum "}" ; components_top : "components_top" "{" intnum "}" ; components_bottom : "components_bottom" "{" intnum "}" ; mark_vias : "mark_vias" "{" intnum "}" ; mark_bb_vias : "mark_bb_vias" "{" intnum "}" ; mark_micro_vias : "mark_micro_vias" "{" intnum "}" ; components_refname : "components_refname" "{" intnum "}" ; components_typname : "components_typname" "{" intnum "}" ; histogramm : "histogramm" "{" intnum "}" ; selection_frame : "selection_frame" "{" intnum "}" ; drill_deviation_visible : "drill_deviation_visible" "{" intnum "}" ; plated_drill_cover_visible : "plated_drill_cover_visible" "{" intnum "}" ; mark_fixed : "mark_fixed" "{" intnum "}" ; cutmode : "cutmode" "{" intnum "}" ; cutsize : "cutsize" "{" coorddim "}" ; vias_color : "vias_color" "{" intnum "}" ; bb_vias_color : "bb_vias_color" "{" intnum "}" ; micro_vias_color : "micro_vias_color" "{" intnum "}" ; histogramm_color : "histogramm_color" "{" intnum "}" ; fixed_color : "fixed_color" "{" intnum "}" ; selection_frame_color : "selection_frame_color" "{" intnum "}" ; curwidth : "curwidth" "{" coorddim "}" ; cur_copperwidth : "cur_copperwidth" "{" coorddim "}" ; snapcursor : "snapcursor" "{" intnum "}" ; default_copper_hatchdist : "default_copper_hatchdist" "{" coorddim "}" ; default_copper_type : "default_copper_type" "{" intnum "}" ; default_copper_islands : "default_copper_islands" "{" intnum "}" ; default_copper_contact : "default_copper_contact" "{" intnum "}" ; default_copper_contact_width : "default_copper_contact_width" "{" coorddim "}" ; default_layer : "default_layer" "{" layerspec "}" ; drawmode : "drawmode" "{" intnum "}" ; cursor : "cursor" "{" intnum "}" ; grid : "grid" "{" coorddim "}" ; gridlist : gridlist grid | grid | ; snap : "snap" "{" coorddim "}" ; shapefilter : "shapefilter" "{" intnum "}" ; trackfilter : "trackfilter" "{" intnum "}" ; viafilter : "viafilter" "{" intnum "}" ; pinfilter : "pinfilter" "{" intnum "}" ; tpfilter : "tpfilter" "{" intnum "}" ; areafilter : "areafilter" "{" intnum "}" ; keepoutfilter : "keepoutfilter" "{" intnum "}" ; textfilter : "textfilter" "{" intnum "}" ; routing_rules : "routing_rules" "{" intnum "}" ; highspeed_rules : "highspeed_rules" "{" intnum "}" ; flooded : "flooded" "{" intnum "}" ; isolate : "isolate" "{" intnum "}" ; use_bb_vias : "use_bb_vias" "{" intnum "}" ; mm : "mm" "{" gridlist "}" ; mils : "mils" "{" gridlist "}" ; std_pins_cut : "std_pins_cut" "{" intnum "}" ; smd_pins_cut : "smd_pins_cut" "{" intnum "}" ; grid_size : "grid_size" "{" coorddim "}" ; reference_libraries : "reference_libraries" "{" lib_names "}" ; lib_names : lib_names lib_name | lib_name | ; min_dist : "min_dist" "{" coorddim (p_trackdist) "}" ; same_net_pin_pin_distance : "same_net_pin_pin_distance" "{" coorddim "}" ; same_net_smd_via_distance : "same_net_smd_via_distance" "{" coorddim "}" ; same_net_via_via_distance : "same_net_via_via_distance" "{" coorddim "}" ; same_net_pin_via_distance : "same_net_pin_via_distance" "{" coorddim "}" ; rout_width : "rout_width" "{" coorddim "}" ; default_via_list : "default_via_list" "{" viapadstacks "}" | "default_via" "{" ident (p_viapadstack) "}" ; viapadstacks : viapadstacks viapadstack | viapadstack | ; viapadstack : "padstack" "{" ident (p_viapadstack) "}" ; min_route_length : "min_route_length" "{" coorddim "}" ; max_route_length : "max_route_length" "{" coorddim "}" ; effective_via_length : "effective_via_length" "{" coorddim "}" ; trace_amplitude : "trace_amplitude" "{" coorddim "}" ; trace_gap : "trace_gap" "{" coorddim "}" ; junction_type : "junction_type" "{" ident "}" ; solder_past_size : "solder_past_size" "{" coorddim "}" ; solder_mask_size : "solder_mask_size" "{" coorddim "}" ; rest_ring : "rest_ring" "{" coorddim "}" ; isolation_distance : "isolation_distance" "{" coorddim "}" ; heattrap_distance : "heattrap_distance" "{" coorddim "}" ; heattrap_width : "heattrap_width" "{" coorddim "}" ; apgrid : "apgrid" "{" coorddim "}" ; reprotext : "reprotext" "{" ident "}" ; firmtext : "firmtext" "{" ident "}" ; companytext : "companytext" "{" ident "}" ; origin : "origin" "{" xycoord "}" ; size : "size" "{" xycoord (p_size) "}" ; size2 : "size2" "{" xycoord "}" ; offset : "offset" "{" xycoord "}" ; offset2 : "offset2" "{" xycoord "}" ; cell_size : "cell_size" "{" xycoord "}" ; pivot : "pivot" "{" xycoord (p_pivot) "}" ; mirror : "mirror" "{" intnum "}" ; no_mirror : "no_mirror" "{" intnum "}" ; right_reading : "right_reading" "{" intnum "}" ; rotation : "rotation" "{" angnum (p_rotation) "}" ; rotation2 : "rotation2" "{" angnum "}" ; hidden : "hidden" "{" intnum "}" ; hidden2 : "hidden2" "{" intnum "}" ; aspect_ratio : "aspect_ratio" "{" fltnum "}" ; aspect_ratio2 : "aspect_ratio2" "{" fltnum "}" ; pin_class : "pin_class" "{" intnum "}" ; gate_class : "gate_class" "{" intnum "}" ; element_class : "element_class" "{" intnum "}" ; bridge_code : "bridge_code" "{" intnum "}" ; testpoint_grid : "testpoint_grid" "{" xycoord "}" ; testpoint_via : "testpoint_via" "{" intnum "}" ; via_contact_mode : "via_contact_mode" "{" intnum "}" ; testpoint_std_pad : "testpoint_std_pad" "{" intnum "}" ; testpoint_smd_pad : "testpoint_smd_pad" "{" intnum "}" ; testpoint_poly_pad : "testpoint_poly_pad" "{" intnum "}" ; recreate_polygons : "recreate_polygons" "{" intnum "}" ; dynamic_vias : "dynamic_vias" "{" intnum "}" ; dynamic_pins : "dynamic_pins" "{" intnum "}" ; dynamic_pads : "dynamic_pads" "{" intnum "}" ; project_title : "project_title" "{" ident "}" ; project_version : "project_version" "{" ident "}" ; modification_date : "modification_date" "{" ident "}" ; modification_time : "modification_time" "{" ident "}" ; date : "date" "{" ident "}" ; time : "time" "{" ident "}" ; creator : "creator" "{" ident "}" ; modificator : "modificator" "{" ident "}" ; board_outline : "board_outline" "{" boardoutlcmds "}" ; boardoutlcmds : boardoutlcmds boardoutlcmd | boardoutlcmd | ; boardoutlcmd : fixed | signal_width | power_width | border_rule | border_outline | "cutout_list" "{" board_cutouts "}" | distance (p_boarddistance) ; border_outline : "border_outline" (p_polygonstart(0)) "{" polycmds (p_border) "}" ; board_cutouts : board_cutouts cutout | cutout | ; cutout : "cutout" (p_polygonstart(2)) "{" areacmds (p_shapepoly) "}" ; coorlist : coorlist coor | coor | ; coor : "coor" "{" xycoord (p_addpoint(0)) "}" ; arc_ccw : "arc_ccw" "{" xycoord (p_addpoint(1)) "}" ; arc_cw : "arc_cw" "{" xycoord (p_addpoint(2)) "}" ; distance : "distance" "{" distancecmds "}" ; distancecmds : distancecmds distancecmd | distancecmd | ; distancecmd : track_param | smd_pin | std_pin | via_param | copper_area_param | distanceval | fromdistance | todistance ; distanceval : "distance" "{" coorddim "}" ; fromdistance : "from" "{" distelemspec "}" ; todistance : "to" "{" distelemspec "}" ; distelemspec : "smd_pin" | "std_pin" | "copper_area" | "track" | "via" ; smd_pin : "smd_pin" "{" coorddim "}" ; std_pin : "std_pin" "{" coorddim "}" ; via_param : "via" "{" coorddim "}" ; copper_area_param : "copper_area" "{" coorddim "}" ; min_copper_arae : "min_copper_arae" "{" coorddim "}" ; optimize_airlines : "optimize_airlines" "{" intnum "}" ; power_border_width : "power_border_width" "{" coorddim "}" ; power_width : "power_width" "{" coorddim "}" ; signal_width : "signal_width" "{" coorddim "}" ; border_rule : "border_rule" "{" intnum "}" ; comment : "comment" "{" quostr "}" ; diameter : "diameter" "{" coorddim (p_diameter) "}" ; dnc : "dnc" "{" coorddim "}" ; drilldeviation : "drill_deviation" "{" coorddim "}" ; plated_drill_cover : "plated_drill_cover" "{" coorddim "}" ; min_height : "min_height" "{" coorddim (p_minheight) "}" ; max_height : "max_height" "{" coorddim (p_maxheight) "}" ; end : "end" "{" xycoord (p_end) "}" ; fixed : "fixed" "{" intnum "}" ; lib_name : "lib_name" "{" quostr "}" ; din : "din" "{" quostr (p_din) "}" ; part_code : "part_code" "{" quostr "}" ; title : "title" "{" quostr "}" ; id : "id" "{" quostr "}" ; connect : "connect" "{" quostr "}" ; slpname : "slpname" "{" quostr "}" ; reference : "reference" "{" quostr "}" ; class : "class" "{" quostr "}" ; name : "name" "{" quostr (p_name) "}" ; swappable : "swappable" "{" intnum "}" ; place : "place" "{" intnum "}" ; placed : "placed" "{" placestatus "}" ; placestatus : "placed" (p_plcstatus(1)) | "unplaced" (p_plcstatus(0)) | "free" (p_plcstatus(1)) ; filled : "filled" "{" intnum "}" ; optradius : radius | ; radius : "radius" "{" coorddim (p_radius) "}" ; range : "range" "{" intnum "}" ; reconnect : "reconnect" "{" intnum "}" ; max_thermals : "max_thermals" "{" intnum "}" ; min_thermals : "min_thermals" "{" intnum "}" ; islands : "islands" "{" intnum "}" ; contact : "contact" "{" intnum "}" ; start : "start" "{" xycoord (p_start) "}" ; terminal_grid : "terminal_grid" "{" coorddim "}" ; unit : "unit" "{" unitspec "}" ; unitspec : "inch" (p_unitl(1)) | "mm" (p_unitl(2)) | "mil" (p_unitl(3)) ; keepout_type : "keepout_type" "{" ident "}" ; pintyp : "typ" "{" pintypspec "}" ; pintypspec : "other" | "in" | "out" | "power" ; typ : "typ" "{" ident "}" ; subtyp : "subtyp" "{" ident "}" ; style : "style" "{" ident "}" ; valid : "valid" "{" validval "}" ; validval : "true" | "false" ; value : "value" "{" ident "}" ; dummy : "dummy" "{" ident "}" ; show_id : "show_id" "{" ident "}" ; version : "version" "{" fltnum (p_version) "}" ; width : "width" "{" coorddim (p_width) "}" ; min_width : "min_width" "{" coorddim "}" ; via_switch : "via_switch" "{" intnum "}" ; min_width_switch : "min_width_switch" "{" intnum "}" ; max_width : "max_width" "{" coorddim "}" ; max_width_switch : "max_width_switch" "{" intnum "}" ; width_switch : "width_switch" "{" intnum "}" ; contact_width : "contact_width" "{" coorddim "}" ; increase_gap : "increase_gap" "{" coorddim "}" ; draw_distance : "draw_distance" "{" coorddim "}" ; start_angle : "start_angle" "{" angnum (p_startangle) "}" ; end_angle : "end_angle" "{" angnum (p_endangle) "}" ; xycoord : coorddim (p_x) "," coorddim (p_y) ; coorddim : fltnum (p_coord) ; ident : IDENT (p_ident) | NUMBER (p_ident) | SQSTR (p_quoident) | DQSTR (p_quoident) | "component" (p_ident) | "copper_area" (p_ident) | "date" (p_ident) | "din" (p_ident) | "dnc" (p_ident) | "filled" (p_ident) | "frame" (p_ident) | "id" (p_ident) | "in" (p_ident) | "name" (p_ident) | "net" (p_ident) | "out" (p_ident) | "other" (p_ident) | "part_code" (p_ident) | "pin" (p_ident) | "placed" (p_ident) | "power" (p_ident) | "project_title" (p_ident) | "sheet" (p_ident) | "symbol" (p_ident) | "technology" (p_ident) | "text" (p_ident) | "time" (p_ident) | "track" (p_ident) | "typ" (p_ident) | "variant" (p_ident) | "via" (p_ident) ; quostr : DQSTR (p_quostr) ; intnum : NUMBER (p_intnum(0)) | "-" NUMBER (p_intnum(1)) ; angnum : NUMBER (p_angnum(0)) | "-" NUMBER (p_angnum(1)) ; fltnum : NUMBER (p_fltnum(0)) | "-" NUMBER (p_fltnum(1)) ; } // BNF syntax definition end /*________________________________________________________________*/ // Scanner/parser functions void parsefile(string fn) /* // Parse an input file // Parameters : // string fn : File name */ { // Parser error messages STRINGS ERRS = { "", M("(synparsefile) Keine BNF-Definition verfuegbar!", "(synparsefile) No BNF definition available!"), M("(synparsefile) Parser ist bereits aktiv!", "(synparsefile) Parser already active!"), M("(synparsefile) Fehler beim Oeffnen der Datei '%s'!", "(synparsefile) Error opening file '%s'!"), M("(synparsefile) Zu viele offene Dateien!", "(synparsefile) Too many open files!"), M("[%s/%d] Fataler Lese-/Schreibfehler!", "[%s/%d] Fatal read/write error!"), M("[%s/%d] Scan Item '%s' zu lang!", "[%s/%d] Scan item '%s' too long!"), M("[%s/%d] Syntaxfehler bei '%s' (unerwartetes Symbol)!", "[%s/%d] Syntax error at '%s' (unexpected symbol)!"), M("[%s/%d] Dateiende erreicht!", "[%s/%d] Unexpected end of file!"), M("[%s/%d] Stackueberlauf (BNF zu komplex)!", "[%s/%d] Stack overflow (BNF too complex)!"), M("[%s/%d] Stackunterlauf (BNF fehlerhaft)!", "[%s/%d] Stack underflow (BNF erroneous)!"), M("[%s/%d] Fehler von Parser Aktion/Funktion!", "[%s/%d] Error from parse action function!"), M("(synparsefile) Unbekannter Fehlercode %d!", "(synparsefile) Unknown error code %d!") }; int status /* Parser status */; string msg /* Error message */; // Get the plan checking parameter lay_getplanchkparam(curttdist,0,0,0,"",-1,0); // Parse the input file and evaluate the parser status synsetintpar(0,1); if ((status=synparsefile(fn))==0) { // No error synsetintpar(0,0); return; } synsetintpar(0,0); if (status>=arylength(ERRS)) sprintf(msg,ERRS[arylength(ERRS)-1],status); else sprintf(msg,ERRS[status], fn,synscanline(),synscanstring()); // Print the error message error(msg); } // Parser action routines int p_coord() /* // Receive a coordinate // Return value : // zero if done or (-1) on error */ { // Store the current coordinate curcoord=curflt*lenconv; // Return without errors return(0); } int p_version() /* // Receive a version spec. // Return value : // zero if done or (-1) on error */ { // Store the current version curversion=curflt; // Return without errors return(0); } int p_unitl(int code) /* // Handle the length units definition request // Return value : // zero if done or (-1) on error // Parameters : // int code : Length units code */ { // Set the length conversion factor switch (code) { // Inch case 1 : lenconv=cvtlength(1.0,1,0); break; // mm case 2 : lenconv=cvtlength(1.0,2,0); break; // mil case 3 : lenconv=cvtlength(1.0,3,0); break; // Implementation gap default : return(-1); } // Return without errors return(0); } int p_x() /* // Receive a X coordinate // Return value : // zero if done or (-1) on error */ { // Store the current X coordinate curx=curcoord; // Return without errors return(0); } int p_y() /* // Receive a Y coordinate // Return value : // zero if done or (-1) on error */ { // Store the current Y coordinate cury=curcoord; // Return without errors return(0); } int p_start() /* // Receive a start coordinate // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curxs=curx; curys=cury; // Return without errors return(0); } int p_end() /* // Receive an end coordinate // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curxe=curx; curye=cury; // Return without errors return(0); } int p_pivot() /* // Receive a pivot position // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curpx=curx; curpy=cury; // Return without errors return(0); } int p_comppos() /* // Receive a component position // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curcx=curpx; curcy=curpy; // Return without errors return(0); } int p_compplaced() /* // Receive a component placement status // Return value : // zero if done or (-1) on error */ { // Store the current placement status curcplcstat=curplcstat; // Return without errors return(0); } int p_comprot() /* // Receive a component rotation // Return value : // zero if done or (-1) on error */ { // Store the current angle curca=cura; // Return without errors return(0); } int p_complay() /* // Receive a component placement layer // Return value : // zero if done or (-1) on error */ { // Store the current layer curclayer=curlayer; // Return without errors return(0); } int p_size() /* // Receive a size // Return value : // zero if done or (-1) on error */ { // Store the current coordinates cursx=curx; cursy=cury; // Return without errors return(0); } int p_width() /* // Receive a width value // Return value : // zero if done or (-1) on error */ { // Store the current dimension curwidth=curcoord; curpwidth=PWSCALE*curwidth; // Return without errors return(0); } int p_resetwidth() /* // Receive a width reset // Return value : // zero if done or (-1) on error */ { // Reset the current width curwidth=curpwidth=0.0; curadjust=curadjust2=8; // Return without errors return(0); } int p_radius() /* // Receive a radius value // Return value : // zero if done or (-1) on error */ { // Store the current dimension currad=curcoord; // Return without errors return(0); } int p_diameter() /* // Receive a diameter value // Return value : // zero if done or (-1) on error */ { // Store the current dimension curdia=curcoord; // Return without errors return(0); } int p_trackdist() /* // Receive a track distance value // Return value : // zero if done or (-1) on error */ { // Store the current dimension curtdist=curcoord; // Return without errors return(0); } int p_boarddistance() /* // Receive a board distance definitions end // Return value : // zero if done or (-1) on error */ { // Store the current distance curttdist=curtdist; // Return without errors return(0); } int p_minheight() /* // Receive a minimum height value // Return value : // zero if done or (-1) on error */ { // Store the current dimension minheight=curcoord; // Return without errors return(0); } int p_maxheight() /* // Receive a maximum height value // Return value : // zero if done or (-1) on error */ { // Store the current dimension maxheight=curcoord; // Return without errors return(0); } int p_polylinestart() /* // Receive a polyline start // Return value : // zero if done or (-1) on error */ { // Clear polygon curpolyn=0; pfill=0; curwidth=curpwidth=0.0; // Return without errors return(0); } int p_polygonstart(int fillinit) /* // Receive a polygon start // Return value : // zero if done or (-1) on error // Parameters : // int fillinit : Fill modus default */ { // Clear polygon curpolyn=0; pfill=fillinit; minheight=maxheight=curwidth=curpwidth=0.0; // Return without errors return(0); } int p_addpoint(int ptyp) /* // Receive a polygon point // Return value : // zero if done or (-1) on error // Parameters : // int ptyp : Point type */ { addpoint(curx,cury,ptyp); // Return without errors return(0); } int p_padvis(int vismode) /* // Receive a pad visibility mode // Return value : // zero if done or (-1) on error // Parameters : // int vismode : Pad visibilty mode */ { padvis=vismode; // Clear polygon curpolyn=0; // Return without errors return(0); } int p_ndk() /* // Receive a NDK flag // Return value : // zero if done or (-1) on error */ { curndk=curint; // Return without errors return(0); } int p_padtyp() /* // Receive a pad shape // Return value : // zero if done or (-1) on error */ { padshape=curint; // Return without errors return(0); } int p_pointstart() /* // Receive a point start // Return value : // zero if done or (-1) on error */ { curtypname=""; currot=0.0; // Return without errors return(0); } int p_pointend() /* // Receive a point end // Return value : // zero if done or (-1) on error */ { // Check if part was created if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); switch (curtypname) { // Middle point case "mid" : if (LAYMIDPPOINT>=DOCLAYBASE) if (ged_storetext("$",curx,cury,currot,MIDPPOINTSIZE, LAYMIDPPOINT,0)) fprintf(mfh,ERRPLCTEXT, txffname,synscanline(),"$"); break; // Pin 1 point case "pin_1" : if (LAYPIN1POINT>=DOCLAYBASE) if (ged_storetext("$",curx,cury,currot,PIN1POINTSIZE, LAYPIN1POINT,0)) fprintf(mfh,ERRPLCTEXT, txffname,synscanline(),"$"); break; } // Return without errors return(0); } int p_padstart() /* // Receive a pad start // Return value : // zero if done or (-1) on error */ { // Clear pad polygons padcomppn=padsoldpn=curpolyn=0; // Return without errors return(0); } int p_storepad() /* // Receive a pad store // Return value : // zero if done or (-1) on error */ { // Check if no contact area if (padvis==2) // Ignore no contact pad return(0); if (padvis) { padcomppl=curpolyl; padcomppn=curpolyn; } else { padsoldpl=curpolyl; padsoldpn=curpolyn; } // Return without errors return(0); } int p_clearradius() /* // Clear the radius // Return value : // zero if done or (-1) on error */ { currad=0.0; // Return without errors return(0); } int p_smdpad() /* // Receive a smd pad // Return value : // zero if done or (-1) on error */ { double xhalf,yhalf /* Pad half dimensions */; // Get pad dimensions xhalf=0.5*fabs(curxe-curxs); yhalf=0.5*fabs(curye-curys); // Check pad shape if (currad==0.0) { // Store rectangle polygon curpolyn=0; addpoint(-xhalf,-yhalf,0); addpoint(xhalf,-yhalf,0); addpoint(xhalf,yhalf,0); addpoint(-xhalf,yhalf,0); } else { // Store rectangle polygon with round corners curpolyn=0; // Lower right arc addpoint(xhalf-currad,-yhalf,0); addpoint(xhalf-currad,-yhalf+currad,1); addpoint(xhalf,-yhalf+currad,0); // Upper right arc addpoint(xhalf,yhalf-currad,0); addpoint(xhalf-currad,yhalf-currad,1); addpoint(xhalf-currad,yhalf,0); // Upper left arc addpoint(-xhalf+currad,yhalf,0); addpoint(-xhalf+currad,yhalf-currad,1); addpoint(-xhalf,yhalf-currad,0); // Lower left arc addpoint(-xhalf,-yhalf+currad,0); addpoint(-xhalf+currad,-yhalf+currad,1); addpoint(-xhalf+currad,-yhalf,0); } // Return without errors return(0); } int p_stdpad() /* // Receive a standard pad // Return value : // zero if done or (-1) on error */ { switch (padshape) { // Octagon case 0 : curpolyn=0; addpoint(-0.5*curdia,0.0,0); addpoint(0.0,0.0,1); addpoint(0.5*curdia,0.0,0); addpoint(0.0,0.0,1); break; // Square case 1 : curpolyn=0; addpoint(-0.5*curdia,-0.5*curdia,0); addpoint(0.5*curdia,-0.5*curdia,0); addpoint(0.5*curdia,0.5*curdia,0); addpoint(-0.5*curdia,0.5*curdia,0); break; // Circle case 2 : curpolyn=0; addpoint(-0.5*curdia,0.0,0); addpoint(0.0,0.0,1); addpoint(0.5*curdia,0.0,0); addpoint(0.0,0.0,1); break; } // Return without errors return(0); } int p_viaend() /* // Receive a via end // Return value : // zero if done or (-1) on error */ { int i /* Loop control variable */; if (strlen(curname)>(MAXKEYLEN-1)) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN-1]='\0'; } // Check if pad already exists if (existddbelem(ddbfname,DDBCLLPAD,curname)==1) return(0); // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_GEDSAVELEM); bae_setintpar(22,0); } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,3,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,curname); bae_storetextiact(1,"1"); bae_storetextiact(1,"1"); bae_setintpar(22,1); call(MNU_GEDCREELEM); bae_setintpar(22,0); // Store single pad bae_clearpoints(); for (i=0;iMAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN]='\0'; } // Check if pad already exists if (existddbelem(ddbfname,DDBCLLPAD,curname)==1) return(0); // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_GEDSAVELEM); bae_setintpar(22,0); } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,3,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,curname); bae_storetextiact(1,"1"); bae_storetextiact(1,"1"); bae_setintpar(22,1); call(MNU_GEDCREELEM); bae_setintpar(22,0); // Compare pads for (i=0;i(MAXKEYLEN-1)) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN-1]='\0'; } // Check if padstack already exists if (existddbelem(ddbfname,DDBCLLSTK,curname)==1) { curpstkproc=0; curpartproc=0; return(0); } // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_GEDSAVELEM); bae_setintpar(22,0); } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,2,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,curname); bae_storetextiact(1,"1"); bae_storetextiact(1,"1"); bae_setintpar(22,1); call(MNU_GEDCREELEM); bae_setintpar(22,0); curpstkproc=1; // Return without errors return(0); } int p_padstackdrill() /* // Receive a padstack drill // Return value : // zero if done or (-1) on error */ { // Check if padstack was created if (!curpstkproc || curdia==0.0) // Return without errors return(0); // Store the drill ged_storedrill(0.0,0.0,0.5*curdia,curndk ? NDKDRLCL : 0); curndk=0; // Return without errors return(0); } int p_padstackpad() /* // Receive a padstack pad // Return value : // zero if done or (-1) on error */ { int layer /* Layer code */; // Check if padstack was created if (!curpstkproc) // Return without errors return(0); if (curflayer==LAYERINV) curflayer=curllayer; else if (curllayer==LAYERINV) curllayer=curflayer; if (curflayer==LAYERINV) return(0); // Check if middle layer pad if (curflayer==1 && curllayer==POWLAYBASE) curflayer=curllayer=LAYERBTW; if (strlen(curname)>MAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN]='\0'; } // Check if all signal layers plus some extra layer if (curflayer==0 && curllayer>=DOCLAYBASE) { ged_storeuref(curname,0.0,0.0,0.0,LAYERALL,0); ged_storeuref(curname,0.0,0.0,0.0,(curllayer&~1)|2,0); } else if (curllayerMAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN]='\0'; } // Check if part already exists if (existddbelem(ddbfname,DDBCLLPRT,curname)==1) { curpstkproc=0; curpartproc=0; return(0); } // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_GEDSAVELEM); bae_setintpar(22,0); } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,1,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,curname); bae_storetextiact(1,"1"); bae_storetextiact(1,"1"); bae_setintpar(22,1); call(MNU_GEDCREELEM); bae_setintpar(22,0); curpartproc=1; // Return without errors return(0); } int p_shapepivot() /* // Receive a shape pivot point // Return value : // zero if done or (-1) on error */ { if (!curpartproc) // Return without errors return(0); // Ignore pivot return(0); // Set upper element boundary bae_clriactqueue(); bae_storemouseiact(1,2.0*curpx,2.0*curpy,0,LMB); bae_callmenu(MNU_GEDPARUBND); // Set element origin bae_storemouseiact(1,2.0*curpx,2.0*curpy,0,LMB); bae_callmenu(MNU_GEDPARORIG); // Return without errors return(0); } int p_shapeend() /* // Receive a shape end // Return value : // zero if done or (-1) on error */ { // Check if part was created if (!curpartproc) // Return without errors return(0); // Shrink part bae_setintpar(22,2); baewsshrink(1); bae_setintpar(22,0); // Save the part bae_setintpar(22,1); call(MNU_GEDSAVELEM); bae_setintpar(22,0); curpartproc=0; // Return without errors return(0); } int p_pinname() /* // Receive a pin name // Return value : // zero if done or (-1) on error */ { curpinname=curname; curndk=0; // Return without errors return(0); } int p_paddefstart() /* // Receive a pad style padstack definition start // Return value : // zero if done or (-1) on error */ { // Check if part was created if (!curpartproc) // Return without errors return(0); lrn=0; stkreq=1; curdia=0.0; // Return without errors return(0); } int p_shapepinend() /* // Receive a shape pin placement end // Return value : // zero if done or (-1) on error */ { string partname /* Current shape part name */; int cnt /* Padstack layer range count */; int i, j /* Loop control variables */; // Check if part was created if (!curpartproc) // Return without errors return(0); if (strlen(curname)>(MAXKEYLEN-1)) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN-1]='\0'; } // Check if pad padstack creation if (stkreq) { // Search padstack definition for (i=0;i=cnt) break; } if (i>=pstkn) { // Get same pad padstack count for (i=j=0;i=POWLAYBASE && lrfl[i]MAXKEYLEN) { // Build the multiline text rules sprintf(rl[0],":%s:%s='%s_%d';", RS_PCBSUBJ,RS_MTEXTID,textid,mtextcnt); sprintf(rl[1],":%s:%s=%d;",RS_PCBSUBJ,RS_MTEXTCOL,textcol); sprintf(rl[2],":%s:%s=%d;",RS_PCBSUBJ,RS_MTEXTROW,0); sprintf(rl[3],":%s:%s=%.2f;",RS_PCBSUBJ,RS_MTEXTLS,1.0); substr=strextract(quostr,0,MAXKEYLEN-1); if (ged_storetext(substr,curpx+cosa*xoff-sina*yoff, curpy+sina*xoff+cosa*yoff,currot,cursy,curlayer, (curlayer&0x03)==0 ? 1 : 0)) { fprintf(mfh,ERRPLCTEXT,txffname,synscanline(),quostr); } else if (lay_lastfigelem(lastfig)==0) { // Attach rules if (lay_rulefigatt(lastfig,rl)) rs_error(-1); if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH, curpwidth,0.0,""); } quostr=strextract(quostr,MAXKEYLEN,strlen(quostr)); curpx+=cosa*80.0*cursy/3.0; curpy+=sina*80.0*cursy/3.0; textcol++; } if (ged_storetext(quostr,curpx+cosa*xoff-sina*yoff, curpy+sina*xoff+cosa*yoff,currot,cursy,curlayer, (curlayer&0x03)==0 ? 1 : 0)) { fprintf(mfh,ERRPLCTEXT,txffname,synscanline(),quostr); } else { if (textcol!=0 && lay_lastfigelem(lastfig)==0) { // Attach rules if (lay_rulefigatt(lastfig,rl)) rs_error(-1); mtextcnt++; } if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } // Return without errors return(0); } int p_shapeplaceholder() /* // Receive a shape place holder end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; string attrname /* Attribute name */; double xoff,yoff /* Text justify offset */; double cosa,sina /* Trigonometric values */; int textmode = 0 /* Text mode */; // Check if part was created if (!curpartproc || curlayer==LAYERINV) // Return without errors return(0); // Check the designator type switch (curtypname) { case "din" : attrname="$"; break; case "typ" : attrname=ATTRTYP; break; case "technology" : attrname=ATTRTEC; break; default : // Ignore return(0); } textadjust(curadjust,cursx,cursy,xoff,yoff,currot,1,textmode); sina=sin(currot); cosa=cos(currot); if (strlen(attrname)>MAXKEYLEN) { fprintf(mfh,ERRLONGTEXT,txffname,synscanline(),attrname); attrname[MAXKEYLEN]='\0'; } if (ged_storetext(attrname,curpx+cosa*xoff-sina*yoff, curpy+sina*xoff+cosa*yoff,currot,cursy,curlayer,textmode)) fprintf(mfh,ERRPLCTEXT,txffname,synscanline(),attrname); else if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); // Return without errors return(0); } int p_shapeline() /* // Receive a shape line end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; // Check if part was created and valid layer if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); bae_storepoint(curxs,curys,0); bae_storepoint(curxe,curye,0); // Store polygon if (curlayer>=DOCLAYBASE) { if (ged_storepoly(curlayer,L_POLYDOCLINE,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } else { if (ged_storepath(curlayer,curwidth)) fprintf(mfh,ERRPLCPATH,txffname,synscanline()); } // Return without errors return(0); } int p_shapearc() /* // Receive a shape arc end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; // Check if part was created and valid layer if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); // Check if full circle arc if (curas==curae) { bae_storepoint(curx-currad,cury,0); bae_storepoint(curx,cury,1); bae_storepoint(curx+currad,cury,0); bae_storepoint(curx,cury,1); bae_storepoint(curx-currad,cury,0); } else { bae_storepoint( curx+currad*cos(curas),cury+currad*sin(curas),0); bae_storepoint(curx,cury,1); bae_storepoint( curx+currad*cos(curae),cury+currad*sin(curae),0); } // Store polygon if (curlayer>=DOCLAYBASE) { if (ged_storepoly(curlayer,L_POLYDOCLINE,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } else { if (ged_storepath(curlayer,curwidth)) fprintf(mfh,ERRPLCPATH,txffname,synscanline()); } // Return without errors return(0); } int p_shaperectangle() /* // Receive a shape rectangle end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; // Check if part was created and valid layer if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); bae_storepoint(curpx,curpy,0); bae_storepoint(curpx+cursx,curpy,0); bae_storepoint(curpx+cursx,curpy+cursy,0); bae_storepoint(curpx,curpy+cursy,0); bae_storepoint(curpx,curpy,0); // Store polygon if (curlayer>=DOCLAYBASE) { if (ged_storepoly(curlayer,L_POLYDOCLINE,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } else { if (ged_storepath(curlayer,curwidth)) fprintf(mfh,ERRPLCPATH,txffname,synscanline()); } // Return without errors return(0); } int p_shapesolid() /* // Receive a shape solid end // Return value : // zero if done or (-1) on error */ { // Check if part was created and valid layer if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); bae_storepoint(curpx,curpy,0); bae_storepoint(curpx+cursx,curpy,0); bae_storepoint(curpx+cursx,curpy+cursy,0); bae_storepoint(curpx,curpy+cursy,0); // Store polygon if (ged_storepoly(curlayer, curlayer>=DOCLAYBASE ? L_POLYDOCAREA :L_POLYCOPPASS,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } int p_shapecircle() /* // Receive a shape circle end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; // Check if part was created and valid layer if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); // Check if glue point marker if (curlayer==LAYERGLUE && curlayer>=DOCLAYBASE) { bae_storepoint(curx-currad-0.5*curwidth,cury,0); bae_storepoint(curx,cury,1); bae_storepoint(curx+currad+0.5*curwidth,cury,0); bae_storepoint(curx,cury,1); if (ged_storepoly(curlayer,L_POLYDOCAREA,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } bae_storepoint(curx-currad,cury,0); bae_storepoint(curx,cury,1); bae_storepoint(curx+currad,cury,0); bae_storepoint(curx,cury,1); if (pfill!=1) bae_storepoint(curx-currad,cury,0); // Store polygon if (curlayer>=DOCLAYBASE) { if (ged_storepoly(curlayer, pfill ? L_POLYDOCAREA : L_POLYDOCLINE,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (pfill==0 && curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } else { if (pfill) { if (ged_storepoly(curlayer,L_POLYCOPPASS,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); } else { if (ged_storepath(curlayer,curwidth)) fprintf(mfh,ERRPLCPATH,txffname,synscanline()); } } // Return without errors return(0); } int p_shapepoly() /* // Receive a shape polygon end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; double xmin, ymin /* Polygon lower range */; double xmax, ymax /* Polygon upper range */; int i /* Loop control variable */; // Check if part was created and valid layer if ((!curpartproc && !curlayproc) || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); for (i=0;i=DOCLAYBASE) { if (pfill==2 || (curlayer&~0x03)==LAYERPDRC) { if (ged_storepoly(pfill==2 ? LAYERPDRC|1 : curlayer, L_POLYKEEPOUT,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (maxheight>0.0 && lay_lastfigelem(lastfig)==0) // Assign the height DRC predicate rule rs_assfigdblpred( lastfig,RS_HEIGHT,maxheight,0.0,""); } else { if (ged_storepoly(curlayer, pfill ? L_POLYDOCAREA : L_POLYDOCLINE,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (pfill==0 && curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred( lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } } else { switch (pfill) { case 0 : if (ged_storepath(curlayer,curwidth)) fprintf(mfh,ERRPLCPATH,txffname,synscanline()); break; case 2 : if (ged_storepoly(curlayer,L_POLYKEEPOUT,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); break; case 5 : if (ged_storepoly(curlayer,L_POLYKEEPOUT,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (lay_lastfigelem(lastfig)==0) // Assign the width pred. rule rs_assfigintpred(lastfig, RS_POLYSUBTYPE,L_POLYFILLFA,0,""); break; case 3 : if (ged_storepoly(curlayer,L_POLYCOPFILL,curnetname,0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); curcopfcnt++; break; case 4 : if (curlayer>=POWLAYBASE) { bae_getpolyrange(xmin,ymin,xmax,ymax); if (xmin<(-1.0) || ymin<(-1.0) || xmax>1.0 || ymax>1.0) { // Define power layer bae_clriactqueue(); bae_storemenuiact(1,pown,LMB); bae_storetextiact(1,curnetname); bae_storemenuiact(1,POWLAYMAX,LMB); call(MNU_GEDPARPOWL); pown++; } else { // Store split power plane area if (ged_storepoly(curlayer, L_POLYSPPAREA,curnetname,0)) fprintf(mfh,ERRPLCPOLY, txffname,synscanline()); if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width pred. rule rs_assfigdblpred(lastfig, RS_PLOTWIDTH,curpwidth,0.0,""); } } else { if (ged_storepoly(curlayer,L_POLYCOPFILL, curnetname,0)) fprintf(mfh, ERRPLCPOLY,txffname,synscanline()); curcopfcnt++; } break; case 1 : default : if (ged_storepoly(curlayer,L_POLYCOPPASS,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); } } // Return without errors return(0); } int p_border() /* // Receive a border polygon end // Return value : // zero if done or (-1) on error */ { brdpolyn=curpolyn; brdpolyl=curpolyl; // Return without errors return(0); } int p_layout() /* // Receive a layout start // Return value : // zero if done or (-1) on error */ { int i /* Loop control variable */; // Check if only library processing if (libonly) return(0); // Save the last element if (bae_planddbclass()!=DDBCLUNDEF) { bae_setintpar(22,2); call(MNU_BAEZOOMALL); bae_setintpar(22,0); if (curcopfcnt) { bae_clriactqueue(); bae_storemenuiact(1,7,1); bae_storemenuiact(1,25,1); call(506); } if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_GEDSAVELEM); bae_setintpar(22,0); } } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,0,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,laydefelemname(ddbfname)); bae_storetextiact(1,"10"); bae_storetextiact(1,"10"); bae_setintpar(22,1); call(MNU_GEDCREELEM); bae_setintpar(22,0); curlayproc=1; curcopfcnt=0; // Set the plan checking parameters lay_setplanchkparam(curttdist,curttdist,curttdist,0.0,"",-1,0); // Set the copper fill isolation distance ged_setdblpar(3,curttdist); // Store the board outline if (brdpolyn) { bae_clearpoints(); for (i=0;iMAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN]='\0'; } if (strlen(curdin)>MAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curdin); curdin[MAXKEYLEN]='\0'; } cmpl[cmpn].name=curdin; cmpl[cmpn].mac=MACPREFIX+curcompname; cmpl[cmpn].x=curcx; cmpl[cmpn].y=curcy; cmpl[cmpn].ang=curca; cmpl[cmpn].mirr= curclayer==0 ? 1 : 0 ; cmpn++; // Return without errors return(0); } int p_track() /* // Receive a track end // Return value : // zero if done or (-1) on error */ { index L_FIGURE lastfig /* Last figure list index */; // Check if layout was created and valid layer if (!curlayproc || curlayer==LAYERINV) // Return without errors return(0); bae_clearpoints(); bae_storepoint(curxs,curys,0); bae_storepoint(curxe,curye,0); if (curlayer>=DOCLAYBASE) { // Store line polygon if (ged_storepoly(curlayer,L_POLYDOCLINE,"",0)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); else if (curpwidth>0.0 && lay_lastfigelem(lastfig)==0) // Assign the width predicate rule rs_assfigdblpred(lastfig,RS_PLOTWIDTH,curpwidth,0.0,""); } else { // Store trace if (ged_storepath(curlayer,curwidth)) fprintf(mfh,ERRPLCPATH,txffname,synscanline()); } // Return without errors return(0); } int p_via() /* // Receive a via end // Return value : // zero if done or (-1) on error */ { // Check if layout was created if (!curlayproc) // Return without errors return(0); // Store via if (ged_storeuref(curname,curvx,curvy,0.0,0,0)) fprintf(mfh,ERRPLCVIA,txffname,synscanline(),curname); // Return without errors return(0); } int p_viacoord() /* // Receive a via end // Return value : // zero if done or (-1) on error */ { curvx=curx; curvy=cury; // Return without errors return(0); } int p_viapadstack() /* // Receive a via definition padstack end // Return value : // zero if done or (-1) on error */ { // Convert the scanned string vial[vian]=convname(curid); vian++; // Return without errors return(0); } int p_name() /* // Receive a name // Return value : // zero if done or (-1) on error */ { // Convert the scanned string curname=convname(quostr); // Return without errors return(0); } int p_din() /* // Receive a designator // Return value : // zero if done or (-1) on error */ { // Convert the scanned string curdin=convname(quostr); // Return without errors return(0); } int p_quostr() /* // Receive a quoted string // Return value : // zero if done or (-1) on error */ { string instr /* Input string */; char c /* Character buffer */; int len /* Symbol name length */; int i /* Loop control variable */; // Get the scanned string instr=synscanstring(); // Get the string length len=strlen(instr); // Transfer the string characters quostr=""; for (i=0;ilayordmax) layordmax=curint; // Return without errors return(0); } int p_layerparam() /* // Receive a layer parameter set // Return value : // zero if done or (-1) on error */ { int laycnt = 0 /* Signal layer count */; int i /* Loop control variable */; // Get the max. layer translation number laytransn=0; for (i=0;i<=layordmax;i++) { if (layordl[i]>laytransn && layordl[i]=0 && layordl[i]2.0) toplay=laycnt-1; laycnt=0; // Store the translated layer codes for (i=0;i<=layordmax;i++) if (layordl[i]>=0 && layordl[i]toplay) toplay=curilayer; // Check if bottom layer if (curint==0) curlayer=0; // Check if top layer else if (curint==1) curlayer=LAYERTOP; else // Inner layer curlayer=curint-1; // Check if layer translation known if (laytransn && curint=0 && curlayer!=LAYERTOP) curlayer=laytransl[curint]; break; // Power layer case 1 : curlayer=curilayer=POWLAYBASE+curint; break; // Solder mask case 2 : curlayer=curilayer= curint ? (LAYERMASK|1) : LAYERMASK; break; // Solder paste case 3 : curlayer=curilayer= curint ? (LAYERPASTE|1) : LAYERPASTE; break; // Plan case 4 : curilayer=curlayer=LAYERPLAN[curint]; break; // Drill case 5 : curlayer=curilayer= curint ? (LAYERDRILL|1) : LAYERDRILL|2; break; // Frame case 6 : curilayer=curlayer=LAYERFRAME; break; // Info case 7 : curilayer=curlayer=LAYERINFO[curint]; break; default : curlayer=curilayer=LAYERINV; } // Return without errors return(0); } int p_padsinglelay() /* // Receive a single pad layer code // Return value : // zero if done or (-1) on error */ { curflayer=curllayer=curlayer; lrfl[lrn]=curflayer; lrll[lrn]=curllayer; lrn++; // Return without errors return(0); } int p_firstlayer() /* // Receive a first layer code // Return value : // zero if done or (-1) on error */ { curflayer=curlayer; // Return without errors return(0); } int p_lastlayer() /* // Receive a last layer code // Return value : // zero if done or (-1) on error */ { curllayer=curlayer; lrfl[lrn]=curflayer; lrll[lrn]=curllayer; lrn++; // Return without errors return(0); } int p_rotation() /* // Receive a rotation angle // Return value : // zero if done or (-1) on error */ { currot=cura; // Return without errors return(0); } int p_startangle() /* // Receive a start angle // Return value : // zero if done or (-1) on error */ { curas=cura; // Return without errors return(0); } int p_endangle() /* // Receive a end angle // Return value : // zero if done or (-1) on error */ { curae=cura; // Return without errors return(0); } int p_justify(int typ) // Receive a justify specification // Returns : zero if done or (-1) on error { // Store the justify specification curjustify=typ; // Return without errors return(0); } int p_adjust() // Receive an adjust specification // Returns : zero if done or (-1) on error { // Store the justify specification curadjust=curjustify; // Return without errors return(0); } int p_adjust2() // Receive a secondary adjust specification // Returns : zero if done or (-1) on error { // Store the justify specification curadjust2=curjustify; // Return without errors return(0); } int p_intnum(int negflag) /* // Receive a integer value // Return value : // zero if done or (-1) on error // Parameters : // int negflag : Negative number flag */ { // Get the current integer value curint=atoi(synscanstring()); // Set negative on request if (negflag) curint*=(-1); // Return without errors return(0); } int p_angnum(int negflag) /* // Receive an angle value // Return value : // zero if done or (-1) on error // Parameters : // int negflag : Negative number flag */ { // Get the current float value cura=atof(synscanstring()); // Set negative on request if (negflag) cura*=(-1.0); // Adjust arc range to [0,360[ while (cura<0.0) cura+=360.0; while (cura>=360.0) cura-=360.0; // Convert to internal units cura*=angconv; // Return without errors return(0); } int p_fltnum(int negflag) /* // Receive a float value // Return value : // zero if done or (-1) on error // Parameters : // int negflag : Negative number flag */ { // Get the current float value curflt=atof(synscanstring()); // Set negative on request if (negflag) curflt*=(-1); // Return without errors return(0); } void addpoint(double x,double y,int t) /* // Add a point to the polygon buffer // Parameters : // double x : X coordinate // double y : Y coordinate // int t : Point type */ { curpolyl[curpolyn].x=x; curpolyl[curpolyn].y=y; curpolyl[curpolyn].t=t; curpolyn++; } string convname(string name) /* // Convert a name string // Return value : // Converted string */ { string instr /* Input string */; string res = "" /* Result string */; string chars = "_" /* Character string */; int len /* Symbol name length */; int i, j, k /* Loop control variable */; // Get the lower case string strlower(instr=name); // Get the string length len=strlen(instr); // Check the string characters for (i=0;i