Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > ac50c8547d586963a47aff205a94967f > files > 71

dyalog-debug-1.11.3-1mdv2008.1.i586.rpm

/* 
 ******************************************************************
 * $Id: tree-indexing.h 514 2006-03-06 16:44:41Z clerger $
 * Copyright (C) 1998, 2006 by INRIA 
 * Author: Eric de la Clergerie <Eric.De_La_Clergerie@inria.fr>
 * ----------------------------------------------------------------
 *
 *  tree-indexing.h -- Header file for tree-indexing.c
 *
 * ----------------------------------------------------------------
 * Description
 * 
 * ----------------------------------------------------------------
 */

typedef void *Closure;
typedef Bool (* ClosedFn) (tabobj_t,Closure);

#define INDEXATION_MAX_DEPTH        5

typedef struct Trailed_HashScan {
    boxtype type;               /* HASH_SCAN */
    HashScan scan;
} *Trailed_HashScan;

typedef struct Resume {
    boxtype type;               /* INDEXATION */
    struct Resume *prev;
    int depth;
    Closure closure;
    fol_t A;
    struct ResumeInfo {
        fol_t   *arg;
        fol_t   *stop;
        fkey_t  k;
    } info[INDEXATION_MAX_DEPTH+2];
} *Resume;

typedef struct Undo {
    boxtype type;
    union {
        int forward;
        struct Upward {
            fol_t *stop;
            fkey_t k;
        } upward;
    }  value;
} *Undo;

#define IP ((Resume) REG(I_IP))
#define LVALUE_IP (LVALUE_REG(I_IP))

inline extern void
Untrail_Forward(Undo undo)
{
    int pop = undo->value.forward;
            
    V_DISPLAY( "\tundo forward %d\n", pop );
            
    for (; pop ; pop--, (IP->info[IP->depth].arg)--, IP->depth++);
    (IP->info[IP->depth].arg)--;
}

inline extern void
Untrail_Upward(Undo undo)
{
    struct Upward *s=&(undo->value.upward);
    int depth = (IP->depth)--;
    
    V_DISPLAY( "\tundo pushing : restoring %&s from depth %d\n",
               DFOLINT(0), s->k, depth);
    
    IP->info[depth] = (struct ResumeInfo) { arg  : s->stop, stop : s->stop, k: s->k };
}