EDS.ESexp - disksummary

The disksummary branch version of ESexp contains some enhancements which allow it to be much more re-usable.

With the Evolution/EDS.ESexp original version, each expression is parsed into a tree stored in the base object, so that it can only be used to parse and execute a single expression at a time.

The enhancements in this version change the model of use. Instead, the base object defines the language avaialable, and multiple expressions can be parsed and evaluated in parallel based on this language.

Base struct

The base object has had all memory and syntax tree related data removed from it. Now it just stores the scanner, and contains a lock to serialise access to it, since the scanner is not pure.

All of the syntax tree information has been moved into a new object, ESexpTree.

Methods

The parsing function now returns an ESexpTree object if it is successful, and all of the evaluation-related functions now take one as well, rather than the ESexp object.

All of the callback methods are also passed the syntax tree pointer for this expression, not the base ESexp object, although they can easily obtain that too.

The eval function now takes another user-data field, which is passed as the data parameter to the callbacks.

ESexpTree

This contains the syntax tree information, memory management, and exception handling structures.

 struct _ESExpTree {
        struct _ESExp *sexp;
        struct _ESExpTerm *term;
 
        void *user_data;
 
        jmp_buf failenv;
        char *error;
        void *lock;
 
        struct _EMemChunk *term_chunks;
        struct _EMemChunk *result_chunks;
 };
  • sexp: Points to the parent object, used in expression evaluators.
  • term: The actual syntax tree for this expression
  • user_data: Used by code to pass other context data related to this expression.
  • failenv, error: Exception handling structures.
  • lock, term_chunks, result_chunks: Memory management.

Apps/Evolution/EDSDS.ESexp (last edited 2013-08-08 22:50:04 by WilliamJonMcCann)