コード例 #1
0
ファイル: FSC.CPP プロジェクト: kuailexs/symbiandump-os1
int FscRead::ReadFont()
	{
	iInputFile.seekg(0,ios::end);
	iFileBufLen=iInputFile.tellg();
	iInputFile.seekg(0);
	iFileBufPos=0;
	iFileBuf=new char[iFileBufLen];
	iInputFile.read(iFileBuf,iFileBufLen);
	int ret=Pass1();
	if(ret) return(ret);
	return(Pass2());
	}
コード例 #2
0
ファイル: Renderer.cpp プロジェクト: AerialX/projectM-android
void Renderer::RenderFrame(const Pipeline &pipeline, const PipelineContext &pipelineContext)
{
	SetupPass1(pipeline, pipelineContext);

#ifdef USE_CG
	shaderEngine.enableShader(currentPipe->warpShader, pipeline, pipelineContext);
#endif
	Interpolation(pipeline);
#ifdef USE_CG
	shaderEngine.disableShader();
#endif

	RenderItems(pipeline, pipelineContext);

	FinishPass1();
	Pass2(pipeline, pipelineContext);
}
コード例 #3
0
int main( int argc, char * argv[] )
#endif
/***************************************/
{
    bool    noerror;

#ifndef DLL_COMPILE
    RcMemInit();
    Layer0InitStatics();
#if !defined(__UNIX__) && !defined(__OSI__) /* _grow_handles doesn't work yet */
    _grow_handles(100);
#endif
#endif
    if( !InitRcMsgs( argv[0] ) ) return( 1 );

    noerror = ScanParams( argc, argv );
    if (!CmdLineParms.Quiet) {
        RcIoPrintBanner();
    }
    if (CmdLineParms.PrintHelp) {
        RcIoPrintHelp( argv[0] );
    }

    if (noerror && !CmdLineParms.Pass2Only) {
        noerror = Pass1();
    }
    if (noerror && !CmdLineParms.Pass1Only && !CmdLineParms.PreprocessOnly ) {
        noerror = Pass2();
    }

    FiniTable();
#ifndef DLL_COMPILE
    ScanParamShutdown();
    FiniRcMsgs();
    RcMemShutdown();
#endif

    if (noerror) {
        return( 0 );
    } else {
        return( 1 );
    }
} /* main */
コード例 #4
0
void Renderer::RenderFrame(const Pipeline &pipeline, const PipelineContext &pipelineContext)
{

#ifdef USE_FBO
    // when not 'renderToTexture', the user may use its own couple FBO/texture
    // so retrieve this external FBO if it exists, (0 means no FBO) and unbind it
    GLint externalFBO = 0;
    if (!renderTarget->renderToTexture)
    {
        glGetIntegerv(GL_FRAMEBUFFER_BINDING, &externalFBO);
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    }
#endif

	SetupPass1(pipeline, pipelineContext);

#ifdef USE_CG
	shaderEngine.enableShader(currentPipe->warpShader, pipeline, pipelineContext);
#endif
	Interpolation(pipeline);
#ifdef USE_CG
	shaderEngine.disableShader();
#endif

	RenderItems(pipeline, pipelineContext);
	FinishPass1();

#ifdef USE_FBO
    // when not 'renderToTexture', the user may use its own couple FBO/texture
    // if it exists (0 means no external FBO)
    // then rebind it just before calling the final pass: Pass2
    if (!renderTarget->renderToTexture && externalFBO != 0)
        glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, externalFBO);
