This is Unofficial EPICS BASE Doxygen Site
ccl.c File Reference
#include "flexdef.h"
+ Include dependency graph for ccl.c:

Go to the source code of this file.

Functions

void ccladd (int cclp, int ch)
 
int cclinit (void)
 
void cclnegate (int cclp)
 
void list_character_set (FILE *file, int cset[])
 

Function Documentation

void ccladd ( int  cclp,
int  ch 
)

Definition at line 47 of file ccl.c.

48 {
49  int ind, len, newpos, i;
50 
51  len = ccllen[cclp];
52  ind = cclmap[cclp];
53 
54  /* check to see if the character is already in the ccl */
55 
56  for ( i = 0; i < len; ++i )
57  if ( ccltbl[ind + i] == ch )
58  return;
59 
60  newpos = ind + len;
61 
62  if ( newpos >= current_max_ccl_tbl_size )
63  {
65 
66  ++num_reallocs;
67 
69  }
70 
71  ccllen[cclp] = len + 1;
72  ccltbl[newpos] = ch;
73  }
int i
Definition: scan.c:967
int num_reallocs
Definition: flex.c:100
int * ccllen
Definition: flex.c:96
int * cclmap
Definition: flex.c:96
#define reallocate_character_array(array, size)
Definition: flexdef.h:610
Char * ccltbl
Definition: flex.c:98
#define MAX_CCL_TBL_SIZE_INCREMENT
Definition: flexdef.h:165
int current_max_ccl_tbl_size
Definition: flex.c:97
int cclinit ( void  )

Definition at line 83 of file ccl.c.

84 {
85  if ( ++lastccl >= current_maxccls )
86  {
88 
89  ++num_reallocs;
90 
94  }
95 
96  if ( lastccl == 1 )
97  /* we're making the first ccl */
98  cclmap[lastccl] = 0;
99 
100  else
101  /* the new pointer is just past the end of the last ccl. Since
102  * the cclmap points to the \first/ character of a ccl, adding the
103  * length of the ccl to the cclmap pointer will produce a cursor
104  * to the first free space
105  */
106  cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1];
107 
108  ccllen[lastccl] = 0;
109  cclng[lastccl] = 0; /* ccl's start out life un-negated */
110 
111  return ( lastccl );
112  }
#define MAX_CCLS_INCREMENT
Definition: flexdef.h:161
int num_reallocs
Definition: flex.c:100
int current_maxccls
Definition: flex.c:96
int * cclng
Definition: flex.c:96
#define reallocate_integer_array(array, size)
Definition: flexdef.h:584
int * ccllen
Definition: flex.c:96
int * cclmap
Definition: flex.c:96
int lastccl
Definition: flex.c:96
void cclnegate ( int  cclp)

Definition at line 122 of file ccl.c.

123 {
124  cclng[cclp] = 1;
125  }
int * cclng
Definition: flex.c:96
void list_character_set ( FILE *  file,
int  cset[] 
)

Definition at line 140 of file ccl.c.

141 {
142  int i;
143  char *readable_form();
144 
145  putc( '[', file );
146 
147  for ( i = 0; i < csize; ++i )
148  {
149  if ( cset[i] )
150  {
151  int start_char = i;
152 
153  putc( ' ', file );
154 
155  fputs( readable_form( i ), file );
156 
157  while ( ++i < csize && cset[i] )
158  ;
159 
160  if ( i - 1 > start_char )
161  /* this was a run */
162  fprintf( file, "-%s", readable_form( i - 1 ) );
163 
164  putc( ' ', file );
165  }
166  }
167 
168  putc( ']', file );
169  }
int i
Definition: scan.c:967
char * readable_form(int c)
Definition: misc.c:672
int csize
Definition: flex.c:68