home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / SHOWDX.C < prev    next >
Text File  |  1995-11-02  |  32KB  |  561 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   showdx.c                                                                */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /* History:                                                                  */
  8. /*                                                                           */
  9. /*   02/08/91 Creation of 32-bit SD86, from 16-bit version.                  */
  10. /*                                                                           */
  11. /*...16->32 port.                                                            */
  12. /*...                                                                        */
  13. /*... 02/08/91  101   Joe       port to 32 bit.                              */
  14. /*... 02/08/91  111   Christina port to 32 bit.                              */
  15. /*... 02/08/91  112   Joe       port to 32 bit.                              */
  16. /*                                                                           */
  17. /*...Release 1.00 (Pre-release 1)                                            */
  18. /*...                                                                        */
  19. /*... 07/09/91  202   srinivas  change address box when editing in data      */
  20. /*                              window to show flat address.                 */
  21. /*                                                                           */
  22. /*...Release 1.00 (Pre-release 105 10/10/91)                                 */
  23. /*...                                                                        */
  24. /*... 11/07/91  311   Srinivas  EAX in Register window disappears some times.*/
  25. /*...                                                                        */
  26. /*...Release 1.00 (Pre-release 107 11/13/91)                                 */
  27. /*...                                                                        */
  28. /*... 11/13/91  400   Srinivas  Vertical Register Display.                   */
  29. /*...                                                                        */
  30. /*...Release 1.00 (Pre-release 108 12/05/91)                                 */
  31. /*...                                                                        */
  32. /*... 02/10/92  514   Srinivas  TAB and S_TAB keys required to function to   */
  33. /*...                           move between the hex and ascii fields.       */
  34. /*... 02/11/92  518   Srinivas  Remove limitation on max no of screen rows.  */
  35. /*... 02/21/92  521   Srinivas  Port to C-Set/2.                             */
  36. /*...                                                                        */
  37. /*...Release 1.01 (04/03/92)                                                 */
  38. /*...                                                                        */
  39. /*... 08/03/92  701   Joe       Cua Interface.                               */
  40. /*...                                                                        */
  41. /**Includes*******************************************************************/
  42.  
  43. #include "all.h"
  44.  
  45. extern uchar*      VideoMap;
  46. extern uint        ExprAddr;  /* Set by ParseExpr -- Address value of expr101*/
  47. extern uchar       CantZapMsg[];
  48. extern uchar       BadDataMsg[];
  49. extern uchar      *BoundPtr;            /* -> to screen bounds            518*/
  50. extern uint        VideoCols;           /* # of columns per screen        514*/
  51.  
  52.  
  53. static  uchar hexbuf[2+2]  = { Attrib(vaStgPro) };
  54. static  uchar ascbuf[16+2] = { Attrib(vaStgPro) };
  55. static  uchar chrbuf[16+2] = { Attrib(vaStgVal) };
  56. static  uchar hexout[] = { RepCnt(2), Attrib(vaStgVal), 0 };
  57.  
  58. #define ABOXROWS 3
  59. #define ABOXCOLS 12                                                     /*202*/
  60.  
  61.  
  62. static  uchar AboxFormat [] = "│ ┌────────┐└─┤########│  └────────┘";   /*311*/
  63. /***********************/               /* This array needs to a null     311*/
  64. /*  "│ ┌────────┐"     */               /* terminated string. Because of  311*/
  65. /*  "└─┤########│"     */               /* this reason it has been changed311*/
  66. /*  "  └────────┘"     */               /* to a single dim array.         311*/
  67. /*   123456789012      */               /*                                311*/
  68. /***********************/               /*                                311*/
  69.  
  70.  
  71.  uint
  72. ZapHexBytes(DFILE *dfp,uint row,uint skip)
  73. {
  74.     int ith, incr, i;                   /* was register.                  112*/
  75.     uint col, key, csroff, nbytes, sfx = dfp->sfx;
  76.     uint absptr,ptr, varptr = ExprAddr + 16*skip;
  77.     uchar *dp;
  78.     uchar hexval, buffer[16+2], rawdata[16];
  79.     uchar *original;
  80.     uchar *addrbox;
  81.     uint  limit = 16;                   /* max no of bytes                521*/
  82.     PEVENT Event;                       /* -> to current event structure. 701*/
  83.     uint   EntryRow;                    /* the row we came in on.         701*/
  84.     uint   rc = TRUE;                   /*                                701*/
  85.     uint   InitCsrOff = 0;              /* initial cursor pos for ASCII.  701*/
  86.  
  87.     if( varptr < ExprAddr )
  88.         return( FALSE );
  89.  
  90.     /*************************************************************************/
  91.     /* Limit the display to the size of array or a struct.                521*/
  92.     /*************************************************************************/
  93.     if( dfp->showtype )                                                 /*521*/
  94.     {                                                                   /*521*/
  95.         limit = QtypeSize(dfp->mid, dfp->showtype);                     /*521*/
  96.         if( limit > 16)                                                 /*521*/
  97.            limit = 16;                                                  /*521*/
  98.     }                                                                   /*521*/
  99.  
  100.     dp = GetAppData(varptr,limit, &nbytes, sfx);
  101.     if( !dp || (nbytes != limit))
  102.         return( FALSE );
  103.  
  104.     memcpy( rawdata,dp, nbytes );                                       /*101*/
  105.  
  106.  
  107.     ith = incr = key = col = 0;
  108.     /*************************************************************************/
  109.     /* - if we come in with a mouse event then we need to get the index   701*/
  110.     /*   of the entry field that we're going to edit.                     701*/
  111.     /* - if the event did not occur in a valid entry field, i.e.,         701*/
  112.     /*   it occurred in the white space between fields or in the          701*/
  113.     /*   edit area, then we just return.                                  701*/
  114.     /* - if the event occurred in the ASCII area, then we get the         701*/
  115.     /*   initial offset of the cursor position in the field.              701*/
  116.     /*************************************************************************/
  117.     Event = GetCurrentEvent();                                          /*701*/
  118.     EntryRow = Event->Row;                                              /*701*/
  119.     if( Event->Type == TYPE_MOUSE_EVENT )                               /*701*/
  120.     {                                                                   /*701*/
  121.      int area;                                                          /*701*/
  122.                                                                         /*701*/
  123.      ith = GetIthHexField(Event);                                       /*701*/
  124.      area = GetStorageArea(Event);                                      /*701*/
  125.      if( (area == STORAGEAREA && ith >= nbytes) ||                      /*701*/
  126.           area == EDITAREA )                                            /*701*/
  127.       return( TRUE );                                                   /*701*/
  128.      if( area == ASCIIAREA )                                            /*701*/
  129.       InitCsrOff = Event->Col-(ASCIICOL-1);                             /*701*/
  130.     }                                                                   /*701*/
  131.  
  132.     addrbox =  2*ABOXROWS*ABOXCOLS +
  133.         (original = Talloc(2*2*ABOXROWS*ABOXCOLS));                     /*521*/
  134.  
  135.     GotoNewByte:
  136.         if( (ith += incr) < 0 )
  137.             goto Fini;
  138.  
  139.  
  140.         /*********************************************************************/
  141.         /* If we are going to the right beyond the screen limits , beep   514*/
  142.         /* and depending on the direction take action.                    514*/
  143.         /* - If we are going forward decrement the current byte ->.       514*/
  144.         /* - If we are going backward stay at the 1st byte.               514*/
  145.         /*********************************************************************/
  146.         if(((ith * 4)+3) >= BoundPtr[row])                              /*514*/
  147.         {                                                               /*514*/
  148.            beep();                                                      /*514*/
  149.            if (incr > 0)                                                /*514*/
  150.              ith -= 1;                                                  /*514*/
  151.            else                                                         /*514*/
  152.              ith = 0;                                                   /*514*/
  153.         }                                                               /*514*/
  154.  
  155.         /*********************************************************************/
  156.         /* If we have less than 16 bytes on the screen and Registers dis- 514*/
  157.         /* play is on, remain on the current byte.                        514*/
  158.         /*********************************************************************/
  159.         if( (ith >= (int)nbytes) && (BoundPtr[row] < VideoCols))        /*514*/
  160.              ith--;                                                     /*514*/
  161.  
  162.         if( ith >= (int)nbytes ){
  163.             ith = 0;
  164.             csroff = InitCsrOff;                                        /*701*/
  165.             col = ASCIICOL-1;
  166.         }else{
  167.             csroff = (key == LEFT);
  168.             col = STGCOL-1 + 3*ith + ith/4;
  169.         }
  170.         ptr = varptr + ith;
  171.  
  172.         Vgetbox( original, row+1, col, ABOXROWS, ABOXCOLS );
  173.         memcpy(  addrbox,original, 2*ABOXROWS*ABOXCOLS );
  174.  
  175.         if( GetAbsAddr(ptr, sfx, &absptr) ){
  176.             FmtAdrBox( addrbox, absptr );
  177.             Vputbox( addrbox, row+1, col, ABOXROWS, ABOXCOLS );
  178.         }
  179.         if( col == ASCIICOL-1 )
  180.             goto KeyAscii;
  181.  
  182.         utox2( rawdata[ith], hexbuf+1 );
  183.         putrc( row, col, hexbuf );
  184.         for( i=0 ; i < (int)nbytes ; ++i )
  185.             chrbuf[i+1] = graphic(rawdata[i]);
  186.         chrbuf[i+1] = 0;
  187.         putrc( row, ASCIICOL-1, chrbuf );
  188.  
  189.     for(;;)
  190.     {
  191.         key = GetString(row,col,2, 2,&csroff, buffer,HEXKEYFLD,NULL);
  192.         switch(key)
  193.         {
  194.  
  195.           case DATAKEY:
  196.           case RIGHT:
  197.           case TAB:
  198.             incr = 1;
  199.             goto UpdateByte;
  200.  
  201.           case LEFT:
  202.           case S_TAB:
  203.             incr = -1;
  204.             goto UpdateByte;
  205.  
  206.           case UP:                                                      /*701*/
  207.           case DOWN:                                                    /*701*/
  208.            Event->Type =  TYPE_MOUSE_EVENT;                             /*701*/
  209.            Event->Col  =  col;                                          /*701*/
  210.            Event->Row  =  (key == DOWN )?row+1:row-1;                   /*701*/
  211.            SetDataViewCsr();                                            /*701*/
  212.            goto UpdateByte;
  213.  
  214.           case ENTER:
  215.           UpdateByte:
  216.             if( *(twoc*)buffer != *(twoc*)(hexbuf+1) ){
  217.                 if( !x2tou(buffer, &hexval) ){
  218.                     fmterr( BadDataMsg );
  219.                     goto Complain;  }
  220. /*110 remove !*/if(  PutAppData(ptr, 1, &hexval, sfx) ){
  221.                     fmterr( CantZapMsg );
  222.                     goto Complain;  }
  223.                 rawdata[ith] = hexval;
  224.             }
  225.            goto caseESC;
  226.  
  227. caseESC:
  228.           case ESC:
  229.             putrc( row, col, hexout );
  230.             Vputbox( original, row+1, col, ABOXROWS, ABOXCOLS );
  231.             if( (key==ENTER) || (key==ESC) || (key==UP) || (key==DOWN) )/*701*/
  232.                 goto Fini;
  233.             goto GotoNewByte;
  234.  
  235.           case F1:
  236.             Help( HELP_DATA_HEX );
  237.             break;
  238.  
  239.           case LEFTMOUSECLICK:                                          /*701*/
  240.            {                                                            /*701*/
  241.                                                                         /*701*/
  242.             /*****************************************************************/
  243.             /* - get the current event.                                   701*/
  244.             /* - if it's not in the storage area on a valid entry field   701*/
  245.             /*   then come back in ( recirculate) on the new row.         701*/
  246.             /* - otherwise get the new ith and proceed to the next entry  701*/
  247.             /*   field.                                                   701*/
  248.             /*****************************************************************/
  249.             Event = GetCurrentEvent();                                  /*701*/
  250.             if( GetEventView() != DATAVIEW )                            /*701*/
  251.             {                                                           /*701*/
  252.              rc = key;                                                  /*701*/
  253.              key = ENTER;                                               /*701*/
  254.              goto UpdateByte;                                           /*701*/
  255.             }                                                           /*701*/
  256.             if(  (GetStorageArea(Event) != STORAGEAREA ) ||             /*701*/
  257.                  (Event->Row != EntryRow)                ||             /*701*/
  258.                  (GetIthHexField(Event) >= nbytes)                      /*701*/
  259.               )                                                         /*701*/
  260.             {                                                           /*701*/
  261.              SetDataViewCsr();                                          /*701*/
  262.              rc = RECIRCULATE;                                          /*701*/
  263.              key = ENTER;                                               /*701*/
  264.              goto UpdateByte;                                           /*701*/
  265.             }                                                           /*701*/
  266.             ith = GetIthHexField(Event);                                /*701*/
  267.             incr = 0;                                                   /*701*/
  268.             goto UpdateByte;                                            /*701*/
  269.           /*  break;   */                                               /*701*/
  270.           }                                                             /*701*/
  271.  
  272.           default:
  273.           Complain:
  274.             beep();
  275.     }   }
  276.  
  277.     KeyAscii:;{
  278.         uint NewChr, IsSame;
  279.  
  280.         for( i=0 ; i < (int)nbytes ; ++i )
  281.             ascbuf[i+1] = graphic(rawdata[i]);
  282.         ascbuf[i+1] = 0;
  283.         putrc( row, col, ascbuf );
  284.  
  285.         strcpy(buffer,ascbuf);          /* init the buffer for GetString. 701*/
  286.         for(;;){
  287.             key = GetString(row,col,nbytes,nbytes,&csroff,buffer+1,1,NULL);
  288.             switch( key )
  289.             {
  290.               case F1:
  291.                 Help( HELP_DATA_ASCII );
  292.                 break;
  293.               case TAB:                                                 /*514*/
  294.               case S_TAB:                                               /*514*/
  295.               case RIGHT:                                               /*514*/
  296.               case LEFT:                                                /*514*/
  297.               case DATAKEY:                                             /*514*/
  298.               case UP:                                                  /*701*/
  299.               case DOWN:                                                /*701*/
  300.                Event->Type =  TYPE_MOUSE_EVENT;                         /*701*/
  301.                Event->Col  =  col;                                      /*701*/
  302.                Event->Row  =  (key == DOWN )?row+1:row-1;               /*701*/
  303.                SetDataViewCsr();                                        /*701*/
  304.                goto caseENTER;
  305.  
  306. caseENTER:
  307.               case ENTER:
  308.                 for( ith=0, NewChr=1, ptr = varptr ; ++ith <= (int)nbytes ; ++ptr ){
  309.                     if( NewChr ){
  310.                         IsSame = ( (NewChr = buffer[ith]) == ascbuf[ith] );
  311.                         switch( NewChr ){
  312.                           case ACHAR_NULL:
  313.                           case ACHAR_NONA:
  314.                             NewChr = 0x100;  /* use 0x00 and keep going */
  315.                     }   }
  316.                     if( NewChr && IsSame )
  317.                         continue;
  318. /*110 remove ! */   if(  PutAppData(ptr, 1, (uchar*)&NewChr, sfx)  ){
  319.                         fmterr( CantZapMsg );
  320.                         goto Grumble;
  321.                 }   }
  322.                goto caseesc;
  323.  
  324. caseesc:
  325.               case ESC:
  326.  
  327.                 buffer[0] = Attrib(vaStgVal);                           /*701*/
  328.                 putrc( row, ASCIICOL-1, buffer );                       /*701*/
  329.  
  330.                 Vputbox( original, row+1, col, ABOXROWS, ABOXCOLS );
  331.                 goto Fini;
  332.  
  333.               case LEFTMOUSECLICK:                                      /*701*/
  334.               /***************************************************************/
  335.               /* if we get a left button click while in the data window   701*/
  336.               /* then simply recirculate and come back in at the new      701*/
  337.               /* cursor position.                                         701*/
  338.               /***************************************************************/
  339.                 if( GetEventView() != DATAVIEW )                        /*701*/
  340.                 {                                                       /*701*/
  341.                  rc = key;                                              /*701*/
  342.                  key = ENTER;                                           /*701*/
  343.                  goto caseENTER;                                        /*701*/
  344.                 }                                                       /*701*/
  345.                 SetDataViewCsr();                                       /*701*/
  346.                 rc = RECIRCULATE;                                       /*701*/
  347.                 key = ENTER;                                            /*701*/
  348.                 goto caseENTER;                                         /*701*/
  349.                                                                         /*701*/
  350.  
  351.               default:
  352.               Grumble:
  353.                 beep();
  354.             }
  355.         }
  356.     }
  357.     Fini:
  358.         /*********************************************************************/
  359.         /* Before finishing check the key, if it is ENTER key return back 514*/
  360.         /* or else depending on the key set up the index and incr values  514*/
  361.         /* since for all other keys we go back to hexfield editing we have514*/
  362.         /* to update the data read and we refresh that row on the screen  514*/
  363.         /* with a call to show hex bytes.                                 514*/
  364.         /*********************************************************************/
  365.         switch (key)                                                    /*514*/
  366.         {                                                               /*514*/
  367.           case TAB:                                                     /*514*/
  368.           case DATAKEY:                                                 /*514*/
  369.           case RIGHT:                                                   /*514*/
  370.             ith = 0;                                                    /*514*/
  371.             incr = 0;                                                   /*514*/
  372.             goto GoBkstart;                                             /*514*/
  373.           case S_TAB:                                                   /*514*/
  374.           case LEFT:                                                    /*514*/
  375.             if ( ith == -1)             /* are we at the Starting ??      514*/
  376.                ith = 17;                /* if yes go to ascii field       514*/
  377.             else                        /* else                           514*/
  378.                ith--;                   /* move back one byte position.   514*/
  379.             incr = -1;                                                  /*514*/
  380. GoBkstart:                                                              /*514*/
  381.             dp = GetAppData(varptr, limit, &nbytes, sfx);           /*521 514*/
  382.             memcpy( rawdata, dp, nbytes );                              /*514*/
  383.             ShowHexBytes(dfp, row, 1, skip);                            /*514*/
  384.             goto GotoNewByte;                                           /*514*/
  385.           default:                                                      /*514*/
  386.             Tfree( (void*)original);                                 /*521 514*/
  387.             if( (key==UP) || (key==DOWN) )                              /*701*/
  388.              return(key);                                               /*701*/
  389.             return( rc );                                               /*514*/
  390.         }                                                               /*514*/
  391. }
  392.  
  393.   void
  394. FmtAdrBox(uchar *boxptr,uint addr)
  395. {
  396.     uchar c;                            /* was register.                  112*/
  397.     uchar *fmtptr, *bufptr, buffer[9];
  398.  
  399.     bufptr  = buffer;                                                   /*202*/
  400.     utox8(addr, buffer);                                                /*202*/
  401.  
  402.     fmtptr = (uchar*) AboxFormat;
  403.  
  404.     for(;;)
  405.     {
  406.         c = *fmtptr++;
  407.         switch( c )
  408.         {
  409.           case 0:
  410.             return;
  411.  
  412.           case ' ':
  413.             boxptr += 2;
  414.             break;
  415.  
  416.           case '#':
  417.           default:
  418.            if( c == '#')
  419.             c = *bufptr++;
  420.  
  421.           {
  422.            uchar attr1;
  423.            uchar attr2;
  424.             *boxptr++ = c;  /* set character */
  425.             attr1 = FG_white|FG_light;
  426.             attr2 = VideoMap[vaStgVal] & (uchar)~FG_attribute;
  427.             *boxptr++ = attr2 | attr1;
  428.           }
  429.     }   }
  430. }
  431.  
  432. x2tou(uchar *hexstr,uchar *valptr)
  433. {
  434.     uint c, n, mask, shift;             /* was register.                  112*/
  435.  
  436.     shift = 4;
  437.     mask = 0xF0;
  438.     for( n=0 ; n < 2 ; ++n, shift -= 4, mask >>= 4 ){
  439.         if( ((c = hexstr[n] - '0') > 9)
  440.          && (((c = hexstr[n] - ('A'-10)) < 10) || (c > 15))
  441.           ) return( FALSE );
  442.         *valptr &= ~mask;
  443.         *valptr |= (c << shift);
  444.     }
  445.     return( TRUE );
  446. }
  447.  
  448.  
  449. /*****************************************************************************/
  450. /* GetIthHexField()                                                       701*/
  451. /*                                                                        701*/
  452. /* Description:                                                           701*/
  453. /*   Get the ith field that a mouse event has occurred in.                701*/
  454. /*                                                                        701*/
  455. /* Parameters:                                                            701*/
  456. /*   Event      The event that we're testing.                             701*/
  457. /*                                                                        701*/
  458. /* Return:                                                                701*/
  459. /*                                                                        701*/
  460. /*  ith         The hex field that the event occurred in.                 701*/
  461. /*                                                                        701*/
  462. /* Assumptions                                                            701*/
  463. /*  none                                                                  701*/
  464. /*                                                                        701*/
  465. /*****************************************************************************/
  466. #define FIELDSIZE 3                                                     /*701*/
  467. #define FRAMESIZE (4*FIELDSIZE+1)                                       /*701*/
  468. #define EVENTNOTINFIELD 99                                              /*701*/
  469. #define ASCII_ITH       16                                              /*701*/
  470.                                                                         /*701*/
  471. int GetIthHexField( PEVENT Event )                                      /*701*/
  472. {                                                                       /*701*/
  473.  int    frame;                                                          /*701*/
  474.  int    column;                                                         /*701*/
  475.  int    FieldStartCol;                                                  /*701*/
  476.  int    delta;                                                          /*701*/
  477.  int    ith;                                                            /*701*/
  478.  int    area;                                                           /*701*/
  479.                                                                         /*701*/
  480.  /************************************************************************701*/
  481.  /* If the event is in the ascii field, we only need to return the        701*/
  482.  /* initial index of the field simply to distinguish it from an index     701*/
  483.  /* in the storage area.                                                  701*/
  484.  /************************************************************************701*/
  485.  area = GetStorageArea(Event);                                          /*701*/
  486.  if( area == ASCIIAREA )                                                /*701*/
  487.   return(ASCII_ITH);                                                    /*701*/
  488.  /************************************************************************701*/
  489.  /* - get absolute column number relative to 0 index.                     701*/
  490.  /* - convert to column number relative to STGCOL, the start of editable  701*/
  491.  /*   storage.                                                            701*/
  492.  /* - get the frame the event occurred in.                                701*/
  493.  /* - get the ith field that the event occurred in.                       701*/
  494.  /* - test to see if the event occurred in the spaces between the fields  701*/
  495.  /*   and if it did, then return a "not in field" indication.             701*/
  496.  /* -                                                                     701*/
  497.  /* -                                                                     701*/
  498.  /* - storage layout is like so:                                          701*/
  499.  /*                                                                       701*/
  500.  /*        __STGCOL - 1 ( the -1 makes STGCOL relative to a 0 index.)     701*/
  501.  /*       |                                                               701*/
  502.  /*       |                                                               701*/
  503.  /*       |-frame 0---||-frame 1---||-frame 2---||-frame 3---|            701*/
  504.  /*       bb bb bb bb  bb bb bb bb  bb bb bb bb  bb bb bb bb              701*/
  505.  /*       ----------------------------------------------------            701*/
  506.  /* ith   0  1  2  3   4  5  6  7   8  9  1  1   1  1  1  1               701*/
  507.  /*                                       0  1   2  3  4  5               701*/
  508.  /*                 111111111122222222223333333333444444444455            701*/
  509.  /*       0123456789012345678901234567890123456789012345678901            701*/
  510.  /*                                                                       701*/
  511.  /************************************************************************701*/
  512.  column  = Event->Col;                                                  /*701*/
  513.  column = ( column - (STGCOL-1) );                                      /*701*/
  514.                                                                         /*701*/
  515.  frame = column/FRAMESIZE;                                              /*701*/
  516.  ith = frame*4 + (column - frame*FRAMESIZE)/FIELDSIZE;                  /*701*/
  517.                                                                         /*701*/
  518.  FieldStartCol = ith*FIELDSIZE + ith/4;                                 /*701*/
  519.  delta =  column - FieldStartCol;                                       /*701*/
  520.  if( delta != 0 && delta != 1 )                                         /*701*/
  521.   ith = EVENTNOTINFIELD;                                                /*701*/
  522.  return(ith);                                                           /*701*/
  523.                                                                         /*701*/
  524. }                                                                       /*701*/
  525. /*****************************************************************************/
  526. /* GetStorageArea()                                                       701*/
  527. /*                                                                        701*/
  528. /* Description:                                                           701*/
  529. /*   Get the area of the data window that an event has occurred in.       701*/
  530. /*                                                                        701*/
  531. /* Parameters:                                                            701*/
  532. /*   Event      The event that we're testing.                             701*/
  533. /*                                                                        701*/
  534. /* Return:                                                                701*/
  535. /*                                                                        701*/
  536. /*  area         - edit area                                              701*/
  537. /*               - storage area                                           701*/
  538. /*               - ascii area                                             701*/
  539. /*                                                                        701*/
  540. /* Assumptions                                                            701*/
  541. /*  none                                                                  701*/
  542. /*                                                                        701*/
  543. /*****************************************************************************/
  544. int GetStorageArea( PEVENT Event )                                      /*701*/
  545. {                                                                       /*701*/
  546.  int    area = 0;                                                       /*701*/
  547.                                                                         /*701*/
  548.  if( GetEventView() != DATAVIEW )                                       /*701*/
  549.   return(0);                                                            /*701*/
  550.                                                                         /*701*/
  551.  else if( Event->Col < STGCOL - 1 )                                     /*701*/
  552.   area = EDITAREA;                                                      /*701*/
  553.                                                                         /*701*/
  554.  else if( Event->Col < ASCIICOL - 1 )                                   /*701*/
  555.   area = STORAGEAREA;                                                   /*701*/
  556.                                                                         /*701*/
  557.  else                                                                   /*701*/
  558.   area = ASCIIAREA;                                                     /*701*/
  559.  return( area );                                                        /*701*/
  560. }                                                                       /*701*/
  561.