Raymond Toy pushed to branch issue-386-generate-def-unix-error at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • bin/create-def-unix-error.awk
    1
    +BEGIN {
    
    2
    +    count = 0
    
    3
    +}
    
    4
    +
    
    5
    +# Find anything that matches '#define Efoo value'
    
    6
    +/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ {
    
    7
    +    # If we haven't found $2 in errno before, add it to the table.
    
    8
    +    # This is to catch any duplicates.  We assume the latter value is
    
    9
    +    # NOT what we want.  This happens on Darwin where EOPNOSUPP is
    
    10
    +    # defined twice due to #if's.
    
    11
    +    if (!($2 in errno)) {
    
    12
    +	errno[count] = $2;
    
    13
    +	value[count] = $3;
    
    14
    +	++count;
    
    15
    +    }
    
    16
    +}
    
    17
    +
    
    18
    +END {
    
    19
    +    for (k = 0; k < count; ++k) {
    
    20
    +	printf "(def-unix-error %s %s)\n", errno[k], value[k];
    
    21
    +    }
    
    22
    +}

  • bin/create-errno.sh
    ... ... @@ -23,9 +23,7 @@ case `uname -s` in
    23 23
     	    ;;
    
    24 24
     esac
    
    25 25
     
    
    26
    -awk '/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ {
    
    27
    -    printf "(def-unix-error %s %s)\n", $2, $3;
    
    28
    -}' "$@" ${ERRNO_FILES} >> $OUTPUT
    
    26
    +awk -f bin/create-def-unix-error.awk ${ERRNO_FILES} >> $OUTPUT
    
    29 27
     
    
    30 28
     # The tail was also copied from code/unix.lisp.  It's needed to tell
    
    31 29
     # Lisp about the errno values.