#endif

	Pass2(pipeline, pipelineContext);
}
コード例 #5
0
ファイル: pbsweep.cpp プロジェクト: igorizyumin/xpcb
void BOCTX::Sweep(SEGM2 * aSegms, UINT32 nSegms)
{
	CollectEvents(aSegms, nSegms);

	while (not m_E.empty())
	{
		// store the current state of main active list
		SAVE_LIST save_list;
		save_list.reserve(32);
		
		for (SEGM_LIST::iterator segm = m_S.begin(); segm != m_S.end(); ++segm)
			save_list.push_back(&*segm);

		// do Pass 1
		EVENT e = m_E.top();
		m_E.pop();
		EVENTLIST elist;
		elist.reserve(8);

		assert(INT20_MIN <= e.x and e.x <= INT20_MAX);

			AddEvent(&elist, e);
			HandleEvent(e);

		while (not m_E.empty() and m_E.top().x == e.x)
		{
			e = m_E.top();
			m_E.pop();
			AddEvent(&elist, e);
			HandleEvent(e);
		}

		// do Pass 2
		Pass2(&elist, &save_list);
	}
} // Sweep
コード例 #6
0
ファイル: sim.c プロジェクト: AristotleProject/freepascal
int
main(int argc, char *argv[]) {
	progname = argv[0];		/* save program name */
	argv++, argc--;			/* and skip it */

	/* Set the default output and debug streams */
	OutputFile = stdout;
	DebugFile = stdout;

	/* Get command line options */
	{	int nop = do_options(progname, optlist, argc, argv);
		argc -= nop, argv += nop;	/* skip them */
	}

	/* Treat the value options */
	if (minrunstring) {
		MinRunSize = strtoul(minrunstring, NULL, 10);
		if (MinRunSize == 0) fatal("bad or zero run size; form is: -r N");
	}
	if (pagewidthstring) {
		PageWidth = atoi(pagewidthstring);
		if (PageWidth == 0) fatal("bad or zero page width; form is: -w N");
	}
	if (outputname) {
		OutputFile = fopen(outputname, "w");
		if (OutputFile == 0) {
			char msg[500];

			sprintf(msg, "cannot open output file %s", outputname);
			fatal(msg);
			/*NOTREACHED*/
		}
	}

	if (option_set('-')) {
		/* it is the lexical scan only */
		while (argv[0]) {
			print_stream(argv[0]);
			argv++;
		}
		return 0;
	}

	/* Start processing */
	InitLanguage();

	/* Read the input files */
	Pass1(argc, argv);

	/* Set up the forward reference table */
	MakeForwardReferences();

	/* Compare the input files to find runs */
	Compare();

	/* Delete forward reference table */
	FreeForwardReferences();

	/* Find positions of the runs found */
	Pass2();

	/* Print the similarities */
	Pass3();

	return 0;
}
コード例 #7
0
ファイル: iasm.c プロジェクト: Goku0858756/rzzzwilson
/******************************************************************************
 Description : 
  Parameters : 
     Returns : 
    Comments : 
 ******************************************************************************/
