]> git.saurik.com Git - cycript.git/blob - Console.cpp
c4303f683344f2b77bd16374f00cca15e44318d1
[cycript.git] / Console.cpp
1 /* Cycript - Inlining/Optimizing JavaScript Compiler
2 * Copyright (C) 2009 Jay Freeman (saurik)
3 */
4
5 /* Modified BSD License {{{ */
6 /*
7 * Redistribution and use in source and binary
8 * forms, with or without modification, are permitted
9 * provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the
12 * above copyright notice, this list of conditions
13 * and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the
15 * above copyright notice, this list of conditions
16 * and the following disclaimer in the documentation
17 * and/or other materials provided with the
18 * distribution.
19 * 3. The name of the author may not be used to endorse
20 * or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
25 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
34 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38 /* }}} */
39
40 #include "cycript.hpp"
41
42 #ifdef CY_EXECUTE
43 #include "JavaScript.hpp"
44 #endif
45
46 #include <cstdio>
47 #include <sstream>
48
49 #include <setjmp.h>
50
51 #ifdef HAVE_READLINE_H
52 #include <readline.h>
53 #else
54 #include <readline/readline.h>
55 #endif
56
57 #ifdef HAVE_HISTORY_H
58 #include <history.h>
59 #else
60 #include <readline/history.h>
61 #endif
62
63 #include <sys/mman.h>
64
65 #include <errno.h>
66 #include <unistd.h>
67
68 #include <sys/types.h>
69 #include <sys/stat.h>
70 #include <fcntl.h>
71
72 #include "Cycript.tab.hh"
73
74 #include <sys/types.h>
75 #include <sys/socket.h>
76 #include <netinet/in.h>
77 #include <sys/un.h>
78 #include <pwd.h>
79
80 #include <apr_getopt.h>
81
82 #include <dlfcn.h>
83
84 #include "Replace.hpp"
85
86 static volatile enum {
87 Working,
88 Parsing,
89 Running,
90 Sending,
91 Waiting,
92 } mode_;
93
94 static jmp_buf ctrlc_;
95
96 static void sigint(int) {
97 switch (mode_) {
98 case Working:
99 return;
100 case Parsing:
101 longjmp(ctrlc_, 1);
102 case Running:
103 throw "*** Ctrl-C";
104 case Sending:
105 return;
106 case Waiting:
107 return;
108 }
109 }
110
111 #if YYDEBUG
112 static bool bison_;
113 #endif
114 static bool strict_;
115 static bool pretty_;
116
117 void Setup(CYDriver &driver, cy::parser &parser) {
118 #if YYDEBUG
119 if (bison_)
120 parser.set_debug_level(1);
121 #endif
122 if (strict_)
123 driver.strict_ = true;
124 }
125
126 void Setup(CYOutput &out, CYDriver &driver, CYOptions &options) {
127 out.pretty_ = pretty_;
128 CYContext context(driver.pool_, options);
129 driver.program_->Replace(context);
130 }
131
132 static CYUTF8String Run(CYPool &pool, int client, CYUTF8String code) {
133 const char *json;
134 size_t size;
135
136 if (client == -1) {
137 mode_ = Running;
138 #ifdef CY_EXECUTE
139 json = CYExecute(pool, code);
140 #else
141 json = NULL;
142 #endif
143 mode_ = Working;
144 if (json != NULL)
145 size = strlen(json);
146 } else {
147 mode_ = Sending;
148 size = code.size;
149 CYSendAll(client, &size, sizeof(size));
150 CYSendAll(client, code.data, code.size);
151 mode_ = Waiting;
152 CYRecvAll(client, &size, sizeof(size));
153 if (size == _not(size_t))
154 json = NULL;
155 else {
156 char *temp(new(pool) char[size + 1]);
157 CYRecvAll(client, temp, size);
158 temp[size] = '\0';
159 json = temp;
160 }
161 mode_ = Working;
162 }
163
164 return CYUTF8String(json, size);
165 }
166
167 static CYUTF8String Run(CYPool &pool, int client, const std::string &code) {
168 return Run(pool, client, CYUTF8String(code.c_str(), code.size()));
169 }
170
171 FILE *fout_;
172
173 static void Output(CYUTF8String json, FILE *fout, bool expand = false) {
174 const char *data(json.data);
175 size_t size(json.size);
176
177 if (data == NULL || fout == NULL)
178 return;
179
180 if (!expand || data[0] != '"' && data[0] != '\'')
181 fputs(data, fout);
182 else for (size_t i(0); i != size; ++i)
183 if (data[i] != '\\')
184 fputc(data[i], fout);
185 else switch(data[++i]) {
186 case '\0': goto done;
187 case '\\': fputc('\\', fout); break;
188 case '\'': fputc('\'', fout); break;
189 case '"': fputc('"', fout); break;
190 case 'b': fputc('\b', fout); break;
191 case 'f': fputc('\f', fout); break;
192 case 'n': fputc('\n', fout); break;
193 case 'r': fputc('\r', fout); break;
194 case 't': fputc('\t', fout); break;
195 case 'v': fputc('\v', fout); break;
196 default: fputc('\\', fout); --i; break;
197 }
198
199 done:
200 fputs("\n", fout);
201 fflush(fout);
202 }
203
204 static void Run(int client, const char *data, size_t size, FILE *fout = NULL, bool expand = false) {
205 CYPool pool;
206 Output(Run(pool, client, CYUTF8String(data, size)), fout, expand);
207 }
208
209 static void Run(int client, std::string &code, FILE *fout = NULL, bool expand = false) {
210 Run(client, code.c_str(), code.size(), fout, expand);
211 }
212
213 int (*append_history$)(int, const char *);
214
215 static std::string command_;
216
217 static CYExpression *ParseExpression(CYPool &pool, CYUTF8String code) {
218 std::ostringstream str;
219 str << '(' << code << ')';
220 std::string string(str.str());
221
222 CYDriver driver(pool);
223 driver.data_ = string.c_str();
224 driver.size_ = string.size();
225
226 cy::parser parser(driver);
227 Setup(driver, parser);
228
229 if (parser.parse() != 0 || !driver.errors_.empty())
230 _assert(false);
231
232 CYExpress *express(dynamic_cast<CYExpress *>(driver.program_->statements_));
233 _assert(express != NULL);
234 return express->expression_;
235 }
236
237 static int client_;
238
239 static char **Complete(const char *word, int start, int end) {
240 rl_attempted_completion_over = TRUE;
241
242 CYPool pool;
243
244 CYDriver driver(pool);
245 cy::parser parser(driver);
246 Setup(driver, parser);
247
248 std::string line(rl_line_buffer, start);
249 std::string command(command_ + line);
250
251 driver.data_ = command.c_str();
252 driver.size_ = command.size();
253
254 driver.auto_ = true;
255
256 if (parser.parse() != 0 || !driver.errors_.empty())
257 return NULL;
258
259 if (driver.mode_ == CYDriver::AutoNone)
260 return NULL;
261
262 CYExpression *expression;
263
264 CYOptions options;
265 CYContext context(driver.pool_, options);
266
267 std::ostringstream prefix;
268
269 switch (driver.mode_) {
270 case CYDriver::AutoPrimary:
271 expression = $ CYThis();
272 break;
273
274 case CYDriver::AutoDirect:
275 expression = driver.context_;
276 break;
277
278 case CYDriver::AutoIndirect:
279 expression = $ CYIndirect(driver.context_);
280 break;
281
282 case CYDriver::AutoMessage: {
283 CYDriver::Context &thing(driver.contexts_.back());
284 expression = $M($M($ CYIndirect(thing.context_), $S("isa")), $S("messages"));
285 for (CYDriver::Context::Words::const_iterator part(thing.words_.begin()); part != thing.words_.end(); ++part)
286 prefix << (*part)->word_ << ':';
287 } break;
288
289 default:
290 _assert(false);
291 }
292
293 std::string begin(prefix.str());
294
295 driver.program_ = $ CYProgram($ CYExpress($C3(ParseExpression(pool,
296 " function(object, prefix, word) {\n"
297 " var names = [];\n"
298 " var pattern = '^' + prefix + word;\n"
299 " var length = prefix.length;\n"
300 " for (name in object)\n"
301 " if (name.match(pattern) != null)\n"
302 " names.push(name.substr(length));\n"
303 " return names;\n"
304 " }\n"
305 ), expression, $S(begin.c_str()), $S(word))));
306
307 driver.program_->Replace(context);
308
309 std::ostringstream str;
310 CYOutput out(str, options);
311 out << *driver.program_;
312
313 std::string code(str.str());
314 CYUTF8String json(Run(pool, client_, code));
315
316 CYExpression *result(ParseExpression(pool, json));
317 CYArray *array(dynamic_cast<CYArray *>(result));
318
319 if (array == NULL) {
320 fprintf(fout_, "\n");
321 Output(json, fout_);
322 rl_forced_update_display();
323 return NULL;
324 }
325
326 // XXX: use an std::set?
327 typedef std::vector<std::string> Completions;
328 Completions completions;
329
330 std::string common;
331 bool rest(false);
332
333 for (CYElement *element(array->elements_); element != NULL; element = element->next_) {
334 CYString *string(dynamic_cast<CYString *>(element->value_));
335 _assert(string != NULL);
336
337 std::string completion(string->value_, string->size_);
338 completions.push_back(completion);
339
340 if (!rest) {
341 common = completion;
342 rest = true;
343 } else {
344 size_t limit(completion.size()), size(common.size());
345 if (size > limit)
346 common = common.substr(0, limit);
347 else
348 limit = size;
349 for (limit = 0; limit != size; ++limit)
350 if (common[limit] != completion[limit])
351 break;
352 if (limit != size)
353 common = common.substr(0, limit);
354 }
355 }
356
357 size_t count(completions.size());
358 if (count == 0)
359 return NULL;
360
361 if (!common.empty()) {
362 size_t size(prefix.str().size());
363 _assert(common.size() >= size);
364 common = common.substr(size);
365 }
366
367 size_t colon(common.find(':'));
368 if (colon != std::string::npos)
369 common = common.substr(0, colon + 1);
370 if (completions.size() == 1)
371 common += ' ';
372
373 char **results(reinterpret_cast<char **>(malloc(sizeof(char *) * (count + 2))));
374
375 results[0] = strdup(common.c_str());
376 size_t index(0);
377 for (Completions::const_iterator i(completions.begin()); i != completions.end(); ++i)
378 results[++index] = strdup(i->c_str());
379 results[count + 1] = NULL;
380
381 return results;
382 }
383
384 // need char *, not const char *
385 static char name_[] = "cycript";
386 static char break_[] = " \t\n\"\\'`@$><=;|&{(" ")}" ".:[]";
387
388 static void Console(apr_pool_t *pool, CYOptions &options) {
389 passwd *passwd;
390 if (const char *username = getenv("LOGNAME"))
391 passwd = getpwnam(username);
392 else
393 passwd = getpwuid(getuid());
394
395 const char *basedir(apr_psprintf(pool, "%s/.cycript", passwd->pw_dir));
396 const char *histfile(apr_psprintf(pool, "%s/history", basedir));
397 size_t histlines(0);
398
399 rl_initialize();
400 rl_readline_name = name_;
401
402 mkdir(basedir, 0700);
403 read_history(histfile);
404
405 bool bypass(false);
406 bool debug(false);
407 bool expand(false);
408
409 fout_ = stdout;
410
411 // rl_completer_word_break_characters is broken in libedit
412 rl_basic_word_break_characters = break_;
413
414 rl_completer_word_break_characters = break_;
415 rl_attempted_completion_function = &Complete;
416 rl_bind_key('\t', rl_complete);
417
418 struct sigaction action;
419 sigemptyset(&action.sa_mask);
420 action.sa_handler = &sigint;
421 action.sa_flags = 0;
422 sigaction(SIGINT, &action, NULL);
423
424 restart: for (;;) {
425 command_.clear();
426 std::vector<std::string> lines;
427
428 bool extra(false);
429 const char *prompt("cy# ");
430
431 if (setjmp(ctrlc_) != 0) {
432 mode_ = Working;
433 fputs("\n", fout_);
434 fflush(fout_);
435 goto restart;
436 }
437
438 read:
439 mode_ = Parsing;
440 char *line(readline(prompt));
441 mode_ = Working;
442 if (line == NULL)
443 break;
444 if (line[0] == '\0')
445 goto read;
446
447 if (!extra) {
448 extra = true;
449 if (line[0] == '?') {
450 std::string data(line + 1);
451 if (data == "bypass") {
452 bypass = !bypass;
453 fprintf(fout_, "bypass == %s\n", bypass ? "true" : "false");
454 fflush(fout_);
455 } else if (data == "debug") {
456 debug = !debug;
457 fprintf(fout_, "debug == %s\n", debug ? "true" : "false");
458 fflush(fout_);
459 } else if (data == "expand") {
460 expand = !expand;
461 fprintf(fout_, "expand == %s\n", expand ? "true" : "false");
462 fflush(fout_);
463 }
464 add_history(line);
465 ++histlines;
466 goto restart;
467 }
468 }
469
470 command_ += line;
471
472 char *begin(line), *end(line + strlen(line));
473 while (char *nl = reinterpret_cast<char *>(memchr(begin, '\n', end - begin))) {
474 *nl = '\0';
475 lines.push_back(begin);
476 begin = nl + 1;
477 }
478
479 lines.push_back(begin);
480
481 free(line);
482
483 std::string code;
484
485 if (bypass)
486 code = command_;
487 else {
488 CYDriver driver;
489 cy::parser parser(driver);
490 Setup(driver, parser);
491
492 driver.data_ = command_.c_str();
493 driver.size_ = command_.size();
494
495 if (parser.parse() != 0 || !driver.errors_.empty()) {
496 for (CYDriver::Errors::const_iterator error(driver.errors_.begin()); error != driver.errors_.end(); ++error) {
497 cy::position begin(error->location_.begin);
498 if (begin.line != lines.size() || begin.column - 1 != lines.back().size() || error->warning_) {
499 cy::position end(error->location_.end);
500
501 if (begin.line != lines.size()) {
502 std::cerr << " | ";
503 std::cerr << lines[begin.line - 1] << std::endl;
504 }
505
506 std::cerr << "....";
507 for (size_t i(0); i != begin.column - 1; ++i)
508 std::cerr << '.';
509 if (begin.line != end.line || begin.column == end.column)
510 std::cerr << '^';
511 else for (size_t i(0), e(end.column - begin.column); i != e; ++i)
512 std::cerr << '^';
513 std::cerr << std::endl;
514
515 std::cerr << " | ";
516 std::cerr << error->message_ << std::endl;
517
518 add_history(command_.c_str());
519 ++histlines;
520 goto restart;
521 }
522 }
523
524 driver.errors_.clear();
525
526 command_ += '\n';
527 prompt = "cy> ";
528 goto read;
529 }
530
531 if (driver.program_ == NULL)
532 goto restart;
533
534 if (client_ != -1)
535 code = command_;
536 else {
537 std::ostringstream str;
538 CYOutput out(str, options);
539 Setup(out, driver, options);
540 out << *driver.program_;
541 code = str.str();
542 }
543 }
544
545 add_history(command_.c_str());
546 ++histlines;
547
548 if (debug)
549 std::cout << code << std::endl;
550
551 Run(client_, code, fout_, expand);
552 }
553
554 if (append_history$ != NULL) {
555 _syscall(close(_syscall(open(histfile, O_CREAT | O_WRONLY, 0600))));
556 (*append_history$)(histlines, histfile);
557 } else {
558 write_history(histfile);
559 }
560
561 fputs("\n", fout_);
562 fflush(fout_);
563 }
564
565 static void *Map(const char *path, size_t *psize) {
566 int fd;
567 _syscall(fd = open(path, O_RDONLY));
568
569 struct stat stat;
570 _syscall(fstat(fd, &stat));
571 size_t size(stat.st_size);
572
573 *psize = size;
574
575 void *base;
576 _syscall(base = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0));
577
578 _syscall(close(fd));
579 return base;
580 }
581
582 void InjectLibrary(pid_t pid);
583
584 int Main(int argc, char const * const argv[], char const * const envp[]) {
585 bool tty(isatty(STDIN_FILENO));
586 bool compile(false);
587 CYOptions options;
588
589 append_history$ = reinterpret_cast<int (*)(int, const char *)>(dlsym(RTLD_DEFAULT, "append_history"));
590
591 #ifdef CY_ATTACH
592 pid_t pid(_not(pid_t));
593 #endif
594
595 CYPool pool;
596 apr_getopt_t *state;
597 _aprcall(apr_getopt_init(&state, pool, argc, argv));
598
599 for (;;) {
600 char opt;
601 const char *arg;
602
603 apr_status_t status(apr_getopt(state,
604 "cg:n:"
605 #ifdef CY_ATTACH
606 "p:"
607 #endif
608 "s"
609 , &opt, &arg));
610
611 switch (status) {
612 case APR_EOF:
613 goto getopt;
614 case APR_BADCH:
615 case APR_BADARG:
616 fprintf(stderr,
617 "usage: cycript [-c]"
618 #ifdef CY_ATTACH
619 " [-p <pid|name>]"
620 #endif
621 " [<script> [<arg>...]]\n"
622 );
623 return 1;
624 default:
625 _aprcall(status);
626 }
627
628 switch (opt) {
629 case 'c':
630 compile = true;
631 break;
632
633 case 'g':
634 if (false);
635 else if (strcmp(arg, "rename") == 0)
636 options.verbose_ = true;
637 #if YYDEBUG
638 else if (strcmp(arg, "bison") == 0)
639 bison_ = true;
640 #endif
641 else {
642 fprintf(stderr, "invalid name for -g\n");
643 return 1;
644 }
645 break;
646
647 case 'n':
648 if (false);
649 else if (strcmp(arg, "minify") == 0)
650 pretty_ = true;
651 else {
652 fprintf(stderr, "invalid name for -n\n");
653 return 1;
654 }
655 break;
656
657 #ifdef CY_ATTACH
658 case 'p': {
659 size_t size(strlen(arg));
660 char *end;
661
662 pid = strtoul(arg, &end, 0);
663 if (arg + size != end) {
664 // XXX: arg needs to be escaped in some horrendous way of doom
665 const char *command(apr_psprintf(pool, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", arg));
666
667 if (FILE *pids = popen(command, "r")) {
668 char value[32];
669 size = 0;
670
671 for (;;) {
672 size_t read(fread(value + size, 1, sizeof(value) - size, pids));
673 if (read == 0)
674 break;
675 else {
676 size += read;
677 if (size == sizeof(value)) {
678 pid = _not(pid_t);
679 goto fail;
680 }
681 }
682 }
683
684 size:
685 if (size == 0)
686 goto fail;
687 if (value[size - 1] == '\n') {
688 --size;
689 goto size;
690 }
691
692 value[size] = '\0';
693 size = strlen(value);
694 pid = strtoul(value, &end, 0);
695 if (value + size != end) fail:
696 pid = _not(pid_t);
697 _syscall(pclose(pids));
698 }
699
700 if (pid == _not(pid_t)) {
701 fprintf(stderr, "invalid pid for -p\n");
702 return 1;
703 }
704 }
705 } break;
706 #endif
707
708 case 's':
709 strict_ = true;
710 break;
711 }
712 } getopt:;
713
714 const char *script;
715 int ind(state->ind);
716
717 #ifdef CY_ATTACH
718 if (pid != _not(pid_t) && ind < argc - 1) {
719 fprintf(stderr, "-p cannot set argv\n");
720 return 1;
721 }
722
723 if (pid != _not(pid_t) && compile) {
724 fprintf(stderr, "-p conflicts with -c\n");
725 return 1;
726 }
727 #endif
728
729 if (ind == argc)
730 script = NULL;
731 else {
732 #ifdef CY_EXECUTE
733 // XXX: const_cast?! wtf gcc :(
734 CYSetArgs(argc - ind - 1, const_cast<const char **>(argv + ind + 1));
735 #endif
736 script = argv[ind];
737 if (strcmp(script, "-") == 0)
738 script = NULL;
739 }
740
741 #ifdef CY_ATTACH
742 if (pid != _not(pid_t) && script == NULL && !tty) {
743 fprintf(stderr, "non-terminal attaching to remote console\n");
744 return 1;
745 }
746 #endif
747
748 #ifdef CY_ATTACH
749 if (pid == _not(pid_t))
750 client_ = -1;
751 else {
752 int server(_syscall(socket(PF_UNIX, SOCK_STREAM, 0))); try {
753 struct sockaddr_un address;
754 memset(&address, 0, sizeof(address));
755 address.sun_family = AF_UNIX;
756
757 sprintf(address.sun_path, "/tmp/.s.cy.%u", getpid());
758
759 _syscall(bind(server, reinterpret_cast<sockaddr *>(&address), SUN_LEN(&address)));
760 _syscall(chmod(address.sun_path, 0777));
761
762 try {
763 _syscall(listen(server, 1));
764 InjectLibrary(pid);
765 client_ = _syscall(accept(server, NULL, NULL));
766 } catch (...) {
767 // XXX: exception?
768 unlink(address.sun_path);
769 throw;
770 }
771 } catch (...) {
772 _syscall(close(server));
773 throw;
774 }
775 }
776 #else
777 client_ = -1;
778 #endif
779
780 if (script == NULL && tty)
781 Console(pool, options);
782 else {
783 CYDriver driver(pool, script ?: "<stdin>");
784 cy::parser parser(driver);
785 Setup(driver, parser);
786
787 char *start, *end;
788
789 if (script == NULL) {
790 start = NULL;
791 end = NULL;
792
793 driver.file_ = stdin;
794 } else {
795 size_t size;
796 start = reinterpret_cast<char *>(Map(script, &size));
797 end = start + size;
798
799 if (size >= 2 && start[0] == '#' && start[1] == '!') {
800 start += 2;
801
802 if (void *line = memchr(start, '\n', end - start))
803 start = reinterpret_cast<char *>(line);
804 else
805 start = end;
806 }
807
808 driver.data_ = start;
809 driver.size_ = end - start;
810 }
811
812 if (parser.parse() != 0 || !driver.errors_.empty()) {
813 for (CYDriver::Errors::const_iterator i(driver.errors_.begin()); i != driver.errors_.end(); ++i)
814 std::cerr << i->location_.begin << ": " << i->message_ << std::endl;
815 } else if (driver.program_ != NULL)
816 if (client_ != -1) {
817 std::string code(start, end-start);
818 Run(client_, code, stdout);
819 } else {
820 std::ostringstream str;
821 CYOutput out(str, options);
822 Setup(out, driver, options);
823 out << *driver.program_;
824 std::string code(str.str());
825 if (compile)
826 std::cout << code;
827 else
828 Run(client_, code, stdout);
829 }
830 }
831
832 return 0;
833 }
834
835 int main(int argc, char const * const argv[], char const * const envp[]) {
836 apr_status_t status(apr_app_initialize(&argc, &argv, &envp));
837
838 if (status != APR_SUCCESS) {
839 fprintf(stderr, "apr_app_initialize() != APR_SUCCESS\n");
840 return 1;
841 } else try {
842 return Main(argc, argv, envp);
843 } catch (const CYException &error) {
844 CYPool pool;
845 fprintf(stderr, "%s\n", error.PoolCString(pool));
846 return 1;
847 }
848 }