|
The mplist_deserialize() function parses M-text mt and returns a property list.
The syntax of mt is as follows.
MT ::= '(' ELEMENT * ')'
ELEMENT ::= SYMBOL | INTEGER | M-TEXT | PLIST
SYMBOL ::= ascii-character-sequence
INTEGER ::= '-' ? [ '0' | .. | '9' ]+ | '0x' [ '0' | .. | '9' | 'A' | .. | 'F' | 'a' | .. | 'f' ]+
M-TEXT ::= '"' character-sequence '"'
Each alternatives of ELEMENT is assigned one of these keys: Msymbol , Minteger , Mtext , Mplist
In an ascii-character-sequence, a backslash (\) is used as the escape character, which means that, for instance, "abc\ def" produces a symbol whose name is of length seven with the fourth character being a space. |
|
The mplist() function returns a newly created property list object of length zero.
- Return value:
- This function returns a newly created property list.
- Errors:
- This function never fails.
|
|
The mplist_copy() function copies property list plist. In the copy, the values are the same as those of plist.
- Return value:
- This function returns a newly created plist which is a copy of plist.
- Errors:
- This function never fails.
|
|
The mplist_put() function searches property list plist from the beginning for a property whose key is key. If such a property is found, its value is changed to value. Otherwise, a new property whose key is key and value is value is appended at the end of plist. See the documentation of mplist_add() for the restriction on key and val.
If key is a managing key, val must be a managed object. In this case, the reference count of the old value, if not NULL , is decremented by one, and that of val is incremented by one.
- Return value:
- If the operation was successful, mplist_put() returns a sublist of plist whose first element is the just modified or added one. Otherwise, it returns
NULL .
|
|
The mplist_get() function searches property list plist from the beginning for a property whose key is key. If such a property is found, a pointer to its value is returned as the type of (void *) . If not found, NULL is returned.
When NULL is returned, there are two possibilities: one is the case where no property is found (see above); the other is the case where a property is found and its value is NULL . In case that these two cases must be distinguished, use the mplist_find_by_key() function.
- See Also:
- mplist_find_by_key()
|
|
The mplist_add() function appends at the end of property list plist a property whose key is key and value is val. key can be any symbol other than Mnil .
If key is a managing key, val must be a managed object. In this case, the reference count of val is incremented by one.
- Return value:
- If the operation was successful, mplist_add() returns a sublist of plist whose first element is the just added one. Otherwise, it returns
NULL .
|
|
The mplist_push() function inserts at the beginning of property list plist a property whose key is key and value is val.
If key is a managing key, val must be a managed object. In this case, the reference count of val is incremented by one.
- Return value:
- If the operation was successful, this function returns plist. Otherwise, it returns
NULL .
|
void* mplist_pop |
( |
MPlist * |
plist |
) |
|
|
The mplist_pop() function removes a property at the beginning of property list plist. As a result, the second key and value of the original plist become the first of those of the new plist.
- Return value:
- If the operation was successful, this function return the value of the just popped property. Otherwise, it returns
NULL .
|
|
The mplist_find_by_key() function searches property list plist from the beginning for a property whose key is key. If such a property is found, a sublist of plist whose first element is the found one is returned. Otherwise, NULL is returned.
If key is Mnil , it returns a sublist of plist whose first element is the last one of plist. |
|
The mplist_find_by_value() function searches property list plist from the beginning for a property whose value is val. If such a property is found, a sublist of plist whose first element is the found one is returned. Otherwise, NULL is returned. |
|
The mplist_next() function returns a pointer to the sublist of property list plist, which begins at the second element in plist. If the length of plist is zero, it returns NULL . |
|
The mplist_set() function sets the key and the value of the first property in property list plist to key and value, respectively. See the documentation of mplist_add() for the restriction on key and val.
- Return value:
- If the operation was successful, mplist_set() returns plist. Otherwise, it returns
NULL .
|
int mplist_length |
( |
MPlist * |
plist |
) |
|
|
The mplist_length() function returns the number of properties in property list plist. |
|
The mplist_key() function returns the key of the first property in property list plist. If the length of plist is zero, it returns Mnil . |
void* mplist_value |
( |
MPlist * |
plist |
) |
|
|
The mplist_value() function returns the value of the first property in property list plist. If the length of plist is zero, it returns NULL . |
|