Patch:    ivtools-140402-scott-009
For:      ivtools-1.2.11
Author:   scott@wavesemi.com
Subject:  support for ipl development

This is an intermediate patch to ivtools-1.2.11.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Then rebuild with "make;make install"


Index: src/ComTerp/symbolfunc.c
===================================================================
--- src/ComTerp/symbolfunc.c	(revision 8425)
+++ src/ComTerp/symbolfunc.c	(working copy)
@@ -255,16 +255,22 @@
 }
 
 void SplitStrFunc::execute() {
+  ComValue zerov(0, ComValue::IntType);
   ComValue commav(',');
   ComValue symvalv(stack_arg(0));
   static int tokstr_symid = symbol_add("tokstr");
-  ComValue tokstrv(stack_key(tokstr_symid, false, commav));
+  ComValue tokstrv(stack_key(tokstr_symid, false, zerov));
   boolean tokstrflag = tokstrv.is_known();
   static int tokval_symid = symbol_add("tokval");
-  ComValue tokvalv(stack_key(tokval_symid, false, commav));
+  ComValue tokvalv(stack_key(tokval_symid, false, zerov));
   boolean tokvalflag = tokvalv.is_known();
   reset_stack();
 
+  boolean tokstr_charflag = tokstrv.is_type(ComValue::CharType);
+  if(tokstrv.is_type(ComValue::IntType)) tokstrv = commav;
+  if(tokvalv.is_type(ComValue::IntType)) tokvalv = commav;
+  
+
   if (symvalv.is_string()) {
     AttributeValueList* avl = new AttributeValueList();
     ComValue retval(avl);
@@ -279,7 +285,7 @@
       char delim = tokstrv.char_val();
       while (*str) {
         int delim1=0;
-        while(*str && (isspace(*str) || *str==delim)) {
+        while(*str && isspace(*str) || *str==delim) {
           if (*str==delim) {
             if ((delim1 || avl->Number()==0) && !isspace(delim) ) {
               ComValue* comval = new ComValue(ComValue::nullval());
@@ -296,7 +302,7 @@
           }
           break;
         }
-        while (*str && !isspace(*str) && *str!=delim && bufoff<BUFSIZ-1) {
+        while (*str && (tokstr_charflag?*str!='\n':!isspace(*str)) && *str!=delim && bufoff<BUFSIZ-1) {
           if(*str=='"') {
             while(*str && (*str!='"' || *(str-1)!='\\') && bufoff<BUFSIZ-1) 
               buffer[bufoff++] = *str++;
