text stringlengths 0 234 |
|---|
-- append new file path to the path |
writestr (new_path, cut(tmp_path)&trim ( grep (the_line,re_inc_file,2,fail => "") )); |
return cut(new_path); |
end absolute_path; |
function absolute_indent |
(indent : Integer; |
the_line : String) |
Return Integer |
is |
start : Integer; |
begin |
start := 0; |
for i in the_line'Range loop |
if the_line (i) /= ' ' then |
start := max(0,i-1); |
exit; |
end if; |
end loop; |
return indent + start; |
end absolute_indent; |
function set_comment (the_line : String) return String |
is |
re_file_ext : String := "(\.[a-z]+)"""; |
the_ext : String := grep (the_line,re_file_ext,1,fail => "?"); |
begin |
if markup then |
if the_ext = ".tex" then return "%"; |
elsif the_ext = ".py" then return "#"; |
elsif the_ext = ".cdb" then return "#"; |
elsif the_ext = ".ads" then return "--"; |
elsif the_ext = ".adb" then return "--"; |
elsif the_ext = ".adt" then return "--"; |
elsif the_ext = ".ad" then return "--"; |
else return "#"; |
end if; |
else |
return "#"; |
end if; |
end set_comment; |
function filter (the_line : String) return String |
is |
tmp_line : String := the_line; |
re_uuid : String := "(uuid):([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12})"; |
the_beg, the_end : Integer; |
found : Boolean; |
begin |
-- "uuid" is reserved for the original source |
-- the new file being created by this job must use a prefix other than "uuid" |
-- replace the prefix "uuid" with "file" |
if regex_match (the_line, re_uuid) then |
grep (the_beg, the_end, found, the_line, re_uuid, 1); |
tmp_line (the_beg..the_end) := "file"; |
end if; |
return tmp_line; |
end filter; |
begin |
recurse_depth := recurse_depth + 1; |
if recurse_depth > max_recurse_depth then |
Put_Line ("> merge-src: Too many nested Input{...}'s (max = "&str(max_recurse_depth)&"), exit"); |
halt(1); |
end if; |
declare |
src : File_Type; |
the_path : String := absolute_path (prev_path, this_line); |
the_indent : Integer := absolute_indent (prev_indent, this_line); |
comment : String := set_comment (this_line); |
begin |
if markup then |
Put_Line (txt, spc(the_indent)&comment&" beg"&make_str(recurse_depth,2)&": ./" & the_path); |
end if; |
if File_Exists (the_path) |
then Open (src, In_File, the_path); |
else raise Name_Error with "Could not find the file "&""""&str(the_path)&""""; |
end if; |
loop |
begin |
declare |
the_line : String := filter (Get_Line (src)); |
begin |
if is_include_file (the_line) |
then include_files (the_path, the_line, the_indent); |
else Put_Line (txt, spc(the_indent)&the_line); |
end if; |
Function Definition: procedure evolve_data is |
Function Body: looping : Boolean; |
task type SlaveTask is |
entry resume; |
entry pause; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.