Copyright: ANGOSS Software, 1995


Contents
ANGOSS SmartWare Plus README File 2.65b

This file contains corrections to the manuals and information on items that have been changed since the manuals went to print.

The following topics are discussed:

Windows

*	Printing to Dot Matrix Printers

*	Adjusting the Desktop in Windows95

Microsoft 9.01 Mouse Driver

Artisoft FAX Printer Driver

ANGOSSW and MSWOAC

Multiple use of RAD Applications under Windows

Windows For Workgroups

Swap space in Windows

Video Driver Issues

High Characters Display

SmartWare Window Size

Unable to Open Base Font

No Communications Module on Windows 3.1

Unix

Alt-F5 on X11

Printing in SCO

Functions and Commands

*	CALL Function

*	FILELIST Functions

FOPEN Function

FORMAT Function

*	GET_FILE Function

*	PROCESS_CREATE Function

RAD Functions - Release Notes Corrections

MODULE_CALL and MODULE_RETURN

PASSWORD_CRYPT

RUN_QUERY_STR

Command Menu Interface

SUSPEND Command

SCREEN SAVE Command

Miscellaneous

*	Activity Log in RAD Applications

IBM PS2 Problems

Using SHARE

LANtastic Network Driver

Cross-platform Documents

DDLs in RAD Programs

SmartWare 1.51 Preference Files

Documents with v1.51 Graphs

Converting Older RAD Applications

Font Map

Meta Files for v2.65 DOS Users

*	Fixed in this Version

* Indicates new items.


Adjusting the Desktop in Windows95

If you're installing on a network, you may need to set up your client machines with the ANGOSS programs.  If you're not familiar enough with Windows95 to do this, here are some tips:

To create a new Folder (Group):

Click the right mouse button on Start

Select Open

Open the File menu in the Start Folder

Select New

Select Folder

Type in the new Folder name

To create a new Shortcut (Item):

Open a Folder

Open the File menu in the Folder

Select New

Select Shortcut

Enter the full program name or use the Browse button

Select the Next button

Enter the Shortcut name

Select the Finish button

Properties:

Click the right mouse button on a Shortcut (Item)

Select Properties


Printing to Dot Matrix Printers

Printing labels on some dot matrix printers under Windows, appears to switch into NLQ mode, even though it was not asked to - slow printing.  Actually, the real problem is that the default font (Standard 12pt Normal) is a filled area font.  This is because the driver's default font cannot give us 10cpi (12pt).  To resolve this, use the TOOLS PREFERENCES FONT-MAP NORMAL command and specify the font that should be used when Standard 12pt is selected.  Make sure that the Source is Windows Font (the Source is shown at the bottom of the font options editor).


Communications
No Communications Module on Windows 3.1

Unfortunately, the WIN32S driver does not support 32 bit communications. As a result, the ANGOSS Communications module is not available on Windows 3.1.


Mouse Driver
Microsoft 9.01 Mouse Driver

Problems with WIN32S and Microsoft 9.01 Mouse Driver have been encountered. If, after starting SmartWare, you receive the message "GROWSTUB caused a General Protection Fault in module POINTER.DLL", this is probably the case.

Microsoft has created a patch for the 9.01 mouse driver. This patch has been placed on disk 6 of the ANGOSS SmartWare disk set. To install the patch, execute the self-extracting file, HD1061.EXE, and follow the instructions laid out in the resulting README.TXT file.


Artisoft FAX printer
Artisoft FAX Printer Driver

The Artisoft FAX printer driver cannot be used as a print server with SmartWare.


Video Driver
Video Driver Issues under Windows

In general, there are a number of video problems that can be resolved by either obtaining an updated video driver from your adapters manufacturer, or by switching to a standard VGA or SVGA driver.  The video driver setting can be changed in Mains Windows Setup icon or by running the Windows setup program from DOS.

Possible screen corruption with Orchid video driver with Win32 applications. Obtain a driver with a version higher than 4.1.

Possible problem with the graphics accelerator, Promis S3 2.21. C805. Freecell will not run either.  Use a standard VGA or SVGA drivers instead.


Sharing violation
Multiple use of RAD Applications under Windows

A single user running two copies of the same RAD App under Windows may produce a "Sharing violation". You can continue anyway or, to avoid this problem, do not use duplicate login IDs.


Alt-F5 key
Alt-F5 on X11

The Alt-F5 key cannot be used for popup menus on X11. This because the window manager is dealing with the key stroke and SmartWare never sees it.  Remap the key in the .mwmrc file.


Swap Space
Swap space in Windows

SmartWare may crash if Windows runs out of disk space for its swap file. If this happens, free up disk space. If possible, to ensure the space used for swapping, use a permanent swap file (setting found in the Control Panels 386 Enhanced icon).


High Characters
High Characters Display

SmartWare screen fonts in Windows are the same as the DOS WYSIWYG fonts. The character set between 128 and 255 vary from the DOS character set, therefore, if you are SCREEN PRINTing those characters, your display will be incorrect.  Using some Windows FONTS, such as Terminal, match the DOS character set and will correct the problem.  Ideally, you should use the SPSYMMAP() function to print box characters since this will guarantee portability between DOS, Windows, character Unix and X11.


IBM PS2
IBM PS2 Problems

An "Unexpected interrupt in 000A in OAC.EXE at 0246:0118" error occurs running angoss.exe (16 bit version) on an IBM PS2 model 30 (286) with 2MB RAM.


SHARE
Using SHARE

When using SHARE, use /L: /F: to specify the number of locks and file space (in bytes) for MS DOS. For example:

SHARE /L:100 /F:10240

gives 100 records and 10240 bytes for path and file names of share files.


Windows For Workgroups

SmartWare will not run over a network in Windows For Workgroups, version prior to 3.11. This problem (and others regarding opening too many files) is resolved by upgrading to version 3.11.


Document colors
Cross-platform Documents

Document colors may differ across OS platforms. Use the WINDOW Paint command to change this.


preference files
SmartWare 1.51 Preference Files

There are differences between SmartWare version 1.51 and 2.65 preference (def) files. If you run with 1.51 preference files, Tools Preferences Hardware shows you the original options, but is followed by a FATAL ERROR 316 message on exit. Use current preference files instead.


LANTastic networks
LANtastic Network Driver

For LANTastic networks, use DOS SmartWare's network driver, NET_N46.


SmartWare Window Size

If SmartWare's window appears to wide, either increase the Windows screen resolution (use a SVGA driver) or use a font that's less than 8 pixels wide (8*80 = 640).


Printing in SCO

Problems may occur when printing large documents under SCO Unix. This is because LPPR is in "cooked" mode.  Place LPPR in "raw" mode or use a dumb filter.


PROCESS_CREATE
PROCESS_CREATE Function

This function no longer duplicates the program name in the second parameter.  The Paintbrush example in the manual now looks like:

PROCESS_CREATE(c:\windows\pbrush,c:\windows\cars.bmp)

If the function is successful, PROCESS_CREATE will return a process number otherwise, -1 is returned.  For 16 bit applications in Win32S, 0 always indicates a successful return.


SUSPEND Command

The SUSPEND command always paints command lists regardless if repaint is off. Use SUSPEND ENTRY, KEYS ALT-Z instead.


SCREEN SAVE
SCREEN SAVE Command

SCREEN SAVE stores a portion of the screen in memory.  The bytes size for characters differ: DOS character = 2 bytes, DOS WYSIWYG = 3 bytes, Unix= 4 bytes).  Add approximately 10 bytes for header (varies by system). Use SCR_TEXT instead.

Note that buffer variables created with SCREEN SAVE are not compatible across platforms. For example, if you write this variable to disk from DOS and read it in under Unix, SmartWare may terminate.


FOPEN
FOPEN function

The FOPEN ro_mode works differently between DOS and Unix. In Unix, if you use FOPEN to open a file in ro_mode, you must have write permissions since the file must be locked.  In DOS you can open a file in ro_mode with just read permissions.


FORMAT Function

The function format(0.5,0) in the spreadsheet returns 0 whereas you may be expecting 1. This is NOT a bug.  SmartWare conforms to the IEEE Standard for binary Floating-Point Arithmetic (IEE Std -754-1985) (Sections 4.1 and 5.5). "If the two nearest representable values are equally near, the one with its least significant bit zero shall be delivered."


DDL
DDLs in RAD Programs

There is a new way to specify a DDL in a program.

Function:  ddl_str($type,$pathexp,$lookexp,$destfld,$addcond)

You may need to look at the original .ddl file (which may have been deleted) to figure out the values.  If there are quotation marks in the data use chr(34) to embed them. The parameters are:

$type	 = "1" simple, "2" binary query, "3" file per record

$pathexp = FPR only, path of dest .vw

$lookexp = expresion evaluated on source

$destfld = key field in dest (no brackets)

$add	 = expression evaluated on destination

If you had used $$fct to set the .ddl file, then use:

