aboutsummaryrefslogtreecommitdiff
path: root/gconf/gconf-lex.l
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-03-11 12:35:52 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-03-11 12:36:26 +0200
commit43e8d1ad415cd8af7f56f0346097dd2882e23628 (patch)
tree37626ff7a5eaea3b185c6f98017de1200ce30ea9 /gconf/gconf-lex.l
parentb597bbb6893be07010e286f6a6195ed3c323a16b (diff)
downloadwydawca-43e8d1ad415cd8af7f56f0346097dd2882e23628.tar.gz
wydawca-43e8d1ad415cd8af7f56f0346097dd2882e23628.tar.bz2
Start writing wordsplit.
* doc/wydawca.texi: Update. * gconf/argcv.h, gconf/argcv.c: Remove. * gconf/wordsplit.c, gconf/wordsplit.h: New files. * gconf/Makefile.am (libgconf_a_SOURCES): Remove argcv, add wordsplit * gconf/gconf-lex.l, gconf/gconf-preproc.c: Use wordsplit, instead of argcv_get * src/directive.c, src/method.c: Likewise. * src/wydawca.h: Likewise. * tests/wordsplit.at: New file. * tests/wstest.c, tests/wsbatch.c: New files. * tests/Makefile.am (TESTSUITE_AT): Add wordsplit.at Build wstest and wsbatch. * tests/testsuite.at: Add wordsplit.at.
Diffstat (limited to 'gconf/gconf-lex.l')
-rw-r--r--gconf/gconf-lex.l43
1 files changed, 20 insertions, 23 deletions
diff --git a/gconf/gconf-lex.l b/gconf/gconf-lex.l
index 1cdaada..1379640 100644
--- a/gconf/gconf-lex.l
+++ b/gconf/gconf-lex.l
@@ -31,7 +31,7 @@
#define obstack_chunk_free free
#include <obstack.h>
#include <xalloc.h>
-#include <argcv.h>
+#include <wordsplit.h>
#if ENABLE_NLS
# include "gettext.h"
@@ -423,28 +423,23 @@ static void
parse_line (char *text, gconf_locus_t *ploc, size_t *pxlines)
{
int rc = 1;
- int argc;
- char **argv;
-
- while (*text && isspace (*text))
- text++;
- text++;
+ struct wordsplit ws;
- if (argcv_get (text, "", NULL, &argc, &argv))
+ if (wordsplit (text, &ws, WRDSF_DEFFLAGS))
gconf_error (ploc, 0, _("cannot parse #line line"));
else
{
- if (argc == 2)
- rc = assign_locus (ploc, NULL, argv[1], pxlines);
- else if (argc == 3)
- rc = assign_locus (ploc, argv[2], argv[1], pxlines);
- else if (argc == 4)
+ if (ws.ws_wordc == 2)
+ rc = assign_locus (ploc, NULL, ws.ws_wordv[1], pxlines);
+ else if (ws.ws_wordc == 3)
+ rc = assign_locus (ploc, ws.ws_wordv[2], ws.ws_wordv[1], pxlines);
+ else if (ws.ws_wordc == 4)
{
- rc = assign_locus (ploc, argv[2], argv[1], 0);
+ rc = assign_locus (ploc, ws.ws_wordv[2], ws.ws_wordv[1], 0);
if (rc == 0)
{
char *p;
- unsigned long x = strtoul (argv[3], &p, 10);
+ unsigned long x = strtoul (ws.ws_wordv[3], &p, 10);
rc = *p != 0;
if (rc == 0)
*pxlines = x;
@@ -455,25 +450,27 @@ parse_line (char *text, gconf_locus_t *ploc, size_t *pxlines)
if (rc)
gconf_error (ploc, 0, _("malformed #line statement"));
+ wordsplit_free (&ws);
}
- argcv_free (argc, argv);
}
static void
parse_line_cpp (char *text, gconf_locus_t *ploc, size_t *pxlines)
{
- int argc;
- char **argv;
+ struct wordsplit ws;
- if (argcv_get (text, "", NULL, &argc, &argv))
- gconf_error (ploc, 0, _("cannot parse #line line"));
- else if (argc < 3)
+ if (wordsplit (text, &ws, WRDSF_DEFFLAGS))
+ {
+ gconf_error (ploc, 0, _("cannot parse #line line"));
+ return;
+ }
+ else if (ws.ws_wordc < 3)
gconf_error (ploc, 0, _("invalid #line statement"));
else
{
- if (assign_locus (ploc, argv[2], argv[1], pxlines))
+ if (assign_locus (ploc, ws.ws_wordv[2], ws.ws_wordv[1], pxlines))
gconf_error (ploc, 0, _("malformed #line statement"));
}
- argcv_free (argc, argv);
+ wordsplit_free (&ws);
}

Return to:

Send suggestions and report system problems to the System administrator.