本文整理汇总了C++中plogf函数的典型用法代码示例。如果您正苦于以下问题:C++ plogf函数的具体用法?C++ plogf怎么用?C++ plogf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plogf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: NPP_New
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
{
plogf("sp: NPP_New() mode=%d ", mode);
if (!instance)
{
plogf("sp: error: NPERR_INVALID_INSTANCE_ERROR");
return NPERR_INVALID_INSTANCE_ERROR;
}
if (pluginType)
plogf("sp: pluginType: %s ", pluginType);
if (saved)
plogf("sp: SavedData: len=%d", saved->len);
instance->pdata = AllocStruct<InstanceData>();
if (!instance->pdata)
{
plogf("sp: error: NPERR_OUT_OF_MEMORY_ERROR");
return NPERR_OUT_OF_MEMORY_ERROR;
}
gNPNFuncs.setvalue(instance, NPPVpluginWindowBool, (void *)true);
InstanceData *data = (InstanceData *)instance->pdata;
bool ok = GetExePath(data->exepath, dimof(data->exepath));
SelectTranslation(ok ? data->exepath : NULL);
if (ok)
data->message = _TR("Opening document in SumatraPDF...");
else
data->message = _TR("Error: SumatraPDF hasn't been found!");
return NPERR_NO_ERROR;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:34,代码来源:npPdfViewer.cpp
示例2: NPP_Write
int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
{
InstanceData *data = (InstanceData *)instance->pdata;
DWORD bytesWritten = len;
plogf("sp: NPP_Write() off=%d, len=%d", offset, len);
if (data->hFile)
{
// Note: we optimistically assume that data comes in sequentially
// (i.e. next offset will be current offset + bytesWritten)
BOOL ok = WriteFile(data->hFile, buffer, (DWORD)len, &bytesWritten, NULL);
if (!ok)
{
plogf("sp: NPP_Write() failed to write %d bytes at offset %d", len, offset);
return -1;
}
}
data->currSize = offset + bytesWritten;
data->progress = stream->end > 0 ? 1.0f * (offset + len) / stream->end : 0;
TriggerRepaintOnProgressChange(data);
return bytesWritten;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:25,代码来源:npPdfViewer.cpp
示例3: NPP_NewStream
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
{
InstanceData *data = (InstanceData *)instance->pdata;
if (!*data->exepath)
{
plogf("sp: NPP_NewStream() error: NPERR_FILE_NOT_FOUND");
return NPERR_FILE_NOT_FOUND;
}
plogf("sp: NPP_NewStream() end=%d", stream->end);
// if we can create a temporary file ourselfes, we manage the download
// process. The reason for that is that NP_ASFILE (where browser manages
// file downloading) is not reliable and has been broken in almost every
// browser at some point
*stype = NP_ASFILE;
data->hFile = CreateTempFile(data->filepath, dimof(data->filepath));
if (data->hFile)
{
plogf("sp: using temporary file: %S", data->filepath);
*stype = NP_NORMAL;
}
data->totalSize = stream->end;
data->currSize = 0;
data->progress = stream->end > 0 ? 0.01f : 0;
data->prevProgress = -.1f;
TriggerRepaintOnProgressChange(data);
return NPERR_NO_ERROR;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:33,代码来源:npPdfViewer.cpp
示例4: LaunchWithSumatra
void LaunchWithSumatra(InstanceData *data, const char *url_utf8)
{
if (!file::Exists(data->filepath))
plogf("sp: NPP_StreamAsFile() error: file doesn't exist");
ScopedMem<WCHAR> url(str::conv::FromUtf8(url_utf8));
// escape quotation marks and backslashes for CmdLineParser.cpp's ParseQuoted
if (str::FindChar(url, '"')) {
WStrVec parts;
parts.Split(url, L"\"");
url.Set(parts.Join(L"%22"));
}
if (str::EndsWith(url, L"\\")) {
url[str::Len(url) - 1] = '\0';
url.Set(str::Join(url, L"%5c"));
}
// prevent overlong URLs from making LaunchProcess fail
if (str::Len(url) > 4096)
url.Set(NULL);
ScopedMem<WCHAR> cmdLine(str::Format(L"\"%s\" -plugin \"%s\" %d \"%s\"",
data->exepath, url ? url : L"", (HWND)data->npwin->window, data->filepath));
data->hProcess = LaunchProcess(cmdLine);
if (!data->hProcess)
{
plogf("sp: NPP_StreamAsFile() error: couldn't run SumatraPDF!");
data->message = _TR("Error: Couldn't run SumatraPDF!");
}
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:29,代码来源:npPdfViewer.cpp
示例5: NPP_StreamAsFile
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
{
InstanceData *data = (InstanceData *)instance->pdata;
if (!fname)
{
plogf("sp: NPP_StreamAsFile() error: fname is NULL");
data->message = _TR("Error: The document couldn't be downloaded!");
goto Exit;
}
plogf("sp: NPP_StreamAsFile() fname=%s", fname);
if (data->hFile)
plogf("sp: NPP_StreamAsFile() error: data->hFile is != NULL (should be NULL)");
data->progress = 1.0f;
data->prevProgress = 0.0f; // force update
TriggerRepaintOnProgressChange(data);
if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, data->filepath, MAX_PATH))
MultiByteToWideChar(CP_ACP, 0, fname, -1, data->filepath, MAX_PATH);
LaunchWithSumatra(data, stream->url);
Exit:
if (data->npwin)
{
InvalidateRect((HWND)data->npwin->window, NULL, FALSE);
UpdateWindow((HWND)data->npwin->window);
}
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:32,代码来源:npPdfViewer.cpp
示例6: NPP_Print
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint)
{
if (!platformPrint)
{
plogf("sp: NPP_Print(), platformPrint is NULL");
return;
}
if (NP_FULL != platformPrint->mode)
{
plogf("sp: NPP_Print(), platformPrint->mode is %d (!= NP_FULL)", platformPrint->mode);
}
else
{
InstanceData *data = (InstanceData *)instance->pdata;
HWND hWnd = (HWND)data->npwin->window;
HWND hChild = FindWindowEx(hWnd, NULL, NULL, NULL);
if (hChild)
{
PostMessage(hChild, WM_COMMAND, IDM_PRINT, 0);
platformPrint->print.fullPrint.pluginPrinted = true;
}
}
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:25,代码来源:npPdfViewer.cpp
示例7: NPP_New
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
{
InstanceData *data;
plogf("sp: NPP_New() mode=%d ", mode);
if (!instance)
{
plogf("error: NPERR_INVALID_INSTANCE_ERROR");
return NPERR_INVALID_INSTANCE_ERROR;
}
if (pluginType)
plogf("sp: pluginType: %s ", ScopedMem<TCHAR>(str::conv::FromAnsi(pluginType)));
if (saved)
plogf("sp: SavedData: len=%d", saved->len);
instance->pdata = calloc(1, sizeof(InstanceData));
if (!instance->pdata)
{
plogf("error: NPERR_OUT_OF_MEMORY_ERROR");
return NPERR_OUT_OF_MEMORY_ERROR;
}
data = (InstanceData *)instance->pdata;
gNPNFuncs.setvalue(instance, NPPVpluginWindowBool, (void *)true);
if (GetExePath(data->exepath, dimof(data->exepath)))
data->message = _T("Opening document in SumatraPDF...");
else
data->message = _T("Error: SumatraPDF hasn't been found!");
return NPERR_NO_ERROR;
}
开发者ID:monolithpl,项目名称:sumatrapdf,代码行数:34,代码来源:npPdfViewer.cpp
示例8: plogf
void VCS_SOLVE::vcs_TCounters_report(int timing_print_lvl)
/**************************************************************************
*
* vcs_TCounters_report:
*
* Print out the total Its and time counters to standard output
***************************************************************************/
{
plogf("\nTCounters: Num_Calls Total_Its Total_Time (seconds)\n");
if (timing_print_lvl > 0) {
plogf(" vcs_basopt: %5d %5d %11.5E\n",
m_VCount->T_Basis_Opts, m_VCount->T_Basis_Opts,
m_VCount->T_Time_basopt);
plogf(" vcs_TP: %5d %5d %11.5E\n",
m_VCount->T_Calls_vcs_TP, m_VCount->T_Its,
m_VCount->T_Time_vcs_TP);
plogf(" vcs_inest: %5d %11.5E\n",
m_VCount->T_Calls_Inest, m_VCount->T_Time_inest);
plogf(" vcs_TotalTime: %11.5E\n",
m_VCount->T_Time_vcs);
} else {
plogf(" vcs_basopt: %5d %5d %11s\n",
m_VCount->T_Basis_Opts, m_VCount->T_Basis_Opts," NA ");
plogf(" vcs_TP: %5d %5d %11s\n",
m_VCount->T_Calls_vcs_TP, m_VCount->T_Its," NA ");
plogf(" vcs_inest: %5d %11s\n",
m_VCount->T_Calls_Inest, " NA ");
plogf(" vcs_TotalTime: %11s\n",
" NA ");
}
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:32,代码来源:vcs_report.cpp
示例9: printProgress
static void printProgress(const vector<string> &spName,
const vector<double> &soln,
const vector<double> &ff) {
int nsp = soln.size();
double sum = 0.0;
plogf(" --- Summary of current progress:\n");
plogf(" --- Name Moles - SSGibbs \n");
plogf(" -------------------------------------------------------------------------------------\n");
for (int k = 0; k < nsp; k++) {
plogf(" --- %20s %12.4g - %12.4g\n", spName[k].c_str(), soln[k], ff[k]);
sum += soln[k] * ff[k];
}
plogf(" --- Total sum to be minimized = %g\n", sum);
}
开发者ID:calbaker,项目名称:Cantera,代码行数:14,代码来源:vcs_setMolesLinProg.cpp
示例10: NP_GetEntryPoints
DLLEXPORT NPError WINAPI NP_GetEntryPoints(NPPluginFuncs *pFuncs)
{
plogf("sp: NP_GetEntryPoints()");
if (!pFuncs || pFuncs->size < sizeof(NPPluginFuncs))
return NPERR_INVALID_FUNCTABLE_ERROR;
pFuncs->size = sizeof(NPPluginFuncs);
pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
pFuncs->newp = NPP_New;
pFuncs->destroy = NPP_Destroy;
pFuncs->setwindow = NPP_SetWindow;
pFuncs->newstream = NPP_NewStream;
pFuncs->destroystream = NPP_DestroyStream;
pFuncs->asfile = NPP_StreamAsFile;
pFuncs->writeready = NPP_WriteReady;
pFuncs->write = NPP_Write;
pFuncs->print = NPP_Print;
pFuncs->event = NULL;
pFuncs->urlnotify = NULL;
pFuncs->javaClass = NULL;
pFuncs->getvalue = NULL;
pFuncs->setvalue = NULL;
return NPERR_NO_ERROR;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:25,代码来源:npPdfViewer.cpp
示例11: DllMain
BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
plogf("sp: DllMain() reason: %d (%s)", dwReason, DllMainReason(dwReason));
g_hInstance = hInstance;
return TRUE;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:7,代码来源:npPdfViewer.cpp
示例12: G0_R_calc
/**************************************************************************
*
* GStar_R_calc();
*
* This function calculates the standard state Gibbs free energy
* for species, kspec, at the solution temperature TKelvin and
* solution pressure, Pres.
*
*
* Input
* kglob = species global index.
* TKelvin = Temperature in Kelvin
* pres = pressure is given in units specified by if__ variable.
*
*
* Output
* return value = standard state free energy in units of Kelvin.
*/
double VCS_SPECIES_THERMO::GStar_R_calc(size_t kglob, double TKelvin,
double pres)
{
char yo[] = "VCS_SPECIES_THERMO::GStar_R_calc ";
double fe, T;
fe = G0_R_calc(kglob, TKelvin);
T = TKelvin;
if (UseCanteraCalls) {
AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS, "Possible inconsistency");
size_t kspec = IndexSpeciesPhase;
OwningPhase->setState_TP(TKelvin, pres);
fe = OwningPhase->GStar_calc_one(kspec);
double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
fe /= R;
} else {
double pref = SS0_Pref;
switch(SSStar_Model) {
case VCS_SSSTAR_CONSTANT:
break;
case VCS_SSSTAR_IDEAL_GAS:
fe += T * log( pres/ pref );
break;
default:
plogf("%sERROR: unknown SSStar model\n", yo);
exit(EXIT_FAILURE);
}
}
return fe;
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:47,代码来源:vcs_species_thermo.cpp
示例13: switch
/**************************************************************************
*
* eval_ac:
*
* This function evaluates the activity coefficient
* for species, kspec
*
* Input
* kglob -> integer value of the species in the global
* species list within VCS_GLOB. Phase and local species id
* can be looked up within object.
*
* Note, T, P and mole fractions are obtained from the
* single private instance of VCS_GLOB
*
*
* Output
* return value = activity coefficient for species kspec
*/
double VCS_SPECIES_THERMO::eval_ac(size_t kglob)
{
#ifdef DEBUG_MODE
char yo[] = "VCS_SPECIES_THERMO::eval_ac ";
#endif
double ac;
/*
* Activity coefficients are frequently evaluated on a per phase
* basis. If they are, then the currPhAC[] boolean may be used
* to reduce repeated work. Just set currPhAC[iph], when the
* activity coefficients for all species in the phase are reevaluated.
*/
if (UseCanteraCalls) {
size_t kspec = IndexSpeciesPhase;
ac = OwningPhase->AC_calc_one(kspec);
} else {
switch (Activity_Coeff_Model) {
case VCS_AC_CONSTANT:
ac = 1.0;
break;
default:
#ifdef DEBUG_MODE
plogf("%sERROR: unknown model\n", yo);
#endif
exit(EXIT_FAILURE);
}
}
return ac;
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:48,代码来源:vcs_species_thermo.cpp
示例14: VolStar_calc
/**************************************************************************
*
* VolStar_calc:
*
* This function calculates the standard state molar volume
* for species, kspec, at the temperature TKelvin and pressure, Pres,
*
* Input
*
* Output
* return value = standard state volume in m**3 per kmol.
* (VCS_UNITS_MKS)
*/
double VCS_SPECIES_THERMO::
VolStar_calc(size_t kglob, double TKelvin, double presPA)
{
char yo[] = "VCS_SPECIES_THERMO::VStar_calc ";
double vol, T;
T = TKelvin;
if (UseCanteraCalls) {
AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS, "Possible inconsistency");
size_t kspec = IndexSpeciesPhase;
OwningPhase->setState_TP(TKelvin, presPA);
vol = OwningPhase->VolStar_calc_one(kspec);
} else {
switch(SSStar_Vol_Model) {
case VCS_SSVOL_CONSTANT:
vol = SSStar_Vol0;
break;
case VCS_SSVOL_IDEALGAS:
// R J/kmol/K (2006 CODATA value)
vol= 8314.47215 * T / presPA;
break;
default:
plogf("%sERROR: unknown SSVol model\n", yo);
exit(EXIT_FAILURE);
}
}
return vol;
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:41,代码来源:vcs_species_thermo.cpp
示例15: plogf
/*
* This routines adds entries for the formula matrix for this object
* for one species
*
* This object also fills in the index filed, IndSpecies, within
* the volPhase object.
*
* @param volPhase object containing the species
* @param k Species number within the volPhase k
* @param kT global Species number within this object
*
*/
size_t VCS_PROB::addOnePhaseSpecies(vcs_VolPhase* volPhase, size_t k, size_t kT)
{
size_t e, eVP;
if (kT > nspecies) {
/*
* Need to expand the number of species here
*/
plogf("Shouldn't be here\n");
exit(EXIT_FAILURE);
}
double const* const* const fm = volPhase->getFormulaMatrix();
for (eVP = 0; eVP < volPhase->nElemConstraints(); eVP++) {
e = volPhase->elemGlobalIndex(eVP);
#ifdef DEBUG_MODE
if (e == npos) {
exit(EXIT_FAILURE);
}
#endif
FormulaMatrix[e][kT] = fm[eVP][k];
}
/*
* Tell the phase object about the current position of the
* species within the global species vector
*/
volPhase->setSpGlobalIndexVCS(k, kT);
return kT;
}
开发者ID:anujg1991,项目名称:cantera,代码行数:39,代码来源:vcs_prob.cpp
示例16: switch
/*
* This is basically equal to RT
*
* @param mu_units integer representing the dimensional units system
* @param TKelvin double Temperature in Kelvin
*
* @return Returns the value of RT
*/
double VCS_SOLVE::vcs_nondimMult_TP(int mu_units, double TKelvin) const {
double rt;
if (TKelvin <= 0.0) TKelvin = 293.15;
switch (mu_units) {
case VCS_UNITS_KCALMOL:
rt = TKelvin * 8.314472E-3 / 4.184;
break;
case VCS_UNITS_UNITLESS:
rt = 1.0;
break;
case VCS_UNITS_KJMOL:
rt = TKelvin * 0.008314472;
break;
case VCS_UNITS_KELVIN:
rt = TKelvin;
break;
case VCS_UNITS_MKS:
rt = TKelvin * 8.314472E3;
break;
default:
plogf("vcs_nondimMult_TP error: unknown units: %d\n", mu_units);
plogendl();
exit(EXIT_FAILURE);
}
return rt;
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:34,代码来源:vcs_nondim.cpp
示例17: NP_Initialize
DLLEXPORT NPError WINAPI NP_Initialize(NPNetscapeFuncs *pFuncs)
{
plogf("sp: NP_Initialize()");
if (!pFuncs || pFuncs->size < sizeof(NPNetscapeFuncs))
{
plogf("sp: NP_Initialize() error: NPERR_INVALID_FUNCTABLE_ERROR");
return NPERR_INVALID_FUNCTABLE_ERROR;
}
if (HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
{
plogf("sp: NP_Initialize() error: NPERR_INCOMPATIBLE_VERSION_ERROR");
return NPERR_INCOMPATIBLE_VERSION_ERROR;
}
gNPNFuncs = *pFuncs;
return NPERR_NO_ERROR;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:19,代码来源:npPdfViewer.cpp
示例18: CreateTempFile
HANDLE CreateTempFile(WCHAR *filePathBufOut, size_t bufSize)
{
ScopedMem<WCHAR> tmpPath(path::GetTempPath(L"nPV"));
if (!tmpPath)
{
plogf("sp: CreateTempFile(): GetTempPath() failed");
return NULL;
}
str::BufSet(filePathBufOut, bufSize, tmpPath);
HANDLE hFile = CreateFile(filePathBufOut, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == hFile)
{
plogf("sp: CreateTempFile(): CreateFile() failed");
return NULL;
}
return hFile;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:19,代码来源:npPdfViewer.cpp
示例19: plogf
/*
* We check to see if the problem is well posed. If it is not, we return
* false and print out error conditions.
*
* Current there is one condition. If all the element abundances are
* zero, the algorithm will fail
*
* @param vprob VCS_PROB pointer to the definition of the equilibrium
* problem
*
* @return If true, the problem is well-posed. If false, the problem
* is not well posed.
*/
bool VCS_SOLVE::vcs_wellPosed(VCS_PROB *vprob) {
double sum = 0.0;
for (size_t e = 0; e < vprob->ne; e++) {
sum = sum + vprob->gai[e];
}
if (sum < 1.0E-20) {
plogf("vcs_wellPosed: Element abundance is close to zero\n");
return false;
}
return true;
}
开发者ID:hkmoffat,项目名称:cantera,代码行数:24,代码来源:vcs_prep.cpp
示例20: NPP_DestroyStream
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
{
InstanceData *data;
plogf("sp: NPP_DestroyStream() reason: %d", reason);
if (stream)
{
if (stream->url)
plogf("sp: url: %s", stream->url);
plogf("sp: end: %d", stream->end);
}
if (!instance)
{
plogf("sp: NPP_DestroyStream() error: NPERR_INVALID_INSTANCE_ERROR");
return NPERR_INVALID_INSTANCE_ERROR;
}
data = (InstanceData *)instance->pdata;
if (!data)
{
plogf("sp: NPP_DestroyStream() error: instance->pdata is NULL");
return NPERR_NO_ERROR;
}
if (!data->hFile)
goto Exit;
CloseHandle(data->hFile);
if (stream)
LaunchWithSumatra(data, stream->url);
Exit:
if (data->npwin)
{
InvalidateRect((HWND)data->npwin->window, NULL, FALSE);
UpdateWindow((HWND)data->npwin->window);
}
return NPERR_NO_ERROR;
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:41,代码来源:npPdfViewer.cpp
注:本文中的plogf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论