Download from
http://www.nyangau.org/flatten/flatten.zip.
FLATTEN processes folded files and produces flattened output.
Folded files are edited by Andys Source Code Folding Editor and contain "fold-creases' in special reserved comments. As a result they can look strange when edited in other editors, and when printed.
usage: flatten [-f] [-F] [-v] [-V] [-l] [-a|-A] [-r] [-i inifn] [-d lang] {fn}
flags: -f display contents of open folds
-F display contents of all folds (implies -f)
-v display contents of open virtual folds
-V display contents of all virtual folds (implies -v)
-l disable output of fold lines
-a -A highlight output in colour, or don't (ANSI)
-r show reserved comment start rules first
-i inifn specify initialisation file to scan for language info
-d lang override default language (used if can't guess the language
from the name, or if reading stdin, default is "top")
fn filename(s), no extension assumed (- for stdin)
Consider this contrived example :-
$ cat myfunctest.c
/* Sample */
/*...sincludes:0:*/
#include <stdio.h>
#include "myfunc.h"
/*...vmyfunc\46\h:0:*/
/*...e*/
int main(void)
{
if ( myfunc_init() )
/*...sdo the test:16:*/
{
printf("Test result is %d\n", myfunc_test(1,2,3));
myfunc_term();
}
/*...e*/
return 0;
}
We can use flatten to flatten it :-
$ flatten -F myfunctest.c
/* Sample */
{{{ includes
#include <stdio.h>
#include "myfunc.h"
::: myfunc.h
}}}
int main(void)
{
if ( myfunc_init() )
{{{ do the test
{
printf("Test result is %d\n", myfunc_test(1,2,3));
myfunc_term();
}
}}}
return 0;
}
-F tells FLATTEN to enter all folds.