Tags: patch I pulled out some fixes from Ubuntu https://launchpad.net/ubuntu/+source/comedilib/0.10.1-1ubuntu2 and added some other Debian bug fixes.
What is not addressed is #732685, since that will take something beyond what debdiff can represent to get a new debian source package tarball uploaded and installed... This builds in current Debian unstable, so solves #733322. -Maitland
diff -Nru comedilib-0.10.1/debian/changelog comedilib-0.10.1/debian/changelog --- comedilib-0.10.1/debian/changelog 2013-08-18 04:32:17.000000000 -0400 +++ comedilib-0.10.1/debian/changelog 2014-03-31 19:11:16.000000000 -0400 @@ -1,3 +1,26 @@ +comedilib (0.10.1-2) unstable; urgency=low + + * Bring in Ubuntu fixes (patch from A. Maitland Bottoms) + (Closes: #727345, #733322, #711203) + + -- Gudjon I. Gudjonsson <gud...@gudjon.org> Mon, 31 Mar 2014 22:40:31 +0200 + +comedilib (0.10.1-1ubuntu2) trusty; urgency=low + + * Use dh-autoreconf to resolve FTBFS on ppc64el. + + -- Daniel T Chen <crim...@ubuntu.com> Wed, 08 Jan 2014 13:12:42 -0500 + +comedilib (0.10.1-1ubuntu1) trusty; urgency=low + + * FTBFS fixes: + - Backport upstream changesets 90ce9a9, cc0c9e7, f4e228e, c689eff, + and 2277e82; + - Use explicit parameters. + * Closes: #733322. LP: #1264686. + + -- Daniel T Chen <crim...@ubuntu.com> Tue, 07 Jan 2014 17:22:30 -0500 + comedilib (0.10.1-1) unstable; urgency=low * New upstream release diff -Nru comedilib-0.10.1/debian/control comedilib-0.10.1/debian/control --- comedilib-0.10.1/debian/control 2013-04-27 17:12:24.000000000 -0400 +++ comedilib-0.10.1/debian/control 2014-03-31 18:43:02.000000000 -0400 @@ -2,7 +2,7 @@ Section: devel Priority: optional Maintainer: Gudjon I. Gudjonsson <gud...@gudjon.org> -Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), python-all-dev, autotools-dev, +Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), python-all-dev, dh-autoreconf, swig, docbook-utils, dblatex, bison, flex, libtool, xmlto, imagemagick, fop, libboost-program-options-dev, libgsl0-dev, hardening-wrapper Standards-Version: 3.9.4 diff -Nru comedilib-0.10.1/debian/libcomedi0.dirs comedilib-0.10.1/debian/libcomedi0.dirs --- comedilib-0.10.1/debian/libcomedi0.dirs 2012-06-03 19:35:26.000000000 -0400 +++ comedilib-0.10.1/debian/libcomedi0.dirs 2014-03-31 19:14:12.000000000 -0400 @@ -6,3 +6,4 @@ usr/share/doc/libcomedi0/ etc/pcmcia/ lib/udev/rules.d/ +var/lib/comedi/calibrations diff -Nru comedilib-0.10.1/debian/libcomedi0.install comedilib-0.10.1/debian/libcomedi0.install --- comedilib-0.10.1/debian/libcomedi0.install 2012-06-03 19:35:38.000000000 -0400 +++ comedilib-0.10.1/debian/libcomedi0.install 2014-03-31 19:10:51.000000000 -0400 @@ -1,11 +1,12 @@ +etc/pcmcia/* +lib/udev/* usr/lib/libcomedi.so.* #usr/lib/ruby/* -usr/sbin/* +usr/bin/comedi_board_info usr/bin/comedi_calibrate +usr/bin/comedi_soft_calibrate usr/bin/comedi_test +usr/sbin/* usr/share/man/man7/* usr/share/man/man8/* usr/share/doc/comedilib/*.conf usr/share/doc/libcomedi0/ -etc/pcmcia/* -lib/udev/* - diff -Nru comedilib-0.10.1/debian/patches/04_bison.patch comedilib-0.10.1/debian/patches/04_bison.patch --- comedilib-0.10.1/debian/patches/04_bison.patch 2013-08-14 16:58:59.000000000 -0400 +++ comedilib-0.10.1/debian/patches/04_bison.patch 1969-12-31 19:00:00.000000000 -0500 @@ -1,59 +0,0 @@ -Description: Fix build failure with bison 2.6 -Origin: upstream, - http://comedi.org/git?p=comedi/comedilib.git;a=commitdiff;h=90ce9a94bdb6b26a9cbffdf2e9922b0b1f668a65;hp=3dfae5a6ee6040d294493f3856a3949e1b602af0 -Bug-Debian: http://bugs.debian.org/710622 -Last-Update: 2013-08-11 - ---- comedilib-0.10.0.orig/lib/calib_yacc.y -+++ comedilib-0.10.0/lib/calib_yacc.y -@@ -28,13 +28,14 @@ - #include <math.h> - #include <string.h> - #include <stdlib.h> --#include "calib_yacc.h" --#include "calib_lex.h" - - #define YYERROR_VERBOSE - #define YYPARSE_PARAM parse_arg - #define YYLEX_PARAM priv(YYPARSE_PARAM)->yyscanner - -+#include "calib_yacc.h" -+#include "calib_lex.h" -+ - enum polynomial_direction - { - POLYNOMIAL_TO_PHYS, -@@ -347,6 +348,11 @@ extern comedi_calibration_t* _comedi_par - return priv.parsed_file; - } - -+static void yyerror(const char *s) -+{ -+ fprintf(stderr, "%s\n", s); -+} -+ - %} - - %pure_parser -@@ -504,10 +510,5 @@ extern comedi_calibration_t* _comedi_par - - %% - --void calib_yyerror(char *s) --{ -- fprintf(stderr, "%s\n", s); --} -- - - ---- comedilib-0.10.0.orig/lib/libinternal.h -+++ comedilib-0.10.0/lib/libinternal.h -@@ -146,8 +146,6 @@ int valid_chan(comedi_t *it,unsigned int - int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan); - - #define YY_DECL int calib_yylex(YYSTYPE *calib_lvalp, yyscan_t yyscanner) --void calib_yyerror(char *s); --int calib_yyparse(void *parse_arg); - - #endif - diff -Nru comedilib-0.10.1/debian/patches/04_new_bison.patch comedilib-0.10.1/debian/patches/04_new_bison.patch --- comedilib-0.10.1/debian/patches/04_new_bison.patch 1969-12-31 19:00:00.000000000 -0500 +++ comedilib-0.10.1/debian/patches/04_new_bison.patch 2014-03-31 18:37:56.000000000 -0400 @@ -0,0 +1,775 @@ +Index: comedilib-0.10.1/lib/calib_lex.l +=================================================================== +--- comedilib-0.10.1.orig/lib/calib_lex.l 2014-01-07 17:17:46.120064499 -0500 ++++ comedilib-0.10.1/lib/calib_lex.l 2014-01-07 17:19:30.965518265 -0500 +@@ -31,6 +31,8 @@ + #include "libinternal.h" + #include "calib_yacc.h" + ++#define YY_NO_INPUT ++ + %} + + %x COMMENT +Index: comedilib-0.10.1/lib/calib_yacc.y +=================================================================== +--- comedilib-0.10.1.orig/lib/calib_yacc.y 2014-01-07 17:17:46.108063299 -0500 ++++ comedilib-0.10.1/lib/calib_yacc.y 2014-01-07 17:22:12.611832960 -0500 +@@ -28,12 +28,12 @@ + #include <math.h> + #include <string.h> + #include <stdlib.h> +-#include "calib_yacc.h" +-#include "calib_lex.h" + + #define YYERROR_VERBOSE +-#define YYPARSE_PARAM parse_arg +-#define YYLEX_PARAM priv(YYPARSE_PARAM)->yyscanner ++#define LEX_PARAM parse_arg->yyscanner ++ ++#include "calib_yacc.h" ++#include "calib_lex.h" + + enum polynomial_direction + { +@@ -41,7 +41,7 @@ + POLYNOMIAL_FROM_PHYS + }; + +-typedef struct ++struct calib_yyparse_private + { + yyscan_t yyscanner; + comedi_calibration_t *parsed_file; +@@ -49,15 +49,10 @@ + int cal_index; + unsigned num_coefficients; + comedi_polynomial_t polynomial; +-} calib_yyparse_private_t; ++}; + + YY_DECL; + +-static inline calib_yyparse_private_t* priv( calib_yyparse_private_t *parse_arg) +-{ +- return parse_arg; +-} +- + static void free_calibration_setting( comedi_calibration_setting_t *setting ) + { + if( setting->channels ); +@@ -317,39 +312,18 @@ + } + } + +-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 ) ++static void yyerror(calib_yyparse_private_t *parse_arg, const char *s) + { +- 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; ++ fprintf(stderr, "%s\n", s); + } + + %} + +-%pure_parser ++%pure-parser ++ ++%parse-param {calib_yyparse_private_t *parse_arg} ++ ++%lex-param {LEX_PARAM} + + %union + { +@@ -372,7 +346,7 @@ + input: '{' hash '}' + | error + { +- fprintf(stderr, "input error on line %i\n", calib_yyget_lineno(priv(parse_arg)->yyscanner)); ++ fprintf(stderr, "input error on line %i\n", calib_yyget_lineno(parse_arg->yyscanner)); + // fprintf(stderr, "input error on line %i\n", @1.first_line ); + YYABORT; + } +@@ -385,13 +359,13 @@ + + hash_element: T_DRIVER_NAME T_ASSIGN T_STRING + { +- if( priv(parse_arg)->parsed_file->driver_name != NULL ) YYABORT; +- priv(parse_arg)->parsed_file->driver_name = strdup( $3 ); ++ if( parse_arg->parsed_file->driver_name != NULL ) YYABORT; ++ parse_arg->parsed_file->driver_name = strdup( $3 ); + } + | T_BOARD_NAME T_ASSIGN T_STRING + { +- if( priv(parse_arg)->parsed_file->board_name != NULL ) YYABORT; +- priv(parse_arg)->parsed_file->board_name = strdup( $3 ); ++ if( parse_arg->parsed_file->board_name != NULL ) YYABORT; ++ parse_arg->parsed_file->board_name = strdup( $3 ); + } + | T_CALIBRATIONS T_ASSIGN '[' calibrations_array ']' + ; +@@ -401,8 +375,8 @@ + | '{' calibration_setting '}' ',' calibrations_array + ; + +- calibration_setting: /* empty */ { priv(parse_arg)->cal_index++; } +- | calibration_setting_element { priv(parse_arg)->cal_index++; } ++ calibration_setting: /* empty */ { parse_arg->cal_index++; } ++ | calibration_setting_element { parse_arg->cal_index++; } + | calibration_setting_element ',' calibration_setting + ; + +@@ -420,12 +394,12 @@ + | T_SOFTCAL_TO_PHYS T_ASSIGN '{' polynomial '}' + { + if(add_polynomial(parse_arg, POLYNOMIAL_TO_PHYS) < 0) YYERROR; +- priv(parse_arg)->num_coefficients = 0; ++ parse_arg->num_coefficients = 0; + } + | T_SOFTCAL_FROM_PHYS T_ASSIGN '{' polynomial '}' + { + if(add_polynomial(parse_arg, POLYNOMIAL_FROM_PHYS) < 0) YYERROR; +- priv(parse_arg)->num_coefficients = 0; ++ parse_arg->num_coefficients = 0; + } + ; + +@@ -458,14 +432,14 @@ + | '{' caldac '}' ',' caldacs_array + ; + +- caldac: /* empty */ { if(add_caldac( parse_arg, priv(parse_arg)->caldac ) < 0) YYERROR; } +- | caldac_element { if(add_caldac( parse_arg, priv(parse_arg)->caldac ) < 0) YYERROR; } ++ caldac: /* empty */ { if(add_caldac( parse_arg, parse_arg->caldac ) < 0) YYERROR; } ++ | caldac_element { if(add_caldac( parse_arg, parse_arg->caldac ) < 0) YYERROR; } + | caldac_element ',' caldac + ; + +- caldac_element: T_SUBDEVICE T_ASSIGN T_NUMBER { priv(parse_arg)->caldac.subdevice = $3; } +- | T_CHANNEL T_ASSIGN T_NUMBER { priv(parse_arg)->caldac.channel = $3; } +- | T_VALUE T_ASSIGN T_NUMBER { priv(parse_arg)->caldac.value = $3; } ++ caldac_element: T_SUBDEVICE T_ASSIGN T_NUMBER { parse_arg->caldac.subdevice = $3; } ++ | T_CHANNEL T_ASSIGN T_NUMBER { parse_arg->caldac.channel = $3; } ++ | T_VALUE T_ASSIGN T_NUMBER { parse_arg->caldac.value = $3; } + ; + + polynomial: /* empty */ +@@ -494,20 +468,45 @@ + + expansion_origin: T_FLOAT + { +- priv(parse_arg)->polynomial.expansion_origin = $1; ++ parse_arg->polynomial.expansion_origin = $1; + } + | T_NUMBER + { +- priv(parse_arg)->polynomial.expansion_origin = $1; ++ parse_arg->polynomial.expansion_origin = $1; + } + ; + + %% + +-void calib_yyerror(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 ) + { +- fprintf(stderr, "%s\n", s); +-} ++ 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; ++} + + +Index: comedilib-0.10.1/lib/libinternal.h +=================================================================== +--- comedilib-0.10.1.orig/lib/libinternal.h 2014-01-07 17:17:46.132065695 -0500 ++++ comedilib-0.10.1/lib/libinternal.h 2014-01-07 17:20:57.106739088 -0500 +@@ -85,6 +85,8 @@ + typedef struct subdevice_struct subdevice; + typedef struct device_struct device; + ++typedef struct calib_yyparse_private calib_yyparse_private_t; ++ + struct comedi_t_struct{ + int magic; + +@@ -146,8 +148,6 @@ + int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan); + + #define YY_DECL int calib_yylex(YYSTYPE *calib_lvalp, yyscan_t yyscanner) +-void calib_yyerror(char *s); +-int calib_yyparse(void *parse_arg); + + #endif + +Index: comedilib-0.10.1/lib/calib_yacc.y.orig +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ comedilib-0.10.1/lib/calib_yacc.y.orig 2014-01-07 17:20:57.106739088 -0500 +@@ -0,0 +1,517 @@ ++%{ ++/* ++ lib/calib_yacc.y ++ code for parsing calibration file, generated by bison ++ ++ Copyright (C) 2003 Frank Mori Hess <fmh...@users.sourceforge.net> ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation, version 2.1 ++ of the License. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 ++ USA. ++*/ ++ ++#define _GNU_SOURCE ++ ++#include <stdio.h> ++#include "libinternal.h" ++#include <math.h> ++#include <string.h> ++#include <stdlib.h> ++ ++#define YYERROR_VERBOSE ++#define LEX_PARAM parse_arg->yyscanner ++ ++#include "calib_yacc.h" ++#include "calib_lex.h" ++ ++enum polynomial_direction ++{ ++ POLYNOMIAL_TO_PHYS, ++ POLYNOMIAL_FROM_PHYS ++}; ++ ++struct calib_yyparse_private ++{ ++ yyscan_t yyscanner; ++ comedi_calibration_t *parsed_file; ++ comedi_caldac_t caldac; ++ int cal_index; ++ unsigned num_coefficients; ++ comedi_polynomial_t polynomial; ++}; ++ ++YY_DECL; ++ ++static inline calib_yyparse_private_t* priv( calib_yyparse_private_t *parse_arg) ++{ ++ return parse_arg; ++} ++ ++static void free_calibration_setting( comedi_calibration_setting_t *setting ) ++{ ++ if( setting->channels ); ++ { ++ free( setting->channels ); ++ setting->channels = NULL; ++ setting->num_channels = 0; ++ } ++ if( setting->ranges ); ++ { ++ free( setting->ranges ); ++ setting->ranges = NULL; ++ setting->num_ranges = 0; ++ } ++ setting->num_arefs = 0; ++ if( setting->caldacs ); ++ { ++ free( setting->caldacs ); ++ setting->caldacs = NULL; ++ setting->num_caldacs = 0; ++ } ++ if(setting->soft_calibration.to_phys) ++ { ++ free(setting->soft_calibration.to_phys); ++ setting->soft_calibration.to_phys = NULL; ++ } ++ if(setting->soft_calibration.from_phys) ++ { ++ free(setting->soft_calibration.from_phys); ++ setting->soft_calibration.from_phys = NULL; ++ } ++} ++ ++static void free_settings( comedi_calibration_t *file_contents ) ++{ ++ int i; ++ ++ if( file_contents->settings == NULL ) return; ++ ++ for( i = 0; i < file_contents->num_settings; i++ ) ++ { ++ free_calibration_setting( &file_contents->settings[ i ] ); ++ } ++ free(file_contents->settings); ++ file_contents->settings = NULL; ++} ++ ++static int add_calibration_setting( comedi_calibration_t *file_contents ) ++{ ++ comedi_calibration_setting_t *temp; ++ ++ temp = realloc( file_contents->settings, ++ ( file_contents->num_settings + 1 ) * sizeof( comedi_calibration_setting_t ) ); ++ if( temp == NULL ) ++ { ++ fprintf(stderr, "%s: realloc failed to allocate memory.\n", __FUNCTION__); ++ return -1; ++ } ++ file_contents->settings = temp; ++ memset( &file_contents->settings[ file_contents->num_settings ], ++ 0, sizeof( comedi_calibration_setting_t ) ); ++ ++ file_contents->num_settings++; ++ return 0; ++} ++ ++static comedi_calibration_setting_t* current_setting( calib_yyparse_private_t *priv ) ++{ ++ int retval; ++ ++ while( priv->cal_index >= priv->parsed_file->num_settings ) ++ { ++ retval = add_calibration_setting( priv->parsed_file ); ++ if( retval < 0 ) return NULL; ++ } ++ return &priv->parsed_file->settings[ priv->cal_index ]; ++} ++ ++static int add_channel( calib_yyparse_private_t *priv, int channel ) ++{ ++ unsigned *temp; ++ comedi_calibration_setting_t *setting; ++ ++ setting = current_setting( priv ); ++ if( setting == NULL ) return -1; ++ ++ temp = realloc( setting->channels, ( setting->num_channels + 1 ) * sizeof(unsigned) ); ++ if( temp == NULL ) ++ { ++ fprintf(stderr, "%s: realloc failed to allocate memory.\n", __FUNCTION__); ++ return -1; ++ } ++ setting->channels = temp; ++ setting->channels[ setting->num_channels++ ] = channel; ++ return 0; ++} ++ ++static int add_range( calib_yyparse_private_t *priv, int range ) ++{ ++ unsigned *temp; ++ comedi_calibration_setting_t *setting; ++ ++ setting = current_setting( priv ); ++ if( setting == NULL ) return -1; ++ ++ temp = realloc( setting->ranges, ( setting->num_ranges + 1 ) * sizeof(unsigned) ); ++ if( temp == NULL ) ++ { ++ fprintf(stderr, "%s: realloc failed to allocate memory.\n", __FUNCTION__); ++ return -1; ++ } ++ setting->ranges = temp; ++ setting->ranges[ setting->num_ranges++ ] = range; ++ return 0; ++} ++ ++static int add_aref( calib_yyparse_private_t *priv, int aref ) ++{ ++ comedi_calibration_setting_t *setting; ++ ++ setting = current_setting( priv ); ++ if( setting == NULL ) return -1; ++ ++ if( setting->num_arefs >= sizeof( setting->arefs ) / ++ sizeof( setting->arefs[ 0 ] ) ) ++ return -1; ++ setting->arefs[ setting->num_arefs++ ] = aref; ++ return 0; ++} ++ ++static int add_caldac( calib_yyparse_private_t *priv, ++ comedi_caldac_t caldac ) ++{ ++ comedi_caldac_t *temp; ++ comedi_calibration_setting_t *setting; ++ ++ setting = current_setting( priv ); ++ if( setting == NULL ) return -1; ++ ++ temp = realloc( setting->caldacs, ( setting->num_caldacs + 1 ) * ++ sizeof( comedi_caldac_t ) ); ++ if( temp == NULL ) ++ { ++ fprintf(stderr, "%s: realloc failed to allocate memory.\n", __FUNCTION__); ++ return -1; ++ } ++ setting->caldacs = temp; ++ setting->caldacs[ setting->num_caldacs++ ] = caldac; ++ return 0; ++} ++ ++static int add_polynomial(calib_yyparse_private_t *priv, enum polynomial_direction polynomial_direction) ++{ ++ comedi_calibration_setting_t *setting; ++ ++ setting = current_setting( priv ); ++ if( setting == NULL ) ++ { ++ fprintf(stderr, "%s: current_setting returned NULL\n", __FUNCTION__); ++ return -1; ++ } ++ if(priv->num_coefficients < 1) ++ { ++ fprintf(stderr, "%s: polynomial has no coefficients.\n", __FUNCTION__); ++ return -1; ++ } ++ if(polynomial_direction == POLYNOMIAL_TO_PHYS) ++ { ++ if(setting->soft_calibration.to_phys) return -1; ++ setting->soft_calibration.to_phys = malloc(sizeof(comedi_polynomial_t)); ++ *setting->soft_calibration.to_phys = priv->polynomial; ++ }else ++ { ++ if(setting->soft_calibration.from_phys) return -1; ++ setting->soft_calibration.from_phys = malloc(sizeof(comedi_polynomial_t)); ++ *setting->soft_calibration.from_phys = priv->polynomial; ++ } ++ return 0; ++} ++ ++static int add_polynomial_coefficient(calib_yyparse_private_t *priv, double coefficient) ++{ ++ if(priv->num_coefficients >= COMEDI_MAX_NUM_POLYNOMIAL_COEFFICIENTS) ++ { ++ fprintf(stderr, "too many coefficients for polynomial,\n"); ++ fprintf(stderr, "num_coefficients=%i, max is %i .\n", priv->num_coefficients, COMEDI_MAX_NUM_POLYNOMIAL_COEFFICIENTS); ++ return -1; ++ } ++ priv->polynomial.order = priv->num_coefficients; ++ priv->polynomial.coefficients[priv->num_coefficients++] = coefficient; ++ return 0; ++} ++ ++static comedi_calibration_t* alloc_calib_parse( void ) ++{ ++ comedi_calibration_t *file_contents; ++ ++ file_contents = malloc( sizeof( *file_contents ) ); ++ if( file_contents == NULL ) return file_contents; ++ memset( file_contents, 0, sizeof( *file_contents ) ); ++ return file_contents; ++} ++ ++EXPORT_ALIAS_DEFAULT(_comedi_cleanup_calibration,comedi_cleanup_calibration,0.7.20); ++extern void _comedi_cleanup_calibration( comedi_calibration_t *file_contents ) ++{ ++ if(file_contents == NULL) return; ++ if( file_contents->driver_name ) ++ { ++ free( file_contents->driver_name ); ++ file_contents->driver_name = NULL; ++ } ++ if( file_contents->board_name ) ++ { ++ free( file_contents->board_name ); ++ file_contents->board_name = NULL; ++ } ++ free_settings( file_contents ); ++ free( file_contents ); ++} ++ ++static comedi_polynomial_t* alloc_inverse_linear_polynomial(const comedi_polynomial_t *polynomial) ++{ ++ comedi_polynomial_t *inverse; ++ if(polynomial->order != 1) return NULL; ++ inverse = malloc(sizeof(comedi_polynomial_t)); ++ memset(inverse, 0, sizeof(comedi_polynomial_t)); ++ inverse->order = 1; ++ inverse->expansion_origin = polynomial->coefficients[0]; ++ inverse->coefficients[0] = polynomial->expansion_origin; ++ inverse->coefficients[1] = 1. / polynomial->coefficients[1]; ++ if(isfinite(inverse->coefficients[1]) == 0) ++ { ++ free(inverse); ++ return NULL; ++ } ++ return inverse; ++} ++ ++static void fill_inverse_linear_polynomials(comedi_calibration_t *calibration) ++{ ++ unsigned i; ++ for(i = 0; i < calibration->num_settings; ++i) ++ { ++ if(calibration->settings[i].soft_calibration.to_phys) ++ { ++ if(calibration->settings[i].soft_calibration.from_phys == NULL) ++ { ++ calibration->settings[i].soft_calibration.from_phys = ++ alloc_inverse_linear_polynomial(calibration->settings[i].soft_calibration.to_phys); ++ } ++ }else if(calibration->settings[i].soft_calibration.from_phys) ++ { ++ calibration->settings[i].soft_calibration.to_phys = ++ alloc_inverse_linear_polynomial(calibration->settings[i].soft_calibration.from_phys); ++ } ++ } ++} ++ ++static void yyerror(calib_yyparse_private_t *parse_arg, const char *s) ++{ ++ fprintf(stderr, "%s\n", s); ++} ++ ++%} ++ ++%pure-parser ++ ++%parse-param {calib_yyparse_private_t *parse_arg} ++ ++%lex-param {LEX_PARAM} ++ ++%union ++{ ++ int ival; ++ double dval; ++ char *sval; ++} ++ ++%token T_DRIVER_NAME T_BOARD_NAME T_CALIBRATIONS T_SUBDEVICE T_CHANNELS ++%token T_RANGES T_AREFS T_CALDACS T_CHANNEL T_VALUE T_NUMBER T_STRING ++%token T_COEFFICIENTS T_EXPANSION_ORIGIN T_SOFTCAL_TO_PHYS T_SOFTCAL_FROM_PHYS ++%token T_ASSIGN T_FLOAT ++ ++%type <ival> T_NUMBER ++%type <sval> T_STRING ++%type <dval> T_FLOAT ++ ++%% ++ ++ input: '{' hash '}' ++ | error ++ { ++ fprintf(stderr, "input error on line %i\n", calib_yyget_lineno(priv(parse_arg)->yyscanner)); ++// fprintf(stderr, "input error on line %i\n", @1.first_line ); ++ YYABORT; ++ } ++ ; ++ ++ hash: /* empty */ ++ | hash_element ++ | hash_element ',' hash ++ ; ++ ++ hash_element: T_DRIVER_NAME T_ASSIGN T_STRING ++ { ++ if( priv(parse_arg)->parsed_file->driver_name != NULL ) YYABORT; ++ priv(parse_arg)->parsed_file->driver_name = strdup( $3 ); ++ } ++ | T_BOARD_NAME T_ASSIGN T_STRING ++ { ++ if( priv(parse_arg)->parsed_file->board_name != NULL ) YYABORT; ++ priv(parse_arg)->parsed_file->board_name = strdup( $3 ); ++ } ++ | T_CALIBRATIONS T_ASSIGN '[' calibrations_array ']' ++ ; ++ ++ calibrations_array: /* empty */ ++ | '{' calibration_setting '}' ++ | '{' calibration_setting '}' ',' calibrations_array ++ ; ++ ++ calibration_setting: /* empty */ { priv(parse_arg)->cal_index++; } ++ | calibration_setting_element { priv(parse_arg)->cal_index++; } ++ | calibration_setting_element ',' calibration_setting ++ ; ++ ++ calibration_setting_element: T_SUBDEVICE T_ASSIGN T_NUMBER ++ { ++ comedi_calibration_setting_t *setting; ++ setting = current_setting( parse_arg ); ++ if( setting == NULL ) YYABORT; ++ setting->subdevice = $3; ++ } ++ | T_CHANNELS T_ASSIGN '[' channels_array ']' ++ | T_RANGES T_ASSIGN '[' ranges_array ']' ++ | T_AREFS T_ASSIGN '[' arefs_array ']' ++ | T_CALDACS T_ASSIGN '[' caldacs_array ']' ++ | T_SOFTCAL_TO_PHYS T_ASSIGN '{' polynomial '}' ++ { ++ if(add_polynomial(parse_arg, POLYNOMIAL_TO_PHYS) < 0) YYERROR; ++ priv(parse_arg)->num_coefficients = 0; ++ } ++ | T_SOFTCAL_FROM_PHYS T_ASSIGN '{' polynomial '}' ++ { ++ if(add_polynomial(parse_arg, POLYNOMIAL_FROM_PHYS) < 0) YYERROR; ++ priv(parse_arg)->num_coefficients = 0; ++ } ++ ; ++ ++ channels_array: /* empty */ ++ | channel ++ | channel ',' channels_array ++ ; ++ ++ channel: T_NUMBER { if(add_channel( parse_arg, $1 ) < 0) YYERROR; } ++ ; ++ ++ ranges_array: /* empty */ ++ | range ++ | range ',' ranges_array ++ ; ++ ++ range: T_NUMBER { if(add_range( parse_arg, $1 ) < 0) YYERROR; } ++ ; ++ ++ arefs_array: /* empty */ ++ | aref ++ | aref ',' arefs_array ++ ; ++ ++ aref: T_NUMBER { if(add_aref( parse_arg, $1 ) < 0) YYERROR; } ++ ; ++ ++ caldacs_array: /* empty */ ++ | '{' caldac '}' ++ | '{' caldac '}' ',' caldacs_array ++ ; ++ ++ caldac: /* empty */ { if(add_caldac( parse_arg, priv(parse_arg)->caldac ) < 0) YYERROR; } ++ | caldac_element { if(add_caldac( parse_arg, priv(parse_arg)->caldac ) < 0) YYERROR; } ++ | caldac_element ',' caldac ++ ; ++ ++ caldac_element: T_SUBDEVICE T_ASSIGN T_NUMBER { priv(parse_arg)->caldac.subdevice = $3; } ++ | T_CHANNEL T_ASSIGN T_NUMBER { priv(parse_arg)->caldac.channel = $3; } ++ | T_VALUE T_ASSIGN T_NUMBER { priv(parse_arg)->caldac.value = $3; } ++ ; ++ ++ polynomial: /* empty */ ++ | polynomial_element ++ | polynomial_element ',' polynomial ++ ; ++ ++ polynomial_element: T_COEFFICIENTS T_ASSIGN '[' coefficient_array ']' ++ | T_EXPANSION_ORIGIN T_ASSIGN expansion_origin ++ ; ++ ++ coefficient_array: /* empty */ ++ | coefficient ++ | coefficient ',' coefficient_array ++ ; ++ ++ coefficient: T_FLOAT ++ { ++ if(add_polynomial_coefficient(parse_arg, $1) < 0) YYERROR; ++ } ++ | T_NUMBER ++ { ++ if(add_polynomial_coefficient(parse_arg, $1) < 0) YYERROR; ++ } ++ ; ++ ++ expansion_origin: T_FLOAT ++ { ++ priv(parse_arg)->polynomial.expansion_origin = $1; ++ } ++ | T_NUMBER ++ { ++ priv(parse_arg)->polynomial.expansion_origin = $1; ++ } ++ ; ++ ++%% ++ ++ ++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; ++} ++ ++ diff -Nru comedilib-0.10.1/debian/patches/05_automake_warning.patch comedilib-0.10.1/debian/patches/05_automake_warning.patch --- comedilib-0.10.1/debian/patches/05_automake_warning.patch 1969-12-31 19:00:00.000000000 -0500 +++ comedilib-0.10.1/debian/patches/05_automake_warning.patch 2014-03-31 18:37:56.000000000 -0400 @@ -0,0 +1,21 @@ +Index: comedilib-0.10.1/configure.ac +=================================================================== +--- comedilib-0.10.1.orig/configure.ac 2012-08-22 07:48:48.000000000 -0400 ++++ comedilib-0.10.1/configure.ac 2014-01-08 15:09:19.160460885 -0500 +@@ -29,6 +29,8 @@ + m4_define([scxi_lt_revision], [0]) + m4_define([scxi_lt_age], [9]) + ++m4_pattern_allow([AM_PROG_AR]) ++ + # comedilib library version: major.minor.micro + # comedilib package version: major.minor.micro[letter] + # +@@ -105,6 +107,7 @@ + AM_PROG_LEX + AC_PROG_YACC + AC_PROG_LIBTOOL ++AM_PROG_AR + + AC_HEADER_STDC([]) + diff -Nru comedilib-0.10.1/debian/patches/series comedilib-0.10.1/debian/patches/series --- comedilib-0.10.1/debian/patches/series 2013-08-14 16:59:28.000000000 -0400 +++ comedilib-0.10.1/debian/patches/series 2014-03-31 18:37:56.000000000 -0400 @@ -1,5 +1,6 @@ 01_calibrate_build.patch 02_fix_manpages.patch 03_fix_compile.patch -04_bison.patch +04_new_bison.patch +05_automake_warning.patch diff -Nru comedilib-0.10.1/debian/rules comedilib-0.10.1/debian/rules --- comedilib-0.10.1/debian/rules 2013-04-28 04:04:15.000000000 -0400 +++ comedilib-0.10.1/debian/rules 2014-03-31 18:37:56.000000000 -0400 @@ -30,6 +30,7 @@ cp /usr/share/misc/config.guess . cp /usr/share/misc/config.sub comedi-calibrate/ cp /usr/share/misc/config.guess comedi-calibrate/ + dh_autoreconf for pyvers in ${PYTHONS}; \ do\ mkdir -p pybuild/$$pyvers; \ @@ -108,6 +109,7 @@ [ ! -f comedi-calibrate/Makefile ]] || cd comedi-calibrate && [ ! -f Makefile ] || $(MAKE) distclean find . -name Makefile -exec rm -f {} \; #rm -f comedi-calibrate + dh_autoreconf_clean dh_clean install: build