2012-02-29

the subfiler subprogram

2.23: adde/subfiler:
intro:
. the first subprogram I should make is to
input a subject file
and decompose it into several subfiles .
. pay attention to the datestamps,
applying them to each associated output file .
. it shows each of the subfiles intended for output
along with any chunks not assigned to separate files,
showing the relationship as a hierarchy .
. it shows the full internal file name
that it's basing that filename on
(it follows portability rules for filenames).
details:
. there are 2 main formats defined by
either {zero, one} number of spaces
between {title, body};
the one-spacer should have had
2 or blank lines before title,
and then the end of that title's body is defined as
2 or more consecutive lines .
. for a zero-spacer,
the end of subfile is defined as the next blank line .
[. there may be some situation where an end of file
is not followed by either a {title, eof}
-- this is an error
or where one subfile is nested within another?
that should be rare, and review should correct it.]

. the title may be missing a colon,
but a subfile title has one div in it,
and is preceded by at least one blank line .

TOC: table of contents:
. it shows you a TOC of what it thinks the subfiles are,
and it shows any other lines that might be titles*
but that it decided were not,
so you can see how sane it is
(these are content lines).
*:( any line with a div in it preceded by a blank line )
. all content lines are indented,
so only top level (unindented lines)
are the heads of a separate subfile .

. for the first version,
instead of a fancy interactive menu for
adjusting mistakes you or it made,
it should give you the original line numbers
so then you can use your usual editor to visit those line#'s
(the next version can integrate an editor).
[2.29:
. it can help you do the file syntax reviewing:
just print every line preceded by a blank line,
print a blank line if the file has
2 or more blank lines in a row .
. it also prints the associated file numbers .
. it then asks you "(ok to run subfiler?). ]

. a good function to start with is
size.int`= [number of blank lines](inout [next line].string);
. after it returns,
[next string] contains the next non-blank,
and size is the number of blanks .
. if [next line]`length =0,
then eof has been reached .

. a next version might move things to proper folders
according to what the subfile paths are .
. the expectation is that a reviewer has
checked the syntax and made the changes to the file path
so that in case it was written a long time ago,
the path is changed to become currently relevant .
[2.29:
. a next version can help you edit like so:
it generates a file of numbered lines
rather than printing them;
then after you adjust any lines in your editor
and run subfiler on this file,
it copies your changes back to the original file .
it then proceeds to do the subfiler routine,
complete with parking files in the right folders .]

No comments:

Post a Comment