static FcBool read_chars (FcFormatContext *c, FcChar8 term) { FcChar8 *p; p = c->word; while (*c->format && *c->format != '}' && *c->format != term) { if (*c->format == '\\') { c->format++; if (*c->format) *p++ = escaped_char (*c->format++); continue; } *p++ = *c->format++; } *p = '\0'; if (p == c->word) { message ("expected character data at %d", c->format - c->format_orig + 1); return FcFalse; } return FcTrue; }
static FcBool read_word (FcFormatContext *c) { FcChar8 *p; p = c->word; while (*c->format) { if (*c->format == '\\') { c->format++; if (*c->format) *p++ = escaped_char (*c->format++); continue; } else if (FcCharIsPunct (*c->format)) break; *p++ = *c->format++; } *p = '\0'; if (p == c->word) { message ("expected identifier at %d", c->format - c->format_orig + 1); return FcFalse; } return FcTrue; }
static void adjust(register char *str) { register char *s, *t; if ((s = t = str) == NULL) return; while (*s && *s != '#') { if (*s == '\\' && s[1] != NUL) { s++; *str++ = escaped_char(*s++); } else if (str == s) { str++; if (isspace(*s++)) continue; } else if (isspace(*str++ = *s++)) continue; t = str; } *t = NUL; }
void tprint(const char*sss) { char*buffer= NULL; int i= 0; int newlinechar= new_line_char_par; int dolog= 0; int doterm= 0; switch(selector){ case no_print: return; break; case term_only: doterm= 1; break; case log_only: dolog= 1; break; case term_and_log: dolog= 1; doterm= 1; break; case pseudo: while(*sss){ if(tally<trick_count){ trick_buf[tally%error_line]= (packed_ASCII_code)*sss++; tally++; }else{ return; } } return; break; case new_string: append_string((const unsigned char*)sss,(unsigned)strlen(sss)); return; break; default: { char*newstr= xstrdup(sss); char*s; for(s= newstr;*s;s++){ if(*s==newlinechar){ *s= '\n'; } } fputs(newstr,write_file[selector]); free(newstr); return; } break; } if(dolog||doterm){ buffer= xmalloc(strlen(sss)*3); if(dolog){ const unsigned char*ss= (const unsigned char*)sss; while(*ss){ int s= *ss++; if(needs_wrapping(s,file_offset)||s==newlinechar){ t_flush_buffer(log_file,file_offset); } if(s!=newlinechar){ buffer[i++]= s; if(file_offset++==max_print_line){ t_flush_buffer(log_file,file_offset); } } } if(*buffer){ buffer[i++]= '\0'; fputs(buffer,log_file); buffer[0]= '\0'; } i= 0; } if(doterm){ const unsigned char*ss= (const unsigned char*)sss; while(*ss){ int s= *ss++; if(needs_wrapping(s,term_offset)||s==newlinechar){ t_flush_buffer(term_out,term_offset); } if(s!=newlinechar){ if(needs_escaping(s)){ buffer[i++]= s; }else{ buffer[i++]= '^'; buffer[i++]= '^'; buffer[i++]= escaped_char(s); term_offset+= 2; } if(++term_offset==max_print_line){ t_flush_buffer(term_out,term_offset); } } } if(*buffer){ buffer[i++]= '\0'; fputs(buffer,term_out); } } free(buffer); } }