void  DisplayDllChoice (DIALOGSHELL *shell,DIALOGCHOICE *ptr)
{
  uint    i;
  uint    StartIndex = 1;               /*                                   */
  uint    StrLength;                    /*                                   */
  char    buffer[80], *buf;             /*                                   */
  DEBFILE *cur_dll;                     /* pointer to the EXE file info      */
  DEBFILE *pdf;                         /* pointer to debug file struct      */
  uint    BorderCols;

  BorderCols = 6;

  pdf = pnode->ExeStruct;               /* get -> to Exe structure.          */
  cur_dll = pdf->next;                  /* set ptr to 1st DLL node           */

  /***************************************************************************/
  /* Advance the startindex and -> the dll depending on the skip rows.       */
  /***************************************************************************/
  for( i = 0; i < ptr-> SkipRows; i++ )
  {
    StartIndex++;
    cur_dll = cur_dll->next;
  }

  /***************************************************************************/
  /* Display the names that can fit in the window.                           */
  /***************************************************************************/
  for( i = 0; i < ptr->MaxRows; i++ )
  {
    if( StartIndex <= ptr->entries )
    {
      ClearField[1] = 1;
      putrc( shell->row + i + shell->SkipLines, shell->col + 1, ClearField );
      StrLength = strlen( cur_dll->DebFilePtr->fn );
      if( StrLength > (shell->width - BorderCols) )
      {
        buf = cur_dll->DebFilePtr->fn;
        buf = buf + (StrLength - (shell->width - BorderCols));
        strcpy( buffer, buf );
        buffer[0] = '~';
        putrc( shell->row + i + shell->SkipLines, shell->col + 2, buffer );
        StrLength = strlen( buffer );
      }
      else
        putrc( shell->row + i + shell->SkipLines, shell->col + 2,
               cur_dll->DebFilePtr->fn );
      StartIndex++;
      ClearField[1] = shell->width - BorderCols - StrLength;
      putrc( shell->row + i + shell->SkipLines, shell->col + 2 + StrLength,
             ClearField );
      cur_dll = cur_dll->next;
    }
    else
    {
      ClearField[1] = shell->width-2-SCROLLBARCOLOFFSET;
      putrc( shell->row + i + shell->SkipLines, shell->col + 1, ClearField );
    }
  }
}
示例#2
0
static trap_retval DoRemotePut( byte *snd, trap_elen len )
{
    WORD        rc;

putstring( "RemotePut\r\n" );
putconnstatus( Connection );
    if( len == 0 ) {
        _INITSPXECB( Send, 1, NULL, 0 );
    } else {
        _INITSPXECB( Send, 2, (char *)snd, len );
    }
    SendECB.hsem = (HSEM) &SendSem;
    SendHead.connectionCtl |= 0x10;
    SendHead.packetLen = _SWAPINT( sizeof( SendHead ) + len );
    DosSemSet( &SendSem );
    rc = SpxSendSequencedPacket( Connection, &SendECB );
    putrc( "SPXSendSequencedPacket", rc );

    for( ;; ) {
        /*
            I don't know what the 0x1001 status is - I can't find it
            in any documentation, but if we don't wait for it to clear,
            things mess up badly.
        */
        if( SendECB.status != SPX_SUCCESSFUL && !InUse( SendECB ) && SendECB.status != 0x1001 )
            break;
        rc = DosSemWait( &SendSem, 1000 );
        if( rc != ERROR_SEM_TIMEOUT ) {
            break;
        }
    }
    SendECB.hsem = 0;
putstring( "Done RemotePut\r\n" );
    return( len );
}
示例#3
0
static void PostAListen( int i )
{
    WORD        rc;

putstring( "Posting RecECB[i]\r\n" );
    _INITECB( RecECB[i], RecHead[i], 2, SPX )
    RecECB[i].hsem = (HSEM) &RecvSem;
    RecECB[i].fragList[1].fragAddress = &Buffer[i];
    RecECB[i].fragList[1].fragSize = sizeof( Buffer[i] );
    rc = SpxListenForConnectionPacket( Connection, &RecECB[i] );
    putrc( "SPXListenForConnectionPacket", rc );
}
    void
