static void _dxf_DRAW_ARROWHEAD (void* ctx, float ax, float ay) { double angle, hyp, length ; float x1, y1 ; float p[2] ; ENTRY(("_dxf_DRAW_ARROWHEAD(0x%x, %f, %f)",ctx, ax, ay)); hyp = sqrt(ax*ax + ay*ay) ; if (hyp == 0.0) { EXIT(("hyp == 0.0")); return ; } if (hyp < 0.2) length = 0.06 ; else length = 0.12 ; angle = acos((double)(-ax/hyp)) ; if (ay > 0) angle = 2*M_PI - angle ; angle = angle + M_PI/6 ; if (angle > 2*M_PI) angle = angle - 2*M_PI ; x1 = cos(angle) * length ; y1 = sin(angle) * length ; bgnline() ; p[0] = ax ; p[1] = ay ; v2f(p) ; p[0] = ax + x1 ; p[1] = ay + y1 ; v2f(p) ; endline() ; angle = angle - M_PI/3 ; if (angle < 0) angle = angle + 2*M_PI ; x1 = cos(angle) * length ; y1 = sin(angle) * length ; bgnline() ; p[0] = ax ; p[1] = ay ; v2f(p) ; p[0] = ax + x1 ; p[1] = ay + y1 ; v2f(p) ; endline() ; EXIT(("")); }
static void oput(int ch) /* int ch; / * next output character */ { /* * * Responsible for adding all printing characters from the input file to the * open string on top of the stack. The only other characters that end up in * that string are the quotes required for special characters. Reverse printing * mode hasn't been tested but it should be close. hpos and lastx should disagree * each time (except after startline() does something), and that should force a * call to endstring() for every character. * */ if ( stringcount > 100 ) /* don't put too much on the stack */ endline(); if ( vpos != lasty ) endline(); if ( advance == -1 ) /* for reverse printing - move first */ hmot(hmi); startline(); if ( lastc != ch || hpos != prevx ) { if ( lastx != hpos ) endstring(); if ( isascii(ch) && isprint(ch) ) { if ( ch == '\\' || ch == '(' || ch == ')' ) putc('\\', fp_out); putc(ch, fp_out); } else fprintf(fp_out, "\\%.3o", ch & 0377); lastc = ch; prevx = hpos; lastx += lasthmi; } /* End if */ if ( advance != -1 ) hmot(hmi); markedpage = TRUE; } /* End of oput */
void endfile( unsigned int *x ) { int count, linenum; storeline( curline ); curline = sentinel->previous; curpage = curline; lineno = findlineno( curline ); if ( pagebreak ) { linenum = findlineno( curpage ); } count = wind.width - 1; while ( ( count != 0 ) && ( curpage->previous != sentinel ) ) { if ( pagebreak ) { if ( ( linenum % lineperpage ) != 0 ) { curpage = curpage->previous; linenum--; } } else { curpage = curpage->previous; } count--; } loadtoline( curline->text ); endline( x ); pagecomplete = NO; }
void backword( unsigned int *x ) { int i; i = *x + firstcol + 1; if ( i != 1 ) { /* first column ? */ if ( ( !ISBLANK( workline.middle[i] ) ) && ( !ISBLANK( workline.middle[i - 1] ) ) ) { while ( ( !ISBLANK( workline.middle[i] ) ) && ( i > 0 ) ) { i--; } } else { if ( ISBLANK( workline.middle[i - 1] ) ) { i--; } while ( ISBLANK( workline.middle[i] ) && ( i > 0 ) ) { i--; } while ( !ISBLANK( workline.middle[i] ) && ( i > 0 ) ) { i--; } } gocol( i, x ); if ( ( i == 0 ) && ( ISBLANK( workline.middle[1] ) ) ) { backword( x ); } } else { if ( curline->previous != sentinel ) { cursor_up( ); endline( x ); } } }
void Edge::Draw(unsigned int stamp) // This is a recursive drawing routine that uses time stamps to // determine if the edge has already been drawn. This is given // here for testing purposes only: it is not efficient, and for // large triangulations the stack might overflow. A better way // of doing this (and other traversals of the edges) is to maintain // a list of edges in the corresponding Subdivision object. This // list should be updated every time an edge is created or destroyed. { if (Qedge()->TimeStamp(stamp)) { // Draw the edge Point2d a = Org2d(); Point2d b = Dest2d(); bgnline(); v2d((double*)&a); v2d((double*)&b); endline(); // visit neighbors Onext()->Draw(stamp); Oprev()->Draw(stamp); Dnext()->Draw(stamp); Dprev()->Draw(stamp); } }
static void htab(void) { int col; /* 'column' we'll be at next */ int i; /* loop index */ /* * * Tries to figure out where the next tab stop is. Wasn't positive about this * one, since hmi can change. I'll assume columns are determined by the original * value of hmi. That fixes them on the page, which seems to make more sense than * letting them float all over the place. * */ endline(); col = hpos/ohmi + 1; for ( i = col; i < ROWS; i++ ) if ( htabstops[i] == ON ) { col = i; break; } /* End if */ hgoto(col * ohmi); lastx = hpos; } /* End of htab */
static void vtab(void) { int line; /* line we'll be at next */ int i; /* loop index */ /* * * Looks for the next vertical tab stop in the vtabstops[] array and moves to that * line. If we don't find a tab we'll just move down one line - shouldn't happen. * */ endline(); line = vpos/ovmi + 1; for ( i = line; i < COLUMNS; i++ ) if ( vtabstops[i] == ON ) { line = i; break; } /* End if */ vgoto(line * ovmi); } /* End of vtab */
void print_item(string tag) { string type, stag; int *dims; type = get_type(instr, tag); if (streq(type, SetType)) { get_set(instr, tag); print_set(tag); while ((stag = next_item_tag(instr)) != NULL) { print_item(stag); free(stag); } get_tes(instr, tag); print_tes(tag); } else { dims = get_dimensions(instr, tag); print_head(tag, type, dims); print_data(tag, type, dims); endline(); if (dims != NULL) free(dims); } free(type); }
std::ostream& print(std::ostream& os) const { return endline(os << _indent << (isfloat<T>() ? "write_imagef(" : "write_imageui(") << _image.name() << ", (int2)(" << _x.name() << ", " << _y.name() << "), " << _value.name() << ")"); }
void print_tes(string tag) { char buf[128]; incindent(- indent); sprintf(buf, "tes"); (void) outstr(buf); endline(); }
void print_set(string tag) { char buf[128]; sprintf(buf, "set %s", tag); (void) outstr(buf); endline(); incindent(indent); }
void test_kdTree_find_shape(kdTree * tree, vis_t ** grid, size_t m, size_t n, int show) { size_t k; pTimer tmr; ptimer_init(&tmr, CLOCK_PROCESS_CPUTIME_ID); ptimer_tic(&tmr); kdTree_reset_fbs(tree); size_t hitnum = 0; for (k = 0; k < m * n; k++) { const vis_t * elm = grid[k]; if (show) { printf("finding "); vis_fprint(stdout, elm); printf(" nr:%zd/%zd...", k, m * n); } int hit = kdTree_find_shape(tree, elm); if (hit) { hitnum++; } if (show) { printf("%s", hit ? "HIT: " : "MISS"); endline(); } } ptimer_toc(&tmr); printf("- Find: "); ptimer_print_sec_usec9(tmr); printf("[s]"); printf(" (%zd) %s ", hitnum, (hitnum == m * n) ? "SUCCESS" : "FAILURE"); if (show_bars) { int x = (int)rint(ptimer_get_sec(&tmr) * fac); mputchar(stdout, x, '#'); } endline(); }
void test_kdTree_ins_shape(kdTree * tree, vis_t ** grid, size_t m, size_t n, int show) { size_t k; pTimer tmr; ptimer_init(&tmr, CLOCK_PROCESS_CPUTIME_ID); ptimer_tic(&tmr); for (k = 0; k < m * n; k++) { vis_t * elm = grid[k]; if (show) { printf("inserting "); vis_fprint(stdout, elm); printf(" nr:%zd/%zd...", k, m * n); } kdTree_ins_shape(tree, elm); if (show) { kdTree_fprint(stdout, tree, TRUE); putsep(stdout); } if (show) { endline(); } } ptimer_toc(&tmr); printf("- Insertion: "); ptimer_print_sec_usec9(tmr); printf("[s]"); if (show_bars) { int x = (int)rint(ptimer_get_sec(&tmr) * fac); putchar(' '); mputchar(stdout, x, '#'); } endline(); }
void cursor_left( unsigned *x ) { unsigned i = *x + firstcol; if ( i != 0 ) { /* Home of line ? */ gocol( i - 1, x ); } else { if ( curline->previous != sentinel ) { cursor_up( ); /* go to end of */ endline( x ); /* previous line */ } } }
int test_bitvec_none_all(char ch) { Bitvec a; bitvec_initbytes(&a, 1, &ch); fprintf(stdout, "a: "); bitvec_fprint(stdout, &a); fprintf(stdout, "none1:%d all1:%d", bitvec_none1(&a), bitvec_all1(&a)); endline(); bitvec_clear(&a); return 0; }
void cursor_left( unsigned int *p_xCursorPos ) { unsigned int i = *p_xCursorPos + firstcol; if ( i != 0 ) { /* Home of line ? */ gocol( i - 1, p_xCursorPos ); } else { if ( curline->previous != sentinel ) { cursor_up( ); /* go to end of */ endline( p_xCursorPos ); /* previous line */ } } }
void test_ieee754(void) { int i; float x; printf("mantissa-digits: %d\n", FLT_MANT_DIG); printf("enter x:"); int ret = scanf("%f", &x); if (ret == 1) { float_binfprint(stdout, x); endline(); } else { lperror("scanf"); } for (i = 0; i < 32; i++) { uint d = 1 << i; printf("d=%08x x=", d); float_binfprint(stdout, d); endline(); } }
static void act_end(void) { fileoffset_t new_top; cur_pos = endline(cur_pos); edit_type = !!edit_type; if (cur_pos >= file_size) cur_pos = file_size; new_top = cur_pos - (scrlines-1) * width; if (new_top < 0) new_top = 0; new_top = begline(new_top); if (top_pos < new_top) top_pos = new_top; }
void quick( unsigned int *x, unsigned int *y ) { register int key; dispkey( CNTRL_Q ); waitkbd( 3, 2 ); key = ebioskey( 0 ) & 0xff; prchar( key, 0, 3, 2 ); if ( !isalpha( key ) && !iscntrl( key ) ) { return; } switch ( key & 0x1f ) { case 'r' - 'a' + 1: topfile( x ); break; case 'c' - 'a' + 1: endfile( x ); break; case 'f' - 'a' + 1: searching( x, y ); break; case 'a' - 'a' + 1: replacing( x, y ); break; case 'y' - 'a' + 1: deltoendline( *x, *y ); break; case 'l' - 'a' + 1: loadtoline( curline->text ); refreshline( 0, *y ); break; case 'b' - 'a' + 1: gobeginblk( x ); break; case 'k' - 'a' + 1: goendblk( x ); break; case 'd' - 'a' + 1: endline( x ); break; case 's' - 'a' + 1: home( x ); break; case 'x' - 'a' + 1: bottom_of_page( ); break; case 'e' - 'a' + 1: top_of_page( ); break; } }
int vcs_status(std::vector<VCS_STATUS_t>& status_list_return, const char * dir, VCS_t vcs) { int ret = -1; pTimer tmr; ptimer_tic(&tmr); if (vcs == VCS_undefined_) { // TODO: use SemNet pPatts to figure out \c vcs from contents of current directory (\c Dir) and matchers for these. vcs = VCS_GIT; } pid_t child = -1; // child process int out, err; const char * envp[] = { nullptr }; const char * cmd = nullptr; const char * op = "status"; const char * flag = "-S"; switch (vcs) { case VCS_CVS: cmd = "cvs"; break; case VCS_SVN: cmd = "svn"; break; case VCS_GIT: cmd = "git"; flag = "-s"; break; case VCS_BZR: cmd = "bzr"; break; case VCS_HG: cmd = "hg"; break; case VCS_DARCS: cmd = "darcs"; op = "show"; break; default: break; } const char * argv[] = { cmd, op, flag, nullptr }; ret = auto_required_spawn(find_executable_by_name(cmd).c_str(), dir, const_cast<char* const*>(argv), const_cast<char* const*>(envp), &child, nullptr, &out, &err); int status; waitpid(child, &status, 0); // wait for process to terminate std::cout << "status:" << status << std::endl; ptimer_toc(&tmr); ptimer_print_sec_usec9(tmr); endline(); int rc, c; // read out std::cout << "out:" << std::endl; while ((rc = read(out, &c, 1)) > 0) { std::cout << char(c); } // read err std::cerr << "err:" << std::endl; while ((rc = read(err, &c, 1)) > 0) { std::cout << char(c); } return ret; }
static void changefont(char *name) { /* * * Changes the current font. Used to get in and out of auto underscore and bold * printing. * */ endline(); fprintf(fp_out, "%s f\n", name); } /* End of changefont */
/* Print a string */ static void prstr( const char *string) { size_t len = strlen(string) + 1; /* * If this string overflows this line, and there's other stuff * on the line, create a new one. */ if (linelen > 0 && linelen + len >= RMARGIN - LMARGIN) { endline(); startline(""); } g_printf(" %s", string); linelen += len; }
void test_kdTree_rbal(kdTree * tree, int show) { pTimer tmr; ptimer_init(&tmr, CLOCK_PROCESS_CPUTIME_ID); ptimer_tic(&tmr); kdTree_rbal(tree); ptimer_toc(&tmr); printf("- Balance: "); ptimer_print_sec_usec9(tmr); printf("[s]"); if (show_bars) { int x = (int)rint(ptimer_get_sec(&tmr) * fac); mputchar(stdout, x, '#'); } endline(); }
int main(int argc, char *argv[]) { setIO("sample"); int n = gi; for(int i = 0;i<n;++i) a[i] = gi; int tn = 2*n; for(int i = 0;i<=tn;++i){ double phie = (2*PI*double(i)/double(tn)); powG[i] = ci(cos(phie),sin(phie)); } fft(tn,a,0,b); for(int i = 0;i<=tn;++i,printf("\n")) printf("%.4f %.4f",real(b[i]),imag(b[i])); for(int i = 0;i<=tn;++i,endline()) showci(powG[i]); closeIO(); return EXIT_SUCCESS; }
static void formfeed(void) { /* * * Called whenever we've finished with the last page and want to get ready for the * next one. Also used at the beginning and end of each input file, so we have to * be careful about what's done. I've added a simple test before the showpage that * should eliminate the extra blank page that was put out at the end of many jobs, * but the PAGES comments may be wrong. * */ if ( fp_out == stdout ) /* count the last page */ printed++; endline(); /* print the last line */ fprintf(fp_out, "cleartomark\n"); if ( feof(fp_in) == 0 || markedpage == TRUE ) fprintf(fp_out, "showpage\n"); fprintf(fp_out, "saveobj restore\n"); fprintf(fp_out, "%s %d %d\n", ENDPAGE, page, printed); if ( ungetc(getc(fp_in), fp_in) == EOF ) redirect(-1); else redirect(++page); fprintf(fp_out, "%s %d %d\n", PAGE, page, printed+1); fprintf(fp_out, "/saveobj save def\n"); fprintf(fp_out, "mark\n"); writerequest(printed+1, fp_out); fprintf(fp_out, "%d pagesetup\n", printed+1); vgoto(topmargin); hgoto(leftmargin); markedpage = FALSE; } /* End of formfeed */
void test_kdTree_rm_shape(kdTree * tree, vis_t ** grid, size_t m, size_t n, int show) { pTimer tmr; ptimer_init(&tmr, CLOCK_PROCESS_CPUTIME_ID); ptimer_tic(&tmr); size_t k, rmnum = 0; for (k = 0; k < m * n; k++) { vis_t * elm = grid[k]; if (show) { printf("removing "); vis_fprint(stdout, elm); printf(" nr:%zd/%zd...", k, m * n); } uint ok = kdTree_rm_shape(tree, elm); if (ok) { rmnum++; } if (show) { printf("%s\n", ok ? "HIT" : "MISS"); } } ptimer_toc(&tmr); printf("- Remove: "); ptimer_print_sec_usec9(tmr); printf("[s]"); printf(" (%zd) %s ", rmnum, (rmnum == m * n) ? "SUCCESS" : "FAILURE"); if (show_bars) { int x = (int)rint(ptimer_get_sec(&tmr) * fac); mputchar(stdout, x, '#'); } endline(); }
static void backspace(void) { /* * * Moves backwards a distance equal to the current value of hmi, but don't go * past the left margin. * */ endline(); if ( hpos - leftmargin >= hmi ) hmot(-hmi); else hgoto(leftmargin); /* maybe just ignore the backspace?? */ lastx = hpos; } /* End of backspace */
void test_no_branching(void) { int n; for (n = 16; n < 1024*1024*64; n *= 2) { int i; int std_sum, nob_sum; pTimer tmr; ptimer_init(&tmr, CLOCK_PROCESS_CPUTIME_ID); printf("n:%d ", n); ptimer_tic(&tmr); std_sum = 0; for (i = 0; i < n; i++) { std_sum ^= int_min2(i, n - i); } ptimer_toc(&tmr); printf("std:"); ptimer_print_sec_usec9(tmr); ptimer_tic(&tmr); nob_sum = 0; for (i = 0; i < n; i++) { nob_sum ^= int_min_no_branching(i, n - i); } ptimer_toc(&tmr); printf(" nob:"); ptimer_print_sec_usec9(tmr); if (std_sum != nob_sum) { printf(" NOT EQUAL!"); } else { printf(" sum:%d", std_sum); } endline(); } }
void nextword( unsigned int *x, unsigned int y ) { int i, j; i = *x + firstcol + 1; j = i; while ( !ISBLANK( workline.middle[i] ) && ( i != MAXCOL ) ) { i++; } while ( ISBLANK( workline.middle[i] ) && ( i != MAXCOL ) ) { i++; } if ( i != MAXCOL ) { i--; gocol( i, x ); } else { endline( x ); if ( ( *x + firstcol + 1 ) <= j ) { cursor_down( y ); home( x ); if ( ISBLANK( workline.middle[1] ) ) { nextword( x, y ); } } } }
int main( int argc, char *argv[] ) { /* (x,y) position of edit window. x column, y line -> (0,0) at upper left on screen */ unsigned int xCursorPos = 0; unsigned int yCursorPos = 0; unsigned int curmenu = 0x1100; int i; cwsetup( argc, argv ); writestatus( 0 ); writetab( ); splashscreen( ); /* Main program loop */ do { dispstrhgc( " ", wind.col, 2, NORMALATTR ); i = pulled_down_menu( &curmenu, &xCursorPos, &yCursorPos ); if ( filename[0] != '\0' ) { switch ( i ) { case RETKEY: keymain = menu_to_key( curmenu ); break; case ESCKEY: waitkbd( wind.col + xCursorPos, wind.row + yCursorPos ); /* Show blinking cursor */ keymain = readkbd( ); /* If keypressed Get it */ break; default: keymain = i; break; } while ( keymain != ESCKEY ) { if ( ( keymain & 0xff ) >= 32 ) { keymain = changekey( keymain ); if ( insertmode ) { if ( !insert_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } else { if ( !ovrwrite_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } refreshline( xCursorPos, yCursorPos ); } else { /* Function Key */ switch ( keymain ) { case PGUPKEY: case CNTRL_R: page_up( ); break; case PGDNKEY: case CNTRL_C: page_down( ); break; case UPKEY: case CNTRL_E: cursor_up( ); break; case DNKEY: case CNTRL_X: cursor_down( yCursorPos ); break; case LEKEY: case CNTRL_S: cursor_left( &xCursorPos ); break; case 0x2301: gobeginblk( &xCursorPos ); break; case 0x2401: goendblk( &xCursorPos ); break; case RIKEY: case CNTRL_D: cursor_right( &xCursorPos, yCursorPos ); break; case CNTRL_W: scroll_up( ); break; case CNTRL_Z: scroll_down( ); break; case CHOMEKEY: top_of_page( ); break; case CPGUPKEY: topfile( &xCursorPos ); break; case CENDKEY: bottom_of_page( ); break; case CPGDNKEY: endfile( &xCursorPos ); break; case DELKEY: case CNTRL_G: delete_char( xCursorPos ); refreshline( xCursorPos, yCursorPos ); changeflag = YES; break; case CNTRL_T: delete_word( xCursorPos ); refreshline( xCursorPos, yCursorPos ); changeflag = YES; break; case CNTRL_Y: delete_line( ); changeflag = YES; break; case CNTRL_M: case RETKEY: if ( insertmode == NO ) { returnkey( &xCursorPos, yCursorPos ); } else { ret_with_ins( &xCursorPos, yCursorPos ); changeflag = YES; } break; case BSKEY: case CNTRL_H: backspace( &xCursorPos ); yCursorPos = findrow( ); refreshline( 0, yCursorPos ); changeflag = YES; break; case INSKEY: case CNTRL_V: insertmode = !insertmode; writeinsmode( ); break; case CNTRL_N: insert_ret( &xCursorPos ); break; case F10KEY: thaimode = !thaimode; writelanguage( ); break; case F1KEY: fontused = 0x00; writeattr( ); break; case F2KEY: fontused = fontused | ITALICATTR; writeattr( ); break; case F3KEY: fontused = fontused | ONELINEATTR; fontused = fontused & 0x7f; writeattr( ); break; case F4KEY: fontused = fontused | TWOLINEATTR; fontused = fontused & 0xfe; writeattr( ); break; case F5KEY: fontused = fontused | BOLDATTR; writeattr( ); break; case F6KEY: fontused = fontused | ENLARGEATTR; writeattr( ); break; case F7KEY: fontused = fontused | SUPERATTR; if ( ( fontused & SUBATTR ) == SUBATTR ) { fontused = fontused ^ SUBATTR; } writeattr( ); break; case F8KEY: fontused = fontused | SUBATTR; if ( ( fontused & SUPERATTR ) == SUPERATTR ) { fontused = fontused ^ SUPERATTR; } writeattr( ); break; case F9KEY: manualwrap( &xCursorPos, &yCursorPos ); break; case ALTM: editmacro( ); break; case TABKEY: case CNTRL_I: movetotab( &xCursorPos, yCursorPos ); break; case CNTRL_K: blockcommand( &xCursorPos ); break; case 0x1401: blkcmd( 'p', &xCursorPos ); break; case 0x6101: blkcmd( 'b', &xCursorPos ); break; case 0x6201: blkcmd( 'k', &xCursorPos ); break; case 0x6301: blkcmd( 'c', &xCursorPos ); break; case 0x6401: blkcmd( 'y', &xCursorPos ); break; case 0x6501: blkcmd( 'v', &xCursorPos ); break; case 0x6601: blkcmd( 'r', &xCursorPos ); break; case 0x6701: blkcmd( 'w', &xCursorPos ); break; case 0x6801: blkcmd( 'h', &xCursorPos ); break; case CNTRL_O: onscreen( xCursorPos, yCursorPos ); break; case 0x7101: doonscrn( 'l', xCursorPos, yCursorPos ); break; case 0x7201: doonscrn( 'r', xCursorPos, yCursorPos ); break; case 0x7301: doonscrn( 'i', xCursorPos, yCursorPos ); break; case 0x7401: doonscrn( 'n', xCursorPos, yCursorPos ); break; case 0x7501: doonscrn( 'c', xCursorPos, yCursorPos ); break; case 0x7601: doonscrn( 'p', xCursorPos, yCursorPos ); break; case 0x7701: doonscrn( 'x', xCursorPos, yCursorPos ); break; case CNTRL_Q: quick( &xCursorPos, &yCursorPos ); break; case 0x3501: deltoendline( xCursorPos, yCursorPos ); break; case 0x8111: inscntrl( CNTRL_W, xCursorPos, yCursorPos ); break; case 0x8211: inscntrl( CNTRL_S, xCursorPos, yCursorPos ); break; case 0x8311: inscntrl( CNTRL_R, xCursorPos, yCursorPos ); break; case 0x8411: inscntrl( CNTRL_B, xCursorPos, yCursorPos ); break; case 0x8511: inscntrl( CNTRL_E, xCursorPos, yCursorPos ); break; case 0x8611: inscntrl( CNTRL_T, xCursorPos, yCursorPos ); break; case 0x8711: inscntrl( CNTRL_V, xCursorPos, yCursorPos ); break; case CNTRL_P: printcntrl( xCursorPos, yCursorPos ); break; case HOMEKEY: home( &xCursorPos ); break; case ENDKEY: endline( &xCursorPos ); break; case CLEKEY: case CNTRL_A: backword( &xCursorPos ); break; case CRIKEY: case CNTRL_F: nextword( &xCursorPos, yCursorPos ); break; case CNTRL_L: if ( source[0] != '\0' ) { if ( replaceflag == NO ) { if ( searchfwd( &xCursorPos, &yCursorPos ) == NO ) { wordnotfound( ); } } else { if ( searchreplace( &xCursorPos, &yCursorPos ) == NO ) { wordnotfound( ); } } } break; case CNTRL_B: reform( ); break; case ALTP: gotopage( ); break; case CNTRL_J: case ALTL: gotoline( ); break; case 0x5101: searching( &xCursorPos, &yCursorPos ); break; case 0x5201: replacing( &xCursorPos, &yCursorPos ); break; case 0x8501: loadtoline( curline->text ); refreshline( 0, yCursorPos ); break; case CF1KEY: insertmacro( ¯o[0][0], &xCursorPos, &yCursorPos ); break; case CF2KEY: insertmacro( ¯o[1][0], &xCursorPos, &yCursorPos ); break; case CF3KEY: insertmacro( ¯o[2][0], &xCursorPos, &yCursorPos ); break; case CF4KEY: insertmacro( ¯o[3][0], &xCursorPos, &yCursorPos ); break; case CF5KEY: insertmacro( ¯o[4][0], &xCursorPos, &yCursorPos ); break; case CF6KEY: insertmacro( ¯o[5][0], &xCursorPos, &yCursorPos ); break; case CF7KEY: insertmacro( ¯o[6][0], &xCursorPos, &yCursorPos ); break; case CF8KEY: insertmacro( ¯o[7][0], &xCursorPos, &yCursorPos ); break; case CF9KEY: insertmacro( ¯o[8][0], &xCursorPos, &yCursorPos ); break; case CF10KEY: insertmacro( ¯o[9][0], &xCursorPos, &yCursorPos ); break; case AF2KEY: inscntrl( ITALICCODE, xCursorPos, yCursorPos ); break; case AF3KEY: inscntrl( ONELINECODE, xCursorPos, yCursorPos ); break; case AF4KEY: inscntrl( TWOLINECODE, xCursorPos, yCursorPos ); break; case AF5KEY: inscntrl( BOLDCODE, xCursorPos, yCursorPos ); break; case AF6KEY: inscntrl( ENLARGECODE, xCursorPos, yCursorPos ); break; case AF7KEY: inscntrl( SUPERCODE, xCursorPos, yCursorPos ); break; case AF8KEY: inscntrl( SUBCODE, xCursorPos, yCursorPos ); break; #ifdef WANT_TO_USE_GRAPH case ALTG: insertgraph( ); break; case ALTD: deletegraph( ); break; #endif case ALTX: quitprog = YES; keymain = ESCKEY; break; default: if ( ( alt_char_map( keymain ) ) != -1 ) { keymain = alt_char_map( keymain ); if ( insertmode ) { if ( !insert_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } else { if ( !ovrwrite_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } refreshline( xCursorPos, yCursorPos ); } break; } /* switch ( keymain ) */ } adjustcol( &xCursorPos ); while ( ( yCursorPos = findrow( ) ) > ( wind.width - 1 ) ) { storeline( curline ); curline = curline->previous; loadtoline( curline->text ); lineno--; } if ( !keypressed( ) ) { if ( !pagecomplete ) { showpage( ); } if ( !keypressed( ) ) { writecolno( firstcol + xCursorPos ); dispstrhgc( " ", wind.col, 2, NORMALATTR ); if ( !keypressed( ) ) { writepageline( ); } } } if ( quitprog != YES ) { waitkbd( wind.col + xCursorPos, wind.row + yCursorPos ); keymain = readkbd( ); dispkey( keymain ); } } /* while */ } else { /* if filename[0] != '\0' */ errorsound( ); } } while ( !quitprog ); if ( changeflag ) { blockmsg( 5 ); dispstrhgc( "ÂѧäÁèä´é¨Ñ´à¡çºá¿éÁ¢éÍÁÙÅ µéͧ¡ÒèѴà¡çºËÃ×ÍäÁè (Y/N)?", ( 16 + center_factor ) + 7, 5, REVERSEATTR ); keymain = 0; while ( ( keymain != 'n' ) && ( keymain != 'N' ) && ( keymain != 'y' ) && ( keymain != 'Y' ) ) { keymain = ebioskey( 0 ) & 0xff; if ( ( keymain == 'y' ) || ( keymain == 'Y' ) ) { writeblk( filename, sentinel->next, 0, sentinel->previous, MAXCOL ); } } } settext( ); return 0; }