summaryrefslogtreecommitdiff
path: root/gui/resources/glreference-registry.sh
blob: 1c0cbe4f69f4e29ad3d4072dc5c578e94cffd6b4 (plain)
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
#!/bin/bash
# Script to extract reference URLs for functions documented in OpenGL ARB specs

extract_urls () {
    for URL
    do
            lynx -dump "$URL" | sed -n -e '/^References$/,$s/^ *[0-9]\+\. \+//p' | sed -e 's/ /%20/g'
    done
}

extract_functions () {
    sed -n -e '/^New Procedures and Functions$/,/^\w/ s/.* \(\w\+\)(.*$/\1/p' "$@" \
    | sed -e '/^[A-Z]/s/^/gl/'
}

extract_urls https://www.opengl.org/registry/ \
| grep '^https://www\.opengl\.org/registry/specs/\w\+/.*\.txt$' \
| sort -u \
| while read URL
do
    wget --quiet -O - $URL \
    | extract_functions \
    | while read FUNCTION
    do
        echo "$FUNCTION	$URL"
    done
done