本文整理汇总了C++中output_line函数的典型用法代码示例。如果您正苦于以下问题:C++ output_line函数的具体用法?C++ output_line怎么用?C++ output_line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了output_line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gen_decrement_primary_reg
/**
* decrement the primary register by one if char, INTSIZE if int
*/
void gen_decrement_primary_reg(LVALUE *lval) {
output_line("dcx \th");
switch (lval->ptr_type) {
case CINT:
case UINT:
output_line("dcx \th");
break;
case STRUCT:
gen_immediate2();
output_number(lval->tagsym->size - 1);
newline();
// two's complement
output_line("mov \ta,d");
output_line("cma");
output_line("mov \td,a");
output_line("mov \ta,e");
output_line("cma");
output_line("mov \te,a");
output_line("inx \td");
// substract
output_line("dad \td");
break ;
default:
break;
}
}
示例2: header
/**
* print all assembler info before any code is generated
*/
void header (void) {
output_string ("; Small C Debug\n;\tCoder (ac0)\n;");
frontend_version();
newline ();
output_line ("\t;program area SMALLC_GENERATED is RELOCATABLE");
output_line ("\t.module SMALLC_GENERATED");
}
示例3: main
int main()
{
double /* **U, **Unew,err=0.0,*/ sta = 1.0/8.0, stb=1.0/128.0;
int sa = 9, sb = 129, i/*,j*/;
FILE *outs;
init(&U,sa,sa);
init(&Unew,sa,sa);
init(&Ub,sb,sb);
init_cond(&U, sa, sa, sta,sta);
memcpy(&Unew,&U,sizeof(Unew));
for(i = 0; i<1000 /*&& (err>0.001 || err == 0.0)*/; i++)
{
//err = 0.0;
iteration(&U,&Unew, sa,sa, sta,sta);
memcpy(&U,&Unew,sizeof(Unew));
}
outs = fopen("../output/out1.dat", "w");
output_line(U, sa,sa, sta,sta, outs);
fclose(outs);
//init_cond(&Ub, sb, sb, stb,stb);
interpol(&Ub, sb, sb, stb, stb, &U, sa-1, sa-1, sta, sta);
init_cond(&Ub, sb, sb, stb, stb);
outs = fopen("../output/out2.dat", "w");
output_line(Ub, sb,sb, stb,stb, outs);
fclose(outs);
freeArr(&Unew, sa);
//output_line(U, sa,sa, sta,sta);
//output_line(Ub, sb,sb, stb,stb);
//freeArr(&U, sa);
init(&Unew,sb,sb);
init_cond(&Unew, sb, sb, stb, stb);
memcpy(&Unew,&Ub,sizeof(Ub));
//err = 0.0;
for(i = 0; i<1000 /*&& (err>0.0005 || err == 0.0)*/ ; i++)
{
iteration(&Ub,&Unew, sb,sb, stb,stb);
memcpy(&Ub,&Unew,sizeof(Unew));
}
outs = fopen("../output/out3.dat", "w");
output_line(Ub, sb,sb, stb,stb, outs);
fclose(outs);
outs = fopen("../output/out3_mstk.dat", "w");
opt_mstk_line(Ub, sb,sb, stb,stb, outs);
fclose(outs);
//output_line(U, size,size, step,step);
//printf("%f %f %f\n", step*5, step*5, err);
return 0;
}
示例4: gen_push
/**
* push the primary register onto the stack
*/
void gen_push(int reg) {
if (reg & DE_REG) {
output_line ("push\td");
stkp = stkp - INTSIZE;
} else {
output_line ("push\th");
stkp = stkp - INTSIZE;
}
}
示例5: gen_put_indirect
/**
* store the specified object type in the primary register
* at the address in secondary register (on the top of the stack)
* @param typeobj
*/
void gen_put_indirect(char typeobj) {
if (typeobj & CCHAR) {
//gen_call("ccpchar");
output_line("popstoreb r1 (r2)");
} else {
output_line("popstore r1 (r2)");
}
stkp = stkp + INTSIZE;
}
示例6: header
/**
* print all assembler info before any code is generated
*/
void header (void) {
output_string ("; Small C 8080\n;\tCoder (2.4,84/11/27)\n;");
frontend_version();
newline ();
output_line ("\t;program area SMALLC_GENERATED is RELOCATABLE");
output_line ("\t.module SMALLC_GENERATED");
output_line ("\t.list (err, loc, bin, eqt, cyc, lin, src, lst, md)");
output_line ("\t.nlist (pag)");
}
示例7: gen_test_jump
/**
* test the primary register and jump if false to label
* @param label the label
* @param ft if true jnz is generated, jz otherwise
*/
void gen_test_jump(int label, int ft)
{
output_line ("mov \ta,h");
output_line ("ora \tl");
if (ft)
output_with_tab ("jnz \t");
else
output_with_tab ("jz \t");
print_label (label);
newline ();
}
示例8: do_report
static void
do_report(const char *filename, unsigned line_no, const char *severity,
const char *fmt, va_list args)
{
char buf[128];
vsnprintf(buf, sizeof(buf), fmt, args);
buf[sizeof(buf) - 1] = 0;
if (filename != NULL)
output_line(0, "%s:%d: %s: %s",
filename, line_no, severity, buf);
else
output_line(0, "%s: %s", severity, buf);
}
示例9: gen_put_indirect
/**
* store the specified object type in the primary register
* at the address in secondary register (on the top of the stack)
* @param typeobj
*/
void gen_put_indirect(char typeobj) {
gen_pop ();
if (typeobj & CCHAR) {
//gen_call("ccpchar");
output_line("mov \ta,l");
output_line("stax\td");
} else {
if (uflag) {
output_line("shlx");
} else {
gen_call("ccpint");
}
}
}
示例10: gen_decrement_primary_reg
/**
* decrement the primary register by one if char, INTSIZE if int
*/
void gen_decrement_primary_reg(LVALUE *lval) {
switch (lval->ptr_type) {
case CINT:
case UINT:
output_line("sub r1 2");
break;
case STRUCT:
output_with_tab("sub r1 ");
output_number(lval->tagsym->size - 1);
newline();
break ;
default:
output_line("sub r1 1");
break;
}
}
示例11: gen_get_indirect
/**
* fetch the specified object type indirect through the primary
* register into the primary register
* @param typeobj object type
*/
void gen_get_indirect(char typeobj, int reg) {
if (typeobj == CCHAR) {
if (reg & DE_REG) {
gen_swap();
}
output_line("loadsb r1 (r1)");
} else if (typeobj == UCHAR) {
if (reg & DE_REG) {
gen_swap();
}
//gen_call("cguchar");
output_line("loadub r1 (r1)");
} else { // int
output_line("load r1 (r1)");
}
}
示例12: main
int main()
{
char token[MAXL];
char repeat[MAXL];
if(access("token.txt",0))
printf("You don't have token, please set it:");
else
{
printf("You have a token, will you change it (y/n):");
if(getchar()!='y') {
printf("bye~\n");
return 0;
}
printf("Please set it:");
}
while(1)
{
input_token(token);
printf("Repeat it:");
input_token(repeat);
if(strcmp(token,repeat)) {
printf("they are not same, please set it again:");
continue;
}
break;
}
FILE *out=fopen("token.txt","w");
output_line(out,token);
fclose(out);
return 0;
}
示例13: gen_increment_primary_reg
/**
* increment the primary register by 1 if char, INTSIZE if int
*/
void gen_increment_primary_reg(LVALUE *lval) {
switch (lval->ptr_type) {
case STRUCT:
gen_immediate2();
output_number(lval->tagsym->size);
newline();
output_line("dad \td");
break ;
case CINT:
case UINT:
output_line("inx \th");
default:
output_line("inx \th");
break;
}
}
示例14: playback_line
int playback_line( int buflen, char *buffer, int *read_size )
{
char *cp;
if ( recording == ON || replaying == OFF )
{
return ( -1 );
}
if ( fgets( buffer, buflen, rfp ) == NULL )
{
close_record( );
return ( -1 );
}
else
{
cp = strrchr( buffer, '\n' );
if ( cp != NULL )
{
*cp = '\0';
}
*read_size = strlen( buffer );
output_line( buffer );
}
return ( '\n' );
} /* playback_line */
示例15: main
int main(int argc, char **argv)
{
const char *label;
unsigned pos;
switch (argc)
{
case 1:
label = "";
break;
case 2:
if (is_help_option(argv[1]))
{
usage();
return EXIT_SUCCESS;
}
else label = argv[1];
break;
default:
usage();
return EXIT_FAILURE;
}
for (pos = 0;;)
{
unsigned char buf[LINE];
unsigned left = LINE - (pos % LINE);
int res;
/* Try reading the rest of the current line. */
res = do_read(STDIN_FILENO, buf, left);
if (!res)
/* EOF */
return EXIT_SUCCESS;
else if (res < 0)
{
fprintf(stderr, "%s: read error: %s\n", label, strerror(errno));
return EXIT_FAILURE;
}
/* Dump it */
if (output_line(STDERR_FILENO, label, pos, buf, res) <= 0)
{
fprintf(stderr, "%s: write error on stderr: %s\n", label, strerror(errno));
return EXIT_FAILURE;
}
/* And pass it on */
if (do_write(STDOUT_FILENO, buf, res) < 0)
{
fprintf(stderr, "%s: write error: %s\n", label, strerror(errno));
return EXIT_FAILURE;
}
pos += res;
}
}