Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your PHP code is a C->PHP port of the <a href="http://www.sqlite.org/cvstrac/getfile/sqlite/tool/lemon.c" rel="nofollow">LEMON</a> parser generator, which includes this code:</p> <blockquote> <pre><code>/* Add another configuration to the configuration list */ struct config *Configlist_add(rp,dot) struct rule *rp; /* The rule */ int dot; /* Index into the RHS of the rule where the dot goes */ { struct config *cfp, model; assert( currentend!=0 ); model.rp = rp; model.dot = dot; cfp = Configtable_find(&amp;model); if( cfp==0 ){ cfp = newconfig(); cfp-&gt;rp = rp; cfp-&gt;dot = dot; cfp-&gt;fws = SetNew(); cfp-&gt;stp = 0; cfp-&gt;fplp = cfp-&gt;bplp = 0; cfp-&gt;next = 0; cfp-&gt;bp = 0; *currentend = cfp; currentend = &amp;cfp-&gt;next; Configtable_insert(cfp); } return cfp; } </code></pre> </blockquote> <p>It's in the PHP because it was in the original C. In the original C, it writes through the <code>currentend</code> pointer to replace the contents of whatever it is pointing at (memory allocated elsewhere, probably contains garbage), and then it updates the <code>currentend</code> pointer to point to the <code>struct node</code> pointed to by <code>cfp-&gt;next</code> (which is <code>0</code>, here, which is why I think some other routine will allocate the memory for it later).</p> <p>In other words, it appends the new <code>struct rule</code> to the end of a list of <code>struct rule</code>s while maintaining a pointer to the "last entry". (Well, an entry beyond the end. Where the next last-entry will go, once it exists. All of which makes accessing the end-of-the-list an O(1) operation, superb for improving list-append operations.)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload