本文整理汇总了C++中prg函数的典型用法代码示例。如果您正苦于以下问题:C++ prg函数的具体用法?C++ prg怎么用?C++ prg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doprof1
void
doprof1(void)
{
#if 0
Sym *s;
int32 n;
Prog *p, *q;
if(debug['v'])
Bprint(&bso, "%5.2f profile 1\n", cputime());
Bflush(&bso);
s = lookup("__mcount", 0);
n = 1;
for(cursym = textp; cursym != nil; cursym = cursym->next) {
p = cursym->text;
q = prg();
q->line = p->line;
q->link = datap;
datap = q;
q->as = ADATA;
q->from.type = D_EXTERN;
q->from.offset = n*4;
q->from.sym = s;
q->from.scale = 4;
q->to = p->from;
q->to.type = D_CONST;
q = prg();
q->line = p->line;
q->pc = p->pc;
q->link = p->link;
p->link = q;
p = q;
p->as = AADDL;
p->from.type = D_CONST;
p->from.offset = 1;
p->to.type = D_EXTERN;
p->to.sym = s;
p->to.offset = n*4 + 4;
n += 2;
}
q = prg();
q->line = 0;
q->link = datap;
datap = q;
q->as = ADATA;
q->from.type = D_EXTERN;
q->from.sym = s;
q->from.scale = 4;
q->to.type = D_CONST;
q->to.offset = n;
s->type = SBSS;
s->size = n*4;
#endif
}
示例2: py_glIsProgram
static PyObject* py_glIsProgram(PyObject *, PyObject *args) {
CHECK_ARG_COUNT(args, 1);
Uint prg(PyTuple_GetItem(args, 0));
PyObject *rv = (glIsProgram(prg) == GL_TRUE ? Py_True : Py_False);
Py_INCREF(rv);
return rv;
}
示例3: testSingleFact
void testSingleFact() {
std::stringstream prg("1 1 0 0 \n0\n1 a\n0\nB+\n0\nB-\n0\n1\n");
CPPUNIT_ASSERT_EQUAL(true, parseLparse(prg, api));
api.endProgram();
CPPUNIT_ASSERT_EQUAL(0u, ctx.numVars());
CPPUNIT_ASSERT_EQUAL('a', ctx.symTab()[1].name[0]);
}
示例4: prg
bool SociContainer::begin(void)
{
mRecordCount = 0;
Progress prg("Open database", "Connecting ...");
prg->setMaximum(prg->maximum()+2);
if(!getSession())
{
prg->setValue(prg->value()+2);
ErrorMessage(spt::logging::LoggingItem::LOG_ERROR, MODULENAME, "Unable to open database.");
return false;
}
prg->setValue(prg->value()+1);
if(isReader())
{
if(!prepareStatement(selectorToQuery()))
return false;
}
prg->setValue(prg->value()+1);
if(mSQLToFile)
{
mSQLFile.open(mSQLFilename, std::ios::out | std::ios::trunc);
if(!mSQLFile.is_open())
{
ErrorMessage(spt::logging::LoggingItem::LOG_ERROR, MODULENAME, StdString("Unable to open the file: ")+mSQLFilename);
return false;
}
}
return true;
}
示例5: updateObjectsInList
void CMtbRobotDialog::refresh()
{
inRefreshRoutine=true;
// Get handle of last selected object:
int lastSel=simGetObjectLastSelection();
updateObjectsInList();
// Now initialized other dialog elements:
CMtbRobot* taggedObj=NULL;
ui->qqRobotProgram->setPlainText("");
ui->qqAutomatic->setChecked(false);
if (lastSel!=-1)
{
taggedObj=CAccess::mtbRobotContainer->getFromAssociatedObject(lastSel);
if (taggedObj==NULL)
selectObjectInList(-1);
else
{ // The last selected object is the base object of a MTB model!
selectObjectInList(taggedObj->getID());
std::string prg(taggedObj->getProgram());
ui->qqRobotProgram->setPlainText(prg.c_str());
ui->qqAutomatic->setChecked((taggedObj->getOptions()&1)!=0);
}
}
else
selectObjectInList(-1);
ui->qqRobotProgram->setEnabled((taggedObj!=NULL)&&(simGetSimulationState()==sim_simulation_stopped));
ui->qqAutomatic->setEnabled((taggedObj!=NULL)&&(simGetSimulationState()==sim_simulation_stopped));
inRefreshRoutine=false;
}
示例6: RETURN_ERR
blargg_err_t Nes_Cart::load_ines( Auto_File_Reader in )
{
RETURN_ERR( in.open() );
ines_header_t h;
RETURN_ERR( in->read( &h, sizeof h ) );
if ( 0 != memcmp( h.signature, "NES\x1A", 4 ) )
return not_ines_file;
if ( h.zero [7] ) // handle header defaced by a fucking idiot's handle
h.flags2 = 0;
set_mapper( h.flags, h.flags2 );
if ( h.flags & 0x04 ) // skip trainer
RETURN_ERR( in->skip( 512 ) );
RETURN_ERR( resize_prg( h.prg_count * 16 * 1024L ) );
RETURN_ERR( resize_chr( h.chr_count * 8 * 1024L ) );
RETURN_ERR( in->read( prg(), prg_size() ) );
RETURN_ERR( in->read( chr(), chr_size() ) );
return 0;
}
示例7: UNUSED
void SociContainer::handleNotification(Dispatcher<SQLPreview::ActionEvent, QVariant, int> *oSource, SQLPreview::ActionEvent nEvent, QVariant oData, int nRows)
{
UNUSED(oSource);
Progress prg("Fetch columns...");
StdString query;
if(nEvent == SQLPreview::ActionEvent::EVENT_SQL_EXECUTE)
{
setTablename("");
query = oData.value<StdString>();
mPreviewLimit = nRows;
setQuery(query);
refreshPreview(query, mPreviewLimit);
}
else if(nEvent == SQLPreview::ActionEvent::EVENT_SQL_TOGGLE)
{
bool enabled = oData.value<bool>();
if(enabled)
{
setTablename("");
mPreviewLimit = mPreviewPanel->getPreviewLimit();
query = mPreviewPanel->getQuery();
setQuery(query);
refreshPreview(query, mPreviewLimit);
}
}
}
示例8: py_glGetVertexAttribPointer
static PyObject* py_glGetVertexAttribPointer(PyObject *, PyObject *args) {
CHECK_ARG_COUNT(args, 2);
Uint prg(PyTuple_GetItem(args, 0));
Enum param(PyTuple_GetItem(args, 1));
GLvoid *ptr = 0;
glGetVertexAttribPointerv(prg, param, &ptr);
return PyCObject_FromVoidPtr(ptr, NULL);
}
示例9: copyp
Prog*
copyp(Prog *q)
{
Prog *p;
p = prg();
*p = *q;
return p;
}
示例10: py_glGetProgramInfoLog
static PyObject* py_glGetProgramInfoLog(PyObject *, PyObject *args) {
CHECK_ARG_COUNT(args, 1);
Uint prg(PyTuple_GetItem(args, 0));
GLint len=0;
glGetProgramiv(prg, GL_INFO_LOG_LENGTH, &len);
//GLchar *log = new GLchar[len+1];
Array1D<Char> log(len+1);
glGetProgramInfoLog(prg, len, NULL, log);
return PyString_FromString(log);
//delete[] log;
}
示例11: appendp
Prog*
appendp(Prog *q)
{
Prog *p;
p = prg();
p->link = q->link;
q->link = p;
p->line = q->line;
return p;
}
示例12: byteq
Prog*
byteq(int v)
{
Prog *p;
p = prg();
p->as = ABYTE;
p->from.type = D_CONST;
p->from.offset = v&0xff;
return p;
}
示例13: py_glGetAttachedShaders
static PyObject* py_glGetAttachedShaders(PyObject *, PyObject *args) {
CHECK_ARG_COUNT(args, 1);
Uint prg(PyTuple_GetItem(args, 0));
GLint count=0;
glGetProgramiv(prg, GL_ATTACHED_SHADERS, &count);
if (count == 0) {
return PyList_New(0);
} else {
Array1D<Uint> shaders(count);
glGetAttachedShaders(prg, count, NULL, shaders);
return shaders.toPy();
}
}
示例14: follow
void
follow(void)
{
if(debug['v'])
Bprint(&bso, "%5.2f follow\n", cputime());
Bflush(&bso);
firstp = prg();
lastp = firstp;
xfol(textp);
lastp->link = P;
firstp = firstp->link;
}
示例15: clCreateProgramWithSource
CLWProgram CLWProgram::CreateFromSource(char const* sourcecode, size_t sourcesize, CLWContext context)
{
cl_int status = CL_SUCCESS;
cl_program program = clCreateProgramWithSource(context, 1, (const char**)&sourcecode, &sourcesize, &status);
ThrowIf(status != CL_SUCCESS, status, "clCreateProgramWithSource failed");
std::vector<cl_device_id> deviceIds(context.GetDeviceCount());
for(unsigned int i = 0; i < context.GetDeviceCount(); ++i)
{
deviceIds[i] = context.GetDevice(i);
}
char const* buildopts =
#if defined(__APPLE__)
"-D APPLE -cl-mad-enable -cl-fast-relaxed-math -cl-std=CL1.2 -I ."
#elif defined(_WIN32) || defined (WIN32)
"-D WIN32 -cl-mad-enable -cl-std=CL1.2 -I."
#elif defined(__linux__)
"-D __linux__ -I."
#else
nullptr
#endif
;
status = clBuildProgram(program, context.GetDeviceCount(), &deviceIds[0], buildopts, nullptr, nullptr);
if(status != CL_SUCCESS)
{
std::vector<char> buildLog;
size_t logSize;
clGetProgramBuildInfo(program, deviceIds[0], CL_PROGRAM_BUILD_LOG, 0, nullptr, &logSize);
buildLog.resize(logSize);
clGetProgramBuildInfo(program, deviceIds[0], CL_PROGRAM_BUILD_LOG, logSize, &buildLog[0], nullptr);
#ifdef _DEBUG
std::cout << &buildLog[0] << "\n";
#endif
throw CLWException(status, std::string(&buildLog[0]));
}
CLWProgram prg(program);
clReleaseProgram(program);
return prg;
}