ported double tracking from TC

This commit is contained in:
mikx
2020-10-30 23:45:46 -04:00
commit 44b1f31c23
4914 changed files with 4961129 additions and 0 deletions

11
deps/acelite/ace/ETCL/ACE_ETCL.pc.in vendored Normal file
View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: ACE_ETCL
Description: ACE Extended Trading Constraint Language Library
Requires: ACE
Version: @VERSION@
Libs: -L${libdir} -lACE_ETCL
Cflags: -I${includedir}

View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: ACE_ETCL_Parser
Description: ACE Extended Trading Constraint Language Parser Library
Requires: ACE_ETCL
Version: @VERSION@
Libs: -L${libdir} -lACE_ETCL_Parser
Cflags: -I${includedir}

159
deps/acelite/ace/ETCL/ETCL.ll vendored Normal file
View File

@@ -0,0 +1,159 @@
%option noyywrap
%{
// ETCL.ll,v 1.5 2005/11/16 07:53:24 ossama Exp
// ========================================================================
//
// = LIBRARY
// orbsvcs/ECTL
//
// = FILENAME
// ETCL.ll
//
// = AUTHOR
// Carlos O'Ryan <coryan@uci.edu> based on previous work by
// Seth Widoff <sbw1@cs.wustl.edu>
//
// ========================================================================
#include "ace/ETCL/ETCL_Interpreter.h"
#include "ace/ETCL/ETCL_y.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
static const char * extract_string(char*);
#define YY_LEX_DEBUG
#ifdef CONSTRAINT_DEBUG
#define YY_LEX_DEBUG OS::fprintf(stderr, "%s\n", yytext)
#endif /* CONSTRAINT_DEBUG */
#define YY_DECL int ETCL_yylex (ETCL_YYSTYPE *lvalp, void* state)
#define YY_BREAK
#define YY_NO_UNPUT
%}
white_space [ \t]
letter [a-zA-Z]
digit [0-9]
alpha_num ({letter}|{digit})
integer {digit}+
float ({digit}*\.{digit}+)([eE][-+]?{digit}+)?
string '(([^'\\]*)|([^'\\]*\\')|([^'\\]*\\\\))*'
base {letter}({alpha_num}|[_])*
ident {base}|\\{base}
newline \n
%%
min { YY_LEX_DEBUG; return ETCL_MIN; }
max { YY_LEX_DEBUG; return ETCL_MAX; }
first { YY_LEX_DEBUG; return ETCL_FIRST; }
random { YY_LEX_DEBUG; return ETCL_RANDOM; }
with { YY_LEX_DEBUG; return ETCL_WITH; }
exist { YY_LEX_DEBUG; return ETCL_EXIST; }
not { YY_LEX_DEBUG; return ETCL_NOT; }
and { YY_LEX_DEBUG; return ETCL_AND; }
or { YY_LEX_DEBUG; return ETCL_OR; }
in { YY_LEX_DEBUG; return ETCL_IN; }
"~" { YY_LEX_DEBUG; return ETCL_TWIDDLE; }
"+" { YY_LEX_DEBUG; return ETCL_PLUS; }
"-" { YY_LEX_DEBUG; return ETCL_MINUS; }
"*" { YY_LEX_DEBUG; return ETCL_MULT; }
"/" { YY_LEX_DEBUG; return ETCL_DIV; }
"<" { YY_LEX_DEBUG; return ETCL_LT; }
"<=" { YY_LEX_DEBUG; return ETCL_LE; }
">" { YY_LEX_DEBUG; return ETCL_GT; }
">=" { YY_LEX_DEBUG; return ETCL_GE; }
"==" { YY_LEX_DEBUG; return ETCL_EQ; }
"!=" { YY_LEX_DEBUG; return ETCL_NE; }
"(" { YY_LEX_DEBUG; return ETCL_LPAREN; }
")" { YY_LEX_DEBUG; return ETCL_RPAREN; }
"$" { YY_LEX_DEBUG; return ETCL_DOLLAR; }
"." { YY_LEX_DEBUG; return ETCL_DOT; }
"default" { YY_LEX_DEBUG; return ETCL_DEFAULT; }
"_d" { YY_LEX_DEBUG; return ETCL_DISCRIMINANT; }
"_type_id" { YY_LEX_DEBUG; return ETCL_TYPE_ID; }
"_repos_id" { YY_LEX_DEBUG; return ETCL_REPOS_ID; }
"_length" { YY_LEX_DEBUG; return ETCL_LENGTH; }
"[" { YY_LEX_DEBUG; return ETCL_LBRA; }
"]" { YY_LEX_DEBUG; return ETCL_RBRA; }
TRUE {
lvalp->constraint =
new ETCL_Literal_Constraint ((CORBA::Boolean) 1);
YY_LEX_DEBUG; return ETCL_BOOLEAN;
}
FALSE {
lvalp->constraint =
new ETCL_Literal_Constraint ((CORBA::Boolean) 0);
YY_LEX_DEBUG; return ETCL_BOOLEAN;
}
{integer} {
lvalp->constraint =
new ETCL_Literal_Constraint (ACE_OS::atoi (yytext));
YY_LEX_DEBUG; return ETCL_INTEGER;
}
{float} {
double v;
sscanf (yytext, "%lf", &v);
lvalp->constraint =
new ETCL_Literal_Constraint (v);
YY_LEX_DEBUG; return ETCL_FLOAT;
}
{string} {
lvalp->constraint =
new ETCL_Literal_Constraint (extract_string (yytext));
YY_LEX_DEBUG; return ETCL_STRING;
}
{ident} {
lvalp->constraint =
new ETCL_Identifier (yytext);
YY_LEX_DEBUG; return ETCL_IDENT;
}
{white_space} {
YY_LEX_DEBUG; break; // Ignore
}
. {
YY_LEX_DEBUG; break; // @@ TODO
}
%%
const char*
extract_string(char* str)
{
char *t = str;
for (char * i = str + 1; *i != '\''; ++i, ++t)
{
if (*i == '\\')
{
++i;
if (*i == 0)
return 0;
else if (*i == 't')
*t = '\t';
else if (*i == 'n')
*t = '\n';
else if (*i == '\\')
*t = '\\';
else
*t = *i;
continue;
}
*t = *i;
}
*t = '\0';
return str;
}
int
yywrap (void)
{
return 1;
}
ACE_END_VERSIONED_NAMESPACE_DECL

62
deps/acelite/ace/ETCL/ETCL.mpc vendored Normal file
View File

@@ -0,0 +1,62 @@
// -*- MPC -*-
project(ACE_ETCL) : acelib, install, ace_output {
sharedname = ACE_ETCL
dynamicflags += ACE_ETCL_BUILD_DLL
Source_Files {
ETCL_Constraint.cpp
ETCL_Constraint_Visitor.cpp
}
Header_Files {
ETCL_Constraint.h
ETCL_Constraint_Visitor.h
ace_etcl_export.h
}
Inline_Files {
ETCL_Constraint.inl
}
Template_Files {
}
Pkgconfig_Files {
ACE_ETCL.pc.in
}
specific {
install_dir = ace/ETCL
}
}
project(ACE_ETCL_Parser) : acelib, ace_etcl, install, ace_output {
sharedname = ACE_ETCL_Parser
dynamicflags += ETCL_PARSER_BUILD_DLL
Source_Files {
ETCL_Interpreter.cpp
ETCL_l.cpp
ETCL_y.cpp
}
Header_Files {
ETCL_Interpreter.h
ETCL_y.h
etcl_parser_export.h
}
Inline_Files {
}
Template_Files {
}
Pkgconfig_Files {
ACE_ETCL_Parser.pc.in
}
specific {
install_dir = ace/ETCL
}
}

269
deps/acelite/ace/ETCL/ETCL.yy vendored Normal file
View File

@@ -0,0 +1,269 @@
%{
// $Id$
// ========================================================================
//
// = LIBRARY
// orbsvcs / Extended Trader Constraint Language parser.
//
// = FILENAME
// ETCL.yy
//
// = AUTHOR
// Carlos O'Ryan <coryan@uci.edu> based on previous work by
// Seth Widoff <sbw1@cs.wustl.edu>
// Jeff Parsons <j.parsons@vanderbilt.edu>
//
// ========================================================================
#include "ace/ETCL/ETCL_y.h"
#include "ace/ETCL/ETCL_constraint.h"
#include "ace/ETCL/ETCL_Interpreter.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
extern int yylex (void);
extern void yyflush_current_buffer (void);
static void yyerror (const char *)
{
// @@ TODO
// Ignore error messages
}
ACE_END_VERSIONED_NAMESPACE_DECL
#include <stdio.h>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
%}
%token ETCL_GT
%token ETCL_GE
%token ETCL_LT
%token ETCL_LE
%token ETCL_EQ
%token ETCL_NE
%token ETCL_EXIST
%token ETCL_DEFAULT
%token ETCL_AND
%token ETCL_OR
%token ETCL_NOT
%token ETCL_IN
%token ETCL_TWIDDLE
%token ETCL_BOOLEAN
%token ETCL_PLUS
%token ETCL_MINUS
%token ETCL_MULT
%token ETCL_DIV
%token ETCL_UMINUS
%token ETCL_INTEGER
%token ETCL_FLOAT
%token ETCL_STRING
%token ETCL_RPAREN
%token ETCL_LPAREN
%token ETCL_RBRA
%token ETCL_LBRA
%token ETCL_IDENT
%token ETCL_UNSIGNED
%token ETCL_SIGNED
%token ETCL_DOUBLE
%token ETCL_CONSTRAINT
%token ETCL_COMPONENT
%token ETCL_WITH
%token ETCL_MAX
%token ETCL_MIN
%token ETCL_FIRST
%token ETCL_RANDOM
%token ETCL_DOLLAR
%token ETCL_DOT
%token ETCL_DISCRIMINANT
%token ETCL_LENGTH
%token ETCL_TYPE_ID
%token ETCL_REPOS_ID
%type <constraint> ETCL_IDENT
%type <constraint> ETCL_BOOLEAN
%type <constraint> ETCL_STRING
%type <constraint> ETCL_FLOAT
%type <constraint> ETCL_INTEGER
%type <constraint> expr_in
%type <constraint> constraint preference bool_or bool_and bool_compare
%type <constraint> expr_in expr_twiddle expr term factor_not factor
%type <constraint> union_pos union_val component_array
%type <constraint> component_array component_assoc component_pos
%type <constraint> component_dot component_ext component
%start constraint
%%
constraint: bool_or
| preference
;
preference: ETCL_MIN bool_or
{ $$ = new ETCL_PREFERENCE_CLASS (ETCL_MIN, $2); }
| ETCL_MAX bool_or
{ $$ = new ETCL_PREFERENCE_CLASS (ETCL_MAX, $2); }
| ETCL_WITH bool_or
{ $$ = new ETCL_PREFERENCE_CLASS (ETCL_WITH, $2); }
| ETCL_FIRST
{ $$ = new ETCL_PREFERENCE_CLASS (ETCL_FIRST); }
| ETCL_RANDOM
{ $$ = new ETCL_PREFERENCE_CLASS (ETCL_RANDOM); }
;
bool_or: bool_or ETCL_OR bool_and
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_OR, $1, $3); }
| bool_and
;
bool_and: bool_and ETCL_AND bool_compare
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_AND, $1, $3); }
| bool_compare
;
bool_compare: expr_in ETCL_EQ expr_in
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_EQ, $1, $3); }
| expr_in ETCL_NE expr_in
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_NE, $1, $3); }
| expr_in ETCL_GT expr_in
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_GT, $1, $3); }
| expr_in ETCL_GE expr_in
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_GE, $1, $3); }
| expr_in ETCL_LT expr_in
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_LT, $1, $3); }
| expr_in ETCL_LE expr_in
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_LE, $1, $3); }
| expr_in
;
expr_in: expr_twiddle ETCL_IN component
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_IN, $1, $3); }
| expr_twiddle ETCL_IN ETCL_DOLLAR component
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_IN, $1, $4); }
| expr_twiddle
;
expr_twiddle: expr ETCL_TWIDDLE expr
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_TWIDDLE, $1, $3); }
| expr
;
expr: expr ETCL_PLUS term
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_PLUS, $1, $3); }
| expr ETCL_MINUS term
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_MINUS, $1, $3); }
| term
;
term: term ETCL_MULT factor_not
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_MULT, $1, $3); }
| term ETCL_DIV factor_not
{ $$ = new ETCL_BINARY_EXPR_CLASS (ETCL_DIV, $1, $3); }
| factor_not
;
factor_not: ETCL_NOT factor
{ $$ = new ETCL_UNARY_EXPR_CLASS (ETCL_NOT, $2); }
| factor
;
factor: ETCL_LPAREN bool_or ETCL_RPAREN
{ $$ = $2; }
| ETCL_INTEGER
{ $$ = $1; }
| ETCL_PLUS ETCL_INTEGER
{ $$ = new ETCL_UNARY_EXPR_CLASS (ETCL_PLUS, $2); }
| ETCL_MINUS ETCL_INTEGER
{ $$ = new ETCL_UNARY_EXPR_CLASS (ETCL_MINUS, $2); }
| ETCL_FLOAT
{ $$ = $1; }
| ETCL_PLUS ETCL_FLOAT
{ $$ = new ETCL_UNARY_EXPR_CLASS (ETCL_PLUS, $2); }
| ETCL_MINUS ETCL_FLOAT
{ $$ = new ETCL_UNARY_EXPR_CLASS (ETCL_MINUS, $2); }
| ETCL_STRING
{ $$ = $1; }
| ETCL_BOOLEAN
{ $$ = $1; }
| ETCL_EXIST ETCL_IDENT
{ $$ = new ETCL_EXIST_CLASS ($2); }
| ETCL_EXIST ETCL_DOLLAR component
{ $$ = new ETCL_EXIST_CLASS ($3); }
| ETCL_DEFAULT ETCL_DOLLAR component
{ $$ = new ETCL_DEFAULT_CLASS ($3); }
| ETCL_DOLLAR component
{ $$ = new ETCL_EVAL_CLASS ($2); }
| ETCL_IDENT
{ $$ = $1; }
;
component: /* empty */
{ $$ = 0; }
| ETCL_DOT component_dot
{ $$ = new ETCL_DOT_CLASS ($2); }
| ETCL_IDENT component_ext
{ $$ = new ETCL_COMPONENT_CLASS ($1, $2); }
| component_array
| component_assoc
;
component_ext: /* empty */
{ $$ = 0; }
| ETCL_DOT component_dot
{ $$ = new ETCL_Dot ($2); }
| component_array
| component_assoc
;
component_dot: ETCL_IDENT component_ext
{ $$ = new ETCL_COMPONENT_CLASS ($1, $2); }
| ETCL_LENGTH
{ $$ = new ETCL_SPECIAL_CLASS (ETCL_LENGTH); }
| ETCL_DISCRIMINANT
{ $$ = new ETCL_SPECIAL_CLASS (ETCL_DISCRIMINANT); }
| ETCL_TYPE_ID
{ $$ = new ETCL_SPECIAL_CLASS (ETCL_TYPE_ID); }
| ETCL_REPOS_ID
{ $$ = new ETCL_SPECIAL_CLASS (ETCL_REPOS_ID); }
| component_pos
| union_pos
;
component_array: ETCL_LBRA ETCL_INTEGER ETCL_RBRA component_ext
{ $$ = new ETCL_COMPONENT_ARRAY_CLASS ($2, $4); }
;
component_assoc: ETCL_LPAREN ETCL_IDENT ETCL_RPAREN component_ext
{ $$ = new ETCL_COMPONENT_ASSOC_CLASS ($2, $4); }
;
component_pos: ETCL_INTEGER component_ext
{ $$ = new ETCL_COMPONENT_POS_CLASS ($1, $2); }
;
union_pos: ETCL_LPAREN union_val ETCL_RPAREN component_ext
{ $$ = new ETCL_UNION_POS_CLASS ($2, $4); }
;
union_val: /* empty */
{ $$ = 0; }
| ETCL_INTEGER
{ $$ = new ETCL_UNION_VALUE_CLASS (+1, $1); }
| ETCL_PLUS ETCL_INTEGER
{ $$ = new ETCL_UNION_VALUE_CLASS (+1, $2); }
| ETCL_MINUS ETCL_INTEGER
{ $$ = new ETCL_UNION_VALUE_CLASS (-1, $2); }
| ETCL_STRING
{ $$ = new ETCL_UNION_VALUE_CLASS ($1); }
;
%%
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -0,0 +1,653 @@
// -*- C++ -*-
#include "ace/ACE.h"
#include "ace/ETCL/ETCL_Constraint.h"
#include "ace/ETCL/ETCL_Constraint_Visitor.h"
#if ! defined (__ACE_INLINE__)
#include "ace/ETCL/ETCL_Constraint.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ETCL_Constraint::ETCL_Constraint (void)
{
}
ETCL_Constraint::~ETCL_Constraint (void)
{
}
int
ETCL_Constraint::accept (ETCL_Constraint_Visitor * /* visitor */)
{
return 0;
}
// ****************************************************************
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
const ETCL_Literal_Constraint & lit
)
: ETCL_Constraint(),
type_ (ACE_ETCL_UNKNOWN)
{
this->copy (lit);
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::ULong uinteger) : type_ (ACE_ETCL_UNSIGNED)
{
this->op_.uinteger_ = uinteger;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::Long integer) : type_ (ACE_ETCL_SIGNED)
{
this->op_.integer_ = integer;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::Boolean boolean
)
: type_ (ACE_ETCL_BOOLEAN)
{
this->op_.bool_ = boolean;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::Double doub) : type_ (ACE_ETCL_DOUBLE)
{
this->op_.double_ = doub;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
const char* str) : type_ (ACE_ETCL_STRING)
{
this->op_.str_ = ACE::strnew (str);
}
ETCL_Literal_Constraint::~ETCL_Literal_Constraint (void)
{
if (this->type_ == ACE_ETCL_STRING)
{
ACE::strdelete (this->op_.str_);
}
}
int
ETCL_Literal_Constraint::accept (ETCL_Constraint_Visitor* visitor)
{
return visitor->visit_literal (this);
}
Literal_Type
ETCL_Literal_Constraint::expr_type (void) const
{
return this->type_;
}
void
ETCL_Literal_Constraint::operator= (const ETCL_Literal_Constraint& co)
{
this->copy (co);
}
ETCL_Literal_Constraint::operator ACE_CDR::Boolean (void) const
{
return (this->type_ == ACE_ETCL_BOOLEAN) ? this->op_.bool_ : false;
}
ETCL_Literal_Constraint::operator ACE_CDR::ULong (void) const
{
switch (this->type_)
{
case ACE_ETCL_UNSIGNED:
return this->op_.uinteger_;
case ACE_ETCL_SIGNED:
case ACE_ETCL_INTEGER:
return
(this->op_.integer_ > 0) ? (ACE_CDR::ULong) this->op_.integer_ : 0;
case ACE_ETCL_DOUBLE:
return
(this->op_.double_ > 0) ?
((this->op_.double_ > ACE_UINT32_MAX) ?
ACE_UINT32_MAX :
(ACE_CDR::ULong) this->op_.double_)
: 0;
default:
return 0;
}
}
ETCL_Literal_Constraint::operator ACE_CDR::Long (void) const
{
switch (this->type_)
{
case ACE_ETCL_SIGNED:
case ACE_ETCL_INTEGER:
return this->op_.integer_;
case ACE_ETCL_UNSIGNED:
return
(this->op_.uinteger_ > (ACE_CDR::ULong) ACE_INT32_MAX) ?
ACE_INT32_MAX : (ACE_CDR::Long) this->op_.uinteger_;
case ACE_ETCL_DOUBLE:
return
(this->op_.double_ > 0) ?
((this->op_.double_ > ACE_INT32_MAX) ?
ACE_INT32_MAX :
(ACE_CDR::Long) this->op_.double_) :
((this->op_.double_ < ACE_INT32_MIN) ?
ACE_INT32_MIN :
(ACE_CDR::Long) this->op_.double_);
default:
return 0;
}
}
ETCL_Literal_Constraint::operator ACE_CDR::Double (void) const
{
switch (this->type_)
{
case ACE_ETCL_DOUBLE:
return this->op_.double_;
case ACE_ETCL_SIGNED:
case ACE_ETCL_INTEGER:
return (ACE_CDR::Double) this->op_.integer_;
case ACE_ETCL_UNSIGNED:
return (ACE_CDR::Double) this->op_.uinteger_;
default:
return 0.0;
}
}
ETCL_Literal_Constraint::operator const char* (void) const
{
switch (this->type_)
{
case ACE_ETCL_STRING:
return this->op_.str_;
default:
return 0;
}
}
bool
ETCL_Literal_Constraint::operator== (const ETCL_Literal_Constraint & rhs)
{
bool return_value = false;
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) == 0);
break;
case ACE_ETCL_DOUBLE:
return_value = ACE::is_equal ((ACE_CDR::Double) *this, (ACE_CDR::Double) rhs);
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return_value = (ACE_CDR::Long) *this == (ACE_CDR::Long) rhs;
break;
case ACE_ETCL_UNSIGNED:
return_value = (ACE_CDR::ULong) *this == (ACE_CDR::ULong) rhs;
break;
case ACE_ETCL_BOOLEAN:
return_value = (ACE_CDR::Boolean) *this == (ACE_CDR::Boolean) rhs;
break;
default:
break;
}
return return_value;
}
bool
ETCL_Literal_Constraint::operator< (const ETCL_Literal_Constraint & rhs)
{
bool return_value = false;
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) < 0);
break;
case ACE_ETCL_DOUBLE:
return_value = (ACE_CDR::Double) *this < (ACE_CDR::Double) rhs;
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return_value = (ACE_CDR::Long) *this < (ACE_CDR::Long) rhs;
break;
case ACE_ETCL_UNSIGNED:
return_value = (ACE_CDR::ULong) *this < (ACE_CDR::ULong) rhs;
break;
case ACE_ETCL_BOOLEAN:
return_value = (ACE_CDR::Boolean) *this < (ACE_CDR::Boolean) rhs;
break;
default:
break;
}
return return_value;
}
bool
ETCL_Literal_Constraint::operator> (const ETCL_Literal_Constraint & rhs)
{
bool return_value = false;
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) > 0);
break;
case ACE_ETCL_DOUBLE:
return_value = (ACE_CDR::Double) *this > (ACE_CDR::Double) rhs;
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return_value = (ACE_CDR::Long) *this > (ACE_CDR::Long) rhs;
break;
case ACE_ETCL_UNSIGNED:
return_value = (ACE_CDR::ULong) *this > (ACE_CDR::ULong) rhs;
break;
default:
break;
}
return return_value;
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator+ (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
ACE_CDR::Double result = (ACE_CDR::Double) *this + (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
ACE_CDR::Long result = (ACE_CDR::Long) *this + (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
ACE_CDR::ULong result = (ACE_CDR::ULong) *this + (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator- (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
ACE_CDR::Double result = (ACE_CDR::Double) *this - (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
ACE_CDR::Long result = (ACE_CDR::Long) *this - (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
ACE_CDR::ULong result = (ACE_CDR::ULong) *this - (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator* (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
ACE_CDR::Double result = (ACE_CDR::Double) *this * (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
ACE_CDR::Long result = (ACE_CDR::Long) *this * (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
ACE_CDR::ULong result = (ACE_CDR::ULong) *this * (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator/ (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
if (ACE::is_equal ((ACE_CDR::Double) rhs, 0.0))
return ETCL_Literal_Constraint ((ACE_CDR::Double) 0.0);
ACE_CDR::Double result = (ACE_CDR::Double) *this / (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
if ((ACE_CDR::Long) rhs == 0)
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
ACE_CDR::Long result = (ACE_CDR::Long) *this / (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
if ((ACE_CDR::ULong) rhs == 0)
return ETCL_Literal_Constraint ((ACE_CDR::ULong) 0);
ACE_CDR::ULong result = (ACE_CDR::ULong) *this / (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator- (void)
{
switch (this->type_)
{
case ACE_ETCL_DOUBLE:
return ETCL_Literal_Constraint (- this->op_.double_);
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return ETCL_Literal_Constraint (- this->op_.integer_);
case ACE_ETCL_UNSIGNED:
return ETCL_Literal_Constraint (- (ACE_CDR::Long) this->op_.uinteger_);
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
Literal_Type
ETCL_Literal_Constraint::widest_type (const ETCL_Literal_Constraint & rhs)
{
Literal_Type rhs_type = rhs.expr_type ();
Literal_Type return_value = rhs_type;
if (rhs_type != this->type_)
{
if (rhs_type > this->type_)
{
return_value = rhs_type;
}
else
{
return_value = this->type_;
}
}
return return_value;
}
void
ETCL_Literal_Constraint::copy (const ETCL_Literal_Constraint &lit)
{
if (this->type_ == ACE_ETCL_STRING)
{
ACE::strdelete (this->op_.str_);
}
this->type_ = lit.type_;
switch (this->type_)
{
case ACE_ETCL_STRING:
this->op_.str_ = ACE::strnew (lit.op_.str_);
break;
case ACE_ETCL_DOUBLE:
this->op_.double_ = lit.op_.double_;
break;
case ACE_ETCL_UNSIGNED:
this->op_.uinteger_ = lit.op_.uinteger_;
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
this->op_.integer_ = lit.op_.integer_;
break;
case ACE_ETCL_BOOLEAN:
this->op_.bool_ = lit.op_.bool_;
break;
default:
this->type_ = ACE_ETCL_UNKNOWN;
break;
}
}
// ****************************************************************
int
ETCL_Identifier::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_identifier (this);
}
// ****************************************************************
ETCL_Union_Value::~ETCL_Union_Value (void)
{
delete this->string_;
delete this->integer_;
}
int
ETCL_Union_Value::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_union_value (this);
}
// ****************************************************************
ETCL_Union_Pos::~ETCL_Union_Pos (void)
{
delete this->component_;
delete this->union_value_;
}
int
ETCL_Union_Pos::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_union_pos (this);
}
// ****************************************************************
ETCL_Component_Pos::~ETCL_Component_Pos (void)
{
delete this->component_;
delete this->integer_;
}
int
ETCL_Component_Pos::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_pos (this);
}
// ****************************************************************
ETCL_Component_Assoc::~ETCL_Component_Assoc (void)
{
delete this->component_;
delete this->identifier_;
}
int
ETCL_Component_Assoc::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_assoc (this);
}
// ****************************************************************
ETCL_Component_Array::~ETCL_Component_Array (void)
{
delete this->component_;
delete this->integer_;
}
int
ETCL_Component_Array::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_array (this);
}
// ****************************************************************
ETCL_Special::~ETCL_Special (void)
{}
int
ETCL_Special::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_special (this);
}
// ****************************************************************
ETCL_Component::~ETCL_Component (void)
{
delete this->component_;
delete this->identifier_;
}
int
ETCL_Component::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component (this);
}
// ****************************************************************
ETCL_Dot::~ETCL_Dot (void)
{
delete this->component_;
}
int
ETCL_Dot::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_dot (this);
}
// ****************************************************************
ETCL_Eval::~ETCL_Eval (void)
{
delete this->component_;
}
int
ETCL_Eval::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_eval (this);
}
// ****************************************************************
ETCL_Default::~ETCL_Default (void)
{
delete this->component_;
}
int
ETCL_Default::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_default (this);
}
// ****************************************************************
ETCL_Exist::~ETCL_Exist (void)
{
delete this->component_;
}
int
ETCL_Exist::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_exist (this);
}
// ****************************************************************
ETCL_Unary_Expr::~ETCL_Unary_Expr (void)
{
delete this->subexpr_;
}
int
ETCL_Unary_Expr::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_unary_expr (this);
}
// ****************************************************************
ETCL_Binary_Expr::~ETCL_Binary_Expr (void)
{
delete this->lhs_;
delete this->rhs_;
}
int
ETCL_Binary_Expr::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_binary_expr (this);
}
// ****************************************************************
ETCL_Preference::~ETCL_Preference (void)
{
delete this->subexpr_;
}
int
ETCL_Preference::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_preference (this);
}
ACE_END_VERSIONED_NAMESPACE_DECL

414
deps/acelite/ace/ETCL/ETCL_Constraint.h vendored Normal file
View File

@@ -0,0 +1,414 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Constraint.h
*
* @author Carlos O'Ryan (coryan@cs.wustl.edu)
* @author Jeff Parsons (j.parsons@vanderbilt.edu)
*/
//=============================================================================
#ifndef ACE_ETCL_CONSTRAINT_H
#define ACE_ETCL_CONSTRAINT_H
#include /**/ "ace/pre.h"
#include "ace/SString.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/CDR_Base.h"
#include "ace/ETCL/ace_etcl_export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef unsigned long Literal_Type;
class ETCL_Constraint_Visitor;
class ACE_ETCL_Export ETCL_Constraint
{
public:
/// Constructor and destructor
ETCL_Constraint (void);
virtual ~ETCL_Constraint (void);
virtual int accept (ETCL_Constraint_Visitor *visitor);
protected:
enum
{
ACE_ETCL_STRING,
ACE_ETCL_DOUBLE,
ACE_ETCL_UNSIGNED,
ACE_ETCL_SIGNED,
ACE_ETCL_INTEGER,
ACE_ETCL_BOOLEAN,
ACE_ETCL_COMPONENT,
ACE_ETCL_UNKNOWN
};
};
// ****************************************************************
class ACE_ETCL_Export ETCL_Literal_Constraint
: public ETCL_Constraint
{
public:
ETCL_Literal_Constraint (void);
// = Constructors for each of the various types of literals.
explicit ETCL_Literal_Constraint (ACE_CDR::ULong uinteger);
explicit ETCL_Literal_Constraint (ACE_CDR::Long integer);
explicit ETCL_Literal_Constraint (ACE_CDR::Boolean boolean);
explicit ETCL_Literal_Constraint (ACE_CDR::Double doub);
explicit ETCL_Literal_Constraint (const char* str);
/// Copy constructor
ETCL_Literal_Constraint (const ETCL_Literal_Constraint& lit);
/// Destructor.
virtual ~ETCL_Literal_Constraint(void);
/// Visitor accept method.
virtual int accept (ETCL_Constraint_Visitor* visitor);
Literal_Type expr_type (void) const;
/// Assignment operator.
void operator= (const ETCL_Literal_Constraint& co);
// Conversion routines.
operator ACE_CDR::Boolean (void) const;
operator ACE_CDR::ULong (void) const;
operator ACE_CDR::Long (void) const;
operator ACE_CDR::Double (void) const;
operator const char* (void) const;
// Return the type represented by this MysteryOperand.
// = Boolean operators.
bool
operator< (const ETCL_Literal_Constraint& rhs);
bool
operator<= (const ETCL_Literal_Constraint& rhs);
bool
operator> (const ETCL_Literal_Constraint& rhs);
bool
operator>= (const ETCL_Literal_Constraint& rhs);
bool
operator== (const ETCL_Literal_Constraint& rhs);
bool
operator!= (const ETCL_Literal_Constraint& rhs);
// = Arithmetic operators.
ETCL_Literal_Constraint
operator+ (const ETCL_Literal_Constraint& rhs);
ETCL_Literal_Constraint
operator- (const ETCL_Literal_Constraint& rhs);
ETCL_Literal_Constraint
operator* (const ETCL_Literal_Constraint& rhs);
ETCL_Literal_Constraint
operator/ (const ETCL_Literal_Constraint& rhs);
// Unary minus.
ETCL_Literal_Constraint
operator- (void);
/// Ensure both operands are of the same simple numeric type.
virtual Literal_Type
widest_type (const ETCL_Literal_Constraint& rhs);
protected:
/// Private copy method.
void copy (const ETCL_Literal_Constraint& co);
/// Union of the possible literal types.
union
{
char* str_;
ACE_CDR::ULong uinteger_;
ACE_CDR::Long integer_;
ACE_CDR::Boolean bool_;
ACE_CDR::Double double_;
} op_;
/// The actual types of the ETCL_Literal_Constraint.
Literal_Type type_;
};
// ****************************************************************
class ACE_ETCL_Export ETCL_Identifier : public ETCL_Constraint
{
public:
ETCL_Identifier (const char *value);
/// Get the value
const char *value (void) const;
// = The Constraint methods.
int accept (ETCL_Constraint_Visitor *visitor);
private:
/// The value
ACE_CString string_;
};
// ****************************************************************
class ACE_ETCL_Export ETCL_Union_Value : public ETCL_Constraint
{
public:
ETCL_Union_Value (int sign,
ETCL_Constraint *integer);
explicit ETCL_Union_Value (ETCL_Constraint *string = 0);
virtual ~ETCL_Union_Value (void);
int sign (void) const;
ETCL_Literal_Constraint *integer (void) const;
ETCL_Literal_Constraint *string (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
int sign_;
ETCL_Literal_Constraint *integer_;
ETCL_Literal_Constraint *string_;
};
class ACE_ETCL_Export ETCL_Union_Pos : public ETCL_Constraint
{
public:
ETCL_Union_Pos (ETCL_Constraint *union_value = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Union_Pos (void);
ETCL_Union_Value *union_value (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Union_Value *union_value_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Component_Pos : public ETCL_Constraint
{
public:
ETCL_Component_Pos (ETCL_Constraint *integer = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component_Pos (void);
ETCL_Literal_Constraint *integer (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Literal_Constraint *integer_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Component_Assoc : public ETCL_Constraint
{
public:
ETCL_Component_Assoc (ETCL_Constraint *identifier = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component_Assoc (void);
ETCL_Identifier *identifier (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Identifier *identifier_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Component_Array : public ETCL_Constraint
{
public:
ETCL_Component_Array (ETCL_Constraint *integer = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component_Array (void);
ETCL_Literal_Constraint *integer (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Literal_Constraint *integer_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Special : public ETCL_Constraint
{
public:
ETCL_Special (void);
ETCL_Special (int type);
virtual ~ETCL_Special (void);
int type (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
};
class ACE_ETCL_Export ETCL_Component : public ETCL_Constraint
{
public:
ETCL_Component (ETCL_Constraint *identifier = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component (void);
ETCL_Identifier *identifier (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Identifier *identifier_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Dot : public ETCL_Constraint
{
public:
explicit ETCL_Dot (ETCL_Constraint *component = 0);
virtual ~ETCL_Dot (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Eval : public ETCL_Constraint
{
public:
explicit ETCL_Eval (ETCL_Constraint *component = 0);
virtual ~ETCL_Eval (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Default : public ETCL_Constraint
{
public:
explicit ETCL_Default (ETCL_Constraint *component = 0);
virtual ~ETCL_Default (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Exist : public ETCL_Constraint
{
public:
explicit ETCL_Exist (ETCL_Constraint *component = 0);
virtual ~ETCL_Exist (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Unary_Expr : public ETCL_Constraint
{
public:
ETCL_Unary_Expr (int type,
ETCL_Constraint *subexpr);
virtual ~ETCL_Unary_Expr (void);
int type (void) const;
ETCL_Constraint *subexpr (void) const;
int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
ETCL_Constraint *subexpr_;
};
class ACE_ETCL_Export ETCL_Binary_Expr : public ETCL_Constraint
{
public:
ETCL_Binary_Expr (int type,
ETCL_Constraint *lhs,
ETCL_Constraint *rhs);
virtual ~ETCL_Binary_Expr (void);
int type (void) const;
ETCL_Constraint *rhs (void) const;
ETCL_Constraint *lhs (void) const;
int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
ETCL_Constraint *lhs_;
ETCL_Constraint *rhs_;
};
class ACE_ETCL_Export ETCL_Preference : public ETCL_Constraint
{
public:
ETCL_Preference (void);
ETCL_Preference (int type,
ETCL_Constraint *subexpr = 0);
virtual ~ETCL_Preference (void);
int type (void) const;
ETCL_Constraint *subexpr (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
ETCL_Constraint *subexpr_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ETCL/ETCL_Constraint.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif // ACE_ETCL_CONSTRAINT_H

View File

@@ -0,0 +1,349 @@
// -*- C++ -*-
// ****************************************************************
ACE_INLINE
ETCL_Literal_Constraint::ETCL_Literal_Constraint (void)
: type_ (ACE_ETCL_UNKNOWN)
{
}
// ****************************************************************
ACE_INLINE
ETCL_Identifier::ETCL_Identifier (const char *value)
: string_ (value)
{
}
ACE_INLINE const char *
ETCL_Identifier::value (void) const
{
return this->string_.c_str ();
}
// ****************************************************************
ACE_INLINE
ETCL_Union_Value::ETCL_Union_Value (int sign,
ETCL_Constraint *integer)
: sign_ (sign),
string_ (0)
{
this->integer_ =
dynamic_cast<ETCL_Literal_Constraint*> (integer);
}
ACE_INLINE
ETCL_Union_Value::ETCL_Union_Value (ETCL_Constraint *string)
: sign_ (0),
integer_ (0)
{
this->string_ =
dynamic_cast<ETCL_Literal_Constraint*> (string);
}
ACE_INLINE int
ETCL_Union_Value::sign (void) const
{
return this->sign_;
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Union_Value::integer (void) const
{
return this->integer_;
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Union_Value::string (void) const
{
return this->string_;
}
// ****************************************************************
ACE_INLINE
ETCL_Union_Pos::ETCL_Union_Pos (ETCL_Constraint *union_value,
ETCL_Constraint *component)
: component_ (component)
{
this->union_value_ =
dynamic_cast<ETCL_Union_Value*> (union_value);
}
ACE_INLINE ETCL_Union_Value *
ETCL_Union_Pos::union_value (void) const
{
return this->union_value_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Union_Pos::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component_Pos::ETCL_Component_Pos (
ETCL_Constraint *integer,
ETCL_Constraint *component)
: component_ (component)
{
this->integer_ =
dynamic_cast<ETCL_Literal_Constraint*> (integer);
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Component_Pos::integer (void) const
{
return this->integer_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component_Pos::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component_Assoc::ETCL_Component_Assoc (
ETCL_Constraint *identifier,
ETCL_Constraint *component)
: component_ (component)
{
this->identifier_ =
dynamic_cast<ETCL_Identifier*> (identifier);
}
ACE_INLINE ETCL_Identifier *
ETCL_Component_Assoc::identifier (void) const
{
return this->identifier_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component_Assoc::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component_Array::ETCL_Component_Array (
ETCL_Constraint *integer,
ETCL_Constraint *component)
: component_ (component)
{
this->integer_ =
dynamic_cast<ETCL_Literal_Constraint*> (integer);
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Component_Array::integer (void) const
{
return this->integer_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component_Array::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Special::ETCL_Special (void)
: type_ (0)
{}
ACE_INLINE
ETCL_Special::ETCL_Special (int type)
: type_ (type)
{}
ACE_INLINE int
ETCL_Special::type (void) const
{
return this->type_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component::ETCL_Component (ETCL_Constraint *identifier,
ETCL_Constraint *component)
: component_ (component)
{
this->identifier_ =
dynamic_cast<ETCL_Identifier*> (identifier);
}
ACE_INLINE ETCL_Identifier *
ETCL_Component::identifier (void) const
{
return this->identifier_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Dot::ETCL_Dot (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Dot::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Eval::ETCL_Eval (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Eval::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Default::ETCL_Default (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Default::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Exist::ETCL_Exist (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Exist::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Unary_Expr::ETCL_Unary_Expr (int type,
ETCL_Constraint *subexpr)
: type_ (type),
subexpr_ (subexpr)
{}
ACE_INLINE int
ETCL_Unary_Expr::type (void) const
{
return this->type_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Unary_Expr::subexpr (void) const
{
return this->subexpr_;
}
// ****************************************************************
ACE_INLINE
ETCL_Binary_Expr::ETCL_Binary_Expr (int type,
ETCL_Constraint *lhs,
ETCL_Constraint *rhs)
: type_ (type),
lhs_ (lhs),
rhs_ (rhs)
{}
ACE_INLINE int
ETCL_Binary_Expr::type (void) const
{
return this->type_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Binary_Expr::rhs (void) const
{
return this->rhs_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Binary_Expr::lhs (void) const
{
return this->lhs_;
}
// ****************************************************************
ACE_INLINE
ETCL_Preference::ETCL_Preference (void)
: type_ (0),
subexpr_ (0)
{}
ACE_INLINE
ETCL_Preference::ETCL_Preference (int type,
ETCL_Constraint *subexpr)
: type_ (type),
subexpr_ (subexpr)
{}
ACE_INLINE int
ETCL_Preference::type (void) const
{
return this->type_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Preference::subexpr (void) const
{
return this->subexpr_;
}
ACE_INLINE bool
ETCL_Literal_Constraint::operator!= (const ETCL_Literal_Constraint & rhs)
{
return !(*this == rhs);
}
ACE_INLINE bool
ETCL_Literal_Constraint::operator<= (const ETCL_Literal_Constraint & rhs)
{
return !(*this > rhs);
}
ACE_INLINE bool
ETCL_Literal_Constraint::operator>= (const ETCL_Literal_Constraint & rhs)
{
return !(*this < rhs);
}

View File

@@ -0,0 +1,119 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Constraint_Visitor.cpp
*
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
#include "ace/ETCL/ETCL_Constraint_Visitor.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ETCL_Constraint_Visitor::ETCL_Constraint_Visitor (void)
{
}
ETCL_Constraint_Visitor::~ETCL_Constraint_Visitor (void)
{
}
int
ETCL_Constraint_Visitor::visit_literal (ETCL_Literal_Constraint *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_identifier (ETCL_Identifier *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_union_value (ETCL_Union_Value *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_union_pos (ETCL_Union_Pos *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component_pos (ETCL_Component_Pos *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component_assoc (ETCL_Component_Assoc *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component_array (ETCL_Component_Array *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_special (ETCL_Special *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component (ETCL_Component *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_dot (ETCL_Dot *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_eval (ETCL_Eval *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_default (ETCL_Default *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_exist (ETCL_Exist *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_unary_expr (ETCL_Unary_Expr *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_binary_expr (ETCL_Binary_Expr *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_preference (ETCL_Preference *)
{
return 0;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -0,0 +1,69 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Constraint_Visitor.h
*
* @author Carlos O'Ryan <coryan@cs.wustl.edu>
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
#ifndef ACE_ETCL_CONSTRAINT_VISITOR_H
#define ACE_ETCL_CONSTRAINT_VISITOR_H
#include /**/ "ace/pre.h"
#include "ace/ETCL/ace_etcl_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ETCL_Literal_Constraint;
class ETCL_Identifier;
class ETCL_Union_Value;
class ETCL_Union_Pos;
class ETCL_Component_Pos;
class ETCL_Component_Assoc;
class ETCL_Component_Array;
class ETCL_Special;
class ETCL_Component;
class ETCL_Dot;
class ETCL_Eval;
class ETCL_Default;
class ETCL_Exist;
class ETCL_Unary_Expr;
class ETCL_Binary_Expr;
class ETCL_Preference;
class ACE_ETCL_Export ETCL_Constraint_Visitor
{
public:
ETCL_Constraint_Visitor (void);
virtual ~ETCL_Constraint_Visitor (void);
virtual int visit_literal (ETCL_Literal_Constraint *);
virtual int visit_identifier (ETCL_Identifier *);
virtual int visit_union_value (ETCL_Union_Value *);
virtual int visit_union_pos (ETCL_Union_Pos *);
virtual int visit_component_pos (ETCL_Component_Pos *);
virtual int visit_component_assoc (ETCL_Component_Assoc *);
virtual int visit_component_array (ETCL_Component_Array *);
virtual int visit_special (ETCL_Special *);
virtual int visit_component (ETCL_Component *);
virtual int visit_dot (ETCL_Dot *);
virtual int visit_eval (ETCL_Eval *);
virtual int visit_default (ETCL_Default *);
virtual int visit_exist (ETCL_Exist *);
virtual int visit_unary_expr (ETCL_Unary_Expr *);
virtual int visit_binary_expr (ETCL_Binary_Expr *);
virtual int visit_preference (ETCL_Preference *);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif // ACE_ETCL_CONSTRAINT_VISITOR_H

View File

@@ -0,0 +1,111 @@
// -*- C++ -*-
#include "ace/Guard_T.h"
#include "ace/Truncate.h"
#include "ace/ETCL/ETCL_Interpreter.h"
#include "ace/ETCL/ETCL_Constraint.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ETCL_Parser_Export ACE_SYNCH_MUTEX ETCL_Interpreter::parserMutex__;
ETCL_Interpreter::ETCL_Interpreter (void)
: root_ (0)
{
}
ETCL_Interpreter::~ETCL_Interpreter (void)
{
delete this->root_;
}
int
ETCL_Interpreter::build_tree (const char* constraints)
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
guard,
ETCL_Interpreter::parserMutex__,
-1);
Lex_String_Input::reset ((char*)constraints);
yyval.constraint = 0;
int return_value = ::yyparse ();
if (return_value == 0 && yyval.constraint != 0)
{
this->root_ = yyval.constraint;
}
else
{
this->root_ = 0;
}
return return_value;
}
int
ETCL_Interpreter::is_empty_string (const char* str)
{
int return_value = 0;
if (str != 0)
{
int i = 0;
while (str[i] != '\0')
{
if (str[i] != ' ')
{
break;
}
++i;
}
if (str[i] == '\0')
{
return_value = 1;
}
}
return return_value;
}
char* Lex_String_Input::string_ = 0;
char* Lex_String_Input::current_ = 0;
char* Lex_String_Input::end_ = 0;
// Routine to have Lex read its input from the constraint string.
int
Lex_String_Input::copy_into (char* buf,
int max_size)
{
int const chars_left =
ACE_Utils::truncate_cast<int> (
Lex_String_Input::end_ - Lex_String_Input::current_);
int const n = max_size > chars_left ? chars_left : max_size;
if (n > 0)
{
ACE_OS::memcpy (buf,
Lex_String_Input::current_,
n);
Lex_String_Input::current_ += n;
}
return n;
}
void
Lex_String_Input::reset (char* input_string)
{
Lex_String_Input::string_ = input_string;
Lex_String_Input::current_ = input_string;
Lex_String_Input::end_ =
input_string + ACE_OS::strlen (Lex_String_Input::string_);
}
ACE_END_VERSIONED_NAMESPACE_DECL

115
deps/acelite/ace/ETCL/ETCL_Interpreter.h vendored Normal file
View File

@@ -0,0 +1,115 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Interpreter.h
*
* @author Jeff Parsons <parsons@cs.wustl.edu> based on previous work by
* @author Seth Widoff <sbw1@cs.wustl.edu>
*/
//=============================================================================
#ifndef ETCL_INTERPRETER_H
#define ETCL_INTERPRETER_H
#include /**/ "ace/pre.h"
#include "ace/Thread_Mutex.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Synch_Traits.h"
#include "etcl_parser_export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ETCL_Constraint;
ACE_END_VERSIONED_NAMESPACE_DECL
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ETCL_Interpreter
*
* @brief ETCL_Interpreter is the superclass for all ETCL interpreters.
* Its build tree method invokes the yacc parser to parse a constraint
* or preference string.
*/
class ETCL_Parser_Export ETCL_Interpreter
{
protected:
// = Initialization and termination methods.
/// Constructor.
ETCL_Interpreter (void);
/// Destructor.
virtual ~ETCL_Interpreter (void);
/// Using the Yacc generated parser, construct an expression tree
/// representing @a constraints from the tokens returned by it.
int build_tree (const char* constraints);
static int is_empty_string (const char* str);
/// The root of the expression tree, not equal to null if build_tree
/// successfully builds a tree from the constraints.
ETCL_Constraint* root_;
private:
/// This mutex protects the <build_tree> method from reentrance.
static ACE_SYNCH_MUTEX parserMutex__;
};
// Functions we need for parsing.
extern int yyparse (void);
extern void yyrestart (FILE*);
extern int yylex (void);
// Have yylex read from the constraint string, not from stdin.
#undef YY_INPUT
#define YY_INPUT(b, r, ms) (r = Lex_String_Input::copy_into(b, ms))
/**
* @class Lex_String_Input
*
* @brief Have Lex read from a string and not from stdin. Essentially,
* the interpreter needs to call yylex() until EOF, and call
* TAO_Lex_String_Input::reset() with the new string, prior to
* calling yyparse.
*/
class Lex_String_Input
{
public:
/// Reset the lex input.
static void reset (char* input_string);
/// Method lex will call to read from the input string.
static int copy_into (char* buf, int max_size);
private:
/// Pointers to keep track of the input string.
static char* string_;
static char* current_;
static char* end_;
};
/// The union used by lex and bison to build the Abstract Syntax Tree.
typedef union
{
ACE_VERSIONED_NAMESPACE_NAME::ETCL_Constraint* constraint;
} YYSTYPE;
extern YYSTYPE yylval;
extern YYSTYPE yyval;
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif // ETCL_INTERPRETER_H

1875
deps/acelite/ace/ETCL/ETCL_l.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

1286
deps/acelite/ace/ETCL/ETCL_y.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

44
deps/acelite/ace/ETCL/ETCL_y.h vendored Normal file
View File

@@ -0,0 +1,44 @@
#define ETCL_GT 257
#define ETCL_GE 258
#define ETCL_LT 259
#define ETCL_LE 260
#define ETCL_EQ 261
#define ETCL_NE 262
#define ETCL_EXIST 263
#define ETCL_DEFAULT 264
#define ETCL_AND 265
#define ETCL_OR 266
#define ETCL_NOT 267
#define ETCL_IN 268
#define ETCL_TWIDDLE 269
#define ETCL_BOOLEAN 270
#define ETCL_PLUS 271
#define ETCL_MINUS 272
#define ETCL_MULT 273
#define ETCL_DIV 274
#define ETCL_UMINUS 275
#define ETCL_INTEGER 276
#define ETCL_FLOAT 277
#define ETCL_STRING 278
#define ETCL_RPAREN 279
#define ETCL_LPAREN 280
#define ETCL_RBRA 281
#define ETCL_LBRA 282
#define ETCL_IDENT 283
#define ETCL_UNSIGNED 284
#define ETCL_SIGNED 285
#define ETCL_DOUBLE 286
#define ETCL_CONSTRAINT 287
#define ETCL_COMPONENT 288
#define ETCL_WITH 289
#define ETCL_MAX 290
#define ETCL_MIN 291
#define ETCL_FIRST 292
#define ETCL_RANDOM 293
#define ETCL_DOLLAR 294
#define ETCL_DOT 295
#define ETCL_DISCRIMINANT 296
#define ETCL_LENGTH 297
#define ETCL_TYPE_ID 298
#define ETCL_REPOS_ID 299

39
deps/acelite/ace/ETCL/ace_etcl_export.h vendored Normal file
View File

@@ -0,0 +1,39 @@
// -*- C++ -*-
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl
// ------------------------------
#ifndef ACE_ETCL_EXPORT_H
#define ACE_ETCL_EXPORT_H
#include "ace/config-all.h"
#if defined (ACE_AS_STATIC_LIBS)
# if !defined (ACE_ETCL_HAS_DLL)
# define ACE_ETCL_HAS_DLL 0
# endif /* ! ACE_ETCL_HAS_DLL */
#else
# if !defined (ACE_ETCL_HAS_DLL)
# define ACE_ETCL_HAS_DLL 1
# endif /* ! ACE_ETCL_HAS_DLL */
#endif
#if defined (ACE_ETCL_HAS_DLL) && (ACE_ETCL_HAS_DLL == 1)
# if defined (ACE_ETCL_BUILD_DLL)
# define ACE_ETCL_Export ACE_Proper_Export_Flag
# define ACE_ETCL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# else /* ACE_ETCL_BUILD_DLL */
# define ACE_ETCL_Export ACE_Proper_Import_Flag
# define ACE_ETCL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* ACE_ETCL_BUILD_DLL */
#else /* ACE_ETCL_HAS_DLL == 1 */
# define ACE_ETCL_Export
# define ACE_ETCL_SINGLETON_DECLARATION(T)
# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_ETCL_HAS_DLL == 1 */
#endif /* ACE_ETCL_EXPORT_H */
// End of auto generated file.

View File

@@ -0,0 +1,39 @@
// -*- C++ -*-
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl
// ------------------------------
#ifndef ETCL_PARSER_EXPORT_H
#define ETCL_PARSER_EXPORT_H
#include "ace/config-all.h"
#if defined (ACE_AS_STATIC_LIBS)
# if !defined (ETCL_PARSER_HAS_DLL)
# define ETCL_PARSER_HAS_DLL 0
# endif /* ! ETCL_PARSER_HAS_DLL */
#else
# if !defined (ETCL_PARSER_HAS_DLL)
# define ETCL_PARSER_HAS_DLL 1
# endif /* ! ETCL_PARSER_HAS_DLL */
#endif
#if defined (ETCL_PARSER_HAS_DLL) && (ETCL_PARSER_HAS_DLL == 1)
# if defined (ETCL_PARSER_BUILD_DLL)
# define ETCL_Parser_Export ACE_Proper_Export_Flag
# define ETCL_PARSER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# else /* ETCL_PARSER_BUILD_DLL */
# define ETCL_Parser_Export ACE_Proper_Import_Flag
# define ETCL_PARSER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* ETCL_PARSER_BUILD_DLL */
#else /* ETCL_PARSER_HAS_DLL == 1 */
# define ETCL_Parser_Export
# define ETCL_PARSER_SINGLETON_DECLARATION(T)
# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ETCL_PARSER_HAS_DLL == 1 */
#endif /* ETCL_PARSER_EXPORT_H */
// End of auto generated file.