home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
busi
/
smiiutil.zip
/
EDITPROJ.PF2
< prev
next >
Wrap
Text File
|
1990-01-10
|
6KB
|
159 lines
'*****************************************************************************
' FILENAME: EDITPROJ.PF2
'
' Programmer: Pierce D. Nunley
' Updated: A.M. 12/24/89
'
' Notes: Written in PDL (Informix, SmartWare II, Ver. 1.01)
'
' Description: This project will search the current DATAPATH for all
' project files of the current module (*.pf?). It will put
' them in a menu from which they may be selected to edit in
' the Text-Editor. It will save the information of which
' project was last chosen to edit so that it will first
' highlight that file on reexecution of this project while
' in the SAME module and the SAME session.
'
' If an error occurs during compilation, this project will
' reload the file in the Text-Editor and move the cursor to
' the line and space of the error. [This is a very inter-
' esting piece of code for a programmer. This is a good
' example of the power of SmartII PDL]
'
' I have set ^E (EDIT) as a macro that will run this project.
' It is in my default macro load.
'
' I have also put this as a menu option off of my tools
' menu using the SMART.MNU file.
'
' REMEMBER: It will search the current datapath (set by
' Tools Preferences (Module) and Tools Directory
' New-directory).
'
'****************************************************************************
' Copyright Notice
' Copyright (c) May 12, 1989 Pierce Nunley Consulting
' 3921 Bell Ave.
' Kansas City, Missouri 64111
'****************************************************************************
'VARIABLE NAME DECLARATIONS
public $modl $path $modl_name $files $fname $glob_select $select $c_select
public $ln_error $ch_error $q
'****************
MAIN
'****************
'lock these variable for reexecution
lock module $modl $path $modl_name $files $glob_select $c_select
'******************
label top
'******************
if $glob_select < 1 'check to see if editproj has been run this session
$glob_select = 1
$c_select = 1
smartpeek $_modl $modl 'get the current smart module number into $modl
$modl_name = case $modl (0,"Main Menu")(1,"Spreadsheet")(2,"Wordprocessor")\
(3,"Database")(4,"Communications")
end if
'the following keeps the same order of files as long as there have been no
'additions or deletions to the list or directory changes. It insures the
'integrity of the highlighter when the project is re-run
if len(getfnames("*.pf"|str($modl),1)) <> len($files) or $path <> path(datapath)
'** add the following line if you have Norton Utilities, Disk Sort.
'tools os "ds d-t-"
$path = path(datapath)
$files = getfnames("*.pf"|str($modl) ,1)
end if
screen clear box 4 9 21 71 12 1 'print a blue box with red border
screen print 21 11 14 1 " Path = "|$path|" " 'print the path on the box
if len($files) < 3 ' check for no project files in directory
beep
screen print 11 10 12 1 format "M60" "There are no"&$modl_name&"project files in this directory"
inchar
exit
end if
screen print 4 11 14 1 " "|$modl_name&"Project Files - Choose & Press Enter "
screen menu 5 10 20 70 15 1 1 15 $glob_select $files $select
if $select = 0 'checks for ESC out of menu
exit 'quit project
end if
'init $glob_select after checking for ESC maintains highlighter integrity
$glob_select=$select
$fname = group($files,$glob_select) 'convert the menu number to the file name
if not(file($fname)) 'check to see if file is in directory, if not then reread
$glob_select=0
screen clear box 9 15 15 65 9 14
screen print 11 16 12 14 format "M48" "Project File """|$fname|""" not Found"
screen print 13 16 9 14 format "M48" "Press Any Key to Re-Read the Directory"
inchar
clear $files
jump top
end if
clearerror
error off
tools text-editor path(datapath)|$fname
error on
if lerror = 58 'insufficient memory error
beep
screen clear box 1 1 scrheight 80 0 0 no-border
screen clear box 5 15 11 65 14 1
screen print 7 16 12 1 format "M48" "Project File could not fit into memory!"
screen print 9 16 15 1 format "M48" "Press Any Key to Exit"
inchar
exit
end if
'-----------------------
label done_edit
'-----------------------
screen clear box 1 1 scrheight 80 0 0 no-border 'clear total screen to black
screen clear box 5 25 11 55 14 1
screen print 7 26 15 1 format "M28" "Compile Project? (Y/n)"
$q=inchar
if $q <> keyvalue("Esc") and lower(chr($q)) <> "n"
screen menu 9 32 9 48 15 1 0 15 $c_select "No-Debug Debug" $c_select
clearerror
case $c_select
when 0 'checks for ESC out of menu
exit 'quit project
when 1
remember tools compile no-debug $fname
when 2
remember tools compile debug $fname
end case
if lerror > 1 'if there is an error during compilation, the following will:
' 1) find out where the error occured,
' 2) load the file into the text-editor, and
' 3) place the cursor on the line & space of the error
smartpeek $_pfel $ln_error 'line number of project compile error
smartpeek $_pfec $ch_error 'character offset of project compile error
fopen "editproj.mac" as 1 'define our own macro file
fwrite 1 from "#1000 = ""tt"", """|$fname|""", Enter, Alt-G, \
"""|str($ln_error)|""", Enter, repeat, #"|str($ch_error)|", Right"
fclose 1
tools macros load "editproj" 'load our macro file
suspendone command 'suspend to run macro and text-editor
keys lookon, #1000 'run the new macro
jump done_edit 'ask again if the project should be compiled
end if
end if
END MAIN