sym_value_entry_type *sem_create_wchar_str() { sym_value_entry_type *az_wchar_str_entry; az_wchar_str_entry = (sym_value_entry_type *) sem_allocate_node ( sym_k_value_entry, sym_k_value_entry_size + sizeof( char * ) ); az_wchar_str_entry->obj_header.b_flags = sym_m_builtin | sym_m_private; az_wchar_str_entry->b_type = sym_k_wchar_string_value; az_wchar_str_entry->w_length = sizeof (char *); az_wchar_str_entry->b_direction = NOSTRING_DIRECTION; _sar_save_source_pos (&az_wchar_str_entry->header, &yylval); return az_wchar_str_entry; }
sym_value_entry_type *sem_create_cstr() { sym_value_entry_type *az_cstr_entry; az_cstr_entry = (sym_value_entry_type *) sem_allocate_node ( sym_k_value_entry, sym_k_value_entry_size + sizeof( char * ) ); az_cstr_entry->obj_header.b_flags = sym_m_builtin | sym_m_private; az_cstr_entry->b_type = sym_k_compound_string_value; az_cstr_entry->w_length = sizeof (char *); az_cstr_entry->b_direction = NOSTRING_DIRECTION; /* Fix for CN 16149 (DTS 10023) part 1 -- initialize charset info */ az_cstr_entry->b_charset = sym_k_error_charset; az_cstr_entry->az_charset_value = NULL; _sar_save_source_pos (&az_cstr_entry->header, &yylval); return az_cstr_entry; }
sym_proc_ref_entry_type *sem_reference_procedure( yystype *id_frame, XmConst yystype *value_frame, XmConst int context ) { sym_value_entry_type *value_entry; sym_proc_def_entry_type *proc_def_entry; sym_proc_ref_entry_type *proc_ref_entry; /* ** Call standard routine to check name entry for id_frame. ** This routine handles font name, color names, etc used as ids */ proc_def_entry = (sym_proc_def_entry_type *) sem_ref_name( id_frame, sym_k_proc_def_entry ); switch (value_frame->b_tag) { case sar_k_null_frame: value_entry = NULL; break; case sar_k_value_frame: if ((value_frame->b_flags & sym_m_forward_ref) != 0) value_entry = NULL; else value_entry = (sym_value_entry_type *) value_frame->value.az_symbol_entry; break; case sar_k_object_frame: value_entry = (sym_value_entry_type *) value_frame->value.az_symbol_entry; break; default: _assert( FALSE, "actual arg in error" ); } /* ** Allocate the procedure reference entry and fill it in */ proc_ref_entry = (sym_proc_ref_entry_type *) sem_allocate_node (sym_k_proc_ref_entry, sym_k_proc_ref_entry_size); if ((id_frame->b_flags & sym_m_forward_ref) != 0) sym_make_value_forward_ref (id_frame, (char*)&(proc_ref_entry->az_proc_def), sym_k_patch_list_add); else proc_ref_entry->az_proc_def = proc_def_entry; if ((value_frame->b_flags & sym_m_forward_ref) != 0) sym_make_value_forward_ref (value_frame, (char*)&(proc_ref_entry->az_arg_value), sym_k_patch_add); else proc_ref_entry->az_arg_value = value_entry; /* ** Apply context constraints ** ** If this is a procedure being used as a user object, ** it should not have any arguments. The arguments to such ** a procedure are always a parent widget id and an argument list. ** This constraint is currently inforced by the grammar. ** ** At this time the compiler permits all types of values for callback ** arguments. This may be limited shortly when we see if it is ** reasonable to pass fonts, colors, reasons, etc. */ return proc_ref_entry; }
void sar_create_procedure(XmConst yystype *id_frame, XmConst yystype *param_frame, XmConst yystype *class_frame, XmConst yystype *semi_frame) { sym_name_entry_type *name_entry; sym_proc_def_entry_type *proc_def_entry; sym_section_entry_type *section_entry; sym_obj_entry_type *obj_entry; /* ** Call standard routine to check name entry for id_frame. ** This routine handles font name, color names, etc used as ids */ name_entry = (sym_name_entry_type *) sem_dcl_name( id_frame ); if (name_entry == NULL) return; /* ** Allocate the procedure definition entry and fill it in */ proc_def_entry = (sym_proc_def_entry_type *) sem_allocate_node (sym_k_proc_def_entry, sym_k_proc_def_entry_size); proc_def_entry->b_widget_type = uil_max_object + 1; proc_def_entry->obj_header.az_name = (sym_name_entry_type *) name_entry; name_entry->az_object = (sym_entry_type *) proc_def_entry; /* ** Parameter frame has 4 cases: ** 1) no argument checking desired ** syntax: PROCEDURE id ** 2) argument checking desired - no argument ** syntax: PROCEDURE id( ) ** 3) argument checking desired - single argument ** syntax: PROCEDURE id( type ) ** 4) argument checking desired - single typed widget argument ** syntax: PROCEDURE id( CLASS_NAME ) ** These cases are distinguished as follows: ** 1) tag = null type = 0 ** 2) tag = null type = sar_k_no_value ** 3) tag = token type = argument type ** 4) tag = object type = widget type */ proc_def_entry->v_arg_checking = TRUE; switch (param_frame->b_tag) { case sar_k_null_frame: if (param_frame->b_type == sym_k_no_value ) { proc_def_entry->b_arg_count = 0; proc_def_entry->b_arg_type = sym_k_no_value; } else proc_def_entry->v_arg_checking = FALSE; break; case sar_k_token_frame: proc_def_entry->b_arg_type = param_frame->b_type; proc_def_entry->b_arg_count = 1; break; case sar_k_object_frame: _assert((param_frame->b_type == sym_k_widget_entry), "object frame not widget entry"); obj_entry = (sym_obj_entry_type *)param_frame->value.az_symbol_entry; proc_def_entry->b_arg_type = sym_k_widget_ref_value; proc_def_entry->b_arg_count = 1; proc_def_entry->b_widget_type = obj_entry->header.b_type; break; default: _assert( FALSE, "param frame in error" ); } /* ** Process the class clause */ switch (class_frame->b_flags) { case sym_m_exported: sym_make_external_def( name_entry ); case sym_m_private: case sym_m_imported: break; default: _assert( FALSE, "class frame in error" ); } proc_def_entry->obj_header.b_flags = class_frame->b_flags; /* ** save the source file info for this procedure entry */ _sar_save_source_info (&proc_def_entry->header, id_frame, semi_frame ); sar_assoc_comment((sym_obj_entry_type *)proc_def_entry); /* preserve comments */ /* ** allocate a section entry to link the proc_def entry into the structure */ section_entry = (sym_section_entry_type *) sem_allocate_node (sym_k_section_entry, sym_k_section_entry_size); /* ** Link this entry off of the current section list */ section_entry->next = (sym_entry_type *) sym_az_current_section_entry->entries; sym_az_current_section_entry->entries = (sym_entry_type *) section_entry; section_entry->entries = (sym_entry_type *) proc_def_entry; }