/***** Autogenerated from runtime.in; changes will be overwritten *****/ #line 1 "./runtimebase.in" /***** * runtimebase.in * Andy Hammerlindl 2009/07/28 * * Common declarations needed for all code-generating .in files. * *****/ #line 1 "./runtime.in" /***** * runtime.in * Tom Prince 2005/4/15 * * Generate the runtime functions used by the vm::stack machine. * *****/ /* Autogenerated routines are specified like this (separated by a formfeed): type asyname:cname(cparams) { C code } */ // Use Void f() instead of void f() to force an explicit Stack argument. #line 1 "./runtimebase.in" #include "stack.h" #include "types.h" #include "builtin.h" #include "entry.h" #include "errormsg.h" #include "array.h" #include "triple.h" #include "callable.h" #include "opsymbols.h" using vm::stack; using vm::error; using vm::array; using vm::read; using vm::callable; using types::formal; using types::function; using camp::triple; #define PRIMITIVE(name,Name,asyName) using types::prim##Name; #include #undef PRIMITIVE void unused(void *); namespace run { typedef double real; array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); double *copyTripleArray2Components(array *a, size_t &N, GCPlacement placement=NoGC); triple *copyTripleArray2C(array *a, size_t &N, GCPlacement placement=NoGC); } function *realRealFunction(); #define CURRENTPEN processData().currentpen #line 52 "runtime.in" #include #include #include #include #include #include #if !defined(_WIN32) #include #endif #include #include "angle.h" #include "pair.h" #include "triple.h" #include "transform.h" #include "path.h" #include "path3.h" #include "pen.h" #include "drawpath.h" #include "guide.h" #include "picture.h" #include "fileio.h" #include "genv.h" #include "builtin.h" #include "texfile.h" #include "pipestream.h" #include "asyparser.h" #include "stack.h" #include "util.h" #include "locate.h" #include "mathop.h" #include "callable.h" #include "stm.h" #include "lexical.h" #include "asyprocess.h" #include "arrayop.h" #include "seconds.h" #if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE) extern "C" { void *GC_generate_random_valid_address(void); void GC_debug_print_heap_obj_proc(void *); } #endif using namespace vm; using namespace camp; using namespace settings; using namespace utils; #undef OUT #undef IN namespace run { using camp::pair; using vm::array; using vm::vmFrame; using vm::stack; using camp::transform; using absyntax::runnable; typedef array boolarray; typedef array Intarray; typedef array Intarray2; typedef array realarray; typedef array realarray2; typedef array pairarray; typedef array pairarray2; typedef array triplearray; typedef array triplearray2; typedef array patharray; typedef array patharray2; typedef array guidearray; typedef array transformarray; typedef array penarray; typedef array penarray2; typedef array stringarray; typedef array stringarray2; } using vm::array; using types::function; #define PRIMITIVE(name,Name,asyName) using types::prim##Name; #include #undef PRIMITIVE using types::booleanArray; using types::IntArray; using types::IntArray2; using types::realArray; using types::realArray2; using types::pairArray; using types::pairArray2; using types::tripleArray; using types::tripleArray2; using types::pathArray; using types::pathArray2; using types::guideArray; using types::transformArray; using types::penArray; using types::penArray2; using types::stringArray; using types::stringArray2; using types::formal; function *realRealFunction() { return new function(primReal(),primReal()); } function *realTripleFunction() { return new function(primReal(),primTriple()); } const size_t camp::ColorComponents[]={0,0,1,3,4,0}; namespace vm { #if COMPACT const Int DefaultValue=0x7fffffffffffffffLL; const Int Undefined=0x7ffffffffffffffeLL; const Int BoolTruthValue=0xABABABABABABABACLL; const Int BoolFalseValue=0xABABABABABABABABLL; const item Default=DefaultValue; #else const item Default=item(default_t()); #endif } namespace run { stopWatch wallClock; cpuTimer cpuTime; const char *arrayempty="cannot take min or max of empty array"; const char *noruntime="no runtime environment for embedded eval"; void writestring(stack *s) { callable *suffix=pop(s,NULL); string S=pop(s); vm::item it=pop(s); bool defaultfile=isdefault(it); camp::file *f=defaultfile ? &camp::Stdout : vm::get(it); if(!f->isOpen() || !f->enabled()) return; if(S != "") f->write(S); if(f->text()) { if(suffix) { s->push(f); suffix->call(s); } else if(defaultfile) f->writeline(); } } string toplocation() { ostringstream buf; position& topPos=processData().topPos; buf << topPos.Line() << "." << topPos.Column(); return buf.str(); } string emptystring; pair zero; } static string defaulttransparency=string("Compatible"); void unused(void *) { } // Autogenerated routines: #ifndef NOSYM #include "runtime.symbols.h" #endif namespace run { // Initializers #line 235 "./runtime.in" void IntZero(stack *Stack) { #line 236 "./runtime.in" {Stack->push(0); return;} } #line 241 "./runtime.in" void realZero(stack *Stack) { #line 242 "./runtime.in" {Stack->push(0.0); return;} } #line 246 "./runtime.in" void boolFalse(stack *Stack) { #line 247 "./runtime.in" {Stack->push(false); return;} } #line 251 "./runtime.in" // bool isnan(real x); void gen_runtime3(stack *Stack) { real x=vm::pop(Stack); #line 252 "./runtime.in" {Stack->push(std::isnan(x)); return;} } #line 256 "./runtime.in" void pushNullArray(stack *Stack) { #line 257 "./runtime.in" {Stack->push(0); return;} } #line 261 "./runtime.in" void pushNullRecord(stack *Stack) { #line 262 "./runtime.in" {Stack->push(0); return;} } #line 266 "./runtime.in" void pushNullFunction(stack *Stack) { #line 267 "./runtime.in" {Stack->push(nullfunc::instance()); return;} } // Default operations // Put the default value token on the stack (in place of an argument when // making a function call). #line 276 "./runtime.in" void pushDefault(stack *Stack) { #line 277 "./runtime.in" {Stack->push(Default); return;} } // Test if the value on the stack is the default value token. #line 283 "./runtime.in" void isDefault(stack *Stack) { item i=vm::pop(Stack); #line 284 "./runtime.in" {Stack->push(isdefault(i)); return;} } // Casts #line 290 "./runtime.in" void pairToGuide(stack *Stack) { pair z=vm::pop(Stack); #line 291 "./runtime.in" {Stack->push(new pairguide(z)); return;} } #line 296 "./runtime.in" void pathToGuide(stack *Stack) { path p=vm::pop(Stack); #line 297 "./runtime.in" {Stack->push(new pathguide(p)); return;} } #line 301 "./runtime.in" void guideToPath(stack *Stack) { guide * g=vm::pop(Stack); #line 302 "./runtime.in" {Stack->push(g->solve()); return;} } // Pen operations #line 308 "./runtime.in" void newPen(stack *Stack) { #line 309 "./runtime.in" {Stack->push(pen()); return;} } #line 314 "./runtime.in" // bool ==(pen a, pen b); void gen_runtime13(stack *Stack) { pen b=vm::pop(Stack); pen a=vm::pop(Stack); #line 315 "./runtime.in" {Stack->push(a == b); return;} } #line 319 "./runtime.in" // bool !=(pen a, pen b); void gen_runtime14(stack *Stack) { pen b=vm::pop(Stack); pen a=vm::pop(Stack); #line 320 "./runtime.in" {Stack->push(a != b); return;} } #line 324 "./runtime.in" // pen +(pen a, pen b); void gen_runtime15(stack *Stack) { pen b=vm::pop(Stack); pen a=vm::pop(Stack); #line 325 "./runtime.in" {Stack->push(a+b); return;} } #line 329 "./runtime.in" // pen *(real a, pen b); void gen_runtime16(stack *Stack) { pen b=vm::pop(Stack); real a=vm::pop(Stack); #line 330 "./runtime.in" {Stack->push(a*b); return;} } #line 334 "./runtime.in" // pen *(pen a, real b); void gen_runtime17(stack *Stack) { real b=vm::pop(Stack); pen a=vm::pop(Stack); #line 335 "./runtime.in" {Stack->push(b*a); return;} } #line 339 "./runtime.in" // pair max(pen p); void gen_runtime18(stack *Stack) { pen p=vm::pop(Stack); #line 340 "./runtime.in" {Stack->push(p.bounds().Max()); return;} } #line 344 "./runtime.in" // pair min(pen p); void gen_runtime19(stack *Stack) { pen p=vm::pop(Stack); #line 345 "./runtime.in" {Stack->push(p.bounds().Min()); return;} } // Reset the meaning of pen default attributes. #line 350 "./runtime.in" // void resetdefaultpen(); void gen_runtime20(stack *) { #line 351 "./runtime.in" processData().defaultpen=camp::pen::initialpen(); } #line 355 "./runtime.in" // void defaultpen(pen p); void gen_runtime21(stack *Stack) { pen p=vm::pop(Stack); #line 356 "./runtime.in" processData().defaultpen=pen(resolvepen,p); } #line 360 "./runtime.in" // pen defaultpen(); void gen_runtime22(stack *Stack) { #line 361 "./runtime.in" {Stack->push(processData().defaultpen); return;} } #line 365 "./runtime.in" // bool invisible(pen p); void gen_runtime23(stack *Stack) { pen p=vm::pop(Stack); #line 366 "./runtime.in" {Stack->push(p.invisible()); return;} } #line 370 "./runtime.in" // pen invisible(); void gen_runtime24(stack *Stack) { #line 371 "./runtime.in" {Stack->push(pen(invisiblepen)); return;} } #line 375 "./runtime.in" // pen gray(pen p); void gen_runtime25(stack *Stack) { pen p=vm::pop(Stack); #line 376 "./runtime.in" p.togrey(); {Stack->push(p); return;} } #line 381 "./runtime.in" // pen rgb(pen p); void gen_runtime26(stack *Stack) { pen p=vm::pop(Stack); #line 382 "./runtime.in" p.torgb(); {Stack->push(p); return;} } #line 387 "./runtime.in" // pen cmyk(pen p); void gen_runtime27(stack *Stack) { pen p=vm::pop(Stack); #line 388 "./runtime.in" p.tocmyk(); {Stack->push(p); return;} } #line 393 "./runtime.in" // pen interp(pen a, pen b, real t); void gen_runtime28(stack *Stack) { real t=vm::pop(Stack); pen b=vm::pop(Stack); pen a=vm::pop(Stack); #line 394 "./runtime.in" {Stack->push(interpolate(a,b,t)); return;} } #line 398 "./runtime.in" // pen rgb(real r, real g, real b); void gen_runtime29(stack *Stack) { real b=vm::pop(Stack); real g=vm::pop(Stack); real r=vm::pop(Stack); #line 399 "./runtime.in" {Stack->push(pen(r,g,b)); return;} } #line 403 "./runtime.in" // pen cmyk(real c, real m, real y, real k); void gen_runtime30(stack *Stack) { real k=vm::pop(Stack); real y=vm::pop(Stack); real m=vm::pop(Stack); real c=vm::pop(Stack); #line 404 "./runtime.in" {Stack->push(pen(c,m,y,k)); return;} } #line 408 "./runtime.in" // pen gray(real gray); void gen_runtime31(stack *Stack) { real gray=vm::pop(Stack); #line 409 "./runtime.in" {Stack->push(pen(gray)); return;} } #line 413 "./runtime.in" // realarray* colors(pen p); void gen_runtime32(stack *Stack) { pen p=vm::pop(Stack); #line 414 "./runtime.in" size_t n=ColorComponents[p.colorspace()]; array *a=new array(n); switch(n) { case 0: break; case 1: (*a)[0]=p.gray(); break; case 3: (*a)[0]=p.red(); (*a)[1]=p.green(); (*a)[2]=p.blue(); break; case 4: (*a)[0]=p.cyan(); (*a)[1]=p.magenta(); (*a)[2]=p.yellow(); (*a)[3]=p.black(); break; default: break; } {Stack->push(a); return;} } #line 441 "./runtime.in" // string hex(pen p); void gen_runtime33(stack *Stack) { pen p=vm::pop(Stack); #line 442 "./runtime.in" {Stack->push(p.hex()); return;} } #line 446 "./runtime.in" // Int byte(real x); void gen_runtime34(stack *Stack) { real x=vm::pop(Stack); #line 447 "./runtime.in" {Stack->push(camp::byte(x)); return;} } #line 451 "./runtime.in" // real byteinv(Int x); void gen_runtime35(stack *Stack) { Int x=vm::pop(Stack); #line 452 "./runtime.in" {Stack->push(x >= 0 ? camp::byteinv(x) : 0.0); return;} } #line 456 "./runtime.in" // string colorspace(pen p); void gen_runtime36(stack *Stack) { pen p=vm::pop(Stack); #line 457 "./runtime.in" string s=ColorDeviceSuffix[p.colorspace()]; std::transform(s.begin(),s.end(),s.begin(),tolower); {Stack->push(s); return;} } #line 463 "./runtime.in" // pen pattern(string *s); void gen_runtime37(stack *Stack) { string * s=vm::pop(Stack); #line 464 "./runtime.in" {Stack->push(pen(setpattern,*s)); return;} } #line 468 "./runtime.in" // string pattern(pen p); void gen_runtime38(stack *Stack) { pen p=vm::pop(Stack); #line 469 "./runtime.in" {Stack->push(p.fillpattern()); return;} } #line 473 "./runtime.in" // pen fillrule(Int n); void gen_runtime39(stack *Stack) { Int n=vm::pop(Stack); #line 474 "./runtime.in" {Stack->push(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;} } #line 478 "./runtime.in" // Int fillrule(pen p); void gen_runtime40(stack *Stack) { pen p=vm::pop(Stack); #line 479 "./runtime.in" {Stack->push(p.Fillrule()); return;} } #line 483 "./runtime.in" // pen opacity(real opacity=1.0, string blend=defaulttransparency); void gen_runtime41(stack *Stack) { string blend=vm::pop(Stack,defaulttransparency); real opacity=vm::pop(Stack,1.0); #line 484 "./runtime.in" for(Int i=0; i < nBlendMode; ++i) if(blend == BlendMode[i]) {Stack->push(pen(Transparency(blend,opacity))); return;} ostringstream buf; buf << "Unknown blend mode: " << "'" << blend << "'"; error(buf); } #line 493 "./runtime.in" // real opacity(pen p); void gen_runtime42(stack *Stack) { pen p=vm::pop(Stack); #line 494 "./runtime.in" {Stack->push(p.opacity()); return;} } #line 498 "./runtime.in" // string blend(pen p); void gen_runtime43(stack *Stack) { pen p=vm::pop(Stack); #line 499 "./runtime.in" {Stack->push(p.blend()); return;} } #line 503 "./runtime.in" // pen linetype(realarray *pattern, real offset=0, bool scale=true, bool adjust=true); void gen_runtime44(stack *Stack) { bool adjust=vm::pop(Stack,true); bool scale=vm::pop(Stack,true); real offset=vm::pop(Stack,0); realarray * pattern=vm::pop(Stack); #line 505 "./runtime.in" size_t size=checkArray(pattern); array *a=new array(size); for(size_t i=0; i < size; ++i) (*a)[i]=::max(vm::read(pattern,i),0.0); {Stack->push(pen(LineType(*a,offset,scale,adjust))); return;} } #line 514 "./runtime.in" // realarray* linetype(pen p=CURRENTPEN); void gen_runtime45(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 515 "./runtime.in" array a=p.linetype()->pattern; {Stack->push(copyArray(&a)); return;} } #line 520 "./runtime.in" // real offset(pen p); void gen_runtime46(stack *Stack) { pen p=vm::pop(Stack); #line 521 "./runtime.in" {Stack->push(p.linetype()->offset); return;} } #line 525 "./runtime.in" // bool scale(pen p); void gen_runtime47(stack *Stack) { pen p=vm::pop(Stack); #line 526 "./runtime.in" {Stack->push(p.linetype()->scale); return;} } #line 530 "./runtime.in" // bool adjust(pen p); void gen_runtime48(stack *Stack) { pen p=vm::pop(Stack); #line 531 "./runtime.in" {Stack->push(p.linetype()->adjust); return;} } #line 535 "./runtime.in" // pen adjust(pen p, real arclength, bool cyclic); void gen_runtime49(stack *Stack) { bool cyclic=vm::pop(Stack); real arclength=vm::pop(Stack); pen p=vm::pop(Stack); #line 536 "./runtime.in" {Stack->push(adjustdash(p,arclength,cyclic)); return;} } #line 540 "./runtime.in" // pen linecap(Int n); void gen_runtime50(stack *Stack) { Int n=vm::pop(Stack); #line 541 "./runtime.in" {Stack->push(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;} } #line 545 "./runtime.in" // Int linecap(pen p=CURRENTPEN); void gen_runtime51(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 546 "./runtime.in" {Stack->push(p.cap()); return;} } #line 550 "./runtime.in" // pen linejoin(Int n); void gen_runtime52(stack *Stack) { Int n=vm::pop(Stack); #line 551 "./runtime.in" {Stack->push(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;} } #line 555 "./runtime.in" // Int linejoin(pen p=CURRENTPEN); void gen_runtime53(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 556 "./runtime.in" {Stack->push(p.join()); return;} } #line 560 "./runtime.in" // pen miterlimit(real x); void gen_runtime54(stack *Stack) { real x=vm::pop(Stack); #line 561 "./runtime.in" {Stack->push(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;} } #line 565 "./runtime.in" // real miterlimit(pen p=CURRENTPEN); void gen_runtime55(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 566 "./runtime.in" {Stack->push(p.miter()); return;} } #line 570 "./runtime.in" // pen linewidth(real x); void gen_runtime56(stack *Stack) { real x=vm::pop(Stack); #line 571 "./runtime.in" {Stack->push(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;} } #line 575 "./runtime.in" // real linewidth(pen p=CURRENTPEN); void gen_runtime57(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 576 "./runtime.in" {Stack->push(p.width()); return;} } #line 580 "./runtime.in" // pen fontcommand(string *s); void gen_runtime58(stack *Stack) { string * s=vm::pop(Stack); #line 581 "./runtime.in" {Stack->push(pen(setfont,*s)); return;} } #line 585 "./runtime.in" // string font(pen p=CURRENTPEN); void gen_runtime59(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 586 "./runtime.in" {Stack->push(p.Font()); return;} } #line 590 "./runtime.in" // pen fontsize(real size, real lineskip); void gen_runtime60(stack *Stack) { real lineskip=vm::pop(Stack); real size=vm::pop(Stack); #line 591 "./runtime.in" {Stack->push(pen(setfontsize,size > 0.0 ? size : 0.0, lineskip > 0.0 ? lineskip : 0.0)); return;} } #line 596 "./runtime.in" // real fontsize(pen p=CURRENTPEN); void gen_runtime61(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 597 "./runtime.in" {Stack->push(p.size()); return;} } #line 601 "./runtime.in" // real lineskip(pen p=CURRENTPEN); void gen_runtime62(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 602 "./runtime.in" {Stack->push(p.Lineskip()); return;} } #line 606 "./runtime.in" // pen overwrite(Int n); void gen_runtime63(stack *Stack) { Int n=vm::pop(Stack); #line 607 "./runtime.in" {Stack->push(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n : DEFWRITE)); return;} } #line 612 "./runtime.in" // Int overwrite(pen p=CURRENTPEN); void gen_runtime64(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 613 "./runtime.in" {Stack->push(p.Overwrite()); return;} } #line 617 "./runtime.in" // pen basealign(Int n); void gen_runtime65(stack *Stack) { Int n=vm::pop(Stack); #line 618 "./runtime.in" {Stack->push(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;} } #line 622 "./runtime.in" // Int basealign(pen p=CURRENTPEN); void gen_runtime66(stack *Stack) { pen p=vm::pop(Stack,CURRENTPEN); #line 623 "./runtime.in" {Stack->push(p.Baseline()); return;} } #line 627 "./runtime.in" // transform transform(pen p); void gen_runtime67(stack *Stack) { pen p=vm::pop(Stack); #line 628 "./runtime.in" {Stack->push(p.getTransform()); return;} } #line 632 "./runtime.in" // path nib(pen p); void gen_runtime68(stack *Stack) { pen p=vm::pop(Stack); #line 633 "./runtime.in" {Stack->push(p.Path()); return;} } #line 637 "./runtime.in" // pen makepen(path p); void gen_runtime69(stack *Stack) { path p=vm::pop(Stack); #line 638 "./runtime.in" {Stack->push(pen(p)); return;} } #line 642 "./runtime.in" // pen colorless(pen p); void gen_runtime70(stack *Stack) { pen p=vm::pop(Stack); #line 643 "./runtime.in" p.colorless(); {Stack->push(p); return;} } // Interactive mode #line 649 "./runtime.in" // bool interactive(); void gen_runtime71(stack *Stack) { #line 650 "./runtime.in" {Stack->push(interact::interactive); return;} } #line 655 "./runtime.in" // bool uptodate(); void gen_runtime72(stack *Stack) { #line 656 "./runtime.in" {Stack->push(interact::uptodate); return;} } // System commands #line 662 "./runtime.in" // Int system(stringarray *s); void gen_runtime73(stack *Stack) { stringarray * s=vm::pop(Stack); #line 663 "./runtime.in" if(safe) error("system() call disabled; override with option -nosafe"); size_t size=checkArray(s); if(size == 0) {Stack->push(0); return;} mem::vector cmd; for(size_t i=0; i < size; ++i) cmd.push_back(read(s,i)); {Stack->push(System(cmd)); return;} } #line 674 "./runtime.in" // bool view(); void gen_runtime74(stack *Stack) { #line 675 "./runtime.in" {Stack->push(view()); return;} } #line 679 "./runtime.in" // string asydir(); void gen_runtime75(stack *Stack) { #line 680 "./runtime.in" {Stack->push(systemDir); return;} } #line 684 "./runtime.in" // string locale(string s=emptystring); void gen_runtime76(stack *Stack) { string s=vm::pop(Stack,emptystring); #line 685 "./runtime.in" char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str()); {Stack->push(L != NULL ? string(L) : ""); return;} } #line 690 "./runtime.in" // void abort(string s=emptystring); void gen_runtime77(stack *Stack) { string s=vm::pop(Stack,emptystring); #line 691 "./runtime.in" if(s.empty()) throw handled_error(); error(s.c_str()); } #line 696 "./runtime.in" // void exit(); void gen_runtime78(stack *) { #line 697 "./runtime.in" throw quit(); } #line 701 "./runtime.in" // void assert(bool b, string s=emptystring); void gen_runtime79(stack *Stack) { string s=vm::pop(Stack,emptystring); bool b=vm::pop(Stack); #line 702 "./runtime.in" flush(cout); if(!b) { ostringstream buf; buf << "assert FAILED"; if(s != "") buf << ": " << s; error(buf); } } #line 712 "./runtime.in" // void sleep(Int seconds); void gen_runtime80(stack *Stack) { Int seconds=vm::pop(Stack); #line 713 "./runtime.in" if(seconds <= 0) return; std::this_thread::sleep_for(std::chrono::seconds(seconds)); } #line 718 "./runtime.in" // void usleep(Int microseconds); void gen_runtime81(stack *Stack) { Int microseconds=vm::pop(Stack); #line 719 "./runtime.in" if(microseconds <= 0) return; std::this_thread::sleep_for(std::chrono::microseconds(microseconds)); } #line 724 "./runtime.in" // void _eval(string *s, bool embedded, bool interactiveWrite=false); void gen_runtime82(stack *Stack) { bool interactiveWrite=vm::pop(Stack,false); bool embedded=vm::pop(Stack); string * s=vm::pop(Stack); #line 725 "./runtime.in" if(embedded) { trans::coenv *e=Stack->getEnvironment(); vm::interactiveStack *is=dynamic_cast(Stack); if(e && is) runStringEmbedded(*s, *e, *is); else error(noruntime); } else runString(*s,interactiveWrite); } #line 737 "./runtime.in" // void _eval(runnable *s, bool embedded); void gen_runtime83(stack *Stack) { bool embedded=vm::pop(Stack); runnable * s=vm::pop(Stack); #line 738 "./runtime.in" absyntax::block *ast=new absyntax::block(s->getPos(), false); ast->add(s); if(embedded) { trans::coenv *e=Stack->getEnvironment(); vm::interactiveStack *is=dynamic_cast(Stack); if(e && is) runCodeEmbedded(ast, *e, *is); else error(noruntime); } else runCode(ast); } #line 753 "./runtime.in" // string xasyKEY(); void gen_runtime84(stack *Stack) { #line 754 "./runtime.in" processDataStruct& P=processData(); xkey_t& xkey=P.xkey; xkey_t::iterator p=xkey.find(P.topPos.LineColumn()); {Stack->push(p != xkey.end() ? p->second+" 1" : toplocation()+" 0"); return;} } #line 760 "./runtime.in" // void xasyKEY(string *s); void gen_runtime85(stack *Stack) { string * s=vm::pop(Stack); #line 761 "./runtime.in" processData().KEY=*s; } #line 764 "./runtime.in" // string location(); void gen_runtime86(stack *Stack) { #line 765 "./runtime.in" ostringstream buf; buf << getPos(); {Stack->push(buf.str()); return;} } // Wrapper for the stack::load() method. #line 771 "./runtime.in" void loadModule(stack *Stack) { string * index=vm::pop(Stack); #line 772 "./runtime.in" Stack->load(*index); } #line 776 "./runtime.in" // string cd(string s=emptystring); void gen_runtime88(stack *Stack) { string s=vm::pop(Stack,emptystring); #line 777 "./runtime.in" if(!globalread()) readDisabled(); if(!s.empty() && !globalwrite()) { string outname=settings::outname(); string dir=stripFile(outname); if(dir.empty()) Setting("outname")=getPath()+dirsep+outname; } {Stack->push(setPath(s.c_str())); return;} } #line 787 "./runtime.in" // void list(string *s, bool imports=false); void gen_runtime89(stack *Stack) { bool imports=vm::pop(Stack,false); string * s=vm::pop(Stack); #line 788 "./runtime.in" if(*s == "-") return; trans::genv ge; symbol name=symbol::trans(*s); record *r=ge.getModule(name,*s); r->e.list(imports ? 0 : r); } // Guide operations #line 798 "./runtime.in" void nullGuide(stack *Stack) { #line 799 "./runtime.in" {Stack->push(new pathguide(path())); return;} } #line 804 "./runtime.in" void dotsGuide(stack *Stack) { guidearray * a=vm::pop(Stack); #line 805 "./runtime.in" guidevector v; size_t size=checkArray(a); for (size_t i=0; i < size; ++i) v.push_back(a->read(i)); {Stack->push(new multiguide(v)); return;} } #line 814 "./runtime.in" void dashesGuide(stack *Stack) { guidearray * a=vm::pop(Stack); #line 815 "./runtime.in" static camp::curlSpec curly; static camp::specguide curlout(&curly, camp::OUT); static camp::specguide curlin(&curly, camp::IN); size_t n=checkArray(a); // a--b is equivalent to a{curl 1}..{curl 1}b guidevector v; if (n > 0) v.push_back(a->read(0)); if (n==1) { v.push_back(&curlout); v.push_back(&curlin); } else for (size_t i=1; iread(i)); } {Stack->push(new multiguide(v)); return;} } #line 841 "./runtime.in" void newCycleToken(stack *Stack) { #line 842 "./runtime.in" {Stack->push(cycleToken()); return;} } #line 846 "./runtime.in" // guide* operator cast(cycleToken tok); void gen_runtime94(stack *Stack) { cycleToken tok=vm::pop(Stack); #line 847 "./runtime.in" // Avoid unused variable warning messages. unused(&tok); {Stack->push(new cycletokguide()); return;} } #line 853 "./runtime.in" // guide* operator spec(pair z, Int p); void gen_runtime95(stack *Stack) { Int p=vm::pop(Stack); pair z=vm::pop(Stack); #line 854 "./runtime.in" camp::side d=(camp::side) p; camp::dirSpec *sp=new camp::dirSpec(z); {Stack->push(new specguide(sp,d)); return;} } #line 861 "./runtime.in" // curlSpecifier operator curl(real gamma, Int p); void gen_runtime96(stack *Stack) { Int p=vm::pop(Stack); real gamma=vm::pop(Stack); #line 862 "./runtime.in" camp::side s=(camp::side) p; {Stack->push(curlSpecifier(gamma,s)); return;} } #line 867 "./runtime.in" void curlSpecifierValuePart(stack *Stack) { curlSpecifier spec=vm::pop(Stack); #line 868 "./runtime.in" {Stack->push(spec.getValue()); return;} } #line 872 "./runtime.in" void curlSpecifierSidePart(stack *Stack) { curlSpecifier spec=vm::pop(Stack); #line 873 "./runtime.in" {Stack->push(spec.getSide()); return;} } #line 877 "./runtime.in" // guide* operator cast(curlSpecifier spec); void gen_runtime99(stack *Stack) { curlSpecifier spec=vm::pop(Stack); #line 878 "./runtime.in" {Stack->push(new specguide(spec)); return;} } #line 882 "./runtime.in" // tensionSpecifier operator tension(real tout, real tin, bool atleast); void gen_runtime100(stack *Stack) { bool atleast=vm::pop(Stack); real tin=vm::pop(Stack); real tout=vm::pop(Stack); #line 883 "./runtime.in" {Stack->push(tensionSpecifier(tout, tin, atleast)); return;} } #line 887 "./runtime.in" void tensionSpecifierOutPart(stack *Stack) { tensionSpecifier t=vm::pop(Stack); #line 888 "./runtime.in" {Stack->push(t.getOut()); return;} } #line 892 "./runtime.in" void tensionSpecifierInPart(stack *Stack) { tensionSpecifier t=vm::pop(Stack); #line 893 "./runtime.in" {Stack->push(t.getIn()); return;} } #line 897 "./runtime.in" void tensionSpecifierAtleastPart(stack *Stack) { tensionSpecifier t=vm::pop(Stack); #line 898 "./runtime.in" {Stack->push(t.getAtleast()); return;} } #line 902 "./runtime.in" // guide* operator cast(tensionSpecifier t); void gen_runtime104(stack *Stack) { tensionSpecifier t=vm::pop(Stack); #line 903 "./runtime.in" {Stack->push(new tensionguide(t)); return;} } #line 907 "./runtime.in" // guide* operator controls(pair zout, pair zin); void gen_runtime105(stack *Stack) { pair zin=vm::pop(Stack); pair zout=vm::pop(Stack); #line 908 "./runtime.in" {Stack->push(new controlguide(zout, zin)); return;} } #line 912 "./runtime.in" // Int size(guide *g); void gen_runtime106(stack *Stack) { guide * g=vm::pop(Stack); #line 913 "./runtime.in" flatguide f; g->flatten(f,false); {Stack->push(f.size()); return;} } #line 919 "./runtime.in" // Int length(guide *g); void gen_runtime107(stack *Stack) { guide * g=vm::pop(Stack); #line 920 "./runtime.in" flatguide f; g->flatten(f,false); {Stack->push(g->cyclic() ? f.size() : f.size()-1); return;} } #line 926 "./runtime.in" // bool cyclic(guide *g); void gen_runtime108(stack *Stack) { guide * g=vm::pop(Stack); #line 927 "./runtime.in" flatguide f; g->flatten(f,false); {Stack->push(g->cyclic()); return;} } #line 933 "./runtime.in" // pair point(guide *g, Int t); void gen_runtime109(stack *Stack) { Int t=vm::pop(Stack); guide * g=vm::pop(Stack); #line 934 "./runtime.in" flatguide f; g->flatten(f,false); {Stack->push(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;} } #line 940 "./runtime.in" // pairarray* dirSpecifier(guide *g, Int t); void gen_runtime110(stack *Stack) { Int t=vm::pop(Stack); guide * g=vm::pop(Stack); #line 941 "./runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); if(!g->cyclic() && (t < 0 || t >= n-1)) {Stack->push(new array(0)); return;} array *c=new array(2); (*c)[0]=f.Nodes(t).out->dir(); (*c)[1]=f.Nodes(t+1).in->dir(); {Stack->push(c); return;} } #line 952 "./runtime.in" // pairarray* controlSpecifier(guide *g, Int t); void gen_runtime111(stack *Stack) { Int t=vm::pop(Stack); guide * g=vm::pop(Stack); #line 953 "./runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); if(!g->cyclic() && (t < 0 || t >= n-1)) {Stack->push(new array(0)); return;} knot curr=f.Nodes(t); knot next=f.Nodes(t+1); if(curr.out->controlled()) { assert(next.in->controlled()); array *c=new array(2); (*c)[0]=curr.out->control(); (*c)[1]=next.in->control(); {Stack->push(c); return;} } else {Stack->push(new array(0)); return;} } #line 969 "./runtime.in" // tensionSpecifier tensionSpecifier(guide *g, Int t); void gen_runtime112(stack *Stack) { Int t=vm::pop(Stack); guide * g=vm::pop(Stack); #line 970 "./runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); if(!g->cyclic() && (t < 0 || t >= n-1)) {Stack->push(tensionSpecifier(1.0,1.0,false)); return;} knot curr=f.Nodes(t); {Stack->push(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;} } #line 979 "./runtime.in" // realarray* curlSpecifier(guide *g, Int t); void gen_runtime113(stack *Stack) { Int t=vm::pop(Stack); guide * g=vm::pop(Stack); #line 980 "./runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); if(!g->cyclic() && (t < 0 || t >= n-1)) {Stack->push(new array(0)); return;} array *c=new array(2); real c0=f.Nodes(t).out->curl(); real c1=f.Nodes(t+1).in->curl(); (*c)[0]=c0 >= 0.0 ? c0 : 1.0; (*c)[1]=c1 >= 0.0 ? c1 : 1.0; {Stack->push(c); return;} } #line 993 "./runtime.in" // guide* reverse(guide *g); void gen_runtime114(stack *Stack) { guide * g=vm::pop(Stack); #line 994 "./runtime.in" flatguide f; g->flatten(f,false); if(f.precyclic()) {Stack->push(new pathguide(g->solve().reverse())); return;} size_t n=f.size(); bool cyclic=g->cyclic(); guidevector v; size_t start=cyclic ? n : n-1; knot curr=f.Nodes(start); knot next=curr; for(size_t i=start; i > 0; --i) { next=f.Nodes(i-1); v.push_back(new pairguide(curr.z)); if(next.out->controlled()) { assert(curr.in->controlled()); v.push_back(new controlguide(curr.in->control(),next.out->control())); } else { pair d=curr.in->dir(); if(d != zero) v.push_back(new specguide(new dirSpec(-d),camp::OUT)); else { real C=curr.in->curl(); if(C >= 0.0) v.push_back(new specguide(new curlSpec(C),camp::OUT)); } real tout=curr.tin.val; real tin=next.tout.val; bool atleast=next.tout.atleast; if(tout != 1.0 || tin != 1.0 || next.tout.atleast) v.push_back(new tensionguide(tensionSpecifier(tout,tin,atleast))); d=next.out->dir(); if(d != zero) v.push_back(new specguide(new dirSpec(-d),camp::IN)); else { real C=next.out->curl(); if(C >= 0.0) v.push_back(new specguide(new curlSpec(C),camp::IN)); } } curr=next; } if(cyclic) v.push_back(new cycletokguide()); else v.push_back(new pairguide(next.z)); {Stack->push(new multiguide(v)); return;} } #line 1046 "./runtime.in" // realarray* _cputime(); void gen_runtime115(stack *Stack) { #line 1047 "./runtime.in" #if !defined(_WIN32) static const real ticktime=1.0/sysconf(_SC_CLK_TCK); struct tms buf; ::times(&buf); real realCutime=((real)buf.tms_cutime)*ticktime; real realCstime=((real)buf.tms_cstime)*ticktime; #else // FIXME: See if there's a way to get cutime/cstime on windows, // if it's possible. real realCutime=0.0; real realCstime=0.0; #endif array *t=new array(5); (*t)[0]=cpuTime.seconds(); // Includes system time (*t)[1]=0.0; (*t)[2]=realCutime; (*t)[3]=realCstime; (*t)[4]=wallClock.seconds(); {Stack->push(t); return;} } // Transforms #line 1073 "./runtime.in" // bool ==(transform a, transform b); void gen_runtime116(stack *Stack) { transform b=vm::pop(Stack); transform a=vm::pop(Stack); #line 1074 "./runtime.in" {Stack->push(a == b); return;} } #line 1079 "./runtime.in" // bool !=(transform a, transform b); void gen_runtime117(stack *Stack) { transform b=vm::pop(Stack); transform a=vm::pop(Stack); #line 1080 "./runtime.in" {Stack->push(a != b); return;} } #line 1084 "./runtime.in" // transform +(transform a, transform b); void gen_runtime118(stack *Stack) { transform b=vm::pop(Stack); transform a=vm::pop(Stack); #line 1085 "./runtime.in" {Stack->push(a+b); return;} } #line 1089 "./runtime.in" // transform *(transform a, transform b); void gen_runtime119(stack *Stack) { transform b=vm::pop(Stack); transform a=vm::pop(Stack); #line 1090 "./runtime.in" {Stack->push(a*b); return;} } #line 1094 "./runtime.in" // pair *(transform t, pair z); void gen_runtime120(stack *Stack) { pair z=vm::pop(Stack); transform t=vm::pop(Stack); #line 1095 "./runtime.in" {Stack->push(t*z); return;} } #line 1099 "./runtime.in" // path *(transform t, path g); void gen_runtime121(stack *Stack) { path g=vm::pop(Stack); transform t=vm::pop(Stack); #line 1100 "./runtime.in" {Stack->push(transformed(t,g)); return;} } #line 1104 "./runtime.in" // pen *(transform t, pen p); void gen_runtime122(stack *Stack) { pen p=vm::pop(Stack); transform t=vm::pop(Stack); #line 1105 "./runtime.in" {Stack->push(transformed(t,p)); return;} } #line 1109 "./runtime.in" // picture* *(transform t, picture *f); void gen_runtime123(stack *Stack) { picture * f=vm::pop(Stack); transform t=vm::pop(Stack); #line 1110 "./runtime.in" {Stack->push(transformed(t,f)); return;} } #line 1114 "./runtime.in" // picture* *(realarray2 *t, picture *f); void gen_runtime124(stack *Stack) { picture * f=vm::pop(Stack); realarray2 * t=vm::pop(Stack); #line 1115 "./runtime.in" {Stack->push(transformed(*t,f)); return;} } #line 1119 "./runtime.in" // transform ^(transform t, Int n); void gen_runtime125(stack *Stack) { Int n=vm::pop(Stack); transform t=vm::pop(Stack); #line 1120 "./runtime.in" transform T; if(n < 0) { n=-n; t=inverse(t); } for(Int i=0; i < n; i++) T=T*t; {Stack->push(T); return;} } #line 1130 "./runtime.in" void transformXPart(stack *Stack) { transform t=vm::pop(Stack); #line 1131 "./runtime.in" {Stack->push(t.getx()); return;} } #line 1135 "./runtime.in" void transformYPart(stack *Stack) { transform t=vm::pop(Stack); #line 1136 "./runtime.in" {Stack->push(t.gety()); return;} } #line 1140 "./runtime.in" void transformXXPart(stack *Stack) { transform t=vm::pop(Stack); #line 1141 "./runtime.in" {Stack->push(t.getxx()); return;} } #line 1145 "./runtime.in" void transformXYPart(stack *Stack) { transform t=vm::pop(Stack); #line 1146 "./runtime.in" {Stack->push(t.getxy()); return;} } #line 1150 "./runtime.in" void transformYXPart(stack *Stack) { transform t=vm::pop(Stack); #line 1151 "./runtime.in" {Stack->push(t.getyx()); return;} } #line 1155 "./runtime.in" void transformYYPart(stack *Stack) { transform t=vm::pop(Stack); #line 1156 "./runtime.in" {Stack->push(t.getyy()); return;} } #line 1160 "./runtime.in" void real6ToTransform(stack *Stack) { real yy=vm::pop(Stack); real yx=vm::pop(Stack); real xy=vm::pop(Stack); real xx=vm::pop(Stack); real y=vm::pop(Stack); real x=vm::pop(Stack); #line 1162 "./runtime.in" {Stack->push(transform(x,y,xx,xy,yx,yy)); return;} } #line 1166 "./runtime.in" // transform shift(transform t); void gen_runtime133(stack *Stack) { transform t=vm::pop(Stack); #line 1167 "./runtime.in" {Stack->push(transform(t.getx(),t.gety(),0,0,0,0)); return;} } #line 1171 "./runtime.in" // transform shiftless(transform t); void gen_runtime134(stack *Stack) { transform t=vm::pop(Stack); #line 1172 "./runtime.in" {Stack->push(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;} } #line 1176 "./runtime.in" // transform identity(); void transformIdentity(stack *Stack) { #line 1177 "./runtime.in" {Stack->push(identity); return;} } #line 1181 "./runtime.in" // transform inverse(transform t); void gen_runtime136(stack *Stack) { transform t=vm::pop(Stack); #line 1182 "./runtime.in" {Stack->push(inverse(t)); return;} } #line 1186 "./runtime.in" // transform shift(pair z); void gen_runtime137(stack *Stack) { pair z=vm::pop(Stack); #line 1187 "./runtime.in" {Stack->push(shift(z)); return;} } #line 1191 "./runtime.in" // transform shift(real x, real y); void gen_runtime138(stack *Stack) { real y=vm::pop(Stack); real x=vm::pop(Stack); #line 1192 "./runtime.in" {Stack->push(shift(pair(x,y))); return;} } #line 1196 "./runtime.in" // transform xscale(real x); void gen_runtime139(stack *Stack) { real x=vm::pop(Stack); #line 1197 "./runtime.in" {Stack->push(xscale(x)); return;} } #line 1201 "./runtime.in" // transform yscale(real y); void gen_runtime140(stack *Stack) { real y=vm::pop(Stack); #line 1202 "./runtime.in" {Stack->push(yscale(y)); return;} } #line 1206 "./runtime.in" // transform scale(real x); void gen_runtime141(stack *Stack) { real x=vm::pop(Stack); #line 1207 "./runtime.in" {Stack->push(scale(x)); return;} } #line 1211 "./runtime.in" // transform scale(real x, real y); void gen_runtime142(stack *Stack) { real y=vm::pop(Stack); real x=vm::pop(Stack); #line 1212 "./runtime.in" {Stack->push(scale(x,y)); return;} } #line 1216 "./runtime.in" // transform slant(real s); void gen_runtime143(stack *Stack) { real s=vm::pop(Stack); #line 1217 "./runtime.in" {Stack->push(slant(s)); return;} } #line 1221 "./runtime.in" // transform rotate(real angle, pair z=0); void gen_runtime144(stack *Stack) { pair z=vm::pop(Stack,0); real angle=vm::pop(Stack); #line 1222 "./runtime.in" {Stack->push(rotatearound(z,radians(angle))); return;} } #line 1226 "./runtime.in" // transform reflect(pair a, pair b); void gen_runtime145(stack *Stack) { pair b=vm::pop(Stack); pair a=vm::pop(Stack); #line 1227 "./runtime.in" {Stack->push(reflectabout(a,b)); return;} } #line 1231 "./runtime.in" // bool isometry(transform t); void gen_runtime146(stack *Stack) { transform t=vm::pop(Stack); #line 1232 "./runtime.in" {Stack->push(t.isIsometry()); return;} } #line 1236 "./runtime.in" // real bezier(real a, real b, real c, real d, real t); void gen_runtime147(stack *Stack) { real t=vm::pop(Stack); real d=vm::pop(Stack); real c=vm::pop(Stack); real b=vm::pop(Stack); real a=vm::pop(Stack); #line 1237 "./runtime.in" real onemt=1-t; real onemt2=onemt*onemt; {Stack->push(onemt2*onemt*a+t*(3.0*(onemt2*b+t*onemt*c)+t*t*d)); return;} } } // namespace run namespace trans { void gen_runtime_venv(venv &ve) { #line 233 "./runtime.in" REGISTER_BLTIN(run::IntZero,"IntZero"); #line 241 "./runtime.in" REGISTER_BLTIN(run::realZero,"realZero"); #line 246 "./runtime.in" REGISTER_BLTIN(run::boolFalse,"boolFalse"); #line 251 "./runtime.in" addFunc(ve, run::gen_runtime3, primBoolean(), SYM(isnan), formal(primReal(), SYM(x), false, false)); #line 256 "./runtime.in" REGISTER_BLTIN(run::pushNullArray,"pushNullArray"); #line 261 "./runtime.in" REGISTER_BLTIN(run::pushNullRecord,"pushNullRecord"); #line 266 "./runtime.in" REGISTER_BLTIN(run::pushNullFunction,"pushNullFunction"); #line 271 "./runtime.in" REGISTER_BLTIN(run::pushDefault,"pushDefault"); #line 281 "./runtime.in" REGISTER_BLTIN(run::isDefault,"isDefault"); #line 288 "./runtime.in" REGISTER_BLTIN(run::pairToGuide,"pairToGuide"); #line 296 "./runtime.in" REGISTER_BLTIN(run::pathToGuide,"pathToGuide"); #line 301 "./runtime.in" REGISTER_BLTIN(run::guideToPath,"guideToPath"); #line 306 "./runtime.in" REGISTER_BLTIN(run::newPen,"newPen"); #line 314 "./runtime.in" addFunc(ve, run::gen_runtime13, primBoolean(), SYM_EQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); #line 319 "./runtime.in" addFunc(ve, run::gen_runtime14, primBoolean(), SYM_NEQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); #line 324 "./runtime.in" addFunc(ve, run::gen_runtime15, primPen(), SYM_PLUS, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); #line 329 "./runtime.in" addFunc(ve, run::gen_runtime16, primPen(), SYM_TIMES, formal(primReal(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); #line 334 "./runtime.in" addFunc(ve, run::gen_runtime17, primPen(), SYM_TIMES, formal(primPen(), SYM(a), false, false), formal(primReal(), SYM(b), false, false)); #line 339 "./runtime.in" addFunc(ve, run::gen_runtime18, primPair(), SYM(max), formal(primPen(), SYM(p), false, false)); #line 344 "./runtime.in" addFunc(ve, run::gen_runtime19, primPair(), SYM(min), formal(primPen(), SYM(p), false, false)); #line 349 "./runtime.in" addFunc(ve, run::gen_runtime20, primVoid(), SYM(resetdefaultpen)); #line 355 "./runtime.in" addFunc(ve, run::gen_runtime21, primVoid(), SYM(defaultpen), formal(primPen(), SYM(p), false, false)); #line 360 "./runtime.in" addFunc(ve, run::gen_runtime22, primPen(), SYM(defaultpen)); #line 365 "./runtime.in" addFunc(ve, run::gen_runtime23, primBoolean(), SYM(invisible), formal(primPen(), SYM(p), false, false)); #line 370 "./runtime.in" addFunc(ve, run::gen_runtime24, primPen(), SYM(invisible)); #line 375 "./runtime.in" addFunc(ve, run::gen_runtime25, primPen(), SYM(gray), formal(primPen(), SYM(p), false, false)); #line 381 "./runtime.in" addFunc(ve, run::gen_runtime26, primPen(), SYM(rgb), formal(primPen(), SYM(p), false, false)); #line 387 "./runtime.in" addFunc(ve, run::gen_runtime27, primPen(), SYM(cmyk), formal(primPen(), SYM(p), false, false)); #line 393 "./runtime.in" addFunc(ve, run::gen_runtime28, primPen(), SYM(interp), formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false), formal(primReal(), SYM(t), false, false)); #line 398 "./runtime.in" addFunc(ve, run::gen_runtime29, primPen(), SYM(rgb), formal(primReal(), SYM(r), false, false), formal(primReal(), SYM(g), false, false), formal(primReal(), SYM(b), false, false)); #line 403 "./runtime.in" addFunc(ve, run::gen_runtime30, primPen(), SYM(cmyk), formal(primReal(), SYM(c), false, false), formal(primReal(), SYM(m), false, false), formal(primReal(), SYM(y), false, false), formal(primReal(), SYM(k), false, false)); #line 408 "./runtime.in" addFunc(ve, run::gen_runtime31, primPen(), SYM(gray), formal(primReal(), SYM(gray), false, false)); #line 413 "./runtime.in" addFunc(ve, run::gen_runtime32, realArray(), SYM(colors), formal(primPen(), SYM(p), false, false)); #line 441 "./runtime.in" addFunc(ve, run::gen_runtime33, primString(), SYM(hex), formal(primPen(), SYM(p), false, false)); #line 446 "./runtime.in" addFunc(ve, run::gen_runtime34, primInt(), SYM(byte), formal(primReal(), SYM(x), false, false)); #line 451 "./runtime.in" addFunc(ve, run::gen_runtime35, primReal(), SYM(byteinv), formal(primInt(), SYM(x), false, false)); #line 456 "./runtime.in" addFunc(ve, run::gen_runtime36, primString(), SYM(colorspace), formal(primPen(), SYM(p), false, false)); #line 463 "./runtime.in" addFunc(ve, run::gen_runtime37, primPen(), SYM(pattern), formal(primString(), SYM(s), false, false)); #line 468 "./runtime.in" addFunc(ve, run::gen_runtime38, primString(), SYM(pattern), formal(primPen(), SYM(p), false, false)); #line 473 "./runtime.in" addFunc(ve, run::gen_runtime39, primPen(), SYM(fillrule), formal(primInt(), SYM(n), false, false)); #line 478 "./runtime.in" addFunc(ve, run::gen_runtime40, primInt(), SYM(fillrule), formal(primPen(), SYM(p), false, false)); #line 483 "./runtime.in" addFunc(ve, run::gen_runtime41, primPen(), SYM(opacity), formal(primReal(), SYM(opacity), true, false), formal(primString(), SYM(blend), true, false)); #line 493 "./runtime.in" addFunc(ve, run::gen_runtime42, primReal(), SYM(opacity), formal(primPen(), SYM(p), false, false)); #line 498 "./runtime.in" addFunc(ve, run::gen_runtime43, primString(), SYM(blend), formal(primPen(), SYM(p), false, false)); #line 503 "./runtime.in" addFunc(ve, run::gen_runtime44, primPen(), SYM(linetype), formal(realArray(), SYM(pattern), false, false), formal(primReal(), SYM(offset), true, false), formal(primBoolean(), SYM(scale), true, false), formal(primBoolean(), SYM(adjust), true, false)); #line 514 "./runtime.in" addFunc(ve, run::gen_runtime45, realArray(), SYM(linetype), formal(primPen(), SYM(p), true, false)); #line 520 "./runtime.in" addFunc(ve, run::gen_runtime46, primReal(), SYM(offset), formal(primPen(), SYM(p), false, false)); #line 525 "./runtime.in" addFunc(ve, run::gen_runtime47, primBoolean(), SYM(scale), formal(primPen(), SYM(p), false, false)); #line 530 "./runtime.in" addFunc(ve, run::gen_runtime48, primBoolean(), SYM(adjust), formal(primPen(), SYM(p), false, false)); #line 535 "./runtime.in" addFunc(ve, run::gen_runtime49, primPen(), SYM(adjust), formal(primPen(), SYM(p), false, false), formal(primReal(), SYM(arclength), false, false), formal(primBoolean(), SYM(cyclic), false, false)); #line 540 "./runtime.in" addFunc(ve, run::gen_runtime50, primPen(), SYM(linecap), formal(primInt(), SYM(n), false, false)); #line 545 "./runtime.in" addFunc(ve, run::gen_runtime51, primInt(), SYM(linecap), formal(primPen(), SYM(p), true, false)); #line 550 "./runtime.in" addFunc(ve, run::gen_runtime52, primPen(), SYM(linejoin), formal(primInt(), SYM(n), false, false)); #line 555 "./runtime.in" addFunc(ve, run::gen_runtime53, primInt(), SYM(linejoin), formal(primPen(), SYM(p), true, false)); #line 560 "./runtime.in" addFunc(ve, run::gen_runtime54, primPen(), SYM(miterlimit), formal(primReal(), SYM(x), false, false)); #line 565 "./runtime.in" addFunc(ve, run::gen_runtime55, primReal(), SYM(miterlimit), formal(primPen(), SYM(p), true, false)); #line 570 "./runtime.in" addFunc(ve, run::gen_runtime56, primPen(), SYM(linewidth), formal(primReal(), SYM(x), false, false)); #line 575 "./runtime.in" addFunc(ve, run::gen_runtime57, primReal(), SYM(linewidth), formal(primPen(), SYM(p), true, false)); #line 580 "./runtime.in" addFunc(ve, run::gen_runtime58, primPen(), SYM(fontcommand), formal(primString(), SYM(s), false, false)); #line 585 "./runtime.in" addFunc(ve, run::gen_runtime59, primString(), SYM(font), formal(primPen(), SYM(p), true, false)); #line 590 "./runtime.in" addFunc(ve, run::gen_runtime60, primPen(), SYM(fontsize), formal(primReal(), SYM(size), false, false), formal(primReal(), SYM(lineskip), false, false)); #line 596 "./runtime.in" addFunc(ve, run::gen_runtime61, primReal(), SYM(fontsize), formal(primPen(), SYM(p), true, false)); #line 601 "./runtime.in" addFunc(ve, run::gen_runtime62, primReal(), SYM(lineskip), formal(primPen(), SYM(p), true, false)); #line 606 "./runtime.in" addFunc(ve, run::gen_runtime63, primPen(), SYM(overwrite), formal(primInt(), SYM(n), false, false)); #line 612 "./runtime.in" addFunc(ve, run::gen_runtime64, primInt(), SYM(overwrite), formal(primPen(), SYM(p), true, false)); #line 617 "./runtime.in" addFunc(ve, run::gen_runtime65, primPen(), SYM(basealign), formal(primInt(), SYM(n), false, false)); #line 622 "./runtime.in" addFunc(ve, run::gen_runtime66, primInt(), SYM(basealign), formal(primPen(), SYM(p), true, false)); #line 627 "./runtime.in" addFunc(ve, run::gen_runtime67, primTransform(), SYM(transform), formal(primPen(), SYM(p), false, false)); #line 632 "./runtime.in" addFunc(ve, run::gen_runtime68, primPath(), SYM(nib), formal(primPen(), SYM(p), false, false)); #line 637 "./runtime.in" addFunc(ve, run::gen_runtime69, primPen(), SYM(makepen), formal(primPath(), SYM(p), false, false)); #line 642 "./runtime.in" addFunc(ve, run::gen_runtime70, primPen(), SYM(colorless), formal(primPen(), SYM(p), false, false)); #line 648 "./runtime.in" addFunc(ve, run::gen_runtime71, primBoolean(), SYM(interactive)); #line 655 "./runtime.in" addFunc(ve, run::gen_runtime72, primBoolean(), SYM(uptodate)); #line 660 "./runtime.in" addFunc(ve, run::gen_runtime73, primInt(), SYM(system), formal(stringArray(), SYM(s), false, false)); #line 674 "./runtime.in" addFunc(ve, run::gen_runtime74, primBoolean(), SYM(view)); #line 679 "./runtime.in" addFunc(ve, run::gen_runtime75, primString(), SYM(asydir)); #line 684 "./runtime.in" addFunc(ve, run::gen_runtime76, primString(), SYM(locale), formal(primString(), SYM(s), true, false)); #line 690 "./runtime.in" addFunc(ve, run::gen_runtime77, primVoid(), SYM(abort), formal(primString(), SYM(s), true, false)); #line 696 "./runtime.in" addFunc(ve, run::gen_runtime78, primVoid(), SYM(exit)); #line 701 "./runtime.in" addFunc(ve, run::gen_runtime79, primVoid(), SYM(assert), formal(primBoolean(), SYM(b), false, false), formal(primString(), SYM(s), true, false)); #line 712 "./runtime.in" addFunc(ve, run::gen_runtime80, primVoid(), SYM(sleep), formal(primInt(), SYM(seconds), false, false)); #line 718 "./runtime.in" addFunc(ve, run::gen_runtime81, primVoid(), SYM(usleep), formal(primInt(), SYM(microseconds), false, false)); #line 724 "./runtime.in" addFunc(ve, run::gen_runtime82, primVoid(), SYM(_eval), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false), formal(primBoolean(), SYM(interactivewrite), true, false)); #line 737 "./runtime.in" addFunc(ve, run::gen_runtime83, primVoid(), SYM(_eval), formal(primCode(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false)); #line 753 "./runtime.in" addFunc(ve, run::gen_runtime84, primString(), SYM(xasyKEY)); #line 760 "./runtime.in" addFunc(ve, run::gen_runtime85, primVoid(), SYM(xasyKEY), formal(primString(), SYM(s), false, false)); #line 764 "./runtime.in" addFunc(ve, run::gen_runtime86, primString(), SYM(location)); #line 770 "./runtime.in" REGISTER_BLTIN(run::loadModule,"loadModule"); #line 776 "./runtime.in" addFunc(ve, run::gen_runtime88, primString(), SYM(cd), formal(primString(), SYM(s), true, false)); #line 787 "./runtime.in" addFunc(ve, run::gen_runtime89, primVoid(), SYM(list), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(imports), true, false)); #line 796 "./runtime.in" REGISTER_BLTIN(run::nullGuide,"nullGuide"); #line 804 "./runtime.in" REGISTER_BLTIN(run::dotsGuide,"dotsGuide"); #line 814 "./runtime.in" REGISTER_BLTIN(run::dashesGuide,"dashesGuide"); #line 841 "./runtime.in" REGISTER_BLTIN(run::newCycleToken,"newCycleToken"); #line 846 "./runtime.in" addFunc(ve, run::gen_runtime94, primGuide(), symbol::trans("operator cast"), formal(primCycleToken(), SYM(tok), false, false)); #line 853 "./runtime.in" addFunc(ve, run::gen_runtime95, primGuide(), symbol::trans("operator spec"), formal(primPair(), SYM(z), false, false), formal(primInt(), SYM(p), false, false)); #line 861 "./runtime.in" addFunc(ve, run::gen_runtime96, primCurlSpecifier(), SYM_CURL, formal(primReal(), SYM(gamma), false, false), formal(primInt(), SYM(p), false, false)); #line 867 "./runtime.in" REGISTER_BLTIN(run::curlSpecifierValuePart,"curlSpecifierValuePart"); #line 872 "./runtime.in" REGISTER_BLTIN(run::curlSpecifierSidePart,"curlSpecifierSidePart"); #line 877 "./runtime.in" addFunc(ve, run::gen_runtime99, primGuide(), symbol::trans("operator cast"), formal(primCurlSpecifier(), SYM(spec), false, false)); #line 882 "./runtime.in" addFunc(ve, run::gen_runtime100, primTensionSpecifier(), SYM_TENSION, formal(primReal(), SYM(tout), false, false), formal(primReal(), SYM(tin), false, false), formal(primBoolean(), SYM(atleast), false, false)); #line 887 "./runtime.in" REGISTER_BLTIN(run::tensionSpecifierOutPart,"tensionSpecifierOutPart"); #line 892 "./runtime.in" REGISTER_BLTIN(run::tensionSpecifierInPart,"tensionSpecifierInPart"); #line 897 "./runtime.in" REGISTER_BLTIN(run::tensionSpecifierAtleastPart,"tensionSpecifierAtleastPart"); #line 902 "./runtime.in" addFunc(ve, run::gen_runtime104, primGuide(), symbol::trans("operator cast"), formal(primTensionSpecifier(), SYM(t), false, false)); #line 907 "./runtime.in" addFunc(ve, run::gen_runtime105, primGuide(), SYM_CONTROLS, formal(primPair(), SYM(zout), false, false), formal(primPair(), SYM(zin), false, false)); #line 912 "./runtime.in" addFunc(ve, run::gen_runtime106, primInt(), SYM(size), formal(primGuide(), SYM(g), false, false)); #line 919 "./runtime.in" addFunc(ve, run::gen_runtime107, primInt(), SYM(length), formal(primGuide(), SYM(g), false, false)); #line 926 "./runtime.in" addFunc(ve, run::gen_runtime108, primBoolean(), SYM(cyclic), formal(primGuide(), SYM(g), false, false)); #line 933 "./runtime.in" addFunc(ve, run::gen_runtime109, primPair(), SYM(point), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); #line 940 "./runtime.in" addFunc(ve, run::gen_runtime110, pairArray(), SYM(dirSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); #line 952 "./runtime.in" addFunc(ve, run::gen_runtime111, pairArray(), SYM(controlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); #line 969 "./runtime.in" addFunc(ve, run::gen_runtime112, primTensionSpecifier(), SYM(tensionSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); #line 979 "./runtime.in" addFunc(ve, run::gen_runtime113, realArray(), SYM(curlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); #line 993 "./runtime.in" addFunc(ve, run::gen_runtime114, primGuide(), SYM(reverse), formal(primGuide(), SYM(g), false, false)); #line 1046 "./runtime.in" addFunc(ve, run::gen_runtime115, realArray(), SYM(_cputime)); #line 1071 "./runtime.in" addFunc(ve, run::gen_runtime116, primBoolean(), SYM_EQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); #line 1079 "./runtime.in" addFunc(ve, run::gen_runtime117, primBoolean(), SYM_NEQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); #line 1084 "./runtime.in" addFunc(ve, run::gen_runtime118, primTransform(), SYM_PLUS, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); #line 1089 "./runtime.in" addFunc(ve, run::gen_runtime119, primTransform(), SYM_TIMES, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); #line 1094 "./runtime.in" addFunc(ve, run::gen_runtime120, primPair(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(z), false, false)); #line 1099 "./runtime.in" addFunc(ve, run::gen_runtime121, primPath(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPath(), SYM(g), false, false)); #line 1104 "./runtime.in" addFunc(ve, run::gen_runtime122, primPen(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPen(), SYM(p), false, false)); #line 1109 "./runtime.in" addFunc(ve, run::gen_runtime123, primPicture(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false)); #line 1114 "./runtime.in" addFunc(ve, run::gen_runtime124, primPicture(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false)); #line 1119 "./runtime.in" addFunc(ve, run::gen_runtime125, primTransform(), SYM_CARET, formal(primTransform(), SYM(t), false, false), formal(primInt(), SYM(n), false, false)); #line 1130 "./runtime.in" REGISTER_BLTIN(run::transformXPart,"transformXPart"); #line 1135 "./runtime.in" REGISTER_BLTIN(run::transformYPart,"transformYPart"); #line 1140 "./runtime.in" REGISTER_BLTIN(run::transformXXPart,"transformXXPart"); #line 1145 "./runtime.in" REGISTER_BLTIN(run::transformXYPart,"transformXYPart"); #line 1150 "./runtime.in" REGISTER_BLTIN(run::transformYXPart,"transformYXPart"); #line 1155 "./runtime.in" REGISTER_BLTIN(run::transformYYPart,"transformYYPart"); #line 1160 "./runtime.in" REGISTER_BLTIN(run::real6ToTransform,"real6ToTransform"); #line 1166 "./runtime.in" addFunc(ve, run::gen_runtime133, primTransform(), SYM(shift), formal(primTransform(), SYM(t), false, false)); #line 1171 "./runtime.in" addFunc(ve, run::gen_runtime134, primTransform(), SYM(shiftless), formal(primTransform(), SYM(t), false, false)); #line 1176 "./runtime.in" addFunc(ve, run::transformIdentity, primTransform(), SYM(identity)); #line 1181 "./runtime.in" addFunc(ve, run::gen_runtime136, primTransform(), SYM(inverse), formal(primTransform(), SYM(t), false, false)); #line 1186 "./runtime.in" addFunc(ve, run::gen_runtime137, primTransform(), SYM(shift), formal(primPair(), SYM(z), false, false)); #line 1191 "./runtime.in" addFunc(ve, run::gen_runtime138, primTransform(), SYM(shift), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); #line 1196 "./runtime.in" addFunc(ve, run::gen_runtime139, primTransform(), SYM(xscale), formal(primReal(), SYM(x), false, false)); #line 1201 "./runtime.in" addFunc(ve, run::gen_runtime140, primTransform(), SYM(yscale), formal(primReal(), SYM(y), false, false)); #line 1206 "./runtime.in" addFunc(ve, run::gen_runtime141, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false)); #line 1211 "./runtime.in" addFunc(ve, run::gen_runtime142, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); #line 1216 "./runtime.in" addFunc(ve, run::gen_runtime143, primTransform(), SYM(slant), formal(primReal(), SYM(s), false, false)); #line 1221 "./runtime.in" addFunc(ve, run::gen_runtime144, primTransform(), SYM(rotate), formal(primReal(), SYM(angle), false, false), formal(primPair(), SYM(z), true, false)); #line 1226 "./runtime.in" addFunc(ve, run::gen_runtime145, primTransform(), SYM(reflect), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false)); #line 1231 "./runtime.in" addFunc(ve, run::gen_runtime146, primBoolean(), SYM(isometry), formal(primTransform(), SYM(t), false, false)); #line 1236 "./runtime.in" addFunc(ve, run::gen_runtime147, primReal(), SYM(bezier), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(c), false, false), formal(primReal(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); } } // namespace trans