示例#1
0
static void setaddr(int mode, unsigned char val) {
	unsigned short ad,ad2;
	switch(mode) {
	case abs:
		cycles+=2;
		ad=getmem(pc-2);
		ad|=256*getmem(pc-1);
		setmem(ad,val);
		return;
	case absx:
		cycles+=3;
		ad=getmem(pc-2);
		ad|=256*getmem(pc-1);
		ad2=ad+x;
		if ((ad2&0xff00)!=(ad&0xff00))
		cycles--;
		setmem(ad2,val);
		return;
	case zp:
		cycles+=2;
		ad=getmem(pc-1);
		setmem(ad,val);
		return;
	case zpx:
		cycles+=2;
		ad=getmem(pc-1);
		ad+=x;
		setmem(ad&0xff,val);
		return;
	case acc:
		a=val;
		return;
	}
}
示例#2
0
void initvars(void)
/* Initializes various global variables */
{
 leftcol = toprow = curcol = currow = lastcol = lastrow = 0;
 setmem(colwidth, sizeof(colwidth), DEFAULTWIDTH);
 setmem(cell, sizeof(cell), 0);
 setmem(format, sizeof(format), DEFAULTFORMAT);
} /* initvars */
示例#3
0
int main ()
{
    union {
        char buf [256];
        void *pad;
    } u;

    int result = 0;

    setmem (&u, sizeof u, 'x');

    // check that a fundamental type is zeroed out on initialization
    int i = int ();

    if (i != 0)
        result |= 1;

    // check that a POD object is zeroed out on initialization
    A a = A ();

    if (!is_A_zero (a))
        result |= 2;

    // check that a POD object is zeroed out on initialization with operator new
    A *pa = new (&u) A ();

    if (!is_A_zero (*pa))
        result |= 4;

    setmem (&u, sizeof u, 'x');

    S<A> *ps = new (&u) S<A>();

    if (!is_SA_zero (*ps))
        result |= 8;

    setmem (&u, sizeof u, 'x');

    X<int> *px = new (&u) X<int>();

    if (!is_X_zero (*px))
        result |= 16;

    setmem (&u, sizeof u, 'x');

    *px = X<int>();

    if (!is_X_zero (*px))
        result |= 32;

    return result;
}
示例#4
0
void load_warning_scr()
{

	copymem((void *)0x78000, (void*)font_pc, 8192);	
	/* Clear out any leftover characters from previous BG. */
	setmem((void*)BGMap(0), 0, 0x2000);
	
	WA[31].head = WRLD_ON;
	WA[31].gx    = 0;
	WA[31].gp    = 0; //No parallax for now.
	WA[31].gy    = CENTER_Y(5)*8;
	WA[31].mx = 0;
	WA[31].mp = 0;
	WA[31].my = 0;
	WA[31].w = 384;
	WA[31].h = (5*8 - 1);
	WA[31].ovr = 0;
	WA[31].param = 0;
	
	WA[30].head = WRLD_END;
	
	print_message(msg_warn[0], 0, CENTER_X(27), 0, 0);
	print_message(msg_warn[1], 0, CENTER_X(23), 2, 0);
	print_message(msg_warn[2], 0, CENTER_X(16), 4, 0);
	
	
}
//---------------------------------------------------------------------------
void TConsoleRunner::ReadFromPipe(vector<string>* answer, HWND parentHandle){
   DWORD dwRead, dwWritten; 
   CHAR chBuf[4096];

	// Close the write end of the pipe before reading from the
    // read end of the pipe.
 
   if (!CloseHandle(hChildStdoutWr)){
      lastError = "Closing handle failed";
   }

// Read output from the child process, and write to parent's STDOUT.

   //if(!WriteFile(hChildStdinWr, "drowssap\r", 9, &dwWritten, NULL)){
   //		OutputDebugString("oops");
   //}



   while(true){
		setmem(chBuf, 4096, 0);
		if( !ReadFile( hChildStdoutRd, chBuf, 4096, &dwRead, NULL) || dwRead == 0){
            break;
        }

        answer->push_back(chBuf);
        if(parentHandle){
            SendMessage(parentHandle, MSG_TO_STDOUT, answer->size() - 1, 0);
        }
        Application->ProcessMessages();
   }

}
示例#6
0
static void ClearStalled (PDEVICELIST pDevice, UCHAR endPoint)
{
   RP_GENIOCTL       rp;
   USBClearStalled   rb;

#ifdef DEBUG
   dsPrint2 (DBG_DETAILED, "USBRESMGR: ClearStalled Device[%x], ep=%x\r\n", pDevice, endPoint);
#endif

   rb.controllerId  = pDevice->pDeviceInfo->ctrlID;
   rb.deviceAddress = pDevice->pDeviceInfo->deviceAddress;
   rb.endPointId = endPoint;
   rb.clientIDCAddr = NULL;   // no irq notification for this request
   rb.clientDS = 0;
   rb.irqSwitchValue = 0;
   rb.requestData2 = 0;
   rb.requestData3 = 0;
   rb.category = USB_IDC_CATEGORY_CLASS;
   rb.clearStalled = &pDevice->setupPack;

   setmem ((PSZ)&rp, 0, sizeof(rp));
   rp.rph.Cmd = CMDGenIOCTL;
   rp.Category = USB_IDC_CATEGORY_USBD;
   rp.Function = USB_IDC_FUNCTION_CLRSTALL;
   rp.ParmPacket = (PVOID)&rb;

   USBCallIDC (gpUSBDIDC, gdsUSBDIDC, (RP_GENIOCTL FAR *)&rp);
}
示例#7
0
int YMODEMCLASS::CheckDataBlock0(void)
{
	int   rVal=FT_SUCCESS ;
	char *path ;
	path = new char[256] ;
 	if (Status)
 		{
		lpStatus->writeName = TRUE ;
 		lstrcpy(lpStatus->filename, lpBuffer) ;
 		lpStatus->blocksize +=128 ;
 		lpStatus->blockno++ ;
 		lpStatus->UpdateStatusWindow() ;
    if (lpStatus->transferStop) return FT_LOCALCANCEL ;
		lpStatus->writeName = FALSE ;
 		}
	if (lpBuffer[0]=='\0')
	  {
		CommPutChar (oiConn, ACK) ;
		if(Status)
			DestroyWindow(lpStatus->hStatus) ;
		return(FT_FILEEND);
		}
		
	sprintf (path, "%s\\%s", directory, lpBuffer) ;
	if (!lpBuffer[lstrlen (lpBuffer)+1])
		{
		length = 0L;
     moddate = 0L ;
		}
	else
		{
		sscanf(&lpBuffer[lstrlen(lpBuffer)+1], "%ld %lo", &length, &moddate) ;
		}
	OFSTRUCT of ;
	if (hFile!=HFILE_ERROR)
		{
		CloseHandle (hFile) ;
     hFile = HFILE_ERROR ;
		}
	if (hFile==HFILE_ERROR)
		{
		char *filename = CutFileName (path) ;
		hFile = CreateFile (filename, &of, OF_CREATE) ;
		}
	if (hFile!=HFILE_ERROR)
	  {
		rvDataCount = 0 ;
		setmem(lpBuffer, maxblocksize, ' ') ;
 		CommPutChar (oiConn, ACK) ;
 		bLastSeq = bSeq ;
 		bSeq++ ;
 		dataBlock0 = FALSE ;
		fltr_state = WAIT_SOH ;
		}
	else
		rVal =FT_LOCALCANCEL ;

	return rVal ;	
}
示例#8
0
void Draw_Box(int x, int y, int sizex, int sizey, char color) {
unsigned char far *linestart, far *lineend;

  lineend=&screen[x+((y+sizey)<<6)+((y+sizey)<<8)];
  for (linestart=&screen[x+(y<<6)+(y<<8)];
       linestart<lineend; linestart+=WIDTH)
    setmem(linestart, sizex, color);
}
示例#9
0
void insertcol(int col)
/* Inserts a column */
{
 int counter, row;

 if (lastcol == MAXCOLS - 1)
 {
  for (counter = 0; counter <= lastrow; counter++)
   deletecell(lastcol, counter, NOUPDATE);
  printfreemem();
 }
 if (col != MAXCOLS - 1)
 {
  movmem(&cell[col][0], &cell[col + 1][0], MAXROWS * sizeof(CELLPTR) *
   (MAXCOLS - col - 1));
  movmem(&format[col][0], &format[col + 1][0], MAXROWS * (MAXCOLS - col - 1));
  movmem(&colwidth[col], &colwidth[col + 1], MAXCOLS - col - 1);
 }
 setmem(&cell[col][0], MAXROWS * sizeof(CELLPTR), 0);
 setmem(&format[col][0], MAXROWS, DEFAULTFORMAT);
 colwidth[col] = DEFAULTWIDTH;
 lastcol = MAXCOLS - 1;
 setlastcol();
 setrightcol();
 if (curcol > rightcol)
 {
  rightcol++;
  setleftcol();
 }
 for (counter = 0; counter <= lastcol; counter++)
 {
  for (row = 0; row <= lastrow; row++)
  {
   if ((cell[counter][row] != NULL) &&
    (cell[counter][row]->attrib == FORMULA))
    fixformula(counter, row, COLADD, col);
   updateoflags(col, row, NOUPDATE);
  }
 }
 while (col <= rightcol)
  displaycol(col++, NOUPDATE);
 changed = TRUE;
 recalc();
} /* insertcol */
/*------------------------------------------------------------------------*

Name            calloc - allocates main memory

Usage           void *calloc(size_t nelem, size_t elsize);

Prototype in    stdlib.h and alloc.h

Description     calloc allocates a  block like malloc, except the  block is
                of size nelem times elsize. The block is cleared to 0.

Return value    calloc returns a  pointer to the newly allocated  block, or
                NULL if not  enough space exists for the new  block or, the
                requested size is equal to 0.

*-------------------------------------------------------------------------*/
void * _FARFUNC calloc(size_t nelem, size_t elsize)
{
        unsigned long   msize;
        register char   *cp;

        msize = (unsigned long)nelem * elsize;
        cp = (msize > 0xFFFF) ? NULL : malloc((unsigned)msize);
        if (cp)
                setmem(cp, (unsigned)msize, 0);
        return(cp);
}
示例#11
0
void colstring(int col, char *colstr)
/* Changes a column number to a string */
{
 setmem(colstr, 3, 0);
 if (col < 26)
  colstr[0] = col + 'A';
 else
 {
  colstr[0] = (col / 26) - 1 + 'A';
  colstr[1] = (col % 26) + 'A';
 }
} /* colstring */
示例#12
0
void
ResetRegAlloc()
{
    RegAlloc = RegReserved;
    RegUsed  = RegAlloc;
    RegLocked= 0;
    DataRegCache = RB_D0;
    AddrRegCache = RB_A0;
    TmpAry[0].ts_Size = 0;
    TSIndex = 0;
    TSMax = 0;

    TryAgainFlag = 0;
    setmem(Refs, sizeof(Refs), 0);

    Refs[RB_A4] = 1;	    /* XXX hack */
    Refs[RB_A5] = 1;
    Refs[RB_A7] = 1;

    setmem(Locked, sizeof(Locked), 0);
}
示例#13
0
//------------------------------------------------------
Frame::Frame(int i,int j)
{
   if( (i>0)&&(j>0)&&(i<MaxDim)&&(j<MaxDim) )
   {
      ImageData=new int[i*j];
      setmem(ImageData,i*j*sizeof(int),0);
      XDim=i;
      YDim=j;
      MaxValue=MeanValue=MinValue=0;
      return;
   };
   Frame();
};
示例#14
0
void writef(int col, int row, int color, int width, va_list arg_list, ...)
/* Prints a string in video memory at a selected location in a color */
{
 va_list arg_ptr;
 char *format;
 char output[81];
 int len;

 va_start(arg_ptr, arg_list);
 format = arg_list;
 vsprintf(output, format, arg_ptr);
 output[width] = 0;
 if ((len = strlen(output)) < width)
  setmem(&output[len], width - len, ' ');
 setcolor(color);
 gotoxy(col, row);
 cprintf(output);
} /* writef */
示例#15
0
int YMODEMCLASS::CheckDataBlock (void)
{
	BYTE hiCRC ,loCRC ;
	int  bCRC ;
	BYTE checksum ;
	BOOL checkOK=TRUE ;
  int  rVal = FT_SUCCESS ; 

	if (fCRC)
		{
		hiCRC = CommGetChar (oiConn) ;
    loCRC = CommGetChar (oiConn) ;
		bCRC = CalcCRC16 (lpBuffer, maxblocksize) ;
		if (hiCRC!=HIBYTE(bCRC)||loCRC!=LOBYTE(bCRC))
			checkOK = FALSE ;				
		}
	else
		{
    checksum = CommGetChar (oiConn) ;
		if(checksum!=CheckSum (lpBuffer))
   		checkOK = FALSE ;
		}

	if (checkOK)
		{
		if (dataBlock0)
			rVal = CheckDataBlock0() ;
    else
			{
			fltr_state = WAIT_SOH ;
			WriteToFile () ;
			}
		}
	else
	 {
	 rvDataCount = 0 ;
	 setmem(lpBuffer, maxblocksize, ' ') ;
   CommPutChar (oiConn, NAK) ;
		fltr_state = WAIT_SOH ;
	 }
  return (rVal) ;
}
示例#16
0
//---------------------------------------------------------------------------
void __fastcall TForm1::UpDown2Click(TObject *Sender, TUDBtnType Button)
{
    setmem(ANodeBuffer, sizeof(ANodeBuffer), 0);
    Series1->Clear();

    double PushValue, t0 = 1e-5;
    double SinusFreq = 4323.16;
    int    ReliazationLength = 45;
    for ( double z = 0; z < t0*ReliazationLength; z = z + t0 )
    {
         PushValue  = sin(2.0 * M_PI * SinusFreq * z + UpDown2->Position*M_PI / 180.0);
         PushValue += 0.1 * sin(2.0 * M_PI * SinusFreq*2.5 * z + UpDown2->Position*M_PI / 180.0);

         for ( int i = 63; i > 0; i-- ) ANodeBuffer[i] = ANodeBuffer[i-1];
         ANodeBuffer[0] = PushValue;
    }
    Series1->AddArray(ANodeBuffer, ReliazationLength);
    // ------------------------
    UpDown1Click(NULL, btNext);
}
示例#17
0
static BOOL CheckHCDDriversLoaded( PSZ cmdLine, USHORT start, USHORT end )
{
   PSZ      drvNameChar=cmdLine+start;
   BOOL     loaded = FALSE;   //LR0904 was = TRUE
   USHORT   charIndex=0;
   CHAR     nChar;

   gHCDDriverName[sizeof(gHCDDriverName)-1]=0;

   if (*(cmdLine+start)=='(' && end>0 && *(cmdLine+end-1)==')')
   {  // ignore enclosing braces
      start++; end--; end--;
   }
   for (;start<=end; start++)
   {
      nChar=*(cmdLine+start);
      if (nChar!=',' && nChar && nChar!=' ')
      {  // fill in driver's name separated by ','
         if (charIndex<sizeof(gHCDDriverName)-1)
         {
            if (!charIndex)
               setmem(gHCDDriverName,' ',sizeof(gHCDDriverName)-1);
            gHCDDriverName[charIndex]=nChar;
            charIndex++;
         }
      }
      if (nChar==',' || start==end)  // process name when separator reached or on last character
      {
         charIndex=0;
         // check if driver loaded
         if (!DevHelp_AttachDD (gHCDDriverName, (NPBYTE)&gDDTable))  //LR0904 ! added
         {
            loaded = TRUE; //LR0904 was = FALSE
            break;
         }
      }
   }
   return (loaded);
}
示例#18
0
文件: sim.c 项目: lassik/ckone
/*
 * push -- push the given word on the given stack
 *
 * sp -- stack pointer register to use. Can be any of the eight
 * general purpose registers.
 * word -- the word to push on the stack
 */
