PyLiteObject* pylt_mods_builtins_pow(PyLiteInterpreter *I, int argc, PyLiteObject **args) { if (pl_isnum(args[0]) && pl_isnum(args[1])) { return castobj(pylt_obj_float_new(I, pow(get_numval(args[0]), get_numval(args[1])))); } else { // TODO } return NULL; }
STATIC uint8_t * get_range(uint8_t *buf, uint32_t *pval1, uint32_t *pval2) { if ((buf = get_numval(buf, pval1)) == NULL) return NULL; if (!*buf) return NULL; if ((buf = get_numval(buf, pval2)) == NULL) return NULL; return buf; }
STATIC uint8_t * get_parameter(uint8_t *buf, negotiation_parameter_t *par) { uint8_t *bp = buf; int i; while (*bp && *bp != '=') { bp++; } if (!*bp) { DEBOUT(("get_parameter: Premature end of parameter\n")); return NULL; } *bp++ = 0; for (i = 0; i <= MAX_KEY; i++) if (!strcmp(buf, entries[i].name)) break; par->key = i; par->list_num = 1; if (i > MAX_KEY) { DEBOUT(("get_parameter: unrecognized key <%s>\n", buf)); if (strlen(buf) > MAX_STRING) { DEBOUT(("get_parameter: key name > MAX_STRING\n")); return NULL; } par->val.sval = buf; return skiptozero(bp); } DEB(10, ("get_par: key <%s>=%d, val=%d, ret %p\n", buf, i, entries[i].val, bp)); DEB(10, ("get_par: value '%s'\n",bp)); switch (entries[i].val) { case T_NUM: bp = get_numval(bp, &par->val.nval[0]); break; case T_BIGNUM: bp = get_bignumval(bp, par); break; case T_STRING: bp = get_strval(bp, &par->val.sval); break; case T_YESNO: bp = get_ynval(bp, &par->val.nval[0]); break; case T_AUTH: bp = get_authval(bp, &par->val.nval[0]); break; case T_DIGEST: bp = get_digestval(bp, &par->val.nval[0]); break; case T_RANGE: bp = get_range(bp, &par->val.nval[0], &par->val.nval[1]); break; default: /* Target sending any other types is wrong */ bp = NULL; break; } return bp; }