📄 tmodule.c
字号:
EndIf ;
EndIf ;
EndIf ;
EndCode
#undef Tstr
#undef Pub
/*+-------------------------------------------------------------------------+
| |
| Export |
| |
+-------------------------------------------------------------------------+*/
void Export(void)
BeginDeclarations
bit_16 len;
public_entry_ptr pub;
#define Pub (*pub)
bit_16 ordflag ;
string_ptr tstr ;
#define Tstr (*tstr)
byte_ptr exp_name ;
bit_16 exp_len ;
EndDeclarations
BeginCode
If n_exports NotLessThan max_exports
Then
max_exports += 64 ;
exports = (public_entry_ptr_array)
reallocate_memory(exports,
(Bit_32(max_exports)+1L) *
Bit_32(sizeof(group_entry_ptr)));
EndIf;
ordflag = *obj_ptr.b8++ ;
exp_len = obj_name_length();
If case_ignore.val
Then
far_to_lower(BytePtr(obj_ptr.b8), exp_len);
EndIf;
exp_name = obj_ptr.b8 ;
obj_ptr.b8 += exp_len ;
len = obj_name_length() ;
exp_name[exp_len] = 0 ;
If case_ignore.val
Then
far_to_lower(BytePtr(obj_ptr.b8), exp_len);
EndIf;
pub = lookup_public(exp_len, exp_name, 0);
obj_ptr.b8 += len;
If Pub.type_entry Is internal AndIf Pub.type_qualifier Is public_normal
OrIf Pub.type_entry Is external OrIf Pub.type_entry Is unused
Then
tstr = allocate_string(exp_len);
Tstr.length = exp_len ;
memcpy(Tstr.text,exp_name,exp_len) ;
Pub.entryident = tstr ;
If ordflag And 0x80
Then
Pub.ordinal = *obj_ptr.b16++ ;
Else
Pub.ordinal = 0xffffffff ;
EndIf ;
If Pub.type_entry IsNot internal
Then
Pub.use_count = 0;
Insert pub AtEnd InList external_list EndInsert;
EndIf ;
If (Pub.type_entry Is public_in_library) AndIf
(Pub.Library.requested)
Then
library_request_count--;
(*Pub.Library.lib_file).request_count--;
EndIf;
If Pub.type_entry Is unused
Then
Pub.type_entry = external ;
Pub.type_qualifier = public_normal;
EndIf ;
exports[n_exports++] = pub ;
Else
linker_error(4, "Attempt to recast a typed public\n"
"\tModule: \"%s\"\n"
"\t File: \"%s\"\n"
"\tOffset: %08lX\n"
"\t Error: Public is already typed, can't become export\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset) ;
EndIf ;
EndCode
#undef Tstr
#undef Pub
/*+-------------------------------------------------------------------------+
| |
| obj_COMENT |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_COMENT()
BeginDeclarations
bit_8 comment_class;
bit_8 filenum ;
char name[256];
bit_32 namelen ;
EndDeclarations
BeginCode
If Current_record_header.rec_typ IsNot COMENT_record
Then
return(False);
EndIf;
obj_ptr.b8++;
comment_class = *obj_ptr.b8++;
Using comment_class
BeginCase
When 158:
DOSSEG.val = True;
break;
When 160:
Using *obj_ptr.b8++
BeginCase
When 1:
Import() ;
break ;
When 2:
Export() ;
break ;
Otherwise:
break ;
EndCase ;
break ;
When 161:
codeview_information_present = True;
break;
When 163:
/* lib mod */
break ;
When 232:
If debug.val IsNotZero
Then
filenum = *obj_ptr.b8++ ;
namelen = *obj_ptr.b8++ ;
memcpy(name,obj_ptr.b8,namelen) ;
name[namelen] = 0;
linnum_new_module(filenum, name) ;
EndIf
break ;
Otherwise:
break;
EndCase;
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_component |
| |
+-------------------------------------------------------------------------+*/
/* obj_component:: obj_data | obj_debug_record */
bit_16 obj_component()
BeginDeclarations
EndDeclarations
BeginCode
If obj_data() OrIf obj_debug_record()
Then
return(True);
EndIf;
return(False);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_content_def |
| |
+-------------------------------------------------------------------------+*/
/* obj_content_def:: obj_data_record {obj_FIXUPP} */
bit_16 obj_content_def()
BeginDeclarations
EndDeclarations
BeginCode
If Not obj_data_record()
Then
return(False);
EndIf;
While obj_FIXUPP()
BeginWhile
EndWhile;
(*last_LxDATA_lseg).hasFixups = (*last_LxDATA_lseg).virtualseg ;
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_data |
| |
+-------------------------------------------------------------------------+*/
/* obj_data:: obj_content_def |
obj_thread_def |
obj_TYPDEF |
obj_PUBDEF |
obj_EXTDEF */
bit_16 obj_data()
BeginDeclarations
EndDeclarations
BeginCode
If obj_content_def() OrIf
obj_thread_def() OrIf
obj_TYPDEF() OrIf
obj_PUBDEF() OrIf
obj_EXTDEF() OrIf
obj_FORREF() OrIf
obj_COMDEF() OrIf
obj_MODEXT() OrIf
obj_MODPUB()
Then
return(True);
EndIf;
return(False);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_data_record |
| |
+-------------------------------------------------------------------------+*/
/* obj_data_record:: obj_LIDATA | obj_LEDATA */
bit_16 obj_data_record()
BeginDeclarations
EndDeclarations
BeginCode
If obj_LIDATA() OrIf obj_LEDATA()
Then
return(True);
EndIf;
return(False);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_debug_record |
| |
+-------------------------------------------------------------------------+*/
/* obj_debug_record:: obj_LINNUM */
bit_16 obj_debug_record()
BeginDeclarations
EndDeclarations
BeginCode
If obj_LINNUM()
Then
return(True);
EndIf;
return(False);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_EXTDEF |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_EXTDEF()
BeginDeclarations
bit_16 len;
public_entry_ptr pub;
#define Pub (*pub)
EndDeclarations
BeginCode
If Current_record_header.rec_typ IsNot EXTDEF_record
Then
return(False);
EndIf;
While obj_ptr.b8 IsNot end_of_record.b8
BeginWhile
If n_externals NotLessThan max_externals
Then
max_externals += 64 ;
externals = (public_entry_ptr_array)
reallocate_memory(externals,
(Bit_32(max_externals)+1L) *
Bit_32(sizeof(group_entry_ptr)));
EndIf;
len = obj_name_length();
If case_ignore.val
Then
far_to_lower(BytePtr(obj_ptr.b8), len);
EndIf;
pub = lookup_public(len, obj_ptr.b8, 0);
obj_ptr.b8 += len;
obj_name_length(); /* Eat the type index. */
externals[++n_externals] = pub;
If Pub.type_entry Is unused
Then
Insert pub AtEnd InList external_list EndInsert;
Pub.type_entry = external;
Else
If (Pub.type_entry Is public_in_library) AndIf
(Not Pub.Library.requested)
Then
library_request_count++;
(*Pub.Library.lib_file).request_count++;
Pub.Library.requested = True;
EndIf;
EndIf;
EndWhile;
obj_next_record();
return(True);
EndCode
#undef Pub
/*+-------------------------------------------------------------------------+
| |
| obj_FIXUPP |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_FIXUPP()
BeginDeclarations
EndDeclarations
BeginCode
If (Current_record_header.rec_typ And Complement 1) IsNot FIXUPP_record
Then
return(False);
EndIf;
Need32();
FIXUPP_contains_only_threads = True;
If Not (*last_LxDATA_lseg).hasFixups
Then
While obj_ptr.b8 IsNot end_of_record.b8
BeginWhile
If (*obj_ptr.TRD_DAT).type_fixupp_record IsZero
Then
obj_FIXUPP_thread();
Else
FIXUPP_contains_only_threads = False;
obj_FIXUPP_fixup();
EndIf;
EndWhile;
EndIf ;
obj_next_record();
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_FIXUPP_fixup |
| |
+-------------------------------------------------------------------------+*/
void obj_FIXUPP_fixup()
BeginDeclarations
FIX_DAT_type FIX_DAT;
bit_16 frame_method;
LOCAT_type LOCAT;
bit_16 target_method;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -