neingeist
/
arduinisten
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

93 lines
1.9 KiB
Plaintext

#usage "<b>Remove actual device/symbol/package and edit next</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;
cmd = "REMOVE " + D.name + ";\n" ;
for (n = 1; n < dcount; n++) {
if (edit == dev[n]) {
break;
}
}
if (n < dcount) {
cmd += "EDIT " + dev[n + 1] + ".dev;\n" ;
}
else {
if (dcount > 0) {
cmd += "EDIT " + dev[n - 1] + ".dev;\n" ;
}
else exit (0);
}
}
if (symbol) symbol(S) {
edit = S.name;
cmd = "REMOVE " + S.name + ";\n" ;
for (n = 1; n < scount; n++) {
if (edit == sym[n]) {
break;
}
}
if (n < scount) {
cmd += "EDIT " + sym[n + 1] + ".sym;\n" ;
}
else {
if (scount > 0) {
cmd += "EDIT " + sym[n - 1] + ".sym;\n" ;
}
else exit (0);
}
}
if (package) package(P) {
edit = P.name;
cmd = "REMOVE " + P.name + ";\n" ;
for (n = 1; n < pcount; n++) {
if (edit == pac[n]) {
break;
}
}
if (n < dcount) {
cmd += "EDIT " + pac[n + 1] + ".pac;\n" ;
}
else {
if (pcount > 0) {
cmd += "EDIT " + pac[n - 1] + ".pac;\n" ;
}
else exit (0);
}
}
exit(cmd);
}