Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
82
Мова:
Українська
:= get_unit(in_unit);
if orig_unit <> nil then
begin
if orig_unit <> unit_list[1] then
write(orig_unit^.name,'.');
writeln(find_name(orig_unit,offset),';');
end
else
WriteError('?????;');
end
else
begin
if const_flag in flags then
if local in flags then
write(' absolute $'+hexword(in_unit)+':$'+hexword(offset))
else
write('=',oneindent,'?');
if in_function and not (const_flag in flags) then
begin
write(';',tab,'{BP ofs ');
if integer(offset)<0 then
write('-')
else
write('+');
write(hexwordasm(abs(integer(offset))));
writeln('}');
end
else
begin
write(';');
if flags<>[const_flag,local] then
begin
write(tab,'{ofs ',hexwordblank(offset));
if not (last_kind in [record_id,object_id,objpriv_id]) then
write(' in block ',hexwordblank(in_unit));
write('}');
end;
writeln;
end;
end;
if v128 in flags then
WriteError('Unknown variable flag '+HexWord(Byte(flags)));
end;
end;
procedure write_args(arg:arg_ptr;num_args:word);
var
i:word;
begin
writeln('(');
inc(indentation);
for i:=1 to num_args do
begin
with arg^ do
begin
indent;
if referenced in flags then
write('var ')
else if const_arg in flags then
write('const ')
else
write(' ');
if flags - [referenced,const_arg] <> [local] then
begin
WriteError('{ flags ='+hexbyte(byte(flags))+' }');
indent;
end;
write('arg',i,':',oneindent);
write_var_type(type_unit,type_def_ofs);
if i<>num_args then
writeln(';')
else
writeln;
end;
arg := add_only_offset(arg,sizeof(arg_rec));
end;
indent;
write(')');
dec(indentation);
end;
procedure write_locals(var name:string; info:func_info_ptr);
var
obj_list : list_ptr;
save_in_function : boolean;
begin
if info^.local_hash = 0 then
exit;
save_in_function := in_function;
in_function := true;
build_list(obj_list,buffer,add_only_offset(buffer,info^.local_hash));
inc(indentation);
indent; writeln('{ ',name,' locals begin...}');
print_name_list(obj_list);
indent; writeln('{ ...',name,' locals end.}');
writeln;
dec(indentation);
in_function := save_in_function;
end;
procedure write_proc_type(var name:string; flags:code_flags; info:func_type_ptr);
var
proc : boolean;
begin
with info^ do
begin
if (type_def_ofs = 0) and (type_unit = 0) then
proc := true
else
proc := false;
if construct in flags then
write('constructor',oneindent,name)
else if destruct in flags then
write('destructor',oneindent,name)
else
if proc then
write('procedure',oneindent,name)
else
write('function',oneindent,name);
if info^.num_args > 0 then
write_args(arg_ptr(add_only_offset(info,sizeof(func_type_rec))),
info^.num_args);
if not proc then
begin
write(':',oneindent);
write_var_type(type_unit,type_def_ofs);
end;
end;
if Name<>'' then
write(';');
end;
{$IFDEF UNIT60}
procedure write_proc_info(var name:string; info:func_info_ptr);
var
entry_pt : entry_pt_ptr;
code : ^word;
i : word;
unknown_flags : obj_flags;
begin
indent;
with info^ do
begin
write_proc_type(name,code_type,func_type_ptr(addr(func_type)));
entry_pt := add_only_offset(buffer,header^.ofs_entry_pts+entry_ofs);
if vmt_entry > 0 then
begin
write(' virtual');