summaryrefslogtreecommitdiff
path: root/cmd/gen-posix/data.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gen-posix/data.go')
-rw-r--r--cmd/gen-posix/data.go211
1 files changed, 211 insertions, 0 deletions
diff --git a/cmd/gen-posix/data.go b/cmd/gen-posix/data.go
new file mode 100644
index 0000000..165ecbd
--- /dev/null
+++ b/cmd/gen-posix/data.go
@@ -0,0 +1,211 @@
+package main
+
+import (
+ "fmt"
+ "os"
+ "os/exec"
+ "regexp"
+ "strings"
+
+ "git.lukeshu.com/www/lib/httpcache"
+)
+
+var IEEESA = Vendor{
+ Name: "IEEE-SA",
+ GetURL: func(id string) string { return fmt.Sprintf("http://standards.ieee.org/findstds/standard/%s.html", id) },
+ GetName: func(id string, url string) string {
+ html, err := httpcache.Get(url, nil)
+ if err != nil {
+ panic(fmt.Errorf("URL=%q: %v", url, err))
+ }
+ cmd := exec.Command("nokogiri", "-e", `puts $_.css("meta[name=\"des\"], meta[name=\"designation\"]").first["content"]`)
+ cmd.Stderr = os.Stderr
+ cmd.Stdin = strings.NewReader(html)
+ d, err := cmd.Output()
+ if err != nil {
+ panic(fmt.Errorf("URL=%q: %v", url, err))
+ }
+ return strings.TrimSuffix(string(d), "\n")
+ },
+}
+
+var reIEEE = regexp.MustCompile(`standardNumber":"([^"]*)"`)
+
+var IEEEXplore = Vendor{
+ Name: "IEEE Xplore",
+ GetURL: func(id string) string { return fmt.Sprintf("http://ieeexplore.ieee.org/servlet/opac?punumber=%s", id) },
+ GetName: func(id string, url string) string {
+ if strings.HasSuffix(url, "ERROR") {
+ return "ERROR"
+ }
+ html, err := httpcache.Get(url, nil)
+ if err != nil {
+ panic(fmt.Errorf("URL=%q: %v", url, err))
+ }
+ m := reIEEE.FindStringSubmatch(html)
+ if m == nil {
+ panic(fmt.Errorf("URL=%q did not contain expected JSON", url))
+ }
+ return m[1]
+ },
+}
+
+var TOG = Vendor{
+ Name: "The Open Group",
+ GetURL: func(id string) string { return fmt.Sprintf("https://www2.opengroup.org/ogsys/catalog/%s", id) },
+ GetName: func(id string, url string) string { return id },
+}
+
+var TOGOnline = Vendor{
+ Name: "online",
+ GetURL: func(id string) string { return fmt.Sprintf("http://pubs.opengroup.org/onlinepubs/%s/", id) },
+ GetName: func(id string, url string) string { return url },
+}
+
+var ISO = Vendor{
+ Name: "ISO",
+ GetURL: func(id string) string {
+ return fmt.Sprintf("http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=%s", id)
+ },
+ GetName: func(id string, url string) string {
+ html, err := httpcache.Get(url, nil)
+ if err != nil {
+ panic(fmt.Errorf("URL=%q: %v", url, err))
+ }
+ cmd := exec.Command("nokogiri", "-e", `puts $_.css("[itemprop=\"name\"]").first.text`)
+ cmd.Stderr = os.Stderr
+ cmd.Stdin = strings.NewReader(html)
+ d, err := cmd.Output()
+ if err != nil {
+ panic(fmt.Errorf("URL=%q: %v", url, err))
+ }
+ return strings.TrimSuffix(string(d), "\n")
+ },
+}
+
+var Vendors = []Vendor{IEEESA, TOG, ISO}
+
+var Editions = []Edition{
+ {Name: "POSIX-2001 (Issue 6)", Docs: []Document{
+ {Vendor: IEEESA, Type: Full, ID: "1003.1-2001", Resellers: []Document{
+ {Vendor: IEEEXplore, Type: Full, ID: "7683"},
+ }},
+ }},
+ {Name: "----->XBD-2001", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C950"},
+ {Vendor: ISO, Type: Full, ID: "37312"},
+ }},
+ {Name: "----->XSH-2001", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C951"},
+ {Vendor: ISO, Type: Full, ID: "37313"},
+ }},
+ {Name: "----->XCU-2001", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C952"},
+ {Vendor: ISO, Type: Full, ID: "37314"},
+ }},
+ {Name: "----->XRAT-2001", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C953"},
+ {Vendor: ISO, Type: Full, ID: "37315"},
+ }},
+
+ {Name: "POSIX-2001, 2002 Edition", Docs: []Document{
+ {Vendor: IEEESA, Type: Patch, ID: "1003.1-2001-Cor_1-2002", Resellers: []Document{
+ {Vendor: IEEEXplore, Type: Patch, ID: "9507"},
+ }},
+ {Vendor: TOG, Type: Patch, ID: "U057", Resellers: []Document{
+ {Vendor: TOG, Type: Full, ID: "T031"},
+ }},
+ }},
+ {Name: "----->XBD-2001, 2002 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C031"},
+ {Vendor: ISO, Type: Full, ID: "38789", Resellers: []Document{
+ {Vendor: IEEESA, Type: Full, ID: "9945-1-2003"},
+ }},
+ }},
+ {Name: "----->XSH-2001, 2002 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C032"},
+ {Vendor: ISO, Type: Full, ID: "38790", Resellers: []Document{
+ {Vendor: IEEESA, Type: Full, ID: "9945-2-2003"},
+ }},
+ }},
+ {Name: "----->XCU-2001, 2002 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C033"},
+ {Vendor: ISO, Type: Full, ID: "38791", Resellers: []Document{
+ {Vendor: IEEESA, Type: Full, ID: "9945-3-2003"},
+ }},
+ }},
+ {Name: "----->XRAT-2001, 2002 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C034"},
+ {Vendor: ISO, Type: Full, ID: "38792", Resellers: []Document{
+ {Vendor: IEEESA, Type: Full, ID: "9945-4-2003"},
+ }},
+ }},
+
+ {Name: "POSIX-2001, 2004 Edition", Docs: []Document{
+ {Vendor: IEEESA, Type: Patch, ID: "1003.1-2001-Cor_2-2004", Resellers: []Document{
+ {Vendor: IEEEXplore, Type: Patch, ID: "9022"},
+ {Vendor: IEEEXplore, Type: Full, ID: "9156"},
+ }},
+ {Vendor: TOG, Type: Patch, ID: "U059", Resellers: []Document{
+ {Vendor: TOG, Type: Full, ID: "T041"},
+ {Vendor: TOGOnline, Type: Full, ID: "009695399"},
+ }},
+ }},
+ {Name: "----->XBD-2001, 2004 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C046"},
+ {Vendor: ISO, Type: Patch, ID: "40687"},
+ }},
+ {Name: "----->XSH-2001, 2004 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C047"},
+ {Vendor: ISO, Type: Patch, ID: "40688"},
+ }},
+ {Name: "----->XCU-2001, 2004 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C048"},
+ {Vendor: ISO, Type: Patch, ID: "40690"},
+ }},
+ {Name: "----->XRAT-2001, 2004 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C049"},
+ {Vendor: ISO, Type: Patch, ID: "40691"},
+ }},
+
+ {Name: "POSIX-2008 (Issue 7)", Docs: []Document{
+ {Vendor: TOG, Type: Full, ID: "C082", Resellers: []Document{
+ {Vendor: TOGOnline, Type: Full, ID: "9699919799.2008edition"},
+ }},
+
+ {Vendor: IEEESA, Type: Full, ID: "1003.1-2008", Resellers: []Document{
+ {Vendor: IEEEXplore, Type: Full, ID: "4694974"},
+ }},
+
+ {Vendor: ISO, Type: Full, ID: "50516", Resellers: []Document{
+ {Vendor: IEEESA, Type: Full, ID: "9945-2009"},
+ {Vendor: IEEEXplore, Type: Full, ID: "5393777"},
+ }},
+ }},
+ {Name: "POSIX-2008, 2013 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Patch, ID: "U130", Resellers: []Document{
+ {Vendor: TOG, Type: Full, ID: "C138"},
+ {Vendor: TOGOnline, Type: Full, ID: "9699919799.2013edition"},
+ }},
+
+ {Vendor: IEEESA, Type: Patch, ID: "1003.1-2008-Cor_1-2013", Resellers: []Document{
+ {Vendor: IEEEXplore, Type: Patch, ID: "6482152"},
+ {Vendor: IEEEXplore, Type: Full, ID: "6506089"},
+ }},
+
+ {Vendor: ISO, Type: Patch, ID: "62005"},
+ }},
+ {Name: "POSIX-2008, 2016 Edition", Docs: []Document{
+ {Vendor: TOG, Type: Patch, ID: "U160", Resellers: []Document{
+ {Vendor: TOG, Type: Full, ID: "C165"},
+ {Vendor: TOGOnline, Type: Full, ID: "9699919799.2016edition"},
+ }},
+
+ {Vendor: IEEESA, Type: Patch, ID: "1003.1-2008-Cor_2-2016", Resellers: []Document{
+ {Vendor: IEEEXplore, Type: Patch, ID: "7542096"},
+ {Vendor: IEEEXplore, Type: Full, ID: "7582336"},
+ }},
+ }},
+}
+
+// SUSv2 http://pubs.opengroup.org/onlinepubs/007908799/