$$fct=ddl_str("1","","[fld]=a","fld","not(deleted)")

If you use loaddataview(), use "ddl"|ddl_str(....) as the ddl parameter.


mswoac
ANGOSSW and MSWOAC Programs

The ANGOSSW and MSWOAC programs are identical.


Base Font Error
Unable to Open Base Font

Some versions of Windows are unable to use the ANGOSS screen fonts. When this occurs, the message "Error opening base font" occurs. To work around this problem, go to the configure menu and turn Use ANGOSS Screen Fonts off. A good alternative is to use the Terminal font.


Documents with v1.51 Graphs
Loading Documents with Graphs Created in v1.51

We have discovered a minor incompatibility between v1.51 and subsequent versions. The space within the document allocated for a graph was inadvertantly changed, leading to unpredictable results when documents with graphs are transferred. Unfortunately there is no way to automatically convert. If you want to move a 1.51 document with graphics to a later version (or vice versa), load the document with the version that created it (i.e.,1.51), remove the graphics, and save. Load the document into the target version (i.e.,2.65) and re insert the graphs.


RAD Conversion
Converting RAD 2.5x and 2.61 Applications

In addition to the changes made to the underlying structure of RAD menus (discussed in the Release Notes), the RAD App start up procedure has been simplified.  Developers should be aware of the following changes:

ANGOSS.CFG File

The $$adev and $$syspath variables, when set in the angoss.cfg file, should only be used as override mechanisms. As a result, these variables should be removed from the CFG file if that file was created prior to version 2.65.

DOS Start Up Batch File

Due to the new RAD startup parameter for SmartWare, this file has a simplified structure. While your original batch file should work, you may need to remove the reference to the ANGIIDVR variable.

You may want to consider replacing the file altogether. One way to do this is to create a temporary system with Makenew (make sure to create a DOS script), save the original batch file and replace it with the one just created. You will then need to edit the new file by changing the temporary system's path references -- there should be two of them -- to the original system's path.  For example, the following line fragments:

if not exist C:\TMP\system\users\

angossx -RADC:\TMP -omC:\ANGOSS\

would become,

if not exist C:\ORGSYS\system\users\

angossx -RADC:\ORGSYS -omC:\ANGOSS\

START.PF3 and LOGIN.PF3

If you have customized these files, you should replace them with the corresponding PF3 files found in the ANGOSS\APSYS\DEV directory. You must then manually add your previous customization work and re-compile them.

Menu Modes

Menu mode 6 defaults to using the graphical menu mode.  If this is not possible, the application automatically switches to mode 3.

To change to this new mode, edit the ANGOSS.CFG file in the home directory of the system and change the line that begins with ##mmod to specify mode 6.

##mmod	Menu display mode	N	6


Font Map
Tools Preferences Font-Map

This maps the Standard font options (normal, condensed, compressed, and expanded) to specified fonts. Remapping the Standard font options allows you to specify the same sized fonts across different printers and platforms. For example, if a table report uses the Standard font with the compressed option, the report may work fine on one printer but not on another. To solve this problem, remap the compressed option for that printer.

Application programmers should note that, to ensure portability of applications, use only the Standard font in printable objects such as reports.  In this way, when a different set of fonts is required, only the font-map will need adjustment.

Font-Map information is stored in the fontmap.def file. A record is entered for each printer that contains a font mapping. This means that you must first select the printer before mapping one or all of the Standard font options. If required, repeat this step for each printer on your system.

Note that this command can also be issued through SPL. In this case the keyword SET followed by the font string must be added. For instance, to set the Standard font's expanded option to 14 point Courier, the command might look like this:

TOOLS PREFERENCES FONT-MAP EXPANDED SET "Courier 14Pt."


metafiles
Metafiles for v2.65 DOS Users

If you are installing the patch to the DOS version of SmartWare 2.65, the four previously missing metafiles will be stored in your ANGOSS\RESOURCE\MISC directory.  You can add these metafiles with the Tools Resource Modify System (or Local) set of commands in the main module. The metafiles fall into the miscellaneous catagory.


RAD Functions
RAD Functions - Release Notes Corrections

The Release Notes indicate that the deleted function EDIT_FIELDS can be found in $$advr|"edfld" if required.  It is actually found in $$advr|"oldlib".  As well, the function COMMANDLIST cannot be found in $$advr|"oldlib" but is, in fact, still maintained in the RAD shell.  However, COMMANDLIST is no longer recommended - its replacement, the CMENU_ functions are discussed in this section under the title Command Menu Interface.  The CMENU_ functions are actually an interface to the GETCOM function that is listed in the Release Notes. The remaining new functions listed in the Release Notes (MODULE_CALL, PASSWORD_CRYPT, and RUN_QUERY_STR) are also discussed in this section.

