1# This script generates the PS3 hypervisor call header from a hypervisor 2# interface definition file. All lines that do not begin with HVCALL 3# or a bare # for comments are copied to the output header so that 4# enums, constant, C comments and the like can be passed through into the 5# header. 6# 7# Invoke like so: awk -f ps3-hv-header.awk < ps3-hvcall.master > ps3-hv.h 8# 9 10# $FreeBSD$ 11 12!/HVCALL.*/ && (!/#.*/ || /#define.*/ || /#include.*/) { 13 print($0); 14} 15 16/HVCALL.*/ { 17 split($5, outs, ",") 18 if ($4 == "UNUSED") 19 split("", ins, ",") 20 else 21 split($4, ins, ",") 22 23 printf("int %s(",$3); 24 for (i = 1; i <= length(ins); i++) { 25 printf("uint64_t %s", ins[i]); 26 if (i < length(ins)) printf(", "); 27 } 28 29 if (length(outs) > 0 && length(ins) > 0) 30 printf(", "); 31 32 for (i = 1; i <= length(outs); i++) { 33 printf("uint64_t *%s", outs[i]); 34 if (i < length(outs)) printf(", "); 35 } 36 37 if (length(outs) == 0 && length(ins) == 0) 38 printf("void"); 39 40 printf(");\n"); 41} 42 43