Source file: /~heha/hs/gputils64-210929.zip/libgputils/rt.awk

BEGIN{
# FS=" ";
 i=0;
}

/gp_register_t \*.*_registers\[\]/ {
 proc[i]=processor=gensub(/\*(.*)_registers\[\]/,"\\1",0,$4);
 j=0;
 regs[i]="";
 next;
}

/0}/ {
 if (!processor) next;
 reg[i++,0]=j;
 processor="";
 next;
}

{
 if (!processor) next;
 r=gensub(/\&(.*),/,"\\1",0,$1);
 reg[i,++j]=r;
 regs[i]=regs[i] r ",";
}

function diff(k) {
 print proc[k];
 e=reg[k,0];
 for (l=1; l<=e; l++) {
  r=reg[k,l];
  if (k) {
   eb=reg[k-1,0];
   for (m=1; m<=eb; m++) {
    if (reg[k-1,m]==r) break;
   }
   if (m>eb) printf("%s%s\n","+",r);
  }else printf("%s%s\n"," ",r);
 }
 if (k) {
  eb=reg[k-1,0];
  for (m=1; m<=eb; m++) {
   rb=reg[k-1,m];
   for (l=1; l<=e; l++) {
    if (rb==reg[k,l]) break;
   }
   if (l>e) printf("%s%s\n","-",rb);
  }
 }
}

function gleich(k) {
 z=0;
 for (l=0; l<i; l++) if (k!=l && regs[k]==regs[l]) {
  if (l<k) break;	# schon mal gefunden
  if (!z) {printf("%s",proc[k]); z=1;}
  printf("==%s",proc[l]);
 }
 if (z) printf("\n");
}

END{
 for (k=0; k<i; k++) {
# diff(k);
 gleich(k);
 }
# print regs[0];
# print regs[2];
 print i;
}
Detected encoding: ASCII (7 bit)2