📄 tmodule.c
字号:
"segments defined.\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset,
index, n_segments);
EndIf;
return(index);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_iterated_data_block |
| |
+-------------------------------------------------------------------------+*/
void obj_iterated_data_block()
BeginDeclarations
bit_16 block_count;
bit_8 *content;
bit_16 i;
bit_16 j;
bit_16 len;
bit_16 repeat_count;
EndDeclarations
BeginCode
repeat_count = *obj_ptr.b16++;
block_count = *obj_ptr.b16++;
If block_count IsNotZero
Then /* Handle recursive case: Content is iterated data block */
content = obj_ptr.b8;
For i=0; i<repeat_count; i++
BeginFor
obj_ptr.b8 = content;
For j=0; j<block_count; j++
BeginFor
obj_iterated_data_block();
EndFor;
EndFor;
Else /* Handle non-recursive case: Content is data. */
len = Bit_16(*obj_ptr.b8++);
For i=0; i<repeat_count; i++
BeginFor
far_move(Addr(last_LxDATA_Lseg.data[LIDATA_offset]),
obj_ptr.b8, len);
LIDATA_offset += len;
EndFor;
obj_ptr.b8 += len;
EndIf;
return;
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_iterated_data_block_length |
| |
+-------------------------------------------------------------------------+*/
bit_32 obj_iterated_data_block_length()
BeginDeclarations
bit_16 block_count;
bit_16 i;
bit_16 len;
bit_32 length;
bit_16 repeat_count;
EndDeclarations
BeginCode
repeat_count = *obj_ptr.b16++;
block_count = *obj_ptr.b16++;
If repeat_count IsZero
Then /* This is a translator error. */
linker_error(12, "Translator error:\n"
"\tModule: \"%Fs\"\n"
"\t File: \"%Fs\"\n"
"\tOffset: %lu\n"
"\t Error: Repeat count in LIDATA iterated data block "
"is zero.\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset);
EndIf;
length = 0L;
If block_count IsNotZero
Then /* Handle recursive case: Content is iterated data block */
For i=0; i<block_count; i++
BeginFor
length += Bit_32(repeat_count) * obj_iterated_data_block_length();
EndFor;
Else /* Handle non-recursive case: Content is data. */
len = Bit_16(*obj_ptr.b8++);
obj_ptr.b8 += len;
length = Bit_32(repeat_count) * Bit_32(len);
EndIf;
return(length);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_leaf_descriptor |
| |
+-------------------------------------------------------------------------+*/
bit_32 obj_leaf_descriptor()
BeginDeclarations
bit_8 element_size;
EndDeclarations
BeginCode
element_size = *obj_ptr.b8++;
If element_size LessThan 129
Then
return(Bit_32(element_size));
Else
If element_size Is 129
Then
return(Bit_32(*obj_ptr.b16++));
Else
If element_size Is 132
Then
obj_ptr.b8--;
return((*obj_ptr.b32++) And 0x00FFFFFFL);
Else
If element_size Is 136
Then
return(*obj_ptr.b32++);
Else
linker_error(12, "Translator error:\n"
"\tModule: \"%Fs\"\n"
"\t File: \"%Fs\"\n"
"\tOffset: %lu\n"
"\t Error: Communal element size of %u is illegal.\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset,
element_size);
EndIf;
EndIf;
EndIf;
EndIf;
return(0L);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_LEDATA |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_LEDATA()
BeginDeclarations
bit_32 next_byte;
bit_16 len;
lseg_ptr lseg;
#define Lseg (*lseg)
bit_16 offset;
bit_16 segment_index;
EndDeclarations
BeginCode
If Current_record_header.rec_typ IsNot LEDATA_record
Then
return(False);
EndIf;
last_LxDATA_record_type = Current_record_header.rec_typ;
segment_index = obj_index_segment();
last_LxDATA_lseg =
lseg = snames[segment_index];
len = Current_record_header.rec_len - 4;
If segment_index Exceeds 127
Then
len--;
EndIf;
last_LxDATA_offset =
offset = *obj_ptr.b16++;
next_byte = Bit_32(offset) + Bit_32(len);
If next_byte Exceeds Lseg.length
Then
linker_error(12, "Translator error:\n"
"\tModule: \"%Fs\"\n"
"\t File: \"%Fs\"\n"
"\tOffset: %lu\n"
"\t Error: Attempt to initialize past end of LSEG.\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset);
EndIf;
If next_byte Exceeds Lseg.highest_uninitialized_byte
Then
Lseg.highest_uninitialized_byte = next_byte;
EndIf;
If (*last_LxDATA_Lseg.segment).combine IsNot common_combine
Then
far_move(Addr(Lseg.data[offset]), obj_ptr.b8, len);
Else /* We must save the initialization data out to the tmp file until
later when we know the length. */
write_temp_file(Current_record_header.rec_typ,
last_LxDATA_lseg,
last_LxDATA_offset,
BytePtr(obj_ptr.b8),
len);
EndIf;
obj_next_record();
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_LIDATA |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_LIDATA()
BeginDeclarations
bit_16 len;
bit_32 LIDATA_length;
bit_32 next_byte;
bit_16 segment_index;
EndDeclarations
BeginCode
If Current_record_header.rec_typ IsNot LIDATA_record
Then
return(False);
EndIf;
far_move(BytePtr(last_LIDATA_record),
BytePtr(object_file_element),
Current_record_header.rec_len + sizeof(obj_record_header_type) - 1);
last_LxDATA_record_type = Current_record_header.rec_typ;
segment_index = obj_index_segment();
last_LxDATA_lseg = snames[segment_index];
LIDATA_offset =
last_LxDATA_offset = *obj_ptr.b16++;
LIDATA_length = obj_LIDATA_length();
next_byte = last_LxDATA_offset + LIDATA_length;
If next_byte Exceeds last_LxDATA_Lseg.length
Then
linker_error(12, "Translator error:\n"
"\tModule: \"%Fs\"\n"
"\t File: \"%Fs\"\n"
"\tOffset: %lu\n"
"\t Error: Attempt to initialize past end of LSEG.\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset);
EndIf;
If next_byte Exceeds last_LxDATA_Lseg.highest_uninitialized_byte
Then
last_LxDATA_Lseg.highest_uninitialized_byte = next_byte;
EndIf;
If (*last_LxDATA_Lseg.segment).combine IsNot common_combine
Then
While obj_ptr.b8 IsNot end_of_record.b8
BeginWhile
obj_iterated_data_block();
EndWhile;
Else /* We must save the initialization data out to the tmp file until
later when we know the length. */
len = Current_record_header.rec_len - 4;
If segment_index Exceeds 127
Then
len--;
EndIf;
write_temp_file(Current_record_header.rec_typ,
last_LxDATA_lseg,
last_LxDATA_offset,
BytePtr(obj_ptr.b8),
len);
EndIf;
obj_next_record();
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_LIDATA_length |
| |
+-------------------------------------------------------------------------+*/
bit_32 obj_LIDATA_length()
BeginDeclarations
bit_32 length;
bit_8 *start;
EndDeclarations
BeginCode
start = obj_ptr.b8;
length = 0L;
While obj_ptr.b8 IsNot end_of_record.b8
BeginWhile
length += obj_iterated_data_block_length();
EndWhile;
obj_ptr.b8 = start;
return(length);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_LINNUM |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_LINNUM()
BeginDeclarations
EndDeclarations
BeginCode
If Current_record_header.rec_typ IsNot LINNUM_record
Then
return(False);
EndIf;
obj_next_record();
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_LNAMES |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_LNAMES()
BeginDeclarations
EndDeclarations
BeginCode
If Current_record_header.rec_typ IsNot LNAMES_record
Then
return(False);
EndIf;
While obj_ptr.b8 IsNot end_of_record.b8
BeginWhile
If n_lnames NotLessThan max_lnames.val
Then
linker_error(12, "Internal limit exceeded:\n"
"\tModule: \"%Fs\"\n"
"\t File: \"%Fs\"\n"
"\tOffset: %lu\n"
"\t Error: Too many LNAMES. Max of %u exceeded.\n"
"\t Retry with larger \"/maxlnames:n\" switch.\n",
(*tmodule_name).symbol,
(*infile.file_info).filename,
current_record_offset,
max_lnames.val);
EndIf;
lnames[++n_lnames] = obj_name();
EndWhile;
obj_next_record();
return(True);
EndCode
/*+-------------------------------------------------------------------------+
| |
| obj_MODEND |
| |
+-------------------------------------------------------------------------+*/
bit_16 obj_MODEND()
BeginDeclarations
FIX_DAT_type END_DAT;
bit_16 frame_method;
MOD_TYP_type MOD_TYP;
bit_16 target_method;
bit_16 thread_number;
EndDeclarations
BeginCode
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -