Reformat of source code to get rid of different coding styles used by different

authors over the years.
merge-requests/1/head
Karl Heinz Kremer 2004-02-08 18:32:33 +00:00
rodzic db44edb31c
commit 5a3f789018
7 zmienionych plików z 4702 dodań i 4513 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2004-02-08 Karl Heinz Kremer <khk@khk.net>
* backend/epson*.[ch]: Reformat source code to get rid of different coding styles
used over the years (and by different authors).
2004-02-08 Frank Zago <fzago at austin dot rr dot com>
* README.windows: added info about USB scanners.

Plik diff jest za duży Load Diff

Wyświetl plik

@ -80,216 +80,181 @@
#define SANE_EPSON_MAX_RETRIES (120) /* how often do we retry during warmup ? */
typedef struct {
char * level;
typedef struct
{
char *level;
unsigned char request_identity;
unsigned char request_identity2; /* new request identity command for Dx command level */
unsigned char request_status;
unsigned char request_condition;
unsigned char set_color_mode;
unsigned char start_scanning;
unsigned char set_data_format;
unsigned char set_resolution;
unsigned char set_zoom;
unsigned char set_scan_area;
unsigned char set_bright;
SANE_Range bright_range;
unsigned char set_gamma;
unsigned char set_halftoning;
unsigned char set_color_correction;
unsigned char initialize_scanner;
unsigned char set_speed; /* B4 and later */
unsigned char set_lcount;
unsigned char mirror_image; /* B5 and later */
unsigned char set_gamma_table; /* B4 and later */
unsigned char set_outline_emphasis; /* B4 and later */
unsigned char set_dither; /* B4 and later */
unsigned char set_color_correction_coefficients; /* B3 and later */
unsigned char request_extended_status; /* get extended status from scanner */
unsigned char control_an_extension; /* for extension control */
unsigned char eject; /* for extension control */
unsigned char feed;
unsigned char request_push_button_status;
unsigned char control_auto_area_segmentation;
unsigned char set_film_type; /* for extension control */
unsigned char set_exposure_time; /* F5 only */
unsigned char set_bay; /* F5 only */
unsigned char set_threshold;
unsigned char set_focus_position; /* B8 only */
unsigned char request_focus_position; /* B8 only */
} EpsonCmdRec, * EpsonCmd;
unsigned char request_identity;
unsigned char request_identity2; /* new request identity command for Dx command level */
unsigned char request_status;
unsigned char request_condition;
unsigned char set_color_mode;
unsigned char start_scanning;
unsigned char set_data_format;
unsigned char set_resolution;
unsigned char set_zoom;
unsigned char set_scan_area;
unsigned char set_bright;
SANE_Range bright_range;
unsigned char set_gamma;
unsigned char set_halftoning;
unsigned char set_color_correction;
unsigned char initialize_scanner;
unsigned char set_speed; /* B4 and later */
unsigned char set_lcount;
unsigned char mirror_image; /* B5 and later */
unsigned char set_gamma_table; /* B4 and later */
unsigned char set_outline_emphasis; /* B4 and later */
unsigned char set_dither; /* B4 and later */
unsigned char set_color_correction_coefficients; /* B3 and later */
unsigned char request_extended_status; /* get extended status from scanner */
unsigned char control_an_extension; /* for extension control */
unsigned char eject; /* for extension control */
unsigned char feed;
unsigned char request_push_button_status;
unsigned char control_auto_area_segmentation;
unsigned char set_film_type; /* for extension control */
unsigned char set_exposure_time; /* F5 only */
unsigned char set_bay; /* F5 only */
unsigned char set_threshold;
unsigned char set_focus_position; /* B8 only */
unsigned char request_focus_position; /* B8 only */
} EpsonCmdRec, *EpsonCmd;
enum
{ OPT_NUM_OPTS = 0
, OPT_MODE_GROUP
, OPT_MODE
, OPT_BIT_DEPTH
, OPT_HALFTONE
, OPT_DROPOUT
, OPT_BRIGHTNESS
, OPT_SHARPNESS
, OPT_GAMMA_CORRECTION
, OPT_COLOR_CORRECTION
, OPT_RESOLUTION
, OPT_THRESHOLD
, OPT_ADVANCED_GROUP
, OPT_MIRROR
, OPT_SPEED
, OPT_AAS
, OPT_LIMIT_RESOLUTION
, OPT_ZOOM
/* , OPT_GAMMA_VECTOR */
, OPT_GAMMA_VECTOR_R
, OPT_GAMMA_VECTOR_G
, OPT_GAMMA_VECTOR_B
, OPT_WAIT_FOR_BUTTON
, OPT_CCT_GROUP
, OPT_CCT_1
, OPT_CCT_2
, OPT_CCT_3
, OPT_CCT_4
, OPT_CCT_5
, OPT_CCT_6
, OPT_CCT_7
, OPT_CCT_8
, OPT_CCT_9
, OPT_PREVIEW_GROUP
, OPT_PREVIEW
, OPT_PREVIEW_SPEED
, OPT_GEOMETRY_GROUP
, OPT_TL_X
, OPT_TL_Y
, OPT_BR_X
, OPT_BR_Y
, OPT_QUICK_FORMAT
, OPT_EQU_GROUP
, OPT_SOURCE
, OPT_AUTO_EJECT
, OPT_FILM_TYPE
, OPT_FOCUS
, OPT_BAY
, OPT_EJECT
, OPT_ADF_MODE
, NUM_OPTIONS
};
{ OPT_NUM_OPTS =
0, OPT_MODE_GROUP, OPT_MODE, OPT_BIT_DEPTH, OPT_HALFTONE, OPT_DROPOUT,
OPT_BRIGHTNESS, OPT_SHARPNESS, OPT_GAMMA_CORRECTION, OPT_COLOR_CORRECTION,
OPT_RESOLUTION, OPT_THRESHOLD, OPT_ADVANCED_GROUP, OPT_MIRROR, OPT_SPEED,
OPT_AAS, OPT_LIMIT_RESOLUTION, OPT_ZOOM, /* OPT_GAMMA_VECTOR */
OPT_GAMMA_VECTOR_R, OPT_GAMMA_VECTOR_G, OPT_GAMMA_VECTOR_B,
OPT_WAIT_FOR_BUTTON, OPT_CCT_GROUP, OPT_CCT_1, OPT_CCT_2, OPT_CCT_3,
OPT_CCT_4, OPT_CCT_5, OPT_CCT_6, OPT_CCT_7, OPT_CCT_8, OPT_CCT_9,
OPT_PREVIEW_GROUP, OPT_PREVIEW, OPT_PREVIEW_SPEED, OPT_GEOMETRY_GROUP,
OPT_TL_X, OPT_TL_Y, OPT_BR_X, OPT_BR_Y, OPT_QUICK_FORMAT, OPT_EQU_GROUP,
OPT_SOURCE, OPT_AUTO_EJECT, OPT_FILM_TYPE, OPT_FOCUS, OPT_BAY,
OPT_EJECT, OPT_ADF_MODE, NUM_OPTIONS
};
typedef enum { /* hardware connection to the scanner */
SANE_EPSON_NODEV, /* default, no HW specified yet */
SANE_EPSON_SCSI, /* SCSI interface */
SANE_EPSON_PIO, /* parallel interface */
SANE_EPSON_USB /* USB interface */
typedef enum
{ /* hardware connection to the scanner */
SANE_EPSON_NODEV, /* default, no HW specified yet */
SANE_EPSON_SCSI, /* SCSI interface */
SANE_EPSON_PIO, /* parallel interface */
SANE_EPSON_USB /* USB interface */
} Epson_Connection_Type;
typedef struct
{
u_short opt_resolution;
u_char sensor;
u_char scan_order;
u_char line_dist1;
u_char line_dist2;
u_short opt_resolution;
u_char sensor;
u_char scan_order;
u_char line_dist1;
u_char line_dist2;
u_short main_res1;
u_short main_res2;
u_short main_res3;
u_short main_res4;
u_short main_res5;
u_short main_res6;
u_short main_res7;
u_short main_res1;
u_short main_res2;
u_short main_res3;
u_short main_res4;
u_short main_res5;
u_short main_res6;
u_short main_res7;
u_short sub_res1;
u_short sub_res2;
u_short sub_res3;
u_short sub_res4;
u_short sub_res5;
u_short sub_res6;
u_short sub_res1;
u_short sub_res2;
u_short sub_res3;
u_short sub_res4;
u_short sub_res5;
u_short sub_res6;
} Epson_Identity2;
struct Epson_Device {
struct Epson_Device *next;
SANE_Device sane;
SANE_Int level;
SANE_Range dpi_range;
struct Epson_Device
{
struct Epson_Device *next;
SANE_Device sane;
SANE_Int level;
SANE_Range dpi_range;
SANE_Range * x_range; /* x range w/out extension */
SANE_Range * y_range; /* y range w/out extension */
SANE_Range *x_range; /* x range w/out extension */
SANE_Range *y_range; /* y range w/out extension */
SANE_Range fbf_x_range; /* flattbed x range */
SANE_Range fbf_y_range; /* flattbed y range */
SANE_Range adf_x_range; /* autom. document feeder x range */
SANE_Range adf_y_range; /* autom. document feeder y range */
SANE_Range tpu_x_range; /* transparency unit x range */
SANE_Range tpu_y_range; /* transparency unit y range */
SANE_Range fbf_x_range; /* flattbed x range */
SANE_Range fbf_y_range; /* flattbed y range */
SANE_Range adf_x_range; /* autom. document feeder x range */
SANE_Range adf_y_range; /* autom. document feeder y range */
SANE_Range tpu_x_range; /* transparency unit x range */
SANE_Range tpu_y_range; /* transparency unit y range */
Epson_Connection_Type connection;
/* hardware interface type */
Epson_Connection_Type connection;
/* hardware interface type */
SANE_Int *res_list; /* list of resolutions */
SANE_Int res_list_size; /* number of entries in this list */
SANE_Int last_res; /* last selected resolution */
SANE_Int last_res_preview; /* last selected preview resolution */
SANE_Int *res_list; /* list of resolutions */
SANE_Int res_list_size; /* number of entries in this list */
SANE_Int last_res; /* last selected resolution */
SANE_Int last_res_preview; /* last selected preview resolution */
SANE_Word *resolution_list; /* for display purposes we store a second copy */
SANE_Word *resolution_list; /* for display purposes we store a second copy */
SANE_Bool extension; /* extension is installed */
SANE_Int use_extension; /* use the installed extension */
SANE_Bool TPU; /* TPU is installed */
SANE_Bool ADF; /* ADF is installed */
SANE_Bool duplexSupport; /* does the ADF handle duplex scanning */
SANE_Bool focusSupport; /* does this scanner have support for "set focus position" ? */
SANE_Bool color_shuffle; /* does this scanner need color shuffling */
SANE_Int maxDepth; /* max. color depth */
SANE_Bool extension; /* extension is installed */
SANE_Int use_extension; /* use the installed extension */
SANE_Bool TPU; /* TPU is installed */
SANE_Bool ADF; /* ADF is installed */
SANE_Bool duplexSupport; /* does the ADF handle duplex scanning */
SANE_Bool focusSupport; /* does this scanner have support for "set focus position" ? */
SANE_Bool color_shuffle; /* does this scanner need color shuffling */
SANE_Int maxDepth; /* max. color depth */
SANE_Int optical_res; /* optical resolution */
SANE_Int max_line_distance;
SANE_Int optical_res; /* optical resolution */
SANE_Int max_line_distance;
SANE_Bool need_double_vertical;
SANE_Bool need_color_reorder;
SANE_Bool need_reset_on_source_change;
SANE_Bool need_double_vertical;
SANE_Bool need_color_reorder;
SANE_Bool need_reset_on_source_change;
SANE_Bool wait_for_button; /* do we have to wait until the scanner button is pressed? */
SANE_Bool wait_for_button; /* do we have to wait until the scanner button is pressed? */
SANE_Int fbf_max_x;
SANE_Int fbf_max_y;
SANE_Int adf_max_x;
SANE_Int adf_max_y;
SANE_Int fbf_max_x;
SANE_Int fbf_max_y;
SANE_Int adf_max_x;
SANE_Int adf_max_y;
SANE_Int devtype;
SANE_Int devtype;
EpsonCmd cmd;
EpsonCmd cmd;
};
typedef struct Epson_Device Epson_Device;
struct Epson_Scanner {
struct Epson_Scanner *next;
int fd;
Epson_Device * hw;
SANE_Option_Descriptor opt [ NUM_OPTIONS];
Option_Value val [ NUM_OPTIONS];
SANE_Parameters params;
SANE_Bool block;
SANE_Bool eof;
SANE_Byte * buf, * end, * ptr;
SANE_Bool canceling;
SANE_Bool invert_image;
SANE_Bool focusOnGlass;
SANE_Byte currentFocusPosition;
struct Epson_Scanner
{
struct Epson_Scanner *next;
int fd;
Epson_Device *hw;
SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS];
SANE_Parameters params;
SANE_Bool block;
SANE_Bool eof;
SANE_Byte *buf, *end, *ptr;
SANE_Bool canceling;
SANE_Bool invert_image;
SANE_Bool focusOnGlass;
SANE_Byte currentFocusPosition;
/* SANE_Word gamma_table [ 4] [ 256]; */
SANE_Word gamma_table [ 3] [ 256];
SANE_Int retry_count;
SANE_Byte *line_buffer[LINES_SHUFFLE_MAX];
/* buffer lines for color shuffling */
SANE_Int color_shuffle_line; /* current line number for color shuffling */
SANE_Int line_distance; /* current line distance */
SANE_Int current_output_line; /* line counter when color shuffling */
SANE_Int lines_written; /* debug variable */
SANE_Bool option_has_changed; /* did one of the options change it's value? */
SANE_Word gamma_table[3][256];
SANE_Int retry_count;
SANE_Byte *line_buffer[LINES_SHUFFLE_MAX];
/* buffer lines for color shuffling */
SANE_Int color_shuffle_line; /* current line number for color shuffling */
SANE_Int line_distance; /* current line distance */
SANE_Int current_output_line; /* line counter when color shuffling */
SANE_Int lines_written; /* debug variable */
SANE_Bool option_has_changed; /* did one of the options change it's value? */
};
typedef struct Epson_Scanner Epson_Scanner;

Wyświetl plik

@ -1,5 +1,5 @@
#ifdef _AIX
# include "../include/lalloca.h" /* MUST come first for AIX! */
#include "../include/lalloca.h" /* MUST come first for AIX! */
#endif
#include "../include/sane/config.h"
#include <sane/sanei_debug.h>
@ -26,84 +26,87 @@
/*
* sense handler for the sanei_scsi_XXX comands
*/
SANE_Status
sanei_epson_scsi_sense_handler(int scsi_fd, u_char *result, void *arg)
SANE_Status
sanei_epson_scsi_sense_handler (int scsi_fd, u_char * result, void *arg)
{
/* to get rid of warnings */
scsi_fd = scsi_fd;
arg = arg;
/* to get rid of warnings */
scsi_fd = scsi_fd;
arg = arg;
if (result[0] && result[0]!=0x70)
{
DBG (2, "sense_handler() : sense code = 0x%02x\n", result[0]);
return SANE_STATUS_IO_ERROR;
}
else
{
return SANE_STATUS_GOOD;
}
if (result[0] && result[0] != 0x70)
{
DBG (2, "sense_handler() : sense code = 0x%02x\n", result[0]);
return SANE_STATUS_IO_ERROR;
}
else
{
return SANE_STATUS_GOOD;
}
}
/*
*
*
*/
SANE_Status
sanei_epson_scsi_inquiry(int fd, int page_code, void * buf, size_t * buf_size)
SANE_Status
sanei_epson_scsi_inquiry (int fd, int page_code, void *buf, size_t * buf_size)
{
u_char cmd [ 6];
int status;
u_char cmd[6];
int status;
memset( cmd, 0, 6);
cmd[ 0] = INQUIRY_COMMAND;
cmd[ 2] = page_code;
cmd[ 4] = *buf_size > 255 ? 255 : *buf_size;
status = sanei_scsi_cmd( fd, cmd, sizeof cmd, buf, buf_size);
memset (cmd, 0, 6);
cmd[0] = INQUIRY_COMMAND;
cmd[2] = page_code;
cmd[4] = *buf_size > 255 ? 255 : *buf_size;
status = sanei_scsi_cmd (fd, cmd, sizeof cmd, buf, buf_size);
return status;
return status;
}
/*
*
*
*/
int
sanei_epson_scsi_read(int fd, void * buf, size_t buf_size, SANE_Status * status)
int
sanei_epson_scsi_read (int fd, void *buf, size_t buf_size,
SANE_Status * status)
{
u_char cmd [ 6];
u_char cmd[6];
memset( cmd, 0, 6);
cmd[ 0] = READ_6_COMMAND;
cmd[ 2] = buf_size >> 16;
cmd[ 3] = buf_size >> 8;
cmd[ 4] = buf_size;
memset (cmd, 0, 6);
cmd[0] = READ_6_COMMAND;
cmd[2] = buf_size >> 16;
cmd[3] = buf_size >> 8;
cmd[4] = buf_size;
if( SANE_STATUS_GOOD == ( *status = sanei_scsi_cmd( fd, cmd, sizeof( cmd), buf, &buf_size)))
return buf_size;
if (SANE_STATUS_GOOD ==
(*status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, &buf_size)))
return buf_size;
return 0;
return 0;
}
/*
*
*
*/
int
sanei_epson_scsi_write(int fd, const void * buf, size_t buf_size, SANE_Status * status)
int
sanei_epson_scsi_write (int fd, const void *buf, size_t buf_size,
SANE_Status * status)
{
u_char * cmd;
u_char *cmd;
cmd = alloca(8 + buf_size);
memset( cmd, 0, 8);
cmd[ 0] = WRITE_6_COMMAND;
cmd[ 2] = buf_size >> 16;
cmd[ 3] = buf_size >> 8;
cmd[ 4] = buf_size;
memcpy( cmd + 8, buf, buf_size);
cmd = alloca (8 + buf_size);
memset (cmd, 0, 8);
cmd[0] = WRITE_6_COMMAND;
cmd[2] = buf_size >> 16;
cmd[3] = buf_size >> 8;
cmd[4] = buf_size;
memcpy (cmd + 8, buf, buf_size);
if( SANE_STATUS_GOOD == ( *status = sanei_scsi_cmd2( fd, cmd, 6, cmd + 8, buf_size, NULL, NULL)))
return buf_size;
if (SANE_STATUS_GOOD ==
(*status = sanei_scsi_cmd2 (fd, cmd, 6, cmd + 8, buf_size, NULL, NULL)))
return buf_size;
return 0;
return 0;
}

Wyświetl plik

@ -12,9 +12,13 @@
#define INQUIRY_BUF_SIZE (36)
SANE_Status sanei_epson_scsi_sense_handler(int scsi_fd, u_char *result, void *arg);
SANE_Status sanei_epson_scsi_inquiry(int fd, int page_code, void * buf, size_t * buf_size);
int sanei_epson_scsi_read(int fd, void * buf, size_t buf_size, SANE_Status * status);
int sanei_epson_scsi_write(int fd, const void * buf, size_t buf_size, SANE_Status * status);
SANE_Status sanei_epson_scsi_sense_handler (int scsi_fd, u_char * result,
void *arg);
SANE_Status sanei_epson_scsi_inquiry (int fd, int page_code, void *buf,
size_t * buf_size);
int sanei_epson_scsi_read (int fd, void *buf, size_t buf_size,
SANE_Status * status);
int sanei_epson_scsi_write (int fd, const void *buf, size_t buf_size,
SANE_Status * status);
#endif

Wyświetl plik

@ -3,34 +3,34 @@
#include "epson_usb.h"
SANE_Word sanei_epson_usb_product_ids [] =
{
0x101, /* Perfection 636 */
0x103, /* Perfection 610 */
0x10c, /* Perfection 640 */
0x104, /* Perfection 1200 */
0x10b, /* Perfection 1240 */
0x106, /* Stylus Scan 2500 */
0x10a, /* Perfection 1640 */
0x107, /* Expression 1600 */
0x10e, /* Expression 1680 */
0x110, /* Perfection 1650 */
0x112, /* Perfection 2450 */
0x11b, /* Perfection 2400 */
0x11c, /* GT-9800 / Perfection 3200 */
0x11e, /* Perfection 1660 */
0x128, /* Perfection 4870 */
0x801, /* CX-5200 */
0x802, /* CX-3200 */
0x805, /* CX-6400 */
0x807, /* RX-500 */
0 /* last entry - this is used for devices that are specified
in the config file as "usb <vendor> <product>" */
SANE_Word sanei_epson_usb_product_ids[] = {
0x101, /* Perfection 636 */
0x103, /* Perfection 610 */
0x10c, /* Perfection 640 */
0x104, /* Perfection 1200 */
0x10b, /* Perfection 1240 */
0x106, /* Stylus Scan 2500 */
0x10a, /* Perfection 1640 */
0x107, /* Expression 1600 */
0x10e, /* Expression 1680 */
0x110, /* Perfection 1650 */
0x112, /* Perfection 2450 */
0x11b, /* Perfection 2400 */
0x11c, /* GT-9800 / Perfection 3200 */
0x11e, /* Perfection 1660 */
0x128, /* Perfection 4870 */
0x801, /* CX-5200 */
0x802, /* CX-3200 */
0x805, /* CX-6400 */
0x807, /* RX-500 */
0 /* last entry - this is used for devices that are specified
in the config file as "usb <vendor> <product>" */
};
int sanei_epson_getNumberOfUSBProductIds(void)
int
sanei_epson_getNumberOfUSBProductIds (void)
{
return sizeof(sanei_epson_usb_product_ids)/sizeof(SANE_Word);
return sizeof (sanei_epson_usb_product_ids) / sizeof (SANE_Word);
}

Wyświetl plik

@ -3,8 +3,8 @@
#define SANE_EPSON_VENDOR_ID (0x4b8)
extern SANE_Word sanei_epson_usb_product_ids [];
extern SANE_Word sanei_epson_usb_product_ids[];
extern int sanei_epson_getNumberOfUSBProductIds(void);
extern int sanei_epson_getNumberOfUSBProductIds (void);
#endif