Image* image = &ImageManager::GetInstance().GetImage(key); *(void**)(lua_newuserdata(L, sizeof(void*))) = image; #endif luaL_getmetatable(L, LuaImage::className_); lua_setmetatable(L, -2); return 1; } #define METHOD(class, name) { #name, class::name } const char* LuaImage::className_ = "Image"; const luaL_reg LuaImage::methods_[] = { METHOD(LuaImage, SetSmooth), {0, 0}, }; int LuaImage::SetSmooth(lua_State* L) { assert(lua_gettop(L) == 2); #if 1 Image* image = *static_cast<Image**>(luaL_checkudata(L, 1, LuaImage::className_)); #else // lua_unboxpointer Image* image = (Image*)(*(void **)(lua_touserdata(L, 1))); #endif bool smooth = lua_toboolean(L, 2); image->SetSmooth(smooth);
return NULL; err = git_config_set_multivar(self->config, name, regex, value); if (err < 0) { if (err == GIT_ENOTFOUND) Error_set(err); else PyErr_SetNone(PyExc_TypeError); return NULL; } Py_RETURN_NONE; } PyMethodDef Config_methods[] = { METHOD(Config, get_system_config, METH_NOARGS | METH_STATIC), METHOD(Config, get_global_config, METH_NOARGS | METH_STATIC), METHOD(Config, foreach, METH_VARARGS), METHOD(Config, add_file, METH_VARARGS | METH_KEYWORDS), METHOD(Config, get_multivar, METH_VARARGS), METHOD(Config, set_multivar, METH_VARARGS), {NULL} }; PySequenceMethods Config_as_sequence = { 0, /* sq_length */ 0, /* sq_concat */ 0, /* sq_repeat */ 0, /* sq_item */ 0, /* sq_slice */ 0, /* sq_ass_item */
PyObject * Repository_expand_id(Repository *self, PyObject *py_hex) { git_oid oid; int err; err = py_oid_to_git_oid_expand(self->repo, py_hex, &oid); if (err < 0) return NULL; return git_oid_to_python(&oid); } PyMethodDef Repository_methods[] = { METHOD(Repository, create_blob, METH_VARARGS), METHOD(Repository, create_blob_fromworkdir, METH_VARARGS), METHOD(Repository, create_blob_fromdisk, METH_VARARGS), METHOD(Repository, create_commit, METH_VARARGS), METHOD(Repository, create_tag, METH_VARARGS), METHOD(Repository, TreeBuilder, METH_VARARGS), METHOD(Repository, walk, METH_VARARGS), METHOD(Repository, merge_base, METH_VARARGS), METHOD(Repository, merge_analysis, METH_O), METHOD(Repository, merge, METH_O), METHOD(Repository, cherrypick, METH_O), METHOD(Repository, read, METH_O), METHOD(Repository, write, METH_VARARGS), METHOD(Repository, create_reference_direct, METH_VARARGS), METHOD(Repository, create_reference_symbolic, METH_VARARGS), METHOD(Repository, listall_references, METH_NOARGS),
len = py_oid_to_git_oid(py_oid, &oid); if (len == 0) return NULL; err = git_object_lookup_prefix(&target, self->repo, &oid, len, GIT_OBJ_ANY); err = err < 0 ? err : git_reset(self->repo, target, reset_type); git_object_free(target); if (err < 0) return Error_set_oid(err, &oid, len); Py_RETURN_NONE; } PyMethodDef Repository_methods[] = { METHOD(Repository, create_blob, METH_VARARGS), METHOD(Repository, create_blob_fromworkdir, METH_VARARGS), METHOD(Repository, create_blob_fromdisk, METH_VARARGS), METHOD(Repository, create_commit, METH_VARARGS), METHOD(Repository, create_tag, METH_VARARGS), METHOD(Repository, TreeBuilder, METH_VARARGS), METHOD(Repository, walk, METH_VARARGS), METHOD(Repository, merge_base, METH_VARARGS), METHOD(Repository, merge, METH_O), METHOD(Repository, read, METH_O), METHOD(Repository, write, METH_VARARGS), METHOD(Repository, create_reference_direct, METH_VARARGS), METHOD(Repository, create_reference_symbolic, METH_VARARGS), METHOD(Repository, listall_references, METH_NOARGS), METHOD(Repository, lookup_reference, METH_O), METHOD(Repository, revparse_single, METH_O),
void osc_unregister_methods(sosc_state_t *state) { char *prefix, *cmd_buf; lo_server srv; prefix = state->config.app.osc_prefix; srv = state->server; #define UNREGISTER(typetags) \ lo_server_del_method(srv, cmd_buf, typetags) METHOD("grid/led/set") UNREGISTER("iii"); METHOD("grid/led/all") UNREGISTER("i"); METHOD("grid/led/map") UNREGISTER("iiiiiiiiii"); METHOD("grid/led/col") UNREGISTER(NULL); METHOD("grid/led/row") UNREGISTER(NULL); METHOD("grid/led/intensity") UNREGISTER("i"); METHOD("grid/led/level/set") UNREGISTER("iii"); METHOD("grid/led/level/all") UNREGISTER("i"); METHOD("grid/led/level/map") UNREGISTER("ii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii"); METHOD("grid/led/level/col") UNREGISTER(NULL); METHOD("grid/led/level/row") UNREGISTER(NULL); METHOD("ring/set") UNREGISTER("iii"); METHOD("ring/all") UNREGISTER("ii"); METHOD("ring/map") UNREGISTER("i" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii"); METHOD("ring/range") UNREGISTER("iiii"); METHOD("tilt/set") UNREGISTER("ii"); #undef UNREGISTER }
err = git_commit_lookup(&commit, self->repo->repo, &oid); if (err < 0) return Error_set(err); py_commit = PyObject_New(Commit, &CommitType); if (py_commit) { py_commit->commit = commit; Py_INCREF(self->repo); py_commit->repo = self->repo; } return (PyObject*)py_commit; } PyMethodDef Walker_methods[] = { METHOD(Walker, hide, METH_O), METHOD(Walker, push, METH_O), METHOD(Walker, reset, METH_NOARGS), METHOD(Walker, sort, METH_O), {NULL} }; PyDoc_STRVAR(Walker__doc__, "Revision walker."); PyTypeObject WalkerType = { PyVarObject_HEAD_INIT(NULL, 0) "_pygit2.Walker", /* tp_name */ sizeof(Walker), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)Walker_dealloc, /* tp_dealloc */
VTABLE(VMMethod)* VMMethod_vtable(void) { if(! VMMethod_vtable_inited) { *((VTABLE(VMArray)*)&_VMMethod_vtable) = *VMArray_vtable(); ASSIGN_TRAIT(VMInvokable, VMMethod); _VMMethod_vtable.init = METHOD(VMMethod, init); _VMMethod_vtable.get_number_of_locals = METHOD(VMMethod, get_number_of_locals); _VMMethod_vtable.get_maximum_number_of_stack_elements = METHOD(VMMethod, get_maximum_number_of_stack_elements); _VMMethod_vtable._get_offset = METHOD(VMMethod, _get_offset); _VMMethod_vtable.set_holder_all = METHOD(VMMethod, set_holder_all); _VMMethod_vtable.get_constant = METHOD(VMMethod, get_constant); _VMMethod_vtable.get_number_of_arguments = METHOD(VMMethod, get_number_of_arguments); _VMMethod_vtable.get_number_of_bytecodes = METHOD(VMMethod, get_number_of_bytecodes); _VMMethod_vtable.get_bytecode = METHOD(VMMethod, get_bytecode); _VMMethod_vtable.set_bytecode = METHOD(VMMethod, set_bytecode); _VMMethod_vtable.invoke_method = METHOD(VMMethod, invoke_method); _VMMethod_vtable.mark_references = METHOD(VMMethod, mark_references); VMMethod_vtable_inited = true; }
const char* SPxScaler::getName() const { METHOD( "SPxScaler::getName()" ); return m_name; }
void SPxScaler::setOrder(bool colFirst) { METHOD( "SPxScaler::setOrder()" ); m_colFirst = colFirst; }
void updateitem(msgpass * msg) { int code = msg->code; int getnum = msg->getnum; void * mainwin = msg->mainwin; item * curitem = itemhead; void * clickbmpclass; int region; RegInfo props; int size,position; switch(code) { case TSKM_KILLED: if(!curitem) break; while(curitem->mainwin != mainwin) { curitem = curitem->next; //printf("looking for item to kill\n"); } JCntRemove(taskbar,curitem->icon); JWKill(curitem->icon); itemhead = remQueue(itemhead,curitem); sendChan(appchannel,REFRESH); resizebar(-1); break; case TSKM_NEWITEM: curitem = malloc(sizeof(item)); region = ((JMan *)mainwin)->Region; JRegInfo(region,&props); if(props.metadata) { curitem->title = props.metadata->title; curitem->launchstr = props.metadata->launchpath; if(props.metadata->icon) { curitem->iconbmp = props.metadata->icon; } else { curitem->iconbmp = malloc(36); memcpy(curitem->iconbmp,ICO_APP_DFL,36); } } else { curitem->title = strdup("Application"); curitem->launchstr = strdup(""); //something that can be free()'d curitem->iconbmp = malloc(36); memcpy(curitem->iconbmp,ICO_APP_DFL,36); } clickbmpclass = JSubclass(&JBmpClass,-1, METHOD(MJW, Button), changefocus, -1); curitem->icon = JNew(clickbmpclass); JBmpInit(curitem->icon,16,16,curitem->iconbmp); ((JW*)curitem->icon)->Sense |= WEV_Button; JWSetData(curitem->icon,curitem); curitem->status = getnum; curitem->mainwin = mainwin; itemhead = addQueueB(itemhead,itemhead,curitem); resizebar(1); JCntAdd(taskbar,curitem->icon); JWinShow(curitem->icon); sendChan(appchannel,REFRESH); //printf("taskbar: new item, %d\n",getnum); if(getnum == TSKM_INFOCUS) sendChan(appchannel,SETCOL,curitem->icon,COL_FOC); else if(getnum == TSKM_INBLUR) sendChan(appchannel,SETCOL,curitem->icon,COL_NFOC); else sendChan(appchannel,SETCOL,curitem->icon,COL_MIN); break; case TSKM_INFOCUS: if(!curitem) break; while(curitem->mainwin != mainwin) { curitem = curitem->next; //printf("finding first item (infocus)\n"); } while(curitem->next->mainwin != mainwin) { //printf("I think this is the bad loop.\n"); curitem = curitem->next; if(curitem->status == TSKM_INFOCUS) { sendChan(appchannel,SETCOL,curitem->icon,COL_NFOC); curitem->status = TSKM_INBLUR; } } curitem = curitem->next; sendChan(appchannel,SETCOL,curitem->icon,COL_FOC); curitem->status = TSKM_INFOCUS; break; case TSKM_MINIMIZED: if(!curitem) break; while(curitem->mainwin != mainwin) { curitem = curitem->next; //printf("finding first item (minimized)\n"); } sendChan(appchannel,SETCOL,curitem->icon,COL_MIN); curitem->status = TSKM_MINIMIZED; break; } }
/** This function is used by computeScaleVecs and has to be overridden. */ Real SPxScaler::computeScale(Real /*mini*/, Real /*maxi*/) const { METHOD( "SPxScaler::computeScale" ); return 1.0; }
return to_unicode(git_note_message(self->note), NULL, NULL); } static void Note_dealloc(Note *self) { Py_CLEAR(self->repo); free(self->annotated_id); git_note_free(self->note); PyObject_Del(self); } PyMethodDef Note_methods[] = { METHOD(Note, remove, METH_VARARGS), {NULL} }; PyMemberDef Note_members[] = { MEMBER(Note, annotated_id, T_STRING, "id of the annotated object."), {NULL} }; PyGetSetDef Note_getseters[] = { GETTER(Note, message), GETTER(Note, oid), {NULL} }; PyDoc_STRVAR(Note__doc__, "Note object.");
void SPxBasis::Desc::reSize(int rowDim, int colDim) { METHOD( "SPxBasis::Desc::reSize()" ); rowstat.reSize(rowDim); colstat.reSize(colDim); }
bool SPxSolver::writeState( const char* filename, const NameSet* rowNames, const NameSet* colNames ) const { METHOD( "SPxSolver::writeState()" ); std::string ofname; std::ofstream ofs; // write parameter settings ofname = std::string(filename) + ".set"; ofs.open(ofname.c_str()); if (!ofs) return false; std::stringstream table, commandline; table << "Delta = " << std::setw(8) << delta() << std::endl << "Epsilon Zero = " << std::setw(8) << Param::epsilon() << std::endl << "Epsilon Factor = " << std::setw(8) << Param::epsilonFactorization() << std::endl << "Epsilon Update = " << std::setw(8) << Param::epsilonUpdate() << std::endl << "Verbosity = " << std::setw(8) << Param::verbose() << std::endl << std::endl << "Algorithm = " << (type() == SPxSolver::ENTER ? "Entering" : "Leaving") << std::endl << "Representation = " << (rep() == SPxSolver::ROW ? "Row" : "Column") << std::endl << "Update = " << slinSolver()->getName() << std::endl << "Pricer = " << pricer()->getName() #ifdef PARTIAL_PRICING << " (partial, size = " << MAX_PRICING_CANDIDATES << ")" #endif << std::endl << "Starter = " << ((starter() == 0) ? "no" : starter()->getName()) << std::endl << "Ratiotest = " << ratiotester()->getName() << std::endl << std::endl; commandline << "bin/soplex -g0 -s0" << " -f" << feastol() << " -o" << opttol() << (type() == SPxSolver::ENTER ? " -e" : "") << (rep() == SPxSolver::ROW ? " -r" : "") << (!strcmp(slinSolver()->getName(), "SLU-Eta") ? " -i" : ""); if (!strcmp(pricer()->getName(), "Dantzig")) commandline << " -p0"; else if (!strcmp(pricer()->getName(), "ParMult")) commandline << " -p1"; else if (!strcmp(pricer()->getName(), "Devex")) commandline << " -p2"; else if (!strcmp(pricer()->getName(), "Hybrid")) commandline << " -p3"; else if (!strcmp(pricer()->getName(), "Steep")) commandline << " -p4"; else if (!strcmp(pricer()->getName(), "Weight")) commandline << " -p5"; else if (!strcmp(pricer()->getName(), "SteepEx")) commandline << " -p6"; if (starter() != 0) { if (!strcmp(starter()->getName(), "Weight")) commandline << " -s1"; else if (!strcmp(starter()->getName(), "Sum")) commandline << " -s2"; else if (!strcmp(starter()->getName(), "Vector")) commandline << " -s3"; } if (!strcmp(ratiotester()->getName(), "Default")) commandline << " -t0"; else if (!strcmp(ratiotester()->getName(), "Harris")) commandline << " -t1"; else if (!strcmp(ratiotester()->getName(), "Fast")) commandline << " -t2"; else if (!strcmp(ratiotester()->getName(), "Bound Flipping")) commandline << " -t3"; commandline << " -br " << filename << ".mps " << filename << ".bas"; ofs << "SoPlex Parameters:\n\n" << table.str() << "Command line > " << commandline.str(); ofs.close(); // write LP ofname = std::string(filename) + ".mps"; ofs.open(ofname.c_str()); if (!ofs) return false; writeMPS(ofs, rowNames, colNames, NULL); ofs.close(); // write basis ofname = std::string(filename) + ".bas"; return writeBasisFile(ofname.c_str(), rowNames, colNames); }
void CParamTooltipCtrl::AddMethod(const CString& sMethod, const vector<CString>& setParams) { m_setMethods.push_back(METHOD(sMethod, setParams)); m_nCurParam = 0; }
void SPxScaler::setBoth(bool both) { METHOD( "SPxScaler::setBoth()" ); m_doBoth = both; }
if (!(self->flags & GIT_DIFF_FLAG_NOT_BINARY) && (self->flags & GIT_DIFF_FLAG_BINARY)) Py_RETURN_TRUE; Py_RETURN_FALSE; } static void DiffDelta_dealloc(DiffDelta *self) { Py_CLEAR(self->old_file); Py_CLEAR(self->new_file); PyObject_Del(self); } static PyMethodDef DiffDelta_methods[] = { METHOD(DiffDelta, status_char, METH_NOARGS), {NULL} }; PyMemberDef DiffDelta_members[] = { MEMBER(DiffDelta, status, T_UINT, "A GIT_DELTA_* constant."), MEMBER(DiffDelta, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."), MEMBER(DiffDelta, similarity, T_USHORT, "For renamed and copied."), MEMBER(DiffDelta, nfiles, T_USHORT, "Number of files in the delta."), MEMBER(DiffDelta, old_file, T_OBJECT, "\"from\" side of the diff."), MEMBER(DiffDelta, new_file, T_OBJECT, "\"to\" side of the diff."), {NULL} }; PyGetSetDef DiffDelta_getseters[] = { GETTER(DiffDelta, is_binary),
void mexFunction ( int nargout, mxArray *pargout [ ], int nargin, const mxArray *pargin [ ] ) { bool malloc_debug = GB_mx_get_global (true) ; GrB_Matrix A = NULL ; void *Y = NULL ; void *Xtemp = NULL ; void *X = NULL ; GrB_Index nvals = 0 ; // check inputs GB_WHERE (USAGE) ; if (nargout > 3 || nargin < 1 || nargin > 2) { mexErrMsgTxt ("Usage: " USAGE) ; } #define GET_DEEP_COPY ; #define FREE_DEEP_COPY ; // get A (shallow copy) A = GB_mx_mxArray_to_Matrix (pargin [0], "A input", false, true) ; if (A == NULL) { FREE_ALL ; mexErrMsgTxt ("A failed") ; } mxClassID aclass = GB_mx_Type_to_classID (A->type) ; // get the number of entries in A GrB_Matrix_nvals (&nvals, A) ; mxClassID xclass ; GrB_Type xtype ; if (A->type == Complex) { // input argument xclass is ignored xtype = Complex ; xclass = mxDOUBLE_CLASS ; // create Xtemp if (nargout > 2) { GB_MALLOC_MEMORY (Xtemp, nvals, sizeof (double complex)) ; } } else { // get xclass, default is class (A), and the corresponding xtype xclass = GB_mx_string_to_classID (aclass, PARGIN (1)) ; xtype = GB_mx_classID_to_Type (xclass) ; if (xtype == NULL) { FREE_ALL ; mexErrMsgTxt ("X must be numeric") ; } // create X if (nargout > 2) { pargout [2] = mxCreateNumericMatrix (nvals, 1, xclass, mxREAL) ; X = (void *) mxGetData (pargout [2]) ; } } // create I pargout [0] = mxCreateNumericMatrix (nvals, 1, mxUINT64_CLASS, mxREAL) ; GrB_Index *I = (GrB_Index *) mxGetData (pargout [0]) ; // create J GrB_Index *J = NULL ; if (nargout > 1) { pargout [1] = mxCreateNumericMatrix (nvals, 1, mxUINT64_CLASS, mxREAL) ; J = (GrB_Index *) mxGetData (pargout [1]) ; } // [I,J,X] = find (A) if (GB_VECTOR_OK (A)) { // test extract vector methods GrB_Vector v = (GrB_Vector) A ; switch (xtype->code) { case GB_BOOL_code : METHOD (GrB_Vector_extractTuples (I, (bool *) X, &nvals, v)) ; break ; case GB_INT8_code : METHOD (GrB_Vector_extractTuples (I, (int8_t *) X, &nvals, v)) ; break ; case GB_UINT8_code : METHOD (GrB_Vector_extractTuples (I, (uint8_t *) X, &nvals, v)) ; break ; case GB_INT16_code : METHOD (GrB_Vector_extractTuples (I, (int16_t *) X, &nvals, v)) ; break ; case GB_UINT16_code : METHOD (GrB_Vector_extractTuples (I, (uint16_t *) X, &nvals, v)) ; break ; case GB_INT32_code : METHOD (GrB_Vector_extractTuples (I, (int32_t *) X, &nvals, v)) ; break ; case GB_UINT32_code : METHOD (GrB_Vector_extractTuples (I, (uint32_t *) X, &nvals, v)) ; break ; case GB_INT64_code : METHOD (GrB_Vector_extractTuples (I, (int64_t *) X, &nvals, v)) ; break ; case GB_UINT64_code : METHOD (GrB_Vector_extractTuples (I, (uint64_t *) X, &nvals, v)) ; break ; case GB_FP32_code : METHOD (GrB_Vector_extractTuples (I, (float *) X, &nvals, v)) ; break ; case GB_FP64_code : METHOD (GrB_Vector_extractTuples (I, (double *) X, &nvals, v)) ; break ; case GB_UCT_code : case GB_UDT_code : METHOD (GrB_Vector_extractTuples (I, Xtemp, &nvals, v)) ; break ; default : FREE_ALL ; mexErrMsgTxt ("unsupported class") ; } if (J != NULL) { for (int64_t p = 0 ; p < nvals ; p++) J [p] = 0 ; } } else { switch (xtype->code) { case GB_BOOL_code : METHOD (GrB_Matrix_extractTuples (I, J, (bool *) X, &nvals, A)) ; break ; case GB_INT8_code : METHOD (GrB_Matrix_extractTuples (I, J, (int8_t *) X, &nvals, A)) ; break ; case GB_UINT8_code : METHOD (GrB_Matrix_extractTuples (I, J, (uint8_t *) X, &nvals, A)) ; break ; case GB_INT16_code : METHOD (GrB_Matrix_extractTuples (I, J, (int16_t *) X, &nvals, A)) ; break ; case GB_UINT16_code : METHOD (GrB_Matrix_extractTuples (I, J, (uint16_t *) X, &nvals, A)) ; break ; case GB_INT32_code : METHOD (GrB_Matrix_extractTuples (I, J, (int32_t *) X, &nvals, A)) ; break ; case GB_UINT32_code : METHOD (GrB_Matrix_extractTuples (I, J, (uint32_t *) X, &nvals, A)) ; break ; case GB_INT64_code : METHOD (GrB_Matrix_extractTuples (I, J, (int64_t *) X, &nvals, A)) ; break ; case GB_UINT64_code : METHOD (GrB_Matrix_extractTuples (I, J, (uint64_t *) X, &nvals, A)) ; break ; case GB_FP32_code : METHOD (GrB_Matrix_extractTuples (I, J, (float *) X, &nvals, A)) ; break ; case GB_FP64_code : METHOD (GrB_Matrix_extractTuples (I, J, (double *) X, &nvals, A)) ; break; case GB_UCT_code : case GB_UDT_code : METHOD (GrB_Matrix_extractTuples (I, J, Xtemp, &nvals, A)) ; break; default : FREE_ALL ; mexErrMsgTxt ("unsupported class") ; } } if (A->type == Complex && nargout > 2) { // create the MATLAB complex X pargout [2] = mxCreateNumericMatrix (nvals, 1, mxDOUBLE_CLASS, mxCOMPLEX) ; GB_mx_complex_split (nvals, Xtemp, pargout [2]) ; } FREE_ALL ; }
#define CLASS(name) { #name, { #define END_CLASS SENTINEL_METHOD } }, #define METHOD(signature, fn) { false, signature, fn }, #define STATIC_METHOD(signature, fn) { true, signature, fn }, // The array of built-in modules. static ModuleRegistry modules[] = { MODULE(io) CLASS(File) STATIC_METHOD("<allocate>", fileAllocate) STATIC_METHOD("<finalize>", fileFinalize) STATIC_METHOD("open_(_,_)", fileOpen) STATIC_METHOD("sizePath_(_,_)", fileSizePath) METHOD("close_(_)", fileClose) METHOD("descriptor", fileDescriptor) METHOD("readBytes_(_,_)", fileReadBytes) METHOD("size_(_)", fileSize) END_CLASS CLASS(Stdin) STATIC_METHOD("readStart_()", stdinReadStart) STATIC_METHOD("readStop_()", stdinReadStop) END_CLASS END_MODULE MODULE(scheduler) CLASS(Scheduler) STATIC_METHOD("captureMethods_()", schedulerCaptureMethods) END_CLASS END_MODULE MODULE(timer)
Py_INCREF(res); return res; } PyGetSetDef Object_getseters[] = { GETTER(Object, oid), GETTER(Object, id), GETTER(Object, hex), GETTER(Object, short_id), GETTER(Object, type), GETTER(Object, _pointer), {NULL} }; PyMethodDef Object_methods[] = { METHOD(Object, read_raw, METH_NOARGS), METHOD(Object, peel, METH_O), {NULL} }; PyDoc_STRVAR(Object__doc__, "Base class for Git objects."); PyTypeObject ObjectType = { PyVarObject_HEAD_INIT(NULL, 0) "_pygit2.Object", /* tp_name */ sizeof(Object), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)Object_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */
0, /* sq_repeat */ 0, /* sq_item */ 0, /* sq_slice */ 0, /* sq_ass_item */ 0, /* sq_ass_slice */ (objobjproc)Tree_contains, /* sq_contains */ }; PyMappingMethods Tree_as_mapping = { (lenfunc)Tree_len, /* mp_length */ (binaryfunc)Tree_getitem, /* mp_subscript */ 0, /* mp_ass_subscript */ }; PyMethodDef Tree_methods[] = { METHOD(Tree, diff_to_tree, METH_VARARGS | METH_KEYWORDS), METHOD(Tree, diff_to_workdir, METH_VARARGS), METHOD(Tree, diff_to_index, METH_VARARGS | METH_KEYWORDS), {NULL} }; PyDoc_STRVAR(Tree__doc__, "Tree objects."); PyTypeObject TreeType = { PyVarObject_HEAD_INIT(NULL, 0) "_pygit2.Tree", /* tp_name */ sizeof(Tree), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */
void SPxSolver::setSolver(SLinSolver* slu, const bool destroy) { METHOD( "SPxSolver::setSolver()" ); SPxBasis::loadSolver(slu, destroy); }
void osc_register_methods(sosc_state_t *state) { char *prefix, *cmd_buf; monome_t *monome; lo_server srv; prefix = state->config.app.osc_prefix; monome = state->monome; srv = state->server; #define REGISTER(typetags, cb) \ lo_server_add_method(srv, cmd_buf, typetags, cb, monome) METHOD("grid/led/set") REGISTER("iii", led_set_handler); METHOD("grid/led/all") REGISTER("i", led_all_handler); METHOD("grid/led/map") REGISTER("iiiiiiiiii", led_map_handler); METHOD("grid/led/col") REGISTER(NULL, led_col_handler); METHOD("grid/led/row") REGISTER(NULL, led_row_handler); METHOD("grid/led/intensity") REGISTER("i", led_intensity_handler); METHOD("grid/led/level/set") REGISTER("iii", led_level_set_handler); METHOD("grid/led/level/all") REGISTER("i", led_level_all_handler); METHOD("grid/led/level/map") REGISTER("ii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii", led_level_map_handler); METHOD("grid/led/level/col") REGISTER(NULL, led_level_col_handler); METHOD("grid/led/level/row") REGISTER(NULL, led_level_row_handler); METHOD("ring/set") REGISTER("iii", led_ring_set_handler); METHOD("ring/all") REGISTER("ii", led_ring_all_handler); METHOD("ring/map") REGISTER("i" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii" "iiiiiiii", led_ring_map_handler); METHOD("ring/range") REGISTER("iiii", led_ring_range_handler); METHOD("tilt/set") REGISTER("ii", tilt_set_handler); #undef REGISTER }
OP_ERROR SOP_PrimCentroid::cookMySop(OP_Context &context) { fpreal now; int method; const GA_Attribute *source_attr; const GA_AttributeDict *dict; GA_AttributeDict::iterator a_it; GA_Offset ptOff; GA_RWAttributeRef n_gah; GA_RWHandleV3 n_h; const GEO_Primitive *prim; const GU_Detail *input_geo; UT_BoundingBox bbox; UT_String pattern, attr_name; UT_WorkArgs tokens; now = context.getTime(); if (lockInputs(context) >= UT_ERROR_ABORT) return error(); // Clear out any previous data. gdp->clearAndDestroy(); // Get the input geometry as read only. GU_DetailHandleAutoReadLock gdl(inputGeoHandle(0)); input_geo = gdl.getGdp(); // Find out which calculation method we are attempting. method = METHOD(now); // Create the standard point normal (N) attribute. n_gah = gdp->addNormalAttribute(GA_ATTRIB_POINT); // Bind a read/write attribute handle to the normal attribute. n_h.bind(n_gah.getAttribute()); // Construct an attribute reference map to map attributes. GA_AttributeRefMap hmap(*gdp, input_geo); // Get the attribute selection string. ATTRIBUTES(pattern, now); // Make sure we entered something. if (pattern.length() > 0) { // Tokenize the pattern. pattern.tokenize(tokens, " "); // The primitive attributes on the incoming geometry. dict = &input_geo->primitiveAttribs(); // Iterate over all the primitive attributes. for (a_it=dict->begin(GA_SCOPE_PUBLIC); !a_it.atEnd(); ++a_it) { // The current attribute. source_attr = a_it.attrib(); // Get the attribute name. attr_name = source_attr->getName(); // If the name doesn't match our pattern, skip it. if (!attr_name.matchPattern(tokens)) continue; // Create a new point attribute on the current geometry // that is the same as the source attribute. Append it and // the source to the map. hmap.append(gdp->addPointAttrib(source_attr).getAttribute(), source_attr); } // Copy local variables. if (COPY(now)) { // Traverse the variable names on the input geometry and attempt to // copy any that match to our new geometry. input_geo->traverseVariableNames( SOP_PrimCentroid::copyLocalVariables, gdp ); } } // Get the list of input primitives. const GA_PrimitiveList &prim_list = input_geo->getPrimitiveList(); // Add points for each primitive. ptOff = gdp->appendPointBlock(input_geo->getNumPrimitives()); // Iterate over primitives using pages. for (GA_Iterator it(input_geo->getPrimitiveRange()); !it.atEnd(); ++it) { // Get the primitive from the list. prim = (const GEO_Primitive *) prim_list.get(*it); if (method) { // Get the bounding box for the primitive and set the point's // position to be the center of the box. prim->getBBox(&bbox); gdp->setPos3(ptOff, bbox.center()); } else // Set the point's position to be the bary center of the primitive gdp->setPos3(ptOff, prim->baryCenter()); // Set the point's normal to be the normal of the primitive. n_h.set(ptOff, prim->computeNormal()); // If we are copying attributes, copy the primitive attributes from // the current primitive to the new point. if (hmap.entries() > 0) hmap.copyValue(GA_ATTRIB_POINT, ptOff, GA_ATTRIB_PRIMITIVE, *it); // Increment the point offset. ptOff++; } unlockInputs(); return error(); }
if (err < 0) { free(trans); Error_set(err); return NULL; } py_trans = to_unicode(trans, NULL, NULL); free(trans); return py_trans; } PyMethodDef Refspec_methods[] = { METHOD(Refspec, src_matches, METH_O), METHOD(Refspec, dst_matches, METH_O), METHOD(Refspec, transform, METH_O), METHOD(Refspec, rtransform, METH_O), {NULL} }; PyGetSetDef Refspec_getseters[] = { GETTER(Refspec, direction), GETTER(Refspec, src), GETTER(Refspec, dst), GETTER(Refspec, string), GETTER(Refspec, force), {NULL} };
git_remote_list(&remotes, self->repo); py_list = PyList_New(remotes.count); for (i=0; i < remotes.count; ++i) { py_tmp = INSTANCIATE_CLASS(RemoteType, Py_BuildValue("Os", self, remotes.strings[i])); PyList_SetItem(py_list, i, py_tmp); } git_strarray_free(&remotes); return py_list; } PyMethodDef Repository_methods[] = { METHOD(Repository, create_blob, METH_VARARGS), METHOD(Repository, create_blob_fromfile, METH_VARARGS), METHOD(Repository, create_commit, METH_VARARGS), METHOD(Repository, create_tag, METH_VARARGS), METHOD(Repository, TreeBuilder, METH_VARARGS), METHOD(Repository, walk, METH_VARARGS), METHOD(Repository, read, METH_O), METHOD(Repository, write, METH_VARARGS), METHOD(Repository, create_reference, METH_VARARGS|METH_KEYWORDS), METHOD(Repository, listall_references, METH_VARARGS), METHOD(Repository, lookup_reference, METH_O), METHOD(Repository, packall_references, METH_NOARGS), METHOD(Repository, revparse_single, METH_O), METHOD(Repository, status, METH_NOARGS), METHOD(Repository, status_file, METH_O), METHOD(Repository, remote_create, METH_VARARGS),
PyObject_Del(self); } PyGetSetDef Diff_getseters[] = { GETTER(Diff, patch), {NULL} }; PyMappingMethods Diff_as_mapping = { (lenfunc)Diff_len, /* mp_length */ (binaryfunc)Diff_getitem, /* mp_subscript */ 0, /* mp_ass_subscript */ }; static PyMethodDef Diff_methods[] = { METHOD(Diff, merge, METH_VARARGS), METHOD(Diff, find_similar, METH_VARARGS), {NULL} }; PyDoc_STRVAR(Diff__doc__, "Diff objects."); PyTypeObject DiffType = { PyVarObject_HEAD_INIT(NULL, 0) "_pygit2.Diff", /* tp_name */ sizeof(Diff), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)Diff_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */
0, /* sq_repeat */ 0, /* sq_item */ 0, /* sq_slice */ 0, /* sq_ass_item */ 0, /* sq_ass_slice */ (objobjproc)Tree_contains, /* sq_contains */ }; PyMappingMethods Tree_as_mapping = { (lenfunc)Tree_len, /* mp_length */ (binaryfunc)Tree_getitem, /* mp_subscript */ 0, /* mp_ass_subscript */ }; PyMethodDef Tree_methods[] = { METHOD(Tree, diff, METH_VARARGS | METH_KEYWORDS), {NULL} }; PyDoc_STRVAR(Tree__doc__, "Tree objects."); PyTypeObject TreeType = { PyVarObject_HEAD_INIT(NULL, 0) "_pygit2.Tree", /* tp_name */ sizeof(Tree), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */
static void source_p(int argc, const char **argv) { if (argc < 2) { haltest_error("No file specified"); return; } process_file(argv[1]); } /* Commands available without interface */ static struct method commands[] = { STD_METHODCH(help, "[<interface>]"), STD_METHOD(quit), METHOD("exit", quit_p, NULL, NULL), STD_METHODH(source, "<file>"), END_METHOD }; /* Gets comman by name */ struct method *get_command(const char *name) { return get_method(commands, name); } /* Function to enumerate interface names */ const char *interface_name(void *v, int i) { return interfaces[i] ? interfaces[i]->name : NULL; }
git_odb_object_data(obj), git_odb_object_size(obj)); git_odb_object_free(obj); return aux; } PyGetSetDef Object_getseters[] = { GETTER(Object, oid), GETTER(Object, hex), GETTER(Object, type), {NULL} }; PyMethodDef Object_methods[] = { METHOD(Object, read_raw, METH_NOARGS), {NULL} }; PyDoc_STRVAR(Object__doc__, "Base class for Git objects."); PyTypeObject ObjectType = { PyVarObject_HEAD_INIT(NULL, 0) "_pygit2.Object", /* tp_name */ sizeof(Object), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)Object_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */