Re: Jade Q: ProcessContext::processNode

Subject: Re: Jade Q: ProcessContext::processNode
From: James Clark <jjc@xxxxxxxxxx>
Date: Mon, 20 Oct 1997 17:41:19 +0700
Frank Christoph wrote:
> 
> In Jade, in the body of ProcessContext::processNode, there is a fragment of
> code that gets invoked after the style engine finds a construction rule matching
> a grove node:
> 
>       if (sosofoObj)                                    // 83 case #1
>         sosofoObj->process(*this);                      // 84
>       else {                                            // 85
>         ELObj *obj = vm().eval(insn.pointer());         // 86
>         if (vm_.interp->isError(obj)) {                 // 87 case #2
>           if (processingMode->name().size() == 0)       // 88
>             processChildren(processingMode);            // 89
>         }                                               // 90
>         else {                                          // 91 case #3
>           ELObjDynamicRoot protect(*vm_.interp, obj);   // 92
>           ((SosofoObj *)obj)->process(*this);           // 93
>         }                                               // 94
>       }                                                 // 95
> 
> I've added comments indicating the three main cases here and numbered the lines.
> 
> When a construction rule is invoked, the result of executing the body of the
> rule will be either a sosofo object or it will foul up and produce an
> error.  I take it that the former corresponds to case #3, and the latter to
> case #2.  But case #1 looks like the match returns a sosofo without ever
> executing any style language code; when does this occur? 

When it can optimize the expression into a constant sosofo (I don't
think it actually ever does currently).

> Also, what is
> the significance of the condition on line 88, i.e., why process the children
> only when the processing mode's name is null?  Does this correspond to the
> top-level mode?

Yes.  It's just an error-recovery heuristic.

James


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread