/* STXFIN (SCM) -- TXF Schematic Data Import */ /* STXFIN (SCM) -- TXF Schaltplan-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 (051207) ENHANCEMENT: // Added macro name prefix support. // rl (050906) RELEASED FOR BAE V6.6. // rl (040811) RELEASED FOR BAE V6.4. // rl (040116) ENHANCEMENT: // Changed from library symbol to full data import. // rl (030213) ORIGINAL CODING. // // DESCRIPTION // // The stxfin User Language program reads TXF schematic data from // a selectable ASCII file and automatically performs the therein // defined schematic definitions. */ // Includes #include "baeparam.ulh" // User Language BAE param. access #include "pop.ulh" // User Language popup utilities #include "scm.ulh" // User Language SCM 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 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 UPRPROCDIR = M("&Verzeichnis konvertieren","Convert &Folder"); string UPRPROCSFILE = M("&Einzeldatei konvertieren","Convert &Project"); string REPSYMNAME = M("%s -> %s\n","%s -> %s\n"); string ERRPLCPIN = M("[%s/%d]: Fehler bei der Pinplatzierung '%s'/'%s'!\n", "[%s/%d]: Error placing pin '%s'/'%s'!\n"); string ERRNOSYM = M("[%s/%d]: Symboldaten zu '%s' nicht gefunden'!\n", "[%s/%d]: Symbol data for '%s' not found!\n"); string ERRPLCSYM = M("[%s/%d]: Fehler bei der Symbolplatzierung '%s'/'%s'!\n", "[%s/%d]: Error placing symbol '%s'/'%s'!\n"); string ERRPLCLAB = M("[%s/%d]: Fehler bei der Labelplatzierung '%s'/'%s'!\n", "[%s/%d]: Error placing label '%s'/'%s'!\n"); string ERRPLCOLAB = M("[%s/%d]: Diagonallabel evtl. nicht verbunden'%s'/'%s'!\n", "[%s/%d]: Diagonal label '%s'/'%s' may be unconnected!\n"); string ERRPLCTAP = M("[%s/%d]: Fehler bei der Bustapplatzierung '%s'!\n", "[%s/%d]: Error placing bus tap '%s'!\n"); string ERRPLCPOLY = M("[%s/%d]: Fehler bei der Polygonerzeugung!\n", "[%s/%d]: Error generating polygon!\n"); string ERRPLCTEXT = M("[%s/%d]: Fehler bei der Texterzeugung '%s'!\n", "[%s/%d]: Error generating text '%s'!\n"); string ERRPLCCON = M("[%s/%d]: Fehler bei der Verbindungserzeugung!\n", "[%s/%d]: Error generating connection!\n"); string ERRLONGTEXT = M("[%s/%d]: Ueberlanger Text '%s' gekuerzt!\n", "[%s/%d]: Long text '%s' truncated!\n"); string ERRLONGSYMN = M("[%s/%d]: Ueberlanger Name '%s' gekuerzt!\n", "[%s/%d]: Long name '%s' truncated!\n"); string ERRPPINMISS = M("Symbol '%s' logischer Pin '%s' ohne Zuweisung!\n", "Symbol '%s' logical pin '%s' without assignment!\n"); string ERRSYMMIS = M("Typsymbol '%s' nicht in TXF-Eingabedatei definiert!\n", "Type symbol '%s' not defined in TXF input file!\n"); // INI file parameter name definitions #define PAR_TXFPLNAME "TXFPLNAME_SCM" // $plname attribute #define PAR_TXFMACPREFIX "TXFMACPREFIX_STD" // Macro prefix #define PAR_TXFTYPATT "TXFTYPATT_STD" // Type attribute #define PAR_TXFTECATT "TXFTECATT_STD" // Technology attribute #define PAR_TXFPARTID "TXFPARTID_SCM" // Part ID attribute #define PAR_TXFPARTIDC "TXFPARTIDC_SCM" // Part ID text class #define PAR_TXFPARTIDS "TXFPARTIDS_SCM" // Part ID size #define PAR_TXFBTNAMES "TXFBTNAMES_SCM" // Bus tap name size #define PAR_TXFRLNAMEC "TXFRLNAMEC_SCM" // $rlname text class #define PAR_TXFRLNAMES "TXFRLNAMES_SCM" // $rlname size #define PAR_TXFDOTRAD "TXFDOTRAD_SCM" // Dot radius #define PAR_TXFBUSTSIZ "TXFBUSTSIZ_SCM" // Bus tap size #define PAR_TXFBUSEXT "TXFBUSEXT_SCM" // Bus lower extension #define PAR_TXFOLDCONV "TXFOLDCONV_SCM" // Old version conv. factor #define PAR_TXFSNAMPAT "TXFSNAMPAT_STD" // Symbol name pattern #define PAR_TXFRPNAMES "TXFRPNAMES_STD" // $rpname size #define PAR_TXFPOWSYM "TXFPOWSYM_STD" // Power symbol name #define PAR_TXFPOWSEXT "TXFPOWSEXT_STD" // Power symbol name extension #define PAR_TXFREPLPAT "TXFREPLPAT_STD" // Name translation pattern #define PAR_MAPLIB "MAPLIB_SCM" // Mapping library name #define PAR_SMAPEXT "SYMMAPEXT_SCM" // Symbol mapping file ext. #define PAR_TXFASSEXT "TXFASSEXT_SCM" // Assignment file extension string ATTRPLNAME = bae_inistrval(PAR_TXFPLNAME,"#:Symboltext#") /* $plname attribute name */; 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 */; string ATTRPARTID = bae_inistrval(PAR_TXFPARTID,"$part_code") /* Part ID attribute name */; double PARTIDSIZE = bae_inidblval(PAR_TXFPARTIDS,0.0001) /* Part ID attribute text size */; int PARTIDCLASS = bae_iniintval(PAR_TXFPARTIDC,1) /* Part ID text class */; double BTNAMESIZE = bae_inidblval(PAR_TXFBTNAMES,0.002) /* Bus tap name size */; double RLNAMESIZE = bae_inidblval(PAR_TXFRLNAMES,0.0001) /* $rlname attribute text size */; int RLNAMECLASS = bae_iniintval(PAR_TXFRLNAMEC,2) /* $rlname text class */; double DOTRAD = bae_inidblval(PAR_TXFDOTRAD,0.0001) /* Dot radius */; double BUSTSIZ = bae_inidblval(PAR_TXFBUSTSIZ,0.003) /* Bus tap size */; double BUSEXT = bae_inidblval(PAR_TXFBUSEXT,0.004) /* Bus lower extension */; string SYMNAMEPAT = bae_inistrval(PAR_TXFSNAMPAT,"*") /* Symbol name pattern */; double RPNAMESIZE = bae_inidblval(PAR_TXFRPNAMES,0.0001) /* $rpname attribute text size */; string POWSYMNAME = bae_inistrval(PAR_TXFPOWSYM,"@powers") /* Power symbol name */; string POWSYMEXT = bae_inistrval(PAR_TXFPOWSEXT,"_power") /* Power symbol name extension */; string MAPLIB = bae_inistrval(PAR_MAPLIB,"mehrfach") /* Mapping library name */; double OLDVERSCONV = bae_inidblval(PAR_TXFOLDCONV,(25.4/15.0)/16.0) /* $rlname attribute text size */; 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 */; // Scanner variables string quostr /* Current quoted string value */; string curname /* Current name */; string curorgname /* Current original name */; string curdin /* Current designator */; string curtitle /* Current title */; string curnetname /* Current net name */; string curpinname /* Current pin name */; string curpintype /* Current pin type */; double curcoord /* Current coordinate */; double curx /* Current X coordinate */; double cury /* Current Y coordinate */; double curxs, curys /* Current start coordinates */; double curxe, curye /* Current end coordinates */; double curpx, curpy /* Current pivot coordinates */; double curspx, curspy /* Current symbol pivot coordinates */; double cursx, cursy /* Current size */; double curs2x, curs2y /* Current secondary size */; double curox, curoy /* Current offset */; double curo2x, curo2y /* Current secondary offset */; double currad /* Current radius */; double curwidth /* Current width */; double cura = 0.0 /* Current angle (default: 0.0) */; double currot = 0.0 /* Current rotation */; double curcrot = 0.0 /* Current component rotation */; double currot2 = 0.0 /* Current 2nd rotation */; 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 */; int curhidden = 0 /* Current hidden option */; int curhidden2 = 0 /* Current 2nd hidden option */; string curid /* Current identifier */; string cursymid /* Current symbol ID */; string cursymname /* Current symbol name */; string curval /* Current value */; string curpartcode /* Current part code */; string curplname /* Current physical library name */; string curmapping /* Current mapping name */; string curtypval /* Current typ value */; string curbasename /* Current base name */; string curtypname /* Current typ name */; string curtypspec /* Current type specification */; string curtypclass /* Current type class name */; int cursymrproc = 0 /* Current symbol ref. process flag */; int curelemproc = 0 /* Current elements process flag */; int cursymproc = 0 /* Current symbol process flag */; int curlineproc = 0 /* Current line process flag */; int curscmproc = 0 /* Current layout process flag */; int curmirror = 0 /* Current mirror flag */; int curcmirror = 0 /* Current component mirror flag */; int curint /* Current integer value */; int curplaced = 0 /* Current placed status */; double curflt /* Current float value */; double curversion = 4.0 /* Current version */; int csymn = 0 /* Component symbol count */; STRINGS csyml /* Component symbol list */; string textid = creatextid() /* Get multiline text base ID */; int mtextcnt = 0 /* Multiline text count */; 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 */; #define SDVAL 0.00005 // Small distance value struct symdes { // Symbol descriptor string name /* Symbol designator name */; string macro /* Symbol macro name */; string typ /* Symbol type */; string val /* Symbol value */; string id /* Symbol part code */; string din /* Symbol part name */; string plname /* Symbol physical library name */; string mapping /* Symbol mapping name */; double x,y /* Symbol coordinates */; double r /* Symbol rotation angle */; int m /* Symbol mirror flag */; } syml[] /* Symbol list buffer */; int symn = 0 /* Symbol count */; int inssymidx /* Insert symbol index */; struct btapdes { // Bus tap descriptor string name /* Bus tap designator name */; double xs,ys /* Bus tap start coordinates */; double xe,ye /* Bus tap end coordinates */; int lastdir /* Bus tap last segment direction */; int line /* Bus tap input file line */; } btapl[] /* Bus tap list */; int btapn = 0 /* Bus tap count */; struct buslinedes { // Bus line descriptor double xs,ys /* Bus line start coordinates */; double xe,ye /* Bus line end coordinates */; int ori /* Bus line orientation */; int line /* Bus line input file line */; } busll[] /* Bus line list */; int busln = 0 /* Bus line count */; int lastsegdir = 0 /* Last segment direction */; struct techdes { // Technology descriptor string part_code /* Part code */; string shape /* Shape name */; string technology /* Technology ($val) */; string mapping /* Mapping ($rlext) */; string height /* Height */; } techl[] /* Technology list */; int techn = 0 /* Technology count */; STRINGS namel /* Mapping name list */; int namen = 0 /* Mapping name count */; STRINGS npinl /* Net name list */; STRINGS nconl /* Net conection name list */; int nconn = 0 /* Mapping name count */; #define STDSYM 0 // Standard symbol #define GATE1 1 // First gate #define GATEN 2 // Alternate gate struct gatepindes { // Gate pin descriptor string lname /* Logical name */; int elem /* Element class code */; int class /* Pin class code */; int out /* Pin swap info output */; STRINGS pnames /* Physical names */; int pnamen /* Physical names count */; }; struct gatedes { // Gate descriptor string name /* Gate name */; string id /* Gate ID */; int swap /* Gate swap flag */; struct gatepindes pl[] /* Gate pin list */; int pn /* Gate pin count */; int gatetyp /* Gate type */; int gatefirst /* Gate first index */; } gatel[] /* Gate list */; int gaten = 0 /* Gate count */; int glpn = 0 /* Gate logical pin count */; int gppn = 0 /* Gate physical pin count */; struct gpmdes { // Gate mapping pin info descriptor string mapping /* Mapping name */; string gate /* Gate name */; string pin /* Pin name */; } gpml[] /* Gate mapping pin info list */; int gpmn = 0 /* Gate mapping pin info count */; int insgpmidx /* Insert gate mapping pin index */; STRINGS symml /* Symbol macro list */; int symrl[] /* Symbol rpname list */; int symmn = 0 /* Symbol macro count */; int inssymmidx /* Ins. symbol macro index */; STRINGS framel /* Frame list */; int framen = 0 /* Frame count */; // File definitions #define TXFEXT ".txf" // TXF data file name extension #define DEFEXT ".def" // Log. def. file name extension #define MSGEXT "_s.lst" // Message file name extension string ASSEXT = bae_inistrval(PAR_TXFASSEXT,".csv") /* Assignment file name ext. */; string MAPEXT = bae_inistrval(PAR_SMAPEXT,".map") /* Mapping list file name ext. */; string txffname /* TXF input file name */; string logfname /* Logical library file name */; string ddbfname /* Output database file name */; int lfh /* Logical library file handle */; string msgfname /* Message file name */; int mfh /* Message file handle */; string assfname /* Assignment file name */; int afh /* Assignment file handle */; string mapfname /* Mapping list file name */; int pfh /* Mapping list file handle */; string slibname /* Short library file name */; // Polygon point definitions struct point { // Point descriptor double x,y /* Point coordinates */; int t /* Point type */; } curpolyl[] /* Polygon buffer */; int curpolyn = 0 /* Polygon buffer size */; int pfill /* Polygon fill flag */; // Main program void main() { string startdir /* Start directory */; string fname /* File name */; int len /* String length */; // Save current element with verification on request verifysave(); // 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 and check the process mode bae_promptdialog(UPRPROCMODE); switch (bae_askmenu(3,UPRPROCDIR,UPRPROCSFILE,UPRABORT)) { case 0 : // 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) // Process the TXF file procfile(startdir+bae_swversion(4)+fname); break; case 1 : // Get the TXF file name if (bae_askfilename(txffname,TXFEXT,UPRTXFFILE) || txffname=="") error_abort(); // Save current state for undo bae_callmenu(MNU_BAESAVESTATE); // Process the file procfile(txffname); break; default : error_abort(); } // Print done message bae_prtdialog(REPDONE); } void procfile(string fn) /* // Process an input file // Parameters : // string fn : File name */ { string msg /* Message string */; // Store the TXF file name txffname=fn; // Build the output database name ddbfname=convstring(txffname,0)+DDBEXT; // Create the bus tap label symbol bae_clriactqueue(); bae_storemenuiact(1,2,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,"bustap"); if (bae_plannotsaved()) bae_storetextiact(1,M_UINYES()); bae_storetextiact(1,"m"); bae_storetextiact(1,"5"); bae_storetextiact(1,"5"); bae_setintpar(22,1); call(MNU_SCMCREELEM); bae_setintpar(22,0); if (scm_storepart("","pin",BUSTSIZ,0.0,0.0,0)!=0) { sprintf(msg,ERRPLCPIN,txffname,synscanline(),"","pin"); error(msg); } bae_clearpoints(); bae_storepoint(0.001,0.001-BUSTSIZ,0); bae_storepoint(BUSTSIZ,0.0,0); if (scm_storepoly(0)) { sprintf(msg,ERRPLCPOLY,txffname,synscanline()); error(msg); } if (scm_storetext("$",BUSTSIZ,0.0,0.0,BTNAMESIZE,0,1)) { sprintf(msg,ERRPLCTEXT,txffname,synscanline(),"$"); error(msg); } bae_setintpar(22,1); call(MNU_SCMSAVELEM); bae_setintpar(22,0); // Create message file msgfname=convstring(txffname,0)+MSGEXT; mfh=fopen(msgfname,1); // Create logical definitions file logfname=convstring(txffname,0)+DEFEXT; lfh=fopen(logfname,1); fprintf(lfh,"loglib\n\n"); // Create mapping list file mapfname=convstring(txffname,0)+MAPEXT; pfh=fopen(mapfname,1); // Create assignment file assfname=convstring(txffname,0)+ASSEXT; afh=fopen(assfname,1); slibname=convstring(txffname,2); // Parse the TXF file sprintf(msg,REPPARSE,txffname); bae_prtdialog(msg); symn=framen=btapn=busln=gaten=glpn=gppn=gpmn=symmn=curpolyn=0; lenconv=1.0/cvtlength(1.0,0,2); angconv=1.0/cvtangle(1.0,0,1); parsefile(txffname); fprintf(lfh,"end.\n"); fclose(lfh); fclose(mfh); fclose(pfh); fclose(afh); // Perform the loglib command system("\""+bae_progdir()+"loglib\" \""+ logfname+"\" \""+ddbfname+"\""); } /*________________________________________________________________*/ // 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" "{" layoutcmds "}" ; 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 | 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 (p_typval) | part_code | technologyref | reference | comment ; symbollist : symbollist symbol | symbol | ; symbol : "symbol" "{" symbolcmds (p_symbolend) "}" ; symbolcmds : symbolcmds symbolcmd | symbolcmd | ; symbolcmd : name | typ (p_symbolstart) | size | offset | cell_size | width | origin_typ | xcount_typ | ycount_typ | symbolelements | symbolnet ; symbolelements : "elements" "{" symbolelementcmds "}" ; symbolelementcmds : symbolelementcmds symbolelementcmd | symbolelementcmd | ; symbolelementcmd : line (p_symbolline) | solid (p_symbolsolid) | rectangle (p_symbolrectangle) | polygon (p_symbolpoly) | circle (p_symbolcircle) | arc (p_symbolarc) | symboltext (p_symboltext) | place_holder (p_symbolplaceholder) ; line : "line" "{" (p_linestart) linecmds (p_lineend) "}" ; linecmds : linecmds linecmd | linecmd | ; linecmd : start | end | layer | width | fixed | pattern | placeholder_list ; pattern : "pattern" "{" intnum "}" ; via : "via" "{" viacmds "}" ; viacmds : viacmds viacmd | viacmd | ; viacmd : coor | name | rotation | fixed | arc | firstlayer | lastlayer ; airline : "air_line" "{" start end "}" ; track : "track" "{" trackcmds "}" ; 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" "{" rectanglecmds "}" ; rectanglecmds : rectanglecmds rectanglecmd | rectanglecmd | ; rectanglecmd : pivot | size | rotation | width | layer ; polyline : "polyline" (p_polylinestart(0)) "{" 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 "}" ; copper_areacmds : copper_areacmds copper_areacmd | copper_areacmd | ; copper_areacmd : coor | arc_ccw | arc_cw | width | layer ; netcopper_area : "copper_area" "{" netcopper_areacmds "}" ; netcopper_areacmds : netcopper_areacmds netcopper_areacmd | netcopper_areacmd | ; netcopper_areacmd : width | layer | border | polyborder | hole | ring | style | fixed | islands | contact | max_thermals | min_thermals | contact_width | increase_gap | draw_distance ; border : "border" (p_polygonstart(0)) "{" polycmds "}" ; inner_border : "inner_border" "{" polycmds "}" ; hole : "hole" "{" polycmds "}" ; polyborder : "polygon" "{" subpolys "}" ; subpolys : subpolys subpoly | subpoly | ; subpoly : border | inner_border | hole ; ring : "ring" "{" ringcmds "}" ; ringcmds : ringcmds ringcmd | ringcmd | ; ringcmd : border | hole ; polycmds : polycmds polycmd | polycmd | ; polycmd : coor | arc_ccw | arc_cw ; blocking_area : "blocking_area" (p_polygonstart(0)) "{" areacmds "}" ; power_area : "power_area" "{" areacmds "}" ; 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 | quostr ; symbolnet : "net" "{" quostr (p_netname) "}" ; symboltext : "text" (p_initadjust) "{" 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_initadjust) "{" place_holder_cmds (p_placeholder) "}" ; 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" (p_initadjust) "{" terminalcmds "}" ; terminalcmds : terminalcmds terminalcmd | terminalcmd | ; terminalcmd : name (p_pinname) | 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 (p_name) "}" ; pin : "pin" "{" pincmds "}" ; pincmds : pincmds pincmd | pincmd | ; pincmd : name | pivot | rotation | "padstack" "{" quostr "}" | "pad" "{" paddefcmds "}" | "drill" "{" coorddim "}" | "ndk" "{" intnum "}" ; paddefcmds : paddefcmds paddefcmd | paddefcmd | ; paddefcmd : name | padlayers ; padlayers : "layer" "{" padlayerlist "}" ; padlayerlist : padlayerlist padlayerspec | padlayerspec | ; padlayerspec : layertype "{" padlayernum "}" | layertype "{" padlayernum ":" padlayernum "}" | layertype "{" padlayernum ";" padlayernum "}" ; padlayernum : intnum ; point : "point" "{" pointcmds "}" ; pointcmds : pointcmds pointcmd | pointcmd | ; pointcmd : coor | size | rotation | radius | filled | typ | 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 (p_symbolend) "}" ; gatecmds : gatecmds gatecmd | gatecmd | ; gatecmd : name (p_gatestart) | gatealternative_list ; gatealternative_list : "alternative_list" "{" gatealternativelist "}" ; gatealternativelist : gatealternativelist gatealternative | gatealternative | ; gatealternative : "alternative" "{" gatealternativecmds "}" ; gatealternativecmds : gatealternativecmds gatealternativecmd | gatealternativecmd | ; gatealternativecmd : name | pivot (p_gatepivot) | radius | size | gatealternativeelements ; gatealternativeelements : "elements" "{" gatealternativeelementcmds "}" ; gatealternativeelementcmds : gatealternativeelementcmds gatealternativeelementcmd | gatealternativeelementcmd | ; gatealternativeelementcmd : line (p_symbolline) | solid (p_symbolsolid) | rectangle (p_symbolrectangle) | polygon (p_symbolpoly) | circle (p_symbolcircle) | arc (p_symbolarc) | symboltext (p_symboltext) | place_holder (p_symbolplaceholder) | terminal (p_symbolpin) ; shapelist : shapelist shape | shape | ; shaperef : "shape" "{" quostr (p_name) "}" ; shape : "shape" "{" shapecmds "}" ; shapecmds : shapecmds shapecmd | shapecmd | ; shapecmd : name | shapealternative_list ; shapealternative_list : "alternative_list" "{" shapealternativelist "}" ; shapealternativelist : shapealternativelist shapealternative | shapealternative | ; shapealternative : "alternative" "{" shapealternativecmds "}" ; shapealternativecmds : shapealternativecmds shapealternativecmd | shapealternativecmd | ; shapealternativecmd : name | pivot | size | radius | dummy | shapealternativeelements | attribute_list ; shapealternativeelements : "elements" "{" shapealternativeelementcmds "}" ; shapealternativeelementcmds : shapealternativeelementcmds shapealternativeelementcmd | shapealternativeelementcmd | ; shapealternativeelementcmd : line | solid | rectangle | polygon | polyline | blocking_area | copper_area | circle | arc | symboltext | place_holder | pin | point ; typlist : typlist typdef | typdef | ; typdef : "typ" "{" typdefcmds "}" ; typdefcmds : typdefcmds typdefcmd | typdefcmd | ; typdefcmd : name (p_typdefname) | lib_name | class (p_typclass) | show_id | typ | subtyp | attribute_list | "technology_list" "{" technologylist "}" | "mapping_list" "{" mappinglist "}" ; technologylist : technologylist technology | technology | ; technology : "technology" "{" technologycmds (p_endtechnology) "}" ; technologycmds : technologycmds technologycmd | technologycmd | ; technologycmd : valid | shaperef (p_shapename) | part_code (p_techpartcode) | technologyref (p_technology) | reference | mappingref (p_techmapping) | attribute_list ; technologyref : "technology" "{" quostr (p_techname) "}" ; mappingref : "mapping" "{" quostr (p_name) "}" ; mappinglist : mappinglist mapping | mapping | ; mapping : "mapping" "{" (p_mappingstart) mappingcmds (p_mappingend) "}" ; mappingcmds : mappingcmds mappingcmd | mappingcmd | ; mappingcmd : "name_list" "{" namelist "}" | "non_terminal_pin_list" "{" non_terminal_pinlist "}" | "gate_list" "{" mappinggatelist "}" | mappingref ; namelist : namelist name (p_mapplname) | name (p_mapplname) | ; 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 (p_netpin) | connect (p_netcon) ; mappinggatelist : mappinggatelist mappinggate | mappinggate | ; mappinggate : "gate" "{" mappinggatecmds (p_gateend) "}" ; mappinggatecmds : mappinggatecmds mappinggatecmd | mappinggatecmd | ; mappinggatecmd : name (p_gatename) | id (p_gateid) | swappable (p_gateswap) | "terminal_list" "{" terminallist "}" ; terminallist : terminallist gateterminal | gateterminal | ; gateterminal : "terminal" "{" gateterminalcmds (p_gatepend) "}" ; gateterminalcmds : gateterminalcmds gateterminalcmd | gateterminalcmd | ; gateterminalcmd : name (p_gatelpin) | element_class (p_gateelem) | pin_class (p_gateclass) | "pin_list" "{" pinlist "}" | symbolnet ; pinlist : pinlist pinlistcmd | pinlistcmd | ; pinlistcmd : pinref (p_gateppin) | terminal_pin ; terminal_pin : "terminal_pin" "{" terminal_pincmds "}" ; terminal_pincmds : terminal_pincmds terminal_pincmd | terminal_pincmd | ; terminal_pincmd : pinref (p_gateppin) | bridge_code ; componentlist : componentlist componentorgroup | componentorgroup | ; componentorgroup : component | compgroup ; compgroup : "group" "{" compgroupcmds "}" ; compgroupcmds : compgroupcmds compgroupcmd | compgroupcmd | ; compgroupcmd : name | "component" "{" quostr "}" ; component : "component" "{" (p_startcomp) componentcmds (p_endcomp) "}" ; componentcmds : componentcmds componentcmd | componentcmd | ; componentcmd : din | typ | show_id | componentsymbol | componentcomp | attribute_list | componentshape ; componentcomp : "component" "{" componentcompcmds "}" ; componentcompcmds : componentcompcmds componentcompcmd | componentcompcmd | ; componentcompcmd : symbolref | typ | technologyref | reference | comment | part_code | lib_name | class ; componentsymbol : "symbol" "{" (p_placed(2)) componentsymbolcmds (p_addsymbol) "}" ; componentsymbolcmds : componentsymbolcmds componentsymbolcmd | componentsymbolcmd | ; componentsymbolcmd : name (p_symbolname) | pivot (p_symbolpivot) | rotation | mirror | id (p_symbolid) | placed | componentsymbolelements ; componentsymbolelements : "elements" "{" (p_elemstart) componentsymbolelementcmds (p_elemend) "}" ; componentsymbolelementcmds : componentsymbolelementcmds componentsymbolelementcmd | componentsymbolelementcmd | ; componentsymbolelementcmd : place_holder | terminal | symboltext ; componentshape : "shape" "{" componentshapecmds "}" ; componentshapecmds : componentshapecmds componentshapecmd | componentshapecmd | ; componentshapecmd : name (p_plname) | pivot | rotation | layer | placed | typ (p_typval) | part_code | technologyref | mappingref (p_mapping) | 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 | track | airline | arc | via | netcopper_area | netpin ; layout_textlist : layout_textlist symboltext | symboltext | ; 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 (p_fframe) "}" | "frame_size" "{" xycoord "}" | "bus_definitions" "{" buslist "}" | "sheet" "{" sheetcmds (p_sheetend) "}" ; 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 (p_postproc) "}" | "net_list" "{" sheet_netlist "}" | "bus_list" "{" bus_list "}" | "graphic_elements" "{" schematic_graphicelements "}" | attribute_list ; admincmds : admincmds admincmd | admincmd | ; admincmd : title (p_sheetname) ; sheet_symbollist : sheet_symbollist sheet_symbol | sheet_symbol | ; sheet_symbol : "symbol" "{" sheet_symbolcmds (p_plcsymbol) "}" ; 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 (p_cnetname) | line (p_netline(0)) | point | netsymbol (p_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 (p_cnetname) | line (p_netline(1)) | point | netinfo ; schematic_graphicelements : schematic_graphicelements schematic_graphicelement | schematic_graphicelement | ; schematic_graphicelement : symboltext (p_symboltext) | line (p_symbolline) | circle (p_symbolcircle) | arc (p_symbolarc) | rectangle (p_symbolrectangle) | scmsymbol | scmframe | intern_frame ; symbolref : "symbol" "{" quostr "}" ; scmsymbol : "symbol" "{" scmsymbolcmds (p_scmsymbol) "}" ; scmsymbolcmds : scmsymbolcmds scmsymbolcmd | scmsymbolcmd | ; scmsymbolcmd : name | pivot | rotation | mirror ; scmframe : "frame" "{" scmframecmds "}" ; scmframecmds : scmframecmds scmframecmd | scmframecmd | ; scmframecmd : name (p_frame) ; via_parameter : "via_parameter" "{" via_list "}" ; via_list : via_list viadef | viadef | ; viadef : "via" "{" viadef_cmds "}" ; viadef_cmds : viadef_cmds viadef_cmd | viadef_cmd | ; viadef_cmd : name | std_pad | smd_pad | "drill" "{" coorddim "}" ; 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 ; 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 | 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 "}" ; padstackcmds : padstackcmds padstackcmd | padstackcmd | ; padstackcmd : name | pad | diameter | drilldeviation | dnc | plated_drill_cover | typ | ident ; padparameter : "pad_parameter" "{" padlist "}" ; padlist : padlist pad | pad | ; pad : "pad" "{" padcmds "}" ; pad_param : "pad" "{" intnum "}" ; padcmds : padcmds padcmd | padcmd | ; padcmd : name | placepadelem | layerrange | ident ; placepadelem : placepadelemname placepadcontactspec "{" place_padelemcmds "}" ; placepadelemname : "place_comp" | "place_solder" ; placepadcontactspec : "contact" | "no_contact" | ; place_padelemcmds : place_padelemcmds place_padelempcmd | place_padelempcmd | ; place_padelempcmd : std_pad | smd_pad | poly_pad ; layerrange : firstlayer lastlayer ; firstlayer : "first_layer" "{" layerspec "}" ; lastlayer : "last_layer" "{" layerspec "}" ; layer : "layer" "{" layerspec "}" ; layerspec : layertype "{" intnum "}" | intnum | ; layertype : "soldermask" | "solderpast" | "track" | "supply" | "plan" | "frame" | "air_line" | "shortcircuit" | "drill" | "point" | "crossover" | "info" ; smd_pad : "smd_pad" "{" start end optradius "}" ; std_pad : "std_pad" "{" stdcmds "}" ; stdcmds : stdcmds stdcmd | stdcmd | ; stdcmd : diameter | padtyp ; padtyp : "typ" "{" intnum "}" ; 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 | fltnum ; 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 "}" ; 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" "{" padstacks "}" | "default_via" "{" ident "}" ; 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 (p_size2) "}" ; offset : "offset" "{" xycoord (p_offset) "}" ; offset2 : "offset2" "{" xycoord (p_offset2) "}" ; cell_size : "cell_size" "{" xycoord "}" ; pivot : "pivot" "{" xycoord (p_pivot) "}" ; mirror : "mirror" "{" intnum (p_mirror) "}" ; no_mirror : "no_mirror" "{" intnum "}" ; right_reading : "right_reading" "{" intnum "}" ; rotation : "rotation" "{" angnum (p_rotation) "}" ; rotation2 : "rotation2" "{" angnum (p_rotation2) "}" ; hidden : "hidden" "{" intnum (p_hidden) "}" ; hidden2 : "hidden2" "{" intnum (p_hidden2) "}" ; 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 ; border_outline : "border_outline" (p_polygonstart(0)) "{" polycmds "}" ; board_cutouts : board_cutouts cutout | cutout | ; cutout : "cutout" "{" areacmds "}" ; 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 "}" ; dnc : "dnc" "{" coorddim "}" ; drilldeviation : "drill_deviation" "{" coorddim "}" ; plated_drill_cover : "plated_drill_cover" "{" coorddim "}" ; min_height : "min_height" "{" coorddim "}" ; max_height : "max_height" "{" coorddim "}" ; end : "end" "{" xycoord (p_end) "}" ; fixed : "fixed" "{" intnum "}" ; lib_name : "lib_name" "{" quostr "}" ; din : "din" "{" quostr (p_din) "}" ; part_code : "part_code" "{" quostr (p_partcode) "}" ; title : "title" "{" quostr (p_title) "}" ; id : "id" "{" quostr (p_id) "}" ; 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_placed(1)) | "unplaced" (p_placed(0)) | "free" (p_placed(1)) ; filled : "filled" "{" intnum (p_fill) "}" ; 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" (p_pintyp(0)) | "in" (p_pintyp(1)) | "out" (p_pintyp(2)) | "power" (p_pintyp(3)) ; 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 "}" ; min_width_switch : "min_width_switch" "{" intnum "}" ; max_width : "max_width" "{" coorddim "}" ; max_width_switch : "max_width_switch" "{" intnum "}" ; width_switch : "width_switch" "{" intnum "}" ; via_switch : "via_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 */; // 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 if ((curversion=curflt)<=2.0) lenconv*=OLDVERSCONV; // 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_pintyp(int typ) /* // Handle the pin type request // Return value : // zero if done or (-1) on error // Parameters : // int typ : Pin type code */ { // Set the pin type switch (typ) { // Input case 1 : curpintype="in"; break; // Output case 2 : curpintype="out"; break; // Power case 3 : curpintype="sup"; break; default : curpintype=""; } // 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_linestart() /* // Receive a line start // Return value : // zero if done or (-1) on error */ { curlineproc=1; // Return without errors return(0); } int p_lineend() /* // Receive a line end // Return value : // zero if done or (-1) on error */ { curlineproc=0; // 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_placeholder() /* // Receive a placeholder end // Return value : // zero if done or (-1) on error */ { if (curlineproc) { // Store net label if (scm_storelabel(curnetname,0,curpx,curpy,currot,0)) fprintf(mfh,ERRPLCLAB, txffname,synscanline(),curnetname,curnetname); if (curxs!=curxe && curys!=curye) { fprintf(mfh,ERRPLCOLAB, txffname,synscanline(),curnetname,curnetname); return(0); } // Perform post process bae_postprocess(); bae_clearpoints(); bae_storepoint(curpx,curpy,0); // Check line relative position if (curxs==curxe) bae_storepoint(curxs,curpy,0); else bae_storepoint(curpx,curys,0); // Ensure the T connection point bae_storepoint(curxs,curys,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON,txffname,synscanline()); scm_setintpar(4,0); } // 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_symbolpivot() /* // Receive a symbol pivot position // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curspx=curpx; curspy=curpy; // Return without errors return(0); } int p_symbolid() /* // Receive a symbol ID // Return value : // zero if done or (-1) on error */ { cursymid=curid; // Return without errors return(0); } int p_symbolname() /* // Receive a symbol name // Return value : // zero if done or (-1) on error */ { cursymname=curname; // 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_size2() /* // Receive a secondary size // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curs2x=curx; curs2y=cury; // Return without errors return(0); } int p_offset() /* // Receive an offset // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curox=curx; curoy=cury; // Return without errors return(0); } int p_offset2() /* // Receive a secondary offset // Return value : // zero if done or (-1) on error */ { // Store the current coordinates curo2x=curx; curo2y=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; // 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_fill() /* // Receive a fill status // Return value : // zero if done or (-1) on error */ { // Store the fill status pfill=curint; // Return without errors return(0); } int p_mirror() /* // Receive a mirror status // Return value : // zero if done or (-1) on error */ { // Store the mirror status curmirror=curint; if (cursymrproc && !curelemproc) curcmirror=curint; // Return without errors return(0); } int p_placed(int plcstat) /* // Receive a placement status // Return value : // zero if done or (-1) on error // Parameters : // int plcstat : Placement status */ { curplaced= plcstat==2 ? (curversion<=2.0 ? 0 : 1) : plcstat ; if (plcstat==2) { cursymrproc=1; curcmirror=0; curcrot=0.0; } // Return without errors return(0); } int p_elemstart() /* // Receive an element start // Return value : // zero if done or (-1) on error */ { curelemproc=1; // Return without errors return(0); } int p_elemend() /* // Receive an element end // Return value : // zero if done or (-1) on error */ { curelemproc=0; // 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; // 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; // 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_sheetname() /* // Receive a sheet start // Return value : // zero if done or (-1) on error */ { int i /* Loop control variable */; // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_SCMSAVELEM); bae_setintpar(22,0); } if (curtitle=="") { // Get net free number i=0; curtitle=itoa(i); do { i++; curtitle=itoa(i); } while (existddbelem(ddbfname,DDBCLSCM,curtitle)==1); } else { // Check if sheet already exists if (existddbelem(ddbfname,DDBCLSCM,curtitle)==1) { curscmproc=0; return(0); } } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,0,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,curtitle); bae_storemenuiact(1,14,LMB); bae_storetextiact(1,"10"); bae_storetextiact(1,"10"); bae_setintpar(22,1); call(MNU_SCMCREELEM); bae_setintpar(22,0); curscmproc=1; btapn=busln=0; // Assign the connectivity mode predicate rule rsc_assplanintpred(1,RS_CONMODE,1,0,""); for (i=0;icurye) { bae_clearpoints(); bae_storepoint(curxs,curys,1); bae_storepoint(curxs,curys+BUSEXT,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); bae_clearpoints(); bae_storepoint(curxs,curye,1); bae_storepoint(curxs,curye-BUSEXT,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); } else { bae_clearpoints(); bae_storepoint(curxs,curys,1); bae_storepoint(curxs,curys-BUSEXT,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); bae_clearpoints(); bae_storepoint(curxs,curye,1); bae_storepoint(curxs,curye+BUSEXT,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); } } else if (curys==curye) { if (curxs>curxe) { bae_clearpoints(); bae_storepoint(curxs,curys,1); bae_storepoint(curxs+BUSEXT,curys,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); bae_clearpoints(); bae_storepoint(curxe,curys,1); bae_storepoint(curxe-BUSEXT,curys,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); } else { bae_clearpoints(); bae_storepoint(curxs,curys,1); bae_storepoint(curxs-BUSEXT,curys,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); bae_clearpoints(); bae_storepoint(curxe,curys,1); bae_storepoint(curxe+BUSEXT,curys,0); // Store connection if (scm_storecon()) fprintf(mfh,ERRPLCCON, txffname,busll[i].line); scm_setintpar(4,0); } } } // Place all bus taps for (i=0;iMAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),symname); symname[MAXKEYLEN]='\0'; } // Check if symbol already exists if (existddbelem(ddbfname,DDBCLSSYM+labflag,symname)==1) { cursymproc=0; return(0); } // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_SCMSAVELEM); bae_setintpar(22,0); } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,1+labflag,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,symname); if (bae_plannotsaved()) bae_storetextiact(1,M_UINYES()); bae_storetextiact(1,"m"); bae_storetextiact(1,"1"); bae_storetextiact(1,"1"); bae_setintpar(22,1); call(MNU_SCMCREELEM); bae_setintpar(22,0); cursymproc=1; if (labflag) scm_storepart("","pin",0.0,0.0,0.0,0); // Return without errors return(0); } int p_gatestart() /* // Receive a gate start // Return value : // zero if done or (-1) on error */ { // Document name translation curname=MACPREFIX+curname; fprintf(mfh,REPSYMNAME,curorgname,curname); if (strlen(curname)>MAXKEYLEN) { fprintf(mfh,ERRLONGSYMN,txffname,synscanline(),curname); curname[MAXKEYLEN]='\0'; } // Check if symbol already exists if (existddbelem(ddbfname,DDBCLSSYM,curname)==1) { cursymproc=0; return(0); } // Save the last element if (bae_plannotsaved()) { bae_setintpar(22,1); call(MNU_SCMSAVELEM); bae_setintpar(22,0); } // Perform the create element call bae_clriactqueue(); bae_storemenuiact(1,1,LMB); bae_storetextiact(1,ddbfname); bae_storetextiact(1,curname); if (bae_plannotsaved()) bae_storetextiact(1,M_UINYES()); bae_storetextiact(1,"m"); bae_storetextiact(1,"1"); bae_storetextiact(1,"1"); bae_setintpar(22,1); call(MNU_SCMCREELEM); bae_setintpar(22,0); cursymproc=1; // Return without errors return(0); } int p_gatepivot() /* // Receive a symbol pivot point // Return value : // zero if done or (-1) on error */ { double lx, ly /* Lower plan boundary */; double ux, uy /* Upper plan boundary */; if (!cursymproc) // Return without errors return(0); #ifdef XXX if (curversion<=2.0) { lx= curpx>0.0 ? 0.0 : 2.0*curpx ; ly= curpy>0.0 ? 0.0 : 2.0*curpy ; ux= curpx<0.0 ? 0.0 : 2.0*curpx ; uy= curpy<0.0 ? 0.0 : 2.0*curpy ; // Set lower element boundary bae_clriactqueue(); bae_storemouseiact(1,lx,ly,0,LMB); bae_callmenu(MNU_SCMPARLBND); // Set upper element boundary bae_clriactqueue(); bae_storemouseiact(1,ux,uy,0,LMB); bae_callmenu(MNU_SCMPARUBND); // Set element origin bae_storemouseiact(1,curpx,curpy,0,LMB); bae_callmenu(MNU_SCMPARORIG); } #endif // Return without errors return(0); } int p_symbolend() /* // Receive a symbol end // Return value : // zero if done or (-1) on error */ { index C_FIGURE nfig /* New figure list element */; string rn /* Rule name */; // Check if symbol was created if (!cursymproc) // Return without errors return(0); if (bae_planddbclass()==DDBCLSSYM) { if (ATTRPARTID!="") { scm_storetext(ATTRPARTID,bae_planwsnx(),bae_planwsny(), 0.0,PARTIDSIZE,0,1); if (cap_lastfigelem(nfig)==0) { // Get predicate rule name sprintf(rn,":%s:%s=%d;", RS_SCMSUBJ,RS_TXTCLASS,PARTIDCLASS); cap_rulefigatt(nfig,rn); } } scm_storetext("$rlname",bae_planwsnx(),bae_planwsny(), 0.0,RLNAMESIZE,0,1); if (cap_lastfigelem(nfig)==0) { // Get predicate rule name sprintf(rn,":%s:%s=%d;", RS_SCMSUBJ,RS_TXTCLASS,RLNAMECLASS); cap_rulefigatt(nfig,rn); } } // Shrink sybol bae_setintpar(22,2); baewsshrink(1); bae_setintpar(22,0); // Save the symbol bae_setintpar(22,1); call(MNU_SCMSAVELEM); bae_setintpar(22,0); cursymproc=0; // Return without errors return(0); } int p_symboltext() /* // Receive a symbol text end // Return value : // zero if done or (-1) on error */ { index C_FIGURE lastfig /* Last figure list index */; string substr /* Text sub string */; double xoff,yoff /* Text justify offset */; double cosa,sina /* Trigonometric values */; STRINGS rl /* Rule list */; int textcol = 0 /* Text column */; // Check if symbol was created if (!cursymproc && !curscmproc) // Return without errors return(0); textadjust(curadjust,cursx,cursy,xoff,yoff,currot,0,0); sina=sin(currot); cosa=cos(currot); while (strlen(quostr)>MAXKEYLEN) { // Build the multiline text rules sprintf(rl[0],":%s:%s='%s_%d';", RS_SCMSUBJ,RS_MTEXTID,textid,mtextcnt); sprintf(rl[1],":%s:%s=%d;",RS_SCMSUBJ,RS_MTEXTCOL,textcol); sprintf(rl[2],":%s:%s=%d;",RS_SCMSUBJ,RS_MTEXTROW,0); sprintf(rl[3],":%s:%s=%.2f;",RS_SCMSUBJ,RS_MTEXTLS,1.0); substr=strextract(quostr,0,MAXKEYLEN-1); if (scm_storetext(substr,curpx+cosa*xoff-sina*yoff, curpy+sina*xoff+cosa*yoff,currot,cursy,0,0)) { fprintf(mfh,ERRPLCTEXT,txffname,synscanline(),quostr); } else if (cap_lastfigelem(lastfig)==0) { // Attach rules if (cap_rulefigatt(lastfig,rl)) rsc_error(-1); } quostr=strextract(quostr,MAXKEYLEN,strlen(quostr)); curpx+=cosa*80.0*cursy/3.0; curpy+=sina*80.0*cursy/3.0; textcol++; } if (scm_storetext(quostr,curpx+cosa*xoff-sina*yoff, curpy+sina*xoff+cosa*yoff,currot,cursy,0,0)) { fprintf(mfh,ERRPLCTEXT,txffname,synscanline(),quostr); } else if (textcol!=0 && cap_lastfigelem(lastfig)==0) { // Attach rules if (cap_rulefigatt(lastfig,rl)) rsc_error(-1); mtextcnt++; } // Return without errors return(0); } int p_symbolplaceholder() /* // Receive a symbol place holder end // Return value : // zero if done or (-1) on error */ { string attrname /* Attribute name */; double xoff,yoff /* Text justify offset */; double cosa,sina /* Trigonometric values */; int textmode = 0 /* Text mode */; // Check if symbol was created if (!cursymproc) // Return without errors return(0); // Check the designator type switch (curtypname) { case "din" : case "net" : attrname="$"; break; case "typ" : attrname=ATTRTYP; break; case "technology" : attrname=ATTRTEC; break; case "symbol" : if (quostr==ATTRPLNAME) { attrname="$plname"; } else { attrname="$"+quostr; strlower(attrname); } break; case "id" : case "variant" : 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 (scm_storetext(attrname,curpx+cosa*xoff-sina*yoff, curpy+sina*xoff+cosa*yoff,currot,cursy,0,textmode)) fprintf(mfh,ERRPLCTEXT,txffname,synscanline(),attrname); // Return without errors return(0); } int p_initadjust() /* // Receive an init adjust request // Return value : // zero if done or (-1) on error */ { curadjust=curadjust2=8; curhidden=curhidden2=0; curpintype=""; // Return without errors return(0); } int p_pinname() /* // Receive a pin name // Return value : // zero if done or (-1) on error */ { curpinname=curname; if (curpinname[strlen(curpinname)-1]=='#') curpinname[strlen(curpinname)-1]='\0'; if (curpinname[0]=='#') curpinname=strextract(curpinname,1,strlen(curpinname)); // Return without errors return(0); } int p_symbolpin() /* // Receive a symbol pin placement end // Return value : // zero if done or (-1) on error */ { index C_FIGURE nfig /* New figure list element */; string pinname /* Pin name */; string pinmac /* Pin macro name */; int pinnum /* Pin number */; int res /* Pin placement result */; double xoff,yoff /* Text justify offset */; double cosa,sina /* Trigonometric values */; // Check if symbol was created if (!cursymproc) // Return without errors return(0); pinmac= curhidden ? (curhidden2 ? "nodisp" : "num") : (curhidden2 ? "id" : "num_id") ; pinnum=0; do { pinnum++; if (pinnum==1) pinname=curpinname; else sprintf(pinname,"%s_%d",curpinname,pinnum); } while ((res=scm_storepart(pinname,pinmac,curpx,curpy,0.0,0))==(-5)); if (res!=0) fprintf(mfh,ERRPLCPIN,txffname,synscanline(),pinname,pinmac); if (res==0 && cap_lastfigelem(nfig)==0) { if (!curhidden) { textadjust(curadjust,cursx,cursy,xoff,yoff,currot,2,0); sina=sin(currot); cosa=cos(currot); scm_attachtextpos(nfig,"$$", curpx+curox+cosa*xoff-sina*yoff, curpy+curoy+sina*xoff+cosa*yoff,currot,cursy,0); } if (!curhidden2 && cap_lastfigelem(nfig)==0) { textadjust(curadjust2,curs2x,curs2y, xoff,yoff,currot2,2,0); sina=sin(currot2); cosa=cos(currot2); scm_attachtextpos(nfig,"$", curpx+curo2x+cosa*xoff-sina*yoff, curpy+curo2y+sina*xoff+cosa*yoff, currot2,curs2y,0); } if (cap_lastfigelem(nfig)==0) // Assign the pin type predicate rule rsc_assfigstrpred(nfig,RS_PINTYPE,curpintype,"",""); } // Return without errors return(0); } int p_symbolline() /* // Receive a symbol line end // Return value : // zero if done or (-1) on error */ { // Check if symbol was created if (!cursymproc && !curscmproc) // Return without errors return(0); bae_clearpoints(); if (curxs==curxe && curys==curye) { bae_storepoint(curxs-DOTRAD,curys,0); bae_storepoint(curxs,curys,1); bae_storepoint(curxs+DOTRAD,curys,0); bae_storepoint(curxs,curys,1); bae_storepoint(curxs-DOTRAD,curys,0); } else { bae_storepoint(curxs,curys,0); bae_storepoint(curxe,curye,0); } // Store polygon if (scm_storepoly(C_POLYDOCLINE)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } int p_netline(int busflag) /* // Receive a net line end // Return value : // zero if done or (-1) on error // Parameters : // int busflag : Bus connection flag */ { // Check if sheet was created if (!curscmproc) // Return without errors return(0); // Check if bus tap line if (fabs(fabs(curxs-curxe)-BUSTSIZ)<=SDVAL && fabs(fabs(curys-curye)-BUSTSIZ)<=SDVAL && !busflag) { // Store bus tap btapl[btapn].name=curnetname; btapl[btapn].xs=curxs; btapl[btapn].ys=curys; btapl[btapn].xe=curxe; btapl[btapn].ye=curye; btapl[btapn].lastdir=lastsegdir; btapl[btapn].line=synscanline(); btapn++; // Return without errors return(0); } if (busflag) { // Store bus connection busll[busln].xs=curxs; busll[busln].ys=curys; busll[busln].xe=curxe; busll[busln].ye=curye; if (curxs==curxe) { busll[busln].ori=0; if (curys>curye) { busll[busln].ys=curye; busll[busln].ye=curys; } } else if (curys==curye) { busll[busln].ori=1; if (curxs>curxe) { busll[busln].xs=curxe; busll[busln].xe=curxs; } } else { busll[busln].ori=2; } busll[busln].line=synscanline(); busln++; } bae_clearpoints(); bae_storepoint(curxs,curys,busflag); if (curxs!=curxe && curys!=curye) { if (lastsegdir) bae_storepoint(curxe,curys,0); else bae_storepoint(curxs,curye,0); } else { lastsegdir= ((curxs==curxe && curys>curye) || (curys==curye && curxs=2.0*PI) currot-=2.0*PI; // Buffer old label macro oldlabmacro=baepar_strval(SCMPAR_LABELMACRO); // Set requested label macro bae_storetextiact(1,curname); bae_callmenu(809); if (scm_storelabel(curnetname,0,curpx,curpy,currot,curmirror)) fprintf(mfh,ERRPLCLAB, txffname,synscanline(),curnetname,curname); // Restore old label macro bae_clriactqueue(); bae_storetextiact(1,oldlabmacro); bae_callmenu(809); // Return without errors return(0); } int p_scmsymbol() /* // Receive a schematic symbol placement end // Return value : // zero if done or (-1) on error */ { // Check if sheet was created if (!curscmproc) // Return without errors return(0); switch (curmirror) { case 1 : currot=PI-currot; break; case -1 : curmirror=1; currot=(-currot); break; } if (currot<0.0) currot+=2.0*PI; if (currot>=2.0*PI) currot-=2.0*PI; if (scm_storepart("",curname,curpx,curpy,currot,curmirror)) fprintf(mfh,ERRPLCSYM, txffname,synscanline(),"",curname); // Return without errors return(0); } int p_plcsymbol() /* // Receive a schematic symbol placement reference // Return value : // zero if done or (-1) on error */ { string name /* Symbol name */; string mapping /* Symbol mapping name */; string gp /* Gate pin name */; int symidx /* Symbol index */; // Check if sheet was created if (!curscmproc) // Return without errors return(0); name= (curid=="a" || curid=="1") ? curdin : (curdin+"_"+curid) ; // Search symbol placement data if ((symidx=findsym(name))<0) { fprintf(mfh,ERRNOSYM,txffname,synscanline(),name); } else if (scm_storepart(name,syml[symidx].macro, syml[symidx].x,syml[symidx].y,syml[symidx].r,syml[symidx].m)) { fprintf(mfh,ERRPLCSYM, txffname,synscanline(),name,syml[symidx].macro); } else { // Get the symbol mapping name mapping=syml[symidx].macro+"_"+convname(syml[symidx].typ)+"_"+ (syml[symidx].mapping=="" ? syml[symidx].plname : syml[symidx].mapping); // Set symbol attributes scm_setpartattrib(name,"$plname",syml[symidx].plname,1); scm_setpartattrib(name,ATTRTEC,syml[symidx].val,0); scm_setpartattrib(name,ATTRTYP,syml[symidx].typ,0); scm_setpartattrib(name,ATTRPARTID,syml[symidx].id,0); scm_setpartattrib(name,"$rlname",mapping,2); if ((gp=getgatepin(mapping,curid))!="") { scm_setpartattrib(name,"$gp",gp,1); scm_setpartattrib(name,"$rpname",curdin,2); } } // Return without errors return(0); } int p_addsymbol() /* // Receive a schematic symbol placement list entry // Return value : // zero if done or (-1) on error */ { struct symdes sym /* Symbol data */; string name /* Symbol name */; int i /* Loop control variable */; cursymrproc=0; if (!curplaced) // Symbol not placed return(0); name= (cursymid=="a" || cursymid=="1") ? curdin : (curdin+"_"+cursymid) ; // Test if this symbol already exists if (findsym(name)!=(-1)) // Symbol already exists return(0); switch (curcmirror) { case 1 : curcrot=PI-curcrot; break; case -1 : curcmirror=1; curcrot=(-curcrot); break; } if (curcrot<0.0) curcrot+=2.0*PI; if (curcrot>=2.0*PI) curcrot-=2.0*PI; // Create the new symbol descriptor sym.name=name; if (curbasename=="") { sym.macro= cursymname==POWSYMNAME ? cursymname : MACPREFIX+cursymname ; curbasename=cursymname; } else { sym.macro= cursymname==POWSYMNAME ? (curbasename+POWSYMEXT) : MACPREFIX+cursymname; } sym.x=curspx; sym.y=curspy; sym.r=curcrot; sym.m=curcmirror; sym.din=curdin; sym.id=""; sym.val=""; sym.typ=""; sym.plname=""; sym.mapping=""; if (inssymidx>0 && syml[inssymidx-1].din==curdin && syml[inssymidx-1].macro==POWSYMNAME) syml[inssymidx-1].macro=cursymname+POWSYMEXT; // Store the symbol descriptor symn++; for (i=(symn-1)-1;i>=inssymidx;i--) syml[i+1]=syml[i]; syml[inssymidx]=sym; csyml[csymn]=name; csymn++; // Return without errors return(0); } int p_startcomp() /* // Receive a component start command // Return value : // zero if done or (-1) on error */ { // Clear component symbol list csymn=0; curval=""; curpartcode=""; curtypname=""; curbasename=""; curplname=""; curmapping=""; // Return without errors return(0); } int p_endcomp() /* // Receive a component start command // Return value : // zero if done or (-1) on error */ { int symidx /* Symbol index */; int i /* Loop control variable */; for (i=0;i=0) { syml[symidx].val=curval; syml[symidx].id=curpartcode; syml[symidx].typ=curtypval; syml[symidx].plname=MACPREFIX+curplname; syml[symidx].mapping=curmapping; } // Clear component symbol list csymn=0; // Return without errors return(0); } int p_symbolarc() /* // Receive a symbol arc end // Return value : // zero if done or (-1) on error */ { // Check if symbol was created if (!cursymproc) // 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 (scm_storepoly(C_POLYDOCLINE)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } int p_symbolrectangle() /* // Receive a symbol rectangle end // Return value : // zero if done or (-1) on error */ { // Check if symbol was created if (!cursymproc) // 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 (scm_storepoly(C_POLYDOCLINE)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } int p_symbolsolid() /* // Receive a symbol solid end // Return value : // zero if done or (-1) on error */ { // Check if symbol was created if (!cursymproc) // 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 (scm_storepoly(C_POLYDOCAREA)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } int p_symbolcircle() /* // Receive a symbol circle end // Return value : // zero if done or (-1) on error */ { // Check if symbol was created if (!cursymproc) // Return without errors return(0); bae_clearpoints(); bae_storepoint(curx-currad,cury,0); bae_storepoint(curx,cury,1); bae_storepoint(curx+currad,cury,0); bae_storepoint(curx,cury,1); if (!pfill) bae_storepoint(curx-currad,cury,0); // Store polygon if (scm_storepoly(pfill ? C_POLYDOCAREA : C_POLYDOCLINE)) fprintf(mfh,ERRPLCPOLY,txffname,synscanline()); // Return without errors return(0); } int p_symbolpoly() /* // Receive a symbol rectangle end // Return value : // zero if done or (-1) on error */ { int i /* Loop control variable */; // Check if symbol was created if (!cursymproc) // Return without errors return(0); bae_clearpoints(); for (i=0;i