forked from robertstarr/ulp_user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange-prefix-in-lbr.ulp
63 lines (52 loc) · 1.58 KB
/
change-prefix-in-lbr.ulp
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
#usage "<b>Change library device prefix strings</b>\n"
"<p>This script loops through all packages in a library and changes the devices prefixes to a new user specified value.<p>"
"<author>Author: http://www.bobstarr.net</author>"
string ulp_path = "";
string script_change = "";
int Result = 0;
string old_prefix = "IC";
string new_prefix = "U";
void menue(void) {
int err = 0;
int newWidth;
int minLimit = 0;
int maxLimit = 0;
dlgDialog("Change All Text Sizes/Ratios") {
//dlgStretch(1);
dlgGroup("Change Device Prefix") {
dlgHBoxLayout { dlgLabel("Old Prefix :\t"); dlgStringEdit(old_prefix); }
dlgHBoxLayout { dlgLabel("New Prefix :\t"); dlgStringEdit(new_prefix); }
}
//dlgStretch(1);
dlgPushButton("+&OK") { dlgAccept(); return; }
dlgPushButton("-&Cancel") { dlgReject(); exit (0);}
};
}
if (library) {
char bkslash = '/';
int pos = strrchr(argv[0], bkslash);
if (pos >= 0) {
ulp_path = strsub(argv[0], 0, pos + 1);
}
int n = 0;
library(L) {
int posb = strrchr(argv[0], bkslash);
if (posb >= 0) {
ulp_path = strsub(argv[0], 0, posb + 1);
}
menue();
script_change = filesetext(L.name, "~~~.scr");
output(script_change, "wtD") {
int firstf = 1;
L.devicesets(D) {
printf("EDIT %s.dev;\n", D.name);
if (D.prefix == old_prefix)
printf("PREFIX %s;\n", new_prefix);
}
}
}
exit ("SCRIPT '" + script_change + "';\n");
} else {
dlgMessageBox("\n*** Start this ULP in a Library ***\n");
exit (0);
}