Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
82
Мова:
Українська
inc(own_record,
4+length(obj_rec(add_only_offset(buffer,own_record)^).name));
checksum := unit_ptr(add_only_offset(buffer,own_record))^.checksum;
{ add the uses units to the unit_list }
offset := header_ptr(buffer)^.ofs_this_unit;
while offset <> 0 do
begin
unit_obj := add_only_offset(buffer,offset);
info_ofs := sizeof(obj_rec)-sizeof(string)+1+length(unit_obj^.name);
obj_info := add_only_offset(buffer,offset+info_ofs);
add_unit(unit_obj^.name,nil);
obj_info^.target := get_unit_num(unit_obj^.name);
offset := obj_info^.next_unit;
end;
end;
end;
end;
function get_unit(unit_ofs:word):unit_list_ptr;
var
the_unit : unit_ptr;
begin
if unit_ofs > unit_list[1]^.own_record then
begin
the_unit := add_only_offset(buffer,unit_ofs);
get_unit := unit_list[the_unit^.target];
end
else
get_unit := unit_list[1];
end;
function get_unit_name(unit_ofs:word):String;
var
the_unit : unit_ptr;
begin
if unit_ofs > unit_list[1]^.own_record then
begin
the_unit := add_only_offset(buffer,unit_ofs);
get_unit_name := unit_list[the_unit^.target]^.name;
end
else
get_unit_name := unit_list[1]^.name;
end;
function get_unit_buffer(buffer:pointer;unit_ofs:word):unit_list_ptr;
var
the_unit : unit_ptr;
begin
the_unit := add_only_offset(buffer,unit_ofs);
get_unit_buffer := unit_list[the_unit^.target];
end;
function get_unit_by_name(const name:string):unit_list_ptr;
var
i : word;
begin
i := get_unit_num(name);
if i <> 0 then
get_unit_by_name := unit_list[i]
else
get_unit_by_name := nil;
end;
function get_unit_num(name:string):word;
var
i : word;
begin
name:=upper(name);
for i:=1 to num_known do
if unit_list[i]^.name = name then
begin
get_unit_num := i;
exit;
end;
get_unit_num := 0;
end;
procedure LoadTpl;
var
total:longint;
header:header_ptr;
i : integer;
procedure InsertToList(offset:longint;size:word);
var Aux:tpl_item_ptr;
begin
Aux:=New(tpl_item_ptr);
Aux^.Size:=size;
read_file(tpl_buffer.path,pointer(Aux^.buffer),offset,size);
Aux^.Next:=tpl_buffer.First;
tpl_buffer.First:=Aux;
end;
begin
with tpl_buffer do
begin
path := tpl_name;
first := nil;
total := 0;
ReadPathFile(path,header);
if header <> nil then
begin
while header<>nil do
begin
if header^.file_id<>tpu_file_id then
begin
WriteOutput('Warning: '+path+' version mismatch.');
exit;
end;
InsertToList(total,header^.sym_size);
freemem(header,sizeof(header^));
header:=header_ptr(First^.Buffer);
Inc(total,
roundup(header^.sym_size,16)
{$IFNDEF UNIT60}
+roundup(header^.browser_size,16)
{$ENDIF}
+roundup(header^.code_size,16)
+roundup(header^.reloc_size,16)
+roundup(header^.const_size,16)
+roundup(header^.const_reloc_size,16));
read_file(path,pointer(header),total,sizeof(header^));
end;
end;
end;
end;
end.
Blocks.pas
unit blocks3;
{$I SWITCHES.INC}
{ These are the routines that print the name definitions }
{reloc - to print relocation records }
interface
uses
dump,util,globals,loader,head,nametype,dos;
{$IFNDEF UNIT60}
type
entry_flags = set of (ent_exported,ent_from_dll,ent_by_name,f08,f10,f20,f40,f80);
{$ELSE}
const
ent_exported = exported;
ent_from_dll = from_dll;
ent_by_name = by_name;
type
entry_flags = obj_flags;
{$ENDIF}
entry_pt_ptr = ^entry_pt_rec;
entry_pt_rec