/* LIBCRREF (STD) -- Library Element Cross Reference */ /* LIBCRREF (STD) -- Bibliothekselement-Querverweisliste */ /* // Copyright (c) 1993-2012 Oliver Bartels F+E, Muenchen // Author: Manfred Baumeister // 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 (050906) RELEASED FOR BAE V6.6. // rl (040811) RELEASED FOR BAE V6.4. // rl (030904) RELEASED FOR BAE V6.2. // rl (021209) RELEASED FOR BAE V6.0. // rl (020618) RELEASED FOR BAE V5.4. // rl (010625) RELEASED FOR BAE V5.0. // rl (010125) ENHANCEMENT: // Eliminated language mix in menus and output. // rl (000509) RELEASED FOR BAE V4.6. // rl (990625) RELEASED FOR BAE V4.4. // rl (980910) RELEASED FOR BAE V4.2. // mb (980710) ENHANCEMENT: // Dynamic multi-language support introduced. // rl (970929) RELEASED FOR BAE V4.0. // mb (960927) RELEASED FOR BAE V3.4. // mb (960801) ENHANCEMENT: // Changed menu items to support key selection // in Windows/Motif user interfaces. // mb (951108) IMPROVEMENT: // mnu_poptext() function instead of file output // used for compare report display. // mb (95) RELEASED FOR BAE V3.2. // mb (950124) IMPROVEMENT: // Introduced feature for program abort on key hit. // mb (94) RELEASED FOR BAE V3.0. // mb (93) ORIGINAL CODING. // // DESCRIPTION // // The libcrref User Language program generates a library element // cross reference list of the current directory's DDB files. The // Listing is displayed in a popup menu with file output option. // The type of library elements to be listed may be selected upon // program start, and an option is provided for listing either all // or only multiple library element definitions. */ // Includes #include "mnu.ulh" // User Language menu utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string UPRABORT = M_UPRABORT(); string UPRPEXIT = M_UPRPEXIT(); string REPSCANSYM = M("Scannen %s in Bibliothek '%s'...", "Scanning %s in Library '%s'..."); string REPLISTSYM = M("List %s Cross Referenz...", "Listing %s Cross Reference..."); string UPROUTMOD = M("Ausgabemodus waehlen!","Select Output Mode!"); string UPROUTALL = M("Listing A&lle" ,"List A&ll"); string UPROUTMUL = M("Listing &Doppelte" ,"List &Multiple Only"); string UPRSYMTYP = M("Elementtyp waehlen!","Select Element Type!"); string UPRALLSYM = M("Alle &Elemente","All &Elements"); string UPRALLSCM = M("Alle &SCM-Elemente","All &SCM Elements"); string UPRALLLAY = M("Alle &Layoutelemente","All &Layout Elements"); string UPRSSYM = M("SCM-S&ymbole","SCM S&ymbols"); string UPRSLAB = M("SCM-La&bels","SCM La&bels"); string UPRSMRK = M("SCM-&Marker","SCM Mar&kers"); string UPRLPRT = M("Layout&bauteile","Layout &Parts"); string UPRLSTK = M("Layout&padstacks","Layout Padsta&cks"); string UPRLPAD = M("Layoutpa&ds","Layout Pa&ds"); string ERRNOLIB = M("Keine Bibliotheksdatei im Verzeichnis '%s'!", "No library file in directory '%s'!"); string ITMUNDEF = M("*** UNDEFINIERT ***","*** UNDEFINED ***"); // Output format strings string FMTLOGHD = M("Bibliothekselemente Crossreferenz", "Library Element Cross Reference"); string FMTFILEHD = M("Analysierte Bibliotheksdateien (Verzeichnis '%s'", "Analyzed Library Files (Directory '%s'):"); #define FMTFILE "%s" string FMTOPTHD = M("Ausgabeoptionen:","Output Options:"); string FMTOUTMODE = M(" Ausgabemodus ......: %s", " Output Mode .......: %s"); string FMTSYMTYP = M(" Elementtyp(en) ....: %s", " Symbol Type(s) ....: %s"); string FMTCLASSHD = M("%s (Insgesamt %d, Doppelte %d) :", "%s (Total %d, Multiple %d) :"); #define FMTSYMST "[%2d] %-*s:" #define FMTFILEREF " %-*s" // Globals #define LIBDIR CURDIR // Library directory path #define DIRDEL "/" // Directory name delimiter static STRINGS ddbfiles /* DDB file name list */; static int ddbfilen = 0 /* DDB file name count */; static struct { // Symbol descriptor string sn /* Symbol name */; int refcnt /* Reference count */; int reflibs[] /* Reference library indices */; } symbols[] /* Symbol list */; static int symboln = 0 /* Symbol count */; static int listmul /* List multiple defs. only flag */; static int maxfnlen = 0 /* Maximum file name length */; static int maxsnlen /* Maximum symbol name length */; static int muldefcnt /* Multiple definitions count */; static STRINGS msgl /* Message list */; static int msgn = 0 /* Message count */; // Main program void main() { int i /* Loop control variable */; // Create the DDB file name list filelist(ddbfiles,ddbfilen,LIBDIR,DDBEXT,"",DDBCLUNDEF,0,0,0,1,0); // Abort if no DDB file found if (!ddbfilen) errormsg(ERRNOLIB,LIBDIR); // Ask for output mode bae_promptdialog(UPROUTMOD); if ((listmul=bae_askmenu(3,UPROUTALL,UPROUTMUL,UPRABORT))<0 || listmul>1) error_abort(); // Print output file header sprintf(msgl[msgn],FMTLOGHD); msgn++; msgl[msgn++]=""; sprintf(msgl[msgn],FMTFILEHD,LIBDIR); msgn++; for (i=0;i>1; // Get and test the compare result if ((compres=numstrcmp(sn,symbols[idx].sn))==0) { symbols[idx].reflibs[symbols[idx].refcnt++]=libidx; if (symbols[idx].refcnt==2) muldefcnt++; return; } // Update the search area if (compres<0) sub=idx-1; else slb=idx+1; } // Insert the new entry to the logical part list symboln++; for (idx=symboln-2;idx>=slb;idx--) symbols[idx+1]=symbols[idx]; symbols[slb].reflibs[0]=libidx; symbols[slb].refcnt=1; symbols[slb].sn=sn; // Update the maximum symbol name length maxsnlen=maxint(maxsnlen,strlen(sn)); } // Data conversion routines string classname(int ddbcl) /* // Get class name for given DDB class // Return value : // class name // Parameters : // int ddbcl : DDB class code */ { // Evaluate the DDB class switch (ddbcl) { case DDBCLSSYM : return(UPRSSYM); case DDBCLSLAB : return(UPRSLAB); case DDBCLSMRK : return(UPRSMRK); case DDBCLLPRT : return(UPRLPRT); case DDBCLLSTK : return(UPRLSTK); case DDBCLLPAD : return(UPRLPAD); } // Undefined return(ITMUNDEF); } // User Language program end