partslist-vendor: Generate Mouser format parts list file on request
authorKeith Packard <keithp@keithp.com>
Fri, 13 Nov 2015 00:08:36 +0000 (16:08 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 13 Nov 2015 00:08:36 +0000 (16:08 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
bin/partslist-vendor

index d8ce957b0130d7ec71da47f7068d2e28f6b68e76..e813ec73b592c724cc20338f656f9123b1042abe 100755 (executable)
@@ -39,6 +39,7 @@ string[*] required_elements = {
        "device",
        "value",
        "refdes",
+       "loadstatus"
 };
 
 bool has_header_member(string member) {
@@ -89,7 +90,6 @@ string part_number(string[string] entry)
 
 void process_seeed(string[string] entry)
 {
-
        if (entry["loadstatus"] != "smt")
                return;
 
@@ -114,6 +114,8 @@ void process_seeed(string[string] entry)
 
 void process_digikey(string[string] entry)
 {
+       if (entry["loadstatus"] == "noload")
+               return;
        printf("%s,%s,%s %s\n",
               entry["quantity"],
               part_number(entry),
@@ -121,7 +123,16 @@ void process_digikey(string[string] entry)
               entry["value"]);
 }
 
+void process_mouser(string[string] entry)
+{
+       if (entry["loadstatus"] == "noload")
+               return;
+       printf("%s|%s\n", part_number(entry), entry["quantity"]);
+}
+
 void process_other(string[string] entry) {
+       if (entry["loadstatus"] == "noload")
+               return;
        printf("%s,%s,%s,%s %s\n",
               entry["vendor"],
               entry["quantity"],
@@ -143,6 +154,9 @@ void process_file(file f) {
                        case "digikey":
                                process_digikey(entry);
                                break;
+                       case "mouser":
+                               process_mouser(entry);
+                               break;
                        default:
                                process_other(entry);
                                break;