MMO'ISL:  Insert Into Sorted List

Bit value:  16777216

May be used by itself or in conjunction with MMO'DEL or MMO'TBL to perform insert, delete, and lookup of items in a sorted list. Note that in all cases, there is no display, and thus the window coordinates don't matter, but the entire memo must fit in memory within the size specified by VSPEC.

When used by itself, it inserts the TEXT parameter (which is assumed to be one line) alphabetically into the memo specified by LINK, which is assumed to be a sorted list. For example, if TEXT contained "RUTABAGA\0.69" and the memo pointed to by LINK contained:

DIAKON\0.89

EGGPLANT\1.49

ENDIVE\2.19

JICAMA\0.59

SQUASH\0.39

then the insertion would be made between JICAMA\0.59 and SQUASH\0.39.

This is one way to use INMEMO to maintain an index which may be accessed with table lookup calls.

Looking Up Items in a List: Although you could use the normal MMO'TBL lookup mode, combining the MMO'ISL + MMO'TBL opcodes allows an easier-to-use alternative. The main advantage of the MMO'ISL + MMO'TBL method is that you don't have to specify the search control characters, and you don't have to worry about inadvertent search matches in the middle of line. MMO'ISL + MMO'TBL use the same sort of search as MMO'ISL + MMO'DEL does. That is, it matches the contents of TEXT (with no wildcards) against each line of the memo, starting at the beginning of the line. Another difference is that the entire line is returned, not just the remainder following the search pattern. The major disadvantage of using the MMO'ISL table lookup (as opposed to the normal one) is that like all MMO'ISL operations, it takes place entirely in memory and thus it is most useful on smaller lists.

Trapping Errors: EXTCOD will contain 1 (MMX'QUI) if there is no room to insert on a MMO'ISL insert operation, or if the search key is not found on a MMO'ISL delete or table lookup operation. It will contain 2 (MMX'VTS) if the VSPEC specified was not large enough to contain the entire memo. (Remember, MMO'ISL operations all require that the entire memo fit in memory in the confines specified by VSPEC). An EXTCOD value of 0 indicates success. In addition, for table lookup, TEXT will contain the line matching the search key if found, or null if not found.