Skip to content

Commit

Permalink
Merge pull request #64 from GTkorvo/CodLex
Browse files Browse the repository at this point in the history
Update cod.l to eliminate lex compat
  • Loading branch information
eisenhauer authored Aug 14, 2023
2 parents 46d7943 + 1165548 commit 2f3fe98
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 469 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)

# The directory label is used for CDash to treat FFS as a subproject of GTKorvo
set(CMAKE_DIRECTORY_LABELS FFS)
Expand Down
63 changes: 0 additions & 63 deletions cod/cod.l
Original file line number Diff line number Diff line change
Expand Up @@ -359,70 +359,9 @@ yywrap YY_PROTO(( void ))
}


#ifndef input
/* flex, not lex */
void yy_delete_buffer YY_PROTO((YY_BUFFER_STATE b));

#ifdef WINNT
/* old Windows code for MKS Toolkit version of flex */

static void
terminate_string_parse()
{
yyrestart(NULL);
}

#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
{
return (void *) malloc( size );
}

static char* current_input_string;

int my_yy_input(buf,result,max_size) {

if (current_input_string == NULL)
{

result = 0;
}
else
if (max_size < strlen(current_input_string))
{
memcpy((void*)buf, current_input_string, max_size);
current_input_string += max_size;
result = max_size;
} else {
int n = strlen(current_input_string);
memcpy((void*)buf, current_input_string, n+1);
current_input_string = NULL;
result = n;
}

/* printf("my_yy_input buf[%s],result[%d]\n",buf,result);*/
return result;
}

static void
setup_for_string_parse(string, defined_types, enum_constants)
const char *string;
char **defined_types;
char **enum_constants;
{
type_count = defined_type_count;
types = defined_types;
enums = enum_constants;

current_input_string = string;
lex_offset = 1;
line_count = 1;
}
#else

static YY_BUFFER_STATE bb = NULL;

Expand Down Expand Up @@ -455,5 +394,3 @@ terminate_string_parse()
}
}

#endif
#endif
Loading

0 comments on commit 2f3fe98

Please sign in to comment.