Beispiel #1
0
void main()
{
	struct node* node = buildtree(12);
	printf("\n postorder recur = ");
	postorderrecur(node);
	printf("\npostorderiter = ");
	postorderiter(node);
	nl();
}
Beispiel #2
0
Input::~Input()
{
    keypad(*screen, FALSE);
    echo();
    nocbreak();
    nl();

    delete screen;
}
Beispiel #3
0
void dseg()
{
    if( curseg != dataseg) {
        nl();
        fprintf(output,"\tdata\n");
        fprintf(output,"\talign\t8\n");
        curseg = dataseg;
    }
}
Beispiel #4
0
pausescr()
{
comm_flush();
nl();
ansic(1);
put("[ Hit any key ]");
get_c();
put_char(12);
}
Beispiel #5
0
void tseg()
{
    if( curseg != tlsseg) {
        nl();
        fprintf(output,"\ttls\n");
        fprintf(output,"\talign\t8\n");
        curseg = tlsseg;
    }
}
Beispiel #6
0
void
screen_finish(void)
{
    if (screen_active) {
	nl();			/* does no harm, some curses don't do it */
	endwin();
	screen_active = FALSE;	/* flag showing that curses is off */
    }
}
Beispiel #7
0
/*
 *      print all assembler info before any code is generated
 *
 */
header ()
{
        outstr("|\tSmall C MC6809\n|\tCoder (2.4,84/11/27)\n|");
        FEvers();
        nl ();
        ol (".globl\tsmul,sdiv,smod,asr,asl,neg,lneg,case");
        ol (".globl\teq,ne,lt,le,gt,ge,ult,ule,ugt,uge,bool");

}
Beispiel #8
0
Datei: semc1.c Projekt: aiju/hdl
/* find all variables in a statement that we would like to initialize */
static Nodes *
sinitblock(ASTNode *n)
{
    SemVar *v, *nv;
    SemInit *s;

    if(n->t != ASTASS || n->n1->t != ASTSSA) return nl(n);
    v = n->n1->semv;
    if(v != v->sym->semc[1]) return nl(n);
    for(s = v->sym->semc[0]->init; s != nil; s = s->vnext)
        if(s->type == SISYNC)
            break;
    if(s == nil) return nl(n);
    nv = mkvar(v->sym, v->prime);
    n->n1 = node(ASTSSA, nv);
    defsadd(sinitvars, nv, 1);
    return nl(n);
}
Beispiel #9
0
void cseg()
{
    if( curseg != codeseg) {
        nl();
        fprintf(output,"\tcode\n");
        fprintf(output,"\talign\t16\n");
        curseg = codeseg;
    }
}
Beispiel #10
0
/* Save the current image to disk */
bool save_image(const vm_char *filename)
{
	FILE* file;
	image_header h;

	file = OPEN_WRITE(filename);
	if(file == NULL)
	{
		print_string("Cannot open image file: "); print_native_string(filename); nl();
		print_string(strerror(errno)); nl();
		return false;
	}

	zone *tenured = &data->generations[data->tenured()];

	h.magic = image_magic;
	h.version = image_version;
	h.data_relocation_base = tenured->start;
	h.data_size = tenured->here - tenured->start;
	h.code_relocation_base = code.seg->start;
	h.code_size = heap_size(&code);

	h.t = T;
	h.bignum_zero = bignum_zero;
	h.bignum_pos_one = bignum_pos_one;
	h.bignum_neg_one = bignum_neg_one;

	for(cell i = 0; i < USER_ENV; i++)
		h.userenv[i] = (save_env_p(i) ? userenv[i] : F);

	bool ok = true;

	if(fwrite(&h,sizeof(image_header),1,file) != 1) ok = false;
	if(fwrite((void*)tenured->start,h.data_size,1,file) != 1) ok = false;
	if(fwrite(first_block(&code),h.code_size,1,file) != 1) ok = false;
	if(fclose(file)) ok = false;

	if(!ok)
	{
		print_string("save-image failed: "); print_string(strerror(errno)); nl();
	}

	return ok;
}
Beispiel #11
0
void doinit(SYM *sp)
{
	char lbl[200];

	lbl[0] = 0;
	if (sp->storage_class == sc_thread) {
		seg(tlsseg);
		nl();
	}
	else if (sp->storage_class == sc_static || lastst==assign) {
		seg(dataseg);          /* initialize into data segment */
		nl();                   /* start a new line in object */
	}
	else {
		seg(bssseg);            /* initialize into data segment */
		nl();                   /* start a new line in object */
	}
	if(sp->storage_class == sc_static || sp->storage_class == sc_thread) {
		put_label(sp->value.i, sp->name, GetNamespace(), 'D');
	}
	else {
		if (sp->storage_class == sc_global) {
			strcpy(lbl, "public ");
			if (curseg==dataseg)
				strcat(lbl, "data ");
			else if (curseg==bssseg)
				strcat(lbl, "bss ");
			else if (curseg==tlsseg)
				strcat(lbl, "tls ");
		}
		strcat(lbl, sp->name);
		gen_strlab(lbl);
	}
	if( lastst != assign) {
		genstorage(sp->tp->size);
	}
	else {
		NextToken();
		InitializeType(sp->tp);
	}
    endinit();
	if (sp->storage_class == sc_global)
		fprintf(output,"\nendpublic\n");
}
Beispiel #12
0
editor()
{
FILE *fp;
int f,c,line;
char array[50][80];

put_char(12);
print("4Title: 3%s  1=-=  4Force Ten ELITE Message editor!",hdr.title); nl();
print("3�������������������������������������������������������������������������������");
nl();
ansic(4);

for(line=0;;line++)
	{
	input(array[line],79);
	nl();
	if(array[line][0]=='/')
		{
		switch(array[line][1])
			{
			case 'S':
			case 's':
				makemsgpath(0);
				fp=fopen(msgpath,"rb+");
				if(fp==NULL)
					fp=fopen(msgpath,"ab+");
				fseek(fp,0l,SEEK_END);
				for(c=0;c < line;c++)
					{
					fprintf(fp,"%s",array[c]);
					if(c!=line-1)
						fprintf(fp,"\n");
					}
				c=NULL;
				fputc(c,fp);
				fclose(fp);
				return(1);
			case 'A':
			case 'a':
				return(0);
			}
		}
	}
}
Beispiel #13
0
/*
 *      dump the string literal pool.
 */
