struct pvm_object pvm_code_get_string(struct pvm_code_handler *code) { int len = pvm_code_get_int32(code); const unsigned char *sp = code->code+code->IP; code->IP += len; pvm_code_check_bounds( code, code->IP-1, "get_string" ); // after we checked there is a real data accessible we can // create string object return pvm_create_string_object_binary( (const char *)sp, len ); }
static int getwc_16(struct pvm_object me , struct data_area_4_thread *tc ) { (void) me; DEBUG_INFO; char c[1]; // TODO XXX syscall blocks! c[0] = phantom_dev_keyboard_getc(); SYSCALL_RETURN( pvm_create_string_object_binary( c, 1 )); }
struct pvm_object pvm_create_string_object(const char *value) { return pvm_create_string_object_binary(value, strlen(value)); }