gboolean newmail_hook (gpointer source, gpointer data) { auto MsgInfo *msginfo = (MsgInfo *)source; auto FolderItem *tof; if (!msginfo) return FALSE; if (!NewLog) return FALSE; tof = msginfo->folder; (void)fprintf (NewLog, "---\n" "Date:\t%s\n" "Subject:\t%s\n" "From:\t%s\n" "To:\t%s\n" "Cc:\t%s\n" "Size:\t%jd\n" "Path:\t%s\n" "Message:\t%d\n" "Folder:\t%s\n", defstr (msginfo->date), defstr (msginfo->subject), defstr (msginfo->from), defstr (msginfo->to), defstr (msginfo->cc), (intmax_t) msginfo->size, defstr (procmsg_get_message_file_path (msginfo)), msginfo->msgnum, tof ? defstr (tof->name) : "(null)"); return (FALSE); } /* newmail_hook */
/** * Concatenates all componets into batch->vSource/gSource/fSource. */ bool SoXipGLSLPrograms::updateSingleShader(ShaderBatch * batch, const SbString& filename, const SbString& defines, std::string& errstr) { if (!batch) return false; std::string funcs = ""; int shaderType = batch->source.getType(); // Add the version string to the source file std::string s; switch(glslVersion.getValue()) { default: case AUTO_SELECT: break; case V110: s += "#version 110 \n\n"; break; case V120: s += "#version 120 \n\n"; break; case V130: s += "#version 130 \n\n"; break; case V140: s += "#version 140 \n\n"; break; case V150: s += "#version 150 \n\n"; break; } batch->source.addToSuppHeader(s.c_str()); std::string defstr(defines.getString()); std::string tmp, defVal; int p0 = 0; int p1 = 0; int d = defstr.find_first_not_of(","); while (d != defstr.npos) { p1 = defstr.find_first_of(",", p0); defVal = defstr.substr(p0,p1-p0); if (!defVal.empty() && defVal.find_first_not_of(" ") != defVal.npos) { tmp = std::string("#define ") + defVal; batch->source.addToSuppHeader(tmp.c_str()); } p0 = p1+1; d = p1; } batch->source.addToSuppHeader(ShaderEngine::readShaderSourceFile(filename.getString()).c_str()); batch->handle = ShaderEngine::compileShader(batch->source.getFullComponent(), shaderType, errstr); //batch->timestamp = (batch->handle) ? time(NULL) : 0; #ifdef WIN32 batch->timestamp = (batch->handle) ? QueryPerformanceCounter((LARGE_INTEGER*)&batch->timestamp) : 0; #else //UNIX if (!(batch->handle)) { batch->timestamp = 0; } else { struct timeval curTime; gettimeofday(&curTime, NULL); //batch->timestamp = ((int64_t)curTime.tv_sec * (1000*1000) + (int64_t)curTime.tv_usec); batch->timestamp = (int64_t)curTime.tv_sec; } #endif //WIN32 if (!errstr.empty()) return false; return true; }