static PyObject * curve_set_continuity(SKCurveObject * self, PyObject * args) { int idx, cont; if (!PyArg_ParseTuple(args, "ii", &idx, &cont)) return NULL; if (idx < 0) idx = idx + self->len; if (idx < 0 || idx >= self->len) { PyErr_SetString(PyExc_IndexError, "curve_set_continuity: index out of range"); return NULL; } if (!CHECK_CONT(cont)) { PyErr_SetString(PyExc_ValueError, "curve_set_continuity: " "cont must be one of ContAngle, ContSmooth " "or ContSymmetrical"); return NULL; } self->segments[idx].cont = cont; if (self->closed) { if (idx == 0) self->segments[self->len - 1].cont = cont; else if (idx == self->len - 1) self->segments[0].cont = cont; } Py_INCREF(Py_None); return Py_None; }
int shell_prompt (GPParams *params) { int x; char cmd[1024], arg[1024], *line; /* The stupid readline functions need that global variable. */ p = params; if (!getcwd (cwd, 1023)) strcpy (cwd, "./"); #ifdef HAVE_RL rl_attempted_completion_function = shell_completion_function; rl_completion_append_character = '\0'; #endif while (!shell_done && !glob_cancel) { line = shell_read_line (); if (line == NULL) { /* quit shell on EOF or input error */ printf("\n"); fflush(stdout); break; } #ifdef HAVE_UNISTD_H if (!isatty(fileno(stdin))) { /* if non-interactive input, the command has not been * printed yet, so we do that here */ printf("%s\n", line); fflush(stdout); } #endif /* If we don't have any command, start from the beginning */ if (shell_arg_count (line) <= 0) { free (line); continue; } shell_arg (line, 0, cmd); strcpy (arg, &line[strlen (cmd)]); free (line); /* Search the command */ for (x = 0; func[x].function; x++) if (!strcmp (cmd, func[x].command)) break; if (!func[x].function) { cli_error_print (_("Invalid command.")); continue; } /* * If the command requires an argument, complain if this * argument is not given. */ if (func[x].arg_required && !shell_arg_count (arg)) { printf (_("The command '%s' requires " "an argument."), cmd); putchar ('\n'); continue; } /* Execute the command */ CHECK_CONT (func[x].function (p->camera, arg)); } return (GP_OK); }