void TurboCode::doEncode_term(const itpp::bvec &input, itpp::bvec *output) const { itpp::bvec parity1, tailbits1, tailParity1; rsc1_.GenParity(input, &parity1); rsc1_.Terminate(&tailbits1, &tailParity1); itpp::bvec interleaved = Interleave(input, interleaver_); itpp::bvec parity2, tailbits2, tailParity2; rsc2_.GenParity(interleaved, &parity2); rsc2_.Terminate(&tailbits2, &tailParity2); itpp::bvec t_output(3*interleaver_.size()); for (int i = 0; i < interleaver_.size(); ++i){ t_output[3*i] = input[i]; t_output[3*i + 1] = parity1[i]; t_output[3*i + 2] = parity2[i]; } // for i itpp::bvec codeTail1(2*tailbits1.size()); for (int i = 0; i < tailbits1.size(); ++i){ codeTail1[2*i] = tailbits1[i]; codeTail1[2*i + 1] = tailParity1[i]; } // for i *output = itpp::concat(t_output, codeTail1); itpp::bvec codeTail2(2*tailbits2.size()); for (int i = 0; i < tailbits2.size(); ++i){ codeTail2[2*i] = tailbits2[i]; codeTail2[2*i + 1] = tailParity2[i]; } // for i *output = itpp::concat(*output, codeTail2); }
main () /* test case */ { struct ECB ecb; COUNT lines, columns; CODE type, term, code; TEXT string[STRINGSIZ+1]; TEXT *str; t_init(&lines, &columns, &type); t_clear(); printf("lines, columns, type = %d, %d, %d\n", lines, columns, type); t_output(10, 30, "line 10, column 30"); t_write("\nnon-CRT write to next line\n", T_STDCC); t_input(20, 10, string, &term); printf("Terminator = %s\n", (term == T_CR) ? "(return)" : "(escape)"); t_highlight (string); t_output(22, 10, string); /* echo */ t_lclear (22, 15); /* clear original except 5 character */ t_write ("hit left, right, up, down, GOLD, or any key"); code = t_gettok (); if (code == T_LEFT) str = "LEFT"; else if (code == T_RIGHT) str = "RIGHT"; else if (code == T_UP) str = "UP"; else if (code == T_DOWN) str = "DOWN"; else if (code == T_GOLD) str = "GOLD"; else if (code == T_UNKNOWN) str = "UNKNOWN"; else { string[0] = code; string[1] = EOS; str = string; } t_write (str, T_STDCC); for (;;) { t_bell(); /* bell every time controlc hit */ t_write(" ", T_STDCC); /* flush */ t_attn(&ecb); while (!e_occur(&ecb)) /* loop till event */ ; } exit (); }
int main (int argc, char **argv) { struct commandline cmd; (void) memset ((char *) &cmd, 0, sizeof (struct commandline)); clear_args (); if (!parseargs (argc, argv, &cmd) || !cmd.infile) usage (); if (cmd.cflag || cmd.hflag || cmd.tflag) checkfiles (cmd.infile, cmd.outfile); else checkfiles (cmd.infile, NULL); if (cmd.cflag) { c_output (cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile); } else if (cmd.hflag) { h_output (cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile); } else if (cmd.tflag) { t_output (cmd.infile, "-DRPC_TBL", DONT_EXTEND, cmd.outfile); } else { /* the rescans are required, since cpp may effect input */ c_output (cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c"); reinitialize (); h_output (cmd.infile, "-DRPC_HDR", EXTEND, ".h"); reinitialize (); t_output (cmd.infile, "-DRPC_TBL", EXTEND, "_tbl.c"); } #ifdef __MSDOS__ if (dos_cppfile != NULL) { (void) fclose (fin); (void) unlink (dos_cppfile); } #endif exit (nonfatalerrors); /* NOTREACHED */ }
FUNCTION VOID wrtpmt ( TEXT msg[] /* IN: prompt message */ ) { IMPORT COUNT termlines; /* number of lines on crt screen */ IMPORT CODE termtype; /* terminal type */ if (termtype == T_CRT) /* terminal is CRT */ { t_lclear(termlines - PMTLIN, 1); /* clear prompt line */ t_output((termlines - PMTLIN), 1, msg); /* write prompt */ } else t_write(msg, T_PROMPT); /* write to terminal */ return; }
FUNCTION VOID wrttxt ( FUNINT line, /* IN: line number to write to */ FUNINT col, /* IN: column number to write to */ TEXT text[], /* IN: message text */ FUNINT blank /* IN: True if rest to be blanked */ ) { IMPORT CODE termtype; /* terminal type */ if (termtype == T_CRT) { if (blank) t_lclear(line, 1); /* write a blank line */ t_output(line, col, text); /* output with no cleanup */ } else t_write(text, T_STDCC); /* write with carriage return */ return; }
int main(int argc, const char **argv) { struct commandline cmd; memset(&cmd, 0, sizeof (struct commandline)); clear_args(); if (!parseargs(argc, argv, &cmd)) usage(); /* * Only the client and server side stubs are likely to be customized, * so in that case only, check if the outfile exists, and if so, * print an error message and exit. */ if (cmd.Ssflag || cmd.Scflag || cmd.makefileflag) checkfiles(cmd.infile, cmd.outfile); else checkfiles(cmd.infile, NULL); if (cmd.cflag) { c_output(cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile); } else if (cmd.hflag) { h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile, cmd.hflag); } else if (cmd.lflag) { l_output(cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile); } else if (cmd.sflag || cmd.mflag || (cmd.nflag)) { s_output(argc, argv, cmd.infile, "-DRPC_SVC", DONT_EXTEND, cmd.outfile, cmd.mflag, cmd.nflag); } else if (cmd.tflag) { t_output(cmd.infile, "-DRPC_TBL", DONT_EXTEND, cmd.outfile); } else if (cmd.Ssflag) { svc_output(cmd.infile, "-DRPC_SERVER", DONT_EXTEND, cmd.outfile); } else if (cmd.Scflag) { clnt_output(cmd.infile, "-DRPC_CLIENT", DONT_EXTEND, cmd.outfile); } else if (cmd.makefileflag) { mkfile_output(&cmd); } else { /* the rescans are required, since cpp may effect input */ c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c"); reinitialize(); h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h", cmd.hflag); reinitialize(); l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c"); reinitialize(); if (inetdflag || !tirpcflag) s_output(allc, allv, cmd.infile, "-DRPC_SVC", EXTEND, "_svc.c", cmd.mflag, cmd.nflag); else s_output(allnc, allnv, cmd.infile, "-DRPC_SVC", EXTEND, "_svc.c", cmd.mflag, cmd.nflag); if (tblflag) { reinitialize(); t_output(cmd.infile, "-DRPC_TBL", EXTEND, "_tbl.i"); } if (allfiles) { reinitialize(); svc_output(cmd.infile, "-DRPC_SERVER", EXTEND, "_server.c"); reinitialize(); clnt_output(cmd.infile, "-DRPC_CLIENT", EXTEND, "_client.c"); } if (allfiles || (cmd.makefileflag == 1)){ reinitialize(); mkfile_output(&cmd); } } exit(nonfatalerrors); /* NOTREACHED */ }
int main(int argc, char **argv) { struct commandline cmd; (void) memset((char *) &cmd, 0, sizeof(struct commandline)); clear_args(); if (!parseargs(argc, argv, &cmd)) usage(); if (cmd.cflag || cmd.hflag || cmd.lflag || cmd.tflag || cmd.sflag || cmd.mflag || cmd.nflag || cmd.Ssflag || cmd.Scflag) { checkfiles(cmd.infile, cmd.outfile); } else checkfiles(cmd.infile, NULL); if (cmd.cflag) { c_output(cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile); } else if (cmd.hflag) { h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile); } else if (cmd.lflag) { l_output(cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile); } else if (cmd.sflag || cmd.mflag || (cmd.nflag)) { s_output(argc, argv, cmd.infile, "-DRPC_SVC", DONT_EXTEND, cmd.outfile, cmd.mflag, cmd.nflag); } else if (cmd.tflag) { t_output(cmd.infile, "-DRPC_TBL", DONT_EXTEND, cmd.outfile); } else if (cmd.Ssflag) { svc_output(cmd.infile, "-DRPC_SERVER", DONT_EXTEND, cmd.outfile); } else if (cmd.Scflag) { clnt_output(cmd.infile, "-DRPC_CLIENT", DONT_EXTEND, cmd.outfile); } else { /* the rescans are required, since cpp may effect input */ c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c"); reinitialize(); h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h"); reinitialize(); l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c"); reinitialize(); if (inetdflag || !tirpcflag) s_output(allc, allv, cmd.infile, "-DRPC_SVC", EXTEND, "_svc.c", cmd.mflag, cmd.nflag); else s_output(allnc, allnv, cmd.infile, "-DRPC_SVC", EXTEND, "_svc.c", cmd.mflag, cmd.nflag); if (tblflag) { reinitialize(); t_output(cmd.infile, "-DRPC_TBL", EXTEND, "_tbl.i"); } if (allfiles) { reinitialize(); svc_output(cmd.infile, "-DRPC_SERVER", EXTEND, "_server.c"); } if (allfiles) { reinitialize(); clnt_output(cmd.infile, "-DRPC_CLIENT", EXTEND, "_client.c"); } } exit(nonfatalerrors); /* NOTREACHED */ }