/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1989-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* tw expression definitions
*/
#include "tw.h"
#include <ctype.h>
#include <tm.h>
#include <sfdisc.h>
#include <sum.h>
typedef struct Exsum_s
{
} Exsum_t;
{
EXID(0, 0, 0, 0, 0)
};
/*
* dereference ftw
*/
static Ftw_t*
{
register char* path;
while (ref)
{
{
}
}
return ftw;
}
/*
* return sum() for path
*/
static char*
{
char* s;
int r;
goto bad;
goto bad;
bad:
return "*******READ-ERROR*******";
}
/*
* format urlized path
*/
static char*
{
register unsigned char* p;
register char* s;
register int n;
register int c;
char* r;
n = 0;
p = (unsigned char*)path;
while (c = *p++)
n++;
p = (unsigned char*)path;
while (c = *p++)
{
*s++ = '%';
*s++ = hex[c&0xF];
}
else
*s++ = c;
*s = 0;
return r;
}
/*
* return value for symbol sym
*/
static Extype_t
{
Extype_t v;
{
{
v.integer = 0;
return v;
}
}
{
case F_args:
break;
case F_atime:
break;
case F_blocks:
break;
case F_blksize:
#ifdef stat_blksize
#else
v.integer = 1024;
#endif
break;
case F_checksum:
goto string;
case F_ctime:
break;
case F_dev:
break;
case F_fstype:
goto string;
case F_gid:
break;
case F_gidok:
break;
case F_info:
break;
case F_ino:
break;
case F_level:
break;
case F_local:
else
break;
case F_magic:
if (fp)
goto string;
case F_md5sum:
break;
case F_mime:
if (fp)
goto string;
case F_mode:
break;
case F_mtime:
break;
case F_name:
goto string;
case F_nlink:
break;
case F_path:
goto string;
case F_perm:
break;
case F_rdev:
break;
case F_size:
break;
case F_status:
break;
case F_symlink:
text[0] = 0;
goto string;
case F_type:
#ifdef S_ISCTG
#endif
#ifdef S_ISSOCK
#endif
#ifdef S_ISDOOR
#endif
else v.integer = 0;
break;
case F_uid:
break;
case F_uidok:
break;
case F_url:
goto string;
case F_view:
break;
case F_visit:
else
break;
case X_cmdarg:
v.integer = 1;
break;
case X_cmdflush:
v.integer = 1;
break;
case X_sum:
break;
default:
{
case F_local:
break;
case F_visit:
v = (vp = (Visit_t*)dtmatch(state.vistab, &id)) ? vp->value[MEMOFFSET(sym->index)] : exzero(sym->type);
break;
default:
error(3, "%s: invalid identifier reference [ index=%d memindex=%d memoffset=%d ]", sym->name, sym->index, MEMINDEX(sym->index), MEMOFFSET(sym->index));
break;
}
break;
}
return v;
return v;
}
/*
* initialize the visit table
*/
static void
{
{
}
}
/*
* sym referenced in expression
*/
static Extype_t
{
Extype_t v;
char* m;
if (elt >= 0)
if (str)
{
}
{
case MEMBER:
while (ref)
{
{
case F_parent:
break;
case F_local:
{
break;
}
/*FALLTHROUGH*/
case F_visit:
{
break;
}
/*FALLTHROUGH*/
default:
break;
}
}
break;
case C_AGAIN:
break;
case C_BLK:
case C_CHR:
case C_DIR:
case C_DOOR:
case C_FIFO:
case C_LNK:
case C_REG:
case C_SOCK:
break;
case C_C:
break;
case C_D:
break;
case C_DC:
break;
case C_DNR:
break;
case C_DNX:
break;
case C_DP:
break;
case C_FOLLOW:
v.integer = FTW_FOLLOW;
break;
case C_NOPOST:
v.integer = FTW_NOPOST;
break;
case C_NR:
break;
case C_NS:
break;
case C_NX:
break;
case C_SKIP:
break;
case F_info:
break;
case F_magic:
case F_mime:
{
}
break;
case F_visit:
break;
case F_atime:
case F_blksize:
case F_blocks:
case F_ctime:
case F_dev:
case F_fstype:
case F_gid:
case F_gidok:
case F_ino:
case F_mode:
case F_mtime:
case F_nlink:
case F_perm:
case F_rdev:
case F_size:
case F_symlink:
case F_type:
case F_uid:
case F_uidok:
break;
case X_cmdarg:
break;
case F_checksum:
m = "ast4";
goto sum;
case F_md5sum:
m = "md5sum";
goto sum;
case X_sum:
m = 0;
sum:
break;
}
return v;
}
/*
* set value for symbol sym to val
*/
static int
setval(Expr_t* pgm, Exnode_t* node, Exid_t* sym, Exref_t* ref, void* env, int elt, Extype_t val, Exdisc_t* disc)
{
if (elt >= 0)
{
case F_local:
break;
case F_status:
break;
case F_visit:
{
}
break;
default:
{
case F_local:
{
{
}
}
break;
case F_visit:
{
}
break;
default:
return -1;
}
break;
}
return 0;
}
/*
* match str against pat
*/
static int
matchval(Expr_t* pgm, Exnode_t* xstr, const char* str, Exnode_t* xpat, const char* pat, void* env, Exdisc_t* disc)
{
}
/*
* convert operands
*/
static int
convert(Expr_t* prog, register Exnode_t* x, int type, register Exid_t* xref, int arg, Exdisc_t* disc)
{
register Sflong_t n;
time_t t;
char* s;
if (type < 0200)
{
else switch (type)
{
case T_DATE:
if (*s)
goto ignored;
break;
case T_GID:
break;
case T_MODE:
case T_PERM:
break;
case T_UID:
break;
}
}
else
{
switch (type)
{
case FLOATING:
break;
case STRING:
switch (x->type)
{
case T_DATE:
t = n;
break;
case T_GID:
break;
case T_MODE:
break;
case T_PERM:
break;
case T_UID:
break;
default:
break;
}
s = strdup(s);
return -1;
break;
}
}
return 0;
if (xref)
else
return 0;
}
/*
* initialize the expression state
*/
static void
init(void)
{
{
}
}
/*
* compile the tw expression in s
*/
void
{
init();
if (file)
{
else
}
if (error_info.trace)
}
/*
* evaluate x w.r.t. ftw
*/
long
{
Extype_t v;
return v.integer;
}
/*
* return integer value for id
*/
long
{
Extype_t v;
return v.integer;
}
/*
* sfkeyprintf() lookup
*/
static int
{
Extype_t v;
return 0;
{
return 0;
}
else
return 1;
}
{
{
init();
}
}