int
main(int argc, char *argv[])
{
    char optch;
    char *outputext = "ptp";
    int  exitvalue = EXIT_SUCCESS;

/******
 * Set up globals.
 ******/

    if (argv[0] != NULL)
        ProgName = argv[0];

/******
 * Check parameters.
 ******/

    opterr = 0;

    while ((optch = getopt(argc, argv, "l:")) != -1)
    {
        switch (optch)
        {
            case 'l':
                ListFileName = optarg;
                break;
            default:
                usage();
        }
    }

    if (optind + 1 != argc)
        usage();

    InFileName = argv[optind];
    InFile = fopen(InFileName, "r");
    if (InFile == NULL)
        Error("Can't open '%s' for first pass read: %s", InFileName, strerror(errno));

    if (strlen(InFileName) > 3 &&
        STREQ(InFileName + strlen(InFileName) - 4, ".asm"))
    {
        char *newname = CopyStr(InFileName);
        char *chptr = newname + strlen(newname) - 4;

        *chptr = '\0';
        sprintf(OutFileName, "%s.%s", newname, outputext);

        free(newname);
    }
    else
        sprintf(OutFileName, "%s.%s", InFileName, outputext);

    OutFile = fopen(OutFileName, "w");
    if (OutFile == NULL)
        Error("Can't open '%s' for output: %s", OutFileName, strerror(errno));

    if (ListFileName != NULL)
    {
        ListFile = fopen(ListFileName, "w");
        if (ListFile == NULL)
            Error("Can't open '%s' for list output: %s", ListFileName, strerror(errno));
    }

/******
 * Assemble the input file.
 ******/

    if (Pass1())
    {
        fclose(InFile);
        InFile = fopen(InFileName, "r");
        if (InFile == NULL)
            Error("Can't open '%s' for second pass read: %s", InFileName, strerror(errno));

        if (!Pass2())
            exitvalue = PASS2_FAIL;
    }
    else
        exitvalue = PASS1_FAIL;

/******
 * Close the files.
 ******/

    if (InFile != NULL)
        fclose(InFile);
    if (OutFile != NULL)
        fclose(OutFile);

    exit(exitvalue);
}
コード例 #8
0
ファイル: macro.c プロジェクト: isaagar/cl3
int Pass1(MNT mnt[50], MDT mdt[50], int mntc, int mdtc, Pass1table table1[50])
{
	int tp=0,i=0, succ=0, fptr=0, temp=0, j=0, flagl=0;
	FPPL fppl[10];
	
	Pass2table table2[50];
	
	FILE *fin=NULL;
	char ch='\0', buffer[20]={"\0"};

	fin=fopen("input1.c","r");
	mntc=0;
	mdtc=0;
	tp=0;
	fptr=0;
	succ=1;
	do
	{
		ch='\0';
		i=0;
		while(ch!=' ' && ch!='\n' && ch!=',' && ch!=':' && succ==1)
		{
			succ=fscanf(fin,"%c",&ch);
			buffer[i]=ch;
			i++;
		
		}
		buffer[i-1]='\0';

		if(strcmp(buffer,"MACRO")==0)	//handling of macro definition
		{
			succ=putinbuffer(fin,buffer);

			strcpy(mnt[mntc].mname,buffer);		//macro name

			mnt[mntc].sindex=mdtc;
			mnt[mntc].no_of_arguments=0;

			ch='\0';
			while(ch!='\n')			// macro parameters into fppl
			{
				ch='\0';
				i=0;
				while(ch!='\n' && ch!=',' && succ==1)
				{
					succ=fscanf(fin,"%c",&ch);
					buffer[i]=ch;
					i++;
		
				}
				buffer[i-1]='\0';
				printf("\nBuffer:%s",buffer);
				mnt[mntc].no_of_arguments++;
	
				strcpy(fppl[fptr].name,buffer);
				fppl[fptr].pos=mnt[mntc].no_of_arguments;
				fptr++;
			}
			
			j=0;
			flagl=0;
			while(strcmp(buffer,"MEND")!=0)		//putting macro def into mdt
			{
				ch='\0';
				i=0;
				while(ch!=' ' && ch!=',' && ch!=':' && ch!='\n')
				{
					fscanf(fin,"%c",&ch);
					buffer[i]=ch;
					i++;
				}
				buffer[i-1]='\0';
		
				if(ch==':')
				{
					strcpy(mdt[mdtc].label,buffer);
					flagl=1;			//label encountered flag
				}
				
				else if(ch==' ')
				{
					strcpy(mdt[mdtc].instruct,buffer);
					mdt[mdtc].no=0;
					if(flagl==0)		//label was not encountered
					{						
						strcpy(mdt[mdtc].label,"\0");
					}
				}
				else if(ch==','||ch=='\n')	//arguments to be checked for position in fppl
				{
					i=0;
					for(i=0;i<fptr;i++)
					{
						if(strcmp(buffer,fppl[i].name)==0)
						{
							break;
						}
					}
					mdt[mdtc].arguments[j]=fppl[i].pos;
					j++;
				}

				if(ch=='\n')
				{
					mdt[mdtc].no=j;
					j=0;
					flagl=0;
					mdtc++;
				}
					
			}
			
			mnt[mntc].eindex=mdtc-1;
			strcpy(mdt[mdtc].instruct,buffer);
			mdt[mdtc].arguments[0]=mntc;
			succ=putinbuffer(fin,buffer);
			
			mntc++;
			mdtc++;			
			
		}
		else	//for the rest of the program
		{

			if(ch==':')
			{
				strcpy(table1[tp].label,buffer);
				flagl=1;
			}
			else if(ch==' ')
			{
				strcpy(table1[tp].instruct,buffer);
				j=0;
				table1[tp].no=0;
				if(flagl==0)
				{
					strcpy(table1[tp].label,"\0");
				}

			}
			else if(ch==',' || ch=='\n')
			{
				strcpy(table1[tp].arguments[j],buffer);
				j++;
				if(ch=='\n')
				{
					table1[tp].no=j;
					j=0;
					flagl=0;
					tp++;
				}
			}
		}

	}while(succ==1);

	displayPass1tables(mnt,mntc,mdt, mdtc,fppl,fptr);
	print_IC(table1,tp);

	fclose(fin);
	fin=NULL;
	
	Pass2(mnt,mdt,mntc,table1,tp,table2);
	
	return tp;
}
コード例 #9
0
ファイル: tContour.cpp プロジェクト: dulton/53_hero
void tContour::Generate()
{

    int i, j;
    int x3, x4, y3, y4, x, y, oldx3, xlow;
    const int cols=m_iColSec+1;
    const int rows=m_iRowSec+1;
    
    // Initialize memroy if needed
    InitMemory();

    m_dDx = (m_pLimits[1]-m_pLimits[0])/(double)(m_iColSec);
    m_dDy = (m_pLimits[3]-m_pLimits[2])/(double)(m_iRowSec);

    xlow = 0;
    oldx3 = 0;
    x3 = (cols-1)/m_iRowFir;
    x4 = ( 2*(cols-1) )/m_iRowFir;
    for (x = oldx3; x <= x4; x++) 
    {     /* allocate new columns needed
        */
        if (x >= cols)
            break;
        if (m_ppFnData[x]==NULL)
            m_ppFnData[x] = new CFnStr[rows];

        for (y = 0; y < rows; y++)
            FnctData(x,y)->m_sTopLen = -1;
    }

    y4 = 0;
    for (j = 0; j < m_iColFir; j++) 
    {
        y3 = y4;
        y4 = ((j+1)*(rows-1))/m_iColFir;
        Cntr1(oldx3, x3, y3, y4);
    }

    for (i = 1; i < m_iRowFir; i++) 
    {
        y4 = 0;
        for (j = 0; j < m_iColFir; j++) 
        {
            y3 = y4;
            y4 = ((j+1)*(rows-1))/m_iColFir;
            Cntr1(x3, x4, y3, y4);
        }

        y4 = 0;
        for (j = 0; j < m_iColFir; j++) 
        {
            y3 = y4;
            y4 = ((j+1)*(rows-1))/m_iColFir;
            Pass2(oldx3,x3,y3,y4);
        }

        if (i < (m_iRowFir-1)) 
        {    /* re-use columns no longer needed */
            oldx3 = x3;
            x3 = x4;
            x4 = ((i+2)*(cols-1))/m_iRowFir;
            for (x = x3+1; x <= x4; x++) 
            {
                if (xlow < oldx3) 
                {
                    if (m_ppFnData[x])
                        delete[] m_ppFnData[x];
                    m_ppFnData[x] = m_ppFnData[xlow];
                    m_ppFnData[ xlow++ ] = NULL;
                } 
                else
                    if (m_ppFnData[x]==NULL)
                        m_ppFnData[x] = new CFnStr[rows];

                for (y = 0; y < rows; y++)
                    FnctData(x,y)->m_sTopLen = -1;
            }
        }
    }

    y4 = 0;
    for (j = 0; j < m_iColFir; j++) 
    {
        y3 = y4;
        y4 = ((j+1)*(rows-1))/m_iColFir;
        Pass2(x3,x4,y3,y4);
    }
}
コード例 #10
0
ファイル: tContour.cpp プロジェクト: dulton/53_hero
void tContour::Pass2(int x1, int x2, int y1, int y2)
{
    int left = 0;
    int right = 0;
    int top = 0;
    int bot = 0;
    int old = 0;
    int iNew = 0;
    int i = 0;
    int j = 0;
    int x3 = 0;
    int y3 = 0;
    double yy0 = 0;
    double yy1 = 0;
    double xx0 = 0;
    double xx1 = 0;
    double xx3 = 0;
    double yy3 = 0;
    double v = 0;
    double f11 = 0;
    double f12 = 0;
    double f21 = 0;
    double f22 = 0;
    double f33 = 0;
    double fold = 0;
    double fnew = 0;
    double f = 0;
    double xoff=m_pLimits[0];
    double yoff=m_pLimits[2];
    
    if ((x1 == x2) || (y1 == y2))   /* if not a real cell, punt */
        return;
    f11 = FnctData(x1,y1)->m_dFnVal;
    f12 = FnctData(x1,y2)->m_dFnVal;
    f21 = FnctData(x2,y1)->m_dFnVal;
    f22 = FnctData(x2,y2)->m_dFnVal;
    if ((x2 > x1+1) || (y2 > y1+1)) /* is cell divisible? */
    {   
        x3 = (x1+x2)/2;
        y3 = (y1+y2)/2;
        f33 = FnctData(x3, y3)->m_dFnVal;
        i = j = 0;
        if (f33 < f11) i++; else if (f33 > f11) j++;
        if (f33 < f12) i++; else if (f33 > f12) j++;
        if (f33 < f21) i++; else if (f33 > f21) j++;
        if (f33 < f22) i++; else if (f33 > f22) j++;
        if ((i > 2) || (j > 2)) /* should we divide cell? */ 
        {   
            /* subdivide cell */
            Pass2(x1, x3, y1, y3);
            Pass2(x3, x2, y1, y3);
            Pass2(x1, x3, y3, y2);
            Pass2(x3, x2, y3, y2);
            return;
        }
    }

    for (i = 0; i < (int)m_vPlanes.size(); i++) 
    {
        v = m_vPlanes[i];
        j = 0;
        if (f21 > v) j++;
        if (f11 > v) j |= 2;
        if (f22 > v) j |= 4;
        if (f12 > v) j |= 010;
        if ((f11 > v) ^ (f12 > v)) 
        {
            if ((FnctData(x1,y1)->m_sLeftLen != 0) &&
                (FnctData(x1,y1)->m_sLeftLen < FnctData(x1,y1)->m_sRightLen)) 
            {
                old = y1;
                fold = f11;
                while (1) 
                {
                    iNew = old+FnctData(x1,old)->m_sLeftLen;
                    fnew = FnctData(x1,iNew)->m_dFnVal;
                    if ((fnew > v) ^ (fold > v))
                        break;
                    old = iNew;
                    fold = fnew;
                }
                yy0 = ((old-y1)+(iNew-old)*(v-fold)/(fnew-fold))/(y2-y1);
            } 
            else
                yy0 = (v-f11)/(f12-f11);

            left = (int)(y1+(y2-y1)*yy0+0.5);
        }
        if ((f21 > v) ^ (f22 > v)) 
        {
            if ((FnctData(x2,y1)->m_sRightLen != 0) &&
                (FnctData(x2,y1)->m_sRightLen < FnctData(x2,y1)->m_sLeftLen)) 
            {
                old = y1;
                fold = f21;
                while (1) 
                {
                    iNew = old+FnctData(x2,old)->m_sRightLen;
                    fnew = FnctData(x2,iNew)->m_dFnVal;
                    if ((fnew > v) ^ (fold > v))
                        break;
                    old = iNew;
                    fold = fnew;
                }
                yy1 = ((old-y1)+(iNew-old)*(v-fold)/(fnew-fold))/(y2-y1);
            } 
            else
                yy1 = (v-f21)/(f22-f21);

            right = (int)(y1+(y2-y1)*yy1+0.5);
        }
        if ((f21 > v) ^ (f11 > v)) 
        {
            if ((FnctData(x1,y1)->m_sBotLen != 0) &&
                (FnctData(x1,y1)->m_sBotLen < FnctData(x1,y1)->m_sTopLen)) {
                old = x1;
                fold = f11;
                while (1) {
                    iNew = old+FnctData(old,y1)->m_sBotLen;
                    fnew = FnctData(iNew,y1)->m_dFnVal;
                    if ((fnew > v) ^ (fold > v))
                        break;
                    old = iNew;
                    fold = fnew;
                }
                xx0 = ((old-x1)+(iNew-old)*(v-fold)/(fnew-fold))/(x2-x1);
            } 
            else
                xx0 = (v-f11)/(f21-f11);

            bot = (int)(x1+(x2-x1)*xx0+0.5);
        }
        if ((f22 > v) ^ (f12 > v)) 
        {
            if ((FnctData(x1,y2)->m_sTopLen != 0) &&
                (FnctData(x1,y2)->m_sTopLen < FnctData(x1,y2)->m_sBotLen)) {
                old = x1;
                fold = f12;
                while (1) {
                    iNew = old+FnctData(old,y2)->m_sTopLen;
                    fnew = FnctData(iNew,y2)->m_dFnVal;
                    if ((fnew > v) ^ (fold > v))
                        break;
                    old = iNew;
                    fold = fnew;
                }
                xx1 = ((old-x1)+(iNew-old)*(v-fold)/(fnew-fold))/(x2-x1);
            } 
            else
                xx1 = (v-f12)/(f22-f12);

            top = (int)(x1+(x2-x1)*xx1+0.5);
        }

        switch (j) 
        {
            case 7:
            case 010:
                ExportLine(i,x1,left,top,y2);
                break;
            case 5:
            case 012:
                ExportLine(i,bot,y1,top,y2);
                break;
            case 2:
            case 015:
                ExportLine(i,x1,left,bot,y1);
            break;
        case 4:
        case 013:
            ExportLine(i,top,y2,x2,right);
            break;
        case 3:
        case 014:
            ExportLine(i,x1,left,x2,right);
            break;
        case 1:
        case 016:
            ExportLine(i,bot,y1,x2,right);
            break;
        case 0:
        case 017:
            break;
        case 6:
        case 011:
            {
                yy3 = (xx0*(yy1-yy0)+yy0)/(1.0-(xx1-xx0)*(yy1-yy0));
                xx3 = yy3*(xx1-xx0)+xx0;
                xx3 = x1+xx3*(x2-x1);
                yy3 = y1+yy3*(y2-y1);
                xx3 = xoff+xx3*m_dDx;
                yy3 = yoff+yy3*m_dDy;
                f = GetFieldValue(xx3, yy3);
                if (f == v) 
                {
                    ExportLine(i,bot,y1,top,y2);
                    ExportLine(i,x1,left,x2,right);
                } 
                else
                {
                    if (((f > v) && (f22 > v)) || ((f < v) && (f22 < v))) 
                    {
                        ExportLine(i,x1,left,top,y2);
                        ExportLine(i,bot,y1,x2,right);
                    } 

                    else 
                    {
                        ExportLine(i,x1,left,bot,y1);
                        ExportLine(i,top,y2,x2,right);
                    }
                }
            }
            break;
        }
    }
}