ClrScr(uint toprow,uint botrow,uint attr )
/*         toprow  : 1st line to clear (0..N) */
/*         botrow  : last line to clear (0..N) */
/*         attr    : logical attribute used to clear screen */
{
  VideoAtr = (uchar)attr;               /* Set the default video attribute   */
  clrrow[0] = (uchar)Attrib(attr);
  clrrow[2] = (uchar)(VideoCols-ColStart);
  while( toprow <= botrow )
      putrc( toprow++, 0, clrrow );
}
void  DisplayExcepChoice (DIALOGSHELL *shell,DIALOGCHOICE *ptr)
{
  uint   i;
  uint   StartIndex;                    /*                                   */
  uchar  *pExcepMap;                    /*                                   */

  /***************************************************************************/
  /* Clear the dialog.                                                       */
  /***************************************************************************/
  for( i=0; i<ptr->MaxRows; i++)
  {
   ClearField[1] = VATTLENGTH + NOTIFICATION;
   putrc(shell->row+i+shell->SkipLines,shell->col+1, ClearField);
  }

  /***************************************************************************/
  /* init the variables required.                                            */
  /***************************************************************************/
  pExcepMap = LocalExcepMap;
  StartIndex = 0;

  /***************************************************************************/
  /* Advance the startindex and notification ptrs depending on the skip rows.*/
  /***************************************************************************/
  for( i = 0; i < ptr->SkipRows; i++ )
  {
    StartIndex++;
    pExcepMap++;
  }

  for(i=0;i<ptr->MaxRows;i++)
  {
   putrc(shell->row+i+shell->SkipLines, shell->col+2,ExcepTypes[StartIndex]);
   putrc(shell->row+i+shell->SkipLines, shell->col+2+VATTLENGTH, ExcepSel[*pExcepMap]);

   StartIndex++;
   pExcepMap++;
  }
}
示例#6
0
char RemoteConnect( void )
{
    WORD        rc;
    #ifdef SERVER
        if( !Listening ) {
            _INITSPXECB( Conn, 1, 0, 0 );
            rc = SpxListenForConnection( SPXSocket, &ConnECB, 0, 0, &Connection );
            putrc( "SPXListenForConnection", rc );
            Listening = 1;
        } else if( !InUse( ConnECB ) ) {
            PostListens();
            return( 1 );
        }
        IPXRelinquishControl();
    #else
putstring( "RemoteConnect\r\n" );
        _INITSPXECB( Send, 1, NULL, 0 );
        if( ( rc = SpxEstablishConnection( SPXSocket, &SendECB,
                                    0, 0x10, &Connection ) ) == 0 ) {
            int i;

            for( i = 1; i < 20; ++i ) {
putstring( "RemoteConnect loop\r\n" );
                if( !InUse( SendECB ) ) {
                    PostListens();
putstring( "RemoteConnect loop done\r\n" );
                    return( 1 );
                }
                DosSleep( 100 );        /* 20 * 100 is approx 2 seconds */
            }
putstring( "RemoteConnect aborting\r\n" );
            rc = SpxAbortConnection( Connection );
            putrc( "SPXAbortConnection", rc );
        } else {
            putrc( "SPXEstablishConnection", rc );
        }
    #endif
    return( 0 );
}
uint                                    /*                                521*/
ShowStruct(DFILE *dfp,uint row,uint rows,uint skip)
                                        /* -> dfile node containing stucture.*/
                                        /* screen row.                       */
                                        /* rows available for display.       */
                                        /* # of logical data recs to skip.   */
{                                       /*                                   */
 uint   item;                           /*                                   */
 uint   rr;                             /*                                   */
 uint   n;                              /*                                   */
 TD_STRUCT   *tp;                       /*                                813*/
 TD_TYPELIST *typelist;                 /*                                813*/
 Trec  *namelist;                       /*                                   */
 uint   Nitems;                         /*                                   */
 uint   mid;                            /*                                   */
 uint   sfx;                            /*                                   */
 uchar *cp;                             /*                                   */
 uint   baseaddr;                       /*                                112*/
 uchar  buffer[2*DATALINESPAN];         /*                                   */
 uint   memberoffs;                     /* offset of member within structure.*/
 uint   membertype;                     /* type of the structure member.     */
 USHORT MaxLen;                         /* length of max structure name813529*/
                                        /*                                   */
 mid = dfp->mid;                        /*                                   */
 sfx = dfp->sfx;                        /*                                   */
 baseaddr = dfp->baseaddr;              /*                                   */

/*****************************************************************************/
/* The first thing we want to do is get a pointer to the base type record.   */
/* If the showtype is <= 512, indicating a primitive type, then we will      */
/* get a back a NULL.                                                        */
/*****************************************************************************/
 tp = (TD_STRUCT*)QbasetypeRec(mid, dfp->showtype); /*                    813*/
 if(!tp ||                              /* cutting through the typedefs.     */
    tp->RecType != T_STRUCT             /*                                   */
   )                                    /* cutting through the typedefs.     */
  return(FALSE);

/*****************************************************************************/
/* Now, we are going to get the number of structure members and quit if we   */
/* were told to skip more than the number of structure members.              */
/*****************************************************************************/
 Nitems = tp->NumMembers;               /*                                813*/
 if( Nitems <= skip )
  return(FALSE);

/*****************************************************************************/
/* Now, get pointers to the type list and the name list.                     */
/*****************************************************************************/
 typelist = (TD_TYPELIST*)QtypeRec(mid, tp->TypeListIndex);             /*813*/
 namelist = QtypeRec(mid, tp->NameListIndex);                           /*813*/
                                        /*                                   */
 if( skip )                             /*                                   */
     dfp = NULL;                        /*                                   */
                                        /*                                   */
 for( rr=0, item=skip+1;                /*                                813*/
      (rr < rows) &&                    /*                                   */
      (item <= Nitems);                 /*                                   */
      ++rr, ++item                      /*                                   */
    )                                   /*                                   */
 {                                      /*                                   */
  cp = (UCHAR *)QNameList(namelist,NAME,item-1);   /* find a member name. 813*/

  if(!cp)                               /* if there is no name then go home. */
    break;                              /*                                   */
                                        /*                                   */
  InitDataBuffer( buffer,               /* initialize the data buffer, i.e.  */
                  DATALINESPAN,         /* clear it, put expression name in  */
                  dfp                   /* it, put attributes in it, and  .  */
                );                      /* and terminate it with \0.         */
  dfp = NULL;                           /* kill dfp so we won't write the    */
                                        /* expression name again.            */
  MaxLen = *(USHORT*)cp;                /* length of structure name    813529*/
  MaxLen =                              /* limit the length of the name   529*/
  (MaxLen < (TAB2-2)) ? MaxLen : (TAB2-2);  /* till TAB2 position         529*/
  n = sprintf( buffer + STGCOL+1,       /* put the member name in the buffer.*/
              "%.*s: ",                 /*                                521*/
              MaxLen,                   /*                                529*/
              cp+sizeof(USHORT)         /*                                813*/
            );                          /*                                   */
                                        /*                                   */
                                        /* compute the offset of this member */
                                        /* within the data structure.        */
  memberoffs = QNameList(namelist,MEMBEROFFSET,item-1);                 /*813*/

                                        /* find the type of this member.     */
  membertype = typelist->TypeIndex[item-1];                          /*813112*/
                                        /*                                   */
                                        /*                                   */
  *(buffer + STGCOL+1 + n) = ' ';       /* remove null inserted by buffmt    */
                                        /*                                   */
  if ( n <= TAB1 )  n = TAB1;           /* move to a tab position based      */
  else  n = TAB2;                       /* on length of member name          */
                                        /*                                   */
                                        /*                                   */
                                        /* now format this item in the buffer*/
  FormatDataItem( buffer + STGCOL+1 + n,/*  starting position for the data.  */
                  baseaddr + memberoffs,/*  address of the member to format. */
                  mid,                  /*  mid containing the data.         */
                  membertype,           /*  type of the member.              */
                  sfx                   /*  stack frame index if there is one*/
                );                      /*                                   */
                                        /*                                   */
  buffer[ DATALINESPAN-1 ] = 0;         /* terminate the data buffer...again.*/
  putrc( row + rr, 0, buffer );         /* now display the data line.        */
 }                                      /*                                   */
                                        /*                                   */
 if( rr < rows )                        /* now clear the remaining rows.     */
   ClrScr( row + rr,                    /*                                   */
           row + rows - 1,              /*                                   */
           vaStgExp                     /*                                   */
         );                             /*                                   */
 return( TRUE );                        /*                                   */
}                                       /*                                   */
uint                                    /*                                521*/
ShowArray( DFILE *dfp, uint row, uint rows, uint skip )                 /*112*/
{                                                                       /**12*/
 TD_ARRAY  *tp;                         /*                                813*/
 uint   item;                           /* array item to display.         112*/
 uint   rr;                             /*                                112*/
 uint   n;                              /* gp integer.                    112*/
 uint   Nitems;                         /* number of array items.         112*/
 uint   atomtype;                       /* type of array items.           112*/
 uint   atomsize;                       /* size of an array item.         112*/
 uint   mid;                            /* module id for the array var.   112*/
 uint   sfx;                            /* stack frame index if auto.     112*/
 uint   baseaddr;                       /* user addr where array starts.  112*/
 uchar  buffer[2*DATALINESPAN];         /* display buffer for array item. 112*/
 uchar *cp;                             /* gp char ptr.                   112*/
 uint   addr;                           /* gp address.                    112*/
                                                                        /*112*/
 mid = dfp->mid;                                                        /*112*/
 sfx = dfp->sfx;                                                        /*112*/
 baseaddr = dfp->baseaddr;                                              /*112*/
                                                                        /*112*/
 /****************************************************************************/
 /* - get a ptr to the defining type record in $$type seg.                112*/
 /* - get the atomic type of the array elements.                          112*/
 /* - get the size of the atomic type.                                    112*/
 /* - get the number of array items.                                      112*/
 /* - handle any errors in the above steps by simply returning false.     112*/
 /*                                                                       112*/
 /****************************************************************************/
 tp = (TD_ARRAY*)QbasetypeRec(mid, dfp->showtype);                   /*813112*/
 if( ( tp == NULL ) || ( tp->RecType != T_ARRAY ) )                  /*813112*/
  return( FALSE );                                                      /*112*/
                                                                        /*112*/
 atomtype = tp->ElemType;                                            /*813112*/
 atomtype = HandleUserDefs(mid,atomtype);                               /*813*/
                                                                        /*512*/
 if( atomtype == 0 )                                                    /*112*/
  return( FALSE );                                                      /*112*/
                                                                        /*112*/
 atomsize = QtypeSize(mid, atomtype);                                   /*112*/
 if( atomsize == 0 )                                                    /*112*/
  return( FALSE );                                                      /*112*/
                                                                        /*112*/
 Nitems = tp->ByteSize/atomsize;                                     /*813112*/
 if( Nitems == 0 )                                                      /*912*/
   Nitems = 1;                                                          /*912*/
 if( Nitems <= skip )                                                   /*112*/
  return( FALSE );                                                      /*112*/
                                                                        /*112*/
 /************************************************************************112*/
 /* simply show character array bytes as a string.                        112*/
 /************************************************************************112*/
 if( atomtype == TYPE_CHAR || atomtype == TYPE_UCHAR )                  /*112*/
 {                                                                      /*112*/
  ShowHexBytes(dfp, row, rows, skip);                                   /*112*/
  return( TRUE );                                                       /*112*/
 }                                                                      /*112*/
                                                                        /*112*/
 /************************************************************************112*/
 /* -we only want to associate the array name with the first element of   112*/
 /*  the array. We set dfp == null after the first element, or before the 112*/
 /*  first element if we have scrolled the array name off the screen.     112*/
 /* -format each element.                                                 112*/
 /* -display in int and hex format.                                       112*/
 /* -truncate long lines.                                                 112*/
 /*                                                                       112*/
 /************************************************************************112*/
 if( skip )                                                             /*112*/
  dfp = NULL;                                                           /*112*/
                                                                        /*112*/
 for( rr=0, item=skip+1; (rr < rows) && (item <= Nitems); ++rr, ++item) /*112*/
 {                                                                      /*112*/
  InitDataBuffer( buffer, DATALINESPAN, dfp );                          /*112*/
  dfp = NULL;                                                           /*112*/
  n = sprintf( buffer + STGCOL+1, "[%02u] ", item-1 );                  /*521*/
                                                                        /*112*/
  *(buffer + STGCOL+1 + n) = ' ';                                       /*112*/
                                                                        /*112*/
  if ( n <= TAB1 )  n = TAB1;                                           /*112*/
  else  n = TAB2;                                                       /*112*/
                                                                        /*112*/
                                                                        /*112*/
  cp   = buffer + STGCOL + 1 + n;                                       /*112*/
  addr = baseaddr+atomsize*(item-1);                                    /*112*/
  FormatDataItem( cp , addr, mid, atomtype, sfx);                       /*112*/
  buffer[ DATALINESPAN-1 ] = 0;                                         /*112*/
  putrc( row + rr, 0, buffer );                                         /*112*/
 }                                                                      /*112*/
 if( rr < rows )                                                        /*112*/
  ClrScr( row + rr, row + rows - 1, vaStgExp );                         /*112*/
 return( TRUE );                                                        /*112*/
}                                       /* end ShowArray().             /*112*/
uint  ExcepDialogFunction( DIALOGSHELL *shell, DIALOGCHOICE *ptr,
                           EVENT *nEvent, void *ParamBlock )
{
  uint   fldcol;
  uchar  *pExcepMap;                    /* Pointer to exception map.         */
  int    SelectIndex;                   /* Index into exception map array.   */

  SelectIndex = shell->CurrentField + ptr->SkipRows - 1;
  pExcepMap = LocalExcepMap + SelectIndex;
  for( ;; )
  {
    switch( nEvent->Value )
    {
      case INIT_DIALOG:
      {
        /*********************************************************************/
        /* This message is sent before displaying elements in display area.  */
        /* It is to initialise the locals in the dialog function.            */
        /*  - Make a copy of the global exception map.                       */
        /*  - Set the field cursor and variables to the first field.         */
        /*  - Set the length of the field highlite bar in normal and hilite  */
        /*    arrays (used in the call to putrc).                            */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        memcpy( LocalExcepMap, ExceptionMap, MAXEXCEPTIONS );
        fldcol = shell->col + 2;
        VioSetCurPos( (short)(shell->row + shell->SkipLines +
                       shell->CurrentField - 1), (short)fldcol, 0 );
        fld = ExpField;

        hilite[1] = normal[1] = (UCHAR)VATTLENGTH - 4;
        return( 0 );
      }

      case ENTER:
      {
        /*********************************************************************/
        /* This message is sent if the user clicks on the ENTER button or    */
        /* presses the ENTER key.                                            */
        /*  - Copy the local excetion map to the global exception map.       */
        /*  - Return non zero value to denote the end of dialog processing.  */
        /*********************************************************************/
        ptr->SkipRows = 0;
        memcpy( ExceptionMap, LocalExcepMap, MAXEXCEPTIONS );
        return( ENTER );
      }

      case F1:
      {
        uchar  *HelpMsg;

        HelpMsg = GetHelpMsg( HELP_DLG_EXCEPTIONS, NULL,0 );
        CuaShowHelpBox( HelpMsg );
        return( 0 );
      }

      case ESC:
      case F10:
      {
        /*********************************************************************/
        /* This message is sent if the user clicks on the CANCEL button or   */
        /* presses the ESC/F10 keys.                                         */
        /*  - Return non zero value to denote the end of dialog processing.  */
        /*********************************************************************/
        ptr->SkipRows = 0;
        return( nEvent->Value );
      }

      case MOUSEPICK:
      {
        /*********************************************************************/
        /* This message is sent if the clicks in the dialog display area.    */
        /*  - Determine on which field the user clicked.                     */
        /*  - Set the cursor on that field.                                  */
        /*  - If the field turns out to be notify field,                     */
        /*     - Set the event value as SPACEBAR (simulate) and stay in the  */
        /*       outer for loop to process SPACEBAR.                         */
        /*    Else                                                           */
        /*     - Return zero to denote continue dialog processing.           */
        /*********************************************************************/
        if( ((uint)nEvent->Col >= (shell->col + 2 + VATTLENGTH)) &&
            ((uint)nEvent->Col < (shell->col+ 2 + VATTLENGTH + NOTIFYMSGWIDTH)))
        {
           fldcol = shell->col+ 2 + VATTLENGTH;
           fld = NotifyField;
        }
        else
        {
           fldcol = shell->col+2;
           fld = ExpField;
        }

        VioSetCurPos( (short)(shell->row + shell->SkipLines +
                       shell->CurrentField - 1), (short)fldcol, 0 );

        if( fld == NotifyField )
        {
          nEvent->Value = SPACEBAR;
          continue;
        }

        return( 0 );
      }

      case key_R:
      case key_r:
      {
        /*********************************************************************/
        /* This message is sent if the user clicks in the RESET button or    */
        /* presses 'R' / 'r' keys.                                           */
        /*  - Reset the current exception notification to default.           */
        /*  - Display the new notification value in the field.               */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        *pExcepMap = DefExcepMap[ SelectIndex ];
        putrc( shell->row + shell->SkipLines + shell->CurrentField - 1,
               shell->col + 2 + VATTLENGTH, ExcepSel[*pExcepMap] );
        return( 0 );
      }

      case key_D:
      case key_d:
      {
        /*********************************************************************/
        /* This message is sent if the user clicks in the DEFAULT button or  */
        /* presses 'D' / 'd' keys.                                           */
        /*  - Copy the default exception map to the local exception map.     */
        /*  - Redisplay the display area of the dialog.                      */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        memcpy( LocalExcepMap, DefExcepMap, MAXEXCEPTIONS );
        DisplayExcepChoice( shell, ptr );
        return( 0 );
      }

      case key_S:
      case key_s:
      {
        /*********************************************************************/
        /* This message is sent if the user clicks on the SAVE button or     */
        /* presses the 'S' / 's' keys.                                       */
        /*  - Find the fully qualified file name for the .pro                */
        /*  - Call function to save the exceptions.                          */
        /*  - If not successfull in saving exceptions, display the error box */
        /*    with appropriate error message.                                */
        /*  - If successfull display a timmed message and copy the local     */
        /*    exception map to the default exception map.                    */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        uchar  StatusMsg[100];
        uchar  fn[MAXFNAMELEN];
        int    rc;

        findpro( "SD386.PRO", fn, MAXFNAMELEN );
        rc = SaveExceptions( fn );
        if( rc )
        {
          if( rc == FILENOTFOUND )
            sprintf( StatusMsg, "Unable to find \"SD386.PRO\" in DPATH" );
          else
            sprintf( StatusMsg, "Unable to save to profile \"%s\"", fn );
        }
        else
        {
          sprintf( StatusMsg, "Saving Exceptions to profile \"%s\"", fn );
          memcpy( ExceptionMap, LocalExcepMap, MAXEXCEPTIONS );
        }
        SayMsgBox2( StatusMsg, 1200UL );
        VioSetCurType( &NormalCursor, 0 );
        return( 0 );
      }

      case RIGHT:
      case TAB:
      {
        /*********************************************************************/
        /* This message is sent if the user presses TAB or right arrow  key.*/
        /*  - Depending on the current field determine to which field we have*/
        /*    to move to the right or loop around.                           */
        /*  - Set the field variables.                                       */
        /*  - Set the cursor position.                                       */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        switch( fld )
        {
          case ExpField:
          {
            fldcol = shell->col + 2 + VATTLENGTH;
            fld    = NotifyField;
            break;
          }

          case NotifyField:
          {
            fldcol = shell->col + 2;
            fld    = ExpField;
            break;
          }
        }
        VioSetCurPos( (short)(shell->row + shell->SkipLines +
                       shell->CurrentField - 1), (short)fldcol, 0 );
        return( 0 );
      }

      case LEFT:
      case S_TAB:
      {
        /*********************************************************************/
        /* This message is sent if the user presses SHIFT TAB or left arrow  */
        /*  key.                                                            */
        /*  - Depending on the current field determine to which field we have*/
        /*    to move to the left or loop around.                            */
        /*  - Set the field variables.                                       */
        /*  - Set the cursor position.                                       */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        switch( fld )
        {
          case ExpField:
          {
            fldcol = shell->col + 2 + VATTLENGTH;
            fld    = NotifyField;
            break;
          }

          case NotifyField:
          {
            fldcol = shell->col + 2;
            fld    = ExpField;
            break;
          }
        }
        VioSetCurPos( (short)(shell->row + shell->SkipLines +
                       shell->CurrentField - 1), (short)fldcol, 0 );
        return( 0 );
      }

      case SPACEBAR:
      {
        /*********************************************************************/
        /* This message is sent if the user presses the SPACEBAR.            */
        /*  - Toggle the notification value of the current field.            */
        /*  - Display the new notification value in the field.               */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        pExcepMap = LocalExcepMap + SelectIndex;
        *pExcepMap = (uchar)(*pExcepMap + 1);
        if( *pExcepMap > 1 )
          *pExcepMap  = 0;

        ClearField[1] = NOTIFICATION;
        putrc( shell->row + shell->SkipLines + shell->CurrentField - 1,
               shell->col + 2 + VATTLENGTH, ClearField );
        putrc( shell->row + shell->SkipLines + shell->CurrentField - 1,
               shell->col + 2 + VATTLENGTH, ExcepSel[*pExcepMap] );
        return( 0 );
      }

      case UP:
      case DOWN:
      case SCROLLUP:
      case SCROLLDOWN:
      case SCROLLBAR:
      {
        /*********************************************************************/
        /* These messages are sent if the user presses up  or down  arrow  */
        /* keys or the user clicks on the  or  in the scrollbar.           */
        /*  - Set the field variables.                                       */
        /*  - Set the cursor position.                                       */
        /*  - Return zero to denote continue dialog processing.              */
        /*********************************************************************/
        switch( fld )
        {
          case ExpField:
          {
            fldcol = shell->col + 2;
            break;
          }

          case NotifyField:
          {
            fldcol = shell->col + 2 + VATTLENGTH;
            break;
          }
        }

        VioSetCurPos( (short)(shell->row + shell->SkipLines +
                       shell->CurrentField - 1), (short)fldcol, 0 );
        return( 0 );
      }

      default:
        /*********************************************************************/
        /* Any other message.                                                */
        /* - Return zero to denote continue dialog processing.               */
        /*********************************************************************/
        return( 0 );
    }
  }
}
void VioInit( )
{
 APIRET      rc;
 UCHAR     **cpp;
 UINT        vlen;
 UINT        row;
 VIOMODEINFO md;

 memset(&md, 0, sizeof(md) );
 md.cb = sizeof(md);

 if( VioGetMode(&md, 0) )
 {
  printf( "Vio error" );
  exit(0);
 }

 VideoRows = md.row;
 VideoCols = md.col;
 MaxPer    = VideoRows - 2 ;            /* max # of lines of Code            */
 MaxData   = VideoRows * 2 / 3;         /* max # of rows for data window     */
 MinPer    = MaxPer - MaxData;          /* min # of lines of Code            */
 ProRow    = VideoRows - 3;             /* screen row for prompt (0..N)      */
 MenuRow   = VideoRows - 3;             /* screen row for menu bar (0..N)    */
 FnameRow  = VideoRows - 2;             /* screen row for file name (0..N)   */
 HelpRow   = VideoRows - 1;             /* screen row for menu help (0..N)   */
 MsgRow    = VideoRows - 1;             /* screen row for messages (0..N)    */
 LinesPer  = MaxPer - TopLine;          /* current # of lines per screen     */
                                        /* for source                        */
 VideoMap  = vaColor;

 if( md.color == 1 )
  VideoMap = vaMono;


    rc = VioGetBuf((PULONG)&VideoPtr, (PUSHORT)&vlen, 0);
    if( rc != 0 ){
        printf( "VioGetBuf() returned %d\n", rc );
        panic(OOquit);
    }
    if( ! HiddenCursor.attr ){
        rc = VioGetCurType(&NormalCursor,0);
        if( rc != 0 ){
            printf( "VioGetCurType() returned %d\n", rc );
            panic(OOquit);  }

        /*********************************************************************/
        /* If the cursor is in insert mode when we enter here then convert   */
        /* the parms of cursorinfo into a normal mode cursor.                */
        /*********************************************************************/
        if ((NormalCursor.cEnd - NormalCursor.yStart) > 2)
          NormalCursor.yStart = NormalCursor.cEnd -
                           ((NormalCursor.cEnd - NormalCursor.yStart - 1) / 4);
        NormalCursor.yStart -= 1;                                       /*112*/
        memcpy( &InsertCursor, &NormalCursor, sizeof(InsertCursor) );   /*100*/
        InsertCursor.yStart = 0;
        memcpy( &HiddenCursor, &NormalCursor, sizeof(HiddenCursor) );   /*100*/
        HiddenCursor.attr = -1;
    }

    /*************************************************************************/
    /* - Allocate memory for screen bounds                                400*/
    /* - set the bounds to the video cols                                 400*/
    /*************************************************************************/
    BoundPtr = Talloc(VideoRows);                                   /*521 518*/
    if (BoundPtr)                                                       /*518*/
       memset(BoundPtr,VideoCols,VideoRows);                            /*518*/
    else                                                                /*518*/
    {                                                                   /*518*/
        printf( "malloc failed\n");                                     /*518*/
        panic(OOquit);                                                  /*518*/
    }                                                                   /*518*/

    VioStartOffSet = 1;
    TopLine = 1;
    MenuRow  = 0;
    LinesPer = MaxPer - TopLine;
    InitDataWinCsr();
    AccessMouse();

    HideCursor();
    ClrScr( 0, VideoRows-1, vaBptOk );
    cpp = banner;
    for( row = BANNER_ROW; *cpp; cpp++,row++ )
    {
     putrc( row, (VideoCols-strlen(*cpp)) / 2, *cpp );
    }
}