forked from KolibriOS/kolibrios
tinypy: support for raw_input() builtin function.
git-svn-id: svn://kolibrios.org@3235 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ad706e4a24
commit
c33af6540c
@ -10,6 +10,19 @@ tp_obj tp_print(TP) {
|
|||||||
return tp_None;
|
return tp_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BUF_SIZE 2048
|
||||||
|
tp_obj tp_raw_input(TP) {
|
||||||
|
tp_obj prompt;
|
||||||
|
char *buf = malloc(BUF_SIZE);
|
||||||
|
if (tp->params.list.val->len)
|
||||||
|
{
|
||||||
|
prompt = TP_OBJ();
|
||||||
|
con_printf("%s", TP_CSTR(prompt));
|
||||||
|
}
|
||||||
|
con_gets(buf, BUF_SIZE);
|
||||||
|
return tp_string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
tp_obj tp_bind(TP) {
|
tp_obj tp_bind(TP) {
|
||||||
tp_obj r = TP_OBJ();
|
tp_obj r = TP_OBJ();
|
||||||
tp_obj self = TP_OBJ();
|
tp_obj self = TP_OBJ();
|
||||||
|
@ -325,8 +325,8 @@ tp_obj tp_import_(TP) {
|
|||||||
|
|
||||||
void tp_builtins(TP) {
|
void tp_builtins(TP) {
|
||||||
struct {const char *s;void *f;} b[] = {
|
struct {const char *s;void *f;} b[] = {
|
||||||
{"print",tp_print}, {"range",tp_range}, {"min",tp_min},
|
{"print",tp_print}, {"range",tp_range}, {"raw_input", tp_raw_input},
|
||||||
{"max",tp_max}, {"bind",tp_bind}, {"copy",tp_copy},
|
{"min",tp_min}, {"max",tp_max}, {"bind",tp_bind}, {"copy",tp_copy},
|
||||||
{"import",tp_import_}, {"len",tp_len_}, {"assert",tp_assert},
|
{"import",tp_import_}, {"len",tp_len_}, {"assert",tp_assert},
|
||||||
{"str",tp_str2}, {"float",tp_float}, {"system",tp_system},
|
{"str",tp_str2}, {"float",tp_float}, {"system",tp_system},
|
||||||
{"istype",tp_istype}, {"chr",tp_chr}, {"save",tp_save},
|
{"istype",tp_istype}, {"chr",tp_chr}, {"save",tp_save},
|
||||||
|
Loading…
Reference in New Issue
Block a user