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