static void push(size_t sp, size_t word)
{
    setreg(sp, getreg(sp)+1);
    setmem(getreg(sp), word);
}
示例#19
0
文件: sim.c 项目: lassik/ckone
/*
 * simulate -- execute the program one CPU instruction at a time until HALT
 */
void simulate(void)
{
    struct insn *insn;
    size_t reg;
    ssize_t tmp;

    /* Before starting to run the program, establish a stack */
    setreg(FP, memsize ? (memsize-1) : 0); /* initialize frame pointer */
    setreg(SP, memsize); /* initialize stack pointer */
    addmem(64); /* reserve memory for the stack at end of address space */

    /* Each iteration of this loop executes one instruction */
    while(!halted)
    {
        /* Fetch the instruction word */
        ir = getmem(pc);
        if(verbose)
        {
            printf("Executing ");
            disasm(mem, pc, 1);
        }
        pc++;

        /* Decode the instruction word */
        insn = decode(ir);
        reg = insn->reg;

        tmp = (ssize_t)(int16_t)insn->imm;
        if(insn->idxreg) tmp += (ssize_t)getreg(insn->idxreg);
        tr = (size_t)tmp;

        switch(insn->mode)
        {
        case 0: break;
        case 1: tr = getmem(tr); break;
        case 2: tr = getmem(getmem(tr)); break;
        }

        /* Execute the instruction */
        switch(insn->opcode)
        {
        case 0x00: /*NOP*/
            break;
        case 0x01: /*STORE*/
            setmem(tr, getreg(reg)); 
            break;
        case 0x02: /*LOAD*/
            setreg(reg, tr);
            break;
        case 0x03: /*IN*/
            if((tr >= COUNTOF(intab)) || !intab[tr]) die("no such input device");
            setreg(reg, intab[tr]());
            break;
        case 0x04: /*OUT*/
            if((tr >= COUNTOF(outtab)) || !outtab[tr]) die("no such output device");
            outtab[tr](getreg(reg));
            break;
        case 0x11: setreg(reg, getreg(reg) + tr); break; /*ADD*/
        case 0x12: setreg(reg, getreg(reg) - tr); break; /*SUB*/
        case 0x13: setreg(reg, getreg(reg) * tr); break; /*MUL*/
        case 0x14: setreg(reg, getreg(reg) / tr); break; /*DIV*/
        case 0x15: setreg(reg, getreg(reg) % tr); break; /*MOD*/
        case 0x16: setreg(reg, getreg(reg) & tr); break; /*AND*/
        case 0x17: setreg(reg, getreg(reg) | tr); break; /*OR*/
        case 0x18: setreg(reg, getreg(reg) ^ tr); break; /*XOR*/
        case 0x19: setreg(reg, getreg(reg) << tr); break; /*SHL*/
        case 0x1A: setreg(reg, size_shr(getreg(reg), tr)); break; /*SHR*/
        case 0x1B: setreg(reg, size_sar(getreg(reg), tr)); break; /*SHRA*/
        case 0x1F: compare(getreg(reg), tr); break; /*COMP*/
        case 0x20: pc=tr; break; /*JUMP*/
        case 0x21: if((ssize_t)getreg(reg) < 0) pc=tr; break; /*JNEG*/
        case 0x22: if((ssize_t)getreg(reg) == 0) pc=tr; break; /*JZER*/
        case 0x23: if((ssize_t)getreg(reg) > 0) pc=tr; break; /*JPOS*/
        case 0x24: if((ssize_t)getreg(reg) >= 0) pc=tr; break; /*JNNEG*/
        case 0x25: if((ssize_t)getreg(reg) != 0) pc=tr; break; /*JNZER*/
        case 0x26: if((ssize_t)getreg(reg) <= 0) pc=tr; break; /*JNPOS*/
        case 0x27: if(getsrbit(SR_L)) pc=tr; break; /*JLES*/
        case 0x28: if(getsrbit(SR_E)) pc=tr; break; /*JEQU*/
        case 0x29: if(getsrbit(SR_G)) pc=tr; break; /*JGRE*/
        case 0x2A: if(!getsrbit(SR_L)) pc=tr; break; /*JNLES*/
        case 0x2B: if(!getsrbit(SR_E)) pc=tr; break; /*JNEQU*/
        case 0x2C: if(!getsrbit(SR_G)) pc=tr; break; /*JNGRE*/
        case 0x31: /*CALL*/ 
            push(reg, pc);
            push(reg, getreg(FP));
            setreg(FP, getreg(SP));
            pc=tr;
            break;
        case 0x32: /*EXIT*/
            setreg(FP, pop(reg));
            pc = pop(reg);
            for(; tr; tr--) pop(reg);
            break;
        case 0x33: /*PUSH*/
            push(reg, tr);
            break;
        case 0x34: /*POP*/
            setreg(insn->idxreg, pop(reg));
            break;
        case 0x35: /*PUSHR*/
            push(reg, getreg(0));
            push(reg, getreg(1));
            push(reg, getreg(2));
            push(reg, getreg(3));
            push(reg, getreg(4));
            push(reg, getreg(5));
            break;
        case 0x36: /*POPR*/
            setreg(5, pop(reg));
            setreg(4, pop(reg));
            setreg(3, pop(reg));
            setreg(2, pop(reg));
            setreg(1, pop(reg));
            setreg(0, pop(reg));
            break;
        case 0x70: /*SVC*/
            if((tr >= COUNTOF(svctab)) || !svctab[tr]) die("no such supervisor call");
            svctab[tr](reg);
            break;
        default:
            die("bad instruction");
        }
    }
}
示例#20
0
文件: sim.c 项目: lassik/ckone
static void svc_read(size_t sp)
{
    setmem(pop(sp), input());
}
示例#21
0
static inline void push(unsigned char val) {
	setmem(0x100+s,val);
	if (s) s--;
}
示例#22
0
//---------------------------------------------------------------------------
void TMainForm::ListResults()
{
   AnsiString FileName=ExtractFileName(FName),OutFile;
   FileName=FileName.SubString(1,FileName.Length()-4);
   AnsiString DirName=ExtractFilePath(FName)+FileName;
   CreateDir(DirName);
   SetCurrentDir(DirName);
   fstream file;
   int NMols,NFrames=0,i,j,n,x,y;
   float *MolIntegrInt,tmp;
   OutFile=DirName+"\\Kinetics.txt";
   file.open(OutFile.c_str(),ios::out);
   for(n=0;n<Results.GetN() && !Results[n];n++){};
   int StartFrame=n;
   if(Pars.UseExProfile)
   {          //deleting the molecules outside Pars.Cutoff*ExFrame.GetMax() area;
      for(i=0;i<Results[n]->Count;i++)
      {
         x=Results[StartFrame]->Mol(i).x;
         y=Results[StartFrame]->Mol(i).y;
         if(ExFrame[y][x]<Pars.CutOff*ExFrame.GetMax())
            for(j=0;j<Results.GetN();j++) if(Results[j]) Results[j]->Delete(i);
      }
   }
   NMols=Results[StartFrame]->Count; //the first processed frame gives the number of molecules
   file<<"Frame\t";
   for(i=0;i<NMols;i++) file<<"Mol"<<i+1<<"\t";//kinetics file header
   file<<endl;
   MolIntegrInt=new float[NMols];
   setmem(MolIntegrInt,NMols*sizeof(float),0);//starting integral values are zeros
   for(;n<Results.GetN() && Results[n];n++)//printing kinetics file and counting aver.int.
   {
      NFrames++;  //counting actual number of frames
      file<<n+1<<"\t";
      for(i=0;i<NMols;i++)
      {
         x=Results[StartFrame]->Mol(i).x;
         y=Results[StartFrame]->Mol(i).y;
         tmp=Results[n]->Mol(i).I;
         if(Pars.Normalize) tmp*=(float)ExFrame.GetMax()/ExFrame[y][x];
         MolIntegrInt[i]+=tmp; //integral intensity of each molecule
         file<<floor(tmp)<<"\t";
      }
      file<<endl;
   }
   file.close();
   OutFile=DirName+"\\"+FileName+"_coor.txt";
   file.open(OutFile.c_str(),ios::out);
   file<<"MolNum\tX\tY\tIaver";
   if(Pars.UseExProfile) file<<"\tIex"; file<<endl;  //coordinate file header
   for(i=0;i<NMols;i++)
   {
      x=Results[StartFrame]->Mol(i).x;
      y=Results[StartFrame]->Mol(i).y;
      file<<i+1<<"\t"<<x+1<<"\t"<<y+1<<"\t"<<floor(MolIntegrInt[i]/NFrames); //aver. int.
      if(Pars.UseExProfile) file<<"\t"<<(float)ExFrame[y][x]/ExFrame.GetMax(); file<<endl;
   }
   file.close();
   //ImproveSignals(ExSignals,NFrames);
   //ImproveSignals(EmSignals,NFrames);
   OutFile=DirName+"\\"+"SignalsEx.txt";
   file.open(OutFile.c_str(),ios::out);
   for(i=0;i<NFrames;i++) file<<ExSignals[i]<<endl;
   file.close();
   OutFile=DirName+"\\"+"SignalsEm.txt";
   file.open(OutFile.c_str(),ios::out);
   for(i=0;i<NFrames;i++) file<<EmSignals[i]<<endl;
   file.close();
   delete[] MolIntegrInt;
}
示例#23
0
void IO_GO(int sig){
 syslog(LOG_ERR, "SIG IO SIG IO!!!!!!"); //Log it
mainfd = open_port();

        struct sockaddr_in clientName = { 0 };
        int BuffCount;  // Got Count 
	char Buff[1024]; //Buffer size 
        bzero(Buff,sizeof(Buff)); //Zero out the buffer
	int simpleChildSocket = 0;
        int clientNameLength = sizeof(clientName);
	int flag=0;
	char endL[3];
	char TempBuff[256];
	int TempCount;
	int returnstatus;
	bzero(endL,sizeof(endL));
	//transbridgeon(mainfd);
	sprintf(endL,"%c%c",end,0x82);

        simpleChildSocket = accept(simpleSocket,(struct sockaddr *)&clientName, &clientNameLength);

        if (simpleChildSocket == -1) {

            syslog(LOG_ERR, "Cannot accept connections!\n");
            close(simpleSocket);
            exit(1);

        }
        BuffCount=read(simpleChildSocket, Buff, 3);
	TempCount=sprintf(TempBuff,"%d",BuffCount);
        syslog(LOG_WARNING, "I read %d : %s",BuffCount,Buff);
	//trying a switch case to select the begining mode of the sign protocoll
	switch(Buff[0]){
	case 'A':// Sign Type, Sign Addr (last bit)
	startc(mainfd,Buff[1],Buff[2]);
        TempCount=sprintf(TempBuff,"CASE A");
	write(simpleChildSocket, TempBuff, strlen(TempBuff) );
	bzero(Buff,sizeof(Buff));

	break;
	case 'B': //simple mode 
	starttext(mainfd,'Z','0','A');
        TempCount=sprintf(TempBuff," CASE B");
        write(simpleChildSocket, TempBuff, strlen(TempBuff));
	bzero(Buff,sizeof(Buff));

	break;
	case 'C': //set 2 line mem
        TempCount=sprintf(TempBuff,"CASE C");
        write(simpleChildSocket, TempBuff, strlen(TempBuff));
    	syslog(LOG_ERR, "CASE C Buff1=%c",Buff[1]);
    	setmem(mainfd,Buff[1]);

        bzero(Buff,sizeof(Buff));

	flag =1;	// skip loop
	break;
	case 'D': //Single line set memory
        TempCount=sprintf(TempBuff,"CASE D");
        write(simpleChildSocket, TempBuff, strlen(TempBuff));

 syslog(LOG_ERR, "CASE D"); //Log it

	slsetmem(mainfd,Buff[1]);
	bzero(Buff,sizeof(Buff));
	 syslog(LOG_ERR, "End of Case D"); //Log it


	flag =1;
	break;
	case 'P': 
	plotit();
	flag=1;
	break;
	case 'X':
	 TempCount=sprintf(TempBuff,"CASE X");
        write(simpleChildSocket, TempBuff, strlen(TempBuff));
        bzero(Buff,sizeof(Buff));
	break;
	}
       while(flag != 1){

	BuffCount=read(simpleChildSocket, Buff, sizeof(Buff));
	if(DEBUG == 1)
	syslog(LOG_WARNING, "I read %d : %s",BuffCount,Buff);	
		if(endsearch(Buff)==1 )
		{
			flag=1;
		}
		if(BuffCount == 0){
			flag =1;
		}
        /* handle the new connection request  */
        /* write out our message to the client */

			write(mainfd,Buff,strlen(Buff));
			bzero(Buff,sizeof(Buff));
/* OLD CODE SNIPPIT
        write(simpleChildSocket, ACKMESSAGE, strlen(ACKMESSAGE));
        close(simpleChildSocket);
        transbridgeon(mainfd);
        write(mainfd,Buff,strlen(Buff));
        transbridgeoff(mainfd);

*/
	}
	//transbridgeoff(mainfd);
	        write(simpleChildSocket, ACKMESSAGE, strlen(ACKMESSAGE));

	close(simpleChildSocket);
	close(mainfd);
	flag = 0;
	usleep(250);


}
示例#24
0
文件: advent.c 项目: slacy/advent4
/*
        Initialization of adventure play variables
*/
void initplay(void) {
  turns = 0;

  /* initialize location status array */
  setmem(cond, (sizeof(int)) * MAXLOC, 0);
  scanint(&cond[1], "5,1,5,5,1,1,5,17,1,1,");
  scanint(&cond[13], "32,0,0,2,0,0,64,2,");
  scanint(&cond[21], "2,2,0,6,0,2,");
  scanint(&cond[31], "2,2,0,0,0,0,0,4,0,2,");
  scanint(&cond[42], "128,128,128,128,136,136,136,128,128,");
  scanint(&cond[51], "128,128,136,128,136,0,8,0,2,");
  scanint(&cond[79], "2,128,128,136,0,0,8,136,128,0,2,2,");
  scanint(&cond[95], "4,0,0,0,0,1,");
  scanint(&cond[113], "4,0,1,1,");
  scanint(&cond[122], "8,8,8,8,8,8,8,8,8,");

  /* initialize object locations */
  setmem(place, (sizeof(int)) * MAXOBJ, 0);
  scanint(&place[1], "3,3,8,10,11,0,14,13,94,96,");
  scanint(&place[11], "19,17,101,103,0,106,0,0,3,3,");
  scanint(&place[23], "109,25,23,111,35,0,97,");
  scanint(&place[31], "119,117,117,0,130,0,126,140,0,96,");
  scanint(&place[50], "18,27,28,29,30,");
  scanint(&place[56], "92,95,97,100,101,0,119,127,130,");

  /* initialize second (fixed) locations */
  setmem(fixed, (sizeof(int)) * MAXOBJ, 0);
  scanint(&fixed[3], "9,0,0,0,15,0,-1,");
  scanint(&fixed[11], "-1,27,-1,0,0,0,-1,");
  scanint(&fixed[23], "-1,-1,67,-1,110,0,-1,-1,");
  scanint(&fixed[31], "121,122,122,0,-1,-1,-1,-1,0,-1,");
  scanint(&fixed[62], "121,-1,");

  /* initialize default verb messages */
  scanint(actmsg, "0,24,29,0,33,0,33,38,38,42,14,");
  scanint(&actmsg[11], "43,110,29,110,73,75,29,13,59,59,");
  scanint(&actmsg[21], "174,109,67,13,147,155,195,146,110,13,13,");

  /* initialize various flags and other variables */
  setmem(visited, (sizeof(int)) * MAXLOC, 0);
  setmem(prop, (sizeof(int)) * MAXOBJ, 0);
  setmem(&prop[50], (sizeof(int)) * (MAXOBJ - 50), 0xff);
  wzdark = closed = closing = holding = detail = 0;
  limit = 100;
  tally = 15;
  tally2 = 0;
  newloc = 3;
  loc = oldloc = oldloc2 = 1;
  knfloc = 0;
  chloc = 114;
  chloc2 = 140;
  /*	dloc[DWARFMAX-1] = chloc				*/
  scanint(dloc, "0,19,27,33,44,64,114,");
  scanint(odloc, "0,0,0,0,0,0,0,");
  dkill = 0;
  scanint(dseen, "0,0,0,0,0,0,0,");
  clock1 = 30;
  clock2 = 50;
  panic = 0;
  bonus = 0;
  numdie = 0;
  daltloc = 18;
  lmwarn = 0;
  foobar = 0;
  dflag = 0;
  gaveup = 0;
  saveflg = 0;
}
示例#25
0
t_jit_err jit_demultiplex_matrix_calc(t_jit_demultiplex *x, void *inputs, void *outputs)
{
	t_jit_err err=JIT_ERR_NONE;
	t_jit_matrix_info in_minfo,out_minfo,out2_minfo;
	long i;
	t_matrix_conv_info conv, conv2;
	char demultiplexdim = CLAMP(x->demultiplexdim,0,JIT_MATRIX_MAX_DIMCOUNT);
	t_jit_matrix_info *a_minfo,*b_minfo;
	void *a_matrix,*b_matrix;
	long tmpsize, tmp, mod, a_start, b_start, c_start, plexsize;
	long offset, offset2;
	long scan_a = x->scan_a;
	long scan_b = x->scan_b;
	void *in_matrix,*out_matrix,*out2_matrix;
	
	in_matrix 	= jit_object_method(inputs,_jit_sym_getindex,0);
	out_matrix 	= jit_object_method(outputs,_jit_sym_getindex,0);
	out2_matrix 	= jit_object_method(outputs,_jit_sym_getindex,1);

	
	if (x && in_matrix && out_matrix && out2_matrix) {
		jit_object_method(in_matrix,_jit_sym_getinfo,&in_minfo);
		jit_object_method(out_matrix,_jit_sym_getinfo,&out_minfo);
		jit_object_method(out2_matrix,_jit_sym_getinfo,&out2_minfo);

		if (jit_demultiplex_calc_out_matrix(x, &in_minfo, in_matrix, &out_minfo, out_matrix, &out2_minfo, out2_matrix)) {
			err=JIT_ERR_GENERIC; 
			goto out;
		}

		//double check
		//compatible types?
		if ((in_minfo.type != out2_minfo.type) && (in_minfo.type != out_minfo.type)) { 
			err=JIT_ERR_MISMATCH_TYPE; 
			goto out;
		}
				
		//allow any planes, will simply wrap. i think that's okay  - jkc		
		
		setmem(&conv,sizeof(t_matrix_conv_info),0);
		setmem(&conv2,sizeof(t_matrix_conv_info),0);
		for (i=0;i<JIT_MATRIX_MAX_PLANECOUNT;i++) { 
			conv.planemap[i] = i;
			conv2.planemap[i] = i;
		}
		conv.flags = conv2.flags = JIT_MATRIX_CONVERT_SRCDIM | JIT_MATRIX_CONVERT_DSTDIM;
		
		
		// just for ease and later expandability
		a_minfo = &out_minfo;
		a_matrix = out_matrix;		
		b_minfo = &out2_minfo;
		b_matrix = out2_matrix;		
	
		// need to set these first, and only copy in the while tmp-- loop
		for (i = 0; i < in_minfo.dimcount; i++) {
			conv.srcdimstart[i] = conv2.srcdimstart[i] = 0;
			conv.srcdimend[i] = conv2.srcdimend[i] = in_minfo.dim[i] - 1;
			conv.dstdimstart[i] = conv2.dstdimstart[i] = 0;
			conv.dstdimend[i] = conv2.dstdimend[i] = in_minfo.dim[i] - 1;
		}
		
		i = demultiplexdim;
		CLIP(scan_a, 0, in_minfo.dim[i]);
		CLIP(scan_b, 0, in_minfo.dim[i]);
		plexsize = CLAMP(scan_a + scan_b, 0, in_minfo.dim[i]);
			
		tmpsize = in_minfo.dim[i];
		tmp = (tmpsize / plexsize);
		mod = (tmpsize % plexsize);
		a_start = 0;
		b_start = 0;
		c_start = 0;
		if (scan_b == 0) {
			conv.srcdimstart[i] = CLAMP(a_start, 0, in_minfo.dim[i] - 1);
			conv.srcdimend[i] = CLAMP(a_start + (scan_a - 1), 0, in_minfo.dim[i] - 1);
			conv.dstdimstart[i] = CLAMP(b_start, 0, out_minfo.dim[i] - 1);
			conv.dstdimend[i] = CLAMP(b_start + (scan_a - 1), 0, out_minfo.dim[i] - 1);
			jit_object_method(out_matrix, _jit_sym_frommatrix, in_matrix, &conv);
			goto out;
		}
		else if (scan_a == 0) {
			conv2.srcdimstart[i] = CLAMP(a_start, 0, in_minfo.dim[i] - 1);
			conv2.srcdimend[i] = CLAMP(a_start + (scan_b - 1), 0, in_minfo.dim[i] - 1);
			conv2.dstdimstart[i] = CLAMP(c_start, 0, out2_minfo.dim[i] - 1);
			conv2.dstdimend[i] = CLAMP(c_start + (scan_b - 1), 0, out2_minfo.dim[i] - 1);
			jit_object_method(out2_matrix, _jit_sym_frommatrix, in_matrix, &conv2);
			goto out;
		}		
		else while (tmp--) {
			conv.srcdimstart[i] = CLAMP(a_start, 0, in_minfo.dim[i] - 1);
			conv.srcdimend[i] = CLAMP(a_start + (scan_a - 1), 0, in_minfo.dim[i] - 1);
			conv.dstdimstart[i] = CLAMP(b_start, 0, out_minfo.dim[i] - 1);
			conv.dstdimend[i] = CLAMP(b_start + (scan_a - 1), 0, out_minfo.dim[i] - 1);
			a_start += scan_a;
			b_start += scan_a;
			conv2.srcdimstart[i] = CLAMP(a_start, 0, in_minfo.dim[i] - 1);
			conv2.srcdimend[i] = CLAMP(a_start + (scan_b - 1), 0, in_minfo.dim[i] - 1);
			conv2.dstdimstart[i] = CLAMP(c_start, 0, out2_minfo.dim[i] - 1);
			conv2.dstdimend[i] = CLAMP(c_start + (scan_b - 1), 0, out2_minfo.dim[i] - 1);
			a_start += scan_b;
			c_start += scan_b;
			jit_object_method(out_matrix, _jit_sym_frommatrix, in_matrix, &conv);
			jit_object_method(out2_matrix, _jit_sym_frommatrix, in_matrix, &conv2);
		}
		if (mod) {
			offset = (mod < scan_a) ? mod : scan_a;
			offset2 = (mod - scan_a <= 0) ? 0 : mod - scan_a;
			conv.srcdimstart[i] = CLAMP(a_start, 0, in_minfo.dim[i] - 1);
			conv.srcdimend[i] = CLAMP(a_start + (offset - 1), 0, in_minfo.dim[i] - 1);
			conv.dstdimstart[i] = CLAMP(b_start, 0, out_minfo.dim[i] - 1);
			conv.dstdimend[i] = CLAMP(b_start + (offset - 1), 0, out_minfo.dim[i] - 1);
			a_start += offset;
			b_start += offset;
			if (a_start > in_minfo.dim[i] - 1) {
				jit_object_method(out_matrix, _jit_sym_frommatrix, in_matrix, &conv);
				goto out;
			}
			conv2.srcdimstart[i] = CLAMP(a_start, 0, in_minfo.dim[i] - 1);
			conv2.srcdimend[i] = CLAMP(a_start + (offset2 - 1), 0, in_minfo.dim[i] - 1);
			conv2.dstdimstart[i] = CLAMP(c_start, 0, out2_minfo.dim[i] - 1);
			conv2.dstdimend[i] = CLAMP(c_start + (offset2 - 1), 0, out2_minfo.dim[i] - 1);
			jit_object_method(out_matrix, _jit_sym_frommatrix, in_matrix, &conv);
			jit_object_method(out2_matrix, _jit_sym_frommatrix, in_matrix, &conv2);	
		}
	}
	else return JIT_ERR_INVALID_PTR;
	
out:
	return err;
}
示例#26
0
//------------------------------------------------------
void Frame::Reset()
{
   setmem(ImageData,XDim*YDim*sizeof(int),0);
   MaxValue=MeanValue=MinValue=0;
};
示例#27
0
static void putaddr(int mode, unsigned char val) {
	unsigned short ad,ad2;
	switch(mode) {
	case abs:
		cycles+=4;
		ad=getmem(pc++);
		ad|=getmem(pc++)<<8;
		setmem(ad,val);
		return;
	case absx:
		cycles+=4;
		ad=getmem(pc++);
		ad|=getmem(pc++)<<8;
		ad2=ad+x;
		setmem(ad2,val);
		return;
	case absy:
		cycles+=4;
		ad=getmem(pc++);
		ad|=getmem(pc++)<<8;
		ad2=ad+y;
		if ((ad2&0xff00)!=(ad&0xff00)) cycles++;
		setmem(ad2,val);
		return;
	case zp:
		cycles+=3;
		ad=getmem(pc++);
		setmem(ad,val);
		return;
	case zpx:
		cycles+=4;
		ad=getmem(pc++);
		ad+=x;
		setmem(ad&0xff,val);
		return;
	case zpy:
		cycles+=4;
		ad=getmem(pc++);
		ad+=y;
		setmem(ad&0xff,val);
		return;
	case indx:
		cycles+=6;
		ad=getmem(pc++);
		ad+=x;
		ad2=getmem(ad&0xff);
		ad++;
		ad2|=getmem(ad&0xff)<<8;
		setmem(ad2,val);
		return;
	case indy:
		cycles+=5;
		ad=getmem(pc++);
		ad2=getmem(ad);
		ad2|=getmem((ad+1)&0xff)<<8;
		ad=ad2+y;
		setmem(ad,val);
		return;
	case acc:
		cycles+=2;
		a=val;
		return;
	}
}
示例#28
0
BOOL fedit(char *filename)
{
	FILE *fp;
	char *buf;
	unsigned int lim;			/* can't edit more then a segment anyway */
	long filesize;
	int rc = FALSE;
	int err;
	char path[64];
	
	getcwd(path,64);

	err = errno = 0;
	/* set the message entry flags and buffer */
	clearmsgbuf();
    setmem(msgBuf, sizeof(struct msgB), 0);
    mailFlag = FALSE;
    oldFlag = FALSE;
    limitFlag = FALSE;
    linkMess = FALSE;
	if (loggedIn)
		strcpy(msgBuf->mbauth,logBuf.lbname);
	
	/* try to edit an existing file */
	if (filexists(filename)) {
		fp = fopen(filename,"rt");
		if (fp) {
			filesize = filelength(fileno(fp));
			if ((unsigned int) (filesize + (long) cfg.maxtext) > UINT_MAX) {
				err = -2;
				cPrintf("\nFile too long\n");
			} else {
				lim = cfg.maxtext + (int) filesize;
				buf = calloc(1,lim);
				if (buf) {
					errno = 0;
					if (!fread(buf,1,lim,fp)) {
						cPrintf("\nFile read error\n");
						err = errno;
					}
					if (fclose(fp) && !err) {/* we need to 'recreate' later */
						cPrintf("\nFile close error\n");
						err = errno;
					}
					if (!err)
						mFormat(buf);		/* display the file */
					oldFlag = TRUE;
					
				}
			}
		} else {
			lim = cfg.maxtext;
			buf = calloc(1,lim);
			oldFlag = FALSE;
		}
	}
	
	if (buf && !err && editBuf(buf,lim)) {
		changedir(path);		/* because silly edit routines loose path */
		if (!strblank(buf)) {
			rc = TRUE;
			lim = strlen(buf);
			errno = 0;			/* because silly video routines set it */
			fp = fopen(filename,"wt");
			if (!fp && !err) {
				cPrintf("\nFile open error 2\n");
				err = errno;
			}
			if (fp) {
				/* because silly DOS doesn't 'error' on disk full	*/
				if(!fwrite(buf,1,lim,fp) && !errno) {
					cPrintf("\nFile write error\n");
					err = -1;
				}
				errno = 0;
				if (!fclose(fp)&& !err) {
					cPrintf("\nFile close error 2\n");
					err = errno;
				}
			}
		} else {				/* we won't save empty files */
			rc = FALSE;
		}
	}
	if (!buf) {					/* out of memory condition */
		mtPrintf(TERM_BOLD," \n Out of memory editing file %s.\n",filename);
		rc = FALSE;
	} else {
		switch (err) {
			case 0:		/* no error */
			break;
			
			case -1:	/* disk full condition */
				mtPrintf(TERM_BOLD,
					" \n Disk full saving %s, file truncated.\n",filename);
				rc = FALSE;
			break;
			
			case -2:	/* file >64k condition */
				mtPrintf(TERM_BOLD,
					" \n File %s is too large to edit.\n",filename);
				rc = FALSE;
			break;
			
			default:	/* DOS error condition */
				mtPrintf(TERM_BOLD, " \n DOS error '%s' editing %s: \n",
					strerror(err),filename);
				rc = FALSE;
			break;
		}
	}
	if (buf) {
		free(buf);
		buf = NULL;
	}
	return rc;
}
示例#29
0
/************************ END OF SPECIFICATIONS ***********************/
void USBInit( RPH FAR *pRP )
{
   PRPINITOUT      pRPO;          /* output request packet far pointer */
   PRPINITIN       pRPI;          /* input request packet far pointer */
   UINT            ctrlID;
   KeyData         keyData[3]={"V",CFSTR_TYPE_DEC,0,0,
      "REQ:",CFSTR_TYPE_STRING,0,0,
      "I13",CFSTR_TYPE_DEC,0,0}; // 31/05/1999 MB
   PSZ             cmdLine;
   ULONG           cmdRStatus, errColumn;
   USHORT          cmdRc;

#ifdef   DEBUG
   dsPrint(DBG_HLVLFLOW, "USBD: USBInit started\r\n");
#endif

   pRP->Status = STATUS_DONE;
   if (ghDriver) // initialization already passed
      return;

   pRPI = (PRPINITIN) pRP;
   pRPO = (PRPINITOUT) pRP;

   Device_Help = ((PRPINITIN)pRP)->DevHlpEP;  /* save devhlp entry point */

   // process CONFIG.SYS BASEDEV= line parameters
   cmdLine=(PSZ) MAKEP( SELECTOROF(pRPI->InitArgs),
                        OFFSETOF(((PDDD_PARM_LIST)pRPI->InitArgs)->cmd_line_args) );
   cmdRStatus=ProcessConfigString(cmdLine, sizeof(keyData)/sizeof(keyData[0]), (KeyData FAR *)&keyData);
   cmdRc=LOUSHORT(cmdRStatus); errColumn=(ULONG)HIUSHORT(cmdRStatus);
   switch (cmdRc)  // set cmd line processing errors
   {
   case CFSTR_UNKWN_KEYS:
      SetLongValue( gVMessages[INIT_MESSAGE_UNKNOWNKWD], errColumn );
      gMessageCount=AddToMsgArray( gMessageIDs, INIT_MESSAGE_UNKNOWNKWD, gMessageCount, MAX_INIT_MESSAGE_COUNT );
      break;
   case CFSTR_CONVERR:
      SetLongValue( gVMessages[INIT_MESSAGE_INVNUMERIC], errColumn );
      gMessageCount=AddToMsgArray( gMessageIDs, INIT_MESSAGE_INVNUMERIC, gMessageCount, MAX_INIT_MESSAGE_COUNT );
      break;
   default:
      break;
   }
   if (keyData[1].value &&  // check for HCD layer drivers
       !CheckHCDDriversLoaded( cmdLine, LOUSHORT(keyData[1].value), HIUSHORT(keyData[1].value) ))
   {
      pRP->Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; // 05/16/2000 MB - exit code changed to quiet exit code
      gMessageCount=AddToMsgArray( gMessageIDs, INIT_MESSAGE_NO_HCD, gMessageCount, MAX_INIT_MESSAGE_COUNT );
   }
   gVerbose= keyData[0].keyStatus!=CFSTR_STATUS_NOTFOUND;

   gDelayHostStart = keyData[2].keyStatus!=CFSTR_STATUS_NOTFOUND; // 31/05/1999 MB
   if(gDelayHostStart && (pRP->Status == STATUS_DONE) )  // 05/16/2000 MB - fixed error code processing
   {
      USHORT         ctxOffset;  
      USHORT         rc;

      ctxOffset=(USHORT)(LONG)(StartHostCtxHookRtn); // IRQ processing thread
      rc = DevHelp_AllocateCtxHook((NPFN)ctxOffset, &gStartHostHookHandle);

      if (rc)
      {
         pRP->Status = STATUS_DONE | STERR | STATUS_ERR_UNKCMD;
         gMessageCount=AddToMsgArray( gMessageIDs, INIT_MESSAGE_SETCTXFAILED, gMessageCount, MAX_INIT_MESSAGE_COUNT );
#ifdef DEBUG
      dsPrint(DBG_CRITICAL, " USBD: USBDInit failed to allocate CTX hook routine\r\n");
#endif
      }
   }

   /*---------------------------------------------------*/
   /* Register device driver with resource manager      */
   /*---------------------------------------------------*/
   if (pRP->Status == STATUS_DONE)
      RegisterUSBD();

   if (pRP->Status == STATUS_DONE)
   {
      //	initialize local structures
      setmem((PSZ)&gHostControllers,0,sizeof(gHostControllers));
      setmem((PSZ)&gClassDrivers,0,sizeof(gClassDrivers));
      setmem((PSZ)&gDevices,0,sizeof(gDevices));
      setmem((PSZ)&gHubs,0,sizeof(gHubs));
      for (ctrlID=1; ctrlID<gMaxControllers; ctrlID++)
      {
         gSetAddress[ctrlID]=gSetAddress[0];
         gSetConfiguration[ctrlID]=gSetConfiguration[0];
         gDeviceStruct[ctrlID]=gDeviceStruct[0];
         gGetConfiguration[ctrlID]=gGetConfiguration[0];
         gGetHubConfigurationLength[ctrlID]=gGetHubConfigurationLength[0];
      }
   }

   if (pRP->Status == STATUS_DONE)
   {
      SetLongValue( gVMessages[INIT_MESSAGE_LOADED], (ULONG)gDriverStruct.MajorVer );   
      SetLongValue( gVMessages[INIT_MESSAGE_LOADED], (ULONG)gDriverStruct.MinorVer );   
      gMessageCount=AddToMsgArray( gMessageIDs, INIT_MESSAGE_LOADED, gMessageCount, MAX_INIT_MESSAGE_COUNT );
      pRPO->CodeEnd = ((USHORT) &USBInit) - 1;         /* set end of code segment */
      pRPO->DataEnd = ((USHORT) &gInitDataStart) - 1;  /* set end of data segment */
   }
   else
   {
      pRPO->CodeEnd = 0;          /* set end of code segment */
      pRPO->DataEnd = 0;       /* set end of data segment */
   }

   TTYWrite(gVMessages, gMessageIDs, gMessageCount);

#ifdef   DEBUG
   dsPrint1(DBG_HLVLFLOW, "USBD: USBInit ended. Status %x\r\n", pRP->Status);
#endif
   return;
}
示例#30
0
文件: LIFE.C 项目: k0gaMSX/legacy
/* initialize the cell matrix to all dead */
clear()
{
	setmem(cell,(XSIZE*YSIZE),0);
}