cxmap.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-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
/*
* C expression library value map support
*
* Glenn Fowler
* AT&T Research
*/
#include "cxlib.h"
typedef struct Frame_s
{
} Frame_t;
/*
* dt string ignorecase comparison
*/
static int
{
return strcasecmp((char*)a, (char*)b);
}
/*
* cxinitmap helper
*/
static int
{
int easy;
static Dtdisc_t num2strdisc;
static Dtdisc_t str2numdisc;
static Dtdisc_t stricase2numdisc;
return -1;
for (;;)
{
break;
}
return 0;
{
if (!frame)
return 0;
easy = 0;
}
else
{
{
}
else
{
return -1;
}
easy = 1;
}
{
easy = 0;
else
{
easy = 0;
else
{
return -1;
easy = 0;
}
}
}
if (easy)
{
{
return -1;
}
}
return 0;
}
/*
* initialize map
*/
int
{
}
/*
* cxnum2str helper
*/
static int
{
Cxunsigned_t n;
char* s;
int v;
int p;
int r;
char buf[64];
for (;;)
{
break;
}
{
return 1;
}
r = 0;
{
n = num;
p = r;
{
{
r++;
}
if (v)
break;
}
{
buf[0] = 0;
{
if (!buf[0])
if (!regexec(&edit->re, buf, elementsof(match), match, 0) && !regsubexec(&edit->re, buf, elementsof(match), match))
{
r++;
break;
}
}
{
r++;
break;
}
}
}
return r;
}
/*
* map number to string
*/
int
{
char* s;
int del;
{
del = '|';
return -1;
}
else
return -1;
if (p)
*p = s + 1;
return 0;
}
/*
* cxstr2num helper
*/
static int
{
{
return 1;
}
else if (!regexec(&edit->re, str, elementsof(match), match, 0) && !regsubexec(&edit->re, str, elementsof(match), match))
{
return 1;
}
return 0;
}
/*
* map string to number
*/
int
{
register char* s;
register char* b;
int del;
Cxunsigned_t n;
Cxunsigned_t m;
return -1;
n = 0;
return -1;
while (*s)
{
if (*s)
*s++ = 0;
n |= m;
else
return -1;
}
if (p)
*p = n;
return 0;
}
/*
* apply edit substitutions in edit to r
*/
int
{
if (!cxisstring(r->type))
{
return -1;
}
else
type = 0;
if (!regnexec(&edit->re, r->value.string.data, r->value.string.size, elementsof(match), match, 0) && !regsubexec(&edit->re, r->value.string.data, elementsof(match), match))
return -1;
return 0;
}
/*
* apply edit substitutions in part to r
*/
int
{
while (part)
{
return -1;
}
return 0;
}