www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/30/18:18:55

Sender: ej AT delorie DOT com
Message-ID: <386BCF78.345D4724@tradeservices.com>
Date: Thu, 30 Dec 1999 16:32:40 -0500
From: Eric Johnson <ej AT tradeservices DOT com>
X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13-7mdksmp i686)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: bcsio20 help
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.
--------------2C5621E2ACC5C5373F914335
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This message is intended for Bill Currie the
author of BCSio20.  If you could please forward
this message, I would appreciate it.


Hi Bill,

I hope you're still supporting BCSio20.  I'm
stuck and was wondering if you could take a look
at this code and let me know what I'm doing
wrong.

Attached is my source and the logfile that it
writes.  You will be able to tell what the
input file is by reading the logfile.

Basically, I have a label writer/psuedo printer
that speaks a proprietary language called pywrite.
I'm looking to have my C code read a set of
pywrite commands and send them to the printer
via COM1 on Windows 95.

The code seems to execute without errors, but
I'm not seeing the labels come out of the printer.
When the printer reads a "showpage", a new label
should emerge.

I am using your included linker, and have even
disabled COM1 under Win95 per your suggestion and
still can't seem to get it to print.

Note that in my source, I first tried using the
sio_write function, but I kept getting a SIGSEGV,
so I switched to sio_put which doesn't choke, but
also doesn't work.

FYI, I won't have access to my email for a week,
so if you ask for more info, I'll get back to you
as soon as I am able.

TIA,
Eric

-- 
Eric Johnson - ej AT tradeservices DOT com || 603.766.2216
   <---------> Quote of the minute <----------->
To restore a sense of reality, I think Walt Disney should have a
Hardluckland.
		-- Jack Paar
--------------2C5621E2ACC5C5373F914335
Content-Type: text/plain; charset=us-ascii;
 name="chlpr.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="chlpr.c"

#include <stdio.h>
#include <pc.h>
#include <keys.h>
#include <dpmi.h>
#include "serio.h"

#define MAX_READ 128
#define baud9600 96
#define COM1     0x3f8
#define COM2     0x2f8
#define C1IRQ    4
#define C2IRQ    3

int main(int argc, char **argv)
{
 int i,written;
 char buf[MAX_READ],c;
 SioPort *comport;
 FILE *pyf;
 FILE *log;

 /* Required by BCSerio */
 extern char sltext[] asm ("sltext");
 extern char eltext[] asm ("eltext");
 extern char sldata[] asm ("sldata");
 extern char eldata[] asm ("eldata");
 _go32_dpmi_lock_code(sltext,eltext-sltext);
 _go32_dpmi_lock_data(sldata,eldata-sldata);

 /* open log file for debugging */
 log=fopen("c:/djgpp/bin/clog.txt","w");
 if (!log) {
    fprintf(stderr, "could not open logfile: bailing!\n");
    exit(1);
 }

 fprintf(log,"\nPanAm Helper App v3 Log File\n");

 /* open pywrite commands */
 pyf=fopen("c:/djgpp/bin/py.txt","r");
 if (!pyf) {
    fprintf(log,"Could not open Pywrite command file: \n");
    close(log);
    exit(1);
 }

 fprintf(log,"Attempting to open COM1\n");
 /* open serial port using bcsio20 functions */
 comport = sio_openport(COM1,C1IRQ);
 comport->sio_doxoff = 1;
 sio_setparms(comport, sio8Bits, sioNoParity, sio1StopBit);
 sio_setspeed(comport, baud9600);
 fprintf(log,"COM1 opened and comm parms set successfully\n");

 fprintf(log,"Beginning to write Pywrite commands\n");
 while (!feof(pyf)) {
   fgets(buf,MAX_READ,pyf);
  /* written=sio_write(comport,buf,sizeof(buf));  */
   fprintf(log," <= ");
   for (i=0; i<strlen(buf); i++) {
     fprintf(log,"%c",buf[i]);
     sio_put(comport,buf[i]);
     if (sio_charready(comport)) {
       c = sio_get(comport);
       fprintf(log, " -%c- ",c);
     }
   }
 }
 fprintf(log,"done sending data to comm port\n");

 fprintf(log,"closing COM1\n");
 sio_closeport(comport);
 fprintf(log,"COM1 closed, exiting normally\n");

 close(log);
 return 0;
}


--------------2C5621E2ACC5C5373F914335
Content-Type: text/plain; charset=us-ascii;
 name="clog.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="clog.txt"


PanAm Helper App v3 Log File
Attempting to open COM1
COM1 opened and comm parms set successfully
Beginning to write Pywrite commands
 <= /centerhoriz { dup stringwidth pop 2 div 117 exch sub } bind def
 <= /rcol { dup stringwidth pop 2 div 185.5 exch sub } bind def
 <= /lcol { dup stringwidth pop 2 div 48.5 exch sub } bind def
 <= /bdpass0 {
 <= /Sans18.00pt findfont 24 scalefont setfont
 <= (PAN AM) centerhoriz 667 moveto show
 <= /Sans14.00pt findfont 14 scalefont setfont
 <= (http://FlyPanAm.com) centerhoriz 652 moveto show
 <= (800 FLY PANAM) centerhoriz 638 moveto show
 <= 35 setlinewidth 0 505 moveto 235 505 lineto stroke
 <= 17 setlinewidth 50 470 moveto 184 470 lineto stroke
 <= /Sans12.00pt findfont 10 scalefont setfont
 <= 1 setgray
 <= (PASSENGERS MUST BE AT THE GATE AT) centerhoriz 505 moveto show
 <= (LEAST 20 MINUTES PRIOR TO DEPARTURE) centerhoriz 493 moveto show
 <= (CHECKED BAGGAGE) centerhoriz 465 moveto show
 <= 0 setgray
 <= /Sans14.00pt findfont 14 scalefont setfont
 <= (Beatrice Biddiscome) centerhoriz 612 moveto show
 <= (FLT #1) lcol 585 moveto show
 <= (12/22/1999) rcol 585 moveto show
 <= (DEPARTURE 08:30 AM EST) centerhoriz 567 moveto show
 <= (ARRIVAL 11:10 AM EST) centerhoriz 195 moveto show
 <= (Beatrice Biddiscome) centerhoriz 118 moveto show
 <= (12/22/1999) rcol 90 moveto show
 <= (FLT #1) lcol 90 moveto show
 <= /Sans36.00pt findfont 25 scalefont setfont
 <= (SFB) centerhoriz 60 moveto show
 <= /Sans36.00pt findfont 36 scalefont setfont
 <= (Pax #5) centerhoriz 155 moveto show
 <= /Sans36.00pt findfont 40 scalefont setfont
 <= (Pax #5) centerhoriz 8 moveto show
 <= /Sans36.00pt findfont 72 scalefont setfont
 <= (SFB) centerhoriz 220 moveto show
 <= showpage } bind def
 <= /bdpass1 {
 <= /Sans18.00pt findfont 24 scalefont setfont
 <= (PAN AM) centerhoriz 667 moveto show
 <= /Sans14.00pt findfont 14 scalefont setfont
 <= (http://FlyPanAm.com) centerhoriz 652 moveto show
 <= (800 FLY PANAM) centerhoriz 638 moveto show
 <= 35 setlinewidth 0 505 moveto 235 505 lineto stroke
 <= 17 setlinewidth 50 470 moveto 184 470 lineto stroke
 <= /Sans12.00pt findfont 10 scalefont setfont
 <= 1 setgray
 <= (PASSENGERS MUST BE AT THE GATE AT) centerhoriz 505 moveto show
 <= (LEAST 20 MINUTES PRIOR TO DEPARTURE) centerhoriz 493 moveto show
 <= (CHECKED BAGGAGE) centerhoriz 465 moveto show
 <= 0 setgray
 <= /Sans14.00pt findfont 14 scalefont setfont
 <= (Beatrice Biddiscome) centerhoriz 612 moveto show
 <= (FLT #1) lcol 585 moveto show
 <= (12/22/1999) rcol 585 moveto show
 <= (DEPARTURE 08:30 AM EST) centerhoriz 567 moveto show
 <= (ARRIVAL 11:10 AM EST) centerhoriz 195 moveto show
 <= (Beatrice Biddiscome) centerhoriz 118 moveto show
 <= (12/22/1999) rcol 90 moveto show
 <= (FLT #1) lcol 90 moveto show
 <= /Sans36.00pt findfont 25 scalefont setfont
 <= (SFB) centerhoriz 60 moveto show
 <= /Sans36.00pt findfont 36 scalefont setfont
 <= (Pax #5) centerhoriz 155 moveto show
 <= /Sans36.00pt findfont 40 scalefont setfont
 <= (Pax #5) centerhoriz 8 moveto show
 <= /Sans36.00pt findfont 72 scalefont setfont
 <= (SFB) centerhoriz 220 moveto show
 <= showpage } bind def
 <= bdpass0
 <= bdpass1
 <= userdict /centerhoriz undef
 <= userdict /rcol undef
 <= userdict /lcol undef
 <= userdict /bdpass0 undef
 <= userdict /bdpass1 undef
 <= userdict /bdpass1 undef
done sending data to comm port
closing COM1
COM1 closed, exiting normally

--------------2C5621E2ACC5C5373F914335--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019