- if (String (output_global_ch) == "scm")
- {
-#if 1
- /*
- we'd rather use C++ i/o iso Guile's, but how?
- and: they can't be mixed (or synchronised) easily?
- */
-
- // urg
- if (!port)
- {
- int fd = 1;
- ofstream * of = dynamic_cast<ofstream*> (outstream_l_->os);
- if (of)
- fd = of->rdbuf()->fd();
- FILE *file = fdopen (fd, "a");
- port = scm_standard_stream_to_port (file, "a", "");
- scm_display (gh_str02scm (
- "(primitive-load-path 'lily.scm)\n"
- "(eval (tex-scm 'all-definitions))\n"
- ";(eval (ps-scm 'all-definitions))\n"
- "(display (map (lambda (x) (string-append (eval x) \"%\\n\")) '(\n"
- ), port);
- }
-
- scm_write (scm, port);
- // duh
- scm_display (gh_str02scm ("\n"), port);
- scm_fflush (port);
-#else
- static bool first = true;
- if (first)
- {
- *outstream_l_->os << ""
- "(primitive-load-path 'lily.scm)\n"
- "(eval (tex-scm 'all-definitions))\n"
- ";(eval (ps-scm 'all-definitions))\n"
- "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n"
- ;
- }
-
- /*
- why doesn't this work?
-
- ERROR: In procedure gh_scm2newstr:
- ERROR: Wrong type argument in position 3:
- (header "GNU LilyPond 1.1.49.jcn1" ", at Tue Jun 22 20:58:17 1999")
-
- or:
-
- ERROR: In procedure symbol->string:
- ERROR: Wrong type argument in position 1:
- (header "GNU LilyPond 1.1.49.jcn2" ", at Wed Jun 23 18:42:14 1999")
-
- eg, two ways to print '(foo bar)'
-
- SCM scm = gh_list (ly_symbol ("foo"), gh_str2scm ("bar"), SCM_UNDEFINED);
- scm_write (scm, port);
- puts (gh_xxx2newstr (scm, 0));
- */
-
- char* p;
- //p = gh_scm2newstr (scm, 0);
- //p = gh_symbol2newstr (scm, 0);
- //p = gh_scm2newstr (scm_symbol_to_string (scm), 0);
- //p = gh_symbol2newstr (scm_symbol_to_string (scm), 0);
- //*outstream_l_->os << p << endl;
- *outstream_l_->os << symbol_to_string (scm) << endl;
-#endif
- }
- else
- {
- SCM result = scm_eval (scm);
- char *c=gh_scm2newstr (result, NULL);
-
- *outstream_l_ << c;
- free (c);
- }