Programming terminal problem...

Programming terminal problem...

Post by Joel R. Stanl » Sun, 07 Feb 1993 19:52:08



My buddy and I are working on a terminal program and it's crashing a
lot. Compile the following program. It crashes when you try to close the
window. I do, however, get a TR light on my modem, so I know I am
initing the serial device correctly. Please help me out with any
suggestions in regards to my code.

With SAS/C6.0, I've also been getting Error 88, and if you can help me
avoid this, please write this also.

Here's the code :

/* This program is written by Dave Brunker and Joel Stanley. Intitial */

/* coding done on 02.05.93.                                           */

 #include <proto/all.h>

 #include <stdio.h>

 #include <intuition/intuition.h>

 #include <devices/serial.h>

 /* Let's put all of our prototypes here... */

 void main(void);

 void OpenAll(void);

 void CloseAll(void);

 void serparms(void);

 void initser(void);

 void exit(int);

 /* And all structures here... */

 struct IntuitionBase *IntuitionBase;

 struct MsgPort *replymp;

 struct IOExtSer *serial_req;

 struct Window *WindowOne;

 struct NewWindow WindowOneStructure =

 {

         0, 0, 640, 200, 0, 1, CLOSEWINDOW, SMART_REFRESH | ACTIVATE |
         WINDOWSIZING | WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG, NULL,
         NULL, NULL, NULL, NULL, 10, 20, 640, 200, WBENCHSCREEN,

 };

 void main(void)

 {

         OpenAll();

         Wait(1 << WindowOne->UserPort->mp_SigBit);

         CloseAll();

 }

 void OpenAll(void)

 {

         UBYTE err;

         if (!(IntuitionBase = (struct IntuitionBase *)

                 OpenLibrary("intuition.library", 0)))

                 {

                         printf("Uh-oh. No intuiton library!\n");

                         CloseAll();

                         exit(FALSE);

                 }

         if (!(WindowOne = (struct Window *)

                 OpenWindow(&WindowOneStructure)))

                 {

                         printf("Window won't open.\n");

                         CloseAll();

                 }

         if (!(replymp = (struct MsgPort *)

                 CreatePort(NULL, 0)))

                 {

                         printf("Could not create the reply port!\n");

                         CloseAll();

                         exit(FALSE);

                 }

         serial_req = (struct IOExtSer *)

                 CreateExtIO(replymp, sizeof(struct IOExtSer *));

                 if (!serial_req)

                 {

                         printf("Not enough mem.\n");

                         CloseAll();

                         exit(FALSE);

                 }

         err = OpenDevice("serial.device", 0, serial_req, 0);

         if (err)

         {

                 printf("Could not open the serial device.\n");

                 CloseAll();

                 exit(FALSE);

         }

         serparms();

 }

 void CloseAll(void)

 {

         CloseDevice(serial_req);

         DeletePort(replymp);

         CloseWindow(WindowOne);

         CloseLibrary(IntuitionBase);

 }

 void serparms(void)

 {

         serial_req->io_RBufLen = 8192;

         serial_req->io_Baud = 2400;

         serial_req->io_BrkTime = 500000;

         serial_req->io_ReadLen = 8;

         serial_req->io_WriteLen = 8;

         serial_req->io_StopBits = 1;

         serial_req->io_SerFlags = SERF_XDISABLED;

         initser();

 }

 void initser(void)

 {

         UBYTE error;

         serial_req->IOSer.io_Command = SDCMD_SETPARAMS;

         error = DoIO(serial_req);

         if (error)

         {

                 printf("DoIO failed...\n");

                CloseAll();

                 exit(FALSE);

         }

 }

I appreciate anybody's time who works on this particular problem for me.
:)

Please respond via e-mail!

--

My views do not represent those of Cryogenic Software.
They just let me use thier machine, not thier views.
"2B||!2B <--- = ?" (To be or not to be, that is the question)

 
 
 

Programming terminal problem...

Post by Daniel R Barl » Wed, 10 Feb 1993 10:15:19



>My buddy and I are working on a terminal program and it's crashing a
>lot. Compile the following program. It crashes when you try to close the
>window. I do, however, get a TR light on my modem, so I know I am
>initing the serial device correctly. Please help me out with any
>suggestions in regards to my code.

>With SAS/C6.0, I've also been getting Error 88, and if you can help me
>avoid this, please write this also.

>Here's the code :

[stuff deleted ... don't try this at home, kiddies]

Quote:>         Wait(1 << WindowOne->UserPort->mp_SigBit);

>         CloseAll();
[...]
> void CloseAll(void)
> {
>         CloseDevice(serial_req);
>         DeletePort(replymp);
>         CloseWindow(WindowOne);
>         CloseLibrary(IntuitionBase);
> }

I'm not saying it's causing your problem, but shouldn't you GetMsg and
ReplyMsg the message which arrives at your userport?

Daniel

 
 
 

1. terminal program problems with DOS 2.1

I have had chronic difficulty running communications terminal programs
under my newly installed AmigaDOS 2.1 on an A2500/030.  I have tried
everything from replacing the devs:, libs: and l: directories from
2.04 to see if somewhere in the path there is a conflicting software
bug.  I have been able to run communications programs from a bootable
2.04 floppy with a modem0.device driver copied to devs: for my 2400
SupraModem.  The nature of my problem is that I can get the program to
boot (say a generic vt100, or BaudBandit) and dialup and logon to a
system for about a minute or so before the character flow completely
stops to the screen and the program locks up.  I remain connected but
cannot execute any further commands to the program.  I end up having
to reboot to disconnect or sometimes the program will crash the system
entirely although not always.  Anyone else experience similar
difficulties and/or bugs with 2.1 and terminal programs?

Please post and/or send email.

Thanks.

2. MFC42.DLL Error Message

3. can't get mail only from other HPs!

4. WTD: Terminal Program for A2000/500

5. Inkjet paper for TEXT

6. WTB: Terminal Program

7. Need suggestions about good books on MS Windows programming

8. WTB:Kickstart1.3&terminal program

9. Terminal Program

10. Communication Terminal Program

11. Help! I need a terminal program