void dumplits()
{
    char            *cp;

    cseg();
    nl();
    align(8);
    nl();
    while( strtab != NULL) {
        nl();
        put_label(strtab->label,strtab->str);
        cp = strtab->str;
        while(*cp)
            GenerateChar(*cp++);
        GenerateChar(0);
        strtab = strtab->next;
    }
    nl();
}
Beispiel #14
0
void
bwx_terminate( void )
   {
    nodelay(stdscr,FALSE);
    echo();
    nl();
    nocbreak();
    endwin();
    exit( 0 );
   }
Beispiel #15
0
void nnobRecvBitOblivInputs(ProtocolDesc* pd, OblivBit* oblivInput, int destparty)
{
	NnobProtocolDesc* npd = pd->extra;
	randomOblivAuthenticationKey(npd, &oblivInput->nnob.key);	
	memset(oblivInput->nnob.shareAndMac.mac, 0, NNOB_KEY_BYTES);
	orecv(pd, destparty, &oblivInput->nnob.shareAndMac.share, 1);
	oblivInput->unknown=true;
	debugPrintOblivBit(oblivInput);
	nl();
}
Beispiel #16
0
void init()
{
	initscr();
	cbreak();
	nl();
	noecho();
	intrflush(stdscr, FALSE);
	keypad(stdscr, TRUE);
	refresh();
}
Beispiel #17
0
/* align the following data */
static void put_align P1 (SIZE, al)
{
    nl ();
    if (al > align_type) {
	if (al > 1l) {
	    oprintf ("\t.align\t%ld%s", al, newline);
	}
    }
    align_type = al;
}
Beispiel #18
0
Datei: meta.c Projekt: aiju/hdl
static Nodes *
metacopy(ASTNode *n)
{
	if(n->t == ASTCOMPILE)
		return metarun(n->n1);
	else if(n->t == ASTSYMB && (n->sym->opt & OPTMETA) != 0)
		return nl(n->sym->val);
	else
		return proceed;
}
Beispiel #19
0
Datei: pipe.c Projekt: aiju/hdl
static void
addeq(BitSet *t, ASTNode **n, int p)
{
	int i;
	Nodes *r;
	ASTNode *m;
	
	i = bsiter(t, -1);
	if(i < 0) return;
	if(*n != nil)
		r = nl(*n);
	else
		r = nil;
	for(; i >= 0; i = bsiter(t, i)){
		m = node(ASTSYMB, stcur->vars[i]);
		r = nlcat(r, nl(node(ASTASS, OPNOP, p != 0 ? node(ASTPRIME, m) : m, m)));
	}
	*n = node(ASTBLOCK, r);
}
Beispiel #20
0
//O(n)
void printlist(struct node* node, char* s)
{
	printf("\nList %s = ", s);
	while(node != NULL)
	{
		printf(" %d ", node->data);
		node = node->next;
	}
	nl();
}
Beispiel #21
0
static void seg P3 (enum e_sg, segtype, const char *, segname, SIZE, al)
{
    nl ();
    if (curseg != segtype) {
	oprintf ("\t.sect\t%s%s", segname, newline);
	curseg = segtype;
	align_type = 0L;
    }
    put_align (al);
}
Beispiel #22
0
static void COB_NOINLINE
cob_screen_init (void)
{
	char	*s;

	if (!cob_screen_initialized) {
		s = getenv ("COB_SCREEN_EXCEPTIONS");
		if (s) {
			if (*s == 'Y' || *s == 'y') {
				cob_extended_status = 1;
				s = getenv ("COB_SCREEN_ESC");
				if (s) {
					if (*s == 'Y' || *s == 'y') {
							cob_use_esc = 1;
					}
				}
			}
		}
		/* Get default insert mode, if 'Y' set to on */ 
		s = getenv ("COB_INSERT_MODE");
                if (s) {
                       if (*s == 'Y' || *s == 'y') {
                               insert_mode = 1; 
                       }
                } 
		fflush (stdout);
		fflush (stderr);
		if (!initscr ()) {
			cob_runtime_error ("Failed to initialize curses");
			cob_stop_run (1);
		}
		cbreak ();
		keypad (stdscr, 1);
		nl ();
		noecho ();
		if (has_colors ()) {
			start_color ();
			pair_content ((short)0, &fore_color, &back_color);
			if (COLOR_PAIRS) {
#ifdef	HAVE_LIBPDCURSES
			size_t i;
			/* pdcurses sets ALL pairs to default fg/bg */
			/* IMHO a bug. */
			for (i = 1; i < (size_t)COLOR_PAIRS; ++i) {
				init_pair ((short)i, 0, 0);
			}
#endif
				cob_has_color = 1;
			}
		}
		attrset (A_NORMAL);
		getmaxyx (stdscr, cob_max_y, cob_max_x);
		cob_screen_initialized = 1;
	}
}
Beispiel #23
0
extern int main(int argc, char *argv[])
{
  int size, code;

  if (argc == 2)
    code = sscanf(argv[1],"%d",&size);
  else
    code = 0;
  
  if (code != 1) {
    fprintf(stderr,
	    "Usage : %s <size> - makes foreign call stub of size <size>\n",
	    argv[0]);
    exit(1);
  }

  printf("   /*=====================================================*/\n");
  printf("   /*                                                     */\n");
  printf("   /*             FOREIGN INTERFACE CALL STUB             */\n");
  printf("   /*             ---------------------------             */\n");
  printf("   /*                                                     */\n");
  printf("   /*   Generated by rts/misc/fi_call_stub_h_gen.c        */\n");
  printf("   /*                                                     */\n");
  printf("   /*   (C) 1995 Harlequin Ltd.                           */\n");
  printf("   /*=====================================================*/\n");
  nl();
  printf("#include \"types.h\"\n");
  printf("#include \"mltypes.h\"\n");
  nl();
  printf("#define MAX_FI_ARG_LIMIT\t\t%d\n",size);
  printf("   /*                                                       \n");
  printf("    *  Gives the maximum no. of arguments that the FI can   \n");
  printf("    *  manage using the call stub.                          \n");
  printf("    */                                                      \n");
  nl();
  nl();
  printf("extern void *call_ffun(void *, void *[], int);              \n");
  printf("   /*                                                       \n");
  printf("    *  call_ffun(function, arg_vector, num_of_args) : result\n");
  printf("    *                                                       \n");
  printf("    *  Foreign call stub code  (see gen/fi_call_code.c)     \n");
  printf("    *  That code is automatically generated.                \n");
  printf("    *  (see misc/fi_call_code_c_gen.c)                      \n");
  printf("    */                                                      \n");
  nl();
  nl();
  printf("extern mlval call_ffun_error(int);                          \n");
  printf("   /*                                                       \n");
  printf("    *  call_ffun_error(num_of_args)                         \n");
  printf("    *                                                       \n");
  printf("    *  Reports error for request for too many foreign       \n");
  printf("    *  arguments. Can provide an mlval result.              \n");
  printf("    *  (implemented externally)                             \n");
  printf("    */                                                      \n");
  nl();
  return 0;
}
Beispiel #24
0
delbatfile()
{
char s[80];
int i;

nl();
nl();

if(que.files==0)
	{
	pl("4No files in batch.");
	return;
	}

while(1)
	{
	put("1Delete which file from batch [4Name/Number1][4?/List1]:2 ");
	input(s,50);
	switch(s[0])
		{
		case 0:
			return;
		case '?':
			listbatch();
			nl();
			break;
		default:
			i=atoi(s);
			if(i < 1 || i > que.files)
				{
				nl();
				pl("4Invalid file.");
				return;
				}
			else
				{
				delbfile(i);
				return;
				}
		}
	}
}
Beispiel #25
0
/*
 * Suspend/Resume
 */
