home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / idedll.zip / WATCOM.PEL < prev   
Text File  |  1995-11-23  |  3KB  |  92 lines

  1. #########################################################################
  2. #
  3. # WATCOM.PEL
  4. #
  5. #  ide_hilite( row, col, len)
  6. #  ide_hilite_err( row, col, len, resource, errmsg)
  7. #  ide_sethelp( helpfile)
  8. #
  9. # Implements the DDE functions called from the Watcom IDE to link the
  10. # PREDITOR/2 Editor
  11. #
  12. #########################################################################
  13.  
  14. # ide_hilite( row, col, len)
  15. #
  16. # Position the cursor at the indicated point and then hilite the next len characters.
  17.  
  18. global function ide_hilite( row, col, len)
  19.  { goto_pos( row, col)
  20.    center_cursor()
  21.    if (0 != len)
  22.       create_linecol_selection( NORMAL_SELECTION, row, col, row, col + len, 0, 0)
  23.  }
  24.  
  25. # ide_hilite_err( row, col, len, resource, token)
  26. #
  27. # Position the cursor at the indicated point and then hilite the next len characters.
  28. # If col is zero, this seems to indicate that the Watcom IDE doesn't know the column
  29. # position of the offending token.  In this case, see if there is a single-quoted
  30. # string in the error message.  If so, try to find it in the line and use it to
  31. # compute the column position and hilite information.
  32.  
  33. global function ide_hilite_err( row, col, len, resource, token)
  34.  { # Unencode the token
  35.    token = space_decode( token)
  36.  
  37.    # If Col = 0, then the IDE doesn't know the position of the error, so just hilight
  38.    # the whole line.  Otherwise hilight the error.
  39.    if (0 == col)
  40.     { goto_pos( row, 1)
  41.       goto_eol()
  42.       create_linecol_selection( NORMAL_SELECTION, row, current_column, row, 1, 0, 0)
  43.     }
  44.    else
  45.     { if (0 != len)
  46.          create_linecol_selection( NORMAL_SELECTION, row, col + len, row, col, 0, 0)
  47.       else
  48.          goto_pos( row, col)
  49.     }
  50.    center_cursor()
  51.  }
  52.  
  53. # ide_sethelp( helpfile)
  54. #
  55. # Currently, I am not doing anything with the HelpFile.
  56.  
  57. global function ide_sethelp( helpfile)
  58.  {
  59.  }
  60.  
  61. # space_decode( coded_str)
  62. #
  63. # Decodes the string to restore it to plain text
  64. local function space_decode( coded_str)
  65.  { local token
  66.    local i
  67.    local flag
  68.    local chr
  69.  
  70.    for (i = 0, flag = 0, token = "" ; i <= length( coded_str) ; i++)
  71.     { chr = substr( coded_str, i, 1)
  72.       if ("~" == chr)
  73.        { if (1 == flag)
  74.           { token = token + chr
  75.             flag = 0
  76.           }
  77.          else
  78.             token = token + " "
  79.        }
  80.       else if ("$" == chr)
  81.        { if (1 == flag)
  82.           { token = token + chr
  83.             flag = 0
  84.           }
  85.          else
  86.             flag = 1
  87.        }
  88.       else
  89.          token = token + chr
  90.     }
  91.    return token
  92.  }