str_t *int_to_str(int num ) { char c[2] ; int pos ; int rem ; str_t *rstr ; str_t *tmp ; str_t *str ; str_t *tmp___0 ; void *__cil_tmp9 ; char *__cil_tmp10 ; { { #line 240 pos = 0; #line 241 rem = 0; #line 242 tmp = str_make((str_t *)0); #line 242 rstr = tmp; #line 243 tmp___0 = str_make((str_t *)0); #line 243 str = tmp___0; } { #line 247 while (1) { while_continue: /* CIL Label */ ; #line 247 if (! (num > 0)) { #line 247 goto while_break; } { #line 249 rem = num % 10; #line 250 num /= 10; #line 251 sprintf((char */* __restrict */)(c), (char const */* __restrict */)"%d", rem); #line 252 str_add_char(rstr, c[0]); } } while_break___1: /* CIL Label */ ; } while_break: #line 256 pos = rstr->len - 1; { #line 256 while (1) { while_continue___0: /* CIL Label */ ; #line 256 if (! (pos >= 0)) { #line 256 goto while_break___0; } { #line 257 str_add_char(str, *(rstr->str + pos)); #line 256 pos --; } } while_break___2: /* CIL Label */ ; } while_break___0: ; #line 259 return (str); } }
int str_add_line_from_desc(str_t *str , int file_desc ) { int nchars ; char c ; { #line 160 nchars = 0; #line 161 c = (char)0; #line 163 if (! str) { { #line 164 str = str_make(str); } } else { { #line 163 if (! str->str) { { #line 164 str = str_make(str); } } } } { #line 166 while (1) { while_continue: /* CIL Label */ ; { #line 168 nchars = safe_read(file_desc, & c, 1); } #line 170 if (! nchars) { #line 171 return (2); } #line 172 if (nchars < 0) { #line 173 return (1); } { #line 175 str_add_char(str, c); } #line 176 if ((int )c == 10) { #line 177 goto while_break; } } while_break___0: /* CIL Label */ ; } while_break: ; #line 180 return (0); } }
void str_add_str(str_t *str1 , str_t *str2 ) { int pos ; { #line 113 pos = 0; #line 115 if (! str2) { #line 116 return; } else { { #line 115 if (! str2->str) { #line 116 return; } } } #line 117 if (! str1) { { #line 118 str1 = str_make(str1); } } else { { #line 117 if (! str1->str) { { #line 118 str1 = str_make(str1); } } } } { #line 120 while (1) { while_continue: /* CIL Label */ ; { #line 120 if (! (pos < str2->len)) { #line 120 goto while_break; } } { #line 121 str_add_char(str1, *(str2->str + pos)); #line 120 pos ++; } } while_break___0: /* CIL Label */ ; } while_break: ; #line 122 return; } }
int str_add_line(str_t *str , FILE *stream ) { register char c ; int tmp ; int tmp___0 ; { #line 132 if (! str) { { #line 133 str = str_make(str); } } else { { #line 132 if (! str->str) { { #line 133 str = str_make(str); } } } } #line 134 if (! stream) { #line 135 return (1); } { #line 137 while (1) { while_continue: /* CIL Label */ ; { #line 139 tmp = _IO_getc(stream); #line 139 c = (char )tmp; } #line 141 if ((int )c == -1) { #line 142 return (2); } else { { #line 141 tmp___0 = ferror(stream); } #line 141 if (tmp___0) { #line 142 return (2); } } { #line 143 str_add_char(str, c); } #line 144 if ((int )c == 10) { #line 145 goto while_break; } } while_break___0: /* CIL Label */ ; } while_break: ; #line 148 return (0); } }
PUBLIC int lex_string_flatten() { PRIVATE char finalstring[255]; char *src=yytext+1; /* skip past initial " */ char *dest=finalstring; while (*src) { if (*src == '\\' && *(src+1)) { src++; switch (*src) { case '"': *dest = '"'; break; case 'r': *dest = '\r'; break; case 'n': *dest = '\n'; break; case 't': *dest = '\t'; break; case '\b': *dest = (char) 7; break; default: *dest = *src; } src++; } else if (*src=='"') if (!*(src+1)) break; else if (*(src+1)=='"') { src+=2; *dest='"'; } else { src++; *dest='"'; } else if (*src=='\r' || *src=='\n') { src++; dest--; /* to compensate for the coming dest++ */ } else { *dest=*src; src++; } dest++; } *dest=0; yylval.str = str_make(PARSE_POOL, finalstring); return stringSYM; }