void unbound_module_print_on(value_t value, print_on_context_t *context) { string_buffer_printf(context->buf, "#<unbound_module("); value_t path = get_unbound_module_path(value); value_print_inner_on(path, context, -1); string_buffer_printf(context->buf, ") "); value_t fragments = get_unbound_module_fragments(value); value_print_inner_on(fragments, context, -1); string_buffer_printf(context->buf, ">"); }
void method_print_on(value_t self, print_on_context_t *context) { string_buffer_printf(context->buf, "#<method "); value_t signature = get_method_signature(self); value_print_inner_on(signature, context, -1); string_buffer_printf(context->buf, " "); value_t syntax = get_method_syntax(self); value_print_inner_on(syntax, context, -1); string_buffer_printf(context->buf, ">"); }
void library_print_on(value_t value, print_on_context_t *context) { string_buffer_printf(context->buf, "#<library("); value_t display_name = get_library_display_name(value); value_print_inner_on(display_name, context, -1); string_buffer_printf(context->buf, ") "); value_t modules = get_library_modules(value); value_print_inner_on(modules, context, -1); string_buffer_printf(context->buf, ">"); }
void signature_print_on(value_t self, print_on_context_t *context) { string_buffer_printf(context->buf, "#<signature: "); for (int64_t i = 0; i < get_signature_parameter_count(self); i++) { if (i > 0) string_buffer_printf(context->buf, ", "); value_print_inner_on(get_signature_tag_at(self, i), context, -1); string_buffer_printf(context->buf, ":"); value_t param = get_signature_parameter_at(self, i); value_print_inner_on(get_parameter_guard(param), context, -1); } string_buffer_printf(context->buf, ">"); }
void unbound_module_fragment_print_on(value_t value, print_on_context_t *context) { string_buffer_printf(context->buf, "#<unbound_module_fragment("); value_t stage = get_unbound_module_fragment_stage(value); value_print_inner_on(stage, context, -1); string_buffer_printf(context->buf, ") imports: "); value_t imports = get_unbound_module_fragment_imports(value); value_print_inner_on(imports, context, -1); string_buffer_printf(context->buf, ") elements: "); value_t elements = get_unbound_module_fragment_elements(value); value_print_inner_on(elements, context, -1); string_buffer_printf(context->buf, ">"); }
void parameter_print_on(value_t self, print_on_context_t *context) { CHECK_FAMILY(ofParameter, self); string_buffer_printf(context->buf, "#<parameter: gd@"); // We know the guard is a guard, not a parameter, so this can't cause a cycle. value_print_inner_on(get_parameter_guard(self), context, -1); string_buffer_printf(context->buf, ", op@%i, ix@%i>", get_parameter_is_optional(self), get_parameter_index(self)); }
void guard_print_on(value_t self, print_on_context_t *context) { CHECK_FAMILY(ofGuard, self); switch (get_guard_type(self)) { case gtEq: string_buffer_printf(context->buf, "eq("); value_print_inner_on(get_guard_value(self), context, -1); string_buffer_printf(context->buf, ")"); break; case gtIs: string_buffer_printf(context->buf, "is("); value_print_inner_on(get_guard_value(self), context, -1); string_buffer_printf(context->buf, ")"); break; case gtAny: string_buffer_printf(context->buf, "any()"); break; } }
void call_tags_print_on(value_t self, print_on_context_t *context) { string_buffer_printf(context->buf, "{"); int64_t arg_count = get_call_tags_entry_count(self); for (int64_t i = 0; i < arg_count; i++) { if (i > 0) string_buffer_printf(context->buf, ", "); value_t tag = get_call_tags_tag_at(self, i); size_t offset = (size_t) get_call_tags_offset_at(self, i); value_print_inner_on(tag, context, -1); string_buffer_printf(context->buf, "@%i", offset); } string_buffer_printf(context->buf, "}"); }
void operation_print_open_on(value_t self, value_t transport, print_on_context_t *context) { value_t value = get_operation_value(self); print_on_context_t unquote_context = *context; unquote_context.flags |= pfUnquote; bool is_async = is_same_value(transport, transport_async()); switch (get_operation_type(self)) { case otAssign: // Since the operator for the assignment is kind of sort of part of the // operator let's not decrease depth. If you make an assignment whose // operator is the assignment itself then 1) this will fail and 2) I hate // you. value_print_inner_on(value, &unquote_context, 0); string_buffer_printf(context->buf, ":=("); break; case otCall: string_buffer_printf(context->buf, "("); break; case otIndex: string_buffer_printf(context->buf, "["); break; case otInfix: string_buffer_printf(context->buf, is_async ? "->" : "."); value_print_inner_on(value, &unquote_context, -1); string_buffer_printf(context->buf, "("); break; case otPrefix: value_print_inner_on(value, &unquote_context, -1); string_buffer_printf(context->buf, "("); break; case otSuffix: string_buffer_printf(context->buf, "("); break; default: UNREACHABLE("unexpected operation type"); break; } }
void operation_print_close_on(value_t self, print_on_context_t *context) { value_t value = get_operation_value(self); print_on_context_t unquote_context = *context; unquote_context.flags |= pfUnquote; switch (get_operation_type(self)) { case otAssign: case otCall: case otInfix: case otPrefix: string_buffer_printf(context->buf, ")"); break; case otIndex: string_buffer_printf(context->buf, "]"); break; case otSuffix: string_buffer_printf(context->buf, ")"); value_print_inner_on(value, &unquote_context, -1); break; default: UNREACHABLE("unexpected operation type"); break; } }
void value_print_on(value_t value, print_on_context_t *context) { value_print_inner_on(value, context, 0); }
void builtin_implementation_print_on(value_t self, print_on_context_t *context) { CHECK_FAMILY(ofBuiltinImplementation, self); string_buffer_printf(context->buf, "#<builtin_implementation "); value_print_inner_on(get_builtin_implementation_name(self), context, -1); string_buffer_printf(context->buf, ">"); }
void builtin_marker_print_on(value_t self, print_on_context_t *context) { CHECK_FAMILY(ofBuiltinMarker, self); string_buffer_printf(context->buf, "#<builtin_marker "); value_print_inner_on(get_builtin_marker_name(self), context, -1); string_buffer_printf(context->buf, ">"); }
void methodspace_print_on(value_t self, print_on_context_t *context) { string_buffer_printf(context->buf, "#<methodspace "); value_t methods = get_methodspace_methods(self); value_print_inner_on(methods, context, -1); string_buffer_printf(context->buf, ">"); }
void module_loader_print_on(value_t value, print_on_context_t *context) { string_buffer_printf(context->buf, "#<module loader "); value_t modules = get_module_loader_modules(value); value_print_inner_on(modules, context, -1); string_buffer_printf(context->buf, ">"); }