MODULE_CALL()

MODULE_RETURN()

These two functions are used to call a project in another SmartWare module when running a RAD application.  They do all the work necessary to save and restore the current application position.

The syntax for MODULE_CALL is:

MODULE_CALL(#module,$project_file)

The parameters are:

#module - 1=SS, 2=WP, 3=DB, 4=CM, (-1=special)

$project - text string which is path and filename to execute when at the destination module (required)

If #module = -1 then the caller is to do the actual module change.  (e.g., using the send command.)  If -1 is used, the caller must execute the project $$advr|"ppmodch.rf3", which in turn executes the project specified by $project_file.

Return values are:

0 = Fail

1 = If #module=-1 and successful.

Doesn't return if 1<=#module<=4 and successful

MODULE_RETURN()

The MODULE_RETURN() function is only used after MODULE_CALL().  It requires no parameters.  When called, it returns to running the application at the point that MODULE_CALL() was issued.

PASSWORD_CRYPT($pass_word)

This function is just like password() except the $pass_word parameter is a string encrypted with the CRYPT() function.

RUN_QUERY_STR($name,$query,#mess_hnd)

This function runs a query specified by the $query string variable.  It avoids the need for separate query files and makes code more readable by embedding query statements in project file.

The parameters are:

$name  -file name of index that is generated (do not supply path or extension) path will be $$workdir, ext=.idx

$query  -a string containing the logical expression of query

Use \n for new line

Use \' for double quotes (see example)

#mess_hnd  -file handle of an already open text file for messages. 0 if none. if >0, the query name and expression is written when executed for tracing purposes

Return values:

-if successful, the number of records selected

-if error occured, 0 means error was caused internally by the RUN_QUERY_STR() function, otherwise a negative value indicates a SmartWare error number (multiply this by -1 to get the real number).

Examples:

run_query("dept","[Department]=\'A\'",0)

$dept = "A"

run_query("dept","[Department=\'"|$dept|"\'",0)

Command Menu Interface (COMMANDLIST replacement)

A series of SPL functions have been written to simplify the interface to the pulldown menus and as an improved alternative to the old commandlist() function.  These functions allow developers to quickly specify and run pulldown menus or command lists.

Note: If you are not using these commands from within RAD, you must load the RAD libraries by executing the following line before using these functions:

execute path(systpath)|"loadalib.rf0" in-memory

Constructing a menu.

The functions dicussed here allow you to quickly build a menu.  In essence, they are a simplified alternative to the mnu_open() and mnu_insch() functions.  Note that these functions are written in SPL and, in fact, use the mnu_ functions.

cmenu_init()

This function starts a new menu.  It returns 0 for fail, 1 for success.

cmenu_add($desc,$act,$linehelp,$helpfile)

Adds an item to menu being built.  The following parameters are used.

$desc -Command description.  Use -> to specify levels.  For example "File->Exit" creates a command named exit under a submenu named file.

$act -Command action.  A string that can be used to identify the choice.  If left blank then the description of the choice is returned.

$linehelp -The autohelp line for the current choice

$helpfile -The base file name of the file containing help text for this command.

cmenu_makemnu()

This function builds a menu (using mnu_info() related functions) based on the information previously provided with cmenu_add().

It returns a menu handle or 0 if a failure occurred.

cmenu_free(#menu)

Frees the memory used by a menu file.  (It is the same as mnu_free().

Running a menu

The cmenu_run() function displays a menu and responds to the end user.  The menu can be built with the above listed cmenu functions or with the mnu_info() related functions.  For a "quick and dirty" menu, the menu choices can also be passed as a text string.  Here is the format of cmenu_run()

cmenu_run(#menu,#nav,$key_cb,$com_cb,$h_pth,$h_ext,$#data)

The parameters are:

#menu -The menu handle or a space seperated text string listing commands.

#nav -Navigation keys.  If it is set to 1, then the end user may use the mouse or keystrokes to move around the database, spreadsheet or document. Otherwise, use 0.

$key_cb -Keystroke call back function.  If you want your own function to respond to mouse events, keystrokes, etc. then list the name of the public function to deal with these events. See below for more details.  If you do not want to use it, simply enter "".

$com_cb -Command call back function.  It is best if you specify a function that will be called when a command is selected.  This way, the processing overhead to set up the menu only need be run when the menu is entered.  See below for details.  If you do not specify this parameter (i.e., enter ""), then cmenu_run() will terminate when the user selects a choice, returning the action (or description) of the choice selected.

$h_pth -Help path.  This must be a directory name which contains help files for the menu.

$h_ext -Help file extension.  This is the three character file extension that the help files for this menu will have.  When a user requests a help file the path ($h_pth), file name (from cmenu_add()) and the extension ($h_ext) are combined to calculate the file to display.

$#data -This parameter is passed to the call back functions.  You may use it however you want. if more than one data element is required, consider using an array pointer.

If you are running in character mode, (##pulldowns=0) then a command list will be used.  A command list is a ring style menu occupying the bottom portion of the text window.  If you are running in graphics mode, (##pulldowns=1), then pulldown menus, which sit above the text window, are used.

Command Call Back Function

The command call back function, which is passed as an arguement to cmenu_run(), is called when the end user selects a command.  You must write this function yourself.  It must be a public function and it must have the following arguements:

function my_callback($act,$#data,#menu,#choice)

$act -This is the "action" of the menu choice selected as specified by the cmenu_add() or MNU_ACT.  Typically, your function will branch based on this value.

$#data -This is whatever was passed to cmenu_run().

#menu

#choice -The #menu and #choice parameters are usually not used.  They can be used to further enquire about the menu choice selected.  For instance the password, help file, object, etc. can be obtained by passing these choices to mnu_info().

The command call back function should usually return 0.  If it returns a value other than 0, cmenu_run() will terminate, returning the same value that you returned.  So, when the user selects a choice that should terminate the menu, return a value other than 0.

Key Call Back Function

When a key call back function is specified in cmenu_run(), each time the user presses a key or uses the mouse this function is called.  As usual, the call back function must be public.  The key call back function requires this format:

function my_callback(#key,$#data,#menu)

#key -Is the event id as returned by the EVENTINFO function.

$#data -This is whatever was passed to cmenu_run().

#menu -The #menu and #choice parameters are usually not used but can be used by mnu_info() to obtain more information about the current menu.

The key call back function must return 0 if the event was not handled, 1 if the event was handled and 2 if you want the menu to terminate.

Examples

Each program usinf the cmenu functions must include the following declarations:

' Menu Building

external cmenu_init()

external cmenu_add()

external cmenu_makemnu()

external cmenu_free()

' Menu Run

external cmenu_run()

global simple()

global very_simple()

global still_simple()

global complex()

' If you are not using RAD, the functions must be loaded by:

execute path(syspath)|"loadalib.rf0" in-memory

' VERY SIMPLE EXAMPLE

function very_simple()

local $ret

$ret =  cmenu_run("Run Exit Copy Delete", 0, "","","","","")

' Call a command menu with above commands, no data base navigation

case $ret

when "Run"

message $ret

when "Exit"

message $ret

when "Copy"

message $ret

when "Delete"

message $ret

otherwise

message "huh:"|str($ret)

end case

end function

' SIMPLE EXAMPLE

function simple()

local $ret #menu

' Simple Example

' Build a Menu

if cmenu_init()

cmenu_add("Run","r","","")

cmenu_add("Exit","x","","")

cmenu_add("Copy","c","","")

cmenu_add("Delete","d","","")

#menu = cmenu_makemnu()

$ret = cmenu_run(#menu, 1, "","","","","")

' Call command menu, with buildmenu with navigation

cmenu_free(#menu)

case lower($ret)

when "r"

message $ret

when "x"

message $ret

when "c"

message $ret

when "d"

message $ret

otherwise

message "huh:"|str($ret)

end case

end if

end function

' AN ADVANCED EXAMPLE

public my_commands()

public $mydir

function still_simple()

local #menu $ret

$mydir = ""

if cmenu_init()

cmenu_add("File->Run","run","run a program","run")

cmenu_add("File->Exit","x","quit this program","quit")

cmenu_add("File->Whatever","what","quit this program","quit")

cmenu_add("Edit->Copy","cpy","copy something","cpy")

cmenu_add("Edit->Delete","del","delete something","del")

#menu = cmenu_makemnu()

$ret = cmenu_run(#menu,1,"","my_commands",$mydir,"txt","")

cmenu_free(#menu)

end if

end function

' 0=continue, anything else exit

function my_commands($action,$data,#menu,#choice)

case $action

when "run"

message $action

when "cpy"

message $action

when "x"

message $action

return 1 ' This terminates menu

when "del"

message $action

when "what"

message $action

otherwise

message "action:"|$action

end case

return 0

end function

' COMPLEX EXAMPLE

public my_keys()

' Also uses my_commands from previous example

function complex()

local #menu $ret

$mydir = ""

if cmenu_init()

cmenu_add("File->Run","run","run a program","run")

cmenu_add("File->Exit","x","quit this program","quit")

cmenu_add("Edit->Copy","cpy","copy something","cpy")

cmenu_add("Edit->Delete","del","delete something","del")

cmenu_add("File->Whatever","what","quit this program","quit")

cmenu_add("Data->Find->Name","f name","find name","fn")

cmenu_add("Data->Find->Phone","f phone","find phone","fp")

cmenu_add("Data->Order->Name","o phone","order name","on")

cmenu_add("Data->Order->Phone","o phone","order phone","op")

#menu = cmenu_makemnu()

$ret = cmenu_run(#menu,1,"my_keys","my_commands",$mydir,"txt","Hi There")

cmenu_free(#menu)

end if

end function

function my_keys(#key,$data,#mnu)

case #key

when {Alt-H}

message $data

return 1 ' Thank you, I have dealt with event

when {Alt-Q}

message "bye alt-q"

return 2 ' Let's get out of menu

when {f10}

message "bye f10"

return 2 ' Let's get out of menu

when {esc}

message "bye esc"

return 2 ' Let's get out of menu

end case

return 0 ' I don't know about this event

end function


Activity Log in RAD Applications

Applications generated in RAD versions prior to v265b created an activity log where the date field was a number.  If you import with this scenerio, the date field is lost - use the Developer System to change the field type from a number to a date field type.


CALL Function

The CALL function executes and SPL function:

CALL

Format: CALL( text, <,txt/num> <,txt/num> <,...> )

OS: All

Scope: All

Returns: Conditional

CALL executes an SPL public function.  This function's name is specified in the first parameter.  The remaining parameters are actually the parameters passed to the public function - note that these must match the number of parameters expected by that function.  Failure to do so will cause a run-time error.

CALL( "FunctionName", "parameter1", ... )

As an alternative, INDIRECT can be used to execute SPL public functions.  Additionally, INDIRECT executes SmartWare functions - CALL does not.  CALL's advantages, however, are: the "function call" is not built as a string and, pointers can be used in its parameters. Compare the follow lines of code:

INDIRECT( "Msg(" & CHR(34)|"Hello World"|CHR(34) & ")" )

CALL( "Msg", "Hello World" )

If CALL fails, 0 is returned (e.g., an invalid number of parameters was passed).  Otherwise, output from the public function is returned.

Example:

This simple example requires two programs.  The first program, containing the public function, is loaded in memory.  The second program, when executed, calls the public function and passes it a string and a number.  Msg() then prints both values on the screen and returns "OK".

'****** LOADED PROGRAM ******

PUBLIC Msg()

FUNCTION Msg( $string, #number )

MESSAGE $string & STR(#number)

RETURN "OK"

END FUNCTION

'****** CALLING PROGRAM *****

MAIN

LOCAL $return

$return = CALL( "Msg", "Hello World", 1234 )

MESSAGE "Msg return:" & $return

END MAIN


FILELIST Functions

The following three functions are used to return file names:

FILELIST_OPEN

Format: FILELIST_OPEN( text, numeric )

OS: ALL

Returns: text

This initiates a file list and returns the first filematching the file spec.

FILELIST_OPEN( $filespec, #directories )

The first parameter indicates the file spec.  Path and wild card characters can be included.  For example, when "*.txt" is passed, this function opens a file list on the current directory and filters out any file that does not have a "txt" extension.

Directories are included in the file list when the second parameter is set to TRUE (1).

If no files or directories are found, a null string ("") is returned.  Otherwise, the first matching file or directory name is returned.

To get the next name, use FILELIST_NEXT.

Except when a null string is returned (no files or directories found), the SPL program must eventually close the list with the FILELIST_CLOSE function.

Example:

The example code opens a file list and returns the first file matching the "*.txt" file spec in the current directory.  A WHILE loop is then started.  If no files or directories are found, the loop is aborted.  If a file is found, its name is displayed, a close flag is set, and the next file is returned.  This continues until FILELIST_NEXT returns a null string (no more files found).  Finally, if the close flag is set, FILELIST_CLOSE is called.

MAIN

LOCAL $file #close

$file = FILELIST_OPEN( "*.txt", 2 )

WHILE $file <> ""

MESSAGE $file

#close = 1

$file = FILELIST_NEXT

END WHILE

IF #close

FILELIST_CLOSE

END IF

END MAIN

Notes:

Multiple file lists can be opened.  Because FILELIST_OPEN uses a stack, it can be called again before a FILELIST_CLOSE is issued.  This has the effect of leaving the previous list open and making the new list current - useful when climbing up and down directory structures.  When the new list is closed, the previous list becomes active and FILELIST_NEXT continues to operate where it left off.  The maximum number of open lists is 100.

Lists must eventually be closed.  If repeatedly left open, errors will occur and SmartWare will not be able to find files.

If FILELIST_OPEN does not return a file or directory name, FILELIST_CLOSE should not be called.  In this case, no list is actually opened and FILELIST_CLOSE may, inadvertently, close the current list.

The file list functions do not employ a user interface.  Use FILEPROMPT for that task.

See also FILELIST_NEXT and FILELIST_CLOSE.

FILELIST_NEXT

Format: FILELIST_NEXT

OS: ALL

Returns: text

This returns the next file or directory name in an opened file list.  When FILELIST_NEXT returns a null string (""), no more files or directories exist in the list.

For details on using file lists, refer to the FILELIST_OPEN function.

FILELIST_CLOSE

Format: FILELIST_CLOSE

OS: ALL

Returns: 0

This closes an open file list.  For every successful call to FILELIST_OPEN, a close must be issued.  Failure to do so will cause errors and SmartWare will not be able to find files.

For details on using file lists, refer to the FILELIST_OPEN function.


GET_FILE Function

This is a RAD function, used to load views.

GET_FILE

Format: get_file($pth,$vw,$typ,#cur,#excl,#retry,#hnd,#ind)

Module: database

Return: result string

This RAD function loads the specified view or makes it current if the view is already loaded.  This last action assumes that the #cur parameter is set - see below.

Parameters:

$pth    The path of the view.  If its value is a null string, the path is determined by the RAD application's internal data (i.e., dv_info).

NOTE: If the view is already loaded, the path parameter is ignored.  In cases where the application uses multiple views with the samename, it is safer to unload the view and callGET_FILE again - see the Return Strings section below.

If the path parameter is a view name prefixed with a question mark (e.g., "?customer"), GET_FILE will find that view's path (again in dv_info) and use it.  Typically, this is done when loading a standard-view that is normally attached to a custom-view but does not share the same name.

$vw     The view name.  Do not include the path or extension.

$typ    Indicates the type as custom-view or standard-view.  Valid options for this parameter are "vw" for custom-view and "vws" for standard-view.

#cur    Makes the view current.  Valid options for this parameter are 1 (view is current) and 0 (view is active).

#excl   Loads the view as exclusive - this prevents other users from loading the file.  Note that the #cur parameter must be true (1).

NOTE: If the view is already loaded but is not exclusive, unload it before calling GET_FILE again, otherwise the view will not be reloaded - see the Return Strings section below.

#retry  Number of load attempts.  If this parameter is set to 0, the program is interrupted and the user is prompted to retry or abort the load attempt.  A value greater than 0 indicates the number of uninterrupted retries.  In this case, after each failed load attempt, the function pauses before retrying.  This pause is increased by one minute per attempt (e.g., after the ninth attempt, the function waits nine minutes before retrying).

#hnd    Message file handle.  When this parameter is greater than 1, messages are written to the opened file represented by the handle.  The program will not be interrupted when errors occur.  Typically, this is used in an AUDITED PROGRAM where the standard handle passed to GET_FILE is ##mhnd. Messages are then written to the Batch Update/ Process Log.  When the handle is set to 0, error messages are displayed on the screen while the program waits for user input.

#ind    Indentation level for messages.

Return Strings:

"error"	Unable to load the view.

"loaded"	GET_FILE loaded the view.

"already loaded"	View was previously loaded.

Example 1:

The code fragment below loads the view, if it is not already loaded, and makes it current.  Exclusive mode is not invoked, load retries are prompted, and error messages are displayed on the screen.  For more advanced usage, refer to the second example.

FUNCTION Init()

LOCAL $view

$view = "customer"

IF get_file("",$view,"vw",1,0,0,0,0) == "error"

RETURN 0

END IF

... other initiation code

RETURN 1

END FUNCTION

Example 2:

The code fragment below was extracted from an AUDITED PROGRAM.  It loads the inventory custom-view exclusively. In case of loading errors, six attempts will be made to retry the load.

Note that, because the view must be loaded exclusively, an unload is performed if GET_FILE returns "already loaded". The WHILE loop then causes a reload.

FUNCTION UpdateInventory()

LOCAL $view $result

$view = "inventry"

WHILE TRUE

$result = get_file("",$view,"vw",1,1,6,##mhnd,2)

IF $result == "already loaded"

FILE UNLOAD VIEW $view|".vw"

ELSE

EXIT WHILE

END IF

END WHILE

IF $result == "error"

rec_message( "Could not load" & $view )

rec_message( "* Critical view - Batch aborted" )

RETURN 0

END IF

... code to update view

RETURN 1

END FUNCTION

Notes:

While GET_FILE can be used to load views in any program, it has a number of features that make it valuable in Batch Processing programs where the program runs unattended.  The message and load retry facilities are ideal in that, no program interruption is required.  Further, the exclusive loading mode eliminates potential LOCK RECORD problems and other update record issues.


Fixed in this Version

Ref# Description

---- ------------------------------------------------------------------

1576 WYSIWYG text driver, help text display is italics.

2438 Sometimes crashes during a move in the custom-view editor.

2652 8 lines per inch printing in draft in SS module.

2661 Documentation generator always selects all choices.

2670 Screen painting and general performance with second instance in Win95 & NT is very slow.

2709 Due to a bug in the MicroSoft Windows math libraries, a number to the power of 0, returns 0 but s/b 1 - PC's with no coprocessor.

2710 Print current record only, prints wrong record - PC's with no coprocessor.

2736 Docgen produces "Invalid index to array" when there is more than one language.

2749 ROUND(0,0) shows 0.00e+000.

2767 Tools Zap asks whether you want to zap a file, even though "no" was selected on the initial screen.

2771 Problems printing with latest 550c driver

2772 Modify Document Information sometimes causes an error.

2781 GRAPHICS BMPLIB READ confuses file names.

2782 The graphics menu (menu6) sometimes displays the wrong icon.

2783 Insert Procedure/Job Stream appears twice.

2817 REALPTR under Windows gives error "Command not valid in Unix" - s/b "Command only valid in DOS".

2824 Most Help buttons on Insert Dialogs are broken.

2844 Minor problems with makenew.

2845 All Tools, "File-FIx, Krunch etc." commands in "File Structure Maintenace" have a bug which causes all db's to be selected.

2855 Ruler is inaccurate in Windows.

2859 Printing to disk goes to the printer.

2890 CA (Change Application) does not work.

2895 Using ##mmod=6 and ##pulldowns=0 causes double autohelp when a dataview is selected.

2904 ARRAYFIND and ARRAYSORT comsume memory.

2907 Substituion of DB in Edit Links complains that files do not match when they do.

2912 12x24 Font the underscore (_) shows as a blank.

2933 Table on Info Set view shows up as black on black in update mode.

2935 Toolbar does not show when ##mmod=6 and ##pulldowns = 0.

2940 DDE server not accepting multiple requests.

2992 Insufficient Memory printing from SS in DOS & Unix.

2997 Rounding with FORMAT errors.

3029 The color of the cursor of a table was black on black instead of default.

3061 Problems running and executing RAD reports.

3106 Could not move a block using pulldown menus.

3108 Pulldowns: The Layout jsutify center command caused an "Invalid action" message.

3109 Layout Lines Edit caused invalid action.

3110 Send (using command list menus) from WP or SS caused errors.

3114 Install program under Win95 asks to install Win32s.

3122 Glitches with file prompter on Windows 95.

3133 LGraphic, DingBat, fonts do not show under Windows (SS & WP).

3137 Invalid Row/Col Coordinates error occurs in RAD reports.

3138 Report object that does not exist in rp_exec() call gives misleading message.

3153 Spacing differences between DRAFT & ENHANCED printing.

3154 PROCESS_CREATE doesn't work with 16bit applications under NT & Win95.

3174 Filled Area Fonts in header or report are printed incorrectly.

3194 Problems occurred with a large number of menus in a RAD App - adding user modes, converting, changing colors, etc.

3195 Various problems printing lines and shading.

3209 PFB (Project file beautifier caused - out of file handles) on some networked configurations.

3210 Problems occurred inserting/modifying graphs into a RAD application (SS).

3211 Displaying graphics from RAD app (SS) left stuff at bottom of screen.

3212 If a library was bound to an SS menu, which was called directly the DB, an error loading library occuured.

3213 A couple of minor bugs were fixed in Lint.