xproc() begin
if (lines gt 0) open
Pcall sub0("xlong")
if (lines gt 0) begin
sort
save xlong.fdefs.txt rep
quietly try delete all
end
Pcall sub0("xshort")
if (lines gt 0) begin
sort
save xshort.fdefs.txt rep
quietly try delete all
end
end
proc sub0 (class) begin
Pcall sub1(class,"unsigned short")
Pcall sub1(class,"unsigned long")
Pcall sub1(class,"unsigned int")
Pcall sub1(class,"unsigned char")
Pcall sub1(class,"short")
Pcall sub1(class,"long")
Pcall sub1(class,"int")
Pcall sub1(class,"char")
end
proc sub1 (class,ltype) begin
Pcall sub2(class,ltype,"*")
Pcall sub2(class,ltype,"+")
Pcall sub2(class,ltype,"-")
Pcall sub2(class,ltype,"/")
Pcall sub2(class,ltype,"%")
Pcall sub2(class,ltype,"^")
Pcall sub2(class,ltype,"&")
Pcall sub2(class,ltype,"|")
Pcall sub2(class,ltype,"<<")
Pcall sub2(class,ltype,">>")
Pcall sub7(class,ltype,"==")
Pcall sub7(class,ltype,"!=")
Pcall sub7(class,ltype,"<")
Pcall sub7(class,ltype,"<=")
Pcall sub7(class,ltype,">")
Pcall sub7(class,ltype,">=")
end
proc sub2 (class,ltype,opr) begin
Pcall sub3(class,ltype,opr)
Pcall sub4(class,ltype,opr)
end
proc sub3 (class,ltype,opr) begin
dcl string retyp
retyp = substr(class,2)
if (index(ltype,'long') gt 0) retyp = 'long'
if (retyp ne 'long' and index(ltype,'int') gt 0) retyp = 'int'
putend, friend &(retyp) operator&(opr) (&(ltype), &(class));
putend, friend &(ltype)* operator&(opr) (&(ltype)*, &(class));
end
proc sub4 (class,ltype,opr) begin
putend, friend &(ltype)& operator&(opr)= (&(ltype)&, &(class));
end
proc sub7 (class,ltype,opr) begin
putend, friend int operator&(opr) (&(ltype), &(class));
putend, friend int operator&(opr) (&(ltype)*, &(class));
end