home *** CD-ROM | disk | FTP | other *** search
- $MACRO_FILE PVCS;
- {*************************MULTI-EDIT MACRO FILE******************************
- Contains the PVCS interface macros.
- To configure Multi-Edit to interface to the PVCS system, place the
- following commands in your STARTUP macro:
-
- {Tell Multi-Edit to utilize the PVCS_GET_FILE macro if a
- FILE NOT FOUND error occurs when the user loads a file.}
- set_global_str('@FNF_LOAD_MACRO@', 'PVCS^PVCS_GET_FILE');
-
- {Setup the switches to use for checking out a file.
- -L is the default switch. If you do not want the file
- locked, then you can use the -W switch.}
- set_global_str('!PVCS_GET_SWITCHES!', '-L' );
-
- {Tell Multi-Edit to call the PVCS_CLEANUP macro before
- exiting. Only use this if you want to be prompted to
- check files back in before exiting.}
- set_global_str('@ME_EXIT_MACRO@', 'PVCS^PVCS_CLEANUP');
-
-
- The macro PVCS_MENU supplies a menu from which the user can list available
- log files, check out files from that list, and check the current file back
- in.
-
- PVCS - Polytron PVCS interface menu
- PVCS_GET_FILE - Loads PVCS files
- PVCS_DIR - Displays a directory of PVCS files
- PVCS_CLEANUP - Works with ME's exit routine to be sure PVCS issues are resolved
- PVCS_MENU - Checkin/Checkout for PVCS files
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO PVCS;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: PVCS
-
- Description: Polytron PVCS Inteface macro.
-
- Parameters: /C=str Command string
- CHECKOUT check out file
- CHECKIN check file back in
-
- /F=str File name
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- def_str( cmd[20],
- fname[120],
- tstr[120],
- pvcs_name[120],
- switches[40]
- );
-
- def_int( old_win, pvcs_win, initial_rev, checkout_count, jx, file_win,
- multi_line_comment );
-
- {IF you want multiple line comments for PVCS then set this variable to
- TRUE}
- multi_line_comment := FALSE;
-
- cmd := shorten_str(parse_str( '/C=', mparm_str ));
- fname := parse_str( '/F=', mparm_str );
- IF fname = '' THEN
- fname := file_name;
- ELSE
- fname := fexpand(fname);
- END;
- refresh := false;
-
- old_win := window_id;
- switch_window( window_count );
- create_window;
- pvcs_win := window_id;
- pvcs_name := me_path + user_id + 'PVCS.TMP';
- IF switch_file( pvcs_name ) THEN
- delete_window;
- END;
- switch_win_id( pvcs_win );
- reg_exp_stat := TRUE;
-
- checkout_count := Global_Int('!PVCS_CHECKOUT_COUNT!');
-
- IF cmd = 'CHECKOUT' THEN
- RM('userin^CHECKFILE');
- IF return_int < 1 THEN
- goto exit;
- END;
- make_message('');
- Working;
- switches := Global_Str('!PVCS_GET_SWITCHES!');
- IF switches = '' THEN
- switches := '-L';
- END;
- gotoxy( message_col, message_row );
- make_message('Retrieving "' + truncate_path(fname) + '"...');
- shell_to_dos( 'RSE GET ' + switches + ' ' + fname + ' > ' + pvcs_name, TRUE );
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- load_file( pvcs_name );
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- IF (search_fwd('get:',0)) THEN
- RM('MEERROR^MESSAGEBOX /T=PVCS ERROR/B=2/M=' + get_line );
- return_int := 0;
- goto ERROR_exit;
- END;
- IF (search_fwd('@<@-',0)) THEN
- goto_col(1);
- fname := fexpand(get_word(' '));
- right; right; right; right;
- tstr := get_word(' ');
- switch_win_id( old_win );
- load_file( fname );
- RM('EXTSETUP');
- return_int := 1;
- make_message( '"' + truncate_path(file_name) + '" checked out of "' + tstr + '".');
- ++checkout_count;
- Set_Global_Str('!PVCS_FILE_OUT#' + str(checkout_count), file_name );
- ELSE
- goto parse_problem;
- END;
-
- ELSIF cmd = 'CHECKIN' THEN
- return_str := get_extension( fname );
- IF length(return_str) = 1 THEN
- return_str := return_str + '_V';
- ELSE
- return_str := copy(return_str,1,2) + 'V';
- END;
- initial_rev := (file_exists( truncate_extension(fname) + '.' + return_str) = FALSE);
-
-
-
- IF multi_line_comment THEN
- switch_window( window_count );
- create_window;
- file_name := me_path + user_id + '2PVCS.TMP';
- Return_Str := '';
- IF initial_rev THEN
- RM('USERIN^EDITWINDOW /X=5/Y=5/W=60/L=10/WW=1/RM=58/CC=1/SP=1/T=PVCS: DESCRIBE "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' -T';
- ELSE
- RM('USERIN^EDITWINDOW /X=5/Y=5/W=60/L=10/WW=1/RM=58/CC=1/SP=1/T=PVCS: DESCRIBE CHANGES TO"' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' -M';
- END;
- save_file;
- delete_window;
- switch_win_id( pvcs_win );
- RM('USERIN^VERIFY /T=Check "' + fname + '" into library?');
- ELSE
- Return_Str := '';
- IF initial_rev THEN
- RM('USERIN^USERSTR /BL=PVCS: DESCRIBE "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' -T';
- ELSE
- RM('USERIN^USERSTR /BL=PVCS: DESCRIBE CHANGES TO "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' -M';
- END;
- tstr := return_str;
- END;
- IF return_int THEN
- working;
- file_win := 0;
- IF switch_file( fname ) THEN
- file_win := window_id;
- IF file_changed THEN
- RM('MEUTIL1^SAVEFILE /NP=1');
- END;
- RM('WINDOW^DelWin');
- IF old_win = file_win THEN
- old_win := window_id;
- END;
- END;
-
- jx := 1;
- WHILE (jx <= checkout_count) AND
- (Global_Str('!PVCS_FILE_OUT#' + str(jx)) <> fname) DO
- ++jx;
- END;
- IF jx <= checkout_count THEN
- return_int := jx;
- RM('USERIN^DELETEITEM /G=!PVCS_FILE_OUT#/#=' + str(checkout_count) );
- --checkout_count;
- END;
- switch_win_id( pvcs_win );
- make_message('');
- Working;
- gotoxy( message_col, message_row );
- make_message('Storing "' + truncate_path(fname) + ' "...');
- IF NOT(multi_line_comment) THEN
- shell_to_dos( 'RSE PUT ' + switches + '"' + tstr + '" ' + fname + ' > ' + pvcs_name, TRUE );
- ELSE
- shell_to_dos( 'RSE PUT ' + switches + '@' + me_path + user_id + '2PVCS.TMP ' + fname + ' > ' + pvcs_name, TRUE );
- END;
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- load_file( pvcs_name );
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- IF (search_fwd('%put:',0)) THEN
- RM('MEERROR^MESSAGEBOX /T=PVCS ERROR/B=2/M=' + get_line );
- return_int := 0;
- goto ERROR_exit;
- ELSE
- tof;
- IF (search_fwd('@-@>',0)) THEN
- goto_col(1);
- fname := fexpand(get_word(' '));
- right; right; right; right;
- tstr := get_word(' ');
- return_int := 1;
- make_message( '"' + truncate_path(fname) + '" checked in to "' + tstr + '".');
- ELSE
- parse_problem:
- return_int := 0;
- make_message('Problem parsing PVCS message file.');
- goto exit2;
- END;
- END;
- END;
- END;
- GOTO EXIT;
-
- ERROR_EXIT:
- make_message('Error occurred during PVCS operation.');
- EXIT:
- IF switch_win_id( pvcs_win ) THEN
- delete_window;
- END;
- switch_win_id( old_win );
- EXIT2:
- set_global_int('!PVCS_CHECKOUT_COUNT!', checkout_count );
- END_MACRO;
-
- $MACRO PVCS_GET_FILE;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: PVCS_GET_FILE
-
- Description: Called from the LDFILES macro if the file was not found. This
- will search for a PVCS log file, and ask the user if he wants to retrieve
- the latest revision.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_str( tstr[120], gstr[20], new_ext[3] );
- tstr := truncate_path(parse_str('/F=',mparm_str));
- new_ext := get_extension( tstr );
- RM( 'FIND_EXT /EXT=.' + new_ext );
- gstr := return_str;
- return_str := parse_str('DIR=',Global_Str(gstr));
- IF svl(new_ext) = 1 THEN
- new_ext := new_ext + '_V';
- ELSE
- new_ext := copy(new_ext,1,2) + 'V';
- END;
- RM('PathSearch /F=' + truncate_extension(tstr) + '.' + new_ext );
- IF return_int THEN
- RM('USERIN^VERIFY /BL=PVCS: "' + tstr + '" not found/T=Get from "' + return_str + '"?');
- IF return_Int then
- RM('PVCS /C=CHECKOUT/F=' + get_path(return_str) + truncate_path(tstr));
- return_int := 1;
- END;
- ELSE
- return_int := 0;
- END;
- END_MACRO;
-
- $MACRO PVCS_DIR TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: PVCS_DIR
-
- Description: Displays directory listing of PVCS log files. Allows you to
- select a file to be retrieved.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
-
- def_int(bc, old_win, new_win);
- bc := parse_int( '/BC=', mparm_str );
- RM('DIRSHELL /S=2/W=48/L=100/D=' + get_path(global_str('!PVCS_DIR!')) + '*.??V' + mparm_str );
- set_global_str('!PVCS_DIR!', return_str);
- IF return_int > 0 THEN
- old_win := window_id;
- RM('CreateWindow');
- new_win := window_id;
- IF error_level = 0 THEN
- While box_count > bc DO
- kill_box;
- END;
- RM('PVCS /C=CHECKOUT/F=' + return_str);
- IF return_int = 0 THEN
- switch_win_id( new_win );
- delete_window;
- switch_win_id( old_win );
- END;
- END;
- RETURN_INT := 100;
- END;
- END_MACRO;
-
- $MACRO PVCS_CLEANUP TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: PVCS_CLEANUP
-
- Description: Checks to see if there are any PVCS files still checked out and
- prompts user for what to do. Done just prior to exiting ME.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
-
- def_int( checkout_count, jx, old_win );
-
- refresh := false;
- checkout_count := Global_Int('!PVCS_CHECKOUT_COUNT!');
- IF checkout_count < 1 THEN
- return_int := 1;
- goto exit;
- END;
- old_win := window_id;
- switch_window( window_count );
- create_window;
- jx := 0;
- WHILE jx < checkout_count DO
- ++jx;
- put_line( Global_Str('!PVCS_FILE_OUT#' + str(jx) ));
- down;
- END;
- tof;
- Set_Global_Str('EVPVCS1', '/T=Check files back in/K1=13/K2=28/R=1');
- Set_Global_Str('EVPVCS2', '/T=Exit without checking files in/KC=<SPACE>/K1=32/K2=57/R=2');
- Set_Global_Str('EVPVCS3', '/T=Cancel, don''t exit Multi-Edit/K1=27/K2=1/R=0');
- RM('WMENU /T=PVCS: FILES CHECKED OUT/EV=EVPVCS/EV#=3');
- delete_window;
- switch_win_id( old_win );
- IF return_int = 1 THEN
- jx := checkout_count;
- while jx > 0 DO
- RM('PVCS /C=CHECKIN/F=' + global_str('!PVCS_FILE_OUT#' + str(jx)));
- --jx;
- END;
- END;
- EXIT:
- END_MACRO;
-
- $MACRO PVCS_MENU TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: PVCS_MENU
-
- Description: Provides a menu of available PVCS files for check out.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
-
- def_str( gstr[20] );
- refresh := false;
- gstr := '!PVCS!_';
- Create_Global_Str(gstr+'1','/H=/M=PVCS_DIR');
- Create_Global_Str(gstr+'X1','List log files available for check out');
- Create_Global_Str(gstr+'2','/S=2/M=PVCS /C=CHECKIN');
- Create_Global_Str(gstr+'X2','Put current file into log (check file in)');
- do_xmenu:
- RM('USERIN^SUBMENU /GCLR=1/#=2/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=PVCS INTERFACE MENU/G=' + gstr + MParm_Str);
- END_MACRO;
-
- $MACRO PVCSInstall TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: PVCSInstall
-
- Description: Sets up the user's STARTUP.SRC file for PVCS.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
- def_int( old_win );
-
- refresh := false;
- old_win := window_id;
- create_window;
- return_str := 'STARTUP.SRC';
- RM('LdFiles');
- IF NOT(return_int) THEN
- return_str := me_path + 'SRC\STARTUP.SRC';
- RM('LdFiles');
- IF NOT(return_int) THEN
- RM('MEERROR^MessageBox /B=2/M=Unable to locate STARTUP.SRC. PVCS installation not complete.');
- goto exit;
- END;
- END;
- IF search_fwd('Setup for PVCS',0) THEN
- RM('MEERROR^MessageBox /B=1/M=STARTUP.SRC already contains PVCS setup.');
- goto exit;
- END;
- IF search_fwd('END_MACRO;', 0) THEN
- goto_col(1);
- set_indent_level;
- CR;
- up;
- Text('{************** Setup for PVCS ***************}'); CR;
- Text(' {Tell Multi-Edit to utilize the PVCS_GET_FILE macro if a'); CR;
- Text(' FILE NOT FOUND error occurs when the user loads a file.}'); CR;
- Text(' set_global_str(''@FNF_LOAD_MACRO@'', ''PVCS^PVCS_GET_FILE'');'); CR;
- set_global_str('@FNF_LOAD_MACRO@', 'PVCS^PVCS_GET_FILE');
- CR;
- Text(' {Setup the switches to use for checking out a file.'); CR;
- Text(' -L is the default switch. If you do not want the file'); CR;
- Text(' locked, then you can use the -W switch.}'); CR;
- Text(' set_global_str(''!PVCS_GET_SWITCHES!'', ''-L'' );'); CR;
- set_global_str('!PVCS_GET_SWITCHES!', '-L' );
- CR;
- Text(' {Tell Multi-Edit to call the PVCS_CLEANUP macro before'); CR;
- Text(' exiting. Only use this if you want to be prompted to'); CR;
- Text(' check files back in before exiting.}'); CR;
- Text(' set_global_str(''@ME_EXIT_MACRO@'', ''PVCS^PVCS_CLEANUP'');'); CR;
- set_global_str('@ME_EXIT_MACRO@', 'PVCS^PVCS_CLEANUP');
- Text('{*********************************************}'); CR;
-
- Save_File;
- Return_Str := me_path + 'MEMAC -P' + me_path + ' ' + file_name + ' > ' +
- me_path + user_id + 'SETER.TMP';
- RM('EXEC /CMD=1/SWAP=4/MEM=120');
- IF error_level = 0 THEN
- load_file(me_path + user_id + 'SETER.TMP');
- IF error_level = 0 THEN
- IF search_fwd('ERROR',0) THEN
- RM('MEERROR^MessageBox /B=2/M=Error occurred compiling SETUP.SRC.');
- goto exit;
- END;
- END;
- END;
- RM('MEERROR^MessageBox /M=Your STARTUP macro has been modified to initialize the PVCS support.');
- END;
- EXIT:
- delete_window;
- switch_win_id( old_win );
- END_MACRO;
-