libk  mktbl.posix.sh at [e42b590b45]

File arch/mktbl.posix.sh artifact c6b3376c79 part of check-in e42b590b45


#!/usr/bin/env bash

ABI=$2

cat >$1/system_calls.h <<HEADER
#ifndef KIplatform_syscall
#define KIplatform_syscall

enum k_platform_syscall {

HEADER

awk <$1/system_calls.tbl >>$1/system_calls.h -F'\t+' '$2 == "common" || $2 == "'$ABI'" { print "\tk_platform_syscall_" $3 " = " $1 "," }'

cat >>$1/system_calls.h <<FOOTER

};

#endif

FOOTER

cat >$1/error_table.h <<HEADER
#ifndef KIplatform_error
#define KIplatform_error

enum k_platform_error {

HEADER

awk <$1/error_table.tbl >>$1/error_table.h -F' +' '{ print "\tk_platform_error_" $1 " = " $2 "," }'

cat >>$1/error_table.h <<FOOTER

};

#endif

FOOTER