diff options
author | Will Estes <wlestes@users.sourceforge.net> | 2002-08-27 18:07:19 +0000 |
---|---|---|
committer | Will Estes <wlestes@users.sourceforge.net> | 2002-08-27 18:07:19 +0000 |
commit | 3e58ded5164af663649c86ab3f273310c2c57d37 (patch) | |
tree | b9c93a6215354a21740a2f52eb57a4a1192f5f6b /ccl.c | |
parent | 1dc652849525bdce070d741fbce3c0cc40c81ed2 (diff) |
ran the indent target; commit the results
Diffstat (limited to 'ccl.c')
-rw-r--r-- | ccl.c | 101 |
1 files changed, 51 insertions, 50 deletions
@@ -35,61 +35,63 @@ /* ccladd - add a single character to a ccl */ -void ccladd( cclp, ch ) -int cclp; -int ch; - { - int ind, len, newpos, i; +void ccladd (cclp, ch) + int cclp; + int ch; +{ + int ind, len, newpos, i; - check_char( ch ); + check_char (ch); len = ccllen[cclp]; ind = cclmap[cclp]; /* check to see if the character is already in the ccl */ - for ( i = 0; i < len; ++i ) - if ( ccltbl[ind + i] == ch ) + for (i = 0; i < len; ++i) + if (ccltbl[ind + i] == ch) return; /* mark newlines */ if (ch == nlch) ccl_has_nl[cclp] = true; - + newpos = ind + len; - if ( newpos >= current_max_ccl_tbl_size ) - { + if (newpos >= current_max_ccl_tbl_size) { current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT; ++num_reallocs; - ccltbl = reallocate_Character_array( ccltbl, - current_max_ccl_tbl_size ); - } + ccltbl = reallocate_Character_array (ccltbl, + current_max_ccl_tbl_size); + } ccllen[cclp] = len + 1; ccltbl[newpos] = ch; - } +} /* cclinit - return an empty ccl */ -int cclinit() - { - if ( ++lastccl >= current_maxccls ) - { +int cclinit () +{ + if (++lastccl >= current_maxccls) { current_maxccls += MAX_CCLS_INCREMENT; ++num_reallocs; - cclmap = reallocate_integer_array( cclmap, current_maxccls ); - ccllen = reallocate_integer_array( ccllen, current_maxccls ); - cclng = reallocate_integer_array( cclng, current_maxccls ); - ccl_has_nl = reallocate_bool_array( ccl_has_nl, current_maxccls ); - } + cclmap = + reallocate_integer_array (cclmap, current_maxccls); + ccllen = + reallocate_integer_array (ccllen, current_maxccls); + cclng = reallocate_integer_array (cclng, current_maxccls); + ccl_has_nl = + reallocate_bool_array (ccl_has_nl, + current_maxccls); + } - if ( lastccl == 1 ) + if (lastccl == 1) /* we're making the first ccl */ cclmap[lastccl] = 0; @@ -99,24 +101,25 @@ int cclinit() * ccl, adding the length of the ccl to the cclmap pointer * will produce a cursor to the first free space. */ - cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1]; + cclmap[lastccl] = + cclmap[lastccl - 1] + ccllen[lastccl - 1]; ccllen[lastccl] = 0; cclng[lastccl] = 0; /* ccl's start out life un-negated */ ccl_has_nl[lastccl] = false; return lastccl; - } +} /* cclnegate - negate the given ccl */ -void cclnegate( cclp ) -int cclp; - { +void cclnegate (cclp) + int cclp; +{ cclng[cclp] = 1; ccl_has_nl[cclp] = !ccl_has_nl[cclp]; - } +} /* list_character_set - list the members of a set of characters in CCL form @@ -126,34 +129,32 @@ int cclp; * has a non-zero value in the cset array. */ -void list_character_set( file, cset ) -FILE *file; -int cset[]; - { +void list_character_set (file, cset) + FILE *file; + int cset[]; +{ register int i; - putc( '[', file ); + putc ('[', file); - for ( i = 0; i < csize; ++i ) - { - if ( cset[i] ) - { + for (i = 0; i < csize; ++i) { + if (cset[i]) { register int start_char = i; - putc( ' ', file ); + putc (' ', file); - fputs( readable_form( i ), file ); + fputs (readable_form (i), file); - while ( ++i < csize && cset[i] ) - ; + while (++i < csize && cset[i]) ; - if ( i - 1 > start_char ) + if (i - 1 > start_char) /* this was a run */ - fprintf( file, "-%s", readable_form( i - 1 ) ); + fprintf (file, "-%s", + readable_form (i - 1)); - putc( ' ', file ); - } + putc (' ', file); } - - putc( ']', file ); } + + putc (']', file); +} |