diff --git a/ChangeLog b/ChangeLog index da19d4782..d0ca0e64a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-10-06 Thomas Soumarmon + + * backend/hp5400_*: fixed bug #300252 : added static to all non + SANE specific functions + changed #include into + #include "../include/sane/..." as mentioned in the + backend-writing.txt file + 2003-10-05 Gerhard Jaeger * aclocal.m4 configure configure.in: added checks for pthread.h and diff --git a/backend/hp5400.c b/backend/hp5400.c index c8b03312b..0697f1b8c 100644 --- a/backend/hp5400.c +++ b/backend/hp5400.c @@ -54,12 +54,12 @@ #include "hp5400.h" #include "hp5400_debug.h" -#include "sane/config.h" -#include "sane/sane.h" -#include "sane/sanei.h" -#include "sane/sanei_backend.h" -#include "sane/sanei_config.h" -#include "sane/saneopts.h" +#include "../include/sane/config.h" +#include "../include/sane/sane.h" +#include "../include/sane/sanei.h" +#include "../include/sane/sanei_backend.h" +#include "../include/sane/sanei_config.h" +#include "../include/sane/saneopts.h" #include /* malloc, free */ @@ -69,7 +69,7 @@ #define HP5400_CONFIG_FILE "hp5400.conf" -#define BUILD 2 +#define BUILD 3 /* (source) includes for data transfer methods */ #include "hp5400_debug.c" diff --git a/backend/hp5400_debug.c b/backend/hp5400_debug.c index dcdd651b8..c8112954e 100644 --- a/backend/hp5400_debug.c +++ b/backend/hp5400_debug.c @@ -65,7 +65,7 @@ void hp5400_dbg_start() { #undef DEBUG_DECLARE_ONLY #undef _SANEI_DEBUG_H -#include +#include "../include/sane/sanei_debug.h" #endif diff --git a/backend/hp5400_debug.h b/backend/hp5400_debug.h index 5d4b151a1..0d49bf086 100644 --- a/backend/hp5400_debug.h +++ b/backend/hp5400_debug.h @@ -51,12 +51,14 @@ #ifndef STANDALONE #define DEBUG_DECLARE_ONLY -#include +#include "../include/sane/sanei_debug.h" #define DBG_ASSERT 1 #define DBG_ERR 16 #define DBG_MSG 32 #define HP5400_DBG DBG +#define HP5400_SANE_STATIC static + #else @@ -69,6 +71,8 @@ extern FILE *DBG_MSG; void hp5400_dbg_start(); +#define HP5400_SANE_STATIC + #endif diff --git a/backend/hp5400_internal.c b/backend/hp5400_internal.c index bdd9e1656..c1ba822af 100644 --- a/backend/hp5400_internal.c +++ b/backend/hp5400_internal.c @@ -100,6 +100,7 @@ static TScannerModel Model_HP54xx = { "Hewlett-Packard", "HP54xx Flatbed Scanner" }; +HP5400_SANE_STATIC int InitHp5400_internal() { @@ -111,6 +112,7 @@ InitHp5400_internal() { return 1; } +HP5400_SANE_STATIC int FreeHp5400_internal() { @@ -121,6 +123,7 @@ FreeHp5400_internal() { } +HP5400_SANE_STATIC int WriteByte (int iHandle, int cmd, char data) { @@ -132,6 +135,7 @@ WriteByte (int iHandle, int cmd, char data) return 0; } +HP5400_SANE_STATIC int SetLamp (THWParams * pHWParams, int fLampOn) { @@ -143,6 +147,7 @@ SetLamp (THWParams * pHWParams, int fLampOn) return -1; } +HP5400_SANE_STATIC int WarmupLamp (int iHandle) { @@ -193,6 +198,7 @@ WarmupLamp (int iHandle) #define CALPIXBYBLOCK 42 +HP5400_SANE_STATIC int SetCalibration (int iHandle, int numPixels, unsigned int *low_vals[3], unsigned int *high_vals[3], int dpi) @@ -266,6 +272,7 @@ SetCalibration (int iHandle, int numPixels, unsigned int *low_vals[3], } /* Write a gamma table */ +HP5400_SANE_STATIC void WriteGammaCalibTable (int iHandle, const int *pabGammaR, const int *pabGammaG, const int *pabGammaB) @@ -297,6 +304,7 @@ WriteGammaCalibTable (int iHandle, const int *pabGammaR, const int *pabGammaG, return; } +HP5400_SANE_STATIC void SetDefaultGamma (int iHandle) { @@ -316,6 +324,7 @@ FILE *temp; #endif /* Bytes per line is the number of pixels. The actual bytes is one more */ +HP5400_SANE_STATIC void CircBufferInit (int iHandle, TDataPipe * p, int iBytesPerLine, int bpp, int iMisAlignment, int blksize, int iTransferSize) @@ -370,6 +379,7 @@ CircBufferInit (int iHandle, TDataPipe * p, int iBytesPerLine, } +HP5400_SANE_STATIC int CircBufferGetLine (int iHandle, TDataPipe * p, void *pabLine) { @@ -495,6 +505,7 @@ CircBufferGetLine (int iHandle, TDataPipe * p, void *pabLine) return 0; } +HP5400_SANE_STATIC void CircBufferExit (TDataPipe * p) { @@ -509,6 +520,7 @@ CircBufferExit (TDataPipe * p) /* bpp is BYTES per pixel */ +HP5400_SANE_STATIC void DecodeImage (FILE * file, int planes, int bpp, int xsize, int ysize, const char *filename) @@ -566,6 +578,7 @@ DecodeImage (FILE * file, int planes, int bpp, int xsize, int ysize, } +HP5400_SANE_STATIC int hp5400_test_scan_response (struct ScanResponse *resp, struct ScanRequest *req) { @@ -587,6 +600,7 @@ hp5400_test_scan_response (struct ScanResponse *resp, struct ScanRequest *req) * Note the array argument should point to an array of three NULL. These * will be overwritten with allocated pointers. */ +HP5400_SANE_STATIC int DoAverageScan (int iHandle, struct ScanRequest *req, int code, unsigned int **array) @@ -636,6 +650,7 @@ DoAverageScan (int iHandle, struct ScanRequest *req, int code, return 0; } +HP5400_SANE_STATIC int DoScan (int iHandle, struct ScanRequest *req, const char *filename, int code, struct ScanResponse *res) @@ -685,6 +700,7 @@ DoScan (int iHandle, struct ScanRequest *req, const char *filename, int code, return 0; } +HP5400_SANE_STATIC int Calibrate (int iHandle, int dpi) { @@ -818,6 +834,7 @@ Calibrate (int iHandle, int dpi) return 0; } +HP5400_SANE_STATIC int hp5400_scan (int iHandle, TScanParams * params, THWParams * pHWParams, const char *filename) @@ -885,6 +902,7 @@ hp5400_scan (int iHandle, TScanParams * params, THWParams * pHWParams, } +HP5400_SANE_STATIC int PreviewScan (int iHandle) { @@ -923,6 +941,7 @@ static char UISetup2[] = { 0x73, 0x00, 0x00, }; +HP5400_SANE_STATIC int InitScanner (int iHandle) { @@ -949,6 +968,7 @@ InitScanner (int iHandle) } /* Warning! The caller must have configured the gamma tables at this stage */ +HP5400_SANE_STATIC int InitScan (enum ScanType scantype, TScanParams * pParams, THWParams * pHWParams) @@ -1001,6 +1021,7 @@ InitScan (enum ScanType scantype, TScanParams * pParams, } /* For want of a better name ... */ +HP5400_SANE_STATIC int InitScan2 (enum ScanType scantype, struct ScanRequest *req, THWParams * pHWParams, struct ScanResponse *result, @@ -1185,6 +1206,7 @@ InitScan2 (enum ScanType scantype, struct ScanRequest *req, return 0; } +HP5400_SANE_STATIC void FinishScan (THWParams * pHWParams) { @@ -1203,6 +1225,7 @@ FinishScan (THWParams * pHWParams) } } +HP5400_SANE_STATIC int HP5400Open (THWParams * params, char *filename) { @@ -1274,12 +1297,14 @@ hp5400_close_exit: return -1; } +HP5400_SANE_STATIC void HP5400Close (THWParams * params) { hp5400_close (params->iXferHandle); } +HP5400_SANE_STATIC int HP5400Detect (char *filename, int (*_ReportDevice) (TScannerModel * pModel, diff --git a/backend/hp5400_internal.h b/backend/hp5400_internal.h index 63cacb3e7..5c9485a8a 100644 --- a/backend/hp5400_internal.h +++ b/backend/hp5400_internal.h @@ -137,98 +137,124 @@ struct ScanResponse } PACKED; - +HP5400_SANE_STATIC int InitScan2 (enum ScanType type, struct ScanRequest *req, THWParams * pHWParams, struct ScanResponse *res, int iColourOffset, int code); +HP5400_SANE_STATIC void FinishScan (THWParams * pHWParams); +HP5400_SANE_STATIC int WriteByte (int iHandle, int cmd, char data); +HP5400_SANE_STATIC int SetLamp (THWParams * pHWParams, int fLampOn); +HP5400_SANE_STATIC int WarmupLamp (int iHandle); +HP5400_SANE_STATIC int SetCalibration (int iHandle, int numPixels, unsigned int *low_vals[3], unsigned int *high_vals[3], int dpi); +HP5400_SANE_STATIC void WriteGammaCalibTable (int iHandle, const int *pabGammaR, const int *pabGammaG, const int *pabGammaB); +HP5400_SANE_STATIC void SetDefaultGamma (int iHandle); +HP5400_SANE_STATIC void CircBufferInit (int iHandle, TDataPipe * p, int iBytesPerLine, int bpp, int iMisAlignment, int blksize, int iTransferSize); +HP5400_SANE_STATIC int CircBufferGetLine (int iHandle, TDataPipe * p, void *pabLine); +HP5400_SANE_STATIC void CircBufferExit (TDataPipe * p); +HP5400_SANE_STATIC void DecodeImage (FILE * file, int planes, int bpp, int xsize, int ysize, const char *filename); + +HP5400_SANE_STATIC int hp5400_test_scan_response (struct ScanResponse *resp, struct ScanRequest *req); +HP5400_SANE_STATIC int DoAverageScan (int iHandle, struct ScanRequest *req, int code, unsigned int **array); +HP5400_SANE_STATIC int DoScan (int iHandle, struct ScanRequest *req, const char *filename, int code, struct ScanResponse *res); +HP5400_SANE_STATIC int Calibrate (int iHandle, int dpi); +HP5400_SANE_STATIC int hp5400_scan (int iHandle, TScanParams * params, THWParams * pHWParams, const char *filename); +HP5400_SANE_STATIC int PreviewScan (int iHandle); +HP5400_SANE_STATIC int InitScanner (int iHandle); +HP5400_SANE_STATIC int InitScan (enum ScanType scantype, TScanParams * pParams, THWParams * pHWParams); +HP5400_SANE_STATIC void FinishScan (THWParams * pHWParams); +HP5400_SANE_STATIC int HP5400Open (THWParams * params, char *filename); +HP5400_SANE_STATIC void HP5400Close (THWParams * params); +HP5400_SANE_STATIC int HP5400Detect (char *filename, int (*_ReportDevice) (TScannerModel * pModel, char *pszDeviceName)); +HP5400_SANE_STATIC int InitHp5400_internal( void ); +HP5400_SANE_STATIC int FreeHp5400_internal( void ); diff --git a/backend/hp5400_sane.c b/backend/hp5400_sane.c index ee439781a..cfd2305f2 100644 --- a/backend/hp5400_sane.c +++ b/backend/hp5400_sane.c @@ -54,13 +54,13 @@ /* definitions for debug */ #include "hp5400_debug.h" -#include "sane/sane.h" -#include "sane/sanei.h" -#include "sane/sanei_backend.h" -#include "sane/sanei_config.h" -#include "sane/saneopts.h" -#include "sane/config.h" -#include "sane/sanei_usb.h" +#include "../include/sane/sane.h" +#include "../include/sane/sanei.h" +#include "../include/sane/sanei_backend.h" +#include "../include/sane/sanei_config.h" +#include "../include/sane/saneopts.h" +#include "../include/sane/config.h" +#include "../include/sane/sanei_usb.h" #include /* malloc, free */ #include /* memcpy */ diff --git a/backend/hp5400_sanei.c b/backend/hp5400_sanei.c index ba572a8db..27a575361 100644 --- a/backend/hp5400_sanei.c +++ b/backend/hp5400_sanei.c @@ -56,7 +56,7 @@ #include "hp5400_xfer.h" #include "hp5400_debug.h" #include -#include "sane/sanei_usb.h" +#include "../include/sane/sanei_usb.h" #define CMD_INITBULK1 0x0087 /* send 0x14 */ #define CMD_INITBULK2 0x0083 /* send 0x24 */ @@ -94,6 +94,7 @@ _UsbWriteControl (int fd, int iValue, int iIndex, void *pabData, int iSize) } +HP5400_SANE_STATIC void hp5400_command_write_noverify (int fd, int iValue, void *pabData, int iSize) { @@ -117,6 +118,7 @@ _UsbReadControl (int fd, int iValue, int iIndex, void *pabData, int iSize) } +HP5400_SANE_STATIC int hp5400_open (const char *filename) { @@ -157,6 +159,7 @@ hp5400_open (const char *filename) } +HP5400_SANE_STATIC void hp5400_close (int iHandle) { @@ -165,6 +168,7 @@ hp5400_close (int iHandle) /* returns value > 0 if verify ok */ +HP5400_SANE_STATIC int hp5400_command_verify (int iHandle, int iCmd) { @@ -206,6 +210,7 @@ hp5400_command_verify (int iHandle, int iCmd) /* returns > 0 if command OK */ +HP5400_SANE_STATIC int hp5400_command_read_noverify (int iHandle, int iCmd, int iLen, void *pbData) { @@ -224,6 +229,7 @@ hp5400_command_read_noverify (int iHandle, int iCmd, int iLen, void *pbData) } /* returns > 0 if command OK */ +HP5400_SANE_STATIC int hp5400_command_read (int iHandle, int iCmd, int iLen, void *pbData) { @@ -234,6 +240,7 @@ hp5400_command_read (int iHandle, int iCmd, int iLen, void *pbData) /* returns >0 if command OK */ +HP5400_SANE_STATIC int hp5400_command_write (int iHandle, int iCmd, int iLen, void *pbData) { @@ -252,6 +259,7 @@ hp5400_command_write (int iHandle, int iCmd, int iLen, void *pbData) } /* returns >0 if command OK */ +HP5400_SANE_STATIC int hp5400_bulk_read (int iHandle, size_t len, int block, FILE * file) { @@ -293,6 +301,7 @@ hp5400_bulk_read (int iHandle, size_t len, int block, FILE * file) } /* returns >0 if command OK */ +HP5400_SANE_STATIC int hp5400_bulk_read_block (int iHandle, int iCmd, void *cmd, int cmdlen, void *buffer, int len) @@ -315,6 +324,7 @@ hp5400_bulk_read_block (int iHandle, int iCmd, void *cmd, int cmdlen, } /* returns >0 if command OK */ +HP5400_SANE_STATIC int hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, int datalen, int block, char *data) @@ -360,6 +370,7 @@ hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, retrieve on/off status from scanner @return 1 if is on 0 if is off -1 if is not reachable */ +HP5400_SANE_STATIC int hp5400_isOn (int iHandle) { diff --git a/backend/hp5400_sanei.h b/backend/hp5400_sanei.h index 1e81d887a..dc44b23a2 100644 --- a/backend/hp5400_sanei.h +++ b/backend/hp5400_sanei.h @@ -63,37 +63,37 @@ -void _UsbWriteControl (int fd, int iValue, int iIndex, void *pabData, int iSize); +HP5400_SANE_STATIC void _UsbWriteControl (int fd, int iValue, int iIndex, void *pabData, int iSize); -void hp5400_command_write_noverify (int fd, int iValue, void *pabData, int iSize); +HP5400_SANE_STATIC void hp5400_command_write_noverify (int fd, int iValue, void *pabData, int iSize); -void _UsbReadControl (int fd, int iValue, int iIndex, void *pabData, int iSize); +HP5400_SANE_STATIC void _UsbReadControl (int fd, int iValue, int iIndex, void *pabData, int iSize); -int hp5400_open (const char *filename); +HP5400_SANE_STATIC int hp5400_open (const char *filename); -void hp5400_close (int iHandle); +HP5400_SANE_STATIC void hp5400_close (int iHandle); /* returns value > 0 if verify ok */ -int hp5400_command_verify (int iHandle, int iCmd); +HP5400_SANE_STATIC int hp5400_command_verify (int iHandle, int iCmd); /* returns > 0 if command OK */ -int hp5400_command_read_noverify (int iHandle, int iCmd, int iLen, void *pbData); +HP5400_SANE_STATIC int hp5400_command_read_noverify (int iHandle, int iCmd, int iLen, void *pbData); /* returns > 0 if command OK */ -int hp5400_command_read (int iHandle, int iCmd, int iLen, void *pbData); +HP5400_SANE_STATIC int hp5400_command_read (int iHandle, int iCmd, int iLen, void *pbData); /* returns >0 if command OK */ -int hp5400_command_write (int iHandle, int iCmd, int iLen, void *pbData); +HP5400_SANE_STATIC int hp5400_command_write (int iHandle, int iCmd, int iLen, void *pbData); /* returns >0 if command OK */ -int hp5400_bulk_read (int iHandle, size_t len, int block, FILE * file); +HP5400_SANE_STATIC int hp5400_bulk_read (int iHandle, size_t len, int block, FILE * file); /* returns >0 if command OK */ -int hp5400_bulk_read_block (int iHandle, int iCmd, void *cmd, int cmdlen, +HP5400_SANE_STATIC int hp5400_bulk_read_block (int iHandle, int iCmd, void *cmd, int cmdlen, void *buffer, int len); /* returns >0 if command OK */ -int hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, +HP5400_SANE_STATIC int hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, int datalen, int block, char *data); /** @@ -101,6 +101,6 @@ int hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, retrieve on/off status from scanner @return 1 if is on 0 if is off -1 if is not reachable */ -int hp5400_isOn (int iHandle); +HP5400_SANE_STATIC int hp5400_isOn (int iHandle); #endif