Programming Guide |
Reads JPL modules into memory and makes their procedures available to application
publicmoduleName
[moduleName
]...
moduleName
- Specifies the module to read into memory (if necessary), where
moduleName
is a string constant or colon-expanded variable that names a library module or memory-resident module. If Panther cannot findmoduleName
, it issues an error message.Note: If the
public
command is issued in a screen's unnamed procedure andmoduleName
cannot be found, no error message is issued.
The
public
command reads the procedures contained in one or more JPL modules. If the modules are not already memory-resident, public compiles them and puts them in memory, making the contents of the module available to the application as a whole. It also executes the first procedure if it is unnamed. All procedures beginning with aproc
statement are available until the application exits or you remove their module from memory with an unload statement.public
lets you store generic procedures in library modules that are easy to edit and available to any application. For example, these procedures handle user exits:
proc quit
vars ans
ans = sm_message_box \
("Are you ready to quit?", "", SM_MB_YESNO, "")
if ans = SM_IDYES
return 1
else
return 0
proc end
msg emsg 'Program exit.'Given that these procedures are in library module
exit_handler
, you can make them available to the application by entering this public command in the opening screen's unnamed procedure (accessed through the screen's JPL Procedures property):public exit_handlerYou can now call quit from any available application hook, for example, from a control string that is associated with the
EXIT
key:EXIT=^(0=&nextscreen; 1=^end)quitYou can issue the
public
command on a module only once. Panther ignorespublic
commands on a module that is already public.Note: If you test an application that loads a public module, that module remains in memory until you explicitly unload it or Panther exits. If you edit the module after exiting test mode, remember in the next test session to unload the module's earlier version and reload the new one in order to see your changes.
unload