Beispiel #1
0
int
Xmacro(int status, char *label, char *mnemo, char *oper)
{
	jmp_buf errjmpsav;
	char *s1,*s2;
	struct macroline *startmacro;
	register struct macroline **where;
	char mname[LABLEN+1];
	struct label *lbl = 0;
	
	where = &startmacro;
	strncpy(mname,label,LABLEN);
	mname[LABLEN]=0;
	
	if ( oper )
		error ( "no operand allowed in macro statement" );
	if ( macrolevel )
		error ( "nested macro definition");
	if ( status & 1 )
		outputline();
	if ( status & 2 )
	{	lbl = deflabel(mname,0,L_MACRO,0);
		lbl->ptr = 0;
	}
	jmp_buf_copy(errjmpsav,errorjump);
	do
	{	if (setjmp(errorjump) )
			errnumber++;
		zerobuffer();
		linegets(curline,250);
		if (feof (file) )
		{	jmp_buf_copy(errorjump,errjmpsav);
			error("Unexpected End of File");
		}
		if ( !filter(curline,"?_;?",&s1,&s2) )
			s1=curline;
		if (status & 2)
		{
			*where= ( struct macroline *) 
				malloc(	sizeof( struct macroline ) +
					strlen( s1 ) );
			(*where)->next = NULL;
			strcpy ( (*where)->line , s1 );
			where = & ( (*where)->next );
		};
		if (status & 1)
			outputline();
	} while ( ! filter(s1,"_?_ENDM_?",&s1,&s2 ) );

	jmp_buf_copy(errorjump,errjmpsav);
	if ( *s1 || *s2 )
		error ("illegal ENDM instruction");
	if ( lbl )
		lbl->ptr = (void*)startmacro;
	return 0;
		
}
Beispiel #2
0
void VDVideoTextureTilePatternOpenGL::Init(VDOpenGLBinding *pgl, int w, int h, bool bPackedPixelsSupported, bool bEdgeClampSupported) {
	mbPackedPixelsSupported		= bPackedPixelsSupported;
	mbEdgeClampSupported		= bEdgeClampSupported;

	GLint maxsize;
	pgl->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);

	mTextureSize	= maxsize;
	mTextureSizeInv	= 1.0 / maxsize;
	mTextureTilesW	= 1;
	mTextureTilesH	= 1;

	int ntiles = 1;
	int xlast = w;
	int ylast = h;
	int xlasttex = 1;
	int ylasttex = 1;

	while(xlasttex < xlast)
		xlasttex += xlasttex;
	while(ylasttex < ylast)
		ylasttex += ylasttex;

	int largestW = xlasttex;
	int largestH = ylasttex;

	mTextureLastW = xlast;
	mTextureLastH = ylast;
	mTextureLastWInvPow2	= 1.0 / xlasttex;
	mTextureLastHInvPow2	= 1.0 / ylasttex;

	pgl->glGenTextures(1, &mTexture);

	vdautoblockptr zerobuffer(malloc(4 * largestW * largestH));
	memset(zerobuffer, 0, 4 * largestW * largestH);

	pgl->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	pgl->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);


	int tile = 0;
	int y = 0;
	int x = 0;
	int texw = xlasttex;
	int texh = ylasttex;

	pgl->glBindTexture(GL_TEXTURE_2D, mTexture);

	if (mbEdgeClampSupported) {
		pgl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE_EXT);
		pgl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE_EXT);
	} else {
		pgl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
		pgl->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

		static const float black[4]={0.f,0.f,0.f,0.f};
		pgl->glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, black);
	}

	pgl->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texw, texh, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);

	mTileInfo.mInvU		= 1.0f / texw;
	mTileInfo.mInvV		= 1.0f / texh;
	mTileInfo.mSrcW		= xlast;
	mTileInfo.mSrcH		= ylast;

	Flip();
}