aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish_indent.c
diff options
context:
space:
mode:
authorGravatar liljencrantz <liljencrantz@gmail.com>2008-01-14 02:47:47 +1000
committerGravatar liljencrantz <liljencrantz@gmail.com>2008-01-14 02:47:47 +1000
commit87db9517e928c9007c66ed5b23836db2dad2b693 (patch)
treeedfe373687a5afb9ba5360a456e3096d7bf2df85 /fish_indent.c
parentab3502fc8b25469429af25a94306346af590428c (diff)
Add lots of new code comments.
darcs-hash:20080113164747-75c98-9d0cefd27be7aef7ba60772616d9da7e6bb52912.gz
Diffstat (limited to 'fish_indent.c')
-rw-r--r--fish_indent.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fish_indent.c b/fish_indent.c
index d3cf9d9f..3fcb54de 100644
--- a/fish_indent.c
+++ b/fish_indent.c
@@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/** \file main.c
+/** \file fish_indent.c
The fish_indent proegram.
*/
@@ -48,7 +48,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define GETOPT_STRING "hvi"
-void read_file( FILE *f, string_buffer_t *b )
+/**
+ Read the entire contents of a file into the specified string_Buffer_t
+ */
+static void read_file( FILE *f, string_buffer_t *b )
{
while( 1 )
{
@@ -62,6 +65,9 @@ void read_file( FILE *f, string_buffer_t *b )
}
}
+/**
+ Insert the specified number of tabe into the output buffer
+ */
static void insert_tabs( string_buffer_t *out, int indent )
{
int i;
@@ -73,6 +79,9 @@ static void insert_tabs( string_buffer_t *out, int indent )
}
+/**
+ Indent the specified input
+ */
static int indent( string_buffer_t *out, wchar_t *in, int flags )
{
tokenizer tok;
@@ -217,7 +226,12 @@ static int indent( string_buffer_t *out, wchar_t *in, int flags )
return res;
}
-wchar_t *trim( wchar_t *in )
+/**
+ Remove any prefix and suffix newlines from the specified
+ string. Does not allocete a new string, edits the string in place
+ and returns a pointer somewhere into the string.
+ */
+static wchar_t *trim( wchar_t *in )
{
wchar_t *end;
@@ -245,7 +259,9 @@ wchar_t *trim( wchar_t *in )
}
-
+/**
+ The main mathod. Run the program.
+ */
int main( int argc, char **argv )
{
string_buffer_t sb_in;