home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / ACTBAR.C < prev    next >
Text File  |  1995-05-26  |  12KB  |  197 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   actbar.c                                                                */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*  Source and Assembler action bar handling.                                */
  7. /*                                                                           */
  8. /*                                                                           */
  9. /* History:                                                                  */
  10. /*                                                                           */
  11. /*   02/08/91 Creation of 32-bit SD86, from 16-bit version.                  */
  12. /*                                                                           */
  13. /*...16->32 port.                                                            */
  14. /*...                                                                        */
  15. /*... 02/08/91  100   Philip    port to 32 bit.                              */
  16. /*... 02/08/91  101   Joe       port to 32 bit.                              */
  17. /*... 02/08/91  105   Christina port to 32 bit.                              */
  18. /*... 02/08/91  106   Srinivas  port to 32 bit.                              */
  19. /*... 02/08/91  110   Srinivas  port to 32 bit.                              */
  20. /*... 02/08/91  111   Christina port to 32 bit.                              */
  21. /*... 02/08/91  112   Joe       port to 32 bit.                              */
  22. /*                                                                           */
  23. /*...Release 1.00 (Pre-release 1)                                            */
  24. /*...                                                                        */
  25. /*... 07/09/91  204   srinivas  Hooking up of defered break points.          */
  26. /*... 08/19/91  229   srinivas  ESC key should take back to action bar from  */
  27. /*                              showthds and editregs.                       */
  28. /*... 08/19/91  231   srinivas  GETFUNC, GETFILE, BRKPT from the action bar  */
  29. /*                              need not remember the previous values.       */
  30. /*... 08/22/91  234   Joe       PL/X gives "varname" is incorrect message    */
  31. /*...                           when entering a parameter name in the data   */
  32. /*...                           window.  This happens when the cursor is on  */
  33. /*...                           an internal procedure definition statement   */
  34. /*...                           and you use F2 to get into the data window   */
  35. /*...                           and then type the name.                      */
  36. /*                                                                           */
  37. /*...Release 1.00 (Pre-release 107 11/13/91)                                 */
  38. /*...                                                                        */
  39. /*... 11/13/91  400   Srinivas  Vertical Register Display.                   */
  40. /*...                                                                        */
  41. /*... 11/18/91  401   Srinivas  Floating point Register Display.             */
  42. /*...                                                                        */
  43. /*...Release 1.00 (Pre-release 108 12/05/91)                                 */
  44. /*...                                                                        */
  45. /*... 02/10/92  517   Srinivas  Cusrsor sensitive prompting for GetFunc.     */
  46. /*... 02/11/92  518   Srinivas  Remove limitation on max no of screen rows.  */
  47. /*... 02/12/92  521   Srinivas  Port to C-Set/2.                             */
  48. /*...                                                                        */
  49. /*...Release 1.01 (07/10/92)                                                 */
  50. /*...                                                                        */
  51. /*... 05/08/92  701   Joe       Cua Interface.                               */
  52. /*...                                                                        */
  53. /**Includes*******************************************************************/
  54.  
  55. #define INCL_16                         /* 16-bit API                     101*/
  56. #include "all.h"                        /* SD86 include files                */
  57. /* #define _MT             */                                           /*111*/
  58. #include <process.h>                                                    /*111*/
  59.  
  60. /**Macros*********************************************************************/
  61.  
  62. #define NODROPOPT 0x08                  /* mask 2**2 (dropfile)              */
  63. #define NOPROCESS 0x40                  /* mask for  (process )           106*/
  64. #define NOSELECT   0                    /* no menu selection.                */
  65. #define GETFUNC    1                    /* get a function.                   */
  66. #define GETFILEx   2                    /* get a file.                       */
  67. #define BKPT       3                    /* set immediate/deferred bkpt.      */
  68. #define DROPFILEx  4                    /* drop a file from ring.            */
  69. #define FINDSTRING 5                    /* find/repeat find a string.        */
  70. #define EDITREGS   5                    /* edit registers in asm menu.       */
  71. #define THREADS    6                    /* restart the application.          */
  72. #define PROCESS    7                    /* restart the application.          */
  73. #define RESTARTx   8                    /* restart the application.          */
  74. #define QUITx      9                    /* quit SD86.                        */
  75.  
  76. /**Externs********************************************************************/
  77.  
  78. extern AFILE*        allfps;            /* -> to afile ring.                 */
  79. extern uint          LinesPer;          /* currnt # lines/screen for Code.   */
  80. extern uint          VideoCols;         /* # of columns per screen           */
  81. extern uint          VideoRows;         /* # of rows per screen           518*/
  82. /*****************************************************************************/
  83. /* These externs are instanced for each process being debugged.              */
  84. /*****************************************************************************/
  85. extern char  GetFuncBuffer[PROMAX+1];   /* save buffer for GetFunc.          */
  86. extern char  GetFileBuffer[PROMAX+1];   /* save buffer for GetFile.          */
  87. extern char  BkptBuffer[PROMAX+1];      /* save buffer for Bkpt.             */
  88. extern char  FindStringBuffer[PROMAX+1];/* save buffer for Find.             */
  89. extern uchar Reg_Display;               /* Register display flag          400*/
  90. extern uchar *BoundPtr;                 /* -> to screen bounds            518*/
  91.  
  92. /*****************************************************************************/
  93. /* scan function                                                             */
  94. /*****************************************************************************/
  95. uint slen;                              /* length of search string        110*/
  96. extern uint str_fnd_flag;               /* flag to signal reverse video   110*/
  97.  
  98. /* scan(AFILE *fp,uchar *str,uchar *buf) */
  99. int scan(AFILE *fp,uchar *str)          /*                                701*/
  100. {
  101.     int togo;
  102.     uint hit = 0;
  103.     uint orglno = fp->csrline + fp->Nbias;
  104.     uint n = fp->csrline;               /* was register. 112              110*/
  105.     uint runlno = orglno;               /* was register. 112              110*/
  106.     uchar *cp, c1st = str[0];
  107.     uint adjust = fp->skipcols + fp->csr.col + 1;
  108.     ushort *offtab = fp->offtab;           /* 2-byte table offsets        100*/
  109.     uint xlc = 0, pass1 = 1;
  110.     uchar pattern[ PROMAX+1 ];
  111.  
  112.  uchar            buf[ MAXCOLS+1 ];     /* buffer for source line decode.    */
  113.   memset(    buf, 0, sizeof(   buf) );  /* clear the prompt buffer.       100*/
  114.  
  115.  
  116.     str_fnd_flag = 0;                   /* reset the string found flag.   110*/
  117.  
  118.     /* If str is all lowercase, Then do case insensative match */
  119.     if( (slen = strlen(str)) < sizeof(pattern) ){
  120.         LowerCase(str, pattern);
  121.         pattern[slen] = 00;                /* null-terminator             100*/
  122.         xlc = !strcmp(str, pattern);
  123.         if ( xlc ) {                       /* if all lowercase,           100*/
  124.             c1st = *( str = pattern );
  125.     }   }
  126.     for(;;)
  127.     {
  128.         togo = (Decode(fp->source + offtab[n], buf))
  129.              - slen + 1 - adjust;
  130.         if( xlc )
  131.             LowerCase( buf, buf );
  132.      for( cp = buf + adjust,
  133.           adjust = 0 ;
  134.           togo > 0 ;
  135.           ++cp,
  136.           togo -= hit+1
  137.         )
  138.      {
  139.       hit = bindex(cp, togo, c1st);
  140.       cp += hit;
  141.       if( (hit < (uint)togo) && !strncmp(cp, str, slen) )/*if match found,100*/
  142.       {
  143.           fp->csrline = n;
  144.           fp->skipcols = ((n = cp - buf) / VideoCols) * VideoCols;
  145.           fp->csr.col = ( uchar)(n % VideoCols);
  146.           str_fnd_flag = 1;             /* set the flag to procede with   110*/
  147.           return(1);                    /* highlighting the string        110*/
  148.       }
  149.      }
  150.  
  151.      n++;                                                               /*110*/
  152.  
  153.      if( (++runlno == orglno) && !pass1)
  154.      {                                  /* if line no on which search     110*/
  155.                                         /* started and current line no is 110*/
  156.                                         /* same return with failure       110*/
  157.          fp->csrline = n;                                               /*110*/
  158.          return(0);
  159.       }
  160.  
  161.      if( runlno > fp->Tlines )          /*  if the lineno goes beyond the 234*/
  162.      {                                  /*  total lines fetch the top     110*/
  163.          n = runlno = 1;                /*  portion of the source and     234*/
  164.          pass1 = 0;                     /*  continue search.              110*/
  165.          if (fp->pdf != NULL)
  166.              pagefp(fp,1);              /* if not called from browse func 110*/
  167.          else
  168.             scrollfile(fp,1);           /* if called from browse function 110*/
  169.          offtab = fp->offtab;           /* reinitiliase the offtab pointe 110*/
  170.          /* Wrap Around */
  171.                                         /*  infomration message           110*/
  172.          beep();                        /*  issue a beep sound.           110*/
  173.      }
  174.  
  175.      if( (runlno==1 && orglno==1) && !pass1 )
  176.      {                                  /* if line no on which serach     234*/
  177.                                         /* started is 1 and we have wrap- 110*/
  178.                                         /* ed around return with failure  110*/
  179.  
  180.          return(0);
  181.      }
  182.  
  183.      if( n > fp->Nlines )               /* if lineno exceeds the number   234*/
  184.      {                                  /* of lines in the buffer, fetch  110*/
  185.                                         /* the next portion of the source 110*/
  186.         if (fp->pdf != NULL)
  187.           pagefp(fp,n + fp->Nbias);     /* if not called from browse func 234*/
  188.         else
  189.           scrollfile(fp,n + fp->Nbias); /* if called from browse function 234*/
  190.         offtab = fp->offtab;            /* reinitiliase the offtab pointe 110*/
  191.         n = runlno - fp->Nbias;         /* set the line no from where to  110*/
  192.                                         /* continue search                110*/
  193.      }
  194.  
  195.     }
  196. }
  197.