File: editprev-dev-sym-pac.ulp

package info (click to toggle)
eagle 4.16-5
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 36,508 kB
  • sloc: sh: 82; makefile: 32
file content (71 lines) | stat: -rw-r--r-- 1,434 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#usage "<b>Edit previous device, symbol, or package in library</b>\n"
       "<p>"
       "<author>Author: support@cadsoft.de</author>"

// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

string cmd = "";
string dev[];
string sym[];
string pac[];
string edit = "";
int    scount = 0;
int    dcount = 0;
int    pcount = 0;
int    n = 0;

if (library) library(L) {
  L.devicesets(D) {
    dcount++;
    dev[dcount] = D.name;
    }
  L.symbols(S) {
    scount++;
    sym[scount] = S.name;
    }
  L.packages(P) {
    pcount++;
    pac[pcount] = P.name;
    }

   if (deviceset) deviceset(D) {
      edit = D.name;
      for (n = 1; n < dcount; n++) {
         if (edit == dev[n]) {
            break;
            }
         }
      if (n > 0) {
         cmd += "EDIT " + dev[n - 1] + ".dev;\n" ;
         }
      else exit (0);
      }

   if (symbol) symbol(S) {
      edit = S.name;
      for (n = 1; n < scount; n++) {
         if (edit == sym[n]) {
            break;
            }
         }
      if (n > 0) {
         cmd += "EDIT " + sym[n - 1] + ".sym;\n" ;
         }
      else exit (0);
      }

   if (package) package(P) {
      for (n = 1; n < pcount; n++) {
      edit = P.name;
         if (edit == pac[n]) {
            break;
            }
         }

      if (n > 0) {
         cmd += "EDIT " + pac[n - 1] + ".pac;\n" ;
         }
      else exit (0);
      }
  exit(cmd);
  }