static errr Term_xtra_gcu_alive(int v)
{
	int x, y;


	/* Suspend */
	if (!v)
	{
		/* Go to normal keymap mode */
		keymap_norm();

		/* Restore modes */
		nocbreak();
		echo();
		nl();

		/* Hack -- make sure the cursor is visible */
		Term_xtra(TERM_XTRA_SHAPE, 1);

		/* Flush the curses buffer */
		(void)refresh();

		/* Get current cursor position */
		getyx(curscr, y, x);

		/* Move the cursor to bottom right corner */
		mvcur(y, x, LINES - 1, 0);

		/* Exit curses */
		endwin();

		/* Flush the output */
		(void)fflush(stdout);
	}

	/* Resume */
	else
	{
		/* Refresh */
		/* (void)touchwin(curscr); */
		/* (void)wrefresh(curscr); */

		/* Restore the settings */
		cbreak();
		noecho();
		nonl();

		/* Go to angband keymap mode */
		keymap_game();
	}

	/* Success */
	return (0);
}
Beispiel #26
0
struct bwb_line *
bwb_edit( struct bwb_line *l )
   {
   char tbuf[ MAXSTRINGSIZE + 1 ];
   char edname[ MAXSTRINGSIZE + 1 ];
   struct bwb_variable *ed;
   FILE *loadfile;

   ed = var_find( DEFVNAME_EDITOR );
   str_btoc( edname, var_getsval( ed ));

   sprintf( tbuf, "%s %s", edname, CURTASK progfile );

#if INTENSIVE_DEBUG
   sprintf( bwb_ebuf, "in bwb_edit(): command line <%s>", tbuf );
   bwb_debug( bwb_ebuf );
#else
   nl();
   endwin(); /* Added by JBV 10/11/97 */
   system( tbuf );

   /*-----------------------*/
   /* Added by JBV 10/11/97 */
   /*-----------------------*/
   fprintf( stderr, "Press RETURN when ready..." );
   fgets( tbuf, MAXREADLINESIZE, stdin );
   refresh();

   nonl();
#endif

   /* open edited file for read */

   if ( ( loadfile = fopen( CURTASK progfile, "r" )) == NULL )
      {
      sprintf( bwb_ebuf, err_openfile, CURTASK progfile );
      bwb_error( bwb_ebuf );

      ncu_setpos();
      return bwb_zline( l );
      }

   /* clear current contents */

   bwb_new( l ); /* Relocated by JBV (bug found by DD) */

   /* and (re)load the file into memory */

   bwb_fload( loadfile );


   ncu_setpos();
   return bwb_zline( l );
   }
Beispiel #27
0
// lnc.nl(on: boolean)
static int lnc_nl(lua_State *L)
{
	luaL_checktype(L, -1, LUA_TBOOLEAN);
	int on = lua_toboolean(L, -1);
	if (on) {
		nl();
	} else {
		nonl();
	}
	return 0;
}
Beispiel #28
0
/*
 * Switch to cseg 
 */
void cseg(void)
{			if (prm_asmfile)
       	if( curseg != codeseg) {
                nl();
								exitseg();
								if (prm_nasm)
                	fprintf(outputFile,"[SECTION .text]\n");
								else
                	fprintf(outputFile,"\t.CODE\n");
                curseg = codeseg;
                }
}
Beispiel #29
0
void cppseg(void)
{     if (prm_asmfile)  
				if( curseg != cppxseg) {
                nl();
								exitseg();
								if (prm_nasm)
                	fprintf(outputFile,"[SECTION cppinit]\n");
								else
                	fprintf(outputFile,"cppinit\tSEGMENT USE32 PUBLIC DWORD \042CPPDATA\042\n");
                curseg = cppxseg;
                }
}
Beispiel #30
0
/*
 * Switch to rundownseg
 */
void rundownseg(void)
{     if (prm_asmfile)  
				if( curseg != rundownxseg) {
                nl();
								exitseg();
								if (prm_nasm)
	                fprintf(outputFile,"[SECTION crundown]\n");
								else
  	              fprintf(outputFile,"crundown\tSEGMENT USE32 PUBLIC DWORD \042EXITDATA\042\n");
                curseg = rundownxseg;
                }
}