void Text_Text::paragraph (string text) { if (thisline != "") { // The filter that converts from USFM to clear texts inserts some stuff // that's being removed here again, as not desirable in clear text. thisline = filter_string_str_replace (en_space(), " ", thisline); thisline = filter_string_str_replace (" ", " ", thisline); output.push_back (thisline); thisline = ""; } addtext (text); }
int addspot(void) { extern float freq; extern char hiscall[]; extern int trx_control; extern int lanspotflg; extern struct tm *time_ptr; extern char thisnode; char spotline[160]; char frequency[8]; char spottime[6]; if (strlen(hiscall) < 3) return(0); if (trx_control == 0) { attron(COLOR_PAIR(C_LOG) | A_STANDOUT); mvprintw(13, 20, "freq.: "); echo(); getnstr(frequency, 7); noecho(); freq = atof(frequency); } sprintf(spotline, "DX de TLF-%c: %9.3f %s", thisnode, freq, hiscall); strcat(spotline, " "); get_time(); strftime(spottime, sizeof(spottime), "%H%MZ", time_ptr); strcpy(spotline + 70, spottime); strcat(spotline, "\n\n"); send_lan_message(TLFSPOT, spotline); lanspotflg = 1; addtext(spotline); lanspotflg = 0; spotline[0] = '\0'; hiscall[0] = '\0'; return (0); }
void merge(void) { struct frame *cur, *next; for (BU_LIST_FOR(cur, frame, &head)) { next = BU_LIST_NEXT(frame, &cur->l); if (BU_LIST_IS_HEAD(next, &head)) break; if (cur->number == next->number) { if (next->text) addtext(cur, next->text); cur->flags |= next->flags; BU_LIST_DEQUEUE(&next->l); if (next->text) bu_free(next->text, "text area"); next->text = NULL; next->l.magic = -1; bu_free(next, "struct frame"); cur = BU_LIST_PREV(frame, &cur->l); } } }
/** add call to list of spots * * format a fake DX spot from call and frequency add it to the spot list * and send it to other stations in the LAN */ void add_to_spots(char *call, float freq) { extern int lanspotflg; extern struct tm *time_ptr; extern char thisnode; char spotline[160]; char spottime[6]; sprintf(spotline, "DX de TLF-%c: %9.3f %s", thisnode, freq, call); strcat(spotline, " "); get_time(); strftime(spottime, sizeof(spottime), "%H%MZ", time_ptr); strcpy(spotline + 70, spottime); strcat(spotline, "\n\n"); send_lan_message(TLFSPOT, spotline); lanspotflg = 1; addtext(spotline); lanspotflg = 0; }
int Qt1::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: fun(); break; case 1: fun1((*reinterpret_cast< QString(*)>(_a[1]))); break; case 2: fun3((*reinterpret_cast< QString(*)>(_a[1]))); break; case 3: fun2(); break; case 4: tellme((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: textchange(); break; case 6: addtext(); break; case 7: settext((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: settext1((*reinterpret_cast< QString(*)>(_a[1]))); break; case 9: settext2((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: displayimage(); break; case 11: displayqt2(); break; } _id -= 12; } return _id; }
void vappend(int ch, int cnt, int indent) { register int i; register char *gcursor; bool escape; int repcnt; short oldhold = hold; /* * Before a move in hardopen when the line is dirty * or we are in the middle of the printed representation, * we retype the line to the left of the cursor so the * insert looks clean. */ if (ch != 'o' && state == HARDOPEN && (rubble || !ateopr())) { rubble = 1; wcursor = cursor; vmove(); } vaifirst = indent == 0; /* * Handle replace character by (eventually) * limiting the number of input characters allowed * in the vgetline routine. */ if (ch == 'r') repcnt = 2; else repcnt = 0; /* * If an autoindent is specified, then * generate a mixture of blanks to tabs to implement * it and place the cursor after the indent. * Text read by the vgetline routine will be placed in genbuf, * so the indent is generated there. */ if (value(AUTOINDENT) && indent != 0) { gcursor = genindent(indent); *gcursor = 0; vgotoCL(qcolumn(cursor - 1, genbuf)); } else { gcursor = genbuf; *gcursor = 0; if (ch == 'o') vfixcurs(); } /* * Prepare for undo. Pointers delimit inserted portion of line. */ vUA1 = vUA2 = cursor; /* * If we are not in a repeated command and a ^@ comes in * then this means the previous inserted text. * If there is none or it was too long to be saved, * then beep() and also arrange to undo any damage done * so far (e.g. if we are a change.) */ if ((vglobp && *vglobp == 0) || peekbr()) { if ((INS[0] & (OVERBUF|TRIM)) == OVERBUF) { beep(); if (!splitw) ungetkey('u'); doomed = 0; hold = oldhold; return; } /* * Unread input from INS. * An escape will be generated at end of string. * Hold off n^^2 type update on dumb terminals. */ vglobp = INS; hold |= HOLDQIK; } else if (vglobp == 0) /* * Not a repeated command, get * a new inserted text for repeat. */ INS[0] = 0; /* * For wrapmargin to hack away second space after a '.' * when the first space caused a line break we keep * track that this happened in gobblebl, which says * to gobble up a blank silently. */ gobblebl = 0; /* * Text gathering loop. * New text goes into genbuf starting at gcursor. * cursor preserves place in linebuf where text will eventually go. */ if (*cursor == 0 || state == CRTOPEN) hold |= HOLDROL; for (;;) { if (ch == 'r' && repcnt == 0) escape = 0; else { gcursor = vgetline(repcnt, gcursor, &escape); /* * After an append, stick information * about the ^D's and ^^D's and 0^D's in * the repeated text buffer so repeated * inserts of stuff indented with ^D as backtab's * can work. */ if (HADUP) addtext("^"); else if (HADZERO) addtext("0"); while (CDCNT > 0) addtext("\204"), CDCNT--; if (gobbled) addtext(" "); addtext(ogcursor); } repcnt = 0; /* * Smash the generated and preexisting indents together * and generate one cleanly made out of tabs and spaces * if we are using autoindent. */ if (!vaifirst && value(AUTOINDENT)) { i = fixindent(indent); if (!HADUP) indent = i; gcursor = strend(genbuf); } /* * Limit the repetition count based on maximum * possible line length; do output implied * by further count (> 1) and cons up the new line * in linebuf. */ cnt = vmaxrep(ch, cnt); CP(gcursor + 1, cursor); do { CP(cursor, genbuf); if (cnt > 1) { int oldhold = hold; Outchar = vinschar; hold |= HOLDQIK; ex_printf("%s", genbuf); hold = oldhold; Outchar = vputchar; } cursor += gcursor - genbuf; } while (--cnt > 0); endim(); vUA2 = cursor; if (escape != '\n') CP(cursor, gcursor + 1); /* * If doomed characters remain, clobber them, * and reopen the line to get the display exact. */ if (state != HARDOPEN) { DEPTH(vcline) = 0; if (doomed > 0) { register int cind = cindent(); physdc(cind, cind + doomed); doomed = 0; } i = vreopen(LINE(vcline), lineDOT(), vcline); } /* * All done unless we are continuing on to another line. */ if (escape != '\n') break; /* * Set up for the new line. * First save the current line, then construct a new * first image for the continuation line consisting * of any new autoindent plus the pushed ahead text. */ killU(); addtext(gobblebl ? " " : "\n"); vsave(); cnt = 1; if (value(AUTOINDENT)) { #ifdef LISP if (value(LISP)) indent = lindent(dot + 1); else #endif if (!HADUP && vaifirst) indent = whitecnt(linebuf); vaifirst = 0; strcLIN(vpastwh(gcursor + 1)); gcursor = genindent(indent); *gcursor = 0; if (gcursor + strlen(linebuf) > &genbuf[LBSIZE - 2]) gcursor = genbuf; CP(gcursor, linebuf); } else { CP(genbuf, gcursor + 1); gcursor = genbuf; } /* * If we started out as a single line operation and are now * turning into a multi-line change, then we had better yank * out dot before it changes so that undo will work * correctly later. */ if (vundkind == VCHNG) { vremote(1, (void (*)(int))yank, 0); undap1--; } /* * Now do the append of the new line in the buffer, * and update the display. If slowopen * we don't do very much. */ vdoappend(genbuf); vundkind = VMANYINS; vcline++; if (state != VISUAL) vshow(dot, NOLINE); else { i += LINE(vcline - 1); vopen(dot, i); if (value(SLOWOPEN)) vscrap(); else vsync1(LINE(vcline)); } strcLIN(gcursor); *gcursor = 0; cursor = linebuf; vgotoCL(qcolumn(cursor - 1, genbuf)); } /* * All done with insertion, position the cursor * and sync the screen. */ hold = oldhold; if (cursor > linebuf) cursor--; if (state != HARDOPEN) vsyncCL(); else if (cursor > linebuf) back1(); doomed = 0; wcursor = cursor; vmove(); }
struct frame *getframe(FILE *in) { extern FILE *yyin; extern char yytext[]; struct frame *newframe; yyin = in; /* * If we are not IN a frame, then every thing is part of the globals * and gets attached to the head. */ if (token == SHELL) token = yylex(); while (token != START && (token != 0)) { addtext(&globals, yytext); token = yylex(); } if (!token) return NULL; /* * The next token MUST be a frame number! */ token = yylex(); if (!token) return NULL; if (token != INT) { fprintf(stderr, "getframe: BAD start format. Skipping.\n"); while ((token=yylex()) != END); token = yylex(); /* the semi-colon. */ return NULL; } /* * get a frame and set it up. */ BU_ALLOC(newframe, struct frame); BU_LIST_INIT_MAGIC(&(newframe->l), MAGIC); newframe->number = atoi(yytext); newframe->number += frame_offset; /* * The next token should be SEMI COLON; */ token = yylex(); if (!token) { newframe->l.magic = -1; bu_free(newframe, "struct frame"); return NULL; } if (token != SEMI) { fprintf(stderr, "getframe: Missing semi colon after start %%d.\n"); fprintf(stderr, "getframe: Inserting semi colon.\n"); } /* * Now comes the rest. */ while ((token = yylex()) != END && (token)) { if (token == CLEAN) { (void) yylex(); /* skip semi-colon */ newframe->flags |= FLAG_CLEAN; } else { addtext(newframe, yytext); /* Can't concatenate commands to comments. */ if (token == COMMENT) { addtext(newframe, "\n"); } } } token = yylex(); /* scarf the semi-colon */ token = yylex(); /* Get the next token. It could be shell */ if (token == SHELL) { newframe->flags |= FLAG_SCRIPT; } if (verbose) { fprintf(stderr, "scriptsort: Frame %d(%d)\n", newframe->number, newframe->tp); } return newframe; }
main() { int aa,b,c,x,y,f; asm mov ax, 3 asm int 10h init(); while(dis_sync()<1 && !dis_exit()); prtc(160,120,"A"); prtc(160,160,"Future Crew"); prtc(160,200,"Production"); dofade(fade1,fade2); wait(300); dofade(fade2,fade1); fonapois(); while(dis_sync()<2 && !dis_exit()); prtc(160,160,"First Presented"); prtc(160,200,"at Assembly 93"); dofade(fade1,fade2); wait(300); dofade(fade2,fade1); fonapois(); while(dis_sync()<3 && !dis_exit()); prtc(160,120,"in"); prtc(160,160,"�"); prtc(160,179,"�"); dofade(fade1,fade2); wait(300); dofade(fade2,fade1); fonapois(); while(dis_sync()<4 && !dis_exit()); memcpy(fadepal,fade1,768); cop_fadepal=picin; cop_dofade=128; for(a=1,p=1,f=0,frame_count=0;cop_dofade!=0 && !dis_exit();) do_scroll(2); for(f=60;a<320 && !dis_exit();) { if(f==0) { cop_fadepal=textin; cop_dofade=64; f+=20; } else if(f==50) { cop_fadepal=textout; cop_dofade=64; f++; } else if(f>50 && cop_dofade==0) { cop_pal=palette; do_pal=1; f++; memset(tbuf,0,186*320); switch(tptr++) { case 0: addtext(160,50,"Graphics"); addtext(160,90,"Marvel"); addtext(160,130,"Pixel"); // sucks ffonapois(); break; case 1: faddtext(160,50,"Music"); faddtext(160,90, "Purple Motion"); faddtext(160,130, "Skaven"); ffonapois(); break; case 2: faddtext(160,30,"Code"); faddtext(160,70, "Psi"); faddtext(160,110, "Trug"); faddtext(160,148, "Wildfire"); ffonapois(); break; case 3: faddtext(160,50,"Additional Design"); faddtext(160,90, "Abyss"); // faddtext(160,110,"Useless Design"); faddtext(160,130, "Gore"); ffonapois(); break; case 4: ffonapois(); break; default: faddtext(160,80, "BUG BUG BUG"); faddtext(160,130, "Timing error"); ffonapois(); break; } while(((a&1) || dis_sync()<4+tptr) && !dis_exit() && a<319) do_scroll(0); aa=a; if(aa<320-12) fmaketext(aa+16); f=0; } else f++; do_scroll(1); } if(f>63/SCRLF){ dofade(palette2,palette); } fonapois(); close_copper(); }
polyui::polyui(){ // poly ui Layout w = 800,h = 600; //AppBounds double wp = (7*w)/8,hp = (5*h)/6; rm.init(w/2,h/2,(7*w)/8,(5*h)/6); Rectangle rmoutl(w/2,h/2,(7*w)/8,(5*h)/6); rm.setColor(COLOR(230,228,227));rm.setFill(); // rectAlloc(rm); rectAlloc(rmoutl); //AppTaskBar int it=25; // Task bar Rectangle tk[2*it]; double t=it, ht=h/16; for(int i=0; i<t; i++){ tk[i+it].init(w/2,((5*h)/96)+(ht/(2*t))/2+(ht/(2*t))*i,(7*w)/8,ht/(2*t)); tk[i+it].setColor(COLOR(0,0,0)); tk[i+it].setFill(true); tk[i].init(w/2,((5*h)/96)-(ht/(2*t))/2-(ht/(2*t))*i,(7*w)/8,ht/(2*t)); tk[i].setColor(COLOR(65+(60.0/t)*i,65+(60.0/t)*i,65+(60.0/t)*i)); tk[i].setFill(true); //rectAlloc(tk[i]); rectAlloc(tk[i+it]); } //canvasBounds double wc = wp - 20,hc = hp - 80; rc.init(w/2,h/2 + 30,wc,hc); rc.setColor(COLOR("white")); rc.setFill(); rectAlloc(rc); //exitButton float rad = h/20; // setting r to the size of exitui button exitui.init(w-rad-10,rad+10,rad); exitui.setColor(COLOR(243,81,79)); exitui.setFill(); Circle olexitui(w-rad-10,rad+10,rad); circAlloc(exitui); circAlloc(olexitui); // control panel of the polynomial // left half // wdb = width of buttons on the left double wdb=(wc/2-50)/5, htb=20; ppolyread.init(w/2-wc/2+wdb/2,h/2-hp/2+10+htb/2, wdb, htb); ppolyread.setColor(COLOR(255,255,255)); ppolyread.setFill(); Text ppolyreadtext(w/2-wc/2+wdb/2,h/2-hp/2+10+htb/2, "P"); qpolyread.init(w/2-wc/2+wdb/2,h/2-hp/2+10+htb/2 + htb + 10, wdb, htb); qpolyread.setColor(COLOR(255,255,255)); qpolyread.setFill(); // below ppolyread Text qpolyreadtext(w/2-wc/2+wdb/2,h/2-hp/2+10+htb/2 + htb + 10, "Q"); pqswap.init(w/2-wc/2+wdb/2 + (wdb + 10),h/2-hp/2+10+htb/2 + htb/2 + 5, wdb, htb); pqswap.setColor(COLOR(255,255,255)); pqswap.setFill(); Text pqswaptext(w/2-wc/2+wdb/2 + (wdb + 10),h/2-hp/2+10+htb/2 + htb/2 + 5, "Swap"); add.init(w/2-wc/2+wdb/2 + 2*(wdb + 10),h/2-hp/2+10+htb/2, wdb, htb); add.setColor(COLOR(255,255,255)); add.setFill(); Text addtext(w/2-wc/2+wdb/2 + 2*(wdb + 10),h/2-hp/2+10+htb/2, "+"); minus.init(w/2-wc/2+wdb/2 + 3*(wdb + 10),h/2-hp/2+10+htb/2, wdb, htb); minus.setColor(COLOR(255,255,255)); minus.setFill(); Text minustext(w/2-wc/2+wdb/2 + 3*(wdb + 10),h/2-hp/2+10+htb/2, "-"); remain.init(w/2-wc/2+wdb/2 + 4*(wdb + 10),h/2-hp/2+10+htb/2, wdb, htb); remain.setColor(COLOR(255,255,255)); remain.setFill(); Text remaintext(w/2-wc/2+wdb/2 + 4*(wdb + 10),h/2-hp/2+10+htb/2, "%"); // top row till here multiply.init(w/2-wc/2+wdb/2 + 2*(wdb + 10) + (5+wdb/2) ,h/2-hp/2+10+htb/2 + htb + 10, wdb, htb); multiply.setColor(COLOR(255,255,255)); multiply.setFill(); Text multiplytext(w/2-wc/2+wdb/2 + 2*(wdb + 10) + (5+wdb/2) ,h/2-hp/2+10+htb/2 + htb + 10, "x"); divide.init(w/2-wc/2+wdb/2 + 3*(wdb + 10) + (5+wdb/2) ,h/2-hp/2+10+htb/2 + htb + 10, wdb, htb); divide.setColor(COLOR(255,255,255)); divide.setFill(); Text dividetext(w/2-wc/2+wdb/2 + 3*(wdb + 10) + (5+wdb/2) ,h/2-hp/2+10+htb/2 + htb + 10, "/"); // control panel // right half // wrb = width of buttons on the right double wrb = wc/6-10; plotp.init(w/2 + wrb/2, h/2-hp/2+10+htb/2, wrb, htb ); plotp.setColor(COLOR(255,255,255)); plotp.setFill(); Text plotptext(w/2 + wrb/2, h/2-hp/2+10+htb/2, "Plot P"); plotq.init(w/2 + wrb/2, h/2-hp/2+10+htb/2 + htb + 10, wrb, htb ); plotq.setColor(COLOR(255,255,255)); plotq.setFill(); Text plotqtext(w/2 + wrb/2, h/2-hp/2+10+htb/2 + htb + 10, "Plot Q"); diffp.init(w/2 + wrb/2 + (wrb+15), h/2-hp/2+10+htb/2, wrb, htb ); diffp.setColor(COLOR(255,255,255)); diffp.setFill(); Text diffptext(w/2 + wrb/2 + (wrb+15), h/2-hp/2+10+htb/2, "Differentiate P"); diffq.init(w/2 + wrb/2 + (wrb+15), h/2-hp/2+10+htb/2 + htb + 10, wrb, htb ); diffq.setColor(COLOR(255,255,255)); diffq.setFill(); Text diffqtext(w/2 + wrb/2 + (wrb+15), h/2-hp/2+10+htb/2 + htb + 10, "Differentiate Q"); integp.init(w/2 + wrb/2 + 2*(wrb+15), h/2-hp/2+10+htb/2, wrb, htb ); integp.setColor(COLOR(255,255,255)); integp.setFill(); Text integptext(w/2 + wrb/2 + 2*(wrb+15), h/2-hp/2+10+htb/2, "Integrate P"); integq.init(w/2 + wrb/2 + 2*(wrb+15), h/2-hp/2+10+htb/2 + htb + 10, wrb, htb ); integq.setColor(COLOR(255,255,255)); integq.setFill(); Text integqtext(w/2 + wrb/2 + 2*(wrb+15), h/2-hp/2+10+htb/2 + htb + 10, "Integrate Q"); /* // allocations rectangles rectAlloc(ppolyread); rectAlloc(qpolyread); rectAlloc(pqswap); rectAlloc(add); rectAlloc(minus); rectAlloc(remain); rectAlloc(multiply); rectAlloc(divide); rectAlloc(plotp); rectAlloc(plotq); rectAlloc(diffp); rectAlloc(diffq); rectAlloc(integp); rectAlloc(integq); // allocations text textAlloc(ppolyreadtext); textAlloc(qpolyreadtext); textAlloc(pqswaptext); textAlloc(addtext); textAlloc(minustext); textAlloc(remaintext); textAlloc(multiplytext); textAlloc(dividetext); textAlloc(plotptext); textAlloc(plotqtext); textAlloc(diffptext); textAlloc(diffqtext); textAlloc(integptext); textAlloc(integqtext); */ cout << "Welcome to Polynomial Processor." << endl; cout << "Please read the Polynomials P, Q before proceeding to use operations on them." << endl; while(readytostay){ click(); } }
void vappend(int ch, int cnt, int indent) { int i; unsigned char *gcursor; bool escape; int repcnt, savedoomed; short oldhold = hold; int savecnt = cnt; line *startsrcline; int startsrccol, endsrccol; int gotNL = 0; int imultlinecnt = 0; int omultlinecnt = 0; if ((savecnt > 1) && (ch == 'o' || ch == 'O')) { omultlinecnt = 1; } #ifdef XPG6 if ((savecnt > 1) && (ch == 'a' || ch == 'A' || ch == 'i' || ch == 'I')) imultlinecnt = 1; #endif /* XPG6 */ /* * Before a move in hardopen when the line is dirty * or we are in the middle of the printed representation, * we retype the line to the left of the cursor so the * insert looks clean. */ if (ch != 'o' && state == HARDOPEN && (rubble || !ateopr())) { rubble = 1; gcursor = cursor; i = *gcursor; *gcursor = ' '; wcursor = gcursor; (void) vmove(); *gcursor = i; } /* * If vrep() passed indent = 0, this is the 'r' command, * so don't autoindent until the last char. */ vaifirst = indent == 0; /* * Handle replace character by (eventually) * limiting the number of input characters allowed * in the vgetline routine. */ if (ch == 'r') repcnt = 2; else repcnt = 0; /* * If an autoindent is specified, then * generate a mixture of blanks to tabs to implement * it and place the cursor after the indent. * Text read by the vgetline routine will be placed in genbuf, * so the indent is generated there. */ if (value(vi_AUTOINDENT) && indent != 0) { unsigned char x; gcursor = genindent(indent); *gcursor = 0; vgotoCL(nqcolumn(lastchr(linebuf, cursor), genbuf)); } else { gcursor = genbuf; *gcursor = 0; if (ch == 'o') vfixcurs(); } /* * Prepare for undo. Pointers delimit inserted portion of line. */ vUA1 = vUA2 = cursor; /* * If we are not in a repeated command and a ^@ comes in * then this means the previous inserted text. * If there is none or it was too long to be saved, * then beep() and also arrange to undo any damage done * so far (e.g. if we are a change.) */ switch (ch) { case 'r': break; case 'a': /* * TRANSLATION_NOTE * "A" is a terse mode message corresponding to * "APPEND MODE". * Translated message of "A" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("A")); } else { vshowmode(gettext("APPEND MODE")); } break; case 's': /* * TRANSLATION_NOTE * "S" is a terse mode message corresponding to * "SUBSTITUTE MODE". * Translated message of "S" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("S")); } else { vshowmode(gettext("SUBSTITUTE MODE")); } break; case 'c': /* * TRANSLATION_NOTE * "C" is a terse mode message corresponding to * "CHANGE MODE". * Translated message of "C" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("C")); } else { vshowmode(gettext("CHANGE MODE")); } break; case 'R': /* * TRANSLATION_NOTE * "R" is a terse mode message corresponding to * "REPLACE MODE". * Translated message of "R" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("R")); } else { vshowmode(gettext("REPLACE MODE")); } break; case 'o': /* * TRANSLATION_NOTE * "O" is a terse mode message corresponding to * "OPEN MODE". * Translated message of "O" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("O")); } else { vshowmode(gettext("OPEN MODE")); } break; case 'i': /* * TRANSLATION_NOTE * "I" is a terse mode message corresponding to * "INSERT MODE" and the following "INPUT MODE". * Translated message of "I" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("I")); } else { vshowmode(gettext("INSERT MODE")); } break; default: /* * TRANSLATION_NOTE * "I" is a terse mode message corresponding to * "INPUT MODE" and the previous "INSERT MODE". * Translated message of "I" must be 1 character (not byte). * Or, just leave it. */ if (value(vi_TERSE)) { vshowmode(gettext("I")); } else { vshowmode(gettext("INPUT MODE")); } } ixlatctl(1); if ((vglobp && *vglobp == 0) || peekbr()) { if (INS[128] == 0200) { (void) beep(); if (!splitw) ungetkey('u'); doomed = 0; hold = oldhold; return; } /* * Unread input from INS. * An escape will be generated at end of string. * Hold off n^^2 type update on dumb terminals. */ vglobp = INS; inscdcnt = INSCDCNT; hold |= HOLDQIK; } else if (vglobp == 0) { /* * Not a repeated command, get * a new inserted text for repeat. */ INS[0] = 0; INS[128] = 0; INSCDCNT = 0; } /* * For wrapmargin to hack away second space after a '.' * when the first space caused a line break we keep * track that this happened in gobblebl, which says * to gobble up a blank silently. */ gobblebl = 0; startsrcline = dot; startsrccol = cursor - linebuf; /* * Text gathering loop. * New text goes into genbuf starting at gcursor. * cursor preserves place in linebuf where text will eventually go. */ if (*cursor == 0 || state == CRTOPEN) hold |= HOLDROL; for (;;) { if (ch == 'r' && repcnt == 0) escape = 0; else { ixlatctl(1); /* * When vgetline() returns, gcursor is * pointing to '\0' and vgetline() has * read an ESCAPE or NL. */ gcursor = vgetline(repcnt, gcursor, &escape, ch); if (escape == '\n') { gotNL = 1; #ifdef XPG6 if (ch == 'r') { /* * XPG6 assertion 313 [count]r\n : * Arrange to set cursor correctly. */ endsrccol = gcursor - genbuf - 1; } #endif /* XPG6 */ } else { /* * Upon escape, gcursor is pointing to '\0' * terminating the string in genbuf. */ endsrccol = gcursor - genbuf - 1; } ixlatctl(0); /* * After an append, stick information * about the ^D's and ^^D's and 0^D's in * the repeated text buffer so repeated * inserts of stuff indented with ^D as backtab's * can work. */ if (HADUP) addtext("^"); else if (HADZERO) addtext("0"); if(!vglobp) INSCDCNT = CDCNT; while (CDCNT > 0) { addtext("\004"); CDCNT--; } if (gobbled) addtext(" "); addtext(ogcursor); } repcnt = 0; /* * Smash the generated and preexisting indents together * and generate one cleanly made out of tabs and spaces * if we are using autoindent and this isn't 'r' command. */ if (!vaifirst && value(vi_AUTOINDENT)) { i = fixindent(indent); if (!HADUP) indent = i; gcursor = strend(genbuf); } /* * Set cnt to 1 to avoid repeating the text on the same line. * Do this for commands 'i', 'I', 'a', and 'A', if we're * inserting anything with a newline for XPG6. Always do this * for commands 'o' and 'O'. */ if ((imultlinecnt && gotNL) || omultlinecnt) { cnt = 1; } /* * Limit the repetition count based on maximum * possible line length; do output implied * by further count (> 1) and cons up the new line * in linebuf. */ cnt = vmaxrep(ch, cnt); /* * cursor points to linebuf * Copy remaining old text (cursor) in original * line to after new text (gcursor + 1) in genbuf. */ CP(gcursor + 1, cursor); /* * For [count] r \n command, when replacing [count] chars * with '\n', this loop replaces [count] chars with "". */ do { /* cp new text (genbuf) into linebuf (cursor) */ CP(cursor, genbuf); if (cnt > 1) { int oldhold = hold; Outchar = vinschar; hold |= HOLDQIK; viprintf("%s", genbuf); hold = oldhold; Outchar = vputchar; } /* point cursor after new text in linebuf */ cursor += gcursor - genbuf; } while (--cnt > 0); endim(); vUA2 = cursor; /* add the remaining old text after the cursor */ if (escape != '\n') CP(cursor, gcursor + 1); /* * If doomed characters remain, clobber them, * and reopen the line to get the display exact. * eg. c$ to change to end of line */ if (state != HARDOPEN) { DEPTH(vcline) = 0; savedoomed = doomed; if (doomed > 0) { int cind = cindent(); physdc(cind, cind + doomed); doomed = 0; } if(MB_CUR_MAX > 1) rewrite = _ON; i = vreopen(LINE(vcline), lineDOT(), vcline); if(MB_CUR_MAX > 1) rewrite = _OFF; #ifdef TRACE if (trace) fprintf(trace, "restoring doomed from %d to %d\n", doomed, savedoomed); #endif if (ch == 'R') doomed = savedoomed; } /* * Unless we are continuing on to another line * (got a NL), break out of the for loop (got * an ESCAPE). */ if (escape != '\n') { vshowmode(""); break; } /* * Set up for the new line. * First save the current line, then construct a new * first image for the continuation line consisting * of any new autoindent plus the pushed ahead text. */ killU(); addtext(gobblebl ? " " : "\n"); /* save vutmp (for undo state) into temp file */ vsave(); cnt = 1; if (value(vi_AUTOINDENT)) { if (value(vi_LISP)) indent = lindent(dot + 1); else if (!HADUP && vaifirst) indent = whitecnt(linebuf); vaifirst = 0; strcLIN(vpastwh(gcursor + 1)); gcursor = genindent(indent); *gcursor = 0; if (gcursor + strlen(linebuf) > &genbuf[LBSIZE - 2]) gcursor = genbuf; CP(gcursor, linebuf); } else { /* * Put gcursor at start of genbuf to wipe * out previous line in preparation for * the next vgetline() loop. */ CP(genbuf, gcursor + 1); gcursor = genbuf; } /* * If we started out as a single line operation and are now * turning into a multi-line change, then we had better yank * out dot before it changes so that undo will work * correctly later. */ if (FIXUNDO && vundkind == VCHNG) { vremote(1, yank, 0); undap1--; } /* * Now do the append of the new line in the buffer, * and update the display, ie: append genbuf to * the file after dot. If slowopen * we don't do very much. */ vdoappend(genbuf); vundkind = VMANYINS; vcline++; if (state != VISUAL) vshow(dot, NOLINE); else { i += LINE(vcline - 1); vopen(dot, i); if (value(vi_SLOWOPEN)) vscrap(); else vsync1(LINE(vcline)); } switch (ch) { case 'r': break; case 'a': if (value(vi_TERSE)) { vshowmode(gettext("A")); } else { vshowmode(gettext("APPEND MODE")); } break; case 's': if (value(vi_TERSE)) { vshowmode(gettext("S")); } else { vshowmode(gettext("SUBSTITUTE MODE")); } break; case 'c': if (value(vi_TERSE)) { vshowmode(gettext("C")); } else { vshowmode(gettext("CHANGE MODE")); } break; case 'R': if (value(vi_TERSE)) { vshowmode(gettext("R")); } else { vshowmode(gettext("REPLACE MODE")); } break; case 'i': if (value(vi_TERSE)) { vshowmode(gettext("I")); } else { vshowmode(gettext("INSERT MODE")); } break; case 'o': if (value(vi_TERSE)) { vshowmode(gettext("O")); } else { vshowmode(gettext("OPEN MODE")); } break; default: if (value(vi_TERSE)) { vshowmode(gettext("I")); } else { vshowmode(gettext("INPUT MODE")); } } strcLIN(gcursor); /* zero genbuf */ *gcursor = 0; cursor = linebuf; vgotoCL(nqcolumn(cursor - 1, genbuf)); } /* end for (;;) loop in vappend() */ if (imultlinecnt && gotNL) { imultlinerep(savecnt, startsrcline, startsrccol, endsrccol); } else if (omultlinecnt) { omultlinerep(savecnt, startsrcline, endsrccol); #ifdef XPG6 } else if (savecnt > 1 && ch == 'r' && gotNL) { /* * XPG6 assertion 313 & 254 : Position cursor for [count]r\n * then insert [count -1] newlines. */ endsrccol = gcursor - genbuf - 1; rmultlinerep(savecnt, endsrccol); #endif /* XPG6 */ } /* * All done with insertion, position the cursor * and sync the screen. */ hold = oldhold; if ((imultlinecnt && gotNL) || omultlinecnt) { fixdisplay(); #ifdef XPG6 } else if (savecnt > 1 && ch == 'r' && gotNL) { fixdisplay(); /* * XPG6 assertion 313 & 254 [count]r\n : Set flag to call * fixdisplay() after operate() has finished. To be sure that * the text (after the last \n followed by an indent) is always * displayed, fixdisplay() is called right before getting * the next command. */ redisplay = 1; #endif /* XPG6 */ } else if (cursor > linebuf) { cursor = lastchr(linebuf, cursor); #ifdef XPG6 /* * XPG6 assertion 313 & 254 [count]r\n : * For 'r' command, when the replacement char causes new * lines to be created, point cursor to first non-blank. * The old code, ie: cursor = lastchr(linebuf, cursor); * set cursor to the blank before the first non-blank * for r\n */ if (ch == 'r' && gotNL && isblank((int)*cursor)) ++cursor; #endif /* XPG6 */ } if (state != HARDOPEN) vsyncCL(); else if (cursor > linebuf) back1(); doomed = 0; wcursor = cursor; (void) vmove(); }
//! Plot text at page location x; y (in pts) at angle rot. void PSpage::puttext(char *text, Doub x, Doub y, Doub rot) { fprintf(PSpage::PLT,"gsave %g %g translate %g rotate 0 0 mt ",x,y,rot); addtext(text); fprintf(PSpage::PLT,"grestore \n"); }
void *background_process(void *ptr) { extern int landebug; extern struct tm *time_ptr; static int i, t; static char prmessage[256]; static int lantimesync = 0; static int fldigi_rpc_cnt = 0; int n; char debugbuffer[160]; FILE *fp; i = 1; while (i) { while (stop_backgrnd_process == 1) { sleep(1); } usleep(10000); if (packetinterface != 0) { receive_packet(); } if (trxmode == DIGIMODE && digikeyer != NO_KEYER) rx_rtty(); /* * calling Fldigi XMLRPC method, which reads the Fldigi's carrier * this function helps to show the correct freq of the RIG: reads * the carrier value from Fldigi, and stores in a variable; then * it readable by fldigi_get_carrier() * only need at every 2nd cycle * see fldigixmlrpc.[ch] */ if (trxmode == DIGIMODE && (digikeyer == GMFSK || digikeyer == FLDIGI) && trx_control == 1) { if (fldigi_rpc_cnt == 0) { fldigi_xmlrpc_get_carrier(); } fldigi_rpc_cnt = 1 - fldigi_rpc_cnt; } if (stop_backgrnd_process == 0) { write_keyer(); cw_simulator(); } if (lan_active == 1) { if (lan_message[0] == '\0') { if (lan_recv() < 0) { recv_error++; } else { lan_message[strlen(lan_message) - 1] = '\0'; } } if (landebug == 1) { if ((fp = fopen("debuglog", "a")) == NULL) { fprintf(stdout, "store_qso.c: Error opening debug file.\n"); } else { get_time(); strftime(debugbuffer, 80, "%H:%M:%S-", time_ptr); if (strlen(lan_message) > 2) { strcat(debugbuffer, lan_message); strcat(debugbuffer, "\n"); fputs(debugbuffer, fp); } fclose(fp); } } if ((*lan_message != '\0') && (lan_message[0] == thisnode)) { mvprintw(24, 0, "Warning: NODE ID CONFLICT ?! You should use another ID! "); refreshp(); sleep(5); } if ((*lan_message != '\0') && (lan_message[0] != thisnode) && (stop_backgrnd_process != 1)) { switch (lan_message[1]) { case LOGENTRY: log_to_disk(true); break; case QTCRENTRY: store_recv_qtc(lan_message+2); break; case QTCSENTRY: store_sent_qtc(lan_message+2); break; case QTCFLAG: parse_qtc_flagline(lan_message+2); break; case CLUSTERMSG: strncpy(prmessage, lan_message + 2, 80); if (strstr(prmessage, call) != NULL) // alert for cluster messages { mvprintw(24, 0, " "); mvprintw(24, 0, "%s", prmessage); refreshp(); } addtext(prmessage); break; case TLFSPOT: strncpy(prmessage, lan_message + 2, 80); lanspotflg = 1; addtext(prmessage); lanspotflg = 0; break; case TLFMSG: for (t = 0; t < 4; t++) strcpy(talkarray[t], talkarray[t + 1]); talkarray[4][0] = lan_message[0]; talkarray[4][1] = ':'; talkarray[4][2] = '\0'; strncat(talkarray[4], lan_message + 2, 60); mvprintw(24, 0, " "); mvprintw(24, 0, " MSG from %s", talkarray[4]); refreshp(); break; case FREQMSG: if ((lan_message[0] >= 'A') && (lan_message[0] <= 'A' + MAXNODES)) { node_frequencies[lan_message[0] - 'A'] = atof(lan_message + 2); break; } case INCQSONUM: n = atoi(lan_message + 2); if (highqsonr < n) highqsonr = n; if ((qsonum <= n) && (n > 0)) { qsonum = highqsonr + 1; qsonr_to_str(); } lan_message[0] = '\0'; case TIMESYNC: if ((lan_message[0] >= 'A') && (lan_message[0] <= 'A' + MAXNODES)) { lantime = atoi(lan_message + 2); if (lantimesync == 1) timecorr = ((4 * timecorr) + lantime - (time(0) + (timeoffset * 3600L))) / 5; else { timecorr = lantime - (time(0) + (timeoffset * 3600L)); lantimesync = 1; } break; } } lan_message[0] = '\0'; lan_message[1] = '\0'; } } gettxinfo(); /* get freq info from TRX */ } return (NULL); }