home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / p2demo21.exe / PEL / ASCII.PEL next >
Text File  |  1995-04-04  |  3KB  |  108 lines

  1. # $Header:   P:\source\wmacros\ascii.pev   1.7   04 Apr 1995 09:27:14   WALKER  $
  2.  
  3. ##############################################################################
  4. #
  5. ##
  6. ##         Compuware Corporation
  7. ##           31440 Northwestern Highway
  8. ##             Farmington Hills, Michigan 48334-2564
  9. ## 
  10. ##     This source code listing contains information that is
  11. ##     proprietary to Compuware Corporation and may not be copied
  12. ##     duplicated, translated, transmitted, stored, retrieved
  13. ##     or in any manner or by any method conveyed or disclosed
  14. ##     to a third party or parties without express written
  15. ##     permission from Compuware Corporation.
  16. ##
  17. #
  18. ##############################################################################
  19.  
  20. #### $Workfile:   ascii.pel  $ Ascii Table
  21.  
  22. local HEX_TEXT        = 104
  23. local DEC_TEXT        = 105
  24.  
  25.  
  26. global function display_ascii_table()
  27. {
  28.    local X_EXTENT = 16
  29.    local Y_EXTENT = 16
  30.  
  31.    local i
  32.    local j
  33.    local hdlg
  34.  
  35.    if (isWindows() && length(search_path("charmap.exe", "PATH")))
  36.       system("charmap.exe") # Windows's charmap is cool!
  37.    else
  38.    {
  39.       message( "Creating Ascii Table..." )
  40.  
  41.       hdlg = create_mdialog(function_id("ascii_dialog_callback"), -1, 1800, resource_dll );
  42.       
  43.       for ( i = 1; i <= Y_EXTENT; i++ )
  44.       {
  45.          for ( j = 1; j <= X_EXTENT; j++ )
  46.          {
  47.             set_dialog_item( hdlg, 101, DAC_VS_SET_ITEM, i, j, chr( (i-1) * Y_EXTENT + (j-1) ));
  48.          }
  49.       }
  50.       
  51.       set_dialog_item(  hdlg, HEX_TEXT, DAC_TEXT, "0" )
  52.       set_dialog_item(  hdlg, DEC_TEXT, DAC_TEXT, "0" )
  53.    
  54.       begin_dialog( hdlg, TRUE )
  55.       message( "" )
  56.    }
  57. }
  58.  
  59. global function ascii_dialog_callback()
  60. {
  61.    local ret_val = DRC_CONTINUE
  62.    local val, row, col
  63.  
  64.    if ( callback_msg == DM_VS_SELECT )
  65.    {
  66.       row = and(callback_data, 0xFFFF)
  67.       col = and(shiftr(callback_data, 16) , 0xFFFF )
  68.  
  69.       val = (row-1) * 16 + (col-1)
  70.  
  71.       set_dialog_item(  callback_dialog_handle, HEX_TEXT, DAC_TEXT, 
  72.                         sprintf( "%X", val) )
  73.  
  74.       set_dialog_item(  callback_dialog_handle, DEC_TEXT, DAC_TEXT, 
  75.                         sprintf( "%d", val) )
  76.  
  77.       ret_val = DRC_MSG_PROCESSED 
  78.    }
  79.    else if (callback_dialog_handle == regex_dlg && callback_msg == DM_CLOSE)
  80.       regex_dlg = 0
  81.  
  82.    return ret_val
  83. }
  84.  
  85. #
  86. # Regular Expression Table
  87. #
  88.  
  89. local IDD_REGEX_TABLE = 1600
  90. local regex_dlg
  91.  
  92. global function display_regex_table()
  93. {
  94.    regex_dlg = create_mdialog( function_id("ascii_dialog_callback"), 
  95.                             prompt_display_handle ? prompt_display_handle : -1,
  96.                      IDD_REGEX_TABLE, resource_dll )
  97.    begin_dialog(regex_dlg, TRUE)
  98. }
  99.  
  100. global function delete_regex_table()
  101. {
  102.    if (regex_dlg)
  103.    {
  104.       delete_dialog(regex_dlg)
  105.       regex_dlg = 0
  106.    }
  107. }
  108.