#!/usr/bin/awk -f BEGIN { ws="[ \t,();]+" # regexp of separators ltws="^" ws "|" ws "$" # regexp of leading and trailing separators nServs=0 # number of Services found } { split($0,line,"//") # separate line into program and (optional) comment gsub(ltws,"",line[1]) # strip out leading or trailing separators gsub("[ \t]+","",line[1]) # strip out any other spaces n=split(line[1],x,ws) # split program portion according to separators if(x[1]=="CREATE_SERV"){ currentService=x[2] services[nServs++]=currentService uuid[currentService]=x[3] desc[currentService]=line[2] # save optional comment as description of Service nChars[currentService]=0 } else if(x[1]=="REQ" || x[1]=="OPT"){ servChars[currentService,nChars[currentService]]=x[2] servReq[currentService,nChars[currentService]]=(x[1]=="REQ") nChars[currentService]++ } else if(x[1]=="CREATE_CHAR"){ char=x[3] default[char]=x[4] min[char]=x[5] max[char]=x[6] nVals[char]=n-6 # parse any pre-defined constants for(i=0;i%s
\n",desc[s]) printf("\n") for(j=0;j") #printf("",servReq[s,j]?"":"",char,servReq[s,j]?"":"",notes[char]) printf("",char,uuid[char],notes[char]) printf("",format[char]) printf("",perms[char]) if(format[char]!="string") printf("",min[char],max[char]) else printf("") if(nVals[char]>0){ printf("") } else { printf("",default[char]) } printf("\n") } printf("
CharacteristicFormatPermsMinMaxConstants/Defaults
%s
  • %s
%s (%s)
  • %s
%s%s%s%s--
    ") for(k=0;k%s%s (%d)%s",default[char]==k?"":"",vals[char,k],k,default[char]==k?"":"") printf("
%s
\n\n") } }