From cc0c9e740579640ef92ee5e7d37d6453cb2c8e9c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 21 Mar 2013 15:36:14 +0000 Subject: [PATCH] lib/calib_yacc.y: Move comedi_parse_calibration_file() Move the comedi_parse_calibration_file() function definition to the bottom of the file. It calls calib_yyparse() and the declaration might not be in scope since we removed the declaration from "lib/libinternal.h", but we know it will be declared somewhere above the bottom of the generated "lib/calib_yacc.c" above the new location of comedi_parse_calibration_file(). --- lib/calib_yacc.y | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/calib_yacc.y b/lib/calib_yacc.y index 94483d9..9624143 100644 --- a/lib/calib_yacc.y +++ b/lib/calib_yacc.y @@ -318,36 +318,6 @@ static void fill_inverse_linear_polynomials(comedi_calibration_t *calibration) } } -EXPORT_ALIAS_DEFAULT(_comedi_parse_calibration_file,comedi_parse_calibration_file,0.7.20); -extern comedi_calibration_t* _comedi_parse_calibration_file( const char *cal_file_path ) -{ - calib_yyparse_private_t priv; - FILE *file; - - if( cal_file_path == NULL ) return NULL; - memset(&priv, 0, sizeof(calib_yyparse_private_t)); - priv.parsed_file = alloc_calib_parse(); - if( priv.parsed_file == NULL ) return NULL; - - file = fopen( cal_file_path, "r" ); - if( file == NULL ) - { - COMEDILIB_DEBUG( 3, "failed to open file\n" ); - return NULL; - } - calib_yylex_init(&priv.yyscanner); - calib_yyrestart(file, priv.yyscanner); - if( calib_yyparse( &priv ) ) - { - comedi_cleanup_calibration( priv.parsed_file ); - priv.parsed_file = NULL; - } - calib_yylex_destroy(priv.yyscanner); - fclose( file ); - fill_inverse_linear_polynomials(priv.parsed_file); - return priv.parsed_file; -} - static void yyerror(const char *s) { fprintf(stderr, "%s\n", s); @@ -511,4 +481,34 @@ static void yyerror(const char *s) %% +EXPORT_ALIAS_DEFAULT(_comedi_parse_calibration_file,comedi_parse_calibration_file,0.7.20); +extern comedi_calibration_t* _comedi_parse_calibration_file( const char *cal_file_path ) +{ + calib_yyparse_private_t priv; + FILE *file; + + if( cal_file_path == NULL ) return NULL; + memset(&priv, 0, sizeof(calib_yyparse_private_t)); + priv.parsed_file = alloc_calib_parse(); + if( priv.parsed_file == NULL ) return NULL; + + file = fopen( cal_file_path, "r" ); + if( file == NULL ) + { + COMEDILIB_DEBUG( 3, "failed to open file\n" ); + return NULL; + } + calib_yylex_init(&priv.yyscanner); + calib_yyrestart(file, priv.yyscanner); + if( calib_yyparse( &priv ) ) + { + comedi_cleanup_calibration( priv.parsed_file ); + priv.parsed_file = NULL; + } + calib_yylex_destroy(priv.yyscanner); + fclose( file ); + fill_inverse_linear_polynomials(priv.parsed_file); + return priv.parsed_file; +} + -- 2.26.2