void gencfile (str fname) { aout << "// -*-c++-*-\n" << "/* This file was automatically generated by rpcc. */\n\n" << "#include \"" << makehdrname (fname) << "\"\n\n"; #if 0 for (const rpc_sym *s = symlist.base (); s < symlist.lim (); s++) if (s->type == rpc_sym::PROGRAM) for (const rpc_vers *rv = s->sprogram->vers.base (); rv < s->sprogram->vers.lim (); rv++) for (const rpc_proc *rp = rv->procs.base (); rp < rv->procs.lim (); rp++) { needtype.insert (rp->arg); needtype.insert (rp->res); } #endif aout << "#ifdef MAINTAINER\n\n"; for (const rpc_sym *s = symlist.base (); s < symlist.lim (); s++) dumpprint (s); aout << "#endif /* MAINTAINER*/\n"; for (const rpc_sym *s = symlist.base (); s < symlist.lim (); s++) dumpsym (s); aout << "\n"; }
int dumpprint(ProxyStream& os, __int64 x) { char Text[100]; _ltoa_s(int(x),Text,10); dumpprint(os, Text); return (int)::strlen(Text); };
void dumpprint(ProxyStream& os, __int64 x, int Scale, const char*xText) { char Text[100]; _ltoa_s(int(x),Text + 1,99,10); int Dot = 1; for(Dot=1; Text[Dot]; Dot++); Dot -= Scale; Dot--; for(int i=0; i < Dot; i++) Text[i] = Text[i+1]; if(Scale > 0) Text[Dot] = '.'; else Text[Dot] = 0; dumpprint(os,Text); dumpprint(os,xText); };
void dumpprinttime(ProxyStream& os, __int64 x, __int64 q) { double xx = double(x)/(double(TicksPerSecond())*double(q)*3600.0); if(xx > 10.0) { dumpprint(os,int(xx),0,"h"); return; }; if(xx >= 1.0) { int h = int(xx); dumpprint(os,h); dumpprint(os,":"); xx-=h; xx*=60; int m = int(xx); if(m<10) dumpprint(os,"0"); dumpprint(os,m); return; }; xx*=60; if(xx >= 1.0) { dumpprint(os,":"); int m = int(xx); if(m<10) dumpprint(os,"0"); dumpprint(os,m); dumpprint(os,":"); xx-=m; xx*=60; int s = int(xx); if(s<10) dumpprint(os,"0"); dumpprint(os,s); return; }; xx*=600; char* Unit[6] = {"s","ms","µs","ns","ps","fs"}; for(int i=1;i<18;i++) { if(xx >= 100.0) { dumpprint(os,int(xx),i%3,Unit[i/3]); return; }; xx*=10; }; dumpprint(os,"0"); };