void _mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPixelTexGenParameterivSGIS"); if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { *value = (GLint) ctx->Pixel.FragmentRgbSource; } else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { *value = (GLint) ctx->Pixel.FragmentAlphaSource; } else { gl_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)"); } }
EXPORT int init_stub_bidder(OBJECT *obj, OBJECT *parent) { try { if (obj!=NULL){ return OBJECTDATA(obj,stub_bidder)->init(parent); } } catch (const char *msg) { char name[64]; gl_error("init_stub_bidder(obj=%s): %s", gl_name(obj,name,sizeof(name)), msg); return 0; } return 1; }
EXPORT int init_thermal_storage(OBJECT *obj) { thermal_storage *my = OBJECTDATA(obj,thermal_storage); try { return my->init(obj->parent); } catch (char *msg) { gl_error("%s::%s.init(OBJECT *obj={name='%s', id=%d}): %s", obj->oclass->module->name, obj->oclass->name, obj->name, obj->id, msg); /* TROUBLESHOOT The initialization operation of the specified object failed. The message given provide additional details and can be looked up under the Exceptions section. */ return 0; } }
/* * NOTE: this function can't be put in a display list. */ void _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSelectBuffer"); if (ctx->RenderMode==GL_SELECT) { gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); } ctx->Select.Buffer = buffer; ctx->Select.BufferSize = size; ctx->Select.BufferCount = 0; ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; }
/** @return 0 on failure, 1 on success **/ int group_recorder::write_header(){ // size_t name_size; time_t now = time(NULL); quickobjlist *qol = 0; OBJECT *obj=OBJECTHDR(this); if(TS_OPEN != tape_status){ // could be ERROR or CLOSED return 0; } if(0 == rec_file){ gl_error("group_recorder::write_header(): the output file was not opened"); /* TROUBLESHOOT group_recorder claimed to be open and attempted to write to a file when a file had not successfully opened. */ tape_status = TS_ERROR; return 0; // serious problem } // write model file name if(0 > fprintf(rec_file,"# file...... %s\n", filename)){ return 0; } if(0 > fprintf(rec_file,"# date...... %s", asctime(localtime(&now)))){ return 0; } #ifdef WIN32 if(0 > fprintf(rec_file,"# user...... %s\n", getenv("USERNAME"))){ return 0; } if(0 > fprintf(rec_file,"# host...... %s\n", getenv("MACHINENAME"))){ return 0; } #else if(0 > fprintf(rec_file,"# user...... %s\n", getenv("USER"))){ return 0; } if(0 > fprintf(rec_file,"# host...... %s\n", getenv("HOST"))){ return 0; } #endif if(0 > fprintf(rec_file,"# group..... %s\n", group_def)){ return 0; } if(0 > fprintf(rec_file,"# property.. %s\n", property_name)){ return 0; } if(0 > fprintf(rec_file,"# limit..... %d\n", limit)){ return 0; } if(0 > fprintf(rec_file,"# interval.. %d\n", write_interval)){ return 0; } // write list of properties if(0 > fprintf(rec_file, "# timestamp")){ return 0; } for(qol = obj_list; qol != 0; qol = qol->next){ if(0 != qol->obj->name){ if(0 > fprintf(rec_file, ",%s", qol->obj->name)){ return 0; } } else { if(0 > fprintf(rec_file, ",%s:%i", qol->obj->oclass->name, qol->obj->id)){ return 0; } } } if(0 > fprintf(rec_file, "\n")){ return 0; } return 1; }
void database::term(void) { if ( strcmp(get_on_term(),"")!=0 ) { gl_verbose("%s running on_term script '%s'", get_name(), get_on_term()); try { int res = run_script(get_on_term()); if ( res<=0 ) exception("on_term script '%s' failed at line %d: %s", get_on_term(), -res, get_last_error()); } catch (const char *msg) { gl_error("%s", msg); } mysql_close(mysql); } }
void GLAPIENTRY imm_MatrixMode (GLenum mode) { if (mode == GL_MODELVIEW) { ctx_mx_top = &ctx_mx_modelview_top; } else if (mode == GL_PROJECTION) { ctx_mx_top = &ctx_mx_projection_top; } else if (mode == GL_TEXTURE) { ctx_mx_top = &ctx_mx_texture_top[ctx_active_tex - ctx_texture]; } else if (mode == GL_COLOR) { ctx_mx_top = &ctx_mx_color_top; } else { gl_error(NULL, GL_INVALID_VALUE, "invalid matrix mode\n"); return; } ctx_mx_mode = mode; }
static GLenum tex_base_format (GLenum internalFormat) { switch (internalFormat) { case 1: case GL_LUMINANCE: case GL_LUMINANCE8: return GL_LUMINANCE; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE8_ALPHA8: return GL_LUMINANCE_ALPHA; case 3: case GL_RGB: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: return GL_RGB; case 4: case GL_RGBA: case GL_RGBA4: case GL_RGBA8: case GL_COMPRESSED_RGBA_FXT1_3DFX: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: return GL_RGBA; case GL_ALPHA: case GL_ALPHA8: return GL_ALPHA; case GL_INTENSITY: case GL_INTENSITY8: return GL_INTENSITY; case GL_RGB5_A1: return GL_RGBA; default: gl_error(NULL, GL_INVALID_ENUM, "%s: bad internal format %x\n", __FUNCTION__, internalFormat); return GL_NONE; } }
static TEX_OBJ * tex_get_current_object (GLenum target) { switch (target) { case GL_TEXTURE_1D: return ctx_active_tex->obj1d; case GL_TEXTURE_2D: return ctx_active_tex->obj2d; case GL_PROXY_TEXTURE_1D: return ctx_proxy1d_obj; case GL_PROXY_TEXTURE_2D: return ctx_proxy2d_obj; default: gl_error(NULL, GL_INVALID_VALUE, "3d / cubemap / nv NYI\n"); return NULL; } }
int network::attach(network_interface *nif){ if(nif == 0){ gl_error("network::attach(): null network_interface parameter"); return 0; } if(first_if == 0){ first_if = nif; last_if = nif; nif->next = 0; } else { last_if->next = nif; last_if = nif; nif->next = 0; } return 1; }
EXPORT int64 plc_java(OBJECT *obj, TIMESTAMP t0) { JNIEnv *jnienv = (JNIEnv *)getvar("jnienv", NULL, NULL); jclass cls = jnienv->FindClass(obj->oclass->name); if(cls == NULL) { gl_error("plc_java: unable to find %s.class", obj->oclass->name); return 0; } jmethodID cfunc = jnienv->GetStaticMethodID(cls, "plc", "(JJ)J"); if(cfunc == NULL) { // reasonable omission //gl_error("plc_java: unable to find long %s.plc(long, long)", obj->oclass->name); obj->oclass->plc = NULL; return 0; } int64 rv = jnienv->CallStaticLongMethod(cls, cfunc, (int64)obj, t0); return rv; }
EXPORT int recalc_java(OBJECT *obj) { JNIEnv *jnienv = (JNIEnv *)getvar("jnienv", NULL, NULL); jclass cls = jnienv->FindClass(obj->oclass->name); if(cls == NULL) { gl_error("recalc_java: unable to find %s.class", obj->oclass->name); return 0; } jmethodID cfunc = jnienv->GetStaticMethodID(cls, "recalc", "(J)V"); if(cfunc == NULL) { // reasonable omission //gl_error("recalc_java: unable to find void %s.recalc(long)", obj->oclass->name); obj->oclass->recalc = NULL; return 0; } int64 rv = jnienv->CallStaticLongMethod(cls, cfunc, (int64)obj); return 0; }
void gl_alloc_accum_buffer( GLcontext *ctx ) { GLint n; if (ctx->Buffer->Accum) { free( ctx->Buffer->Accum ); ctx->Buffer->Accum = NULL; } /* allocate accumulation buffer if not already present */ n = ctx->Buffer->Width * ctx->Buffer->Height * 4 * sizeof(GLaccum); ctx->Buffer->Accum = (GLaccum *) malloc( n ); if (!ctx->Buffer->Accum) { /* unable to setup accumulation buffer */ gl_error( ctx, GL_OUT_OF_MEMORY, "glAccum" ); } }
XCamReturn GLBuffer::bind_buffer_range (uint32_t index, uint32_t offset, uint32_t size) { XCamReturn ret = bind (); XCAM_FAIL_RETURN ( ERROR, xcam_ret_is_ok (ret), ret, "GL bind buffer failed, buf_id:%d", _buf_id); glBindBufferRange (_target, index, _buf_id, offset, size); GLenum error = gl_error (); XCAM_FAIL_RETURN ( ERROR, error == GL_NO_ERROR, XCAM_RETURN_ERROR_GLES, "GL bind buffer range failed. buf_id:%d failed, idx:%d, error flag: %s", _buf_id, index, gl_error_string (error)); return XCAM_RETURN_NO_ERROR; }
void _mesa_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); if (width<=0.0) { gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); return; } ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineWidth"); if (ctx->Line.Width != width) { ctx->Line.Width = width; ctx->TriangleCaps &= ~DD_LINE_WIDTH; if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH; ctx->NewState |= NEW_RASTER_OPS; } }
/** * REQUIRED: allocate and initialize an object. * * @param obj a pointer to a pointer of the last object in the list * @param parent a pointer to the parent of this object * @return 1 for a successfully created object, 0 for error */ EXPORT int create_triplex_node(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(triplex_node::oclass); if (*obj!=NULL) { triplex_node *my = OBJECTDATA(*obj,triplex_node); gl_set_parent(*obj,parent); return my->create(); } } catch (const char *msg) { gl_error("create_triplex_node: %s", msg); } return 0; }
/* * Allocate a new stencil buffer. If there's an old one it will be * deallocated first. The new stencil buffer will be uninitialized. */ void gl_alloc_stencil_buffer( GLcontext *ctx ) { GLuint buffersize = ctx->Buffer->Width * ctx->Buffer->Height; /* deallocate current stencil buffer if present */ if (ctx->Buffer->Stencil) { FREE(ctx->Buffer->Stencil); ctx->Buffer->Stencil = NULL; } /* allocate new stencil buffer */ ctx->Buffer->Stencil = (GLstencil *) MALLOC(buffersize * sizeof(GLstencil)); if (!ctx->Buffer->Stencil) { /* out of memory */ _mesa_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE ); gl_error( ctx, GL_OUT_OF_MEMORY, "gl_alloc_stencil_buffer" ); } }
/** * REQUIRED: allocate and initialize an object. * * @param obj a pointer to a pointer of the last object in the list * @param parent a pointer to the parent of this object * @return 1 for a successfully created object, 0 for error */ EXPORT int create_billdump(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(billdump::oclass); if (*obj!=NULL) { billdump *my = OBJECTDATA(*obj,billdump); gl_set_parent(*obj,parent); return my->create(); } } catch (const char *msg) { gl_error("create_billdump: %s", msg); } return 0; }
/** * REQUIRED: allocate and initialize an object. * * @param obj a pointer to a pointer of the last object in the list * @param parent a pointer to the parent of this object * @return 1 for a successfully created object, 0 for error */ EXPORT int create_powerflow_object(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(powerflow_object::oclass); if (*obj!=NULL) { powerflow_object *my = OBJECTDATA(*obj,powerflow_object); gl_set_parent(*obj,parent); return my->create(); } } catch (const char *msg) { gl_error("create_powerflow_object: %s", msg); } return 0; }
/* * Allocate a new depth buffer. If there's already a depth buffer allocated * it will be free()'d. The new depth buffer will be uniniitalized. * This function is only called through Driver.alloc_depth_buffer. */ void gl_alloc_depth_buffer( GLcontext* ctx ) { /* deallocate current depth buffer if present */ if (ctx->Buffer->Depth) { free(ctx->Buffer->Depth); ctx->Buffer->Depth = NULL; } /* allocate new depth buffer, but don't initialize it */ ctx->Buffer->Depth = (GLdepth *) malloc( ctx->Buffer->Width * ctx->Buffer->Height * sizeof(GLdepth) ); if (!ctx->Buffer->Depth) { /* out of memory */ ctx->Depth.Test = GL_FALSE; gl_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer" ); } }
EXPORT int etp_set(char *param, ...) { int n=0; va_list arg; va_start(arg,param); char *tag = param; while ( tag!=NULL ) { if ( strcmp(param,"max_iterations")==0 ) default_etp_iterations = va_arg(arg,unsigned int); else { gl_error("etp_set(char *param='%s',...): tag '%s' is not recognized",param,tag); return n; } tag = va_arg(arg,char*); n++; }
void _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName"); if (ctx->RenderMode != GL_SELECT) { return; } if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth > 0) { ctx->Select.NameStackDepth--; } else { gl_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); } }
/** * REQUIRED: allocate and initialize an object. * * @param obj a pointer to a pointer of the last object in the list * @param parent a pointer to the parent of this object * @return 1 for a successfully created object, 0 for error */ EXPORT int create_recloser(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(recloser::oclass); if (*obj!=NULL) { recloser *my = OBJECTDATA(*obj,recloser); gl_set_parent(*obj,parent); return my->create(); } } catch (const char *msg) { gl_error("create_recloser: %s", msg); } return 0; }
int notify_java(OBJECT *obj, NOTIFYMODULE msg) { JNIEnv *jnienv = (JNIEnv *)getvar("jnienv", NULL, NULL); jclass cls = jnienv->FindClass(obj->oclass->name); if(cls == NULL) { gl_error("notify_java: unable to find %s.class", obj->oclass->name); return 0; } jmethodID cfunc = jnienv->GetStaticMethodID(cls, "notify", "(JLjava.lang.String;)I"); if(cfunc == NULL) { /* acceptable omission */ //gl_error("notify_java: unable to find int %s.notify(long, int)", obj->oclass->name); obj->oclass->notify = NULL; return 0; } return jnienv->CallStaticIntMethod(cls, cfunc, (int64)obj, (int)msg); }
EXPORT int create_energy_storage(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(energy_storage::oclass,sizeof(energy_storage)); if (*obj!=NULL) { energy_storage *my = OBJECTDATA(*obj,energy_storage); gl_set_parent(*obj,parent); return my->create(); } } catch (char *msg) { gl_error("create_energy_storage: %s", msg); } return 0; }
EXPORT TIMESTAMP sync_network(OBJECT *obj, TIMESTAMP t1) { network *my = OBJECTDATA(obj,network); try { TIMESTAMP t2 = my->sync(obj->clock, t1); //obj->clock = t1; // update in commit return t2; } catch (char *msg) { DATETIME dt; char ts[64]; gl_localtime(t1,&dt); gl_strtime(&dt,ts,sizeof(ts)); gl_error("%s::%s.init(OBJECT **obj={name='%s', id=%d},TIMESTAMP t1='%s'): %s", obj->oclass->module->name, obj->oclass->name, obj->name, obj->id, ts, msg); return 0; } }
EXPORT int create_multizone(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(multizone::oclass); if (*obj!=NULL) { multizone *my = OBJECTDATA(*obj,multizone); gl_set_parent(*obj,parent); return my->create(); } } catch (char *msg) { gl_error("create_multizone: %s", msg); } return 1; }
void _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName"); if (ctx->RenderMode != GL_SELECT) { return; } if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) { ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; } else { gl_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); } }
EXPORT TIMESTAMP sync_residential_enduse(OBJECT *obj, TIMESTAMP t1) { residential_enduse *my = OBJECTDATA(obj,residential_enduse); try { TIMESTAMP t2 = my->sync(obj->clock, t1); obj->clock = t1; return t2; } catch (char *msg) { DATETIME dt; char ts[64]; gl_localtime(t1,&dt); gl_strtime(&dt,ts,sizeof(ts)); gl_error("%s::%s.init(OBJECT **obj={name='%s', id=%d},TIMESTAMP t1='%s'): %s", obj->oclass->module->name, obj->oclass->name, obj->name, obj->id, ts, msg); return 0; } }
/** * REQUIRED: allocate and initialize an object. * * @param obj a pointer to a pointer of the last object in the list * @param parent a pointer to the parent of this object * @return 1 for a successfully created object, 0 for error */ EXPORT int create_histogram(OBJECT **obj, OBJECT *parent) { try { *obj = gl_create_object(histogram::oclass); if (*obj!=NULL) { histogram *my = OBJECTDATA(*obj,histogram); gl_set_parent(*obj,parent); return my->create(); } } catch (char *msg) { gl_error("create_histogram: %s", msg); } return 0; }