diff options
Diffstat (limited to 'graphics/asymptote/runfile.cc')
-rw-r--r-- | graphics/asymptote/runfile.cc | 189 |
1 files changed, 95 insertions, 94 deletions
diff --git a/graphics/asymptote/runfile.cc b/graphics/asymptote/runfile.cc index 74ad76fdd7..bdf9826d63 100644 --- a/graphics/asymptote/runfile.cc +++ b/graphics/asymptote/runfile.cc @@ -263,81 +263,82 @@ void gen_runfile12(stack *Stack) #line 145 "runfile.in" char c=0; if(f->isOpen()) f->read(c); - static char str[1]; + static char str[2]; str[0]=c; + str[1]=0; {Stack->push<string>(string(str)); return;} } -#line 153 "runfile.in" +#line 154 "runfile.in" // Int tell(file *f); void gen_runfile13(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 154 "runfile.in" +#line 155 "runfile.in" {Stack->push<Int>(f->tell()); return;} } -#line 158 "runfile.in" +#line 159 "runfile.in" // void seek(file *f, Int pos); void gen_runfile14(stack *Stack) { Int pos=vm::pop<Int>(Stack); file * f=vm::pop<file *>(Stack); -#line 159 "runfile.in" +#line 160 "runfile.in" f->seek(pos,pos >= 0); } -#line 163 "runfile.in" +#line 164 "runfile.in" // void seekeof(file *f); void gen_runfile15(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 164 "runfile.in" +#line 165 "runfile.in" f->seek(0,false); } -#line 168 "runfile.in" +#line 169 "runfile.in" void namePart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 169 "runfile.in" +#line 170 "runfile.in" {Stack->push<string>(f.filename()); return;} } -#line 173 "runfile.in" +#line 174 "runfile.in" void modePart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 174 "runfile.in" +#line 175 "runfile.in" {Stack->push<string>(f.FileMode()); return;} } // Set file dimensions -#line 179 "runfile.in" +#line 180 "runfile.in" void dimensionSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); Int nz=vm::pop<Int>(Stack,-1); Int ny=vm::pop<Int>(Stack,-1); Int nx=vm::pop<Int>(Stack,-1); -#line 180 "runfile.in" +#line 181 "runfile.in" f->dimension(nx,ny,nz); {Stack->push<file*>(f); return;} } -#line 185 "runfile.in" +#line 186 "runfile.in" void dimensionSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 186 "runfile.in" +#line 187 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(dimensionSetHelper),f)); return;} } -#line 190 "runfile.in" +#line 191 "runfile.in" void dimensionPart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 191 "runfile.in" +#line 192 "runfile.in" array *a=new array(3); (*a)[0]=f.Nx(); (*a)[1]=f.Ny(); @@ -346,174 +347,174 @@ void dimensionPart(stack *Stack) } // Set file f to read arrays in line-at-a-time mode -#line 200 "runfile.in" +#line 201 "runfile.in" void lineSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); bool b=vm::pop<bool>(Stack,true); -#line 201 "runfile.in" +#line 202 "runfile.in" f->LineMode(b); {Stack->push<file*>(f); return;} } -#line 206 "runfile.in" +#line 207 "runfile.in" void lineSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 207 "runfile.in" +#line 208 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(lineSetHelper),f)); return;} } -#line 211 "runfile.in" +#line 212 "runfile.in" void linePart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 212 "runfile.in" +#line 213 "runfile.in" {Stack->push<bool>(f.LineMode()); return;} } // Set file to read comma-separated values -#line 217 "runfile.in" +#line 218 "runfile.in" void csvSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); bool b=vm::pop<bool>(Stack,true); -#line 218 "runfile.in" +#line 219 "runfile.in" f->CSVMode(b); {Stack->push<file*>(f); return;} } -#line 223 "runfile.in" +#line 224 "runfile.in" void csvSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 224 "runfile.in" +#line 225 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(csvSetHelper),f)); return;} } -#line 228 "runfile.in" +#line 229 "runfile.in" void csvPart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 229 "runfile.in" +#line 230 "runfile.in" {Stack->push<bool>(f.CSVMode()); return;} } // Set file to read whitespace-separated values -#line 234 "runfile.in" +#line 235 "runfile.in" void wordSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); bool b=vm::pop<bool>(Stack,true); -#line 235 "runfile.in" +#line 236 "runfile.in" f->WordMode(b); {Stack->push<file*>(f); return;} } -#line 240 "runfile.in" +#line 241 "runfile.in" void wordSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 241 "runfile.in" +#line 242 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(wordSetHelper),f)); return;} } -#line 245 "runfile.in" +#line 246 "runfile.in" void wordPart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 246 "runfile.in" +#line 247 "runfile.in" {Stack->push<bool>(f.WordMode()); return;} } // Set file to read/write single precision real XDR values. -#line 251 "runfile.in" +#line 252 "runfile.in" void singlerealSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); bool b=vm::pop<bool>(Stack,true); -#line 252 "runfile.in" +#line 253 "runfile.in" f->SingleReal(b); {Stack->push<file*>(f); return;} } -#line 257 "runfile.in" +#line 258 "runfile.in" void singlerealSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 258 "runfile.in" +#line 259 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(singlerealSetHelper),f)); return;} } -#line 262 "runfile.in" +#line 263 "runfile.in" void singlerealPart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 263 "runfile.in" +#line 264 "runfile.in" {Stack->push<bool>(f.SingleReal()); return;} } // Set file to read/write single precision int XDR values. -#line 268 "runfile.in" +#line 269 "runfile.in" void singleintSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); bool b=vm::pop<bool>(Stack,true); -#line 269 "runfile.in" +#line 270 "runfile.in" f->SingleInt(b); {Stack->push<file*>(f); return;} } -#line 274 "runfile.in" +#line 275 "runfile.in" void singleintSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 275 "runfile.in" +#line 276 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(singleintSetHelper),f)); return;} } -#line 279 "runfile.in" +#line 280 "runfile.in" void singleintPart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 280 "runfile.in" +#line 281 "runfile.in" {Stack->push<bool>(f.SingleInt()); return;} } // Set file to read/write signed int XDR values. -#line 285 "runfile.in" +#line 286 "runfile.in" void signedintSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); bool b=vm::pop<bool>(Stack,true); -#line 286 "runfile.in" +#line 287 "runfile.in" f->SignedInt(b); {Stack->push<file*>(f); return;} } -#line 291 "runfile.in" +#line 292 "runfile.in" void signedintSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 292 "runfile.in" +#line 293 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(signedintSetHelper),f)); return;} } -#line 296 "runfile.in" +#line 297 "runfile.in" void signedintPart(stack *Stack) { file f=vm::pop<file>(Stack); -#line 297 "runfile.in" +#line 298 "runfile.in" {Stack->push<bool>(f.SignedInt()); return;} } // Set file to read an arrayi (i int sizes followed by an i-dimensional array) -#line 302 "runfile.in" +#line 303 "runfile.in" void readSetHelper(stack *Stack) { file * f=vm::pop<file *>(Stack); Int i=vm::pop<Int>(Stack); -#line 303 "runfile.in" +#line 304 "runfile.in" switch(i) { case 1: f->dimension(-2); @@ -534,21 +535,21 @@ void readSetHelper(stack *Stack) {Stack->push<file*>(f); return;} } -#line 324 "runfile.in" +#line 325 "runfile.in" void readSet(stack *Stack) { file * f=vm::pop<file *>(Stack); -#line 325 "runfile.in" +#line 326 "runfile.in" {Stack->push<callable*>(new thunk(new bfunc(readSetHelper),f)); return;} } // Delete file named s. -#line 330 "runfile.in" +#line 331 "runfile.in" // Int delete(string s); void gen_runfile41(stack *Stack) { string s=vm::pop<string>(Stack); -#line 331 "runfile.in" +#line 332 "runfile.in" s=outpath(s); Int rc=unlink(s.c_str()); if(rc == 0 && verbose > 0) @@ -557,13 +558,13 @@ void gen_runfile41(stack *Stack) } // Rename file "from" to file "to". -#line 340 "runfile.in" +#line 341 "runfile.in" // Int rename(string from, string to); void gen_runfile42(stack *Stack) { string to=vm::pop<string>(Stack); string from=vm::pop<string>(Stack); -#line 341 "runfile.in" +#line 342 "runfile.in" from=outpath(from); to=outpath(to); Int rc=rename(from.c_str(),to.c_str()); @@ -573,12 +574,12 @@ void gen_runfile42(stack *Stack) } // Create a unique temporary file name. -#line 351 "runfile.in" +#line 352 "runfile.in" // string mktemp(string s); void gen_runfile43(stack *Stack) { string s=vm::pop<string>(Stack); -#line 352 "runfile.in" +#line 353 "runfile.in" char *S=Strdup(s+"XXXXXX"); int fd=mkstemp(S); if(fd < 0) { @@ -621,67 +622,67 @@ void gen_runfile_venv(venv &ve) addFunc(ve, run::gen_runfile11, primVoid(), SYM(flush), formal(primFile(), SYM(f), false, false)); #line 144 "runfile.in" addFunc(ve, run::gen_runfile12, primString() , SYM(getc), formal(primFile(), SYM(f), false, false)); -#line 153 "runfile.in" +#line 154 "runfile.in" addFunc(ve, run::gen_runfile13, primInt(), SYM(tell), formal(primFile(), SYM(f), false, false)); -#line 158 "runfile.in" +#line 159 "runfile.in" addFunc(ve, run::gen_runfile14, primVoid(), SYM(seek), formal(primFile(), SYM(f), false, false), formal(primInt(), SYM(pos), false, false)); -#line 163 "runfile.in" +#line 164 "runfile.in" addFunc(ve, run::gen_runfile15, primVoid(), SYM(seekeof), formal(primFile(), SYM(f), false, false)); -#line 168 "runfile.in" +#line 169 "runfile.in" REGISTER_BLTIN(run::namePart,"namePart"); -#line 173 "runfile.in" +#line 174 "runfile.in" REGISTER_BLTIN(run::modePart,"modePart"); -#line 178 "runfile.in" +#line 179 "runfile.in" REGISTER_BLTIN(run::dimensionSetHelper,"dimensionSetHelper"); -#line 185 "runfile.in" +#line 186 "runfile.in" REGISTER_BLTIN(run::dimensionSet,"dimensionSet"); -#line 190 "runfile.in" +#line 191 "runfile.in" REGISTER_BLTIN(run::dimensionPart,"dimensionPart"); -#line 199 "runfile.in" +#line 200 "runfile.in" REGISTER_BLTIN(run::lineSetHelper,"lineSetHelper"); -#line 206 "runfile.in" +#line 207 "runfile.in" REGISTER_BLTIN(run::lineSet,"lineSet"); -#line 211 "runfile.in" +#line 212 "runfile.in" REGISTER_BLTIN(run::linePart,"linePart"); -#line 216 "runfile.in" +#line 217 "runfile.in" REGISTER_BLTIN(run::csvSetHelper,"csvSetHelper"); -#line 223 "runfile.in" +#line 224 "runfile.in" REGISTER_BLTIN(run::csvSet,"csvSet"); -#line 228 "runfile.in" +#line 229 "runfile.in" REGISTER_BLTIN(run::csvPart,"csvPart"); -#line 233 "runfile.in" +#line 234 "runfile.in" REGISTER_BLTIN(run::wordSetHelper,"wordSetHelper"); -#line 240 "runfile.in" +#line 241 "runfile.in" REGISTER_BLTIN(run::wordSet,"wordSet"); -#line 245 "runfile.in" +#line 246 "runfile.in" REGISTER_BLTIN(run::wordPart,"wordPart"); -#line 250 "runfile.in" +#line 251 "runfile.in" REGISTER_BLTIN(run::singlerealSetHelper,"singlerealSetHelper"); -#line 257 "runfile.in" +#line 258 "runfile.in" REGISTER_BLTIN(run::singlerealSet,"singlerealSet"); -#line 262 "runfile.in" +#line 263 "runfile.in" REGISTER_BLTIN(run::singlerealPart,"singlerealPart"); -#line 267 "runfile.in" +#line 268 "runfile.in" REGISTER_BLTIN(run::singleintSetHelper,"singleintSetHelper"); -#line 274 "runfile.in" +#line 275 "runfile.in" REGISTER_BLTIN(run::singleintSet,"singleintSet"); -#line 279 "runfile.in" +#line 280 "runfile.in" REGISTER_BLTIN(run::singleintPart,"singleintPart"); -#line 284 "runfile.in" +#line 285 "runfile.in" REGISTER_BLTIN(run::signedintSetHelper,"signedintSetHelper"); -#line 291 "runfile.in" +#line 292 "runfile.in" REGISTER_BLTIN(run::signedintSet,"signedintSet"); -#line 296 "runfile.in" +#line 297 "runfile.in" REGISTER_BLTIN(run::signedintPart,"signedintPart"); -#line 301 "runfile.in" +#line 302 "runfile.in" REGISTER_BLTIN(run::readSetHelper,"readSetHelper"); -#line 324 "runfile.in" +#line 325 "runfile.in" REGISTER_BLTIN(run::readSet,"readSet"); -#line 329 "runfile.in" +#line 330 "runfile.in" addFunc(ve, run::gen_runfile41, primInt(), SYM(delete), formal(primString() , SYM(s), false, false)); -#line 339 "runfile.in" +#line 340 "runfile.in" addFunc(ve, run::gen_runfile42, primInt(), SYM(rename), formal(primString() , SYM(from), false, false), formal(primString() , SYM(to), false, false)); -#line 350 "runfile.in" +#line 351 "runfile.in" addFunc(ve, run::gen_runfile43, primString() , SYM(mktemp), formal(primString() , SYM(s), false, false)); } |