void mb_parse_str(t_assm *assm, char **inp, char **str, char **t) { int i; int len; while (get_next_line(assm->fd_s, str) > 0) { i = 0; assm->count++; while ((*str)[i] && ((*str)[i] == '\t' || (*str)[i] == ' ')) i++; if ((*str)[i] && (*str)[i] != COMMENT_CHAR && (*str)[i] != ';' && mb_check_valid_label(assm, *str) >= 1) { len = 0; while ((*str)[len] && (*str)[len] != LABEL_CHAR) len++; io_create_lab_lst(&assm->lab_lst, ft_strsub(*str, 0, len)); while ((*str)[i] && (*str)[i] != LABEL_CHAR) i++; i++; } (*t != NULL) ? ft_strdel(t) : 0; *t = ft_strdup(*str); (*str != NULL) ? *inp = save_line(assm, *str, *inp, i) : 0; } // check_last_line(assm, *t); }
void save_num( C const& src, FilepassString const& file_pass, std::string delimiter, WriteMode open_mode = WriteMode::overwrite) { save_line(cat(src, delimiter), file_pass, open_mode); }
void save_line( C const& src, FilepassString const& file_pass, WriteMode open_mode = WriteMode::overwrite) { SIG_FILE_LOCALE_INIT const auto mode = open_mode == WriteMode::overwrite ? std::ios::out : std::ios::out | std::ios::app; typename impl::FStreamSelector<typename impl::container_traits<C>::value_type>::ofstream ofs(file_pass, mode); save_line(src, ofs); }
void save_num( CC const& src, FilepassString const& file_pass, std::string delimiter, WriteMode open_mode = WriteMode::overwrite) { std::vector<std::string> tmp; for (auto const& line : src){ tmp.push_back(cat(line, delimiter)); } save_line(tmp, file_pass, open_mode); }
/* * scrollHelp - refresh the displayed help after a scrolling operation */ static int scrollHelp( SAREA *use, int lastline, bool changecurr ) { int useline; int scroll; int start; int end; scroll = currLine - lastline; vscroll_fields( &helpTab, *use, scroll ); vvscroll( &helpScreen, *use, scroll ); currentAttr = AT( ATTR_NORMAL ); if( abs(scroll) >= use->height ) { start = currLine; end = start + use->height; } else if( scroll < 0 ) { start = currLine; end = start - scroll; } else { start = currLine + use->height - scroll; end = start + scroll; } seek_line( start ); for( ;; ++start ) { save_line( start, HelpTell( helpFileHdl ) ); if( !mygetline() || strncmp( helpInBuf, "::::", 4 ) == 0 ) { maxLine = start; break; } useline = start - currLine; if( useline >= use->height || start >= end ) { break; } /* if it is the first time in, then the old currfield is right */ processLine( helpInBuf, helpOutBuf, useline + use->row, changecurr ); putline( helpOutBuf, useline + use->row ); } end = currLine + use->height; if( maxLine != 0 && end > maxLine ) { end = maxLine; } display_fields(); hotSpots[1].startcol = ( helpScreen.area.width - hotSpots[1].length ) / 2; addSearchButton( helpSearchHdl != NULL ); uiposnhotspots( &helpScreen, hotSpotFields ); uiprinthotspots( &helpScreen, hotSpotFields ); set_slider( currLine ); uirefresh(); return( currLine ); }
// a reference into a set of the cache, return 1 on hit int cache_setref(int set_no, Addr tag, int byte) { int i, j; Cacheline* set = cache + set_no * setsize; unsigned old_mask; /* Test all lines in the set for a tag match * If the tag is another than the MRU, move it into the MRU spot, count access * and shuffle the rest down. */ for (i = 0; i < setsize; i++) { if (tag == set[i].tag) { Cacheline accessed_line=set[i]; for (j = i; j > 0; j--) { set[j]= set[j - 1]; } set[0] = accessed_line; set[0].accesses[byte]++; addSectionChecked(&(set[0].sections),currentSection); return 1; } } /* A miss; save LRU to file, install this tag as MRU, shuffle rest down. */ save_line(set[setsize-1]); for (j = setsize - 1; j > 0; j--) { set[j]= set[j - 1]; } misses++; Cacheline new_line; new_line.tag=tag; for(i=0;i<LINESIZE;++i) { new_line.accesses[i]=0; } new_line.accesses[byte]++; new_line.sections.first=NULL; new_line.sections.last=NULL; addSection(&(new_line.sections),currentSection); set[0]=new_line; return 0; }
static void seek_line( int line ) { int i; if( line > lastHelpLine ) { HelpSeek( helpFileHdl, topPos + helpPos[lastHelpLine], HELP_SEEK_SET ); for( i = lastHelpLine; ; ++i ) { save_line( i, HelpTell( helpFileHdl ) ); if( i == line ) break; if( !mygetline() || strnicmp( helpInBuf, "::::", 4 ) == 0 ) { maxLine = i; break; } } } else if( line >= 0 ) { HelpSeek( helpFileHdl, topPos + helpPos[line], HELP_SEEK_SET ); } }
int main(int argc, char *argv[]) { int lbreak, last; char line[MAXLINE]; struct lines saved_lines; saved_lines.next_line = NULL; if (argc == 1) { lbreak = DEFAULT_BREAK_LINE; } else { if (strcmp(argv[1], "-help") == 0) { printf("\nUsage: -help for help\n -bp n to break point where n is the size\nNo arguments a default value will be set\n"); return 0; } else if (strcmp(argv[1], "-bp") == 0) { lbreak = getvalue(argv[2]); if (lbreak < 0) { printf("Wrong argument\n"); return -1; } } else { printf("Wrong argument\n"); return -1; } } while ((last = read_line(line))) { save_line(&saved_lines, line); del_line(line); if (last == LAST_LINE) { break; } } line_sort(&saved_lines, lbreak); print(&saved_lines); return 0; }
static NOINLINE int process_timer_stats(void) { char buf[128]; char line[15 + 3 + 128]; int n; FILE *fp; buf[0] = '\0'; n = 0; fp = NULL; if (!G.cant_enable_timer_stats) fp = fopen_for_read("/proc/timer_stats"); if (fp) { // Example file contents: // Timer Stats Version: v0.2 // Sample period: 1.329 s // 76, 0 swapper hrtimer_start_range_ns (tick_sched_timer) // 88, 0 swapper hrtimer_start_range_ns (tick_sched_timer) // 24, 3787 firefox hrtimer_start_range_ns (hrtimer_wakeup) // 46D, 1136 kondemand/1 do_dbs_timer (delayed_work_timer_fn) // ... // 1, 1656 Xorg hrtimer_start_range_ns (hrtimer_wakeup) // 1, 2159 udisks-daemon hrtimer_start_range_ns (hrtimer_wakeup) // 331 total events, 249.059 events/sec while (fgets(buf, sizeof(buf), fp)) { const char *count, *process, *func; char *p; int idx; unsigned cnt; count = skip_whitespace(buf); p = strchr(count, ','); if (!p) continue; *p++ = '\0'; cnt = bb_strtou(count, NULL, 10); if (strcmp(skip_non_whitespace(count), " total events") == 0) { #if ENABLE_FEATURE_POWERTOP_PROCIRQ n = cnt / G.total_cpus; if (n > 0 && n < G.interrupt_0) { sprintf(line, " <interrupt> : %s", "extra timer interrupt"); save_line(line, G.interrupt_0 - n); } #endif break; } if (strchr(count, 'D')) continue; /* deferred */ p = skip_whitespace(p); /* points to pid now */ process = NULL; get_func_name: p = strchr(p, ' '); if (!p) continue; *p++ = '\0'; p = skip_whitespace(p); if (process == NULL) { process = p; goto get_func_name; } func = p; //if (strcmp(process, "swapper") == 0 // && strcmp(func, "hrtimer_start_range_ns (tick_sched_timer)\n") == 0 //) { // process = "[kernel scheduler]"; // func = "Load balancing tick"; //} if (strncmp(func, "tick_nohz_", 10) == 0) continue; if (strncmp(func, "tick_setup_sched_timer", 20) == 0) continue; //if (strcmp(process, "powertop") == 0) // continue; idx = index_in_strings("insmod\0modprobe\0swapper\0", process); if (idx != -1) { process = idx < 2 ? "[kernel module]" : "<kernel core>"; } strchrnul(p, '\n')[0] = '\0'; // 46D\01136\0kondemand/1\0do_dbs_timer (delayed_work_timer_fn) // ^ ^ ^ // count process func //if (strchr(process, '[')) sprintf(line, "%15.15s : %s", process, func); //else // sprintf(line, "%s", process); save_line(line, cnt); } fclose(fp); } return n; }
/* Read /proc/interrupts, save IRQ counts and IRQ description */ static void process_irq_counts(void) { FILE *fp; char buf[128]; /* Reset values */ G.interrupt_0 = 0; G.total_interrupt = 0; fp = xfopen_for_read("/proc/interrupts"); while (fgets(buf, sizeof(buf), fp)) { char irq_desc[sizeof(" <kernel IPI> : ") + sizeof(buf)]; char *p; const char *name; int nr; ullong count; ullong delta; p = strchr(buf, ':'); if (!p) continue; /* 0: 143646045 153901007 IO-APIC-edge timer * ^ */ *p = '\0'; /* Deal with non-maskable interrupts -- make up fake numbers */ nr = index_in_strings("NMI\0RES\0CAL\0TLB\0TRM\0THR\0SPU\0", buf); if (nr >= 0) { nr += 20000; } else { /* bb_strtou doesn't eat leading spaces, using strtoul */ errno = 0; nr = strtoul(buf, NULL, 10); if (errno) continue; } p++; /* 0: 143646045 153901007 IO-APIC-edge timer * ^ */ /* Sum counts for this IRQ */ count = 0; while (1) { char *tmp; p = skip_whitespace(p); if (!isdigit(*p)) break; count += bb_strtoull(p, &tmp, 10); p = tmp; } /* 0: 143646045 153901007 IO-APIC-edge timer * NMI: 1 2 Non-maskable interrupts * ^ */ if (nr < 20000) { /* Skip to the interrupt name, e.g. 'timer' */ p = strchr(p, ' '); if (!p) continue; p = skip_whitespace(p); } name = p; strchrnul(name, '\n')[0] = '\0'; /* Save description of the interrupt */ if (nr >= 20000) sprintf(irq_desc, " <kernel IPI> : %s", name); else sprintf(irq_desc, " <interrupt> : %s", name); delta = save_irq_count(nr, count); /* Skip per CPU timer interrupts */ if (is_hpet_irq(name)) continue; if (nr != 0 && delta != 0) save_line(irq_desc, delta); if (nr == 0) G.interrupt_0 = delta; else G.total_interrupt += delta; } fclose(fp); }
int gas_parser_lex(YYSTYPE *lvalp, yasm_parser_gas *parser_gas) { yasm_scanner *s = &parser_gas->s; YYCTYPE *cursor = s->cur; size_t count; YYCTYPE savech; /* Handle one token of lookahead */ if (parser_gas->peek_token != NONE) { int tok = parser_gas->peek_token; *lvalp = parser_gas->peek_tokval; /* structure copy */ parser_gas->tokch = parser_gas->peek_tokch; parser_gas->peek_token = NONE; return tok; } /* Catch EOF */ if (s->eof && cursor == s->eof) return 0; /* Jump to proper "exclusive" states */ switch (parser_gas->state) { case COMMENT: goto comment; case SECTION_DIRECTIVE: goto section_directive; case NASM_FILENAME: goto nasm_filename; default: break; } scan: SCANINIT(); { static unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 254, 254, 126, 126, 126, 126, 126, 126, 94, 94, 0, 0, 0, 0, 0, 0, 8, 78, 78, 78, 78, 78, 78, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 12, 0, 78, 78, 78, 78, 78, 78, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #line 258 "gas-token.c" { YYCTYPE yych; unsigned int yyaccept; goto yy0; ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = *YYCURSOR; if(yych <= '/'){ if(yych <= '#'){ if(yych <= '\r'){ if(yych <= '\t'){ if(yych <= '\b') goto yy30; goto yy26; } else { if(yych <= '\n') goto yy28; if(yych <= '\f') goto yy30; goto yy26; } } else { if(yych <= ' '){ if(yych <= '\037') goto yy30; goto yy26; } else { if(yych <= '!') goto yy17; if(yych <= '"') goto yy11; goto yy24; } } } else { if(yych <= '*'){ if(yych <= '%'){ if(yych <= '$') goto yy17; goto yy22; } else { if(yych == '\'') goto yy9; goto yy17; } } else { if(yych <= ','){ if(yych <= '+') goto yy5; goto yy17; } else { if(yych <= '-') goto yy5; if(yych <= '.') goto yy7; goto yy18; } } } } else { if(yych <= 'Z'){ if(yych <= '<'){ if(yych <= '9'){ if(yych >= '1') goto yy4; goto yy2; } else { if(yych <= ':') goto yy17; if(yych <= ';') goto yy19; goto yy13; } } else { if(yych <= '>'){ if(yych <= '=') goto yy17; goto yy15; } else { if(yych <= '?') goto yy30; if(yych <= '@') goto yy17; goto yy21; } } } else { if(yych <= 'z'){ if(yych <= '^'){ if(yych <= ']') goto yy30; goto yy17; } else { if(yych == '`') goto yy30; goto yy21; } } else { if(yych <= '|'){ if(yych <= '{') goto yy30; goto yy17; } else { if(yych == '~') goto yy17; goto yy30; } } } } yy2: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if(yych <= 'T'){ if(yych <= 'A'){ if(yych <= '/'){ if(yych == '.') goto yy90; goto yy3; } else { if(yych <= '9') goto yy90; if(yych <= ':') goto yy81; goto yy3; } } else { if(yych <= 'E'){ if(yych <= 'B') goto yy85; if(yych >= 'D') goto yy88; goto yy3; } else { if(yych <= 'F') goto yy86; if(yych >= 'T') goto yy88; goto yy3; } } } else { if(yych <= 'e'){ if(yych <= 'a'){ if(yych == 'X') goto yy92; goto yy3; } else { if(yych <= 'b') goto yy85; if(yych >= 'd') goto yy88; goto yy3; } } else { if(yych <= 't'){ if(yych <= 'f') goto yy86; if(yych >= 't') goto yy88; goto yy3; } else { if(yych == 'x') goto yy92; goto yy3; } } } yy3: #line 229 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->intn = yasm_intnum_create_dec(TOK); s->tok[TOKLEN] = savech; RETURN(INTNUM); } #line 402 "gas-token.c" yy4: yych = *++YYCURSOR; if(yych <= 'E'){ if(yych <= ':'){ if(yych <= '9') goto yy84; goto yy81; } else { if(yych == 'B') goto yy77; goto yy84; } } else { if(yych <= 'b'){ if(yych <= 'F') goto yy79; if(yych <= 'a') goto yy84; goto yy77; } else { if(yych == 'f') goto yy79; goto yy84; } } yy5: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if(yych == '.') goto yy61; if(yych <= '/') goto yy6; if(yych <= '9') goto yy59; goto yy6; yy6: #line 303 "./modules/parsers/gas/gas-token.re" { RETURN(s->tok[0]); } #line 431 "gas-token.c" yy7: yych = *++YYCURSOR; if(yybm[0+yych] & 16) { goto yy49; } goto yy37; yy8: #line 310 "./modules/parsers/gas/gas-token.re" { lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN); lvalp->str.len = TOKLEN; RETURN(ID); } #line 444 "gas-token.c" yy9: yych = *++YYCURSOR; goto yy10; yy10: #line 289 "./modules/parsers/gas/gas-token.re" { goto charconst; } #line 452 "gas-token.c" yy11: yych = *++YYCURSOR; goto yy12; yy12: #line 294 "./modules/parsers/gas/gas-token.re" { goto stringconst; } #line 460 "gas-token.c" yy13: yych = *++YYCURSOR; if(yych == '<') goto yy47; goto yy14; yy14: #line 301 "./modules/parsers/gas/gas-token.re" { RETURN(LEFT_OP); } #line 467 "gas-token.c" yy15: yych = *++YYCURSOR; if(yych == '>') goto yy45; goto yy16; yy16: #line 302 "./modules/parsers/gas/gas-token.re" { RETURN(RIGHT_OP); } #line 474 "gas-token.c" yy17: yych = *++YYCURSOR; goto yy6; yy18: yych = *++YYCURSOR; if(yych == '*') goto yy43; if(yych == '/') goto yy41; goto yy6; yy19: yych = *++YYCURSOR; goto yy20; yy20: #line 304 "./modules/parsers/gas/gas-token.re" { parser_gas->state = INITIAL; RETURN(s->tok[0]); } #line 489 "gas-token.c" yy21: yych = *++YYCURSOR; goto yy37; yy22: yych = *++YYCURSOR; if(yybm[0+yych] & 2) { goto yy33; } goto yy23; yy23: #line 407 "./modules/parsers/gas/gas-token.re" { yasm_warn_set(YASM_WARN_UNREC_CHAR, N_("ignoring unrecognized character `%s'"), yasm__conv_unprint(s->tok[0])); goto scan; } #line 505 "gas-token.c" yy24: yych = *++YYCURSOR; goto yy25; yy25: #line 389 "./modules/parsers/gas/gas-token.re" { if (parser_gas->is_cpp_preproc) { RETURN(CPP_LINE_MARKER); } else goto line_comment; } #line 517 "gas-token.c" yy26: yych = *++YYCURSOR; goto yy32; yy27: #line 398 "./modules/parsers/gas/gas-token.re" { goto scan; } #line 523 "gas-token.c" yy28: yych = *++YYCURSOR; goto yy29; yy29: #line 400 "./modules/parsers/gas/gas-token.re" { if (parser_gas->save_input) cursor = save_line(parser_gas, cursor); parser_gas->state = INITIAL; RETURN(s->tok[0]); } #line 534 "gas-token.c" yy30: yych = *++YYCURSOR; goto yy23; yy31: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy32; yy32: if(yybm[0+yych] & 1) { goto yy31; } goto yy27; yy33: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy34; yy34: if(yybm[0+yych] & 2) { goto yy33; } goto yy35; yy35: #line 327 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; if (parser_gas->is_nasm_preproc && strcmp(TOK+1, "line") == 0) { s->tok[TOKLEN] = savech; RETURN(NASM_LINE_MARKER); } switch (yasm_arch_parse_check_regtmod (p_object->arch, TOK+1, TOKLEN-1, &lvalp->arch_data)) { case YASM_ARCH_REG: s->tok[TOKLEN] = savech; RETURN(REG); case YASM_ARCH_REGGROUP: s->tok[TOKLEN] = savech; RETURN(REGGROUP); case YASM_ARCH_SEGREG: s->tok[TOKLEN] = savech; RETURN(SEGREG); default: break; } yasm_error_set(YASM_ERROR_GENERAL, N_("Unrecognized register name `%s'"), s->tok); s->tok[TOKLEN] = savech; lvalp->arch_data = 0; RETURN(REG); } #line 583 "gas-token.c" yy36: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy37; yy37: if(yybm[0+yych] & 4) { goto yy36; } if(yych != '@') goto yy8; goto yy38; yy38: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy39; yy39: if(yybm[0+yych] & 8) { goto yy38; } goto yy40; yy40: #line 317 "./modules/parsers/gas/gas-token.re" { /* if @ not part of ID, move the scanner cursor to the first @ */ if (!((yasm_objfmt_base *)p_object->objfmt)->module->id_at_ok) cursor = (unsigned char *)strchr(TOK, '@'); lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN); lvalp->str.len = TOKLEN; RETURN(ID); } #line 611 "gas-token.c" yy41: yych = *++YYCURSOR; goto yy42; yy42: #line 396 "./modules/parsers/gas/gas-token.re" { goto line_comment; } #line 617 "gas-token.c" yy43: yych = *++YYCURSOR; goto yy44; yy44: #line 388 "./modules/parsers/gas/gas-token.re" { parser_gas->state = COMMENT; goto comment; } #line 623 "gas-token.c" yy45: yych = *++YYCURSOR; goto yy46; yy46: #line 300 "./modules/parsers/gas/gas-token.re" { RETURN(RIGHT_OP); } #line 629 "gas-token.c" yy47: yych = *++YYCURSOR; goto yy48; yy48: #line 299 "./modules/parsers/gas/gas-token.re" { RETURN(LEFT_OP); } #line 635 "gas-token.c" yy49: ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy50; yy50: if(yybm[0+yych] & 16) { goto yy49; } if(yych <= 'E'){ if(yych <= '.'){ if(yych == '$') goto yy36; if(yych >= '.') goto yy36; goto yy51; } else { if(yych <= '?') goto yy51; if(yych <= '@') goto yy38; if(yych <= 'D') goto yy36; goto yy52; } } else { if(yych <= '`'){ if(yych <= 'Z') goto yy36; if(yych == '_') goto yy36; goto yy51; } else { if(yych == 'e') goto yy52; if(yych <= 'z') goto yy36; goto yy51; } } yy51: #line 266 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->flt = yasm_floatnum_create(TOK); s->tok[TOKLEN] = savech; RETURN(FLTNUM); } #line 674 "gas-token.c" yy52: yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); if(yych <= ','){ if(yych == '+') goto yy55; goto yy37; } else { if(yych <= '-') goto yy55; if(yych <= '/') goto yy37; if(yych >= ':') goto yy37; goto yy53; } yy53: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy54; yy54: if(yych <= '?'){ if(yych <= '-'){ if(yych == '$') goto yy36; goto yy51; } else { if(yych <= '.') goto yy36; if(yych <= '/') goto yy51; if(yych <= '9') goto yy53; goto yy51; } } else { if(yych <= '^'){ if(yych <= '@') goto yy38; if(yych <= 'Z') goto yy36; goto yy51; } else { if(yych == '`') goto yy51; if(yych <= 'z') goto yy36; goto yy51; } } yy55: yych = *++YYCURSOR; if(yych <= '/') goto yy56; if(yych <= '9') goto yy57; goto yy56; yy56: YYCURSOR = YYMARKER; switch(yyaccept){ case 0: goto yy3; case 6: goto yy91; case 3: goto yy51; case 4: goto yy66; case 5: goto yy87; case 1: goto yy6; case 2: goto yy8; } yy57: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy58; yy58: if(yych <= '/') goto yy51; if(yych <= '9') goto yy57; goto yy51; yy59: ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy60; yy60: if(yych == '.') goto yy65; if(yych <= '/') goto yy56; if(yych <= '9') goto yy59; goto yy56; yy61: yych = *++YYCURSOR; if(yych <= '/') goto yy56; if(yych >= ':') goto yy56; goto yy62; yy62: yyaccept = 3; YYMARKER = ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy63; yy63: if(yych <= 'D'){ if(yych <= '/') goto yy51; if(yych <= '9') goto yy62; goto yy51; } else { if(yych <= 'E') goto yy64; if(yych != 'e') goto yy51; goto yy64; } yy64: yych = *++YYCURSOR; if(yych <= ','){ if(yych == '+') goto yy55; goto yy56; } else { if(yych <= '-') goto yy55; if(yych <= '/') goto yy56; if(yych <= '9') goto yy57; goto yy56; } yy65: yyaccept = 4; yych = *(YYMARKER = ++YYCURSOR); if(yych <= 'D'){ if(yych <= '/') goto yy66; if(yych <= '9') goto yy67; goto yy66; } else { if(yych <= 'E') goto yy69; if(yych == 'e') goto yy69; goto yy66; } yy66: #line 273 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->flt = yasm_floatnum_create(TOK); s->tok[TOKLEN] = savech; RETURN(FLTNUM); } #line 788 "gas-token.c" yy67: yyaccept = 3; YYMARKER = ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy68; yy68: if(yych <= 'D'){ if(yych <= '/') goto yy51; if(yych <= '9') goto yy67; goto yy51; } else { if(yych <= 'E') goto yy73; if(yych == 'e') goto yy73; goto yy51; } yy69: yych = *++YYCURSOR; if(yych <= ','){ if(yych != '+') goto yy56; goto yy70; } else { if(yych <= '-') goto yy70; if(yych <= '/') goto yy56; if(yych <= '9') goto yy71; goto yy56; } yy70: yych = *++YYCURSOR; if(yych <= '/') goto yy56; if(yych >= ':') goto yy56; goto yy71; yy71: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy72; yy72: if(yych <= '/') goto yy66; if(yych <= '9') goto yy71; goto yy66; yy73: yych = *++YYCURSOR; if(yych <= ','){ if(yych != '+') goto yy56; goto yy74; } else { if(yych <= '-') goto yy74; if(yych <= '/') goto yy56; if(yych <= '9') goto yy75; goto yy56; } yy74: yych = *++YYCURSOR; if(yych <= '/') goto yy56; if(yych >= ':') goto yy56; goto yy75; yy75: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy76; yy76: if(yych <= '/') goto yy51; if(yych <= '9') goto yy75; goto yy51; yy77: yych = *++YYCURSOR; goto yy78; yy78: #line 379 "./modules/parsers/gas/gas-token.re" { /* build local label name */ lvalp->str.contents = yasm_xmalloc(30); lvalp->str.len = sprintf(lvalp->str.contents, "L%c\001%lu", s->tok[0], parser_gas->local[s->tok[0]-'0']); RETURN(ID); } #line 857 "gas-token.c" yy79: yych = *++YYCURSOR; goto yy80; yy80: #line 369 "./modules/parsers/gas/gas-token.re" { /* build local label name */ lvalp->str.contents = yasm_xmalloc(30); lvalp->str.len = sprintf(lvalp->str.contents, "L%c\001%lu", s->tok[0], parser_gas->local[s->tok[0]-'0']+1); RETURN(ID); } #line 870 "gas-token.c" yy81: yych = *++YYCURSOR; goto yy82; yy82: #line 357 "./modules/parsers/gas/gas-token.re" { /* increment label index */ parser_gas->local[s->tok[0]-'0']++; /* build local label name */ lvalp->str.contents = yasm_xmalloc(30); lvalp->str.len = sprintf(lvalp->str.contents, "L%c\001%lu", s->tok[0], parser_gas->local[s->tok[0]-'0']); RETURN(LABEL); } #line 885 "gas-token.c" yy83: ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy84; yy84: if(yych == '.') goto yy65; if(yych <= '/') goto yy3; if(yych <= '9') goto yy83; goto yy3; yy85: yych = *++YYCURSOR; if(yybm[0+yych] & 128) { goto yy104; } goto yy78; yy86: yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); if(yych == '+') goto yy96; if(yych == '-') goto yy96; goto yy97; yy87: #line 280 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->flt = yasm_floatnum_create(TOK+2); s->tok[TOKLEN] = savech; RETURN(FLTNUM); } #line 913 "gas-token.c" yy88: yyaccept = 5; yych = *(YYMARKER = ++YYCURSOR); if(yych == '+') goto yy96; if(yych == '-') goto yy96; goto yy97; yy89: yyaccept = 6; YYMARKER = ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy90; yy90: if(yybm[0+yych] & 32) { goto yy89; } if(yych == '.') goto yy65; if(yych <= '/') goto yy91; if(yych <= '9') goto yy59; goto yy91; yy91: #line 247 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->intn = yasm_intnum_create_oct(TOK); s->tok[TOKLEN] = savech; RETURN(INTNUM); } #line 940 "gas-token.c" yy92: yych = *++YYCURSOR; if(yybm[0+yych] & 64) { goto yy93; } goto yy56; yy93: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy94; yy94: if(yybm[0+yych] & 64) { goto yy93; } goto yy95; yy95: #line 256 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; /* skip 0 and x */ lvalp->intn = yasm_intnum_create_hex(TOK+2); s->tok[TOKLEN] = savech; RETURN(INTNUM); } #line 964 "gas-token.c" yy96: yyaccept = 5; YYMARKER = ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy97; yy97: if(yych <= '9'){ if(yych == '.') goto yy98; if(yych <= '/') goto yy87; goto yy96; } else { if(yych <= 'E'){ if(yych <= 'D') goto yy87; goto yy100; } else { if(yych == 'e') goto yy100; goto yy87; } } yy98: yyaccept = 5; YYMARKER = ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy99; yy99: if(yych <= 'D'){ if(yych <= '/') goto yy87; if(yych <= '9') goto yy98; goto yy87; } else { if(yych <= 'E') goto yy100; if(yych != 'e') goto yy87; goto yy100; } yy100: yych = *++YYCURSOR; if(yych <= ','){ if(yych != '+') goto yy56; goto yy101; } else { if(yych <= '-') goto yy101; if(yych <= '/') goto yy56; if(yych <= '9') goto yy102; goto yy56; } yy101: yych = *++YYCURSOR; if(yych <= '/') goto yy56; if(yych >= ':') goto yy56; goto yy102; yy102: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy103; yy103: if(yych <= '/') goto yy87; if(yych <= '9') goto yy102; goto yy87; yy104: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy105; yy105: if(yybm[0+yych] & 128) { goto yy104; } goto yy106; yy106: #line 238 "./modules/parsers/gas/gas-token.re" { savech = s->tok[TOKLEN]; s->tok[TOKLEN] = '\0'; lvalp->intn = yasm_intnum_create_bin(TOK+2); s->tok[TOKLEN] = savech; RETURN(INTNUM); } #line 1035 "gas-token.c" } } #line 413 "./modules/parsers/gas/gas-token.re" /* C-style comment; nesting not supported */ comment: SCANINIT(); { #line 1047 "gas-token.c" { YYCTYPE yych; goto yy107; ++YYCURSOR; yy107: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if(yych == '\n') goto yy111; if(yych != '*') goto yy113; goto yy109; yy109: yych = *++YYCURSOR; if(yych == '/') goto yy114; goto yy110; yy110: #line 429 "./modules/parsers/gas/gas-token.re" { if (cursor == s->eof) return 0; goto comment; } #line 1068 "gas-token.c" yy111: yych = *++YYCURSOR; goto yy112; yy112: #line 423 "./modules/parsers/gas/gas-token.re" { if (parser_gas->save_input) cursor = save_line(parser_gas, cursor); RETURN(s->tok[0]); } #line 1078 "gas-token.c" yy113: yych = *++YYCURSOR; goto yy110; yy114: yych = *++YYCURSOR; goto yy115; yy115: #line 421 "./modules/parsers/gas/gas-token.re" { parser_gas->state = INITIAL; goto scan; } #line 1086 "gas-token.c" } } #line 434 "./modules/parsers/gas/gas-token.re" /* Single line comment. */ line_comment: { static unsigned char yybm[] = { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; #line 1130 "gas-token.c" { YYCTYPE yych; goto yy116; yy117: ++YYCURSOR; yy116: if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy118; yy118: if(yybm[0+yych] & 128) { goto yy117; } goto yy119; yy119: #line 439 "./modules/parsers/gas/gas-token.re" { goto scan; } #line 1146 "gas-token.c" } } #line 440 "./modules/parsers/gas/gas-token.re" /* .section directive (the section name portion thereof) */ section_directive: SCANINIT(); { static unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #line 1192 "gas-token.c" { YYCTYPE yych; goto yy120; ++YYCURSOR; yy120: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if(yych <= '$'){ if(yych <= '\r'){ if(yych <= '\t'){ if(yych <= '\b') goto yy132; goto yy126; } else { if(yych <= '\n') goto yy130; if(yych <= '\f') goto yy132; goto yy126; } } else { if(yych <= '!'){ if(yych == ' ') goto yy126; goto yy132; } else { if(yych <= '"') goto yy124; if(yych <= '#') goto yy132; goto yy122; } } } else { if(yych <= '@'){ if(yych <= '.'){ if(yych <= '+') goto yy132; if(yych <= ',') goto yy128; goto yy122; } else { if(yych <= '/') goto yy132; if(yych >= ':') goto yy132; goto yy122; } } else { if(yych <= '_'){ if(yych <= 'Z') goto yy122; if(yych <= '^') goto yy132; goto yy122; } else { if(yych <= '`') goto yy132; if(yych >= '{') goto yy132; goto yy122; } } } yy122: yych = *++YYCURSOR; goto yy137; yy123: #line 447 "./modules/parsers/gas/gas-token.re" { lvalp->str.contents = yasm__xstrndup(TOK, TOKLEN); lvalp->str.len = TOKLEN; parser_gas->state = INITIAL; RETURN(ID); } #line 1253 "gas-token.c" yy124: yych = *++YYCURSOR; goto yy125; yy125: #line 454 "./modules/parsers/gas/gas-token.re" { goto stringconst; } #line 1259 "gas-token.c" yy126: yych = *++YYCURSOR; goto yy135; yy127: #line 456 "./modules/parsers/gas/gas-token.re" { goto section_directive; } #line 1265 "gas-token.c" yy128: yych = *++YYCURSOR; goto yy129; yy129: #line 458 "./modules/parsers/gas/gas-token.re" { parser_gas->state = INITIAL; RETURN(s->tok[0]); } #line 1274 "gas-token.c" yy130: yych = *++YYCURSOR; goto yy131; yy131: #line 463 "./modules/parsers/gas/gas-token.re" { if (parser_gas->save_input) cursor = save_line(parser_gas, cursor); parser_gas->state = INITIAL; RETURN(s->tok[0]); } #line 1285 "gas-token.c" yy132: yych = *++YYCURSOR; goto yy133; yy133: #line 470 "./modules/parsers/gas/gas-token.re" { yasm_warn_set(YASM_WARN_UNREC_CHAR, N_("ignoring unrecognized character `%s'"), yasm__conv_unprint(s->tok[0])); goto section_directive; } #line 1296 "gas-token.c" yy134: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy135; yy135: if(yybm[0+yych] & 64) { goto yy134; } goto yy127; yy136: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy137; yy137: if(yybm[0+yych] & 128) { goto yy136; } goto yy123; } } #line 476 "./modules/parsers/gas/gas-token.re" /* filename portion of nasm preproc %line */ nasm_filename: strbuf = yasm_xmalloc(STRBUF_ALLOC_SIZE); strbuf_size = STRBUF_ALLOC_SIZE; count = 0; nasm_filename_scan: SCANINIT(); { static unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #line 1363 "gas-token.c" { YYCTYPE yych; goto yy138; ++YYCURSOR; yy138: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if(yych <= '\f'){ if(yych <= '\b') goto yy144; if(yych <= '\t') goto yy142; if(yych >= '\v') goto yy144; goto yy140; } else { if(yych <= '\r') goto yy142; if(yych == ' ') goto yy142; goto yy144; } yy140: yych = *++YYCURSOR; goto yy141; yy141: #line 488 "./modules/parsers/gas/gas-token.re" { strbuf_append(count++, cursor, s, '\0'); lvalp->str.contents = (char *)strbuf; lvalp->str.len = count; parser_gas->state = INITIAL; RETURN(STRING); } #line 1392 "gas-token.c" yy142: yych = *++YYCURSOR; goto yy147; yy143: #line 496 "./modules/parsers/gas/gas-token.re" { goto nasm_filename_scan; } #line 1398 "gas-token.c" yy144: yych = *++YYCURSOR; goto yy145; yy145: #line 498 "./modules/parsers/gas/gas-token.re" { if (cursor == s->eof) { strbuf_append(count++, cursor, s, '\0'); lvalp->str.contents = (char *)strbuf; lvalp->str.len = count; parser_gas->state = INITIAL; RETURN(STRING); } strbuf_append(count++, cursor, s, s->tok[0]); goto nasm_filename_scan; } #line 1414 "gas-token.c" yy146: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy147; yy147: if(yybm[0+yych] & 128) { goto yy146; } goto yy143; } } #line 509 "./modules/parsers/gas/gas-token.re" /* character constant values */ charconst: /*TODO*/ /* string constant values */ stringconst: strbuf = yasm_xmalloc(STRBUF_ALLOC_SIZE); strbuf_size = STRBUF_ALLOC_SIZE; count = 0; stringconst_scan: SCANINIT(); { #line 1443 "gas-token.c" { YYCTYPE yych; goto yy148; ++YYCURSOR; yy148: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if(yych == '"') goto yy152; if(yych != '\\') goto yy154; goto yy150; yy150: yych = *++YYCURSOR; if(yych != '\n') goto yy155; goto yy151; yy151: #line 547 "./modules/parsers/gas/gas-token.re" { if (cursor == s->eof) { yasm_error_set(YASM_ERROR_SYNTAX, N_("unexpected end of file in string")); lvalp->str.contents = (char *)strbuf; lvalp->str.len = count; RETURN(STRING); } strbuf_append(count++, cursor, s, s->tok[0]); goto stringconst_scan; } #line 1470 "gas-token.c" yy152: yych = *++YYCURSOR; goto yy153; yy153: #line 539 "./modules/parsers/gas/gas-token.re" { strbuf_append(count, cursor, s, '\0'); yasm_unescape_cstring(strbuf, &count); lvalp->str.contents = (char *)strbuf; lvalp->str.len = count; RETURN(STRING); } #line 1482 "gas-token.c" yy154: yych = *++YYCURSOR; goto yy151; yy155: yych = *++YYCURSOR; goto yy156; yy156: #line 526 "./modules/parsers/gas/gas-token.re" { if (cursor == s->eof) { yasm_error_set(YASM_ERROR_SYNTAX, N_("unexpected end of file in string")); lvalp->str.contents = (char *)strbuf; lvalp->str.len = count; RETURN(STRING); } strbuf_append(count++, cursor, s, '\\'); strbuf_append(count++, cursor, s, s->tok[1]); goto stringconst_scan; } #line 1501 "gas-token.c" } } #line 558 "./modules/parsers/gas/gas-token.re" }
/* * dispHelp */ static int dispHelp( char *str, VTAB *tab ) { EVENT ev; bool done; int lastline; int start; SAREA use; SAREA line; char helpname[81]; ignoreMouseRelease = true; helpSet( str, helpname, sizeof( helpname ) ); if( uivopen( &helpScreen ) == NULL ) return( HELP_NO_VOPEN ); use.height = helpScreen.area.height - 3; use.width = helpScreen.area.width; use.col = 0; line.height = 1; line.width = helpScreen.area.width; line.col = 0; topPos = HelpTell( helpFileHdl ); mygetline(); handleHeader( &start, &line ); use.row = start; use.height -= start; handleFooter( &start, &use, &line ); setupScrollBar( &use ); if( helpLines > 0 ) { maxPos = helpLines + 1; helpPos = HelpMemAlloc( maxPos * sizeof( *helpPos ) ); } else { maxPos = 0; helpPos = NULL; } maxLine = 0; lastHelpLine = 0; save_line( 0, topPos ); currLine = helpStack->line; seek_line( currLine ); lastline = currLine + use.height; done = false; ev = EV_NO_EVENT; while( !done ) { currentColour = C_PLAIN; currentAttr = AT( ATTR_NORMAL ); if( lastline != currLine ) { lastline = scrollHelp( &use, lastline, ( ev != EV_NO_EVENT ) ); } ev = hlpwait( tab ); switch( ev ) { case E_UP: case EV_CURSOR_UP: case EV_TOP: if( currLine > 0 ) { --currLine; } break; case E_DOWN: case EV_CURSOR_DOWN: case EV_BOTTOM: ++currLine; if( maxLine != 0 && currLine+use.height > maxLine ) { --currLine; } break; case EV_SCROLL_VERTICAL: currLine = vGadget.pos; break; case EV_PAGE_UP: currLine -= use.height; if( currLine < 0 ) { currLine = 0; } break; case EV_PAGE_DOWN: currLine += use.height; if( maxLine != 0 && currLine >= maxLine ) { currLine -= use.height; } break; default: done = true; break; } } clearline(); uivclose( &helpScreen ); if( helpPos != NULL ) { HelpMemFree( helpPos ); helpPos = NULL; } return( HELP_OK ); }