Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
82
Мова:
Українська
write_enum_const(type_obj,def^.lower);
write('..');
write_enum_const(type_obj,def^.upper);
end;
end;
else
begin
WriteError('Type definition of type '+decword(type_type));
writeln(' otherbyte=',other_byte,'size=',size);
indent;
write(' junk=');
for i:=3 to 8 do
write(who_knows[i]:6);
writeln;
end;
end;
end;
end;
end;
{$ENDIF}
procedure write_type_info(var name:string; obj:obj_ptr; info:type_info_ptr);
var
def_obj : obj_ptr;
begin
indent;
if (last_kind <> record_id) and (last_kind <> type_id) then
begin
writeln('type');
indent;
last_kind := type_id;
end;
write(oneindent,name,'=',oneindent);
with info^ do
if obj = find_type(get_unit(type_unit),type_def_ofs) then
write_type_def(add_only_offset(buffer,type_def_ofs))
else
write_var_type(type_unit,type_def_ofs);
writeln(';');
end;
function find_type(unit_rec:unit_list_ptr;def_ofs:word):obj_ptr;
var
current:list_ptr;
obj : obj_ptr;
obj_info : type_info_ptr;
begin
with unit_rec^ do
begin
if (obj_list = nil) and (buffer <> nil) then
build_list(obj_list,buffer,add_only_offset(buffer,header_ptr(buffer)^.ofs_hashtable));
if obj_list <> nil then
begin
current := obj_list;
while current^.offset < $ffff do
begin
obj := add_only_offset(buffer,current^.offset);
obj_info := add_only_offset(obj,4+length(obj^.name));
if (obj^.obj_type = type_id)
and (obj_info^.type_def_ofs = def_ofs)
and (obj_info^.type_unit = own_record) then
begin
find_type := obj;
exit;
end;
current := current^.next;
end;
end;
find_type := nil;
end;
end;
function find_type_or_proc(unit_rec:unit_list_ptr;def_ofs:word):obj_ptr;
var
current:list_ptr;
obj : obj_ptr;
obj_info : type_info_ptr;
begin
with unit_rec^ do
begin
if (obj_list = nil) and (buffer <> nil) then
build_list(obj_list,buffer,add_only_offset(buffer,header_ptr(buffer)^.ofs_hashtable));
if obj_list <> nil then
begin
current := obj_list;
while current^.offset < $ffff do
begin
obj := add_only_offset(buffer,current^.offset);
obj_info := add_only_offset(obj,4+length(obj^.name));
if ((obj^.obj_type = type_id)
and (obj_info^.type_def_ofs = def_ofs)
and (obj_info^.type_unit = own_record))
or
((obj^.obj_type = proc_id)
and (ofs(obj^)=def_ofs))
then
begin
find_type_or_proc := obj;
exit;
end;
current := current^.next;
end;
end;
find_type_or_proc := nil;
end;
end;
procedure make_proc_list_entry(var in_unit:unit_list_ptr);
var
buffer:byte_array_ptr;
lname:string;
procedure fpe(obj_list:list_ptr;var proc_list:proc_list_ptr);
var
current:list_ptr;
obj : obj_ptr;
obj_info : func_info_ptr;
obj_list2:list_ptr;
fp:string;
def:type_def_ptr;
lastlen:integer;
procedure Insert(const name:string;Entry:word);
var Aux:proc_list_ptr;
begin
New(Aux);
Aux^.name:=NewStr(name);
Aux^.Entry:=Entry;
Aux^.Next:=proc_list;
proc_list:=aux;
end;
begin
if obj_list <> nil then
begin
current := obj_list;
while current^.offset < $ffff do
begin
obj := add_only_offset(buffer,current^.offset);
obj_info := add_only_offset(obj,4+length(obj^.name));
if (obj^.obj_type = type_id) then
begin
if get_unit_buffer(buffer,type_info_ptr(obj_info)^.type_unit)^.buffer=buffer then
begin {only types defined in this unit }
def:=add_only_offset(buffer,type_info_ptr(obj_info)^.type_def_ofs);