1#!/bin/awk 2# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 3# 4# Copyright (c) 2004, Haiku 5# 6# This software is part of the Haiku distribution and is covered 7# by the Haiku license. 8# 9# 10# File: devlist2h.awk 11# Author: Jérôme Duval 12# Description: Devices Preferences 13# Created : July 8, 2004 14# 15# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 16 17BEGIN { 18 FS=" " 19} 20NR == 1 { 21 printf("/*\tHaiku" "$\t*/\n\n") 22 printf("/*\n") 23 printf(" This file is generated automatically. Don't edit. \n") 24 printf("\n*/") 25} 26 27NF > 0 { 28 n++ 29 30 ids[n, 1] = $1; 31 ids[n, 2] = $2; 32 33} 34 35END { 36 printf("\n") 37 printf("typedef struct { char* id; char* devname; } idTable;\n") 38 printf("idTable isapnp_devids [] = {\n") 39 for (i = 1; i <= n; i++) { 40 printf("\t{\n") 41 printf("\t\t\"%s\", \"%s\"\n", ids[i,1], ids[i,2]) 42 printf("\t},\n") 43 } 44 printf("\t};\n") 45 printf("// Use this value for loop control during searching:\n") 46 printf("#define ISA_DEVTABLE_LEN %i\n", n) 47} 48 49