1 /* Copyright (C) 2011 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
30 dhansen@localhorst ~/tmp $ ./a.out
40 inner_main (void *data
, int argc
, char **argv
)
44 SCM string
, tokens
, tok
;
46 string
= scm_from_latin1_string ("foo,bar");
47 tokens
= scm_string_split (string
, SCM_MAKE_CHAR (','));
49 TEST (scm_is_pair (tokens
));
50 tok
= scm_car (tokens
);
51 TEST (scm_is_string (tok
));
52 cstr
= scm_to_latin1_string (tok
);
53 TEST (strcmp (cstr
, "foo") == 0);
55 tokens
= scm_cdr (tokens
);
57 TEST (scm_is_pair (tokens
));
58 tok
= scm_car (tokens
);
59 TEST (scm_is_string (tok
));
60 cstr
= scm_to_latin1_string (tok
);
61 TEST (strcmp (cstr
, "bar") == 0);
63 tokens
= scm_cdr (tokens
);
65 TEST (scm_is_null (tokens
));
69 main (int argc
, char **argv
)
71 scm_boot_guile (argc
, argv
, inner_main
, NULL
);
76 /* Local Variables: */
77 /* compile-command: "gcc `pkg-config --cflags --libs guile-2.0` main.c" */