0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ NETRESOURCE_new, /* tp_new */ }; #define OFF(e) offsetof(PyNETRESOURCE, e) struct PyMemberDef PyNETRESOURCE::members[] = { // Note we avoid the use of 'U'nsigned types as they always force // a long to be returned. {"dwScope", T_INT, OFF(m_nr.dwScope), 0}, // @prop integer|dwScope| {"dwType", T_INT, OFF(m_nr.dwType), 0}, // @prop integer|dwType| {"dwDisplayType", T_INT, OFF(m_nr.dwDisplayType), 0}, // @prop integer|dwDisplayType| {"dwUsage", T_INT, OFF(m_nr.dwUsage), 0}, // @prop integer|dwUsage| // These are handled by getattro/setattro {"lpLocalName", T_STRING, OFF(m_nr.lpLocalName), 0}, // @prop string|localName| {"lpRemoteName",T_STRING, OFF(m_nr.lpRemoteName), 0},// @prop string|remoteName| {"lpComment", T_STRING, OFF(m_nr.lpComment), 0},// @prop string|comment| {"lpProvider", T_STRING, OFF(m_nr.lpProvider), 0},// @prop string|provider| {NULL} // @comm Note that in pywin32-212 and earlier, the string attributes // were always strings, but empty strings when the underlying Windows // structure had NULL. On later pywin32 builds, these string attributes will // return None in such cases. };
/* Frame object implementation */ #include "Python.h" #include "pycore_object.h" #include "pycore_pystate.h" #include "code.h" #include "frameobject.h" #include "opcode.h" #include "structmember.h" #define OFF(x) offsetof(PyFrameObject, x) static PyMemberDef frame_memberlist[] = { {"f_back", T_OBJECT, OFF(f_back), READONLY}, {"f_code", T_OBJECT, OFF(f_code), READONLY}, {"f_builtins", T_OBJECT, OFF(f_builtins), READONLY}, {"f_globals", T_OBJECT, OFF(f_globals), READONLY}, {"f_lasti", T_INT, OFF(f_lasti), READONLY}, {"f_trace_lines", T_BOOL, OFF(f_trace_lines), 0}, {"f_trace_opcodes", T_BOOL, OFF(f_trace_opcodes), 0}, {NULL} /* Sentinel */ }; static PyObject * frame_getlocals(PyFrameObject *f, void *closure) { if (PyFrame_FastToLocalsWithError(f) < 0) return NULL; Py_INCREF(f->f_locals); return f->f_locals;
filename_ob, /* filename */ funcname_ob, /* name */ firstlineno, /* firstlineno */ emptystring /* lnotab */ ); failed: Py_XDECREF(funcname_ob); Py_XDECREF(filename_ob); return result; } #define OFF(x) offsetof(PyCodeObject, x) static PyMemberDef code_memberlist[] = { {"co_argcount", T_INT, OFF(co_argcount), READONLY}, {"co_kwonlyargcount", T_INT, OFF(co_kwonlyargcount), READONLY}, {"co_nlocals", T_INT, OFF(co_nlocals), READONLY}, {"co_stacksize",T_INT, OFF(co_stacksize), READONLY}, {"co_flags", T_INT, OFF(co_flags), READONLY}, {"co_code", T_OBJECT, OFF(co_code), READONLY}, {"co_consts", T_OBJECT, OFF(co_consts), READONLY}, {"co_names", T_OBJECT, OFF(co_names), READONLY}, {"co_varnames", T_OBJECT, OFF(co_varnames), READONLY}, {"co_freevars", T_OBJECT, OFF(co_freevars), READONLY}, {"co_cellvars", T_OBJECT, OFF(co_cellvars), READONLY}, {"co_filename", T_OBJECT, OFF(co_filename), READONLY}, {"co_name", T_OBJECT, OFF(co_name), READONLY}, {"co_firstlineno", T_INT, OFF(co_firstlineno), READONLY}, {"co_lnotab", T_OBJECT, OFF(co_lnotab), READONLY}, {NULL} /* Sentinel */
} else { PyErr_SetString(PyExc_SystemError, "non-dict annotations"); return -1; } Py_XSETREF(((PyFunctionObject *)op)->func_annotations, annotations); return 0; } /* Methods */ #define OFF(x) offsetof(PyFunctionObject, x) static PyMemberDef func_memberlist[] = { {"__closure__", T_OBJECT, OFF(func_closure), RESTRICTED|READONLY}, {"__doc__", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED}, {"__globals__", T_OBJECT, OFF(func_globals), RESTRICTED|READONLY}, {"__module__", T_OBJECT, OFF(func_module), PY_WRITE_RESTRICTED}, {NULL} /* Sentinel */ }; static PyObject * func_get_code(PyFunctionObject *op, void *Py_UNUSED(ignored)) { Py_INCREF(op->func_code); return op->func_code; }
/* - find - find a match for the main NFA (no-complications case) ^ static int find(struct vars *, struct cnfa *, struct colormap *); */ static int find( struct vars *v, struct cnfa *cnfa, struct colormap *cm) { struct dfa *s; struct dfa *d; chr *begin; chr *end = NULL; chr *cold; chr *open; /* Open and close of range of possible * starts */ chr *close; int hitend; int shorter = (v->g->tree->flags&SHORTER) ? 1 : 0; /* * First, a shot with the search RE. */ s = newdfa(v, &v->g->search, cm, &v->dfa1); assert(!(ISERR() && s != NULL)); NOERR(); MDEBUG(("\nsearch at %ld\n", LOFF(v->start))); cold = NULL; close = shortest(v, s, v->start, v->start, v->stop, &cold, NULL); freedfa(s); NOERR(); if (v->g->cflags®_EXPECT) { assert(v->details != NULL); if (cold != NULL) { v->details->rm_extend.rm_so = OFF(cold); } else { v->details->rm_extend.rm_so = OFF(v->stop); } v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ } if (close == NULL) { /* not found */ return REG_NOMATCH; } if (v->nmatch == 0) { /* found, don't need exact location */ return REG_OKAY; } /* * Find starting point and match. */ assert(cold != NULL); open = cold; cold = NULL; MDEBUG(("between %ld and %ld\n", LOFF(open), LOFF(close))); d = newdfa(v, cnfa, cm, &v->dfa1); assert(!(ISERR() && d != NULL)); NOERR(); for (begin = open; begin <= close; begin++) { MDEBUG(("\nfind trying at %ld\n", LOFF(begin))); if (shorter) { end = shortest(v, d, begin, begin, v->stop, NULL, &hitend); } else { end = longest(v, d, begin, v->stop, &hitend); } NOERR(); if (hitend && cold == NULL) { cold = begin; } if (end != NULL) { break; /* NOTE BREAK OUT */ } } assert(end != NULL); /* search RE succeeded so loop should */ freedfa(d); /* * And pin down details. */ assert(v->nmatch > 0); v->pmatch[0].rm_so = OFF(begin); v->pmatch[0].rm_eo = OFF(end); if (v->g->cflags®_EXPECT) { if (cold != NULL) { v->details->rm_extend.rm_so = OFF(cold); } else { v->details->rm_extend.rm_so = OFF(v->stop); } v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ } if (v->nmatch == 1) { /* no need for submatches */ return REG_OKAY; } /* * Submatches. */ zapsubs(v->pmatch, v->nmatch); return dissect(v, v->g->tree, begin, end); }
#define AC_NO_MINS KC_SLSH #define AC_NO_PIPE KC_GRAVE const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { KEYMAP( /* 0: mostly letters */ Q, W, E, R, T, /*|,, |*/ Y, U, I, O, P, \ A, S, D, F, G, /*|,, |*/ H, J, K, L, COMM, \ Z, X, C, V, B, /*|,, |*/ N, M, COMM, DOT, KP_SLASH, \ ESC, TAPT(3), OSM(LGUI), OSM(LSFT), MK(LCTL,BSPC), TAPT(1), TAPT(2), MK(LALT,SPC), TACK(TAB), TACSK(SLSH), SH(2), ENT ), KEYMAP( /* layer one is mostly for programming and shell. lots of idea shortcute on left, not sure how much i will use them.*/ ACK(7), CTRL(W), NO_AE, SH(F10), ACSK(L), SH(NO_ACNT), RA(7), RA(0), NO_OE, SH(1), \ NO_AA, ACK(LEFT), CSK(ENT), ACK(RIGHT), ALT(INS), 0, SH(8), SH(9), NO_PIPE, RA(4), \ CSK(A), CSK(F), ACSK(T), ALT(V), CTRL(F9), SH(NO_BSLS), RA(8), RA(9), SH(6), RA(NO_ACNT), \ ESC, TRNS, OSM(LGUI), OSM(LSFT), TRNS, TRNS, TRNS, SPC, OFF(1),RA(2), NO_QUOTE,KP_EQUAL ), KEYMAP( /* hold space brings up move pad and numpad */ INS, HOME, UP , END , PGUP, SH(5), 7 , 8 , 9, SH(NO_QUOTE), \ DEL, LEFT, DOWN, RIGHT, PGDN, NO_MINS, 4 , 5 , 6, NO_PLUS, \ GUI(1), GUI(2), GUI(3), GUI(4), GUI(5), RA(4), 1 , 2 , 3, NO_BSLS, \ ACK(DEL), TRNS, OSM(LGUI), OSM(LSFT), GUI(D) , TRNS, TRNS, MK(LALT,SPC), OFF(1), DOT, 0, KP_EQUAL ), KEYMAP( /* hold tab to have fpad and mouse */ F1, F2, F3, F4, F5, WH_D , BTN1 , MS_U , BTN2 , SH(3) , \ F6, F7, F8, F9, F10, WH_U , MS_L , MS_D , MS_R , BTN3 , \ F11, F12, F13, F14, BOOT, NO , ACL0 , NO_LT, SH(NO_LT) , BTN4 , \ BOOT, TRNS, OSM(LGUI), OSM(LSFT), MK(LCTL,BSPC), TRNS, TRNS, MK(LALT,SPC), TACK(TAB),TACSK(MINS) , SH(NO_BSLS), KP_EQUAL ),
PyVARDESC::members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; #define OFF(e) offsetof(PyVARDESC, e) /*static*/ struct PyMemberDef PyVARDESC::members[] = { {"memid", T_INT, OFF(memid)}, // @prop int|memid|The dispid of the member {"value", T_OBJECT,OFF(value)}, // @prop int/object|value|A value for the variant. If PERINSTANCE then an offset into the instance, otherwise a variant converted to a Python object. {"elemdescVar", T_OBJECT,OFF(elemdescVar)}, // @prop <o ELEMDESC>|elemdescVar|Object describing the member. {"wVarFlags", T_INT, OFF(wVarFlags)}, // @prop int|varFlags|Variable flags {"varkind", T_INT, OFF(varkind)}, // @prop int|varkind|Kind flags. {NULL} }; PyVARDESC::PyVARDESC() { ob_type = &PyVARDESC::Type; _Py_NewReference(this); memid = 0; value = NULL; elemdescVar = NULL;
} else { PyErr_SetString(PyExc_SystemError, "non-tuple default args"); return -1; } Py_XDECREF(((PyFunctionObject *) op) -> func_defaults); ((PyFunctionObject *) op) -> func_defaults = defaults; return 0; } /* Methods */ #define OFF(x) offsetof(PyFunctionObject, x) static struct memberlist func_memberlist[] = { {"func_code", T_OBJECT, OFF(func_code)}, {"func_globals",T_OBJECT, OFF(func_globals), READONLY}, {"func_name", T_OBJECT, OFF(func_name), READONLY}, {"__name__", T_OBJECT, OFF(func_name), READONLY}, {"func_defaults",T_OBJECT, OFF(func_defaults)}, {"func_doc", T_OBJECT, OFF(func_doc)}, {"__doc__", T_OBJECT, OFF(func_doc)}, {NULL} /* Sentinel */ }; static PyObject * func_getattr(PyFunctionObject *op, char *name) { if (name[0] != '_' && PyEval_GetRestricted()) { PyErr_SetString(PyExc_RuntimeError, "function attributes not accessible in restricted mode");
/* * cfindloop - the heart of cfind */ static int cfindloop(struct vars * v, struct cnfa * cnfa, struct colormap * cm, struct dfa * d, struct dfa * s, chr **coldp) /* where to put coldstart pointer */ { chr *begin; chr *end; chr *cold; chr *open; /* open and close of range of possible starts */ chr *close; chr *estart; chr *estop; int er; int shorter = v->g->tree->flags & SHORTER; int hitend; assert(d != NULL && s != NULL); cold = NULL; close = v->search_start; do { MDEBUG(("\ncsearch at %ld\n", LOFF(close))); close = shortest(v, s, close, close, v->stop, &cold, (int *) NULL); if (close == NULL) break; /* NOTE BREAK */ assert(cold != NULL); open = cold; cold = NULL; MDEBUG(("cbetween %ld and %ld\n", LOFF(open), LOFF(close))); for (begin = open; begin <= close; begin++) { MDEBUG(("\ncfind trying at %ld\n", LOFF(begin))); estart = begin; estop = v->stop; for (;;) { if (shorter) end = shortest(v, d, begin, estart, estop, (chr **) NULL, &hitend); else end = longest(v, d, begin, estop, &hitend); if (hitend && cold == NULL) cold = begin; if (end == NULL) break; /* NOTE BREAK OUT */ MDEBUG(("tentative end %ld\n", LOFF(end))); zapallsubs(v->pmatch, v->nmatch); er = cdissect(v, v->g->tree, begin, end); if (er == REG_OKAY) { if (v->nmatch > 0) { v->pmatch[0].rm_so = OFF(begin); v->pmatch[0].rm_eo = OFF(end); } *coldp = cold; return REG_OKAY; } if (er != REG_NOMATCH) { ERR(er); *coldp = cold; return er; } /* try next shorter/longer match with same begin point */ if (shorter) { if (end == estop) break; /* NOTE BREAK OUT */ estart = end + 1; } else { if (end == begin) break; /* NOTE BREAK OUT */ estop = end - 1; } } /* end loop over endpoint positions */ } /* end loop over beginning positions */ } while (close < v->stop); *coldp = cold; return REG_NOMATCH; }
/* Note: member types are set in the initshm function. Members which need separate processing are: - addr --> it is not part of the shmid_ds structure - attached --> function depending on addr - nattch --> system dependent declaration in shmid_ds (unknown type) - perm --> return permission (lower 9) bits only of ds.shm_perm.mode */ static struct memberlist memory_memberlist[] = { {"cgid", T_INT, OFF2(cgid), RO}, /* 0 (gid_t) */ {"cpid", T_INT, OFF1(shm_cpid), RO}, /* 1 (pid_t) */ {"cuid", T_INT, OFF2(cuid), RO}, /* 2 (uid_t) */ {"key", T_INT, OFF2(key), RO}, /* 3 (key_t) */ {"lpid", T_INT, OFF1(shm_lpid), RO}, /* 4 (pid_t) */ {"shmid", T_INT, OFF(shmid), RO}, /* 5 (int) */ {"size", T_INT, OFF1(shm_segsz), RO}, /* 6 (int) */ {"gid", T_INT, OFF2(gid), RO}, /* 7 (gid_t) */ {"uid", T_INT, OFF2(uid), RO}, /* 8 (uid_t) */ /* The following members are implemented without this table */ {"addr", T_INT, 0, RO}, /* 9 (void *) */ {"attached",T_INT, 0, RO}, /* 10 (int) */ {"nattch", T_INT, 0, RO}, /* 11 sys.dep. */ {"perm", T_INT, 0, RO}, /* 12 (mode_t) */ {NULL} /* sentinel */ }; #undef OFF #undef OFF1 #undef OFF2
//# MENU feldtest void feld_menu(){ getInputWaitRelease(); SETUPgout(BY_AMP); SETUPgout(BY_AMP_N); SETUPgout(TX_RX); SETUPgout(TX_RX_N); SETUPgout(BY_MIX); SETUPgout(BY_MIX_N); SETUPgout(LOW_HIGH_FILT); SETUPgout(LOW_HIGH_FILT_N); SETUPgout(TX_AMP); SETUPgout(RX_LNA); SETUPgout(CE_VCO); SETUPgout(MIXER_EN); char tu=0,td=0,tl=0,tr=0; char tuN=0,tdN=0,tlN=0,trN=0; char page=0; char tu2=0,td2=0,td2N=0,tl2=0,tr2=0; uint16_t sf=3500; char tu3=0,td3=0,tl3=0,tr3=0; int ctr=0; while (1) { lcdClear(0xff); lcdPrintln("Feld-Test v12"); lcdPrintln(""); lcdPrint("Page ");lcdPrintln(IntToStr(page,2,0)); if (page==0){ tu=GET(BY_MIX); tuN=GET(BY_MIX_N); lcdPrint(IntToStr(tu,1,F_HEX)); lcdPrint(IntToStr(tuN,1,F_HEX)); lcdPrintln(" Up BY_MIX/_N"); td=GET(BY_AMP); tdN=GET(BY_AMP_N); lcdPrint(IntToStr(td,1,F_HEX)); lcdPrint(IntToStr(tdN,1,F_HEX)); lcdPrintln(" Dn BY_AMP/_N"); tl=GET(TX_RX);tlN=GET(TX_RX_N); lcdPrint(IntToStr(tl,1,F_HEX)); lcdPrint(IntToStr(tlN,1,F_HEX)); lcdPrintln(" Lt TX_RX/_N"); tr=GET(LOW_HIGH_FILT); trN=GET(LOW_HIGH_FILT_N); lcdPrint(IntToStr(tr,1,F_HEX)); lcdPrint(IntToStr(trN,1,F_HEX)); lcdPrintln(" Rt LOW_HIGH_FILT/_N"); lcdPrintln("Enter for next page"); lcdDisplay(); switch(getInput()){ case BTN_UP: tu=1-tu; if (tu){ OFF(BY_MIX_N); ON(BY_MIX); }else{ OFF(BY_MIX); ON(BY_MIX_N); }; break; case BTN_DOWN: td=1-td; if (td){ OFF(BY_AMP_N); ON(BY_AMP); }else{ OFF(BY_AMP); ON(BY_AMP_N); }; break; case BTN_LEFT: tl=1-tl; if (tl){ OFF(TX_RX_N); ON(TX_RX); }else{ OFF(TX_RX); ON(TX_RX_N); }; break; case BTN_RIGHT: tr=1-tr; if (tr){ OFF(LOW_HIGH_FILT_N); ON(LOW_HIGH_FILT); }else{ OFF(LOW_HIGH_FILT); ON(LOW_HIGH_FILT_N); }; break; case BTN_ENTER: page++; break; }; }else if (page==1){ lcdPrint(" "); lcdPrintln(" Up "); td2=GET(RX_LNA);td2N=GET(TX_AMP); lcdPrint(IntToStr(td2,1,F_HEX)); lcdPrint(IntToStr(td2N,1,F_HEX)); lcdPrintln(" Dn RX/TX"); lcdPrint(IntToStr(tl2,1,F_HEX)); lcdPrint(" "); lcdPrintln(" Lt MIXER_EN"); lcdPrint(IntToStr(tr2,1,F_HEX)); lcdPrint(" "); if(tr2){ lcdPrintln(" Rt SI-clk_dis"); }else{ lcdPrintln(" Rt SI-clk_en"); }; lcdPrintln("Enter for next page"); lcdDisplay(); switch(getInput()){ case BTN_UP: tu2=1-tu2; if (tu2){ ; }else{ ; }; break; case BTN_DOWN: td2=td2+2*td2N; td2++; td2=td2%3; switch (td2){ case(0): OFF(RX_LNA); OFF(TX_AMP); break; case(1): ON(RX_LNA); OFF(TX_AMP); break; case(2): OFF(RX_LNA); ON(TX_AMP); break; }; break; case BTN_LEFT: tl2=1-tl2; if (tl2){ ON(MIXER_EN); }else{ OFF(MIXER_EN); }; break; case BTN_RIGHT: tr2=1-tr2; if (tr2){ si5351c_power_down_all_clocks(); }else{ si5351c_set_clock_source(PLL_SOURCE_XTAL); }; break; case BTN_ENTER: page++; break; }; }else if (page==2){ lcdPrint("SF: ");lcdPrint(IntToStr(sf,4,F_LONG)); lcdPrintln(" MHz"); tl3=GET(CE_VCO); lcdPrint(IntToStr(tl3,1,F_HEX)); lcdPrint(" "); lcdPrintln(" Lt CE_VCO"); lcdPrint(" "); lcdPrintln(" Rt "); lcdPrintln("Enter for next page"); lcdDisplay(); switch(getInput()){ case BTN_UP: sf+=100; mixer_set_frequency(sf); break; case BTN_DOWN: sf-=100; mixer_set_frequency(sf); break; case BTN_LEFT: tl3=1-tl3; if (tl3){ ON(CE_VCO); mixer_setup(); mixer_set_frequency(sf); }else{ OFF(CE_VCO); }; break; case BTN_RIGHT: tr3=1-tr3; if (tr3){ ; }else{ ; }; break; case BTN_ENTER: page++; break; }; }; if (page>2){page=0;} ON(LED1); delay(200000); OFF(LED1); delay(200000); // ctr++; lcdNl(); lcdPrint(IntToStr(ctr,4,F_HEX)); lcdDisplay(); } };
0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; #define OFF(e) offsetof(PyPERF_COUNTER_DEFINITION, e) /*static*/ struct PyMemberDef PyPERF_COUNTER_DEFINITION::members[] = { {"DefaultScale", T_LONG, OFF(m_DefaultScale)}, // @prop integer|DefaultScale|The default scale of the counter. {"DetailLevel", T_LONG, OFF(m_DetailLevel)}, // @prop integer|DetailLevel|The detail level of the counter. {"CounterType", T_LONG, OFF(m_CounterType)}, // @prop integer|CounterType|The counter type. {"CounterNameTitleIndex", T_LONG, OFF(m_CounterNameTitleIndex)}, // @prop integer|CounterNameTitleIndex| {"CounterHelpTitleIndex", T_LONG, OFF(m_CounterHelpTitleIndex)}, // @prop integer|CounterHelpTitleIndex| {NULL} /* Sentinel */ }; PyPERF_COUNTER_DEFINITION::PyPERF_COUNTER_DEFINITION(DWORD counterNameTitleIndex) { ob_type = &type; _Py_NewReference(this); m_pPCD = NULL; m_DefaultScale = 0; m_DetailLevel = PERF_DETAIL_NOVICE; m_CounterNameTitleIndex = counterNameTitleIndex;
static PyObject *Nuitka_Method_get__doc__( Nuitka_MethodObject *method, void *closure ) { return INCREASE_REFCOUNT( method->m_function->m_doc ); } static PyGetSetDef Nuitka_Method_getsets[] = { { (char *)"__doc__", (getter)Nuitka_Method_get__doc__, NULL, NULL }, { NULL } }; #define OFF( x ) offsetof( Nuitka_MethodObject, x ) static PyMemberDef Nuitka_Method_members[] = { { (char *)"im_class", T_OBJECT, OFF( m_class ), READONLY | RESTRICTED, (char *)"the class associated with a method"}, { (char *)"im_func", T_OBJECT, OFF( m_function ), READONLY | RESTRICTED, (char *)"the function (or other callable) implementing a method" }, { (char *)"__func__", T_OBJECT, OFF( m_function ), READONLY | RESTRICTED, (char *)"the function (or other callable) implementing a method" }, { (char *)"im_self", T_OBJECT, OFF( m_object ), READONLY | RESTRICTED, (char *)"the instance to which a method is bound; None for unbound method" }, { (char *)"__self__", T_OBJECT, OFF( m_object ), READONLY | RESTRICTED, (char *)"the instance to which a method is bound; None for unbound method" }, { NULL } }; static PyObject *Nuitka_Method_reduce( Nuitka_MethodObject *method ) { PyObject *result = PyTuple_New(2); PyTuple_SET_ITEM( result, 0, INCREASE_REFCOUNT( (PyObject *)Py_TYPE( method ) ) ); PyObject *arg1 = PyTuple_New(2); PyTuple_SET_ITEM( result, 1, arg1 ); PyTuple_SET_ITEM( arg1, 0, INCREASE_REFCOUNT( (PyObject *)method->m_function ) );
static PySequenceMethods DataBuf_as_sequence = { DataBuf_length, /*sq_length*/ DataBuf_concat, /*sq_concat*/ DataBuf_repeat, /*sq_repeat*/ DataBuf_item, /*sq_item*/ DataBuf_slice, /*sq_slice*/ DataBuf_ass_item, /*sq_ass_item*/ DataBuf_ass_slice, /*sq_ass_slice*/ }; /* Code to access structure members by accessing attributes */ #define OFF(x) offsetof(DataBufObj, x) static struct memberlist DataBuf_memberlist[] = { { "name", T_STRING_INPLACE, OFF(fmt.name) }, /* faked */ { "datatype", T_INT, OFF(fmt.datatype), RO }, { "format", T_INT, OFF(fmt.format) }, { "maxlength", T_INT, OFF(fmt.maxlength), RO }, { "scale", T_INT, OFF(fmt.scale), RO }, { "precision", T_INT, OFF(fmt.precision), RO }, { "status", T_INT, OFF(fmt.status) }, { "count", T_INT, OFF(fmt.count), RO }, { "usertype", T_INT, OFF(fmt.usertype), RO }, { "strip", T_INT, OFF(strip) }, { NULL } /* Sentinel */ }; static PyObject *DataBuf_getattr(DataBufObj *self, char *name) { PyObject *rv;
static void ste_dealloc(PySTEntryObject *ste) { ste->ste_table = NULL; Py_XDECREF(ste->ste_id); Py_XDECREF(ste->ste_name); Py_XDECREF(ste->ste_symbols); Py_XDECREF(ste->ste_varnames); Py_XDECREF(ste->ste_children); PyObject_Del(ste); } #define OFF(x) offsetof(PySTEntryObject, x) static PyMemberDef ste_memberlist[] = { {"id", T_OBJECT, OFF(ste_id), READONLY}, {"name", T_OBJECT, OFF(ste_name), READONLY}, {"symbols", T_OBJECT, OFF(ste_symbols), READONLY}, {"varnames", T_OBJECT, OFF(ste_varnames), READONLY}, {"children", T_OBJECT, OFF(ste_children), READONLY}, {"optimized",T_INT, OFF(ste_unoptimized), READONLY}, {"nested", T_INT, OFF(ste_nested), READONLY}, {"type", T_INT, OFF(ste_type), READONLY}, {"lineno", T_INT, OFF(ste_lineno), READONLY}, {NULL} }; PyTypeObject PySTEntry_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "symtable entry", sizeof(PySTEntryObject),
} Py_INCREF(Py_None); return Py_None; } /* * tables for python, to access various attributes */ #define OFF(x) offsetof(SKCurveObject, x) static struct memberlist curve_memberlist[] = { {"len", T_INT, OFF(len), RO}, {"closed", T_BYTE, OFF(closed), RO}, {NULL} }; /* for maximum performance, this list should contain the methods called most frequently at the beginning */ static struct PyMethodDef curve_methods[] = { {"draw_transformed",(PyCFunction)SKCurve_PyDrawTransformed, 1}, {"hit_point", (PyCFunction)curve_hit_point, 1}, {"accurate_rect", (PyCFunction)curve_accurate_rect, 1}, {"coord_rect", (PyCFunction)curve_coord_rect, 1}, /* new method names */
_Py_IDENTIFIER(path); static PyObject * tb_dir(PyTracebackObject *self) { return Py_BuildValue("[ssss]", "tb_frame", "tb_next", "tb_lasti", "tb_lineno"); } static PyMethodDef tb_methods[] = { {"__dir__", (PyCFunction)tb_dir, METH_NOARGS}, {NULL, NULL, 0, NULL}, }; static PyMemberDef tb_memberlist[] = { {"tb_next", T_OBJECT, OFF(tb_next), READONLY}, {"tb_frame", T_OBJECT, OFF(tb_frame), READONLY}, {"tb_lasti", T_INT, OFF(tb_lasti), READONLY}, {"tb_lineno", T_INT, OFF(tb_lineno), READONLY}, {NULL} /* Sentinel */ }; static void tb_dealloc(PyTracebackObject *tb) { PyObject_GC_UnTrack(tb); Py_TRASHCAN_SAFE_BEGIN(tb) Py_XDECREF(tb->tb_next); Py_XDECREF(tb->tb_frame); PyObject_GC_Del(tb); Py_TRASHCAN_SAFE_END(tb)
#include "Python.h" #include "code.h" #include "frameobject.h" #include "opcode.h" #include "structmember.h" #undef MIN #undef MAX #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define OFF(x) offsetof(PyFrameObject, x) static PyMemberDef frame_memberlist[] = { {"f_back", T_OBJECT, OFF(f_back), READONLY}, {"f_code", T_OBJECT, OFF(f_code), READONLY}, {"f_builtins", T_OBJECT, OFF(f_builtins),READONLY}, {"f_globals", T_OBJECT, OFF(f_globals), READONLY}, {"f_lasti", T_INT, OFF(f_lasti), READONLY}, {NULL} /* Sentinel */ }; static PyObject * frame_getlocals(PyFrameObject *f, void *closure) { PyFrame_FastToLocals(f); Py_INCREF(f->f_locals); return f->f_locals; }
PyDSCBUFFERDESC::members, 0, // tp_getset; 0, // tp_base; 0, // tp_dict; 0, // tp_descr_get; 0, // tp_descr_set; 0, // tp_dictoffset; 0, // tp_init; 0, // tp_alloc; 0 // newfunc tp_new; }; #define OFF(e) offsetof(PyDSCBUFFERDESC, e) /*static*/ struct PyMemberDef PyDSCBUFFERDESC::members[] = { {"dwFlags", T_INT, OFF(m_dscbd.dwFlags), 0, "Identifies the capabilities to include when creating a new DirectSoundBuffer object"}, // @prop integer|dwFlags|Identifies the capabilities to include when creating a new DirectSoundBuffer object. Can be zero or the following flag: // @flagh Flag|Description // @flag DSCBCAPS_WAVEMAPPED|The Win32 wave mapper will be used for formats not supported by the device. {"dwBufferBytes", T_INT, OFF(m_dscbd.dwBufferBytes), 0, "Size of the new buffer, in bytes. This value must be 0 when creating primary buffers. For secondary buffers, the minimum and maximum sizes allowed are specified by DSBSIZE_MIN and DSBSIZE_MAX"}, // @prop integer|dwBufferBytes|Size of the new buffer, in bytes. This value must be 0 when creating primary buffers. For secondary buffers, the minimum and maximum sizes allowed are specified by DSBSIZE_MIN and DSBSIZE_MAX. {"lpwfxFormat", T_OBJECT, OFF(m_obWFX), 0, "Structure specifying the waveform format for the buffer. This value must be None for primary buffers. The application can use IDirectSoundCaptureBuffer::SetFormat to set the format of the primary buffer."}, // @prop WAVEFORMATEX|lpwfxFormat|Structure specifying the waveform format for the buffer. This value must be None for primary buffers. The application can use IDirectSoundBuffer::SetFormat to set the format of the primary buffer. {NULL} /* Sentinel */ }; PyDSCBUFFERDESC::PyDSCBUFFERDESC(void) { ob_type = &PyDSCBUFFERDESCType; _Py_NewReference(this); memset(&m_dscbd, 0, sizeof(m_dscbd));
partial_traverse(partialobject *pto, visitproc visit, void *arg) { Py_VISIT(pto->fn); Py_VISIT(pto->args); Py_VISIT(pto->kw); Py_VISIT(pto->dict); return 0; } PyDoc_STRVAR(partial_doc, "partial(func, *args, **keywords) - new function with partial application\n\ of the given arguments and keywords.\n"); #define OFF(x) offsetof(partialobject, x) static PyMemberDef partial_memberlist[] = { { "func", T_OBJECT, OFF(fn), READONLY, "function object to use in future partial calls" }, { "args", T_OBJECT, OFF(args), READONLY, "tuple of arguments to future partial calls" }, { "keywords", T_OBJECT, OFF(kw), READONLY, "dictionary of keyword arguments to future partial calls" }, {NULL} /* Sentinel */ }; static PyGetSetDef partial_getsetlist[] = { {"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict}, {NULL} /* Sentinel */ };
self = Py_None; Py_INCREF(self); return self; } static PyGetSetDef meth_getsets [] = { {"__doc__", (getter)meth_get__doc__, NULL, NULL}, {"__name__", (getter)meth_get__name__, NULL, NULL}, {"__self__", (getter)meth_get__self__, NULL, NULL}, {0} }; #define OFF(x) offsetof(PyCFunctionObject, x) static PyMemberDef meth_members[] = { {"__module__", T_OBJECT, OFF(m_module), PY_WRITE_RESTRICTED}, {NULL} }; static PyObject * meth_repr(PyCFunctionObject *m) { if (m->m_self == NULL) return PyString_FromFormat("<built-in function %s>", m->m_ml->ml_name); return PyString_FromFormat("<built-in method %s of %s object at %p>", m->m_ml->ml_name, m->m_self->ob_type->tp_name, m->m_self); }
{NULL, NULL} /* sentinel */ }; static void generic_dealloc(genericobject *g) { fl_free_object(g->ob_generic); Py_XDECREF(g->ob_callback); Py_XDECREF(g->ob_callback_arg); PyObject_Del(g); } #define OFF(x) offsetof(FL_OBJECT, x) static struct memberlist generic_memberlist[] = { {"objclass", T_INT, OFF(objclass), RO}, {"type", T_INT, OFF(type), RO}, {"boxtype", T_INT, OFF(boxtype)}, {"x", T_FLOAT, OFF(x)}, {"y", T_FLOAT, OFF(y)}, {"w", T_FLOAT, OFF(w)}, {"h", T_FLOAT, OFF(h)}, {"col1", T_INT, OFF(col1)}, {"col2", T_INT, OFF(col2)}, {"align", T_INT, OFF(align)}, {"lcol", T_INT, OFF(lcol)}, {"lsize", T_FLOAT, OFF(lsize)}, /* "label" is treated specially! */ {"lstyle", T_INT, OFF(lstyle)}, {"pushed", T_INT, OFF(pushed), RO}, {"focus", T_INT, OFF(focus), RO},
#include "type.h" #include "faddr.h" #include "fprint.h" #include "field.h" #include "bit.h" #include "attrshort.h" static int attr_sf_entry_name_count(void *obj, int startoff); static int attr_sf_entry_value_count(void *obj, int startoff); static int attr_sf_entry_value_offset(void *obj, int startoff, int idx); static int attr_shortform_list_count(void *obj, int startoff); static int attr_shortform_list_offset(void *obj, int startoff, int idx); #define OFF(f) bitize(offsetof(xfs_attr_shortform_t, f)) const field_t attr_shortform_flds[] = { { "hdr", FLDT_ATTR_SF_HDR, OI(OFF(hdr)), C1, 0, TYP_NONE }, { "list", FLDT_ATTR_SF_ENTRY, attr_shortform_list_offset, attr_shortform_list_count, FLD_ARRAY|FLD_COUNT|FLD_OFFSET, TYP_NONE }, { NULL } }; #define HOFF(f) bitize(offsetof(xfs_attr_sf_hdr_t, f)) const field_t attr_sf_hdr_flds[] = { { "totsize", FLDT_UINT16D, OI(HOFF(totsize)), C1, 0, TYP_NONE }, { "count", FLDT_UINT8D, OI(HOFF(count)), C1, 0, TYP_NONE }, { NULL } }; #define EOFF(f) bitize(offsetof(xfs_attr_sf_entry_t, f)) const field_t attr_sf_entry_flds[] = { { "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
static PyObject * tile_get_shadow(PyGimpTile *self, void *closure) { return PyBool_FromLong(self->tile->shadow); } static PyObject * tile_get_drawable(PyGimpTile *self, void *closure) { return pygimp_drawable_new(self->tile->drawable, 0); } #define OFF(x) GINT_TO_POINTER(offsetof(GimpTile, x)) static PyGetSetDef tile_getsets[] = { { "ewidth", (getter)tile_get_uint_field, 0, NULL, OFF(ewidth) }, { "eheight", (getter)tile_get_uint_field, 0, NULL, OFF(eheight) }, { "bpp", (getter)tile_get_uint_field, 0, NULL, OFF(bpp) }, { "tile_num", (getter)tile_get_uint_field, 0, NULL, OFF(tile_num) }, { "dirty", (getter)tile_get_dirty, 0, NULL }, { "shadow", (getter)tile_get_shadow, 0, NULL }, { "drawable", (getter)tile_get_drawable, 0, NULL }, { NULL, (getter)0, (setter)0 } }; #undef OFF static PyObject * tile_repr(PyGimpTile *self) { PyObject *s; gchar *name;
/* - cfindloop - the heart of cfind ^ static int cfindloop(struct vars *, struct cnfa *, struct colormap *, ^ struct dfa *, struct dfa *, chr **); */ static int cfindloop( struct vars *v, struct cnfa *cnfa, struct colormap *cm, struct dfa *d, struct dfa *s, chr **coldp) /* where to put coldstart pointer */ { chr *begin; chr *end; chr *cold; chr *open; /* Open and close of range of possible * starts */ chr *close; chr *estart; chr *estop; int er; int shorter = v->g->tree->flags&SHORTER; int hitend; assert(d != NULL && s != NULL); cold = NULL; close = v->start; do { MDEBUG(("\ncsearch at %ld\n", LOFF(close))); close = shortest(v, s, close, close, v->stop, &cold, NULL); if (close == NULL) { break; /* NOTE BREAK */ } assert(cold != NULL); open = cold; cold = NULL; MDEBUG(("cbetween %ld and %ld\n", LOFF(open), LOFF(close))); for (begin = open; begin <= close; begin++) { MDEBUG(("\ncfind trying at %ld\n", LOFF(begin))); estart = begin; estop = v->stop; for (;;) { if (shorter) { end = shortest(v, d, begin, estart, estop, NULL, &hitend); } else { end = longest(v, d, begin, estop, &hitend); } if (hitend && cold == NULL) { cold = begin; } if (end == NULL) { break; /* NOTE BREAK OUT */ } MDEBUG(("tentative end %ld\n", LOFF(end))); zapsubs(v->pmatch, v->nmatch); zapmem(v, v->g->tree); er = cdissect(v, v->g->tree, begin, end); if (er == REG_OKAY) { if (v->nmatch > 0) { v->pmatch[0].rm_so = OFF(begin); v->pmatch[0].rm_eo = OFF(end); } *coldp = cold; return REG_OKAY; } if (er != REG_NOMATCH) { ERR(er); return er; } if ((shorter) ? end == estop : end == begin) { /* * No point in trying again. */ *coldp = cold; return REG_NOMATCH; } /* * Go around and try again */ if (shorter) { estart = end + 1; } else { estop = end - 1; } } } } while (close < v->stop); *coldp = cold; return REG_NOMATCH; }
#endif // __OS2__ vs __NT__ } /* endmethod */ /**************************************************************************** * * * Get Basic INI Information * * * ****************************************************************************/ #define OFF(type, var) offsetof(type,var) /* ((int) &((*(type *) 0).var)) */ #define SIZE(type, var) sizeof((*(type *) 0).var) extern PROFILEITEM ProfileItems [] = { { "AnchorCorner", OFF(INIDATA,AnchorCorner), SIZE(INIDATA,AnchorCorner) }, { "fAnchorCorner", OFF(INIDATA,AnchorCorner), SIZE(INIDATA,fAnchorCorner) }, { "Animate", OFF(INIDATA,Animate), SIZE(INIDATA,Animate) }, { "fAnimate", OFF(INIDATA,fAnimate), SIZE(INIDATA,fAnimate) }, { "BackgroundColor", OFF(INIDATA,BackColor), SIZE(INIDATA,BackColor) }, { "fBackgroundColor", OFF(INIDATA,fBackColor), SIZE(INIDATA,fBackColor) }, { "CenterClock", OFF(INIDATA,CenterClock), SIZE(INIDATA,CenterClock) }, { "fCenterClock", OFF(INIDATA,fCenterClock), SIZE(INIDATA,fCenterClock) }, { "Chime", OFF(INIDATA,Chime), SIZE(INIDATA,Chime) }, { "fChime", OFF(INIDATA,fChime), SIZE(INIDATA,fChime) }, { "DateFormat", OFF(INIDATA,DateFormat), SIZE(INIDATA,DateFormat) }, { "DialogBorder", OFF(INIDATA,DialogBorder), SIZE(INIDATA,DialogBorder) }, { "fDialogBorder", OFF(INIDATA,fDialogBorder), SIZE(INIDATA,fDialogBorder) }, { "ErrorBackground", OFF(INIDATA,ErrorBackground), SIZE(INIDATA,ErrorBackground) }, { "fErrorBackground", OFF(INIDATA,fErrorBackground), SIZE(INIDATA,fErrorBackground) }, { "ErrorForeground", OFF(INIDATA,ErrorForeground), SIZE(INIDATA,ErrorForeground) },
{ "", FLDT_BMAPBTD, OI(0), C1, 0, TYP_NONE }, { NULL } }; const field_t bmapbta_crc_hfld[] = { { "", FLDT_BMAPBTA_CRC, OI(0), C1, 0, TYP_NONE }, { NULL } }; const field_t bmapbtd_crc_hfld[] = { { "", FLDT_BMAPBTD_CRC, OI(0), C1, 0, TYP_NONE }, { NULL } }; #define OFF(f) bitize(offsetof(struct xfs_btree_block, bb_ ## f)) const field_t bmapbta_flds[] = { { "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE }, { "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE }, { "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE }, { "leftsib", FLDT_DFSBNO, OI(OFF(u.l.bb_leftsib)), C1, 0, TYP_BMAPBTA }, { "rightsib", FLDT_DFSBNO, OI(OFF(u.l.bb_rightsib)), C1, 0, TYP_BMAPBTA }, { "recs", FLDT_BMAPBTAREC, btblock_rec_offset, btblock_rec_count, FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE }, { "keys", FLDT_BMAPBTAKEY, btblock_key_offset, btblock_key_count, FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE }, { "ptrs", FLDT_BMAPBTAPTR, btblock_ptr_offset, btblock_key_count, FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTA }, { NULL } }; const field_t bmapbtd_flds[] = { { "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE }, { "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
void Buzzer::take_photo() { ON(); wait(0.2); OFF(); }
void can_setup(void) { /* Enable peripheral clocks. */ rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN); rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_CANEN); /* Configure CAN pin: RX */ gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO_CAN_RX); gpio_set(GPIOA, GPIO_CAN_RX); /* Configure CAN pin: TX */ gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_CAN_TX); /* NVIC configuration */ nvic_enable_irq(NVIC_USB_LP_CAN_RX0_IRQ); nvic_set_priority(NVIC_USB_LP_CAN_RX0_IRQ, 1); /* CAN register init */ can_reset(CAN1); /* CAN cell init */ if (can_init(CAN1, false, /* TTCM: Time triggered comm mode? */ true, /* ABOM: Automatic bus-off management? */ false, /* AWUM: Automatic wakeup mode? */ false, /* NART: No automatic retransmission? */ false, /* RFLM: Receive FIFO locked mode? */ false, /* TXFP: Transmit FIFO priority? */ CAN_BTR_SJW_1TQ, CAN_BTR_TS1_3TQ, CAN_BTR_TS2_4TQ, 12, false, false)) /* BRP+1: Baud rate prescaler */ { ON(LED_RED); OFF(LED_GREEN); OFF(LED_BLUE); OFF(LED_ORANGE); /* Die because we failed to initialize. */ while (1) __asm__("nop"); } /* CAN filter init */ can_filter_id_mask_32bit_init(CAN1, 0, /* Filter ID */ 0, /* CAN ID */ 0, /* CAN ID mask */ 0, /* FIFO assignment (here: FIFO0) */ true); /* Enable the filter. */ /* transmit struct init */ can_tx_msg.id = 0x0; can_tx_msg.rtr = false; #ifdef CAN__USE_EXT_ID can_tx_msg.ide = true; #else can_tx_msg.ide = false; #endif can_tx_msg.dlc = 1; can_enable_irq(CAN1, CAN_IER_FMPIE0); }
0, // tp_getset; 0, // tp_base; 0, // tp_dict; 0, // tp_descr_get; 0, // tp_descr_set; 0, // tp_dictoffset; 0, // tp_init; 0, // tp_alloc; 0 // newfunc tp_new; }; #define OFF(e) offsetof(PyDSCAPS, e) /*static*/ struct PyMemberDef PyDSCAPS::members[] = { {"dwFlags", T_INT, OFF(m_caps.dwFlags), 0, "Specifies device capabilities."}, // @prop integer|dwFlags|Specifies device capabilities. Can be one or more of the following: // @flagh Flag|Description // @flag DSCAPS_PRIMARYMONO|The device supports monophonic primary buffers. // @flag DSCAPS_PRIMARYSTEREO|The device supports stereo primary buffers. // @flag DSCAPS_PRIMARY8BIT|The device supports hardware-mixed secondary buffers with 8-bit samples. // @flag DSCAPS_PRIMARY16BIT|The device supports primary sound buffers with 16-bit samples. // @flag DSCAPS_CONTINUOUSRATE|The device supports all sample rates between the dwMinSecondarySampleRate and dwMaxSecondarySampleRate member values. Typically, this means that the actual output rate will be within +/- 10 hertz (Hz) of the requested frequency. // @flag DSCAPS_EMULDRIVER|The device does not have a DirectSound driver installed, so it is being emulated through the waveform-audio functions. Performance degradation should be expected. // @flag DSCAPS_CERTIFIED|This driver has been tested and certified by Microsoft. // @flag DSCAPS_SECONDARYMONO|The device supports hardware-mixed monophonic secondary buffers. // @flag DSCAPS_SECONDARYSTEREO|The device supports hardware-mixed stereo secondary buffers. // @flag DSCAPS_SECONDARY8BIT|The device supports hardware-mixed secondary buffers with 8-bit samples. // @flag DSCAPS_SECONDARY16BIT|The device supports hardware-mixed secondary sound buffers with 16-bit samples. {"dwMinSecondarySampleRate", T_INT, OFF(m_caps.dwMinSecondarySampleRate), 0, "Minimum sample rate supported by this device's hardware secondary sound buffers."}, // @prop integer|dwMinSecondarySampleRate|Minimum sample rate supported by this device's hardware secondary sound buffers.