home *** CD-ROM | disk | FTP | other *** search
- $MACRO_FILE TLIB;
- {*************************MULTI-EDIT MACRO FILE******************************
- Contains the Burton Systems Software TLIB interface macros.
- To configure Multi-Edit to interface to the TLIB system, place the
- following commands in your STARTUP macro:
-
- {Tell Multi-Edit to utilize the TLIB_GET_FILE macro if a
- FILE NOT FOUND error occurs when the user loads a file.}
- set_global_str('@FNF_LOAD_MACRO@', 'TLIB^TLIB_GET_FILE');
-
- {Setup the TLIB extract command line }
- set_global_str('!TLIB_GET_CMD!', 'TLIB P <PATH> E <NAME>' );
-
- {Setup other TLIB parameters}
- set_global_str('!TLIB_PARMS!', '/LIBEXT=TLB');
-
- {Tell Multi-Edit to call the TLIB_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@', 'TLIB^TLIB_CLEANUP');
-
-
- The macro TLIB_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.
-
- SUGGESTIONS:
- Your TLIB configurations file (default is TLIB.CFG) should contain
- the following statments:
-
- rem Setup library extension overide
- LibExt ?$?
-
- rem Disable all blank/tab conversions
- detabE N
- entabU N
-
- rem Locking is a good idea on networks
- locking Y
-
- rem Setup a user id. Should be the same as your Multi-Edit id.
- id YOU
- rem Or you can use your network id name.
- id *NOVELL*
- rem Or
- id *MACHINE*
-
- rem Log the user into the versions
- loguser Y
-
- rem Log the time into the file
- logtime Y
-
- rem Delete source file after updating
- DeleteSrc Y
-
- rem Preserve significance of file dates as much as possible
- olddate Y
- equaldate Y
-
- TLIB - The main TLIB macro
- TLIB_GET_FILE - Allows retrieval of latest revision of TLIB file
- TLIB_DIR - Displays and allows selection of TLIB log files
- TLIB_CLEANUP - Makes sure user is aware of checked out files
- TLIB_MENU - Main TLIB menu
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO TLIB;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: TLIB
-
- Description: Burton Systems Software TLIB Inteface macro.
-
- Parameters: /C=str Command string
- CHECKOUT check out file
- CHECKIN check file back in
-
- /F=str File name
- /P=str Library path for output files
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_str( cmd[20],
- fname[120],
- lpath[120],
- tstr[120],
- TLIB_name[120],
- switches[40]
- );
-
- def_int( old_win, TLIB_win, initial_rev, checkout_count,
- jx, file_win, check_num, multi_line_comment );
-
- {IF you want multiple line comments for PVCS then set this variable to
- TRUE}
- multi_line_comment := TRUE;
-
- check_num := 0;
-
- cmd := shorten_str(parse_str( '/C=', mparm_str ));
- lpath := parse_str( '/P=', mparm_str );
- fname := parse_str( '/F=', mparm_str );
- IF fname = '' THEN
- fname := file_name;
- ELSE
- fname := fexpand(fname);
- END;
- IF lpath = '' THEN
- lpath := get_path( fname );
- END;
- refresh := false;
-
- old_win := window_id;
- switch_window( window_count );
- create_window;
- window_attr := $81;
- TLIB_win := window_id;
- TLIB_name := me_path + user_id + 'TLIB.TMP';
- IF switch_file( TLIB_name ) THEN
- delete_window;
- END;
- switch_win_id( TLIB_win );
- reg_exp_stat := TRUE;
- ignore_case := TRUE;
- checkout_count := Global_Int('!TLIB_CHECKOUT_COUNT!');
-
- IF cmd = 'CHECKOUT' THEN
- RM('userin^CHECKFILE');
- IF return_int < 1 THEN
- goto exit;
- END;
- make_message('');
- Working;
- return_str := Global_Str('!TLIB_GET_CMD!');
- IF return_str = '' THEN
- return_str := ' E <FILE>.<EXT>';
- END;
- RM( 'XlateCmdLine /F=' + fname );
- gotoxy( message_col, message_row );
- make_message('Retrieving "' + truncate_path(fname) + '"...');
- shell_to_dos( return_str + ' > ' + TLIB_name, TRUE );
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- load_file( TLIB_name );
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- IF NOT(search_fwd('extracted from',0)) THEN
- tof;
- read_only := TRUE;
- RM( 'USERIN^EditWindow /X=5/Y=3/W=65/L=8/T=TLIB ERROR' );
- return_int := 0;
- goto ERROR_exit;
- END;
- goto_col(1);
- fname := get_word(' ');
- right;
- fname := fexpand(get_word(' '));
- right;
- tstr := get_word(' ');
- right;
- tstr := get_word(' ');
- 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('!TLIB_FILE_OUT#' + str(checkout_count), '/F=' + file_name + '/P=' + lpath );
-
- ELSIF cmd = 'CHECKIN' THEN
-
- jx := 1;
- WHILE (jx <= checkout_count) AND
- (Parse_Str('/F=',Global_Str('!TLIB_FILE_OUT#' + str(jx))) <> fname) DO
- ++jx;
- END;
- IF jx <= checkout_count THEN
- check_num := jx;
- lpath := Parse_Str('/P=',Global_Str('!TLIB_FILE_OUT#' + str(jx)));
- END;
-
- IF check_num = 0 THEN
- return_str := lpath;
- RM('USERIN^USERSTR /BL=TLIB: PATH TO SAVE LIBRARY FILE TO/W=70/ML=128/B=1');
- IF return_int = 0 THEN
- goto exit;
- END;
- lpath := return_str;
- END;
-
- initial_rev := (file_exists( get_path( lpath ) + truncate_path(truncate_extension(fname)) + '.TLB') = FALSE);
- IF multi_line_comment THEN
- switch_window( window_count );
- create_window;
- file_name := me_path + user_id + '2TLIB.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=TLIB: DESCRIBE "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' N ';
- ELSE
- RM('USERIN^EDITWINDOW /X=5/Y=5/W=60/L=10/WW=1/RM=58/CC=1/SP=1/T=TLIB: DESCRIBE CHANGES TO "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' U ';
- END;
- save_file;
- delete_window;
- switch_win_id( tlib_win );
- RM('USERIN^VERIFY /T=Check "' + fname + '" into library?');
- ELSE
- Return_Str := '';
- IF initial_rev THEN
- RM('USERIN^USERSTR /BL=TLIB: DESCRIBE "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' N ';
- ELSE
- RM('USERIN^USERSTR /BL=TLIB: DESCRIBE CHANGES TO "' + truncate_path(fname) + '"/W=70/ML=128/B=1');
- switches := ' U ';
- END;
- tstr := return_str;
- IF tstr = '' THEN
- tstr := '.';
- END;
- 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;
- Refresh := TRUE;
- RM('WINDOW^DelWin');
- Refresh := FALSE;
- IF old_win = file_win THEN
- old_win := window_id;
- END;
- END;
-
- IF check_num <> 0 THEN
- return_int := check_num;
- RM('USERIN^DELETEITEM /G=!TLIB_FILE_OUT#/#=' + str(checkout_count) );
- --checkout_count;
- END;
-
- IF lpath <> '' THEN
- lpath := 'P ' + lpath + ' ';
- END;
- switch_win_id( TLIB_win );
- make_message('');
- Working;
- gotoxy( message_col, message_row );
- make_message('Storing "' + truncate_path(fname) + '"...');
- IF NOT( multi_line_comment ) THEN
- shell_to_dos( 'TLIB ' + lpath + switches + fname + ' ' + tstr + ' > ' + TLIB_name, TRUE );
- ELSE
- shell_to_dos( 'TLIB ' + lpath + switches + fname + ' @' + me_path + user_id + '2TLIB.TMP > ' + TLIB_name, TRUE );
- END;
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- load_file( TLIB_name );
- IF error_level <> 0 THEN
- return_int := 0;
- goto ERROR_EXIT;
- END;
- IF (search_fwd('%updated ?* from',0)) THEN
- goto_col(1);
- tstr := get_word(' ');
- right;
- tstr := get_word(' ');
- right;
- fname := get_word(' ');
- right;
- fname := fexpand(get_word(' '));
- return_int := 1;
- make_message( '"' + truncate_path(fname) + '" checked in to "' + tstr + '".');
- ELSIF (search_fwd('created',0)) THEN
- IF file_exists( fname ) THEN
- RM('USERIN^VERIFY /BL=TLIB LIBRARY CREATED/T=Delete "' + fname + '"?');
- IF return_int = 1 THEN
- del_file( fname );
- END;
- END;
- return_int := 1;
- make_message( get_line );
- ELSE
- EOF;
- HOME;
- read_only := TRUE;
- RM( 'USERIN^EditWindow /X=5/Y=3/W=65/L=8/T=TLIB ERROR' );
- read_only := FALSE;
- return_int := 0;
- goto ERROR_exit;
- END;
- END;
- END;
- GOTO EXIT;
-
- ERROR_EXIT:
- make_message('Error occurred during TLIB operation.');
- EXIT:
- refresh := FALSE;
- IF switch_win_id( TLIB_win ) THEN
- delete_window;
- END;
- switch_win_id( old_win );
- EXIT2:
- set_global_int('!TLIB_CHECKOUT_COUNT!', checkout_count );
- END_MACRO;
-
- $MACRO TLIB_GET_FILE;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: TLIB_GET_FILE
-
- Description: Called from the LDFILES macro if the file was not found. This
- will search for a TLIB log file, and ask the user if he wants to retrieve
- the latest revision.
-
- Parameters:
- /F= The desired file name
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_str( tstr[120], gstr[20], new_ext[3], old_ext[3] );
- def_int( jx );
-
- tstr := truncate_path(parse_str('/F=',mparm_str));
- old_ext := get_extension( tstr );
- RM( 'FIND_EXT /EXT=.' + old_ext );
- gstr := return_str;
- return_str := parse_str('DIR=',Global_Str(gstr));
- new_ext := parse_str( '/LIBEXT=', global_str('!TLIB_PARMS!') );
- IF new_ext = '' THEN
- new_ext := 'TLB';
- END;
- jx := 1;
- WILD_LOOP:
- jx := xpos( '?', new_ext, jx );
- IF jx <> 0 THEN
- new_ext := Str_Ins( Copy( old_ext, jx, 1), Str_Del( new_ext, jx, 1 ), jx );
- ++jx;
- goto wild_loop;
- END;
-
- RM('PathSearch /F=' + truncate_extension(tstr) + '.' + new_ext );
- IF return_int THEN
- RM('USERIN^VERIFY /BL=TLIB: "' + tstr + '" not found/T=Extract file from "' + return_str + '"?');
- IF return_Int then
- RM('TLIB /C=CHECKOUT/F=' + get_path(return_str) + truncate_path(tstr));
- return_int := 1;
- END;
- ELSE
- return_int := 0;
- END;
- END_MACRO;
-
- $MACRO TLIB_DIR TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: TLIB_DIR
-
- Description: Displays directory listing of TLIB log files. Allows you to
- select a file to be retrieved.
-
- Parameters:
- /BC= Amount of boxes to kill on exit
-
- (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('!TLIB_DIR!')) + '*.TLB' + mparm_str );
- set_global_str('!TLIB_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('TLIB /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 TLIB_CLEANUP TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: TLIB_CLEANUP
-
- Description: Checks to see if there are any checked out files and presents
- a menu giving the user the option to check them back in.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
-
- def_int( checkout_count, jx, old_win );
-
- refresh := false;
- checkout_count := Global_Int('!TLIB_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( Parse_Str('/F=',Global_Str('!TLIB_FILE_OUT#' + str(jx) )));
- down;
- END;
- tof;
- Set_Global_Str('EVTLIB1', '/T=Check files back in/K1=13/K2=28/R=1');
- Set_Global_Str('EVTLIB2', '/T=Exit without checking files in/KC=<SPACE>/K1=32/K2=57/R=2');
- Set_Global_Str('EVTLIB3', '/T=Cancel, don''t exit Multi-Edit/K1=27/K2=1/R=0');
- RM('WMENU /T=TLIB: FILES CHECKED OUT/EV=EVTLIB/EV#=3');
- delete_window;
- switch_win_id( old_win );
- IF return_int = 1 THEN
- jx := checkout_count;
- while jx > 0 DO
- RM('TLIB /C=CHECKIN' + global_str('!TLIB_FILE_OUT#' + str(jx)));
- --jx;
- END;
- END;
- EXIT:
- END_MACRO;
-
-
- $MACRO TLIB_RUN TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: TLIB_RUN
-
- Description: Executes TLIB for interactive use.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
-
- Return_Str := 'TLIB';
- RM('MEUTIL1^EXEC /CMD=1/SWAP=4/SCREEN=2');
- return_int := 100;
-
- END_MACRO;
-
- $MACRO TLIB_MENU TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: TLIB_MENU
-
- Description: Main TLIB menu.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- *****************************************************************************}
-
- def_str( gstr[20] );
- refresh := false;
- gstr := '!TLIB!_';
- Create_Global_Str(gstr+'1','/H=/M=TLIB_DIR');
- Create_Global_Str(gstr+'X1','List log files available for check out');
- Create_Global_Str(gstr+'2','/S=2/M=TLIB /C=CHECKIN');
- Create_Global_Str(gstr+'X2','Put current file into log (check file in)');
- Create_Global_Str(gstr+'3','/S=2/M=TLIB_RUN');
- Create_Global_Str(gstr+'X3','Run TLIB interactively');
- do_xmenu:
- RM('USERIN^SUBMENU /GCLR=1/#=3/M=' + gstr + 'X' + '/S=' +global_str(gstr+'0') +'/L=TLIB INTERFACE MENU/G=' + gstr + MParm_Str);
- END_MACRO;
-
-
- $MACRO TlibInstall TRANS;
- {******************************MULTI-EDIT MACRO******************************
-
- Name: TLIBInstall
-
- Description: Sets up the user's STARTUP.SRC file for TLIB.
-
- (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. TLIB installation not complete.');
- goto exit;
- END;
- END;
- IF search_fwd('Setup for TLIB',0) THEN
- RM('MEERROR^MessageBox /B=1/M=STARTUP.SRC already contains TLIB setup.');
- goto exit;
- END;
- IF search_fwd('END_MACRO;', 0) THEN
- goto_col(1);
- set_indent_level;
- CR;
- up;
- Text('{************** Setup for TLIB ***************}'); CR;
- Text(' {Tell Multi-Edit to utilize the TLIB_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@'', ''TLIB^TLIB_GET_FILE'');'); CR;
- set_global_str('@FNF_LOAD_MACRO@', 'TLIB^TLIB_GET_FILE');
- CR;
- Text(' {Setup the switches to use for checking out a file.'); CR;
- Text(' E is the default switch. }'); CR;
- Text(' set_global_str(''!TLIB_GET_CMD!'', ''TLIB P <PATH> E <NAME>.<EXT> '' );'); CR;
- set_global_str('!TLIB_GET_CMD!', 'TLIB P <PATH> E <NAME>.<EXT> ' );
- CR;
- Text(' {Setup other TLIB parameters}'); CR;
- Text(' set_global_str(''!TLIB_PARMS!'', ''/LIBEXT=TLB'');'); CR;
- set_global_str('!TLIB_PARMS!', '/LIBEXT=TLB');
- CR;
- Text(' {Tell Multi-Edit to call the TLIB_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@'', ''TLIB^TLIB_CLEANUP'');'); CR;
- set_global_str('@ME_EXIT_MACRO@', 'TLIB^TLIB_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 TLIB support.');
- END;
- EXIT:
- delete_window;
- switch_win_id( old_win );
- END_MACRO;
-