Soup Functions

Miscellaneous Soup Methods


soup:GetIndexes()


This method returns an array of frames, one for each index in soup. This method is not supported for union soups. Here are some examples of its use:

internalStore := GetStores()[0];
namesSoup := internalStore:GetSoup("Names");
Print(namesSoup:GetIndexes());
[{structure: slot,
  path: sortOn,
  type: String,
  index: 125}]

calendarSoup := internalSoup:GetSoup("Calendar");
Print(calendarSoup:GetIndexes());
[{structure: slot,
  path: mtgStartDate,
  type: Int,
  index: 96},
 {structure: slot,
  path: mtgAlarm,
  type: Int,
  index: 98}]

soup:AddIndexXmit(indexSpec, changeSymbol)


You use this to add a soup index as specified by the indexSpec frame. This method is not supported for union soups. The changeSymbol is a symbol specifying who made the change (it is usually an application symbol). If changeSymbol is nil, no change notification is done.

Here is an example that adds a single-slot index:

mySoup:AddIndexXmit(
   {
      structure:  'slot,
      path:       'name,
      type:       'string,
   }
   '|ProgNewton:Calliope|);

soup:RemoveIndexXmit(indexPath, changeSymbol)


You use this to remove a soup index on the path indexPath. This method works on both union and nonunion soups. The changeSymbol is a symbol specifying who made the change (it is usually an application symbol). If changeSymbol is nil, no change notification is done.

Here is an example that removes a single-slot index:

mySoup:RemoveIndexXmit('name,
   '|ProgNewton:Calliope|);
Here is an example that removes a multislot index:

mySoup:RemoveIndexXmit(['name, 'age],
   '|ProgNewton:Calliope|);

soup:RemoveFromStoreXmit(changeSymbol)


This method deletes soup from the store it is on. This method is not supported for union soups. The changeSymbol is a symbol specifying who made the change (it is usually an application symbol). If changeSymbol is nil, no change notification is done.

Here is an example:

soup := GetStores()[0]:GetSoup("Foo");
soup:RemoveFromStoreXmit('|ProgNewton:Calliope|);

soup:IsValid()


This method returns true if soup is valid, and nil otherwise. A soup is invalid if it has been deleted or if the store that it is on has been removed. Here is an example:

soup := GetStores()[0]:GetSoup("Foo");
Print(soup:IsValid())
TRUE
soup:RemoveFromStore();
Print(soup:IsValid())
NIL

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996