1#!/bin/sh 2# $OpenBSD: MKcaptab.awk,v 1.3 2001/01/22 18:01:49 millert Exp $ 3# $From: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $ 4AWK=${1-awk} 5DATA=${2-../include/Caps} 6 7cat <<'EOF' 8/* 9 * comp_captab.c -- The names of the capabilities indexed via a hash 10 * table for the compiler. 11 * 12 */ 13 14#include <ncurses_cfg.h> 15#include <curses.priv.h> 16#include <tic.h> 17#include <term.h> 18 19EOF 20 21./make_hash 1 info <$DATA 22./make_hash 3 cap <$DATA 23 24cat <<'EOF' 25const struct alias _nc_capalias_table[] = 26{ 27EOF 28 29$AWK <$DATA ' 30$1 == "capalias" { 31 if ($3 == "IGNORE") 32 to = "(char *)NULL"; 33 else 34 to = "\"" $3 "\""; 35 printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n", 36 $2, to, $4, $5 37 } 38' 39 40cat <<'EOF' 41 {(char *)NULL, (char *)NULL, (char *)NULL} 42}; 43 44const struct alias _nc_infoalias_table[] = 45{ 46EOF 47 48$AWK <$DATA ' 49$1 == "infoalias" { 50 if ($3 == "IGNORE") 51 to = "(char *)NULL"; 52 else 53 to = "\"" $3 "\""; 54 printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n", 55 $2, to, $4, $5 56 } 57' 58 59cat <<'EOF' 60 {(char *)NULL, (char *)NULL, (char *)NULL} 61}; 62 63NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap) 64{ 65 return termcap ? _nc_cap_table: _nc_info_table ; 66} 67 68NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap) 69{ 70 return termcap ? _nc_cap_hash_table: _nc_info_hash_table ; 71} 72EOF 73