]> git.donarmstrong.com Git - lilypond.git/blob - lily/lily-guile.cc
* input/regression/accidental-piano.ly (Module): new file.
[lilypond.git] / lily / lily-guile.cc
1 /*
2   lily-guile.cc -- implement assorted guile functions
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
7                  Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
9
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <libintl.h>            // gettext on macos x
14 #include <math.h>   /* isinf */
15 #include <string.h> /* strdup, strchr */
16 #include <ctype.h>
17
18 #include "lily-proto.hh"
19 #include "version.hh"
20
21 /* MacOS S fix:
22    source-file.hh includes cmath which undefines isinf and isnan
23
24    FIXME: #ifdef MACOS_X?
25 */
26 inline int my_isinf (Real r) { return isinf (r); }
27 inline int my_isnan (Real r) { return isnan (r); }
28
29
30 #include "libc-extension.hh"
31 #include "lily-guile.hh"
32 #include "main.hh"
33 #include "file-path.hh"
34 #include "warn.hh"
35 #include "direction.hh"
36 #include "offset.hh"
37 #include "interval.hh"
38 #include "pitch.hh"
39 #include "dimensions.hh"
40 #include "source-file.hh"
41
42 // #define TEST_GC
43
44 SCM
45 ly_last (SCM list)
46 {
47   return ly_car (scm_last_pair (list));
48 }
49
50
51 SCM
52 ly_write2scm (SCM s)
53 {
54   SCM port = scm_mkstrport (SCM_INUM0, 
55                             scm_make_string (SCM_INUM0, SCM_UNDEFINED),
56                             SCM_OPN | SCM_WRTNG,
57                             "ly_write2string");
58   //  SCM write = scm_eval_3 (ly_symbol2scm ("write"), s, SCM_EOL);
59   SCM write = scm_primitive_eval (ly_symbol2scm ("write"));
60   
61   // scm_apply (write, port, SCM_EOL);
62   scm_call_2 (write, s, port);
63   return scm_strport_to_string (port);
64 }
65
66
67 SCM
68 ly_quote_scm (SCM s)
69 {
70   return scm_list_n (ly_symbol2scm ("quote"), s, SCM_UNDEFINED);
71 }
72
73 String
74 ly_symbol2string (SCM s)
75 {
76   /*
77     Ugh. this is not very efficient.
78    */
79   SCM str = scm_symbol_to_string (s);
80   return ly_scm2string (str);
81 }
82
83 String
84 gulp_file_to_string (String fn)
85 {
86   String s = global_path.find (fn);
87   if (s == "")
88     {
89       String e = _f ("can't find file: `%s'", fn);
90       e += " ";
91       e += _f ("(load path: `%s')", global_path.to_string ());
92       error (e);
93     }
94   else if (verbose_global_b)
95     progress_indication ("[" + s);
96
97   int n;
98   char * str = gulp_file (s, &n);
99   String result (str);
100   delete[] str;
101   
102   if (verbose_global_b)
103     progress_indication ("]");
104
105   return result;
106 }
107
108 LY_DEFINE (ly_gulp_file, "ly:gulp-file",
109            1, 0, 0, (SCM name),
110            "Read the file @var{name}, and return its contents in a string.  "
111            "The file is looked up using the search path.")
112 {
113   SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
114   return scm_makfrom0str (gulp_file_to_string (ly_scm2string (name)).to_str0 ());
115 }
116
117
118 extern "C" {
119   // maybe gdb 5.0 becomes quicker if it doesn't do fancy C++ typing?
120 void
121 ly_display_scm (SCM s)
122 {
123   scm_display (s, scm_current_output_port ());
124   scm_newline (scm_current_output_port ());
125 }
126 };
127
128 String
129 ly_scm2string (SCM str)
130 {
131   return String ((Byte*)scm_i_string_chars (str),
132                  (int) scm_i_string_length (str));
133 }
134
135 char *
136 ly_scm2newstr (SCM str, size_t *lenp)
137 {
138   SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
139
140   size_t len = SCM_STRING_LENGTH (str);
141   if (char *new_str = (char *) malloc ((len + 1) * sizeof (char)))
142     {
143       memcpy (new_str, scm_i_string_chars (str), len);
144       new_str[len] = '\0';
145
146       if (lenp)
147         *lenp = len;
148       
149       return new_str;
150     }
151   return 0;
152 }
153
154 SCM
155 index_get_cell (SCM s, Direction d)
156 {
157   
158   assert (d);
159   return (d == LEFT) ? ly_car (s) : ly_cdr (s);
160 }
161
162 SCM
163 index_set_cell (SCM s, Direction d, SCM v)
164 {
165   if (d == LEFT)
166     scm_set_car_x (s, v);
167   else if (d == RIGHT)
168     scm_set_cdr_x (s, v);
169   return s;
170 }
171   
172 LY_DEFINE (ly_warn, "ly:warn",
173            1, 0, 1, (SCM str, SCM rest),
174            "Scheme callable function to issue the warning @code{msg}. "
175            "The message is formatted with @code{format} and @code{rest}.")
176 {
177   SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
178   progress_indication ("\n");
179
180   str = scm_simple_format (SCM_BOOL_F, str, rest);
181   warning ("lily-guile: " + ly_scm2string (str));
182   return SCM_UNSPECIFIED;
183 }
184
185 LY_DEFINE (ly_programming_error, "ly:programming-error",
186            1, 0, 1, (SCM str, SCM rest),
187            "Scheme callable function to issue the warning @code{msg}. "
188            "The message is formatted with @code{format} and @code{rest}.")
189 {
190   SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
191   progress_indication ("\n");
192
193   str = scm_simple_format (SCM_BOOL_F, str, rest);
194   programming_error (ly_scm2string (str));
195   return SCM_UNSPECIFIED;
196 }
197
198 LY_DEFINE (ly_dir_p, "ly:dir?",
199            1, 0, 0, (SCM s),
200           "type predicate. A direction is @code{-1}, @code{0} or "
201            "@code{1}, where @code{-1} represents "
202           "left or down and @code{1} represents right or up.")
203 {
204   if (scm_is_number (s))
205     {
206       int i = scm_to_int (s);
207       return (i>= -1 && i <= 1)  ? SCM_BOOL_T : SCM_BOOL_F; 
208     }
209   return SCM_BOOL_F;
210 }
211
212 bool
213 is_number_pair (SCM p)
214 {
215   return ly_c_pair_p (p)
216     && scm_is_number (ly_car (p)) && scm_is_number (ly_cdr (p));
217 }
218
219 typedef void (*Void_fptr) ();
220 Array<Void_fptr> *scm_init_funcs_;
221
222 void add_scm_init_func (void (*f) ())
223 {
224   if (!scm_init_funcs_)
225     scm_init_funcs_ = new Array<Void_fptr>;
226
227   scm_init_funcs_->push (f);
228 }
229
230 void
231 ly_init_ly_module (void *)
232 {
233   for (int i=scm_init_funcs_->size () ; i--;)
234     (scm_init_funcs_->elem (i)) ();
235
236   if (verbose_global_b)
237     progress_indication ("\n");
238   
239   scm_primitive_load_path (scm_makfrom0str ("lily.scm"));
240 }
241
242 SCM global_lily_module;
243
244 void
245 ly_c_init_guile ()
246 {
247   global_lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0);
248   scm_c_use_module ("lily");
249 }
250
251 unsigned int
252 ly_scm_hash (SCM s)
253 {
254   return scm_ihashv (s, ~1u);
255 }
256
257 bool
258 is_direction (SCM s)
259 {
260   if (scm_is_number (s))
261     {
262       int i = scm_to_int (s);
263       return i>= -1 && i <= 1; 
264     }
265   return false;
266 }
267
268 LY_DEFINE(ly_assoc_get, "ly:assoc-get",
269           2, 1, 0,
270           (SCM key, SCM alist, SCM default_value),
271           "Return value if KEY in ALIST, else DEFAULT-VALUE (or #f if not specified).")
272 {
273   SCM handle = scm_assoc (key, alist);
274
275   if (default_value == SCM_UNDEFINED)
276     default_value = SCM_BOOL_F;
277   
278   if (ly_c_pair_p (handle))
279     return ly_cdr (handle);
280   else
281     return default_value;
282 }
283
284 bool
285 is_axis (SCM s)
286 {
287   if (scm_is_number (s))
288     {
289       int i = scm_to_int (s);
290       return i== 0 || i == 1;
291     }
292   return false;
293 }
294
295 Direction
296 to_dir (SCM s)
297 {
298   return scm_is_integer (s) ? (Direction) scm_to_int (s) : CENTER;
299 }
300
301 Interval
302 ly_scm2interval (SCM p)
303 {
304   return Interval (scm_to_double (ly_car (p)), scm_to_double (ly_cdr (p)));
305 }
306
307 Drul_array<Real>
308 ly_scm2realdrul (SCM p)
309 {
310   return Drul_array<Real> (scm_to_double (ly_car (p)),
311                            scm_to_double (ly_cdr (p)));
312 }
313
314 SCM
315 ly_interval2scm (Drul_array<Real> i)
316 {
317   return scm_cons (scm_make_real (i[LEFT]), scm_make_real (i[RIGHT]));
318 }
319
320 bool
321 to_boolean (SCM s)
322 {
323   return scm_is_bool (s) && ly_scm2bool (s);
324 }
325
326 /* Appendable list L: the cdr contains the list, the car the last cons
327    in the list.  */
328 SCM
329 appendable_list ()
330 {
331   SCM s = scm_cons (SCM_EOL, SCM_EOL);
332   scm_set_car_x (s, s);
333   
334   return s;
335 }
336
337 void
338 appendable_list_append (SCM l, SCM elt)
339 {
340   SCM newcons = scm_cons (elt, SCM_EOL);
341   
342   scm_set_cdr_x (ly_car (l), newcons);      
343   scm_set_car_x (l, newcons);
344 }
345
346 SCM
347 ly_offset2scm (Offset o)
348 {
349   return scm_cons (scm_make_real (o[X_AXIS]), scm_make_real (o[Y_AXIS]));
350 }
351
352 Offset
353 ly_scm2offset (SCM s)
354 {
355   return Offset (scm_to_double (ly_car (s)),
356                  scm_to_double (ly_cdr (s)));
357 }
358
359 LY_DEFINE (ly_number2string, "ly:number->string",
360            1, 0, 0, (SCM s),
361            "Convert @var{num} to a string without generating many decimals.")
362 {
363   SCM_ASSERT_TYPE (scm_is_number (s), s, SCM_ARG1, __FUNCTION__, "number");
364
365   char str[400];                        // ugh.
366
367   if (scm_exact_p (s) == SCM_BOOL_F)
368     {
369       Real r (scm_to_double (s));
370
371       if (my_isinf (r) || my_isnan (r))
372         {
373           programming_error ("Infinity or NaN encountered while converting Real number; setting to zero.");
374           r = 0.0;
375         }
376
377       sprintf (str, "%08.4f", r);
378     }
379   else
380     sprintf (str, "%d", scm_to_int (s));
381
382   return scm_makfrom0str (str);
383 }
384
385
386
387 LY_DEFINE (ly_version,  "ly:version", 0, 0, 0, (),
388           "Return the current lilypond version as a list, e.g. @code{(1 3 127 uu1)}. ")
389 {
390   char const* vs = "\'(" MAJOR_VERSION " " MINOR_VERSION " "  PATCH_LEVEL " " MY_PATCH_LEVEL ")" ;
391   
392   return scm_c_eval_string ((char*)vs);
393 }
394
395 LY_DEFINE (ly_unit,  "ly:unit", 0, 0, 0, (),
396           "Return the unit used for lengths as a string.")
397 {
398   return scm_makfrom0str (INTERNAL_UNIT);
399 }
400
401
402
403 LY_DEFINE (ly_dimension_p,  "ly:dimension?", 1, 0, 0, (SCM d),
404           "Return @var{d} is a number. Used to distinguish length "
405           "variables from normal numbers.")
406 {
407   return scm_number_p (d);
408 }
409
410 SCM
411 ly_deep_copy (SCM src)
412 {
413   if (ly_c_pair_p (src))
414     return scm_cons (ly_deep_copy (ly_car (src)), ly_deep_copy (ly_cdr (src)));
415   else if (ly_c_vector_p (src))
416     {
417       int len = SCM_VECTOR_LENGTH (src);
418       SCM nv = scm_c_make_vector (len, SCM_UNDEFINED);
419       for (int i  =0 ; i < len ; i++)
420         {
421           SCM si = scm_int2num (i);
422           scm_vector_set_x (nv, si, ly_deep_copy (scm_vector_ref (src, si))); 
423         }
424     }
425   return src;
426 }
427
428
429
430
431 SCM
432 ly_assoc_chain (SCM key, SCM achain)
433 {
434   if (ly_c_pair_p (achain))
435     {
436       SCM handle = scm_assoc (key, ly_car (achain));
437       if (ly_c_pair_p (handle))
438         return handle;
439       else
440         return ly_assoc_chain (key, ly_cdr (achain));
441     }
442   else
443     return SCM_BOOL_F;
444 }
445
446 /* looks the key up in the cdrs of the alist-keys
447    - ignoring the car and ignoring non-pair keys.
448    Returns first match found, i.e.
449
450    alist = ((1 . 10)
451                    ((1 . 2) . 11)
452                    ((2 . 1) . 12)
453                    ((3 . 0) . 13)
454                    ((4 . 1) . 14) )
455
456 I would like (ly_assoc_cdr 1) to return 12 - because it's the first
457 element with the cdr of the key = 1.  In other words (alloc_cdr key)
458 corresponds to call
459
460 (alloc (anything . key))
461
462
463
464 */
465 SCM
466 ly_assoc_cdr (SCM key, SCM alist)
467 {
468   if (ly_c_pair_p (alist))
469     {
470       SCM trykey = ly_caar (alist);
471       if (ly_c_pair_p (trykey) && to_boolean (scm_equal_p (key, ly_cdr (trykey))))
472         return ly_car (alist);
473       else
474         return ly_assoc_cdr (key, ly_cdr (alist));
475     }
476   return SCM_BOOL_F;
477 }
478
479 /* LST has the form "sym1 sym2 sym3\nsym4\nsym5"
480    i.e. \n and ' ' can be used interchangeably as separators.  */
481 SCM
482 parse_symbol_list (char const *lst)
483 {
484   char *s = strdup (lst);
485   char *orig = s;
486   SCM create_list = SCM_EOL;
487
488   char * e = s + strlen (s) - 1;
489   while (e >= s && isspace (*e))
490     *e-- = 0;
491
492   for (char * p = s; *p; p++)
493     if (*p == '\n')
494       *p = ' ';
495   
496   if (!s[0])
497     s = 0;
498   
499   while (s)
500     {
501       char *next = strchr (s, ' ');
502       if (next)
503         *next++ = 0;
504
505       create_list = scm_cons (ly_symbol2scm (s), create_list);
506       s = next;
507     }
508
509   free (orig);
510   return create_list;
511 }
512
513 SCM
514 ly_truncate_list (int k, SCM lst)
515 {
516   if (k == 0)
517     lst = SCM_EOL;
518   else
519     {
520       SCM s = lst;
521       k--;
522       for (; ly_c_pair_p (s) && k--; s = ly_cdr (s))
523         ;
524
525       if (ly_c_pair_p (s))
526         scm_set_cdr_x (s, SCM_EOL);
527     }
528   return lst;
529 }
530
531 String
532 print_scm_val (SCM val)
533 {
534   String realval = ly_scm2string (ly_write2scm (val));
535   if (realval.length () > 200)
536     realval = realval.left_string (100)
537       + "\n :\n :\n"
538       + realval.right_string (100);
539   return realval;        
540 }
541
542 bool
543 type_check_assignment (SCM sym, SCM val,  SCM type_symbol) 
544 {
545   bool ok = true;
546
547   /*
548     Always succeeds.
549
550
551     TODO: should remove #f from allowed vals?
552    */
553   if (val == SCM_EOL || val == SCM_BOOL_F)
554     return ok;
555
556   if (!scm_is_symbol (sym))
557 #if 0
558     return false;
559 #else
560   /*
561     This is used for autoBeamSettings.
562
563     TODO: deprecate the use of \override and \revert for
564     autoBeamSettings?
565
566     or use a symbol autoBeamSettingS?  
567    */
568   return true; 
569 #endif
570   
571   SCM type = scm_object_property (sym, type_symbol);
572
573   if (type != SCM_EOL && !ly_c_procedure_p (type))
574       {
575         warning (_f ("Can't find property type-check for `%s' (%s).",
576                      ly_symbol2string (sym).to_str0 (),
577                      ly_symbol2string (type_symbol).to_str0 ())
578                  + "  " + _ ("Perhaps you made a typing error?"));
579
580         /* Be strict when being anal :) */
581         if (internal_type_checking_global_b)
582           abort ();
583         
584         warning (_ ("Doing assignment anyway."));
585       }
586   else
587     {
588       if (val != SCM_EOL
589           && ly_c_procedure_p (type)
590           && scm_call_1 (type, val) == SCM_BOOL_F)
591         {
592           SCM errport = scm_current_error_port ();
593           ok = false;
594           SCM typefunc = ly_scheme_function ("type-name");
595           SCM type_name = scm_call_1 (typefunc, type);
596
597          
598           scm_puts (_f ("Type check for `%s' failed; value `%s' must be of type `%s'",
599                         ly_symbol2string (sym).to_str0 (),
600                         print_scm_val (val),
601                         ly_scm2string (type_name).to_str0 ()).to_str0 (),
602                     errport);
603           scm_puts ("\n", errport);                   
604         }
605     }
606   return ok;
607 }
608
609
610 /* some SCM abbrevs
611
612    zijn deze nou handig?
613    zijn ze er al in scheme, maar heten ze anders? */
614
615
616 /* Remove doubles from (sorted) list */
617 SCM
618 ly_unique (SCM list)
619 {
620   SCM unique = SCM_EOL;
621   for (SCM i = list; ly_c_pair_p (i); i = ly_cdr (i))
622     {
623       if (!ly_c_pair_p (ly_cdr (i))
624           || !ly_c_equal_p (ly_car (i), ly_cadr (i)))
625         unique = scm_cons (ly_car (i), unique);
626     }
627   return scm_reverse_x (unique, SCM_EOL);
628 }
629
630
631 static int
632 scm_default_compare (void const *a, void const *b)
633 {
634   SCM pa = *(SCM*) a;
635   SCM pb = *(SCM*) b;
636   if (pa == pb)
637     return 0;
638   return pa < pb ? -1 : 1;
639 }
640
641 /*  Modify LST in place: qsort it.  */
642 SCM
643 ly_list_qsort_uniq_x (SCM lst)
644 {
645   int len = scm_ilength (lst);
646   SCM *arr = new SCM[len];
647   int k = 0;
648   for (SCM s = lst; SCM_NNULLP (s); s = SCM_CDR (s))
649     arr[k++] = SCM_CAR (s);
650
651   assert (k == len);
652   qsort (arr, len, sizeof (SCM), &scm_default_compare);
653
654   SCM *tail = &lst;
655   for (int i = 0; i < len; i++)
656     if (!i || arr[i] != arr[i - 1])
657       {
658         SCM_SETCAR (*tail, arr[i]);
659         tail = SCM_CDRLOC (*tail);
660       }
661
662   *tail = SCM_EOL;
663   delete[] arr;
664
665   return lst; 
666 }
667
668
669 /* tail add */
670 SCM
671 ly_snoc (SCM s, SCM list)
672 {
673   return ly_append2 (list, scm_list_n (s, SCM_UNDEFINED));
674 }
675
676 /* Split list at member s, removing s.
677    Return (BEFORE . AFTER)  */
678 SCM
679 ly_split_list (SCM s, SCM list)
680 {
681   SCM before = SCM_EOL;
682   SCM after = list;
683   for (; ly_c_pair_p (after);)
684     {
685       SCM i = ly_car (after);
686       after = ly_cdr (after);
687       if (ly_c_equal_p (i, s))
688         break;
689       before = scm_cons (i, before);
690     }
691   return scm_cons ( scm_reverse_x (before, SCM_EOL),  after);
692   
693 }
694
695
696 void
697 taint (SCM *)
698 {
699   /*
700     nop.
701    */
702 }
703
704 /*
705   display stuff without using stack
706  */
707 SCM
708 display_list (SCM s)
709 {
710   SCM p = scm_current_output_port ();
711
712   scm_puts ("(", p);
713   for (; ly_c_pair_p (s); s =ly_cdr (s))
714     {
715       scm_display (ly_car (s), p);
716       scm_puts (" ", p);      
717     }
718   scm_puts (")", p);
719   return SCM_UNSPECIFIED;
720 }
721
722 Slice
723 int_list_to_slice (SCM l)
724 {
725   Slice s;
726   s.set_empty ();
727   for (; ly_c_pair_p (l); l = ly_cdr (l))
728     if (scm_is_number (ly_car (l)))
729       s.add_point (scm_to_int (ly_car (l))); 
730   return s;
731 }
732
733 /* Return I-th element, or last elt L. If I < 0, then we take the first
734    element.
735    
736    PRE: length (L) > 0  */
737 SCM
738 robust_list_ref (int i, SCM l)
739 {
740   while (i-- > 0 && ly_c_pair_p (ly_cdr (l)))
741     l = ly_cdr (l);
742   return ly_car (l);
743 }
744
745 Real
746 robust_scm2double (SCM k, double x)
747 {
748   if (scm_is_number (k))
749     x = scm_to_double (k);
750   return x;
751 }
752
753 Interval
754 robust_scm2interval (SCM k, Drul_array<Real> v)
755 {
756   Interval i;
757   i[LEFT]= v[LEFT];
758   i[RIGHT]= v[RIGHT];
759   if (is_number_pair (k))
760     i = ly_scm2interval (k);
761   return i;
762 }
763
764 Drul_array<Real>
765 robust_scm2drul (SCM k, Drul_array<Real> v)
766 {
767   if (is_number_pair (k))
768     v = ly_scm2interval (k);
769   return v;
770 }
771
772 Offset
773 robust_scm2offset (SCM k, Offset o)
774 {
775   if (is_number_pair (k))
776     o = ly_scm2offset (k);
777   return o;
778 }
779
780 int
781 robust_scm2int (SCM k, int o)
782 {
783   if (scm_integer_p (k) == SCM_BOOL_T)
784     o = scm_to_int (k);
785   return o;
786 }
787
788 SCM
789 alist_to_hashq (SCM alist)
790 {
791   int i = scm_ilength (alist);
792   if (i < 0)
793     return scm_c_make_hash_table (0);
794           
795   SCM tab = scm_c_make_hash_table (i);
796   for (SCM s = alist; ly_c_pair_p (s); s = ly_cdr (s))
797     {
798       SCM pt = ly_cdar (s);
799       scm_hashq_set_x (tab, ly_caar (s), pt);
800     }
801   return tab; 
802 }
803
804 #if 1
805 /*
806   Debugging mem leaks:
807  */
808 LY_DEFINE (ly_protects, "ly:protects",
809            0, 0, 0, (),
810           "Return hash of protected objects.")
811 {
812   return scm_protects;
813 }
814 #endif
815
816
817 #if HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC
818
819 #include "pangofc-afm-decoder.hh"
820
821 LY_DEFINE (ly_pango_add_afm_decoder, "ly:pango-add-afm-decoder",
822            1, 0, 0, (SCM font_family),
823            "Add pango afm decoder for FONT-FAMILY.")
824 {
825   SCM_ASSERT_TYPE (scm_is_string (font_family), font_family, SCM_ARG1,
826                    __FUNCTION__, "font_family");
827   pango_fc_afm_add_decoder (ly_scm2newstr (font_family, 0));
828   return SCM_UNSPECIFIED;
829 }
830
831 #endif
832
833 LY_DEFINE (ly_gettext, "ly:gettext",
834            1, 0, 0, (SCM string),
835            "Gettext wrapper.")
836 {
837   SCM_ASSERT_TYPE (scm_is_string (string), string, SCM_ARG1,
838                    __FUNCTION__, "string");
839   return scm_makfrom0str (gettext (scm_i_string_chars (string)));
840 }
841