mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-28 11:43:09 +03:00
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;
|
||||
}
|
||||
|
||||
#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 r = TP_OBJ();
|
||||
tp_obj self = TP_OBJ();
|
||||
|
@ -325,8 +325,8 @@ tp_obj tp_import_(TP) {
|
||||
|
||||
void tp_builtins(TP) {
|
||||
struct {const char *s;void *f;} b[] = {
|
||||
{"print",tp_print}, {"range",tp_range}, {"min",tp_min},
|
||||
{"max",tp_max}, {"bind",tp_bind}, {"copy",tp_copy},
|
||||
{"print",tp_print}, {"range",tp_range}, {"raw_input", tp_raw_input},
|
||||
{"min",tp_min}, {"max",tp_max}, {"bind",tp_bind}, {"copy",tp_copy},
|
||||
{"import",tp_import_}, {"len",tp_len_}, {"assert",tp_assert},
|
||||
{"str",tp_str2}, {"float",tp_float}, {"system",tp_system},
|
||||
{"istype",tp_istype}, {"chr",tp_chr}, {"save",tp_save},
|
||||
|
Loading…
Reference in New Issue
Block a user