示例#1
0
static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
{
    fxMesaContext fxMesa = FX_CONTEXT( ctx );
    GrVertex *dst = fxMesa->verts + edst;
    GrVertex *src = fxMesa->verts + esrc;

#if FX_PACKEDCOLOR
    *(GLuint *)&dst->pargb = *(GLuint *)&src->pargb;
#else  /* !FX_PACKEDCOLOR */
    COPY_FLOAT(dst->r, src->r);
    COPY_FLOAT(dst->g, src->g);
    COPY_FLOAT(dst->b, src->b);
    COPY_FLOAT(dst->a, src->a);
#endif /* !FX_PACKEDCOLOR */
}
示例#2
0
文件: cp.c 项目: lorian1333/hjvm
u8int read_constant_pool(FILE* f, u16int *i, u16int *cpcount, cp_info** cpinfo)
{

     u16int *j= (u16int*) malloc(sizeof(u16int));
	s32int* integer, *i2;
	u8int *raw = malloc(4), *raw2 = malloc(8);

     
     cp_info* info;

   
	debugmsg("Constant pool: \n");
	for(*i=0;*i < ((*cpcount)-1); (*i)++)
	{
        info = (cp_info*) malloc(sizeof(cp_info));
        memset(info, 0, sizeof(cp_info));
		info->tag = fgetc(f);
	
		switch(info->tag)
		{
			case CONSTANT_Class: 
			{
				read_class(f, j, info);
				debugmsg("#%d Class #%d\n", (*i)+1, MAKE_U16( ((CONSTANT_Class_info*) info->data)->name_index ));
				break;
			}
			
			case CONSTANT_Fieldref:
			{
				read_fieldref(f, j, info);
				 debugmsg("#%d Fieldref #%d.#%d\n", (*i)+1,
				MAKE_U16( ((CONSTANT_Fieldref_info*)info->data)->class_index  ),
				MAKE_U16( ((CONSTANT_Fieldref_info*)info->data)->name_and_type_index ));
				break;
			}
			case CONSTANT_Methodref:
			{
				read_methodref(f, j, info);
				 debugmsg("#%d Methodref #%d.#%d\n", (*i)+1,
				MAKE_U16( ((CONSTANT_Methodref_info*)info->data)->class_index ),
				MAKE_U16( ((CONSTANT_Methodref_info*)info->data)->name_and_type_index ));
				break;
			}
			case CONSTANT_InterfaceMethodref:
			{
				read_interfacemethodref(f, j, info);
				 debugmsg("#%d InterfaceMethodref #%d.#%d\n", (*i)+1,
				MAKE_U16( ((CONSTANT_InterfaceMethodref_info*)info->data)->class_index  ),
				MAKE_U16( ((CONSTANT_InterfaceMethodref_info*)info->data)->name_and_type_index  ));
				break;
			}
			case CONSTANT_String:
			{
				read_string(f, j, info);
				debugmsg("#%d String #%d\n", (*i)+1, MAKE_U16( ((CONSTANT_String_info*)info->data)->string_index));
				break;
			}
			case CONSTANT_Integer:
			{
				read_integer(f, j, info);
				
				MAKE_S32(raw, ((CONSTANT_Integer_info*)info->data)->bytes);
				integer = (s32int*) raw;
				debugmsg("#%d Integer %d\n", (*i) + 1, *integer);
				break;
			}
			case CONSTANT_Float:
			{	
				read_float(f, j, info);
				COPY_FLOAT(raw, ((CONSTANT_Float_info*)info->data)->bytes);
				debugmsg("#%d Float %f\n", (*i)+1, *((float32*) raw));
				break;
			}
			case CONSTANT_Long:
			{
				read_long(f, j, info);
				MAKE_S64(raw2, ((CONSTANT_Long_info*)info->data)->high_bytes );
				debugmsg("#%d Long %ld\n", (*i)+1,  *( (s64int*) raw2));
                    cpinfo[(*i)++] = NULL;
				break;
			}
			case CONSTANT_Double:
			{
				read_double(f, j, info);
				COPY_DOUBLE(raw2, ((CONSTANT_Double_info*) info->data)->high_bytes);
				debugmsg("#%d Double %f\n", (*i)+1, *( (float64*) raw2));
				cpinfo[(*i)++] = NULL;
				break;
			}
			case CONSTANT_NameAndType:
			{
				read_nameandtype(f, j, info);
				debugmsg("#%d NameAndType #%d.#%d\n", (*i)+1, MAKE_U16( ((CONSTANT_NameAndType_info*) info->data)->name_index) , MAKE_U16(((CONSTANT_NameAndType_info*) info->data)->descriptor_index ) );
				break;
			}
			case CONSTANT_Utf8:
			{
				read_utf8(f, j, info);
                    debugmsg("#%d Utf8 %s\n", (*i)+1, utf8_to_cstring(((CONSTANT_Utf8_info*) info->data)->bytes));
				break;
			}
               case CONSTANT_MethodHandle:
               {
                    read_methodhandle(f, j, info);
                    debugmsg("#%d MethodHandle Kind:%d #%d\n", *(i)+1, ((CONSTANT_MethodHandle_info*) info->data)->reference_kind, MAKE_U16(((CONSTANT_MethodHandle_info*) info->data)->reference_index));
                    break;
               }
               
               case CONSTANT_MethodType:
               {
                    read_methodtype(f, j, info);
                    debugmsg("#%d MethodType #%d\n", *(i)+1, MAKE_U16(((CONSTANT_MethodType_info*) info->data)->descriptor_index));
                    break;
               }
               
               case CONSTANT_InvokeDynamic:
               {
                    read_invokedynamic(f,j,info);
                    debugmsg("#%d InvokeDynamic #%d.#%d\n", *(i)+1, MAKE_U16(((CONSTANT_InvokeDynamic_info*) info->data)->bootstrap_method_attr_index),
                              MAKE_U16(((CONSTANT_InvokeDynamic_info*) info->data)->name_and_type_index));
                    break;
               }
               
			default: {
				debugerr("Unrecognized tag: %02X!\n", info->tag);
				free(info);
				return 0;
					}
		}
          cpinfo[(*i)] = info;       
	}
     
	 debugmsg("Done reading Constant Pool\n");
      

	free(j);
	free(raw);
	free(raw2);
     
     
	return 1;
}