break;
}
break;
+ case OBERON_TYPE_SYSTEM_PTR:
+ return new_string("Ljava/lang/Object;");
+ break;
default:
gen_error("jvm_get_descriptor: unsupported type class %i", type -> class);
break;
case OBERON_TYPE_ARRAY:
return new_string("A%s", jvm_get_descriptor_safe(type -> base));
break;
+ case OBERON_TYPE_SYSTEM_PTR:
+ return new_string("SYSPTR");
+ break;
default:
return jvm_get_descriptor(type);
break;
case OBERON_TYPE_POINTER:
case OBERON_TYPE_STRING:
case OBERON_TYPE_NIL:
+ case OBERON_TYPE_SYSTEM_PTR:
return 'a';
break;
case OBERON_TYPE_REAL:
case OBERON_TYPE_POINTER:
case OBERON_TYPE_STRING:
case OBERON_TYPE_NIL:
+ case OBERON_TYPE_SYSTEM_PTR:
return 'a';
break;
case OBERON_TYPE_REAL:
rec_id = type -> gen_type -> rec_id;
name = new_string("%s$RECORD%i", type -> module -> name, rec_id);
break;
+ case OBERON_TYPE_SYSTEM_PTR:
+ name = new_string("java/lang/Object");
+ break;
default:
gen_error("jvm_get_class_full_name: unk type class %i", type -> class);
break;
return t -> class == OBERON_TYPE_SYSTEM_BYTE;
}
+bool
+oberon_is_system_ptr_type(oberon_type_t * t)
+{
+ return t -> class == OBERON_TYPE_SYSTEM_PTR;
+}
+
bool
oberon_is_byte_type(oberon_type_t * t)
{
/* Доп: Tv - символ, е - строковая константа из одного символа */
/* SYSTEM: переменным типа BYTE можно присваивать значения переменных типа CHAR или SHORTINT. */
+ /* SYSTEM: Переменным типа PTR могут быть присвоены значения переменных-указателей любого типа. */
oberon_type_t * Te = e -> result;
-/*
- printf("<<< oberon_is_assignment_compatible_expressions ===\n");
- printf(": Te -> class == %i\n", Te -> class);
- printf(": Tv -> class == %i\n", Tv -> class);
- printf(":: oberon_is_some_types(Te, Tv) == %i\n", oberon_is_some_types(Te, Tv));
- printf("::: oberon_is_number_type(Te) == %i\n", oberon_is_number_type(Te));
- printf("::: oberon_is_number_type(Tv) == %i\n", oberon_is_number_type(Tv));
- printf("::: oberon_incluses_type(Tv, Te) == %i\n", oberon_incluses_type(Tv, Te));
- printf(":::: oberon_is_record_type(Te) == %i\n", oberon_is_record_type(Te));
- printf(":::: oberon_is_record_type(Tv) == %i\n", oberon_is_record_type(Tv));
-// printf(":::: oberon_extension_of(Te, Tv) == %i\n", oberon_extension_of(Te, Tv));
- printf(":::: oberon_extension_of(Tv, Te) == %i\n", oberon_extension_of(Tv, Te));
- printf("=== oberon_is_assignment_compatible_expressions >>>\n");
-*/
-
return oberon_is_some_types(Te, Tv)
|| (oberon_is_number_type(Te) && oberon_is_number_type(Tv) && oberon_incluses_type(Tv, Te))
|| (oberon_is_record_type(Te) && oberon_is_record_type(Tv) && oberon_extension_of(Tv, Te))
|| (oberon_is_array_of_char_type(Tv) && !oberon_is_open_array(Tv) && oberon_is_const_string(e) && (strlen(e -> item.string) < Tv -> size))
|| (oberon_is_procedure_type(Tv) && e -> is_item && e -> item.var -> class == OBERON_CLASS_PROC && oberon_is_some_procedure_signatures(Tv, e -> result))
|| (oberon_is_char_type(Tv) && oberon_is_const_string(e) && strlen(e -> item.string) == 1)
- || (oberon_is_system_byte_type(Tv) && (oberon_is_char_type(Te) || oberon_is_byte_type(Te)));
+ || (oberon_is_system_byte_type(Tv) && (oberon_is_char_type(Te) || oberon_is_byte_type(Te)))
+ || (oberon_is_system_ptr_type(Tv) && oberon_is_pointer_type(Te));
}
static bool
/* SYSTEM: Если формальный параметр-переменная имеет тип ARRAY OF BYTE, */
/* то соответствующий фактический параметр может иметь любой тип. */
+ /* SYSTEM: Если формальный параметр-переменная имеет тип PTR, */
+ /* фактический параметр может быть указателем любого типа. */
return oberon_is_some_types(Tf, Ta)
|| (oberon_is_record_type(Tf) && oberon_extension_of(Ta, Tf))
- || (oberon_is_array_of_system_byte_type(Tf));
+ || (oberon_is_array_of_system_byte_type(Tf))
+ || (oberon_is_system_ptr_type(Tf));
}
void
ctx -> system_byte_type = oberon_new_type_ptr(OBERON_TYPE_SYSTEM_BYTE);
oberon_generator_init_type(ctx, ctx -> system_byte_type);
+ ctx -> system_ptr_type = oberon_new_type_ptr(OBERON_TYPE_SYSTEM_PTR);
+ oberon_generator_init_type(ctx, ctx -> system_ptr_type);
+
/* LONG / SHORT support */
ctx -> byte_type -> shorter = NULL;
ctx -> byte_type -> longer = ctx -> shortint_type;
/* Types */
oberon_new_intrinsic_type(ctx, "BYTE", ctx -> system_byte_type);
+ oberon_new_intrinsic_type(ctx, "PTR", ctx -> system_ptr_type);
oberon_end_intrinsic_module(ctx, ctx -> system_module);