expo: Use standard numbering for save and discard

Set aside some expo IDs for 'save' and 'discard' buttons. This avoids
needing to store the IDs for these. Adjust the documentation and expo
tool for the new EXPOID_BASE_ID value.

Ignore these objects when saving and loading the cedit, since they do
not contain real data.

Adjust 'cedit run' to return failure when the user exits the expo
without saving. Update the test for this change as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-10-18 14:10:22 -06:00
parent 89f4f33c44
commit d8ff97ce91
10 changed files with 112 additions and 41 deletions
+6 -1
View File
@@ -94,7 +94,7 @@ them. Expo supports doing this with an enum, where every ID is listed in the
enum::
enum {
ZERO,
ID_PROMPT = EXPOID_BASE_ID,
ID_PROMPT,
@@ -130,6 +130,11 @@ that means that something is wrong with your syntax, or perhaps you have an ID
in the `.dts` file that is not mentioned in your enum. Check both files and try
again.
Note that the first ID in your file must be no less that `EXPOID_BASE_ID` since
IDs before that are reserved. The `expo.py` tool automatically obtains this
value from the `expo.h` header file, but you must set the first ID to this
enum value.
Use the command interface
-------------------------
+8 -4
View File
@@ -88,8 +88,13 @@ or even the IDs of objects. Programmatic creation of many items in a loop can be
handled by allocating space in the enum for a maximum number of items, then
adding the loop count to the enum values to obtain unique IDs.
Where dynamic IDs are need, use expo_set_dynamic_start() to set the start value,
so that they are allocated above the starting (enum) IDs.
Some standard IDs are reserved for certain purposes. These are defined by
`enum expo_id_t` and start at 1. `EXPOID_BASE_ID` defines the first ID which
can be used for an expo.
An ID of 0 is invalid. If this is specified in an expo call then a valid
'dynamic IDs is allocated. Use expo_set_dynamic_start() to set the start
value, so that they are allocated above the starting (enum) IDs.
All text strings are stored in a structure attached to the expo, referenced by
a text ID. This makes it easier at some point to implement multiple languages or
@@ -417,8 +422,7 @@ strings are provided inline in the nodes where they are used.
/* this comment is parsed by the expo.py tool to insert the values below
enum {
ZERO,
ID_PROMPT,
ID_PROMPT = EXPOID_BASE_ID,
ID_SCENE1,
ID_SCENE1_TITLE,