SCM tortoise_turn(SCM s_degrees) { int prevValue = (int)currentDirection; double degrees; SCM_ASSERT(SCM_NUMBERP(s_degrees), s_degrees, SCM_ARG1, "tortoise-turn"); //degrees = SCM_NUM2DOUBLE(s_degrees); degrees = scm_to_double(s_degrees); currentDirection += degrees; return SCM_MAKINUM(prevValue); }
static LONGEST scm_istr2int (char *str, int len, int radix) { int i = 0; LONGEST inum = 0; int c; int sign = 0; if (0 >= len) return SCM_BOOL_F; /* zero scm_length */ switch (str[0]) { /* leading sign */ case '-': case '+': sign = str[0]; if (++i == len) return SCM_BOOL_F; /* bad if lone `+' or `-' */ } do { switch (c = str[i++]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c = c - '0'; goto accumulate; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c = c - 'A' + 10; goto accumulate; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c = c - 'a' + 10; accumulate: if (c >= radix) return SCM_BOOL_F; /* bad digit for radix */ inum *= radix; inum += c; break; default: return SCM_BOOL_F; /* not a digit */ } } while (i < len); if (sign == '-') inum = -inum; return SCM_MAKINUM (inum); }
void Scm::createHook(const QString& symb, unsigned int nbargs) { SCM hook=scm_make_hook(SCM_MAKINUM(nbargs)); scm_c_define(symb.ascii(),hook); sym[symb] = hook; }