static void showglslinfo(GLenum type, GLuint obj, const char *name, const char **parts = NULL, int numparts = 0) { GLint length = 0; if(type) glGetShaderiv_(obj, GL_INFO_LOG_LENGTH, &length); else glGetProgramiv_(obj, GL_INFO_LOG_LENGTH, &length); if(length > 1) { conoutf(CON_ERROR, "GLSL ERROR (%s:%s)", type == GL_VERTEX_SHADER ? "VS" : (type == GL_FRAGMENT_SHADER ? "FS" : "PROG"), name); FILE *l = getlogfile(); if(l) { GLchar *log = new GLchar[length]; if(type) glGetShaderInfoLog_(obj, length, &length, log); else glGetProgramInfoLog_(obj, length, &length, log); fprintf(l, "%s\n", log); bool partlines = log[0] != '0'; int line = 0; loopi(numparts) { const char *part = parts[i]; int startline = line; while(*part) { const char *next = strchr(part, '\n'); if(++line > 1000) goto done; if(partlines) fprintf(l, "%d(%d): ", i, line - startline); else fprintf(l, "%d: ", line); fwrite(part, 1, next ? next - part + 1 : strlen(part), l); if(!next) { fputc('\n', l); break; } part = next + 1; } } done: delete[] log; } }
void setlogfile(const char *fname) { closelogfile(); if(fname && fname[0]) { fname = findfile(fname, "w"); if(fname) logfile = fopen(fname, "w"); } FILE *f = getlogfile(); if(f) setvbuf(f, NULL, _IOLBF, BUFSIZ); }
/*! Creates a directory if the specified one does not yet exist. /param A character string representing the to-be-created directory. /return True, if the directory already existed, or was successfully created. False, if the input path was already a file, not a directory, or if the directory was unable to be created. /todo Do domething with error status if the directory couldn't be created? */ static bool s_createDirectoryIfNecessary(const char * szDir) { struct stat statbuf; if (stat(szDir,&statbuf) == 0) // if it exists { if (S_ISDIR(statbuf.st_mode)) // and is a directory return true; UT_DEBUGMSG(("Pathname [%s] is not a directory.\n",szDir)); return false; } #ifdef LOGFILE fprintf(getlogfile(),"New Directory created \n"); #endif if (mkdir(szDir,0700) == 0) return true; UT_DEBUGMSG(("Could not create Directory [%s].\n",szDir)); return false; }
gtk_adjustment_get_page_size(pFrameImpl->m_pVadj))); } } AP_UnixFrame::AP_UnixFrame() #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON : AP_Frame(new AP_UnixHildonFrameImpl(this)) #else : AP_Frame(new AP_UnixFrameImpl(this)) #endif { m_pData = NULL; setFrameLocked(false); #ifdef LOGFILE fprintf(getlogfile(),"New unix frame with app \n"); fprintf(getlogfile(),"Number of frames in app %d \n",pApp->getFrameCount()); #endif } AP_UnixFrame::AP_UnixFrame(AP_UnixFrame * f) : AP_Frame(static_cast<AP_Frame *>(f)) { m_pData = NULL; #ifdef LOGFILE fprintf(getlogfile(),"New unix frame with frame \n"); #endif } AP_UnixFrame::~AP_UnixFrame() {