本文整理汇总了C++中plogf函数的典型用法代码示例。如果您正苦于以下问题:C++ plogf函数的具体用法?C++ plogf怎么用?C++ plogf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plogf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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!");
}
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
示例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 ");
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}