|
PRAGMA PROGRAM REFERENCE MANUAL
|
Index
|
All Operation
|
|
Expand All ADDENDUM
|
SYSTEM CALL
|
SC
|
Standard Verb
|
Operating System Operation
|
Target = EXTERNAL ECHO
|
Used to perform any operating system command from within PRAGMA. When the command has finished executing, PRAGMA will resume where it left off in the current verb. Prior to executing a SYSTEM CALL command, all open files are closed. Upon resumption, all files are reopened. Careful. During the execution of a SYSTEM CALL the cursor position and screen attributes may get lost.
|
SYSTEM CALL command OPERATING SYSTEM COMMAND OPERATING SYSTEM COMMAND is a command for the operating system to execute. It has the same syntax as if you had typed it from the command line prompt.
|
SEE ALSO: CLOSE ALL FILES
|
SYSTEM CALL (SC)
SYSTEM CALL lets you perform any operating system command from within PRAGMA. When the command has finished executing, PRAGMA will resume where it left off in the current verb.
SYSTEM CALL takes one parameter. This parameter is expected to be a command for the operating system to execute, just as if you had typed the same command from the command line prompt.
Prior to executing the system call command, PRAGMA closes all open files. This includes all user PFM files, all Btrieve files, PRVOCAB.PFM, PRMSG.PFM and PRSTD.PFM. The printer and communications files/ports are also closed. Upon resumption of the verb after the system call is complete, PRAGMA reopens PRVOCAB.PFM, PRMSG.PFM, PRSTD.PFM, and the printer and communications files/ports. The other PFM and Btrieve files in use will not be reopened unless they are used again.
Be aware that when closing all files the THIS pointer of all the files will be lost. For instance, you cannot get a record of a file, do a system call and then save the modified record. PRAGMA will have lost the information of which record you wanted to update. Yet it is essential that PRAGMA closes all files before doing a system call. The program that you may invoke with the system call may crash and the closed PRAGMA files ensure that they will not be corrupted.
It is also important to realize that when performing work outside of PRAGMA's control, as a system call does, PRAGMA may lose track of the screen (cursor position, attributes, colors) if the system call command changes them, or displays data to the screen. The SYSTEM CALL verb will perform a read of the cursor position (which does NOT affect the nouns CURSOR ROW and CURSOR COLUMN) when it returns from the system call so that PRAGMA may know if the cursor has been moved. However, this depends upon whether the screen being used has the ability to report its cursor position, and this may not always be the case. For this reason the best course of action after a system call is to set the attribute, colors and cursor position again.
Under DOS, where the available memory is a scarce commodity, you may not always be able to run large programs with a system call. DOS will simply refuse to load the program with a not enough memory message, exit, and you will be back in PRAGMA. The DOS error message will have flashed by very quickly and you will be left wondering what has happened. If you suspect that this is happening to you, run the system call example shown below to see how much memory you have left.
When doing a system call under DOS, the 386 version of PRAGMA keeps only very little memory for itself, about 40K. Sometimes in DOS you will need to free as much lower memory as possible when making a system call. To do this place as much of DOS and other programs (e.g., network programs) as you can into upper memory. Version 5 of DOS gives you this option. If your system calls do not use much lower memory, it is better not to place DOS or other programs high, but to leave the extended memory free for PRAGMA. Luckily these concerns do not apply for UNIX or OS/2.
The status of the system call operation is placed into the noun EXTERNAL ECHO. This status is a number; 0 means all is OK. However, this is also an operating system dependent issue. DOS, for instance, always returns a zero status, even if the command does not execute. A non zero status is only returned from DOS if it cannot find COMMAND.COM.
Whenever PRAGMA does a system call, the lines System Call Started and System Call ended are added to the PRAGMA.LOG file. Since a system call closes all PRAGMA files, it is the equivalent of an orderly shutdown. The log entry reflects this and will let you know if a crash occurs while doing a system call.
EXAMPLES
To check the amount of free memory under DOS you can run the following verb:
VERB called TEST SYSTEM CALL
1 SYSTEM CALL command "MEM" 2 INPUT KEY into the noun KEY
The input in line 2 is necessary to stop PRAGMA from going back to the START prompt and erasing the display of the available memory.
You must always be aware that most system calls are operating system dependent. So if you want to list all the files that are in the directory where PRAGMA is running, and you want to be able to do this for every operating system PRAGMA supports, you would do something like this:
VERB called DISPLAY DIRECTORY
1 IF the value OPERATING SYSTEM NAME "=" the value "UNIX" do 2 COPY the value "l" to the noun LIST COMMAND else 3 COPY the value "DIR" to the noun LIST COMMAND end 4 SYSTEM CALL command LIST COMMAND 5 INPUT KEY into the noun KEY
Luckily the listing command "DIR" works both for DOS and OS/2, otherwise we would have had to also test whether the operating system was DOS or OS/2. The example also shows that the command for the system call can, of course, also be copied to a noun.
|
|
|
CustomWare® is a registered trademark of CustomWare Designs, Inc. All rights reserved.
CustomWare® is a registered servicemark of CustomWare Designs, Inc. All rights reserved.
All images and designs on this web site are copyrighted© 2021.
v
t
|
|