;COPYRIGHT Hewlett-Packard Company 1987, 1988, 1989, 1990, 1991
;
;This file contains all of the symbols routines because if left in
;   SetUtl.txt file there were too many lines for the Setup Interpreter
;   to handle during Additional Features Setup (AddSetup\) and 
;   we want the files to be identical in all three setups.
; find_symdir
; install_bitmaps
; update_symbol

goto skip_symbol

find_symdir
		       
;This procedure looks for where symbol files should be installed.
;All symbol files should be installed in the same directory.
;For Openview applications, it will look in WIN.INI to find
;out where symbol files should be installed.
;
;Inputs:	 
;  var003 - application source drive
;  var072 - MS Windows WIN.INI disk drive.
;  var073 - MS Windows WIN.INI dir.
;Outputs:
;  var077 - symbol drive
;  var078 - symbol dir
;  var095 - full symbol path (without ending slash)

	onerror gosub floppy_out
	changedrive var003
        cd app_inst

	set find_file var072			;Find Win.ini file.
	strcat find_file var073
	if var073 = "\" goto root_winsym	;Skip if file is at root.
	strcat find_file bslash
root_winsym
	strcat find_file win_ini
	set find_sym null			;Fetch symbols dir from Win.ini.
	envstr find_sym
	run mdini.exe "getlabelinfo" app_hdr app_symdtxt find_file
	if find_sym = null goto helpsym_failed
	if find_sym = null return		:OV doesn't require path.

	mid var077 find_sym 1 2
	mid var078 find_sym 3 62

	set var095 find_sym
	strlen var095 len 
	mid temp var095 len 1
	if temp = "\" sub 1 len
	mid var095 var095 1 len

return	
	
update_symbol

;Takes symbol info supplied by application and updates the symbols file.
;Inputs:
;  var072 - MW Windows win.ini drive.
;  var073 - MS Windows win.ini directory.

 	set var050 app_name1		;Disk 1 must be mounted.
	set var051 app_label1		
	gosub get_volume		;Verify correct volume mounted.
					
	onerror gosub floppy_out
	changedrive var003		;Go to install routines.
	cd\
        cd app_inst		     
	onerror gosub symbol_err 	

	set wini_file var072			;Find Win.ini file.
	strcat wini_file var073
	if var073 = "\" goto root_dir		
	strcat wini_file bslash
root_dir      
	strcat wini_file win_ini
	set var079 symbol_file
						;Get symbol file path.
	set symfile_path null
	envstr symfile_path
	run mdini.exe "getlabelinfo" app_hdr app_symftxt wini_file
	if symfile_path = null goto update_symbol2
	      
	set status 0			;Verify that symbol file exists.	

	mid temp1 symfile_path 1 2	;Strip out drive, directory.
	strlen symbol_file lenf
	strlen symfile_path lenp
	sub lenf lenp
	sub 1 lenp
	mid temp2 symfile_path 1 lenp
	changedrive temp1
	cd \

	set var042 temp2			;Set for default.
	exist symfile_path status	
	if status != 1 goto update_symbol2
	if var032 != null goto update_symbol5	;This release OV doesn't do.
					
	onerror gosub floppy_out
	changedrive var003		;Go to install routines.
	cd\
        cd app_inst		     
	onerror gosub symbol_err 	

	print cr cr up_arch3 cr		;Print 'Updating symbol file' msg.
	run symbol.exe "-f" symfile_path -c symbol.inf  
	print cr
		
	goto update_symbol5

update_symbol2				;Symbol file does not exist.
	if var032 = null goto symbol_err2	;App needs installed file.
	exist temp2 status
	if status != 2 goto update_symbol3  
				;Set to directory in Win.ini if exist.
	if symfile_path != null set var042 temp2
	if symfile_path = null goto update_symbol3
	goto update_symbol4

update_symbol3			;Set destination to Symbols path			
	set var042 var095	;  (where bitmaps are).	

update_symbol4			
	set var076 symbol_file
	set var040 cp_arch4 		;Print copying message.
	set var041 app_files_ovw	;Set length of copy bar.
	
	set var043 var003		;Set source path.
	strcat var043 app_app
	strcat var043 app_sym
	set spec_files symbol_file
	
	set var050 app_name1		;Verify correct volume mounted.
	set var051 app_label1		;Set the floppy as the default disk.

	gosub get_volume		;Verify correct volume mounted.
	onerror gosub floppy_out	
	changedrive var003
;A.05	cd \

        cd var043                       ; A.05 cd to source directory
        print cr cr cr var040           ; A.05 print that we are copying
        copy symbol_file var042 status  ; A.05 copy the file
        if status != 1 goto copy_failed ; A.05
        
;A.05	gosub copy_spec_files		;OV copies new file.

update_symbol5
					;Modify AddWin.ini file.
	set var080 app_symftxt 		;Symbols file entry to modify
	set var081 var042 		;path to insert 
	set var082 app_hdr		;section header
	gosub update_addwin
return
	
install_bitmaps
		    
;This procedure copies bitmap files into the symbols directory 

	set var074 var077		
	set var075 var078
	set var076 app_del_file
	gosub delete_files
     					
	set var043 app_app		; set source path
        strcat var043 app_sym

	set var042 var095		; set destination path

	set var076 sym_files		; Message text parameter
	
	onerror gosub floppy_out
	changedrive var003
	cd \

        set var040 cp_arch4
        set var041 app_files_sym
	gosub copyb_files

return

skip_symbol
