mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 02:18:20 -07:00
Restructure LPT devices so that lpt_device_t is now only used internally while the exposed LPT devices are now regular device_t's.
This commit is contained in:
@@ -1979,7 +1979,7 @@ read_status(void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
escp_init(void *lpt)
|
||||
escp_init(const device_t *info)
|
||||
{
|
||||
escp_t *dev = NULL;
|
||||
|
||||
@@ -1995,7 +1995,8 @@ escp_init(void *lpt)
|
||||
/* Initialize a device instance. */
|
||||
dev = (escp_t *) calloc(1, sizeof(escp_t));
|
||||
dev->ctrl = 0x04;
|
||||
dev->lpt = lpt;
|
||||
|
||||
dev->lpt = lpt_attach(info->local & 0xf, write_data, write_ctrl, strobe, read_status, read_ctrl, NULL, NULL, dev);
|
||||
|
||||
rom_get_full_path(dev->fontpath, "roms/printer/fonts/");
|
||||
|
||||
@@ -2109,13 +2110,13 @@ static const device_config_t lpt_prt_escp_config[] = {
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
const device_t prt_escp_device = {
|
||||
const device_t lpt_prt_escp_device = {
|
||||
.name = "Generic ESC/P 2 Dot-Matrix Printer",
|
||||
.internal_name = "dot_matrix",
|
||||
.flags = DEVICE_LPT,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.init = escp_init,
|
||||
.close = escp_close,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
@@ -2126,20 +2127,3 @@ const device_t prt_escp_device = {
|
||||
.config = NULL
|
||||
#endif
|
||||
};
|
||||
|
||||
const lpt_device_t lpt_prt_escp_device = {
|
||||
.name = "Generic ESC/P 2 Dot-Matrix Printer",
|
||||
.internal_name = "dot_matrix",
|
||||
.init = escp_init,
|
||||
.close = escp_close,
|
||||
.write_data = write_data,
|
||||
.write_ctrl = write_ctrl,
|
||||
.strobe = strobe,
|
||||
.read_status = read_status,
|
||||
.read_ctrl = read_ctrl,
|
||||
.epp_write_data = NULL,
|
||||
.epp_request_read = NULL,
|
||||
.priv = NULL,
|
||||
.lpt = NULL,
|
||||
.cfgdevice = (device_t *) &prt_escp_device
|
||||
};
|
||||
|
||||
@@ -465,15 +465,16 @@ ps_read_status(void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
ps_init(void *lpt)
|
||||
ps_init(const device_t *info)
|
||||
{
|
||||
ps_t *dev = (ps_t *) calloc(1, sizeof(ps_t));
|
||||
gsapi_revision_t rev;
|
||||
|
||||
dev->ctrl = 0x04;
|
||||
dev->lpt = lpt;
|
||||
dev->pcl = false;
|
||||
|
||||
dev->lpt = lpt_attach(info->local & 0xf, ps_write_data, ps_write_ctrl, ps_strobe, ps_read_status, NULL, NULL, NULL, dev);
|
||||
|
||||
/* Try loading the DLL. */
|
||||
ghostscript_handle = dynld_module(PATH_GHOSTSCRIPT_DLL, ghostscript_imports);
|
||||
#ifdef PATH_GHOSTSCRIPT_DLL_ALT1
|
||||
@@ -513,15 +514,16 @@ ps_init(void *lpt)
|
||||
|
||||
#ifdef USE_PCL
|
||||
static void *
|
||||
pcl_init(void *lpt)
|
||||
pcl_init(const device_t *info)
|
||||
{
|
||||
ps_t *dev = (ps_t *) calloc(1, sizeof(ps_t));
|
||||
gsapi_revision_t rev;
|
||||
|
||||
dev->ctrl = 0x04;
|
||||
dev->lpt = lpt;
|
||||
dev->pcl = true;
|
||||
|
||||
dev->lpt = lpt_attach(info->local & 0xf, ps_write_data, ps_write_ctrl, ps_strobe, ps_read_status, NULL, NULL, NULL, dev);
|
||||
|
||||
/* Try loading the DLL. */
|
||||
ghostscript_handle = dynld_module(PATH_GHOSTPCL_DLL, ghostscript_imports);
|
||||
#ifdef PATH_GHOSTPCL_DLL_ALT1
|
||||
@@ -579,36 +581,32 @@ ps_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
const lpt_device_t lpt_prt_ps_device = {
|
||||
.name = "Generic PostScript Printer",
|
||||
.internal_name = "postscript",
|
||||
.init = ps_init,
|
||||
.close = ps_close,
|
||||
.write_data = ps_write_data,
|
||||
.write_ctrl = ps_write_ctrl,
|
||||
.strobe = ps_strobe,
|
||||
.read_status = ps_read_status,
|
||||
.read_ctrl = NULL,
|
||||
.epp_write_data = NULL,
|
||||
.epp_request_read = NULL,
|
||||
.priv = NULL,
|
||||
.lpt = NULL
|
||||
const device_t lpt_prt_ps_device = {
|
||||
.name = "Generic PostScript Printer",
|
||||
.internal_name = "postscript",
|
||||
.flags = DEVICE_LPT,
|
||||
.local = 0,
|
||||
.init = ps_init,
|
||||
.close = ps_close,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
#ifdef USE_PCL
|
||||
const lpt_device_t lpt_prt_pcl_device = {
|
||||
.name = "Generic PCL5e Printer",
|
||||
.internal_name = "pcl",
|
||||
.init = pcl_init,
|
||||
.close = ps_close,
|
||||
.write_data = ps_write_data,
|
||||
.write_ctrl = ps_write_ctrl,
|
||||
.strobe = ps_strobe,
|
||||
.read_status = ps_read_status,
|
||||
.read_ctrl = NULL,
|
||||
.epp_write_data = NULL,
|
||||
.epp_request_read = NULL,
|
||||
.priv = NULL,
|
||||
.lpt = NULL
|
||||
const device_t lpt_prt_pcl_device = {
|
||||
.name = "Generic PCL5e Printer",
|
||||
.internal_name = "pcl",
|
||||
.flags = DEVICE_LPT,
|
||||
.local = 0,
|
||||
.init = pcl_init,
|
||||
.close = ps_close,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -455,13 +455,13 @@ read_status(void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
prnt_init(void *lpt)
|
||||
prnt_init(const device_t *info)
|
||||
{
|
||||
/* Initialize a device instance. */
|
||||
prnt_t *dev = (prnt_t *) calloc(1, sizeof(prnt_t));
|
||||
|
||||
dev->ctrl = 0x04;
|
||||
dev->lpt = lpt;
|
||||
dev->lpt = lpt_attach(info->local & 0xf, write_data, write_ctrl, strobe, read_status, NULL, NULL, NULL, dev);
|
||||
|
||||
/* Initialize parameters. */
|
||||
reset_printer(dev);
|
||||
@@ -523,13 +523,13 @@ static const device_config_t lpt_prt_text_config[] = {
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
const device_t prt_text_device = {
|
||||
const device_t lpt_prt_text_device = {
|
||||
.name = "Generic Text Printer",
|
||||
.internal_name = "text_prt",
|
||||
.flags = DEVICE_LPT,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.init = prnt_init,
|
||||
.close = prnt_close,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
@@ -540,20 +540,3 @@ const device_t prt_text_device = {
|
||||
.config = NULL
|
||||
#endif
|
||||
};
|
||||
|
||||
const lpt_device_t lpt_prt_text_device = {
|
||||
.name = "Generic Text Printer",
|
||||
.internal_name = "text_prt",
|
||||
.init = prnt_init,
|
||||
.close = prnt_close,
|
||||
.write_data = write_data,
|
||||
.write_ctrl = write_ctrl,
|
||||
.strobe = strobe,
|
||||
.read_status = read_status,
|
||||
.read_ctrl = NULL,
|
||||
.epp_write_data = NULL,
|
||||
.epp_request_read = NULL,
|
||||
.priv = NULL,
|
||||
.lpt = NULL,
|
||||
.cfgdevice = (device_t *) &prt_text_device
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user