// Constructor with fileName GLC_Texture::GLC_Texture(const QString &Filename) : m_pQGLContext(NULL) , m_FileName(Filename) , m_GlTextureID(0) , m_textureImage(loadFromFile(m_FileName)) , m_TextureSize() , m_HasAlphaChannel(m_textureImage.hasAlphaChannel()) { if (m_textureImage.isNull()) { QString ErrorMess("GLC_Texture::GLC_Texture open image : "); ErrorMess.append(m_FileName).append(" Failed"); qDebug() << ErrorMess; GLC_Exception e(ErrorMess); throw(e); } }
// Constructor with QFile GLC_Texture::GLC_Texture(const QFile &file) : m_pQGLContext(NULL) , m_FileName(file.fileName()) , m_GlTextureID(0) , m_textureImage() , m_TextureSize() , m_HasAlphaChannel(m_textureImage.hasAlphaChannel()) { m_textureImage.load(const_cast<QFile*>(&file), QFileInfo(m_FileName).suffix().toLocal8Bit()); if (m_textureImage.isNull()) { QString ErrorMess("GLC_Texture::GLC_Texture open image : "); ErrorMess.append(m_FileName).append(" Failed"); qDebug() << ErrorMess; GLC_Exception e(ErrorMess); throw(e); } }
GLC_Texture::GLC_Texture(const GLC_Texture &TextureToCopy) : m_pQGLContext(TextureToCopy.m_pQGLContext) , m_FileName(TextureToCopy.m_FileName) , m_GlTextureID(TextureToCopy.m_GlTextureID) , m_textureImage(TextureToCopy.m_textureImage) , m_TextureSize(TextureToCopy.m_TextureSize) , m_HasAlphaChannel(m_textureImage.hasAlphaChannel()) { if (m_textureImage.isNull()) { QString ErrorMess("GLC_Texture::GLC_Texture open image : "); ErrorMess.append(m_FileName).append(" Failed"); qDebug() << ErrorMess; GLC_Exception e(ErrorMess); throw(e); } addThisOpenGLTextureId(); }
main(void) { char sbuf[128]; char rbuf[128]; /* mySFGetFile(sbuf); printf("sbuf [%s]\n", sbuf ); */ ErrorMess("num is %d for %s", 1, "fred"); /* index_list(WORDLIST,":le:",5);*/ /* index_list(STEMLIST,"",1);*/ /* while(gets(sbuf)) { beta2smk(sbuf,rbuf); printf("rbuf:%s\n", rbuf ); } */ }
static do_index(char *file, int indfreq) { FILE * foutput; /* char curkey[BIGSTRING]; char prevkey[BIGSTRING]; char curtag[BIGSTRING]; char prevtag[BIGSTRING]; */ char *curkey; char *prevkey; char *curtag; char *prevtag; long i; char ** table; curkey = malloc(BIGSTRING); prevkey = malloc(BIGSTRING); curtag = malloc(BIGSTRING); prevtag = malloc(BIGSTRING); table = stems; qsort(table,(size_t)stemcount,sizeof * table, zstrcmp ); /* lqsort((char **)table,stemcount,(int) sizeof * table, xstrcmp ); */ fprintf(stderr,"out of qsort\n"); if(! (foutput=MorphFopen(file,"w"))) { char tmp[256]; sprintf(tmp,"Could not open %s!", file ); ErrorMess(tmp); return(-1); } prevtag[0] = 0; for(i=0;i<stemcount;i++) { if( ! (i % 5000 ) ) printf("processing %ld: %s\n", i , *(table+i) ); nextkey(*(table+i),curtag); /* * if a new keys */ if( morphstrcmp(curtag,prevtag) ) { if( prevtag[0] ) fprintf(foutput,"\n"); fprintf(foutput,"%s%s%s", curtag, DELIMITER, *(table+i) ); } else if ( strcmp(prevkey,*(table+i) ) ) /* * don't include lines such as "uiais perf_act perf_act" * where the same key is repeated */ fprintf(foutput,"%s%s", DELIMITER, *(table+i) ); strcpy(prevtag,curtag); strcpy(prevkey,*(table+i)); } fprintf(stderr,"done with i=%ld, %ld\n", i , stemcount-i); fclose(foutput); fprintf(stderr,"about to index [%s]\n", file); /* free(bufptr); */ index_list(file,"",indfreq); fprintf(stderr,"have just indexed [%s]\n", file); /* for(i=0;i<stemcount;i++) free(*(table+i)); */ free(table); }
//---------------------------------------------------------------------------------------------------------- // essaye de passer en resolution x:y avec le + de couleur possible bool ChangeScreenResolution(U32 X, U32 Y, U32 bitperpixel) { #if 0 bool ret = TRUE; DEVMODE mode; U32 result; //Result of ChangeDisplaySettings U32 num_mode; memset(&mode, 0, sizeof(PDEVMODE)); num_mode = 0; //------------------------- Essaye de passer en 32 bit if ((bitperpixel==0) || (bitperpixel==32)) { while (ret == TRUE) { ret = EnumDisplaySettings(NULL, // use default device num_mode, // DEVMODEs start at 0 &mode); // if successful the system fills in the DEVMODE structure num_mode++; if (mode.dmBitsPerPel == 32 && mode.dmPelsWidth == X && mode.dmPelsHeight == Y) { result = ChangeDisplaySettings(&mode, CDS_FULLSCREEN); // YEAHHHHHHHHHH!!!!!!!!!!!!!!!!!!! if (result != DISP_CHANGE_SUCCESSFUL) { ErrorMess("It's Impossible To change de resolution du con.\n"); return FALSE; } return TRUE; } } } //------------------------- sinon essaye de passer en 24 bit ret = TRUE; num_mode = 0; if ((bitperpixel==0) || (bitperpixel==24)) { while (ret == TRUE) { ret = EnumDisplaySettings(NULL, // use default device num_mode, // DEVMODEs start at 0 &mode); // if successful the system fills in the DEVMODE structure num_mode++; if (mode.dmBitsPerPel == 24 && mode.dmPelsWidth == X && mode.dmPelsHeight == Y) { result = ChangeDisplaySettings(&mode, CDS_FULLSCREEN); // YEAHHHHHHHHHH!!!!!!!!!!!!!!!!!!! if (result != DISP_CHANGE_SUCCESSFUL) { ErrorMess("It's Impossible To change de resolution du con.\n"); return FALSE; } return TRUE; } } } //------------------------- Essaye de passer en 16 bit ret = TRUE; num_mode = 0; if ((bitperpixel==0) || (bitperpixel==16)) { while (ret == TRUE) { ret = EnumDisplaySettings(NULL, // use default device num_mode, // DEVMODEs start at 0 &mode); // if successful the system fills in the DEVMODE structure num_mode++; if (mode.dmBitsPerPel == 16 && mode.dmPelsWidth == X && mode.dmPelsHeight == Y) { result = ChangeDisplaySettings(&mode, CDS_FULLSCREEN); // YEAHHHHHHHHHH!!!!!!!!!!!!!!!!!!! if (result != DISP_CHANGE_SUCCESSFUL) { ErrorMess("It's Impossible To change de resolution du con.\n"); return FALSE; } return TRUE; } } } ErrorMess("Haaaaaaaaaa True Color Mode not Found\n"); return FALSE; #endif }