/* STD.ULH (STD) -- User Language Standard Include */ /* STD.ULH (STD) -- User Language Standard Include */ /* // // // // rl (131029) RELEASED FOR BAE V8.0. // rl (120427) RELEASED FOR BAE V7.8. // rl (111215) ENHANCEMENT: // Introduced new function M_UINNO. // rl (111130) ENHANCEMENT: // Introduced new functions ddbcelemname, ddbnameadd, datecomp. // rl (111114) ENHANCEMENT: // Introduced simplified BAE parameter query functions. // rl (110119) ENHANCEMENT: // Introduced new function bae_versfilename. // Introduced new function bae_splitdirnames. // Introduced new function bae_stripdirnames. // rl (101210) ENHANCEMENT: // Introduced new function varattrname. // rl (101019) RELEASED FOR BAE V7.6. // rl (100401) ENHANCEMENT: // Introduced new function mousegrab. // rl (100107) ENHANCEMENT: // Introduced new function bae_createdir. // rl (091020) RELEASED FOR BAE V7.4. // rl (090623) ENHANCEMENT: // Introduced new function runulprogexit. // rl (081014) RELEASED FOR BAE V7.2. // rl (081006) ENHANCEMENT: // Introduced new bae.ini parameter writeback function support. // rl (071029) RELEASED FOR BAE V7.0. // rl (070926) ENHANCEMENT: // Introduced new function check_fctactive. // rl (070612) ENHANCEMENT: // Introduced new function ispattern. // rl (060829) RELEASED FOR BAE V6.8. // rl (060209) ENHANCEMENT: // Introduced new function bae_promptdialog. // rl (051024) ENHANCEMENT: // Fixed problem with program sequences in runulprog. // rl (050906) RELEASED FOR BAE V6.6. // rl (040811) RELEASED FOR BAE V6.4. // rl (040513) ENHANCEMENT: // Introduced new initial file array/field parameter functions. // rl (030904) RELEASED FOR BAE V6.2. // rl (021209) RELEASED FOR BAE V6.0. // rl (021018) CHANGE: // Introcuded version specific database file names. // rl (020620) RELEASED FOR BAE V5.4. // rl (020207) ENHANCEMENT: // Added system control environment variables definitions. // Added system default database file name definitions. // Introduced new function bae_optvarfilename. // mb (010913) CHANGE: // baewsresize and baewsshrink functions added. // rl (010912) CHANGE: // Support for Autoplacement program module removed. // rl (010912) CHANGE: // DDBCLPPAR definition added. // rl (010709) RELEASED FOR BAE V5.0. // rl (010209) ENHANCEMENT: // Introduced new initial file parameter access functions. // rl (001113) CHANGE: // Added Group function code and mouse function definitions. // rl (000509) RELEASED FOR BAE V4.6. // rl (000509) ENHANCEMENT: // Introduced new function bae_chkoutfname. // rl (000418) ENHANCEMENT: // Introduced new HighEnd message system ID's. // rl (990901) ENHANCEMENT: // Introduced GED trace functions. // rl (990625) RELEASED FOR BAE V4.4. // rl (990506) ENHANCEMENT: // Introduced class DDBCLRULL. // rl (980910) RELEASED FOR BAE V4.2. // rl (980901) ENHANCEMENT: // Introduced class DDBCLLDRC. // mb (980822) CHANGE: // Verification prompts modified for bae_msgboxverify functions. // rl (980821) ENHANCEMENT: // Introduced class DDBCLCCHG. // mb (980708) ENHANCEMENT: // Introduced M_* functions for message string generation. // mb (980708) ENHANCEMENT: // Introduced functions error_abort, error_class, error_scan. // mb (980707) ENHANCEMENT: // Introduced M function for multi-language support. // mb (980707) CHANGE: // Introduced default user interface language definition // UILANGDEF to be returned by bae_uilanguage on default. // mb (980707) CHANGE: // Menu line delimiter introduced to UPRABORT definition. // rl (980528) ENHANCEMENT: // Introduced message system ID number definitions for // BAE HighEnd. // rl (970929) RELEASED FOR BAE V4.0. // mb (970704) CHANGE: // Removed function bae_runmenu due to rare use. // mb (970620) ENHANCEMENT: // Introduced UL interpreter type ULIPCV for CAM View. // mb (970606) ENHANCEMENT: // Introduced new function bae_moduleid. // mb (970131) IMPROVEMENT: // Introduced compiler directives for BAE compatibility // control. Middle mouse button definition introduced. // mb (970129) IMPROVEMENT: // Implemented new functions maxint, minint. // Introduced menu item number definitions. // mb (970127) CHANGE: // Introduced figure/polygon type definitions. // mb (970122) ENHANCEMENT: // Introduced new function bae_fopen. // mb (960917) RELEASED FOR BAE V3.4. // mb (960827) ENHANCEMENT: // Introduced DDB class 402 (Parameter Setup Data). // Introduced functions bae_runmenu, bae_uilanguage. // Changed menu items to support key selection // in Windows/Motif user interfaces. // mb (960704) CHANGE: // Changed baecvtl function in order to support // correct coordinates for IC design/Chip Editor. // mb (960703) ENHANCEMENT: // BAE user interface type designators introduced. // mb (95) RELEASED FOR BAE V3.2. // mb (941113) ENHANCEMENT: // Introduced UL interpreter types ULIPAR (Autorouter), // ULIPCED (Chip Editor), ULIPICD (IC Design). // mb (94) RELEASED FOR BAE V3.0. // mb (94) ENHANCEMENTS: // Introduced '#define UIL*' statements to support // multiple language control. Functions call, zoomall, // zoomalt, errormsg, message, itoa, ftoa introduced. // mb (93) RELEASED FOR BAE V2.6. // mb (93) ORIGINAL CODING. // // // // // The definitions and declarations from include file std.ulh are // compatible with all User Language interpreter environments of // the Bartels AutoEngineer (i.e. Schematic Editor, Layout Editor, // Autoplacement, Neural Autorouter, CAM Processor, CAM View and // Chip Editor, respectively). std.ulh provides general utilities // and definitions for BAE software configuration query, data // conversion, multi-language support, error handling, menu and/or // user interaction, etc. // // // // // // Data conversion: // baecvtl -- Convert BAE internal length value to display units // ftoa -- Convert float to string // itoa -- Convert integer to string // maxint -- Get maximum of two integer values // minint -- Get minimum of two integer values // // Date utilities: // datecomp -- Compare to dates // // String utilities: // ispattern -- Check if string represents pattern // // Variant attributes: // checkvarattrname -- Check if given attribute name matches variant // varattrname -- Build variant specific attribute name // // Analytic geometry: // dist -- Get the distance between two points // // BAE user interface and multi-language support: // bae_moduleid -- Get the current BAE module identifier // bae_uilanguage -- Get the current BAE user interface language // bae_selectprompt -- Print parameter selection message to status line // M - Get language-specific message string // M_UINYES - Yes input string generator // M_UINNO - No input string generator // M_UPRABORT - Abort menu item string generator // M_UPRPEXIT - Program exit prompt string generator // M_UPRFEXIT - Program exit prompt string generator // M_ERRINPVAL - Invalid input value error message generator // M_ERRNOPICK - No pick element found error message generator // P_PROMPT - Build parameter prompt message string // P_DIALOG - Build parameter dialog message string // // Simplified BAE parameter query without error checking: // baegetintpar - Get integer parameter // baegetdblpar - Get double parameter // baegetstrpar - Get string parameter // // BAE INI file definitions access support: // bae_iniintval -- Get integer value definition // bae_iniintset -- Prepare integer value write // bae_iniflagset -- Prepare integer flag value write // bae_inidblval -- Get double value definition // bae_inidblset -- Prepare double value write // bae_inidimset -- Prepare dimension value write // bae_iniangset -- Prepare angle value write // bae_inistrval -- Get string value definition // bae_inistrset -- Prepare string value write // bae_iniarrayvarname -- Get array element variable name // bae_inifieldvarname -- Get field element variable name // bae_iniwrite -- Writeback changed bae.ini values // // Message and error handling: // message -- Print message with message item to status line // msgstring -- Build message string with single message item // msg2string -- Build message string with two message items // msg3string -- Build message string with three message items // ddbclassname -- Get DDB class name for specific DDB class code // ddbcelemname -- Get DDB element name with optional comment // ddbnameadd -- Add DDB element name with optional comment // errormsg -- Print error message with error item and exit from program // error -- Print error message and exit from program // error_abort -- Issue operation aborted message and exit from program // error_class -- Issue class error message and exit from program // error_scan -- Issue scan error message and exit from program // // BAE user interaction: // askcontinue -- Prompt for continue // call -- Call a BAE menu function // screenredraw -- Perform the BAE Display / Redraw command // zoomall -- Perform the BAE Display / Zoom All command // mousegrab -- Grab mouse pointer and activate window // // User Language program call facilities: // check_fctactive -- Check if menu function active // runulprog -- Run another User Language program // runulprogexit -- Run another User Language program, exit current program // // File Management: // bae_fopen -- Open file or abort with error message on fault // bae_chkbatmode -- Check if in element batch process mode // bae_chkoutfname -- Check if output file name is valid // bae_optvarfilename -- Get system database file optionally specified // through environment variable // bae_createdir -- Create a directory with all sub directories // bae_getsubdirname -- Extract a sub directory name // bae_splitdirnames -- Split a directory into sub directory names // bae_stripdirnames -- Strip trailing directories from directory name // bae_versfilename -- Get next version file name // bae_altconffilename -- Get alternate configuration file name // bae_selconffilename -- Select conf. file name according to priority // // BAE workspace manipulation: // baewsresize -- Resize current BAE element workspace by given value // baewsshrink -- Shrink BAE workspace to origin // // */ // Avoid multiple inclusion #ifndef INCLUDE_STD #define INCLUDE_STD // User interface language definition #define UILANG_DE 0 // German language code #define UILANG_EN 1 // English language code #define UILANGDEF UILANG_EN // Default user interface language // BAE software configuration types to be queried with bae_swconfig(0) #define BAE_Professional 2 // BAE Professional #define BAE_HighEnd 3 // BAE HighEnd // BAE user interface types to be queried with bae_swconfig(3) #define BAE_StdScreen 0 // Standard screen/side menu #define BAE_WinStd 1 // Windows standard/side menu #define BAE_WinPulldwn 2 // Windows pulldown menu #define BAE_MotifStd 3 // Motif standard menu #define BAE_MotifPdwn 4 // Motif pulldown menu // BAE software configuration types to be queried with bae_swconfig(1) #define BAE_Standard 0 // Standard configuration #define BAE_Demo 1 // Demo configuration #define BAE_FabView 2 // FabView configuration // User Language interpreter types #define ULIPSCM 0x0080 // UL interpreter type SCM #define ULIPGED 0x0040 // UL interpreter type GED #define ULIPAR 0x0010 // UL interpreter type AR #define ULIPCAM 0x0008 // UL interpreter type CAM #define ULIPCED 0x0004 // UL interpreter type CED #define ULIPCV 0x1000 // UL interpreter type CV #define ULIPCAP ULIPSCM // UL interpreter type CAP general #define ULIPLAY ULIPGED|ULIPAR|ULIPCAM // UL interpreter type LAY general #define ULIPICD ULIPCED // UL interpreter type ICD general // User Language version control #define ULCOMPVERSION 50 // UL IP 1st compatiblity version // DDB classes #define DDBCLUNDEF (-1) // DDB class unknown/undefined #define DDBCLLAY 100 // DDB class Layout Plan #define DDBCLLPRT 101 // DDB class Layout Part #define DDBCLLSTK 102 // DDB class Layout Padstack #define DDBCLLPAD 103 // DDB class Layout Pad #define DDBCLLPATH 150 // DDB class Layout Paths #define DDBCLLECN 151 // DDB class Layout Connectivity #define DDBCLLDRC 160 // DDB class Layout DRC Parameters #define DDBCLPCON 200 // DDB class Physical Netlist #define DDBCLBASS 201 // DDB class Backannotation Info #define DDBCLCCHG 202 // DDB class Backannotation Request #define DDBCLCPRT 250 // DDB class Physical Partlist #define DDBCLLAR 300 // DDB class Autorouter Data #define DDBCLAPAR 301 // DDB class Autorouter Parameter #define DDBCLASET 302 // DDB class Autorouter Ctrl./Strat. #define DDBCLABAT 303 // DDB class Autorouter Batch Data #define DDBCLFONT 400 // DDB class BAE Font Data #define DDBCLBSETUP 401 // DDB class BAE Setup Data #define DDBCLPARSET 402 // DDB class Parameter Setup Data #define DDBCLGTAB 500 // DDB class Gerber Aperture Table #define DDBCLLCOL 501 // DDB class Layout Color Table #define DDBCLSCOL 502 // DDB class SCM Color Table #define DDBCLICOL 510 // DDB class IC Color Table #define DDBCLGDS 511 // DDB class GDS Structure #define DDBCLXWIN 550 // DDB class X-Windows Position #define DDBCLWIN 551 // DDB class Windows Position #define DDBCLMSG 700 // DDB class BAE Messages #define DDBCLSCM 800 // DDB class SCM Plan #define DDBCLSSYM 801 // DDB class SCM Symbol #define DDBCLSMRK 802 // DDB class SCM Marker #define DDBCLSLAB 803 // DDB class SCM Label #define DDBCLSPLST 850 // DDB class SCM Partlist #define DDBCLLLIB 900 // DDB class Logical Library Part #define DDBCLLCON 901 // DDB class Logical Netlist #define DDBCLPPINF 902 // DDB class Physical Pin Info Data #define DDBCLPPAR 903 // DDB class Packager Parameters #define DDBCLILAY 1000 // DDB class IC Layout #define DDBCLICELL 1001 // DDB class IC Cell #define DDBCLIPIN 1002 // DDB class IC Pin #define DDBCLIPATH 1050 // DDB class IC Paths #define DDBCLIECN 1051 // DDB class IC Connectivity #define DDBCLIAR 1052 // DDB class IC Autorouter Data #define DDBCLUL 1200 // DDB class User Language Program #define DDBCLULLIB 1201 // DDB class User Language Library #define DDBCLRULE 1400 // DDB class Design Rule #define DDBCLRULL 1401 // DDB class Design Rule List #define DDBCLRULS 1402 // DDB class Design Rule Source #define DDBCLSQLTS 4096 // DDB class SQL Table Structure #define DDBCLSQLFT 4097 // DDB class SQL Free Table Info #define DDBCLSQLT1 4352 // DDB class SQL Table 1 #define DDBCLSQLTN 8191 // DDB class SQL Table n #define DDBCLINFOS 8192 // Element info class space start #define DDBCLINFOE 12287 // Element info class space end // File handling #define MAXPATHLEN 200 // Max. file name length #define MAXKEYLEN 40 // Max. file key name length #define MAXTEXTLEN 200 // Max. text/attribute value length #define MAXPNLEN 1024 // Max. path name length #define CURDIR "." // Current directory designator #define PARDIR ".." // Parent directory designator #define DDBEXT ".ddb" // DDB file name extension #define AUTEXT ".aut" // Automatic start file name extension // System control environment variable names #define PROGDVNAME "BAE_PROGDIR" // Library base directory var. name #define ACCVNAME "BAE_CFG" // Def. access ctrl. file var. name #define CAMLIBVNAME "BAE_CAMLIB" // CAM library variable name #define CEDLIBVNAME "BAE_CEDLIB" // CED library variable name #define DCOLLIBVNAME "BAE_DCOLLIB" // Display colors library var. name #define DCOLLIBVPATT "BAE%s_DCOLLIB" // Display colors library var. pat. #define FONTLIBVNAME "BAE_FONTLIB" // Font library variable name #define GEDLIBVNAME "BAE_GEDLIB" // GED library variable name #define PCOLLIBVNAME "BAE_PCOLLIB" // Printer colors library var. name #define RULEDBVNAME "BAE_RULELIB" // Rule database variable name #define SCMLIBVNAME "BAE_SCMLIB" // SCM library variable name #define SETUPVNAME "BAE_BSETUP" // Setup data file variable name #define ULDEFPRGVNAME "BAE_ULCLIB" // Default program file var. name #define ULNEWPRGVNAME "BAE_ULCNEW" // New program file var. name #define WPOSVARNAME "BAE_WINLIB" // Windows pos. file variable name #define DEFLANGVNAME "BAE_LANG" // Lang.default data file var. name #define DMBUTVARNAME "BAE_DMB" // Down mouse button variable name #define OFONTVARNAME "BAE_OLDFONT" // Old font variable name #define DCASCVARNAME "BAE_DCASCAD" // Disable casc. menus var. name #define IFNRVARNAME "BAE_IGNFV" // Ignore file version var. name #define INITFVNAME "BAE_INI" // Init. file var. name #define INITBFVNAME "BAE_BASEINI" // User base init. file var. name #define INITBNFVNAME "BAE_BASEINI%d" // User indexed base init.file var. name #define INITUFVNAME "BAE_USERINI" // User init. file var. name #define CLIPBFVNAME "BAE_CLIPB" // Clipboard file var. name #define PARAMVNAME "BAE_PARLIB" // Parameter file var. name #define MACROVNAME "BAE_MACRO" // Macro database file var. name #define HISTVNAME "BAE_HIST" // History database file var. name #define ULHLPVNAME "BAE_ULCHELP" // ULC help database file var. name #define CAMBLIBVNAME "BAE_CAMBLIB" // CAM batch library variable name #define EPSBLIBVNAME "BAE_EPSBLIB" // EPS/PDF batch library variable name #define RUTDBVNAME "BAE_RUTLIB" // Router par. database var. name #define DRCDBVNAME "BAE_DRCLIB" // DRC par. database var. name #define MENUPOSVARNAME "BAE_MENUPOS" // Menu position variable name #define MENUCOLVARNAME "BAE_MENUCOLS" // Menu columns variable name #define WHEELSVARNAME "BAE_WHEELSTEP" // Wheel step variable name #define SCREENXSCALE "BAE_SCRXSCALE" // Screen size x scale var. name #define SCREENYSCALE "BAE_SCRYSCALE" // Screen size y scale var. name #define MINCRDVARNAME "BAE_MINCOORD" // Min. coord. value var. name #define MAXCRDVARNAME "BAE_MAXCOORD" // Max. coord. value var. name #define SCMFASTDRAW "BAE_SCMFDRAW" // Schematic fast draw flag #define NOLOCKVARNAME "BAE_NOLOCK" // No file lock var. name #define SCANLISTN "BAE_SCANLIST" // Scan list size #define THREADSVNAME "BAE_THREADS" // Max. BAE threads var. name // System default database file names #define ACCFNAME "router.cfg" // Default access ctrl. file name #define CAMLIBNAME "cam.dat" // CAM library name #define CEDLIBNAME "ced.dat" // CED library name #define DCOLLIBNAME "bae.col" // Display colors library name #define DCOLLIBPATT "bae%s.col" // Display colors lib. mod. pattern #define FONTLIBNAME "ged.fnt" // Font library name #define GEDLIBNAME "ged.dat" // GED library name #define PCOLLIBNAME "baep.col" // Printer colors library name #define RULEDBFNAME "brules.vdb" // Rule database name #define SCMLIBNAME "scm.dat" // SCM library name #define SETUPFNAME "bsetup.dat" // Setup data file name #define ULDEFPRGFNAME "ulcprog.vdb" // Default program file name #define ULNEWPRGFNAME "ulcnew.vdb" // Default program file name #define WPOSFILENAME "baewin.dat" // Windows pos. file name #define XPOSFILENAME "baexwin.dat" // X-Windows pos. file name #define DEFLANGFNAME "language.vdb" // Language default data file name #define INITFNAME "bae.ini" // Init. file name #define INITBNFNAME "baebase%d.ini" // User indexed base init. file name #define INITBFNAME "baebase.ini" // User base init. file name #define INITUFNAME "baeuser.ini" // User init. file name #define CLIPBFNAME "baeclipb.dat" // Clipboard file name #define CLIPBFEXT "clipb.dat" // Clipboard file name extension #define PARAMFNAME "baeparam.dat" // Parameter file name #define MACROFNAME "baemacro.dat" // Macro database file name #define HISTFNAME "baehist.dat" // History database file name #define ULHLPFNAME "ulchelp.vdb" // ULC help database file name #define CAMBLIBNAME "cambatdb.dat" // CAM batch library name #define EPSBLIBNAME "epsbatdb.dat" // EPS/PDF batch library name #define RUTDBFNAME "rutparam.dat" // Router param. database name #define DRCDBFNAME "drcparam.dat" // DRC param. database name // BAE mouse button key codes #define LMB 1 // Left mouse button #define MMB 2 // Middle mouse button #define RMB 3 // Right mouse button // Bartels AutoEngineer (standard) menu item numbers #define MNU_BAEREDISPL 100 // Display / Redraw #define MNU_BAEZOOMALL 101 // Display / Zoom All #define MNU_BAEZOOMALT 102 // Display / Zoom Last #define MNU_BAEZOOMOUT 103 // Display / Zoom Out #define MNU_BAEZOOMWND 104 // Display / Zoom Window #define MNU_BAEZOOMPAN 105 // Display / Center/Pan Window #define MNU_BAEUNDO 9003 // Edit / Undo #define MNU_BAEREDO 9004 // Edit / Redo #define MNU_BAECLOSE 9005 // File / Close #define MNU_BAEGRPCUT 9042 // Ctrl-X - Cut #define MNU_BAEGRPCOPY 9043 // Ctrl-C - Copy #define MNU_BAEGRPPASTE 9044 // Ctrl-V - Paste #define MNU_BAELOADPAR 9045 // File / Load Parameters #define MNU_BAESAVEPAR 9046 // File / Save Parameters #define MNU_BAESAVESTATE 9047 // Request undo save state // Schematic Editor menu item numbers #define MNU_SCMHLRESET 111 // Display / Reset Highlights #define MNU_SCMLOADELEM 200 // Files / Load Element #define MNU_SCMSAVELEM 201 // Files / Save Element #define MNU_SCMCREELEM 203 // Files / Create Element #define MNU_SCMDELELEM 205 // Files / Delete Element #define MNU_SCMADDSYM 300 // Symbols / Add Symbol #define MNU_SCMADDLAB 301 // Symbols / Add Label #define MNU_SCMADDPORT 302 // Symbols / Add Module Port #define MNU_SCMNEXTSYM 303 // Symbols / Next Symbol/Label #define MNU_SCMMOVESYM 304 // Symbols / Move Symbol #define MNU_SCMASSVALUE 307 // Symbols / Assign Value #define MNU_SCMDEFANGLE 308 // Symbols / Set Default Angle #define MNU_SCMPNAMPAT 309 // Symbols / Part Name Pattern #define MNU_SCMMOVEPIN 313 // Symbols / Move Symbol Pin #define MNU_SCMADDCON 400 // Connections / Add Connection #define MNU_SCMTAPBUS 402 // Connections / Tap Bus #define MNU_SCMMOVETAP 403 // Connections / Move Bus Tap #define MNU_SCMADDBUS 413 // Connections / Add Bus #define MNU_SCMMOVEPOLY 504 // Graphic / Move Graphic #define MNU_SCMCOPYPOLY 505 // Graphic / Copy Graphic #define MNU_SCMGRAMCRN 508 // Graphic / Move Corner #define MNU_SCMADDTEXT 600 // Text / Add Text #define MNU_SCMMOVETEXT 601 // Text / Move Text #define MNU_SCMCOPYTEXT 602 // Text / Copy Text #define MNU_SCMCHGTEXT 603 // Text / Change Text #define MNU_SCMDELTEXT 604 // Text / Delete Text #define MNU_SCMMOVENAME 605 // Text / Move Name #define MNU_SCMMOVEATTR 607 // Text / Move Attribute #define MNU_SCMGRPRESE 700 // Group / Reset #define MNU_SCMGRPPOLY 701 // Group / Polygon #define MNU_SCMGRPSELM 702 // Group / Single Element Select #define MNU_SCMMOVEGRP 703 // Group / Move Group #define MNU_SCMCOPYGRP 704 // Group / Copy Group #define MNU_SCMDELGRP 705 // Group / Delete Group #define MNU_SCMLOADGRP 706 // Group / Load Group #define MNU_SCMGRPMACN 708 // Group / Macro Name #define MNU_SCMPARSLIB 800 // Parameter / Set Default Library #define MNU_SCMPARORIG 802 // Parameter / Set Origin #define MNU_SCMPARUBND 803 // Parameter / Set Upper Boundary #define MNU_SCMPARLBND 804 // Parameter / Set Lower Boundary #define MNU_SCMPLTDEV 900 // Pen Plot / Plot Device #define MNU_SCMPLTSETW 901 // Pen Plot / Plotter Pen Width #define MNU_SCMPLTSCAL 903 // Pen Plot / Plot Scale #define MNU_SCMPLTFILL 904 // Pen Plot / Fill Mode HP-GL #define MNU_SCMPLTROT 905 // Pen Plot / Rotate Plot #define MNU_SCMPLTHPGL 906 // Pen Plot / HP-GL Output #define MNU_SCMPLTPOST 907 // Pen Plot / PostScript Output #define MNU_SCMPLTPCL 908 // Pen Plot / HP Laser Output #define MNU_SCMRUNUL 1003 // Utilities / Run User Script // Layout Editor menu item numbers #define MNU_GEDLOADELEM 200 // Files / Load Element #define MNU_GEDSAVELEM 201 // Files / Save Element #define MNU_GEDCREELEM 203 // Files / Create Element #define MNU_GEDDELELEM 205 // Files / Delete Element #define MNU_GEDADDPART 300 // Parts / Add Part #define MNU_GEDMOVEPART 301 // Parts / Move Part #define MNU_GEDNEXTPART 303 // Parts / Place Next Part #define MNU_GEDPGSWAP 306 // Parts / Pin/Gate Swap #define MNU_GEDSELVIA 308 // Parts / Select Via #define MNU_GEDDEFANGLE 309 // Parts / Set Default Angle #define MNU_GEDMOVEPIN 314 // Parts / Move Pin #define MNU_GEDADDTRC 400 // Traces / Add Trace #define MNU_GEDTRCINSC 401 // Traces / Insert Corner #define MNU_GEDTRCMDC 402 // Traces / Move/Delete Corner #define MNU_GEDTRCINSS 403 // Traces / Insert Segment #define MNU_GEDTRCMOVS 404 // Traces / Move Segment #define MNU_GEDADDVIA 413 // Traces / Add Via #define MNU_GEDMOVEVIA 414 // Traces / Move Via #define MNU_GEDADDFTRC 419 // Traces / Add Fixed Trace #define MNU_GEDADDBUS 423 // Traces / Add Bus/Pair #define MNU_GEDADDDLINE 504 // Areas / Add Documentary Line #define MNU_GEDMOVEPOLY 507 // Areas / Move Area #define MNU_GEDCOPYPOLY 508 // Areas / Copy Area #define MNU_GEDPLYSCHG 509 // Areas / Area Resize #define MNU_GEDPOLYINSC 511 // Areas / Insert Corner #define MNU_GEDPOLYMDC 512 // Areas / Move/Delete Corner #define MNU_GEDPOLYMOVS 513 // Areas / Move Segment #define MNU_GEDPOLYINSS 514 // Areas / Insert Segment #define MNU_GEDADDTEXT 600 // Text / Add Text #define MNU_GEDMOVETEXT 601 // Text / Move Text #define MNU_GEDCOPYTEXT 602 // Text / Copy Text #define MNU_GEDMOVENAME 605 // Text / Move Name #define MNU_GEDMOVEATTR 609 // Text / Move Attribute #define MNU_GEDGRPRESE 700 // Group / Reset #define MNU_GEDGRPPOLY 701 // Group / Polygon #define MNU_GEDGRPSELM 702 // Group / Single Element Select #define MNU_GEDMOVEGRP 703 // Group / Move Group #define MNU_GEDCOPYGRP 704 // Group / Copy Group #define MNU_GEDDELGRP 705 // Group / Delete Group #define MNU_GEDLOADGRP 706 // Group / Load Group #define MNU_GEDGRPMACN 708 // Group / Macro Name #define MNU_GEDPARSLIB 800 // Parameter / Set Default Library #define MNU_GEDPARORIG 801 // Parameter / Set Origin #define MNU_GEDPARUBND 802 // Parameter / Set Upper Boundary #define MNU_GEDPARLBND 803 // Parameter / Set Lower Boundary #define MNU_GEDPARPOWL 805 // Parameter / Set Power Layers // Autorouter menu item numbers #define MNU_ARLOADELEM 903 // Files / Load Element #define MNU_ARSAVELEM 904 // Files / Save Element // CAM processor menu item numbers #define MNU_CAMGBRLAPT 303 // CAM Photoplot / Load Gerb. Tab. #define MNU_CAMDRLDFN 400 // CAM Drill / Drill File name #define MNU_CAMDRLTFN 401 // CAM Drill / Tool File Name #define MNU_CAMDRLTTOL 402 // CAM Drill / Tool Tolerance #define MNU_CAMDRLDOUT 403 // CAM Drill / Drill Data Output #define MNU_CAMDRLTOUT 404 // CAM Drill / Tool Table Output #define MNU_CAMDRLEOUT 405 // CAM Drill / Excellon Data Output #define MNU_CAMLOADELEM 603 // Files / Load Element // CAM View menu item numbers #define MNU_CVCOLTBL 108 // CAM View Bilddarst. / Farben laden #define MNU_CVLAYMAP 109 // CAM View Bilddarst. / Farbenzuordnung #define MNU_CVDRWMOD 110 // CAM View Bilddarst. / Zeichenmodus #define MNU_CVGBRDIN 200 // CAM View File / Gerber Data Input #define MNU_CVGBRDOUT 201 // CAM View File / Gerber Data Output #define MNU_CVGBRLAPT 202 // CAM View File / Load Gerb. Tab. #define MNU_CVDRLDIN 204 // CAM View File / Drill Data Input #define MNU_CVDRLDOUT 205 // CAM View File / Drill Data Output #define MNU_CVDRLTIN 206 // CAM View File / Tool Data Input #define MNU_CVDRLTOUT 210 // CAM View File / Tool Data Output #define MNU_CVGBRFMT 302 // CAM View Settings / Set Gerb. Format #define MNU_CVGBREXT 308 // CAM View Settings / Set Ext. Gerb. #define MNU_CVGBROPT 309 // CAM View Settings / Set Gerb. Opt. // Chip Editor menu item numbers #define MNU_CEDLOADELEM 200 // Files / Load Element #define MNU_CEDSAVELEM 201 // Files / Save Element #define MNU_CEDCREELEM 203 // Files / Create Element #define MNU_CEDDELELEM 205 // Files / Delete Element #define MNU_CEDADDMAC 300 // Macros / Add Macro #define MNU_CEDMOVEMAC 301 // Macros / Move Macro #define MNU_CEDNEXTMAC 303 // Macros / Place Next Macro #define MNU_CEDADDTEXT 600 // Text / Add Text #define MNU_CEDMOVETEXT 601 // Text / Move Text #define MNU_CEDCOPYTEXT 602 // Text / Copy Text #define MNU_CEDMOVENAME 605 // Text / Move Name #define MNU_CEDGRPRESE 700 // Group / Reset #define MNU_CEDGRPPOLY 701 // Group / Polygon #define MNU_CEDGRPSELM 702 // Group / Single Element Select #define MNU_CEDMOVEGRP 703 // Group / Move Group #define MNU_CEDCOPYGRP 704 // Group / Copy Group #define MNU_CEDDELGRP 705 // Group / Delete Group #define MNU_CEDLOADGRP 706 // Group / Load Group #define MNU_CEDGRPMACN 708 // Group / Macro Name #define MNU_CEDPARORIG 801 // Parameter / Set Origin #define MNU_CEDPARUBND 802 // Parameter / Set Upper Boundary #define MNU_CEDPARLBND 803 // Parameter / Set Lower Boundary // Message system ID numbers #define MSGID_PLCPART 1 // Part placement #define MSGID_SELPGRP 2 // Part group selection #define MSGID_SETIVAR 3 // Set integer variable #define MSGID_SETDVAR 4 // Set double variable #define MSGID_SETSVAR 5 // Set string variable #define MSGID_RUNULC 6 // Run ULC script #define MSGID_FINDSPRT 7 // Schematic part search #define MSGID_SELPSET 8 // Part set selection #define MSGID_LLPRTMAC 9 // Load layout part macro #define MSGID_NETZOOMHL 10 // Net Highlight/Zoom request #define MSGID_PLCHPART 11 // Hierarchical part placement #define MSGID_SELHPGRP 12 // Hierarchical part group selection #define MSGID_FINDSHPRT 13 // Schematic hierarchical part search #define MSGID_SELHPSET 14 // Hierarchical part set selection #define MSGID_MOUSEGRAB 15 // Center mouse, activate window #define MSGID_PLCHSPART 16 // Hierarchical part search & placement #define MSGID_DSELPOPT 17 // Optionally deselect all parts #define MSGID_PLCPGRP 18 // Part group placement // Figure list element types #define C_FIGPOLY 1 // SCM Polygon #define C_FIGCON 2 // SCM Connection #define C_FIGNREF 3 // SCM Named Reference #define C_FIGTEXT 5 // SCM Text #define C_FIGNPAT 6 // SCM Macro Symbol Name Pattern #define C_FIGPOLYC 8 // SCM Polygon Corner Pick #define C_FIGSREF 9 // SCM Symbol Reference Pick #define C_FIGLREF 10 // SCM Label Reference Pick #define C_FIGATEXT 11 // SCM Symbol Attribute Pick #define L_FIGPOLY 1 // Layout Polygon #define L_FIGPATH 2 // Layout Path/Trace #define L_FIGNREF 3 // Layout Named Reference #define L_FIGUREF 4 // Layout Unnamed Reference #define L_FIGTEXT 5 // Layout Text #define L_FIGDRILL 6 // Layout Drill #define L_FIGINIVIA 7 // Layout initial via #define L_FIGPOLYC 8 // Layout Polygon Corner Pick #define L_FIGPATHC 9 // Layout Path/Trace Corner Pick #define L_FIGCFPOLY 10 // Layout Copper Fill Polygon #define I_FIGPOLY 1 // IC Design Polygon #define I_FIGPATH 2 // IC Design Path/Trace #define I_FIGNREF 3 // IC Design Named Reference #define I_FIGUREF 4 // IC Design Unnamed Reference #define I_FIGTEXT 5 // IC Design Text #define I_FIGPOLYC 7 // IC Design Polygon Corner Pick #define I_FIGPATHC 8 // IC Design Path/Trace Corner Pick // Polygon type definitions #define C_POLYDOCLINE 0 // SCM Line Cosmetic #define C_POLYDOCAREA 1 // SCM Filled Cosmetic #define C_POLYCONAREA 4 // SCM Connection Point #define C_POLYDOTLINE 5 // SCM Dotted line #define C_POLYNETAREA 6 // SCM Net Type Area (sub type) #define C_POLYMAX 5 // SCM Max. Polygon Type Code #define L_POLYCOPPASS 1 // Layout Passive Copper Area #define L_POLYKEEPOUT 2 // Layout Keepout Area #define L_POLYBRDOUT 3 // Layout Board Outline #define L_POLYCOPACT 4 // Layout Active Copper Area #define L_POLYDOCLINE 5 // Layout Documentary Line #define L_POLYDOCAREA 6 // Layout Documentary Area #define L_POLYCOPFILL 7 // Layout Copperfill Workarea #define L_POLYHTCHCOP 8 // Layout Hatched Copper Area #define L_POLYSPPAREA 9 // Layout Split Power Plane #define L_POLYMAX 9 // Layout Max. Polygon Type Code #define I_POLYACTAREA 1 // IC Design Active Area #define I_POLYKEEPOUT 2 // IC Design Forbidden Area #define I_POLYDOCLINE 3 // IC Design Line Cosmetic #define I_POLYBORDER 4 // IC Design Border #define I_POLYMAX 4 // IC Design Max. Polygon Type Code // Mouse modes #define MS_NONE 0 // No function mode #define MS_CONT 1 // Context function mode #define MS_DEL 2 // Delete mode #define MS_MOVE 3 // Move mode #define MS_GSEL 4 // Group selection mode #define MS_LROT 5 // Rotate left mode #define MS_RROT 6 // Rotate right mode #define MS_PANW 7 // Center/Pan Window mode #define MS_GCSEL 8 // Group crossing selection mode // Drawing modes #define DM_REPLACE 0 // Replace #define DM_CLEAR 1 // Clear #define DM_SET 2 // Set #define DM_COMPLEMENT 3 // Complement // Variants #define MAXVARIANT 99 // Max. supported variants // Global variable names #define VAR_ROTANGLE "rot_angle" // Rotation angle #define VAR_MSMODE "ms_mode" // Mouse operation mode #define VAR_MSMODES "ms_modes" // Mouse shift operation mode #define VAR_MSMODEC "ms_modec" // Mouse ctrl operation mode #define VAR_MSMODESC "ms_modesc" // Mouse shift ctrl operation mode #define VAR_MSMODEAL "ms_modeal" // Mouse alt left operation mode #define VAR_MSMODEAR "ms_modear" // Mouse alt right operation mode #define VAR_MSFIGDIS "ms_figdis" // Figure list disable variable name #define VAR_IOMNAME "iom_name%d" // I/O user menu item name #define VAR_IOMPROG "iom_prog%d" // I/O user menu item program name #define VAR_IOMMAX 14 // Max. user I/O menu item count #define VAR_PLOTW "plot_width" // Plot width #define VAR_CORNERR "corner_rad" // Polygon/trace corner radius #define VAR_GROUPLDIS "groupldis" // Group load disable flag // bae.ini writeback list variable name prefixes #define INICHGVAR "varchgname" // Changed parameter name #define INICHGVAL "varchgval" // Changed parameter value #define INICHGIVAL "varchgival" // Changed integer parameter value #define INICHGDVAL "varchgdval" // Changed double parameter value #define INICHGSVAL "varchgsval" // Changed string parameter value // Type definitions typedef string STRINGS[]; // String list //__________________________________________________________________ // Start library-specific source code #ifndef USELIB #ifndef LIBSTD //_________________________________________ // Multi-language support static int CURUILANG=bae_uilanguage(); // Current GUI language //__________________________________________________________________ // Data conversion double baecvtl(double length) /* // Convert BAE internal length value to display units // Return value : // converted length value // Parameters : // double length : Input length value */ { // Get and return the converted value return(cvtlength(length,0, (uliptype() & ULIPICD) ? (bae_getcoorddisp() ? 3 : 4) : (bae_getcoorddisp() ? 1 : 2) ) ); } string ftoa(double number,int precision) /* // Convert float to string // Return value : // resulting string // Parameters : // double number : Input float value // int precision : Precision (fractional digits) */ { string result; // Result string // Build the result string using sprintf sprintf(result,"%.*f",precision,number); // Return the result string return(result); } string itoa(int number) /* // Convert integer to string // Return value : // resulting string // Parameters : // int number : Input integer value */ { string result; // Result string // Build the result string using sprintf sprintf(result,"%d",number); // Return the result string return(result); } int maxint(int i1,int i2) /* // Get maximum of two integer values // Return value : // maximum integer value // Parameters : // int i1 : Input integer value 1 // int i2 : Input integer value 2 */ { // Get and return the maximum value return(i1>i2 ? i1 : i2); } int minint(int i1,int i2) /* // Get minimum of two integer values // Return value : // minimum integer value // Parameters : // int i1 : Input integer value 1 // int i2 : Input integer value 2 */ { // Get and return the minimum value return(i1date2 // Parameters : // int sec1 : 1st date second // int min1 : 1st date minute // int hour1 : 1st date hour // int day1 : 1st date day // int mon1 : 1st date month // int year1 : 1st date year // int sec2 : 2nd date second // int min2 : 2nd date minute // int hour2 : 2nd date hour // int day2 : 2nd date day // int mon2 : 2nd date month // int year2 : 2nd date year */ { if (year1==year2) { if (mon1==mon2) { if (day1==day2) { if (hour1==hour2) { if (min1==min2) { if (sec1==sec2) return(0); return(sec1strlen(str)) ? 0 : 1); } //__________________________________________________________________ // Variant attributes string varattrname(string attrname,int varnum) /* // Build variant specific attribute name // Return value : // variant attribute name string // Parameter : // string attrname : Attribute base name // int varnum : Variant number */ { string vattrname /* Variant attribute name */; // Check if base variant if (varnum==0) return(attrname); // Build variant specific attribute name sprintf(vattrname,"%s\003%02d\003",attrname,varnum); return(vattrname); } int checkvarattrname(string attrname,int varnum) /* // Check if given attribute name matches variant // Return value : // 1 on name match, else 0 // Parameter : // string attrname : Attribute name // int varnum : Variant number */ { string pattern /* Attribute name pattern */; // Check if valid attribute name if (attrname[0]!='$') return(0); // Check if base variant if (varnum<1) return(attrname[strlen(attrname)-1]!='\003' ? 1 : 0); // Build the variant attribute name pattern sprintf(pattern,"*\003%02d\003",varnum); // Compare attribute name pattern return(strmatch(attrname,pattern) ? 1 : 0); } //__________________________________________________________________ // Analytic geometry double dist(double xs,double ys,double xe,double ye) /* // Get the distance between two points // Return value : // resulting distance length value // Parameters : // double xs : Start point X coordinate // double ys : Start point Y coordinate // double xe : End point X coordinate // double ye : End point Y coordinate */ { double xd = xe-xs; // X distance double yd = ye-ys; // Y distance // Calculate and return the distance return(sqrt(xd*xd+yd*yd)); } //__________________________________________________________________ // BAE user interface and multi-language support string bae_moduleid() /* // Get the current BAE module identifier // Return value : // module identifier : // "scm" = Schematic Editor // "ged" = Layout Editor // "ap" = Autoplacement // "ar" = Neural Autorouter // "cam" = CAM Processor // "cv" = CAM View // "ced" = Chip Editor // "bae" = else (unspecified BAE module) */ { // Evaluate the current interpreter environment switch (uliptype()) { // Schematic Editor case ULIPSCM : return("scm"); // Layout Editor case ULIPGED : return("ged"); // Autorouter case ULIPAR : return("ar"); // CAM Processor case ULIPCAM : return("cam"); // CAM View case ULIPCV : return("cv"); // Chip Editor case ULIPCED : return("ced"); } // Unknown BAE module return("bae"); } int bae_uilanguage() /* // Get the current BAE user interface language // Return value : // language id (enumerated UILANG* type) */ { // Get BAE user interface language code switch (bae_language()) { // German case "DE" : return(UILANG_DE); // English case "EN" : return(UILANG_EN); } // Use default language on default return(UILANGDEF); } string M(string DE,string EN) /* // Get language-specific message string // Return value : // language-specific message string // Parameters : // string DE : German message string // string EN : English message string */ { #if UILANGDEF==UILANG_DE // Default language German // Return English message on request, or German message on default return(CURUILANG==UILANG_EN ? EN : DE); #else // Assume default language English // Return German message on request, or English message on default return(CURUILANG==UILANG_DE ? DE : EN); #endif } string M_UINYES() /* // Yes input string generator // Return value : // Message string */ { // Get and return the message string return(M("j","y")); } string M_UINNO() /* // No input string generator // Return value : // Message string */ { // Get and return the message string return(M("n","n")); } string M_UPRABORT() /* // Abort menu item string generator // Return value : // Message string */ { // Get and return the message string return(M("%&Abbruch","%&Abort")); } string M_UPRPEXIT() /* // Program exit prompt string generator // Return value : // Message string */ { // Get and return the message string return(M("Programmabbruch ? ","Abort Program ? ")); } string M_UPRFEXIT() /* // Program exit prompt string generator // Return value : // Message string */ { // Get and return the message string return(M("Funktion abbrechen ?","Abort Function ?")); } string M_ERRINPVAL() /* // Invalid input value error message generator // Return value : // Message string */ { // Get and return the message string return(M("Ungueltige Wertangabe!","Invalid input value!")); } string M_ERRNOPICK() /* // No pick element found error message generator // Return value : // Message string */ { // Get and return the message string return(M("Kein Pickelement gefunden!","No pick element found!")); } string P_PROMPT(string parstr) /* // Get parameter prompt message string // Return value : // prompt message string // Parameter : // string parstr : Parameter base message string */ { // Append prompt extension return(parstr+" ? "); } string P_DIALOG(string parstr) /* // Get parameter dialog box prompt message string // Return value : // dialog box prompt message string // Parameter : // string parstr : Parameter base message string */ { // Append dialog box prompt extension return(parstr+" :"); } void bae_selectprompt(string parstr) /* // Print parameter selection message string // Parameter : // string parstr : Parameter base message string */ { string msg; // Message string sprintf(msg,M("%s selektieren!","Select %s!"),parstr); bae_promptdialog(msg); } //__________________________________________________________________ // Message and error handling void message(string msgfmt,string msgitem) /* // Print message with message item to status line // Parameters : // string msgfmt : Message format string // string msgitem : Message item string */ { string msg; // Message string // Build the message sprintf(msg,msgfmt,msgitem); // Print the message bae_prtdialog(msg); } string msgstring(string msgfmt,string msgitem) /* // Build message string with single message item // Return value : // Message string // Parameters : // string msgfmt : Message format string // string msgitem : Message item string */ { string msg; // Message string // Build the message sprintf(msg,msgfmt,msgitem); // Return the message return(msg); } string msg2string(string msgfmt,string msgitem1,string msgitem2) /* // Build message string with two message items // Return value : // Message string // Parameters : // string msgfmt : Message format string // string msgitem1 : Message 1st item string // string msgitem2 : Message 2nd item string */ { string msg; // Message string // Build the message sprintf(msg,msgfmt,msgitem1,msgitem2); // Return the message return(msg); } string msg3string( string msgfmt,string msgitem1,string msgitem2,string msgitem3) /* // Build message string with three message items // Return value : // Message string // Parameters : // string msgfmt : Message format string // string msgitem1 : Message 1st item string // string msgitem2 : Message 2nd item string // string msgitem3 : Message 3rd item string */ { string msg; // Message string // Build the message sprintf(msg,msgfmt,msgitem1,msgitem2,msgitem3); // Return the message return(msg); } string ddbclassname(int ddbcl) /* // Get DDB class name for specific DDB class code // Return value : // DDB class name // Parameters : // int ddbcl : DDB class code */ { string classid; // DDB class id buffer if (ddbcl>=DDBCLINFOS && ddbcl<=DDBCLINFOE) return(ddbclassname(ddbcl-DDBCLINFOS)+ M(" Elementkommentar"," Element Comment")); // Get the DDB class id if (classid=ddbclassid(ddbcl)) return(classid); // Evaluate the DDB class code; return the DDB class name switch (ddbcl) { case DDBCLLPATH : return(M("Layout Bahnen", "Layout Paths")); case DDBCLLAR : return(M("Autorouter Daten", "Autorouter Data")); case DDBCLAPAR : return( "Autorouter Parameter"); case DDBCLIPATH : return(M("IC Bahnen","IC Paths")); case DDBCLIAR : return(M("IC Autorouter Daten", "IC Autorouter Data")); case DDBCLSQLTS : return(M("SQL Tabellenstruktur", "SQL Table Structure")); case DDBCLSQLFT : return(M("SQL Freie Tabellen", "SQL Free Table Info")); case DDBCLWIN : return(M("Windows Fensterpositionen", "Windows Positions")); case DDBCLXWIN : return(M("X-Windows Fensterpositionen", "X-Windows Positions")); } // Test on SQL table if (ddbcl>=DDBCLSQLT1 && ddbcl<=DDBCLSQLTN) return(M("SQL Tabelle","SQL Table")); // Invalid DDB class return(M("*** UNDEFINIERT ***","*** UNDEFINED ***")); } string ddbcelemname(string filename,string elemname,int ddbcl,int style) /* // Get DDB element name with optional comment // Return value : // DDB element name with comment extension // Parameters : // string filename : DDB file name // string elemname : DDB element name // int ddbcl : DDB class code // int style : Comment seperator style: 0 - " ", 1 - " : " */ { string ecomm; // DDB element comment if (ddbgetelemcomment(filename,ddbcl,elemname,ecomm)!=0) ecomm=""; if (ecomm=="") return(elemname); if (style) return(elemname+" : "+ecomm); return(elemname+" "+ecomm); } int ddbnameadd(string filename,string elemname,int ddbcl,int sort) /* // Add DDB element name with optional comment // Return value : // Name list index/ID or (-1) on error // Parameters : // string filename : DDB file name // string elemname : DDB element name // int ddbcl : DDB class code // int sort : Sort mode */ { string ecomm; // DDB element comment if (ddbgetelemcomment(filename,ddbcl,elemname,ecomm)!=0) ecomm=""; return(bae_nameadd(elemname,"","",ecomm,sort)); } void bae_promptdialog(string msg) /* // Print message for manual interactions only // Parameters : // string msg : Message fstring */ { // Check if manual interaction if (!bae_peekiact()) // Print the message bae_prtdialog(msg); } void errormsg(string errfmt,string erritem) /* // Print error message with error item and exit from program // Parameters : // string errfmt : Error message format string // string erritem : Error item string */ { string errmsg; // Error message string // Clear further automatic interactions bae_clriactqueue(); // Build the message sprintf(errmsg,errfmt,erritem); // Print the error message perror(errmsg); // Exit from program exit(-1); } void error(string msg) /* // Print error message and exit from program // Parameters : // string msg : Error message string */ { // Clear further automatic interactions bae_clriactqueue(); // Print the error message perror(msg); // Exit from program exit(-1); } void error_abort() /* // Issue operation aborted message and exit from program */ { // Issue error message error(M("Operation abgebrochen.","Operation aborted.")); } void error_class() /* // Issue class error message and exit from program */ { int ddbcl = bae_planddbclass() /* Current DDB element class */; // Issue error message if (ddbcl==DDBCLUNDEF) error(M("Befehl ohne geladenes Element nicht erlaubt!", "Command not allowed with element loaded!")); else errormsg(M( "Befehl auf %sebene nicht erlaubt!", "Command not allowed on %s level!"),ddbclassname(ddbcl)); } void error_scan() /* // Issue scan error message and exit from program */ { // Issue error message error(M("Scan-Fehler!","Scan error!")); } //__________________________________________________________________ // BAE user interaction void askcontinue() /* // Prompt for continue */ { // Prompt for continue bae_setmousetext(""); if (bae_readtext( M("Weiter mit ","Hit to continue "),1)=="\003") error_abort(); } void call(int menuitem) /* // Call a BAE menu function // Parameters : // int menuitem : BAE menu item number */ { // Perform the BAE menu call if (bae_callmenu(menuitem)==0) // Done return; // Error error(M("BAE-Menuaufruf fehlgeschlagen!","BAE menu call fault!")); } void screenredraw() /* // Perform the BAE Display / Redraw command */ { // Call the Redraw command call(MNU_BAEREDISPL); } void zoomall() /* // Perform the BAE Display / Zoom All command */ { // Call the Zoom All command call(MNU_BAEZOOMALL); } void mousegrab(int center) /* // Grab mouse pointer and activate window // Parameter : // int center : Center mouse cursor flag */ { double px,py /* Current mouse positions */; int rangedis /* Range check disabled flag */; // Disable range check bae_getintpar(0,rangedis); bae_setintpar(0,1); if (center) { // Set mouse cursor to window center px=0.5*(bae_wswinlx()+bae_wswinux()); py=0.5*(bae_wswinly()+bae_wswinuy()); } else { // Get the current mouse position bae_wsmouse(px,py,0); } bae_clriactqueue(); bae_storemouseiact(1,px,py,0x0C,LMB); bae_inpoint(0.0,0.0,0.0,0.0,0); // Restore old range check state bae_setintpar(0,rangedis); } //__________________________________________________________________ // User Language program call facilities void runulprog(string progname) /* // Run another User Language program // Parameters : // string progname : UL program name */ { string pureprogname; // Pure program name int pver; // Program version int ptyp; // Program caller type int pc=(-1); // Program counter int i; // Loop control variable // Check if not menu call if (progname[0]!='#') { // Get program name without any sequence extension for (i=0;progname[i]!='\0';i++) if (progname[i]==':') break; pureprogname=strextract(progname,0,i-1); // Check if program available if (pureprogname=="" || ulproginfo(pureprogname,pver,ptyp) || pver>ulipversion() || pverulipversion() || pver0 && bae_getactmenu()>=0 && bae_getactmenu()<10000 && bae_getactmenu()!=9002) { // Dismiss interaction queue contents bae_clriactqueue(); // Issue error message error(M( "Befehl nicht waehrend aktiver Funktion erlaubt!", "Command not allowed while function active!")); } } //__________________________________________________________________ // Simplified BAE parameter query facilities int baegetintpar(int parnum) /* // Get integer parameter without error checking // Returns : Parameter value // Parameters : // int parnum : Parameter ID */ { int val; // Parameter value buffer // Get and return parameter bae_getintpar(parnum,val); return(val); } double baegetdblpar(int parnum) /* // Get double parameter without error checking // Returns : Parameter value // Parameters : // int parnum : Parameter ID */ { double val; // Parameter value buffer // Get and return parameter bae_getdblpar(parnum,val); return(val); } string baegetstrpar(int parnum) /* // Get string parameter without error checking // Returns : Parameter value // Parameters : // int parnum : Parameter ID */ { string val; // Parameter value buffer // Get and return parameter bae_getstrpar(parnum,val); return(val); } //__________________________________________________________________ // INI file variables access facilities int bae_iniintval(string varname,int defval) /* // Get integer value from INI file. Use default value if not found. // Return value : // Integer value // Parameters : // string varname : Variable name // int defval : Variable default value */ { int intval; // Integer value // Try to get parameter value if (varget(varname,intval)==0) // Return found value return(intval); // Return default parameter value return(defval); } double bae_inidblval(string varname,double defval) /* // Get double value from INI file. Use default value if not found. // Return value : // Double value // Parameters : // string varname : Variable name // double defval : Variable default value */ { double dblval; // Double value int intval; // Integer value // Try to get parameter value if (varget(varname,dblval)==0) // Return found value return(dblval); // Try to get integer parameter value if (varget(varname,intval)==0) // Return found value return(intval); // Return default parameter value return(defval); } string bae_inistrval(string varname,string defval) /* // Get double value from INI file. Use default value if not found. // Return value : // string value // Parameters : // string varname : Variable name // string defval : Variable default value */ { string strval; // String value // Try to get parameter value if (varget(varname,strval)==0) // Return found value return(strval); // Return default parameter value return(defval); } string bae_iniarrayvarname(string varname,int aryidx) /* // Get array element variable name for INI file. // Return value : // string aryvarname // Parameters : // string varname : Variable base name // int aryidx : Variable array index */ { string vname; // Variable name // Build array element variable name sprintf(vname,"%s_%d",varname,aryidx+1); // Return array element variable name return(vname); } string bae_inifieldvarname(string varname,int aryidx1,int aryidx2) /* // Get field element variable name for INI file. // Return value : // string fieldvarname // Parameters : // string varname : Variable base name // int aryidx1 : Variable field first index // int aryidx2 : Variable field second index */ { string vname; // Variable name // Build field element variable name sprintf(vname,"%s_%d_%d",varname,aryidx1+1,aryidx2+1); // Return field element variable name return(vname); } void bae_iniintset(int varidx,string varname,int val) /* // Store integer value to INI parameter change list. // Parameters : // int varidx : Variable change index // string varname : Variable name // int val : Variable value */ { // Set bae.ini variable change data varset(INICHGVAR+itoa(varidx),varname); varset(INICHGVAL+itoa(varidx),itoa(val)); varset(INICHGIVAL+itoa(varidx),val); varset(varname,val); varidx++; } void bae_iniflagset(int varidx,string varname,int val) /* // Store integer flag value to INI parameter change list. // Parameters : // int varidx : Variable change index // string varname : Variable name // int val : Variable value */ { // Set bae.ini variable change data varset(INICHGVAR+itoa(varidx),varname); varset(INICHGVAL+itoa(varidx),val ? "ON" : "OFF"); varset(INICHGIVAL+itoa(varidx),val); varset(varname,val); varidx++; } void bae_inidblset(int varidx,string varname,double val) /* // Store double value to INI parameter change list. // Parameters : // int varidx : Variable change index // string varname : Variable name // double val : Variable value */ { // Set bae.ini variable change data varset(INICHGVAR+itoa(varidx),varname); varset(INICHGVAL+itoa(varidx),bae_numstring(val,5)); varset(INICHGDVAL+itoa(varidx),val); varset(varname,val); varidx++; } void bae_inidimset(int varidx,string varname,double val) /* // Store dimension/coordinate value to INI parameter change list. // Parameters : // int varidx : Variable change index // string varname : Variable name // double val : Variable value */ { // Set bae.ini variable change data varset(INICHGVAR+itoa(varidx),varname); varset(INICHGVAL+itoa(varidx), bae_numstring(cvtlength(val,0,2),5)+" mm"); varset(INICHGDVAL+itoa(varidx),val); varset(varname,val); varidx++; } void bae_iniangset(int varidx,string varname,double val) /* // Store angle value to INI parameter change list. // Parameters : // int varidx : Variable change index // string varname : Variable name // double val : Variable value */ { // Set bae.ini variable change data varset(INICHGVAR+itoa(varidx),varname); varset(INICHGVAL+itoa(varidx),bae_numstring(cvtangle(val,0,1),3)); varset(INICHGDVAL+itoa(varidx),val); varset(varname,val); varidx++; } void bae_inistrset(int varidx,string varname,string val) /* // Store string value to INI parameter change list. // Parameters : // int varidx : Variable change index // string varname : Variable name // string val : Variable value */ { // Set bae.ini variable change data varset(INICHGVAR+itoa(varidx),varname); varset(INICHGVAL+itoa(varidx),"\""+val+"\""); varset(INICHGSVAL+itoa(varidx),val); varset(varname,val); varidx++; } void bae_iniwrite(int varcnt) /* // Write current parameter list back to bae.ini file // int varcnt : Variable change count */ { int i /* Loop control variable */; if (varcnt==0) return; // Verify write if (bae_msgboxverify( M("Einstellungen als Default in bae.ini speichern ?", "Save Settings as Default to bae.ini ?"),"")==1) { ulsystem("iniedit",0); } else { for (i=0;i=0 && (c=fulldir[i])=='/' || c=='\\') fulldir[i]='\0'; if (filetype(fulldir)==0) return; // Scan sub directories lc=fulldir[0]; for (i=1;(c=fulldir[i])!='\0';i++) { if ((c=='/' || c=='\\') && lc!=':' && lc!='\\' && lc!='/') { // Delimiter found, extract sub directory name subdir=strextract(fulldir,0,i-1); // Check if directory exists if (filetype(subdir)!=0) // Create directory mkdir(subdir); } lc=c; } // Check if directory exists if (filetype(fulldir)!=0) // Create directory mkdir(fulldir); } int bae_splitdirnames(string dir,STRINGS sdl) /* // Split a directory into sub directory names // Return value : // number of sub directories // Parameters : // string dir : Directory name // STRINGS sdl : Sub directory list return (top level last) */ { int sdn = 0 /* Sub directory count */; int epos = strlen(dir)-1 /* Scan end position */; int pos /* String scan position */; int c /* Scan character */; // Scan for sub directories while (epos!=0) { // Skip trailing path delimiters while (epos>=0 && ((c=dir[epos])=='/' || c=='\\')) epos--; // Check if start of directory reached if (epos<0 || dir[epos]==':') // Stop scan break; // Scan to directory name start pos=epos-1; while (pos>=0 && (c=dir[pos])!='/' && c!='\\' && c!=':') pos--; // Store sub directory name sdl[sdn]=strextract(dir,pos+1,epos); sdn++; epos=pos; } // Return the sub directory count return(sdn); } string bae_getsubdirname(string dir,int dircnt) /* // Extract a sub directory name // Return value : // Sub directory name or "" if invalid directory // Parameters : // string dir : Directory name // int dircnt : Directory strip count */ { int sdn = 0 /* Sub directory count */; int epos = strlen(dir)-1 /* Scan end position */; int pos /* String scan position */; int c /* Scan character */; // Scan for sub directories while (epos!=0) { // Skip trailing path delimiters while (epos>=0 && ((c=dir[epos])=='/' || c=='\\')) epos--; // Check if start of directory reached if (epos<0 || dir[epos]==':') // Stop scan break; // Scan to directory name start pos=epos-1; while (pos>=0 && (c=dir[pos])!='/' && c!='\\' && c!=':') pos--; sdn++; if (sdn==dircnt) // Return sub directory name return(strextract(dir,pos+1,epos)); epos=pos; } return(""); } string bae_stripdirnames(string dir,int dircnt) /* // Strip trailing directories from directory name // Return value : // Shortend directory name or "" if invalid directory // Parameters : // string dir : Directory name // int dircnt : Directory strip count */ { int epos = strlen(dir)-1 /* Scan end position */; int c /* Scan character */; int loopcnt = dircnt /* Loop count */; // Scan for sub directories while (loopcnt>0) { // Skip trailing path delimiters while (epos>=0 && ((c=dir[epos])=='/' || c=='\\')) epos--; // Check if start of directory reached if (epos<0 || dir[epos]==':') // Stop scan break; // Scan to directory name start epos--; while (epos>=0 && (c=dir[epos])!='/' && c!='\\' && c!=':') epos--; loopcnt--; } // Check if expected directory count found if (epos<=0 || loopcnt>0) return(""); return(strextract(dir,0,epos)); } string bae_versfilename(string filenamepattern,int startidx,int maxidx) /* // Open file or abort with error message on fault // Returns : next free version file name // Parameters : // string filenamepattern : File name pattern // int startidx : File version start index // int maxidx : File version maximum index */ { string ERRMSG = M("Kein Dateiname mehr frei '%s,...'!", "No more file name available '%s,...'!"); string fname; // File name int scanidx; // Version scan index int fh; // File handle // Set file error mode fseterrmode(0); for (scanidx=startidx;scanidx<=maxidx;scanidx++) { sprintf(fname,filenamepattern,scanidx); // Open file if ((fh=fopen(fname,0))==(-1)) // Return free file name return(fname); // Close file fclose(fh); } sprintf(fname,filenamepattern,startidx); errormsg(ERRMSG,fname); // Not reached return(""); } string bae_altconffilename(string basefilename) /* // Get alternate configuration file name with full path // Returns : file name or empty string if no alternate configuration // Parameter : // string basefilename : Base file name */ { string altconfpath; // Alternate configuration file path // Get the alternate configuration file path if ((altconfpath=baegetstrpar(19))=="") return(""); // Return the alternate configuration file name return(altconfpath+bae_swversion(4)+basefilename); } string bae_getconffilename( string deffilename,string altfilename,string entryname,int entryclass) /* // Select configuration file name for given entry, strip entry priority suffix // Returns : file name // Parameter : // string deffilename : Default configuration file name // string altfilename : Alternate configuration file name // string entryname : Entry name // int entryclass : Entry class */ { int altconfprio /* Alternate conf. file priority */; // Get configuration file priority if (entryname[0]=='!') { altconfprio=1; entryname=strextract(entryname,0,strlen(entryname)); } else if (entryname[0]=='?') { altconfprio=0; entryname=strextract(entryname,0,strlen(entryname)); } else { bae_getintpar(50,altconfprio); } // Check the alternate configuration file if (altfilename=="") // Use default file name return(deffilename); // Check configuration file priority if (altconfprio) { if (ddbcheck(altfilename,entryclass,entryname)==0) return(altfilename); return(ddbcheck(deffilename,entryclass,entryname)==0 ? deffilename : altfilename); } if (ddbcheck(deffilename,entryclass,entryname)==0) return(altfilename); return(ddbcheck(altfilename,entryclass,entryname)==0 ? altfilename : deffilename); } //__________________________________________________________________ // BAE workspace manipulation void baewsshrink(int zoomall) /* // Shrink BAE workspace to origin // Parameters : // int zoomall : Zoom all request flag */ { int MNU_PARUBND; // Parameter - Set Upper Boundary menu item int MNU_PARLBND; // Parameter - Set Lower Boundary menu item double BTL; // Boundary tolerance length double GRIDTOL=0.0001; // SCM grid settings tolerance int gridlock; // Grid lock flag // Abort if invalid plan class if (bae_planddbclass()==DDBCLUNDEF) return; // Check interpreter environment; set parameters switch (uliptype()) { // Schematic Editor case ULIPSCM : MNU_PARUBND=MNU_SCMPARUBND; MNU_PARLBND=MNU_SCMPARLBND; BTL=0.001; break; // Layout Editor case ULIPGED : MNU_PARUBND=MNU_GEDPARUBND; MNU_PARLBND=MNU_GEDPARLBND; BTL=0.00001; break; // Chip Editor case ULIPCED : MNU_PARUBND=MNU_CEDPARUBND; MNU_PARLBND=MNU_CEDPARLBND; BTL=0.000000001; break; // Abort on default (unsupported environment) default : return; } // Free (non-SCM) grid if locked if (uliptype()!=ULIPSCM) { if (gridlock=bae_getgridlock()) bae_setgridlock(0); } // Parameter - Set Upper Boundary bae_clriactqueue(); bae_storemouseiact(1,bae_planwsnx()+BTL,bae_planwsny()+BTL,0,LMB); call(MNU_PARUBND); // Parameter - Set Lower Boundary bae_clriactqueue(); bae_storemouseiact(1,bae_planwsnx()-BTL,bae_planwsny()-BTL,0,LMB); call(MNU_PARLBND); // Special Schematic Editor processing if (uliptype()==ULIPSCM) { // Test plan class if (bae_planddbclass()!=DDBCLSMRK) { // Ceil upper boundary to mm grid bae_clriactqueue(); bae_storemouseiact(1, ceil((bae_planwsux()+GRIDTOL)*1000.0)/1000.0, ceil((bae_planwsuy()+GRIDTOL)*1000.0)/1000.0,0,LMB); call(MNU_SCMPARUBND); // Floor lower boundary to mm grid bae_clriactqueue(); bae_storemouseiact(1, floor((bae_planwslx()-GRIDTOL)*1000.0)/1000.0, floor((bae_planwsly()-GRIDTOL)*1000.0)/1000.0,0,LMB); call(MNU_SCMPARLBND); } // Test if SCM plan if (bae_planddbclass()==DDBCLSCM) { // Set origin to lower boundary if outta new workspace if (bae_planwslx()>bae_planwsnx()) { // Parameter - Set Origin bae_clriactqueue(); bae_storemouseiact( 1,bae_planwslx(),bae_planwsny(),0,LMB); call(MNU_SCMPARORIG); } if (bae_planwsly()>bae_planwsny()) { // Parameter - Set Origin bae_clriactqueue(); bae_storemouseiact( 1,bae_planwsnx(),bae_planwsly(),0,LMB); call(MNU_SCMPARORIG); } } } // Restore (non-SCM) grid lock if (uliptype()!=ULIPSCM) bae_setgridlock(gridlock); // Zoom all on request if (zoomall) zoomall(); } void baewsresize(double resize,int zoomall) /* // Resize current BAE element workspace by given value // Parameters : // double resize : Workspace resize value : // positive value causes enlarge operation, // negative value causes shrink operation // int zoomall : Zoom all request flag */ { int MNU_PARUBND; // Parameter - Set Upper Boundary menu item int MNU_PARLBND; // Parameter - Set Lower Boundary menu item // Abort if invalid plan class or zero resize value if (bae_planddbclass()==DDBCLUNDEF || resize==0.0) return; // Check interpreter environment; set parameters switch (uliptype()) { // Schematic Editor case ULIPSCM : MNU_PARUBND=MNU_SCMPARUBND; MNU_PARLBND=MNU_SCMPARLBND; break; // Layout Editor case ULIPGED : MNU_PARUBND=MNU_GEDPARUBND; MNU_PARLBND=MNU_GEDPARLBND; break; // Chip Editor case ULIPCED : MNU_PARUBND=MNU_CEDPARUBND; MNU_PARLBND=MNU_CEDPARLBND; break; // Abort on default (unsupported environment) default : return; } // Parameter - Set Upper Boundary bae_clriactqueue(); bae_storemouseiact(1, bae_planwsux()+resize,bae_planwsuy()+resize,0,LMB); call(MNU_PARUBND); // Parameter - Set Lower Boundary bae_clriactqueue(); bae_storemouseiact(1, bae_planwslx()-resize,bae_planwsly()-resize,0,LMB); call(MNU_PARLBND); // Zoom all on request if (zoomall) zoomall(); } //__________________________________________________________________ // End library-specific source code #endif // LIBSTD #endif // USELIB // Conditional file inclusion end #endif // INCLUDE_STD // User Language include file end