|
From: Markus R. <rol...@us...> - 2007-04-25 20:24:42
|
Update of /cvsroot/simspark/simspark/spark/utility/sfsexp In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv8837 Modified Files: Tag: RSGEDIT_FILEREF parser.c sexp.c sexp.h sexp_ops.c Log Message: - ws change Index: sexp.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/utility/sfsexp/sexp.h,v retrieving revision 1.1 retrieving revision 1.1.6.1 diff -C2 -d -r1.1 -r1.1.6.1 *** sexp.h 19 Dec 2005 19:13:30 -0000 1.1 --- sexp.h 25 Apr 2007 20:24:35 -0000 1.1.6.1 *************** *** 49,58 **** * * \section intro Intro ! * * This library was created to provide s-expression parsing and manipulation ! * facilities to C and C++ programs. The primary goals were speed and * efficiency - low memory impact, and the highest speed we could achieve in ! * parsing. Suprisingly, no other libraries on the net were found that ! * were not bloated with features or involved embedding a full-fledged * LISP or Scheme interpreter into our programs. So, this library evolved * to fill this gap. As such, it does not guarantee that every valid LISP --- 49,58 ---- * * \section intro Intro ! * * This library was created to provide s-expression parsing and manipulation ! * facilities to C and C++ programs. The primary goals were speed and * efficiency - low memory impact, and the highest speed we could achieve in ! * parsing. Suprisingly, no other libraries on the net were found that ! * were not bloated with features or involved embedding a full-fledged * LISP or Scheme interpreter into our programs. So, this library evolved * to fill this gap. As such, it does not guarantee that every valid LISP *************** *** 83,87 **** * 1,000 times. The following numbers reflect tests done on a * representative expression from Supermon, the tool that this code was ! * created for. * * - <B>v0.1.1</B> : 1.61s --- 83,87 ---- * 1,000 times. The following numbers reflect tests done on a * representative expression from Supermon, the tool that this code was ! * created for. * * - <B>v0.1.1</B> : 1.61s *************** *** 94,98 **** * - <B>v0.3.1</B> : ?.??s * - <B>v0.3.2</B> : ?.??s ! * * \section license License Information * --- 94,98 ---- * - <B>v0.3.1</B> : ?.??s * - <B>v0.3.2</B> : ?.??s ! * * \section license License Information * *************** *** 120,124 **** * This software is licensed under the GNU Public License, which * is included as LICENSE_GPL in this source distribution. ! * * This library is part of the Supermon project, hence the name * "Supermon" above. See http://www.acl.lanl.gov/supermon/ for details on --- 120,124 ---- * This software is licensed under the GNU Public License, which * is included as LICENSE_GPL in this source distribution. ! * * This library is part of the Supermon project, hence the name * "Supermon" above. See http://www.acl.lanl.gov/supermon/ for details on *************** *** 145,149 **** * the head element of the associated s-expression. */ ! typedef enum { /** * An atom of some type. See atom type (aty) field of element structure --- 145,149 ---- * the head element of the associated s-expression. */ ! typedef enum { /** * An atom of some type. See atom type (aty) field of element structure *************** *** 157,161 **** */ SEXP_LIST ! } elt_t; /** --- 157,161 ---- */ SEXP_LIST ! } elt_t; /** *************** *** 172,180 **** * of programming languages. */ ! typedef enum { /** * Basic, unquoted value. */ ! SEXP_BASIC, /** --- 172,180 ---- * of programming languages. */ ! typedef enum { /** * Basic, unquoted value. */ ! SEXP_BASIC, /** *************** *** 182,186 **** * a non-parsed portion of the s-expression. */ ! SEXP_SQUOTE, /** --- 182,186 ---- * a non-parsed portion of the s-expression. */ ! SEXP_SQUOTE, /** *************** *** 227,231 **** * and their values given with the fields themselves. Notice that a single * quote can appear directly before an s-expression or atom, similar to the ! * use in LISP. */ typedef struct elt { --- 227,231 ---- * and their values given with the fields themselves. Notice that a single * quote can appear directly before an s-expression or atom, similar to the ! * use in LISP. */ typedef struct elt { *************** *** 234,238 **** * the type is <B>SEXP_VALUE</B>, then a programmer knows that the val field * is meaningful and contains the data associated with this element of the ! * s-expression. If the type is <B>SEXP_LIST</B>, then the list field * contains a pointer to the s-expression element representing the head of * the list. For each case, the field for the opposite case contains no --- 234,238 ---- * the type is <B>SEXP_VALUE</B>, then a programmer knows that the val field * is meaningful and contains the data associated with this element of the ! * s-expression. If the type is <B>SEXP_LIST</B>, then the list field * contains a pointer to the s-expression element representing the head of * the list. For each case, the field for the opposite case contains no *************** *** 251,260 **** */ int val_allocated; ! /** * Number of bytes used in val (<= val_allocated). */ int val_used; ! /** * If the type of the element is <B>SEXP_LIST</B>, this field will contain --- 251,260 ---- */ int val_allocated; ! /** * Number of bytes used in val (<= val_allocated). */ int val_used; ! /** * If the type of the element is <B>SEXP_LIST</B>, this field will contain *************** *** 283,291 **** * point to a memory location where the data resides. The length * of this memory blob is the next field. char* implies byte sized ! * elements. */ char *bindata; ! /** * The length of the data pointed at by bindata in bytes. */ --- 283,291 ---- * point to a memory location where the data resides. The length * of this memory blob is the next field. char* implies byte sized ! * elements. */ char *bindata; ! /** * The length of the data pointed at by bindata in bytes. */ *************** *** 318,322 **** * advance (this would require more memory management than we want...). * So, by using a continuation-based parser, we can call it with this string ! * and have it return a continuation when it has parsed the first * s-expression. Once we have processed the s-expression (accessible * through the <i>last_sexpr</i> field of the continuation), we can call --- 318,322 ---- * advance (this would require more memory management than we want...). * So, by using a continuation-based parser, we can call it with this string ! * and have it return a continuation when it has parsed the first * s-expression. Once we have processed the s-expression (accessible * through the <i>last_sexpr</i> field of the continuation), we can call *************** *** 457,461 **** */ unsigned int binread; ! /** * Pointer to the memory containing the binary data being read in. --- 457,461 ---- */ unsigned int binread; ! /** * Pointer to the memory containing the binary data being read in. *************** *** 487,491 **** */ char buf[BUFSIZ]; ! /** * Byte count for last read. If it is -1, there was an error. Otherwise, --- 487,491 ---- */ char buf[BUFSIZ]; ! /** * Byte count for last read. If it is -1, there was an error. Otherwise, *************** *** 537,541 **** * one from the stack or a new one if none are available. Use this instead * of manually mallocing if you want to avoid excessive mallocs. <I>Note: ! * Mallocing your own expressions is fine - you can even use * sexp_t_deallocate to deallocate them and put them in the pool.</I> * Also, if the stack has not been initialized yet, this does so. --- 537,541 ---- * one from the stack or a new one if none are available. Use this instead * of manually mallocing if you want to avoid excessive mallocs. <I>Note: ! * Mallocing your own expressions is fine - you can even use * sexp_t_deallocate to deallocate them and put them in the pool.</I> * Also, if the stack has not been initialized yet, this does so. *************** *** 549,553 **** */ void sexp_t_deallocate(sexp_t *s); ! /** * In the event that someone wants us to release ALL of the memory used --- 549,553 ---- */ void sexp_t_deallocate(sexp_t *s); ! /** * In the event that someone wants us to release ALL of the memory used *************** *** 580,591 **** */ sexp_t *new_sexp_list(sexp_t *l); ! /** ! * allocate a new sexp_t element representing a value */ sexp_t *new_sexp_atom(char *buf, int bs); ! ! /** ! * create an initial continuation for parsing the given string */ pcont_t *init_continuation(char *str); --- 580,591 ---- */ sexp_t *new_sexp_list(sexp_t *l); ! /** ! * allocate a new sexp_t element representing a value */ sexp_t *new_sexp_atom(char *buf, int bs); ! ! /** ! * create an initial continuation for parsing the given string */ pcont_t *init_continuation(char *str); *************** *** 614,635 **** */ sexp_t *read_one_sexp(sexp_iowrap_t *iow); ! ! /** ! * wrapper around parser for compatibility. */ sexp_t *parse_sexp(char *s, int len); ! /** ! * wrapper around parser for friendlier continuation use ! * pre-condition : continuation (cc) is NON-NULL! */ sexp_t *iparse_sexp(char *s, int len, pcont_t *cc); ! /** * given a LISP style s-expression string, parse it into a set of ! * connected sexp_t structures. */ pcont_t *cparse_sexp(char *s, int len, pcont_t *pc); ! /** * given a sexp_t structure, free the memory it uses (and recursively free --- 614,635 ---- */ sexp_t *read_one_sexp(sexp_iowrap_t *iow); ! ! /** ! * wrapper around parser for compatibility. */ sexp_t *parse_sexp(char *s, int len); ! /** ! * wrapper around parser for friendlier continuation use ! * pre-condition : continuation (cc) is NON-NULL! */ sexp_t *iparse_sexp(char *s, int len, pcont_t *cc); ! /** * given a LISP style s-expression string, parse it into a set of ! * connected sexp_t structures. */ pcont_t *cparse_sexp(char *s, int len, pcont_t *pc); ! /** * given a sexp_t structure, free the memory it uses (and recursively free Index: parser.c =================================================================== RCS file: /cvsroot/simspark/simspark/spark/utility/sfsexp/parser.c,v retrieving revision 1.1 retrieving revision 1.1.6.1 diff -C2 -d -r1.1 -r1.1.6.1 *** parser.c 19 Dec 2005 19:13:30 -0000 1.1 --- parser.c 25 Apr 2007 20:24:35 -0000 1.1.6.1 *************** *** 50,54 **** if (ss > 0) sexp_val_start_size = ss; ! else fprintf(stderr,"%s: Cannot set buffer start size to value<1.\n",__FILE__); --- 50,54 ---- if (ss > 0) sexp_val_start_size = ss; ! else fprintf(stderr,"%s: Cannot set buffer start size to value<1.\n",__FILE__); [...1275 lines suppressed...] /* the null check used to be part of the guard on the while loop. unfortunately, if we're in state 15, null is considered a perfectly valid byte. This means the length passed in better ! be accurate for the parser to not walk off the end of the string! */ if (state != 15 && t[0] == '\0') keepgoing = 0; *************** *** 1249,1253 **** cc->error = 0; } ! return cc; } --- 1249,1253 ---- cc->error = 0; } ! return cc; } Index: sexp_ops.c =================================================================== RCS file: /cvsroot/simspark/simspark/spark/utility/sfsexp/sexp_ops.c,v retrieving revision 1.1 retrieving revision 1.1.6.1 diff -C2 -d -r1.1 -r1.1.6.1 *** sexp_ops.c 19 Dec 2005 19:13:30 -0000 1.1 --- sexp_ops.c 25 Apr 2007 20:24:35 -0000 1.1.6.1 *************** *** 33,37 **** /** ! * Given an s-expression, find the atom inside of it with the * value matchine name, and return a reference to it. If the atom * doesn't occur inside start, return NULL. --- 33,37 ---- /** ! * Given an s-expression, find the atom inside of it with the * value matchine name, and return a reference to it. If the atom * doesn't occur inside start, return NULL. *************** *** 49,55 **** temp = find_sexp (name, start->list); if (temp == NULL) ! return find_sexp (name, start->next); else ! return temp; } else --- 49,55 ---- temp = find_sexp (name, start->list); if (temp == NULL) ! return find_sexp (name, start->next); else ! return temp; } else *************** *** 57,66 **** assert(start->val != NULL); if (strcmp (start->val, name) == 0) ! return start; else ! return find_sexp (name, start->next); } ! return NULL; /* shouldn't get here */ } --- 57,66 ---- assert(start->val != NULL); if (strcmp (start->val, name) == 0) ! return start; else ! return find_sexp (name, start->next); } ! return NULL; /* shouldn't get here */ } *************** *** 72,76 **** sexp_t *t = sx; sexp_t *rt; ! if (sx == NULL) return NULL; --- 72,76 ---- sexp_t *t = sx; sexp_t *rt; ! if (sx == NULL) return NULL; *************** *** 79,85 **** assert(t->val != NULL); if (strcmp(t->val,str) == 0) { ! return t; } ! } t = t->next; --- 79,85 ---- assert(t->val != NULL); if (strcmp(t->val,str) == 0) { ! return t; } ! } t = t->next; *************** *** 92,96 **** if (rt != NULL) return rt; } ! t = t->next; } --- 92,96 ---- if (rt != NULL) return rt; } ! t = t->next; } *************** *** 111,115 **** t = sx->list; ! while (t != NULL) { len++; --- 111,115 ---- t = sx->list; ! while (t != NULL) { len++; *************** *** 146,150 **** snew->list = copy_sexp(s->list); } ! snew->next = copy_sexp(s->next); --- 146,150 ---- snew->list = copy_sexp(s->list); } ! snew->next = copy_sexp(s->next); *************** *** 191,233 **** */ sexp_t *car_sexp(sexp_t *s) { ! sexp_t *cr, *ocr; ! /* really dumb - calling on null */ ! if (s == NULL) { ! fprintf(stderr,"car called on null sexpr.\n"); ! return NULL; ! } ! /* less dumb - calling on an atom */ ! if (s->ty == SEXP_VALUE) { ! fprintf(stderr,"car called on an atom.\n"); ! return NULL; ! } ! /* ocr = (sexp_t *)malloc(sizeof(sexp_t));*/ ocr = sexp_t_allocate(); ! assert(ocr != NULL); ! ocr->ty = SEXP_LIST; ! ocr->next = NULL; ! /* allocate the new sexp_t */ ! /* cr = (sexp_t *)malloc(sizeof(sexp_t)); */ cr = sexp_t_allocate(); ! assert(cr != NULL); ! ocr->list = cr; ! /* copy the head of the sexpr */ ! if (s->list->ty == SEXP_VALUE) { ! cr->ty = SEXP_VALUE; assert(s->list->val != NULL); ! strcpy(cr->val,s->list->val); ! cr->next = cr->list = NULL; ! } else { ! cr->ty = SEXP_LIST; ! cr->next = NULL; ! cr->list = copy_sexp(s->list->list); ! } ! return ocr; } --- 191,233 ---- */ sexp_t *car_sexp(sexp_t *s) { ! sexp_t *cr, *ocr; ! /* really dumb - calling on null */ ! if (s == NULL) { ! fprintf(stderr,"car called on null sexpr.\n"); ! return NULL; ! } ! /* less dumb - calling on an atom */ ! if (s->ty == SEXP_VALUE) { ! fprintf(stderr,"car called on an atom.\n"); ! return NULL; ! } ! /* ocr = (sexp_t *)malloc(sizeof(sexp_t));*/ ocr = sexp_t_allocate(); ! assert(ocr != NULL); ! ocr->ty = SEXP_LIST; ! ocr->next = NULL; ! /* allocate the new sexp_t */ ! /* cr = (sexp_t *)malloc(sizeof(sexp_t)); */ cr = sexp_t_allocate(); ! assert(cr != NULL); ! ocr->list = cr; ! /* copy the head of the sexpr */ ! if (s->list->ty == SEXP_VALUE) { ! cr->ty = SEXP_VALUE; assert(s->list->val != NULL); ! strcpy(cr->val,s->list->val); ! cr->next = cr->list = NULL; ! } else { ! cr->ty = SEXP_LIST; ! cr->next = NULL; ! cr->list = copy_sexp(s->list->list); ! } ! return ocr; } *************** *** 236,261 **** */ sexp_t *cdr_sexp(sexp_t *s) { ! sexp_t *cd; ! /* really dumb */ ! if (s == NULL) { ! fprintf(stderr,"cdr called on null.\n"); ! return NULL; ! } ! /* less dumb */ ! if (s->ty != SEXP_LIST) { ! fprintf(stderr,"cdr called on atom.\n"); ! return NULL; ! } ! /* cd = (sexp_t *)malloc(sizeof(sexp_t)); */ cd = sexp_t_allocate(); ! assert(cd != NULL); ! cd->ty = SEXP_LIST; ! cd->next = NULL; ! cd->list = copy_sexp(s->list->next); ! return cd; } --- 236,261 ---- */ sexp_t *cdr_sexp(sexp_t *s) { ! sexp_t *cd; ! /* really dumb */ ! if (s == NULL) { ! fprintf(stderr,"cdr called on null.\n"); ! return NULL; ! } ! /* less dumb */ ! if (s->ty != SEXP_LIST) { ! fprintf(stderr,"cdr called on atom.\n"); ! return NULL; ! } ! /* cd = (sexp_t *)malloc(sizeof(sexp_t)); */ cd = sexp_t_allocate(); ! assert(cd != NULL); ! cd->ty = SEXP_LIST; ! cd->next = NULL; ! cd->list = copy_sexp(s->list->next); ! return cd; } Index: sexp.c =================================================================== RCS file: /cvsroot/simspark/simspark/spark/utility/sfsexp/sexp.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** sexp.c 15 Mar 2007 07:26:30 -0000 1.2 --- sexp.c 25 Apr 2007 20:24:35 -0000 1.2.2.1 *************** *** 111,115 **** { fprintf (stderr, ! "Warning: print_sexp not provided sufficient space.\n"); return -1; } --- 111,115 ---- { fprintf (stderr, ! "Warning: print_sexp not provided sufficient space.\n"); return -1; } *************** *** 125,177 **** if (tdata == NULL) ! { ! pop (stack); ! if (depth > 0) ! { ! b[0] = ')'; ! b++; ! left--; ! depth--; ! if (left == 0) ! { ! fprintf (stderr, ! "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! } ! if (stack->top == NULL) ! break; ! top = stack->top; ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! b[0] = ' '; ! b++; ! left--; ! if (left == 0) ! { ! fprintf (stderr, ! "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! } ! } else if (tdata->ty == SEXP_VALUE) ! { ! if (tdata->aty == SEXP_DQUOTE) ! { ! b[0] = '\"'; ! b++; ! left--; ! } ! else if (tdata->aty == SEXP_SQUOTE) ! { ! b[0] = '\''; ! b++; ! left--; ! } if (tdata->aty != SEXP_BINARY) { --- 125,177 ---- if (tdata == NULL) ! { ! pop (stack); ! if (depth > 0) ! { ! b[0] = ')'; ! b++; ! left--; ! depth--; ! if (left == 0) ! { ! fprintf (stderr, ! "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! } ! if (stack->top == NULL) ! break; ! top = stack->top; ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! b[0] = ' '; ! b++; ! left--; ! if (left == 0) ! { ! fprintf (stderr, ! "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! } ! } else if (tdata->ty == SEXP_VALUE) ! { ! if (tdata->aty == SEXP_DQUOTE) ! { ! b[0] = '\"'; ! b++; ! left--; ! } ! else if (tdata->aty == SEXP_SQUOTE) ! { ! b[0] = '\''; ! b++; ! left--; ! } if (tdata->aty != SEXP_BINARY) { *************** *** 190,194 **** if (left == 0) break; } ! b[0] = tc[0]; b++; --- 190,194 ---- if (left == 0) break; } ! b[0] = tc[0]; b++; *************** *** 210,214 **** b += sz; left -= sz; ! if (left < tdata->binlength) { left = 0; --- 210,214 ---- b += sz; left -= sz; ! if (left < tdata->binlength) { left = 0; *************** *** 222,280 **** } else { ! left = 0; break; } } ! if (tdata->aty == SEXP_DQUOTE && left > 0) ! { ! b[0] = '\"'; ! b++; ! left--; ! } ! if (left < 0) ! left = 0; ! if (left == 0) ! { ! fprintf (stderr, "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! b[0] = ' '; ! b++; ! left--; ! if (left == 0) ! { ! fprintf (stderr, ! "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! } ! } else if (tdata->ty == SEXP_LIST) ! { ! depth++; ! b[0] = '('; ! b++; ! left--; ! if (left == 0) ! { ! fprintf (stderr, "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! push (stack, tdata->list); ! } else ! { ! fprintf (stderr, "ERROR: Unknown type in sexp_t.\n"); ! fflush (stderr); ! return -1; ! } } --- 222,280 ---- } else { ! left = 0; break; } } ! if (tdata->aty == SEXP_DQUOTE && left > 0) ! { ! b[0] = '\"'; ! b++; ! left--; ! } ! if (left < 0) ! left = 0; ! if (left == 0) ! { ! fprintf (stderr, "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! b[0] = ' '; ! b++; ! left--; ! if (left == 0) ! { ! fprintf (stderr, ! "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! } ! } else if (tdata->ty == SEXP_LIST) ! { ! depth++; ! b[0] = '('; ! b++; ! left--; ! if (left == 0) ! { ! fprintf (stderr, "Warning: print_sexp out of buffer space.\n"); ! break; ! } ! push (stack, tdata->list); ! } else ! { ! fprintf (stderr, "ERROR: Unknown type in sexp_t.\n"); ! fflush (stderr); ! return -1; ! } } *************** *** 286,293 **** depth--; if (left == 0) ! { ! fprintf (stderr, "Warning: print_sexp out of buffer space.\n"); ! break; ! } } --- 286,293 ---- depth--; if (left == 0) ! { ! fprintf (stderr, "Warning: print_sexp out of buffer space.\n"); ! break; ! } } *************** *** 345,349 **** if (fakehead->ty == SEXP_VALUE) { assert(sx->val != NULL); ! /* duplicate the value of the head into the fake head */ fakehead->val = (char *)malloc(sizeof(char)*sx->val_used); --- 345,349 ---- if (fakehead->ty == SEXP_VALUE) { assert(sx->val != NULL); ! /* duplicate the value of the head into the fake head */ fakehead->val = (char *)malloc(sizeof(char)*sx->val_used); *************** *** 364,396 **** if (tdata == NULL) ! { ! pop (stack); ! if (depth > 0) ! { ! _s = saddch(_s, ')'); ! depth--; ! } ! if (stack->top == NULL) ! break; ! top = stack->top; ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! _s = saddch(_s, ' '); ! } ! } else if (tdata->ty == SEXP_VALUE) ! { ! if (tdata->aty == SEXP_DQUOTE) ! { ! _s = saddch(_s,'\"'); ! } ! else if (tdata->aty == SEXP_SQUOTE) ! { ! _s = saddch(_s,'\''); ! } if (tdata->aty == SEXP_BINARY) { --- 364,396 ---- if (tdata == NULL) ! { ! pop (stack); ! if (depth > 0) ! { ! _s = saddch(_s, ')'); ! depth--; ! } ! if (stack->top == NULL) ! break; ! top = stack->top; ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! _s = saddch(_s, ' '); ! } ! } else if (tdata->ty == SEXP_VALUE) ! { ! if (tdata->aty == SEXP_DQUOTE) ! { ! _s = saddch(_s,'\"'); ! } ! else if (tdata->aty == SEXP_SQUOTE) ! { ! _s = saddch(_s,'\''); ! } if (tdata->aty == SEXP_BINARY) { *************** *** 405,409 **** assert(tdata->val != NULL); tc = tdata->val; ! /* copy value into string */ while (tc[0] != 0) --- 405,409 ---- assert(tdata->val != NULL); tc = tdata->val; ! /* copy value into string */ while (tc[0] != 0) *************** *** 415,419 **** _s = saddch(_s,'\\'); } ! _s = saddch(_s,tc[0]); tc++; --- 415,419 ---- _s = saddch(_s,'\\'); } ! _s = saddch(_s,tc[0]); tc++; *************** *** 421,448 **** } ! if (tdata->aty == SEXP_DQUOTE) ! { ! _s = saddch(_s,'\"'); ! } ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! _s = saddch(_s,' '); ! } ! } else if (tdata->ty == SEXP_LIST) ! { ! depth++; ! _s = saddch(_s,'('); ! push (stack, tdata->list); ! } else ! { ! fprintf (stderr, "ERROR: Unknown type in sexp_t.\n"); ! fflush (stderr); ! return -1; ! } } --- 421,448 ---- } ! if (tdata->aty == SEXP_DQUOTE) ! { ! _s = saddch(_s,'\"'); ! } ! top->data = ((sexp_t *) top->data)->next; ! if (top->data != NULL) ! { ! _s = saddch(_s,' '); ! } ! } else if (tdata->ty == SEXP_LIST) ! { ! depth++; ! _s = saddch(_s,'('); ! push (stack, tdata->list); ! } else ! { ! fprintf (stderr, "ERROR: Unknown type in sexp_t.\n"); ! fflush (stderr); ! return -1; ! } } *************** *** 480,484 **** /** ! * allocate a new sexp_t element representing a value */ sexp_t *new_sexp_atom(char *buf, int bs) { --- 480,484 ---- /** ! * allocate a new sexp_t element representing a value */ sexp_t *new_sexp_atom(char *buf, int bs) { |