/* displays various state values for node */ void dsp_state(NSLNSLnet *net,long nd,float aa,float bb,float cc) { nio_ds *np=nsl_drv(nio_ds); char *fmtstr="%.Xf "; fmtstr[2]=(char)('0'+np->numelm-3); nd-=np->bs_hd; w_position(np->scr_s,xcor(nd),ycor(nd));w_printf(np->scr_s,fmtstr,aa); w_position(np->scr_s,xcor(nd),1+ycor(nd));w_printf(np->scr_s,fmtstr,bb); w_position(np->scr_s,xcor(nd),2+ycor(nd));w_printf(np->scr_s,fmtstr,cc); }
/* displays various state values for node */ void dsp_state(NSLNSLnet *net,long nd,float aa,float bb,float cc) { char *fmtstr="%.Xf "; hop_io_ds *hp=nsl_drv(hop_io_ds); nio_ds *np=(&hp->nio); if(!np->scr_s) return; /* not enough room on vdu */ fmtstr[2]=(char)('0'+np->numelm-3); nd-=np->bs_hd; w_position(np->scr_s,xcor(nd),ycor(nd));w_printf(np->scr_s,fmtstr,aa); w_position(np->scr_s,xcor(nd),1+ycor(nd));w_printf(np->scr_s,fmtstr,bb); w_position(np->scr_s,xcor(nd),2+ycor(nd));w_printf(np->scr_s,fmtstr,cc); }
void cast_w_scope(cast_scope *scope, int indent) { cast_def_protection last_prot = CAST_PROT_PRIVATE; int i; for (i = 0; i < (signed int)scope->cast_scope_len; i++) { if ((last_prot != CAST_PROT_NONE) && (last_prot != scope->cast_scope_val[i].protection)) { last_prot = scope->cast_scope_val[i].protection; if( last_prot ) { w_printf("\n"); w_i_printf(indent > 0 ? indent-1 : 0, "%s\n", (last_prot == CAST_PROT_PUBLIC ? "public:" : last_prot == CAST_PROT_PROTECTED ? "protected:" : last_prot == CAST_PROT_PRIVATE ? "private:" : "")); } } else last_prot = scope->cast_scope_val[i].protection; cast_w_def(&scope->cast_scope_val[i], indent); } }
/* ** Allocate cleared (zeroed) memory. */ void * _allocClearedMem(w_size rsize) { w_chunk chunk; w_thread thread = currentWonkaThread; gc_reclaim(rsize, NULL); if (pre_alloc_check(thread, rsize)) { alloc_barrier(thread); chunk = x_mem_calloc(sizeof(w_Chunk) + rsize); } else { chunk = NULL; } if (chunk) { post_alloc(thread, chunk); } else { w_printf("Failed to allocate %d bytes\n", rsize); if (thread && thread->Thread && isNotSet(thread->flags, WT_THREAD_THROWING_OOME)) { throwOutOfMemoryError(thread, rsize); } return NULL; } return chunk->data; }
void * _reallocMem(void * block, w_size newsize) { w_chunk oldchunk; w_size oldsize; w_chunk newchunk; w_thread thread = currentWonkaThread; oldchunk = block2chunk(block); oldsize = x_mem_size(oldchunk); gc_reclaim(newsize - oldsize, NULL); if (pre_realloc_check(thread, newsize, oldsize)) { alloc_barrier(thread); newchunk = x_mem_realloc(oldchunk, sizeof(w_Chunk) + newsize); } else { newchunk = NULL; } if (newchunk) { post_alloc(thread, newchunk); } else { w_printf("Failed to reallocate %d bytes\n", newsize); if (thread && thread->Thread && isNotSet(thread->flags, WT_THREAD_THROWING_OOME)) { throwOutOfMemoryError(thread, newsize); } return NULL; } return newchunk->data; }
BOOL ocos_setup(NSLNSLnet *net,int num) { BOOL dumy=FALSE; int nn; nio_ds *np=nsl_drv(nio_ds); if(num>60) {w_printf(wnd_std,"too many nodes to display\n"); return(FALSE);} np->numbar=1+(num-1)/15; np->numlin=num/np->numbar; if(num%np->numbar>0) ++np->numlin; np->numelm=((w_x(w_size(wnd_std,TRUE))-SCRO)/np->numlin); /* 2D wnd for domain space */ np->scr_d=w_open("domain",TRUE,TRUE,TRUE,TRUE,FALSE,10,10,wnd_black,wnd_white); /* state output levels */ np->scr_l=w_open("levels",FALSE,TRUE,FALSE,TRUE,FALSE,num,10,wnd_black,wnd_white); np->scr_s=w_open("states",TRUE,FALSE,FALSE,TRUE,FALSE,w_x(w_size(wnd_std,TRUE)),np->numbar*SCRV, wnd_black,wnd_white); np->scr_t=np->scr_l; w_title(np->scr_d,NIO_TL,NIO_DRAW,FALSE,"Domain Space"); w_title(np->scr_d,NIO_BC,NIO_DRAW,FALSE,"X"); w_title(np->scr_d,NIO_LC,NIO_DRAW,FALSE,"Y"); w_title(np->scr_d,NIO_LT,NIO_DRAW,FALSE,"1"); w_title(np->scr_d,NIO_LB,NIO_DRAW,FALSE,"0"); w_title(np->scr_d,NIO_BL,NIO_DRAW,FALSE,"0"); w_title(np->scr_d,NIO_BR,NIO_DRAW,FALSE,"1"); w_title(np->scr_l,NIO_TL,NIO_DRAW,FALSE,"Activity Levels"); w_title(np->scr_l,NIO_BL,NIO_DRAW,FALSE,"OCOS Demo"); w_title(np->scr_l,NIO_LT,NIO_DRAW,FALSE,"1"); w_title(np->scr_l,NIO_LB,NIO_DRAW,FALSE,"0"); np->my_tracks=lmore((char *)NULL,(int)(np->fld_siz),TYPE_SHORT,int); for(nn=0;nn<np->fld_siz;++nn) {np->my_tracks[nn]=w_track(np->scr_l,NIO_CHR,wnd_black,wnd_white, (char)('A'+(nn%26))); } np->trk_probe=w_track(np->scr_d,NIO_CHR,wnd_black,wnd_white,'*'); ocos_draw(net,&dumy); return(TRUE); }
void ocos_draw(NSLNSLnet *net,va_list args) { int nn; BOOL refresh=va_arg(args,BOOL); nio_ds *np=nsl_drv(nio_ds); w_clear(np->scr_d); w_clear(np->scr_l); w_clear(np->scr_s); for(nn=0;nn<np->numbar;++nn) w_printf(np->scr_s,"\n--- \n+++ \n*** "); if(refresh) {w_refresh(np->scr_d,TRUE); w_refresh(np->scr_l,TRUE); w_refresh(np->scr_s,TRUE);} }
void CacheCD(BYTE Unit){ DWORD i,n, volSize; int handle; union REGS regs; struct SREGS sregs; Window wd; int col=5, row=4, width=68, height=1; (void)ReadPVD(Unit); if(CD==CD_ISO) volSize = iso->volSize; else if (CD==CD_HSF) volSize = hsf->volSize; else{ printf("Unkown CD Format. Can't cache it.\n"); return; } for (i=0;i<sizeof dta;i++){dta[i]=0;} wd = w_open(col, row, width, height); w_umessage(wd,"Creating Cache File "); w_lmessage(wd,"Control Break to interrupt"); handle = open(CacheName, O_BINARY|O_CREAT|O_WRONLY,S_IWRITE); SigFlag = 0; signal(SIGINT, SetSigFlag); i = 0; while (i < volSize){ n = volSize - i; w_printf(wd,"Writing block %ld of %ld to %s.\n",i,volSize,CacheName); if (n>=30){ (void)CDReadLong(Unit,30,i); (void)write(handle,pdta, 61440); i += 30; } else { (void)CDReadLong(Unit,n,i); (void)write(handle,pdta, n*2048); i += n; } if (SigFlag != 0){ if (PauseContinue() == -1) break; else{ SigFlag=0; signal(SIGINT, SetSigFlag); } } } w_close(wd); close (handle); }
static void jdwp_vm_classes_by_sig(jdwp_command_packet cmd) { w_int length; w_ubyte *sig; w_string sig_string; w_fifo fifo_of_fifos; w_fifo clazz_fifo; w_fifo one_fifo; w_clazz clazz; sig = jdwp_UTF82cstring((w_ubyte*)cmd->data, &length); sig_string = cstring2String((char*)sig, (w_word)length); classname = undescriptifyClassName(sig_string); if (isSet(verbose_flags, VERBOSE_FLAG_JDWP)) { w_printf("JDWP: signature = %w -> classname = %w\n", sig_string, classname); } releaseMem(sig); deregisterString(sig_string); woempa(7, "Searching all class loaders for classes with signature %w\n", classname); fifo_of_fifos = forEachClassLoader(getMatchingClasses); if (fifo_of_fifos) { woempa(7, "Found %d class loaders\n", occupancyOfFifo(fifo_of_fifos)); deregisterString(classname); clazz_fifo = allocFifo(254); while ((one_fifo = getFifo(fifo_of_fifos))) { woempa(7, "Reading fifo %p\n", one_fifo); while ((clazz = getFifo(one_fifo))) { woempa(1, " %K -> clazz_fifo\n", clazz); putFifo(clazz, clazz_fifo); } woempa(7, "Releasing fifo %p\n", one_fifo); releaseFifo(one_fifo); } woempa(7, "Found %d classes\n", occupancyOfFifo(clazz_fifo)); jdwp_put_u4(&reply_grobag, occupancyOfFifo(clazz_fifo)); while ((clazz = getFifo(clazz_fifo))) { woempa(1, " %K\n", clazz); jdwp_put_tagged_type(&reply_grobag, clazz); jdwp_put_u4(&reply_grobag, clazz2status(clazz)); } releaseFifo(clazz_fifo); } else { jdwp_put_u4(&reply_grobag, 0); } jdwp_send_reply(cmd->id, &reply_grobag, jdwp_err_none); }
void _heapCheck(const char * function, const int line) { static w_int walks = 0; w_Wa Wa; w_wa wa = &Wa; wa->count = 0; wa->bytes = 0; wa->errors = 0; wa->all_count = 0; wa->all_bytes = 0; wa->function = function; wa->line = line; previous = NULL; x_mem_walk(x_eternal, checkWalk, wa); walks += 1; woempa(9, "%s %d : %d anon %d tagged, %d MB anon %d MB tagged, %d errors, %d scans.\n", function, line, wa->all_count, wa->count, wa->all_bytes / (1024 * 1024), wa->bytes / (1024 * 1024), wa->errors, walks); w_printf("%s %d : %d anon %d tagged, %d MB anon %d MB tagged, %d errors, %d scans.\n", function, line, wa->all_count, wa->count, wa->all_bytes / (1024 * 1024), wa->bytes / (1024 * 1024), wa->errors, walks); if (wa->errors) { wabort(ABORT_WONKA, "x_mem_walk returned %d errors\n", wa->errors); } }