#!/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] nConstants[char]=n-6 # parse any pre-defined constants value=0 # default starting value of constants for(i=0;i%s
\n",desc[s]) printf("\n") for(j=0;j") printf("",char,uuid[char],servReq[s,j]?":small_blue_diamond:":"",notes[char]) printf("",format[char]) printf("",perms[char]) if(format[char]!="string") printf("",min[char],max[char]) else printf("") if(nConstants[char]>0){ printf("") } else { printf("",default[char]) } printf("\n") } printf("
CharacteristicFormatPermsMinMaxConstants/Defaults
%s (%s) %s
  • %s
%s%s%s%s--
    ") for(k=0;k%s (%d) %s",constantName[char,k],constantValue[char,k],defaultMark[char,k]) printf("
%s
\n\n") } }