home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
p2demo21.exe
/
PEL
/
WRKFRAME.PEL
< prev
Wrap
Text File
|
1995-04-05
|
7KB
|
254 lines
# $Header: P:\source\wmacros\wrkframe.pev 1.25 05 Apr 1995 13:54:54 WALKER $
## $Tabs:4 7$
##############################################################################
#
# Compuware Corporation
# 31440 Northwestern Highway
# Farmington Hills, Michigan 48334-2564
#
# This source code listing contains information that is
# proprietary to Compuware Corporation and may not be copied
# duplicated, translated, transmitted, stored, retrieved
# or in any manner or by any method conveyed or disclosed
# to a third party or parties without express written
# permission from Compuware Corporation.
#
#
##############################################################################
local wf_serverid = 0
# error list buffer name by magic_cookie
local wf_errors[]
local wf_error_buffers[]
local wf_current_error
local wf_next_markid
local MIN_WF_MARKID = 100
local MAX_WF_MARKID = 980
global function initialize_wf_dde()
{
wf_current_error = 0
wf_next_markid = MIN_WF_MARKID
if ( !wf_serverid ) {
wf_serverid = create_dde_server("WB Editor", function_id("wf_dde_callback"))
if ( !wf_serverid )
{
error("Unable to create DDE server WB Editor")
return;
}
delete wf_errors
attach_event_handler(EVENT.DELETING_BUFFER, function_id("wf_delete_buffer"))
}
}
global function wf_delete_buffer()
{
local arr[]
local i
# this will delete all the marks contained in the errors array
# that were associated with this buffer
if ( buffer_filename in wf_error_buffers ) {
remove_dde_server_topic( wf_serverid, buffer_filename );
while ( i in wf_errors ) {
if ( split( wf_errors[i], arr ) > 0 ) {
if ( arr[1] == buffer_filename ) {
delete_mark( arr[2] )
delete wf_errors[i]
}
}
}
}
}
global function wf_goto_next_error()
{
local stop_loop = 0
local i
for ( i in wf_errors ) {
if ( stop_loop == 1 )
break
if ( i == wf_current_error )
stop_loop = 1
}
if ( ( wf_current_error == 0 && i ) || ( stop_loop == 1 && wf_current_error != i ) ) {
wf_current_error = i
get_workframe_error_info(wf_serverid, buffer_filename, wf_current_error)
}
else {
message("No more errors.")
}
}
global function wf_goto_prev_error()
{
local stop_loop = 0
local i
local prev_error = 0
for ( i in wf_errors ) {
if ( i == wf_current_error )
stop_loop = 1
if ( stop_loop == 1 )
break
prev_error = i
}
# if ( stop_loop == 1 && prev_error != 0 ) {
if ( prev_error != 0 ) {
wf_current_error = prev_error
get_workframe_error_info(wf_serverid, buffer_filename, wf_current_error)
}
else {
message("No more errors.")
}
}
global function wf_dde_callback()
{
local topicid, topicname
local arr[]
local ddename, numerrors, errorline, errortext, erroroffset, errorlength
local magic_cookie
local dde_data
local libraryname
if ( dde_callback_action(wf_serverid) == DDE_INITIATE ) {
topicid = create_dde_topic( dde_callback_topic(wf_serverid) )
if ( !topicid ) {
warning("Unable to create dde topic");
return;
}
if ( !add_dde_item(topicid, "Initialize") ) {
warning("Unable to add DDE item Initialize");
return;
}
if ( !add_dde_item(topicid, "Goto") ) {
warning("Unable to add DDE item Goto");
return;
}
if ( !add_dde_item(topicid, "SendGoto") ) {
warning("Unable to add DDE item SendGoto");
return;
}
if ( !add_dde_server_topic(wf_serverid, topicid) ) {
warning("Unable to add DDE server topic");
return;
}
}
else if ( dde_callback_action(wf_serverid) == DDE_EXECUTE ) {
if ( dde_callback_item(wf_serverid) == "Goto" ) {
if ( mdi_mode != 2 )
set_editwin_property( EWC_TO_TOP ) # bring editwin to top of window stack
dde_data = dde_callback_data(wf_serverid)
ddename = strtok(dde_data, ";")
errorline = atoi(strtok())
erroroffset = atoi(strtok()) + 1
magic_cookie = atoi(strtok())
errortext = strtok()
wf_current_error = magic_cookie
# we have to loop through all our known topic names because the
# IBM WorkFrame does not send the topic name correctly
if ( magic_cookie in wf_errors ) {
if ( split( wf_errors[magic_cookie], arr ) > 0 )
{
unhilight_temp_selection()
update_current_view()
create_buf_and_win(arr[1])
goto_mark(arr[2])
update_current_view()
create_linecol_selection(3, errorline, 0, errorline, 0)
message(errortext)
}
else if ( ddename != "" )
{
unhilight_temp_selection()
update_current_view()
create_buf_and_win(ddename)
update_current_view()
create_linecol_selection(3, errorline, 0, errorline, 0)
message(errortext)
}
}
else if ( ddename != "" )
{
unhilight_temp_selection()
update_current_view()
create_buf_and_win(ddename)
update_current_view()
create_linecol_selection(3, errorline, 0, errorline, 0)
message(errortext)
}
update_current_view()
#display_redraw()
}
else if ( dde_callback_item(wf_serverid) == "Initialize" )
{
dde_data = dde_callback_data(wf_serverid)
numerrors = atoi( strtok(dde_data, ";") )
while (numerrors > 0 ) {
errorline = atoi( strtok() )
erroroffset = atoi( strtok() ) + 1
errorlength = strtok()
magic_cookie = atoi(strtok())
wf_next_markid++
while ( mark_defined(wf_next_markid) != 0 ) {
wf_next_markid++
if ( wf_next_markid > MAX_WF_MARKID )
wf_next_markid = MIN_WF_MARKID
}
create_mark(wf_next_markid, errorline, erroroffset)
wf_errors[magic_cookie] = buffer_filename FS wf_next_markid
numerrors--
}
# now get the help library name from the message
libraryname = strtok();
# keep a list of buffers so we can free the marks easily later
wf_error_buffers[buffer_filename] = libraryname
update_current_view()
}
}
}