#include <LocalMacroSpaceManager.hpp>
Public Member Functions | |
LocalMacroSpaceManager () | |
RexxReturnCode | loadMacroSpace (const char *target) |
RexxReturnCode | loadMacroSpace (const char *target, const char **nameList, size_t nameCount) |
RexxReturnCode | saveMacroSpace (const char *target) |
RexxReturnCode | queryMacro (const char *target, size_t *pos) |
RexxReturnCode | reorderMacro (const char *target, size_t pos) |
RexxReturnCode | getMacro (const char *target, RXSTRING &image) |
RexxReturnCode | saveMacroSpace (const char *target, const char **names, size_t count) |
RexxReturnCode | clearMacroSpace () |
RexxReturnCode | removeMacro (const char *name) |
RexxReturnCode | addMacroFromFile (const char *name, const char *sourceFile, size_t position) |
RexxReturnCode | addMacro (const char *name, ManagedRxstring &imageData, size_t position) |
void | translateRexxProgram (const char *sourcefile, ManagedRxstring &imageData) |
void | readRxstringFromFile (SysFile *file, ManagedRxstring &target, size_t size) |
RexxReturnCode | mapReturnResult (ServiceMessage &m) |
virtual RexxReturnCode | processServiceException (ServiceException *e) |
Public Member Functions inherited from LocalAPISubsystem | |
virtual | ~LocalAPISubsystem () |
virtual void | initializeLocal (LocalAPIManager *a) |
virtual void | terminateProcess () |
Additional Inherited Members | |
Protected Attributes inherited from LocalAPISubsystem | |
LocalAPIManager * | apiManager |
Definition at line 166 of file LocalMacroSpaceManager.hpp.
LocalMacroSpaceManager::LocalMacroSpaceManager | ( | ) |
Definition at line 275 of file LocalMacroSpaceManager.cpp.
RexxReturnCode LocalMacroSpaceManager::addMacro | ( | const char * | name, |
ManagedRxstring & | imageData, | ||
size_t | position | ||
) |
Add a macro from image data into the macrospace.
name | The name of the macro. |
imageData | The source image data |
position | The search order position. |
Definition at line 569 of file LocalMacroSpaceManager.cpp.
References ADD_MACRO, MacroSpaceManager, mapReturnResult(), ServiceMessage::parameter1, ServiceMessage::parameter2, ClientMessage::send(), ServiceMessage::setMessageData(), Rxstring::strlength, and Rxstring::strptr.
Referenced by addMacroFromFile().
RexxReturnCode LocalMacroSpaceManager::addMacroFromFile | ( | const char * | name, |
const char * | sourceFile, | ||
size_t | position | ||
) |
Load a macro from a file and store into the macrospace.
name | The name of the macro. |
sourceFile | The target source file. |
position | The macro search position. |
Definition at line 552 of file LocalMacroSpaceManager.cpp.
References addMacro(), and translateRexxProgram().
RexxReturnCode LocalMacroSpaceManager::clearMacroSpace | ( | ) |
Clear all macros from the macro space.
Definition at line 493 of file LocalMacroSpaceManager.cpp.
References CLEAR_MACRO_SPACE, MacroSpaceManager, mapReturnResult(), and ClientMessage::send().
RexxReturnCode LocalMacroSpaceManager::getMacro | ( | const char * | target, |
RXSTRING & | image | ||
) |
Retrieve a macro from the daemon server.
target | The target macro name. |
image | The returned image data. |
Definition at line 423 of file LocalMacroSpaceManager.cpp.
References GET_MACRO_IMAGE, MacroSpaceManager, mapReturnResult(), RXMACRO_OK, ClientMessage::send(), and ServiceMessage::transferMessageData().
RexxReturnCode LocalMacroSpaceManager::loadMacroSpace | ( | const char * | target | ) |
Load a macrospace file into our space.
target | The target file name. |
Definition at line 286 of file LocalMacroSpaceManager.cpp.
References ADD_MACRO, MacroSpaceFile::close(), MacroSpaceDescriptor::MACRONAMESIZE, MacroSpaceManager, MacroSpaceFile::nextMacro(), MacroSpaceFile::openForLoading(), ServiceMessage::parameter1, ServiceMessage::parameter2, RXMACRO_OK, ClientMessage::send(), ServiceMessage::setMessageData(), Rxstring::strlength, and Rxstring::strptr.
RexxReturnCode LocalMacroSpaceManager::loadMacroSpace | ( | const char * | target, |
const char ** | nameList, | ||
size_t | nameCount | ||
) |
Load a macrospace file, using just the subset of names in the file.
target | The target macrospace file. |
nameList | The list of names to load. |
nameCount | The number of items to load. |
Definition at line 326 of file LocalMacroSpaceManager.cpp.
References ADD_MACRO, MacroSpaceFile::close(), MacroSpaceDescriptor::MACRONAMESIZE, MacroSpaceManager, MacroSpaceFile::nextMacro(), MacroSpaceFile::openForLoading(), ServiceMessage::parameter1, ServiceMessage::parameter2, RXMACRO_OK, ClientMessage::send(), ServiceMessage::setMessageData(), Rxstring::strlength, and Rxstring::strptr.
RexxReturnCode LocalMacroSpaceManager::mapReturnResult | ( | ServiceMessage & | m | ) |
Process an result returned from the server and map it into an API return code.
m | The return message. |
Definition at line 711 of file LocalMacroSpaceManager.cpp.
References MACRO_DOES_NOT_EXIST, ServiceMessage::result, RXMACRO_NOT_FOUND, and RXMACRO_OK.
Referenced by addMacro(), clearMacroSpace(), getMacro(), queryMacro(), removeMacro(), reorderMacro(), and saveMacroSpace().
|
virtual |
Translate a service exception into the appropriate API return code.
e | The returned exception. |
Reimplemented from LocalAPISubsystem.
Definition at line 674 of file LocalMacroSpaceManager.cpp.
References FILE_CREATION_ERROR, FILE_READ_ERROR, FILE_WRITE_ERROR, ServiceException::getErrorCode(), MACRO_DOES_NOT_EXIST, MACRO_LOAD_REXX, MACRO_SOURCE_NOT_FOUND, MACRO_SOURCE_READ_ERROR, MACRO_TRANSLATION_ERROR, MACROSPACE_FILE_READ_ERROR, MACROSPACE_SIGNATURE_ERROR, MACROSPACE_VERSION_ERROR, RXMACRO_FILE_ERROR, RXMACRO_NO_STORAGE, RXMACRO_NOT_FOUND, RXMACRO_SIGNATURE_ERROR, and RXMACRO_SOURCE_NOT_FOUND.
Referenced by LocalAPIManager::processServiceException().
RexxReturnCode LocalMacroSpaceManager::queryMacro | ( | const char * | name, |
size_t * | pos | ||
) |
Check the macro space for a give item, returning the order information.
name | The name to check. |
pos |
Definition at line 521 of file LocalMacroSpaceManager.cpp.
References MacroSpaceManager, mapReturnResult(), ServiceMessage::parameter1, QUERY_MACRO, and ClientMessage::send().
void LocalMacroSpaceManager::readRxstringFromFile | ( | SysFile * | fileInst, |
ManagedRxstring & | target, | ||
size_t | size | ||
) |
Read a buffer of data from a file and return in a ManagedRxString.
fileInst | The source file. |
target | The rxstring used to return the file data. |
size | The size to read. |
Definition at line 648 of file LocalMacroSpaceManager.cpp.
References ManagedRxstring::ensureCapacity(), MACROSPACE_FILE_READ_ERROR, SysFile::read(), Rxstring::strlength, and Rxstring::strptr.
Referenced by translateRexxProgram().
RexxReturnCode LocalMacroSpaceManager::removeMacro | ( | const char * | name | ) |
Remove a macro from the macrospace.
name | The name of the macro to remove. |
Definition at line 506 of file LocalMacroSpaceManager.cpp.
References MacroSpaceManager, mapReturnResult(), REMOVE_MACRO, and ClientMessage::send().
RexxReturnCode LocalMacroSpaceManager::reorderMacro | ( | const char * | name, |
size_t | pos | ||
) |
Change the search order for a macro item.
name | The name of the target macro. |
pos | The new search order. |
Definition at line 536 of file LocalMacroSpaceManager.cpp.
References MacroSpaceManager, mapReturnResult(), ServiceMessage::parameter1, REORDER_MACRO, and ClientMessage::send().
RexxReturnCode LocalMacroSpaceManager::saveMacroSpace | ( | const char * | target | ) |
Save the currently loaded macros into a file.
target | The target file name. |
Definition at line 366 of file LocalMacroSpaceManager.cpp.
References MacroSpaceFile::close(), MacroSpaceFile::create(), ServiceMessage::freeMessageData(), ServiceMessage::getMessageData(), ServiceMessage::getMessageDataLength(), ITERATE_MACRO_DESCRIPTORS, ITERATE_MACROS, MacroSpaceManager, ServiceMessage::nameArg, NEXT_MACRO_DESCRIPTOR, NEXT_MACRO_IMAGE, NO_MORE_MACROS, ServiceMessage::operation, ServiceMessage::parameter1, ServiceMessage::parameter2, ServiceMessage::result, RXMACRO_OK, ClientMessage::send(), MacroSpaceFile::write(), and MacroSpaceFile::writeMacroDescriptor().
RexxReturnCode LocalMacroSpaceManager::saveMacroSpace | ( | const char * | target, |
const char ** | names, | ||
size_t | count | ||
) |
Save the currently loaded macrospace using a subset of the loaded macros.
target | The file target. |
names | The list of names. |
count | The number of names in the list. |
Definition at line 446 of file LocalMacroSpaceManager.cpp.
References MacroSpaceFile::close(), MacroSpaceFile::create(), ServiceMessage::freeMessageData(), GET_MACRO_DESCRIPTOR, GET_MACRO_IMAGE, ServiceMessage::getMessageData(), ServiceMessage::getMessageDataLength(), MACRO_DOES_NOT_EXIST, MacroSpaceManager, mapReturnResult(), ServiceMessage::nameArg, ServiceMessage::operation, ServiceMessage::parameter1, ServiceMessage::parameter2, ServiceMessage::result, RXMACRO_OK, ClientMessage::send(), MacroSpaceFile::write(), and MacroSpaceFile::writeMacroDescriptor().
void LocalMacroSpaceManager::translateRexxProgram | ( | const char * | sourceFile, |
ManagedRxstring & | imageData | ||
) |
Translate a source file into a Rexx program.
sourceFile | The source file name. |
imageData | The returned image data. |
Definition at line 589 of file LocalMacroSpaceManager.cpp.
References SysFile::close(), SysLibrary::getProcedure(), SysFile::getSize(), SysLibrary::load(), MACRO_SOURCE_NOT_FOUND, MACRO_SOURCE_READ_ERROR, MACRO_TRANSLATION_ERROR, SysFile::open(), readRxstringFromFile(), RexxEntry, RX_O_RDONLY, RX_SH_DENYWR, Rxstring::strlength, and Rxstring::strptr.
Referenced by addMacroFromFile().