/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-2012 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
*/
static const char usage[] =
"[-1ls5P?\n@(#)$Id: dss library (AT&T Research) 2012-05-31 $\n]"
"[+PLUGIN?\findex\f]"
"[+DESCRIPTION?The \bdss\b default method provides types, global "
"variables, and a schema available for all other methods.]"
"{\fvariables\f}"
"[+?The schema is a pure XML (tags "
"only) file that specifies the \bdss\b method and optional field value "
"maps and constraints. Public schemas are usually placed in a "
"{"
;
#include "dsshdr.h"
#include <dlldefs.h>
#include <pzip.h>
#include <stak.h>
{
{0}
};
/*
* find and open file for read
*/
dssfind(const char* name, const char* suffix, Dssflags_t flags, char* path, size_t size, Dssdisc_t* disc)
{
if (!suffix)
if (*name == ':')
{
}
{
return 0;
}
else
if (!sp)
{
return 0;
}
return sp;
}
/*
* load tags file
*/
static Dssmeth_t*
{
return meth;
return 0;
}
/*
* dss identf
*/
static int
{
register char* s;
register char* e;
s = (char*)buf;
e = s + size;
while (s < e && isspace(*s))
s++;
if (*s++ != '<')
return 0;
if (*s == '!')
while (s < e && *s++ != '!');
else
while (s < e && isalpha(*s))
s++;
return s < e && *s == '>';
}
/*
* dss openf
*/
static int
{
return 0;
}
/*
* dss readf
*/
static int
{
return 0;
}
/*
* dss writef
*/
static int
{
return 0;
}
/*
* dss seekf
*/
static Sfoff_t
{
return 0;
}
/*
* dss closef
*/
static int
{
return 0;
}
{
&id[0],
CXH,
};
{
&id[0],
"meta-method that specifies a method, value maps and constraints",
CXH,
};
/*
* dss methf
*/
static Dssmeth_t*
dssmethf(const char* name, const char* options, const char* schema, Dssdisc_t* disc, Dssmeth_t* meth)
{
char* us;
if (options)
{
{
return 0;
}
{
return 0;
}
{
return 0;
}
for (;;)
{
{
case '?':
return 0;
case ':':
return 0;
}
break;
}
}
if (schema)
return meth;
}
#include "dss-compress.h"
#include "dss-count.h"
#include "dss-null.h"
#include "dss-print.h"
#include "dss-return.h"
#include "dss-scan.h"
#include "dss-write.h"
{
{0},
};
{
&id[0],
"dss method",
CXH,
0,
0,
0,
0,
0,
&queries[0],
0,
0,
0
};
/*
* initialize library given name and dlopen() handle
*/
static Dsslib_t*
{
/*
* check for the Dsslib_t* function
*/
if (dll)
{
}
if (lib)
{
{
return 0;
}
return lib;
}
return 0;
}
/*
* open and return library info for name
* name==0 scans for all related libraries on $PATH
*/
{
void* dll;
if (!name)
{
{
{
}
}
}
return 0;
(lib = (Dsslib_t*)dll_lib(&names, DSS_PLUGIN_VERSION, (flags & DSS_VERBOSE) ? (Error_f)disc->errorf : (Error_f)0, disc)))
return lib;
}
/*
* add lib tables
*/
int
{
register int i;
return 0;
return -1;
return -1;
return -1;
return -1;
return -1;
return -1;
if (lib->constraints)
return -1;
return -1;
return 0;
}
/*
* find and add library name
*/
{
return 0;
}
/*
* return the input location string for data
* suitable for errorf
*/
static char*
{
char* path;
char* sep;
char* loc;
char* nxt;
char* end;
size_t n;
if (!file)
return "";
path++;
else
sep = ": ";
{
sep = ", ";
n += 64;
}
sfsprintf(nxt, end - nxt, "%s %I*u, %s %I*d: ", ERROR_translate(NiL, NiL, id, "record"), sizeof(file->count), file->count, ERROR_translate(NiL, NiL, id, "offset"), sizeof(file->offset), file->offset);
return loc;
}
static int
dss_mem_get(Cx_t* cx, Cxinstruction_t* pc, Cxoperand_t* r, Cxoperand_t* a, Cxoperand_t* b, void* data, Cxdisc_t* disc)
{
{
case DSS_MEM_file:
break;
case DSS_MEM_format:
break;
case DSS_MEM_length:
break;
case DSS_MEM_offset:
break;
case DSS_MEM_queried:
break;
case DSS_MEM_record:
break;
case DSS_MEM_selected:
break;
default:
return -1;
}
return 0;
}
{
0,
(Dt_t*)&dss_mem_struct[0]
};
{
{ DSS_ID "_s", "Global state struct.", CXH, (Cxtype_t*)"void", 0, 0, 0, 0, 0, 0, 0, {0}, 0, &dss_mem },
};
{
};
/*
* open a dss session
*/
{
int i;
if (!disc)
return 0;
if (!meth)
{
/*
* find the first user library that defines a method
*/
if (lib)
else
{
return 0;
}
}
{
return 0;
}
{
return 0;
}
if (!(dss->cx = cxscope(NiL, meth->cx, flags & DSS_CX_FLAGS, test, disc)) || disc->map && !loadtags(disc->map, "map", disc, meth))
goto bad;
goto bad;
for (var = (Cxvariable_t*)dtfirst(dss->cx->variables); var; var = (Cxvariable_t*)dtnext(dss->cx->variables, var))
for (i = 0; i < elementsof(dss_type); i++)
goto bad;
for (i = 0; i < elementsof(dss_var); i++)
{
goto bad;
goto bad;
}
bad:
return 0;
}
/*
* close a dss session
*/
int
{
int r;
if (!dss)
return -1;
else
r = 0;
r = -1;
else
return r;
}
/*
* initialize method given pointer
* this is a library private global for dssmeth() and dssstatic()
*/
dssmethinit(const char* name, const char* options, const char* schema, Dssdisc_t* disc, Dssmeth_t* meth)
{
{
{
return 0;
}
}
return 0;
{
return 0;
}
if (name)
{
{
if (!meth)
return 0;
}
else if (options)
return 0;
}
}
/*
* return method given name
*/
{
register char* s;
const char* options;
const char* schema;
for (s = buf; *s; s++)
if (*s == ',' || *s == '\t' || *s == '\r' || *s == '\n')
{
if (!options)
{
*s++ = 0;
options = (char*)s;
}
}
else if (*s == ':')
{
*s++ = 0;
break;
}
if (!*name)
{
{
meth = &dss_method;
}
return 0;
}
}
/*
* return initialized global state pointer
*/
{
{
}
return &state;
}
/*
* return 1 if expr contains a query
*/
static int
{
do
{
return 1;
return 1;
return 1;
return 1;
return 0;
}
/*
* apply expression with optional head and tail queries to files in argv
*/
int
{
register Dssexpr_t* x;
int errors;
int r;
return -1;
r = -1;
if (expression == tail)
tail = 0;
tail = "{write}";
if (tail)
{
goto bad;
{
xt = 0;
}
}
{
if (!head)
head = "{scan}";
goto bad;
{
goto bad;
}
}
else if (head)
{
(*dss->disc->errorf)(dss, dss->disc, 2, "%s: expression already has %s head", head, x->query->name);
goto bad;
}
else
{
{
{
goto bad;
}
expr = x;
}
if (xt)
{
}
if (xh)
{
xh = x;
}
}
goto bad;
bad:
if (xh)
if (xt)
return r;
}