home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d4xx / d430 / smartfields.lha / SmartFields / Functions / field_open.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-11  |  1.5 KB  |  48 lines

  1. /***************************************
  2. *  FIELD OPEN v1.07
  3. *  © Copyright 1988 Timm Martin
  4. *  All Rights Reserved
  5. ****************************************/
  6.  
  7. #include <exec/io.h>
  8. #include <exec/ports.h>
  9. #include <intuition/intuition.h>
  10. #include <console/console.h>
  11. #include <console/fields.h>
  12. #include <console/functions.h>
  13.  
  14. int field_open( window, header, initial, final, buffer )
  15.   struct Window *window;
  16.   struct FieldHeader *header;
  17.   struct Field *initial;
  18.   struct Field *final;
  19.   UBYTE  *buffer;
  20. {
  21.   struct MsgPort *CreatePort();    /* exec.library */
  22.   struct IOStdReq *CreateStdIO();  /* exec.library */
  23.  
  24.   header->Window       = window;
  25.   header->Buffer       = buffer;
  26.   header->TypeMode     = DEFAULT_TYPE_MODE;
  27.   header->FirstField   = field_link( final );
  28.   header->FinalField   = final;
  29.   header->CurrentField = initial;
  30.  
  31.   if (!(header->WritePort = CreatePort( "field.write", 0L )))
  32.     return (FIELD_EXIT_WPORT);
  33.   if (!(header->WriteReq = CreateStdIO( header->WritePort )))
  34.     return (FIELD_EXIT_WREQ);
  35.   if (!(header->ReadPort = CreatePort( "field.read", 0L )))
  36.     return (FIELD_EXIT_RPORT);
  37.   if (!(header->ReadReq = CreateStdIO( header->ReadPort )))
  38.     return (FIELD_EXIT_RREQ);
  39.   header->ConsoleError = con_open( window, header->WriteReq, header->ReadReq );
  40.   if (header->ConsoleError)
  41.     return (FIELD_EXIT_CONSOLE);
  42.  
  43.   cursor_invisible( header->WriteReq );
  44.   con_read( header->ReadReq, header->Buffer );  /* "prime" the buffer */
  45.  
  46.   return (FIELD_OPEN_OK);
  47. }
  48.