FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
generateOMEtypesOps.cpp File Reference
#include <iostream>
#include <fstream>
#include <set>
#include <OMEmanifests.h>

Macros

#define TYPE_BIT(n)   (1 << (n))
 
#define SMALL_INTEGERS
 
#define LARGE_INTEGERS   (TYPE_BIT(OME_INT64) | TYPE_BIT(OME_UINT64))
 
#define ALL_INTEGERS   (SMALL_INTEGERS | LARGE_INTEGERS)
 
#define ALL_INTEGERS_OR_ANY   (SMALL_INTEGERS | LARGE_INTEGERS | TYPE_BIT(OME_ANY))
 
#define ALL_FLOATS   (TYPE_BIT(OME_FLOAT) | TYPE_BIT(OME_DOUBLE))
 
#define ALL_NATIVE_NUMBERS   (ALL_INTEGERS | ALL_FLOATS)
 
#define ALL_NATIVE_NUMBERS_OR_ANY   (ALL_INTEGERS | ALL_FLOATS | TYPE_BIT(OME_ANY))
 
#define ALL_NUMERICS   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_FIXED))
 
#define ALL_NUMERICS_OR_ANY   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_FIXED) | TYPE_BIT(OME_ANY))
 
#define ALL_CONTAINERS   (TYPE_BIT(OME_ARRAY) | TYPE_BIT(OME_ASSOC) | TYPE_BIT(OME_SET))
 
#define NUMBERS_AND_STRINGS   (ALL_NUMERICS | TYPE_BIT(OME_STRING))
 
#define NATIVE_NUMBERS_AND_STRINGS   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_STRING))
 
#define NUMBERS_AND_STRINGS_OR_ANY   (ALL_NUMERICS | TYPE_BIT(OME_STRING) | TYPE_BIT(OME_ANY))
 
#define NATIVE_NUMBERS_AND_STRINGS_OR_ANY   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_STRING) | TYPE_BIT(OME_ANY))
 
#define NUMBERS_AND_SETS   (ALL_NUMERICS | TYPE_BIT(OME_SET))
 
#define NATIVE_NUMBERS_AND_SETS   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_SET))
 
#define NUMBERS_AND_SETS_OR_ANY   (ALL_NUMERICS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))
 
#define NATIVE_NUMBERS_AND_SETS_OR_ANY   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))
 
#define NUMBERS_STRINGS_AND_SETS   (NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET))
 
#define NATIVE_NUMBERS_STRINGS_AND_SETS   (NATIVE_NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET))
 
#define NUMBERS_STRINGS_SETS_OR_ANY   (NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))
 
#define NATIVE_NUMBERS_STRINGS_SETS_OR_ANY   (NATIVE_NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))
 
#define INTEGERS_AND_SETS   (ALL_INTEGERS | TYPE_BIT(OME_SET))
 
#define INTEGERS_AND_SETS_OR_ANY   (ALL_INTEGERS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))
 
#define ANY_OMETYPE   TYPE_BIT(OME_ANY)
 
#define EVERYTHING   (~static_cast<uint32_t>(0))
 
#define IS_OMETYPE(n)   (((n) == TYPE_BIT(OME_NIL)) || ((n) == TYPE_BIT(OME_ANY)))
 
#define IS_NATIVE_TYPE(n)   ((n) &ALL_NATIVE_NUMBERS)
 

Functions

const char * promotedType (const struct opDescription *op, const struct typeDescription *leftType, const struct typeDescription *rightType)
 
uint32_t isLegalFunction (const char *opText, uint32_t leftType, uint32_t rightType)
 
uint32_t findPermittedTypes (const legalOperandTypes *t, const uint32_t findType)
 
uint32_t isPermittedOperand (const opDescription *opDesc, const typeDescription *leftTypeDesc, const typeDescription *rightTypeDesc)
 
promotionResult promoteIfNeeded (const opDescription *opDesc, const typeDescription *left, const typeDescription *right, bool leftIsOMEtype, bool rightIsOMEtype)
 
void outputCompareOp (const opDescription *opDesc, typeDescription *leftType, typeDescription *rightType)
 
const char * makeVarName (char *bfr, bool isInstanceVar, bool isOMEtype, const char *baseName, const char *qualifier, const char *suffix, bool isExtendedType=false)
 
const char * LEFT_VAR (const char *leftArgName, const char *altName)
 
void doBinaryOp (const opDescription *opDesc, const char *resultType, typeDescription *leftArgType, typeDescription *rightArgType, bool doMemberFunction)
 
void doRelativeOp (const opDescription *opDesc, const char *resultType)
 
void doUnaryOp (const opDescription *opDesc)
 
void emitUtilityRoutines ()
 
int main (int argc, const char *argv[])
 

Variables

std::ofstream hdrFile
 
std::ofstream srcFile
 
struct legalOperandTypes numericTypes []
 
struct legalOperandTypes onlyIntegerTypes []
 
struct legalOperandTypes numberAndStringTypes []
 
struct legalOperandTypes plusTypes []
 
struct legalOperandTypes setTypes []
 
struct legalOperandTypes logicalBitwiseTypes []
 
struct legalOperandTypes allSameContainerTypes []
 
struct typeDescription typeList []
 
struct opDescription relativeOperatorList []
 
struct opDescription binaryMathOperatorList []
 
struct opDescription unaryMathOperatorList []
 

Macro Definition Documentation

◆ ALL_CONTAINERS

#define ALL_CONTAINERS   (TYPE_BIT(OME_ARRAY) | TYPE_BIT(OME_ASSOC) | TYPE_BIT(OME_SET))

◆ ALL_FLOATS

#define ALL_FLOATS   (TYPE_BIT(OME_FLOAT) | TYPE_BIT(OME_DOUBLE))

◆ ALL_INTEGERS

#define ALL_INTEGERS   (SMALL_INTEGERS | LARGE_INTEGERS)

◆ ALL_INTEGERS_OR_ANY

#define ALL_INTEGERS_OR_ANY   (SMALL_INTEGERS | LARGE_INTEGERS | TYPE_BIT(OME_ANY))

◆ ALL_NATIVE_NUMBERS

#define ALL_NATIVE_NUMBERS   (ALL_INTEGERS | ALL_FLOATS)

◆ ALL_NATIVE_NUMBERS_OR_ANY

#define ALL_NATIVE_NUMBERS_OR_ANY   (ALL_INTEGERS | ALL_FLOATS | TYPE_BIT(OME_ANY))

◆ ALL_NUMERICS

#define ALL_NUMERICS   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_FIXED))

◆ ALL_NUMERICS_OR_ANY

#define ALL_NUMERICS_OR_ANY   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_FIXED) | TYPE_BIT(OME_ANY))

◆ ANY_OMETYPE

#define ANY_OMETYPE   TYPE_BIT(OME_ANY)

◆ EVERYTHING

#define EVERYTHING   (~static_cast<uint32_t>(0))

◆ INTEGERS_AND_SETS

#define INTEGERS_AND_SETS   (ALL_INTEGERS | TYPE_BIT(OME_SET))

◆ INTEGERS_AND_SETS_OR_ANY

#define INTEGERS_AND_SETS_OR_ANY   (ALL_INTEGERS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))

◆ IS_NATIVE_TYPE

#define IS_NATIVE_TYPE (   n)    ((n) &ALL_NATIVE_NUMBERS)

◆ IS_OMETYPE

#define IS_OMETYPE (   n)    (((n) == TYPE_BIT(OME_NIL)) || ((n) == TYPE_BIT(OME_ANY)))

◆ LARGE_INTEGERS

#define LARGE_INTEGERS   (TYPE_BIT(OME_INT64) | TYPE_BIT(OME_UINT64))

◆ NATIVE_NUMBERS_AND_SETS

#define NATIVE_NUMBERS_AND_SETS   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_SET))

◆ NATIVE_NUMBERS_AND_SETS_OR_ANY

#define NATIVE_NUMBERS_AND_SETS_OR_ANY   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))

◆ NATIVE_NUMBERS_AND_STRINGS

#define NATIVE_NUMBERS_AND_STRINGS   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_STRING))

◆ NATIVE_NUMBERS_AND_STRINGS_OR_ANY

#define NATIVE_NUMBERS_AND_STRINGS_OR_ANY   (ALL_NATIVE_NUMBERS | TYPE_BIT(OME_STRING) | TYPE_BIT(OME_ANY))

◆ NATIVE_NUMBERS_STRINGS_AND_SETS

#define NATIVE_NUMBERS_STRINGS_AND_SETS   (NATIVE_NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET))

◆ NATIVE_NUMBERS_STRINGS_SETS_OR_ANY

#define NATIVE_NUMBERS_STRINGS_SETS_OR_ANY   (NATIVE_NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))

◆ NUMBERS_AND_SETS

#define NUMBERS_AND_SETS   (ALL_NUMERICS | TYPE_BIT(OME_SET))

◆ NUMBERS_AND_SETS_OR_ANY

#define NUMBERS_AND_SETS_OR_ANY   (ALL_NUMERICS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))

◆ NUMBERS_AND_STRINGS

#define NUMBERS_AND_STRINGS   (ALL_NUMERICS | TYPE_BIT(OME_STRING))

◆ NUMBERS_AND_STRINGS_OR_ANY

#define NUMBERS_AND_STRINGS_OR_ANY   (ALL_NUMERICS | TYPE_BIT(OME_STRING) | TYPE_BIT(OME_ANY))

◆ NUMBERS_STRINGS_AND_SETS

#define NUMBERS_STRINGS_AND_SETS   (NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET))

◆ NUMBERS_STRINGS_SETS_OR_ANY

#define NUMBERS_STRINGS_SETS_OR_ANY   (NUMBERS_AND_STRINGS | TYPE_BIT(OME_SET) | TYPE_BIT(OME_ANY))

◆ SMALL_INTEGERS

#define SMALL_INTEGERS

◆ TYPE_BIT

#define TYPE_BIT (   n)    (1 << (n))

Function Documentation

◆ doBinaryOp()

void doBinaryOp ( const opDescription *  opDesc,
const char *  resultType,
typeDescription *  leftArgType,
typeDescription *  rightArgType,
bool  doMemberFunction 
)

◆ doRelativeOp()

void doRelativeOp ( const opDescription *  opDesc,
const char *  resultType 
)

◆ doUnaryOp()

void doUnaryOp ( const opDescription *  opDesc)

◆ emitUtilityRoutines()

void emitUtilityRoutines ( )

References srcFile.

Referenced by main().

◆ findPermittedTypes()

uint32_t findPermittedTypes ( const legalOperandTypes *  t,
const uint32_t  findType 
)

Referenced by doBinaryOp().

◆ isLegalFunction()

uint32_t isLegalFunction ( const char *  opText,
uint32_t  leftType,
uint32_t  rightType 
)

◆ isPermittedOperand()

uint32_t isPermittedOperand ( const opDescription *  opDesc,
const typeDescription *  leftTypeDesc,
const typeDescription *  rightTypeDesc 
)

Referenced by doBinaryOp().

◆ LEFT_VAR()

const char* LEFT_VAR ( const char *  leftArgName,
const char *  altName 
)

◆ main()

◆ makeVarName()

const char* makeVarName ( char *  bfr,
bool  isInstanceVar,
bool  isOMEtype,
const char *  baseName,
const char *  qualifier,
const char *  suffix,
bool  isExtendedType = false 
)

Referenced by doBinaryOp().

◆ outputCompareOp()

void outputCompareOp ( const opDescription *  opDesc,
typeDescription *  leftType,
typeDescription *  rightType 
)

◆ promotedType()

const char* promotedType ( const struct opDescription *  op,
const struct typeDescription *  leftType,
const struct typeDescription *  rightType 
)

Referenced by doUnaryOp().

◆ promoteIfNeeded()

promotionResult promoteIfNeeded ( const opDescription *  opDesc,
const typeDescription *  left,
const typeDescription *  right,
bool  leftIsOMEtype,
bool  rightIsOMEtype 
)

References OME_FIXED, OME_SET, srcFile, and TYPE_BIT.

Referenced by doBinaryOp().

Variable Documentation

◆ allSameContainerTypes

◆ binaryMathOperatorList

struct opDescription binaryMathOperatorList[]
Initial value:
= {
{{"+"}, {"plus"}, {""}, 0,
{{"-"}, {"subtract"}, {""}, 0,
{{"*"}, {"multiply"}, {""}, 0,
{{"/"}, {"divide"}, {""}, 0,
{{"%"}, {"modulo"}, {""}, 0,
{{"&"}, {"logical-and"}, {""}, 0,
{{"|"}, {"logical-or"}, {""}, 0,
{{"^"}, {"logical-xor"}, {""}, 0,
{{""}, {""}, {""}, 0, 0, nullptr, 0, 0}}

Referenced by main().

◆ hdrFile

std::ofstream hdrFile

Referenced by doBinaryOp(), doRelativeOp(), and main().

◆ logicalBitwiseTypes

struct legalOperandTypes logicalBitwiseTypes[]
Initial value:

◆ numberAndStringTypes

struct legalOperandTypes numberAndStringTypes[]

◆ numericTypes

struct legalOperandTypes numericTypes[]
Initial value:
= {
{0, 0}}

◆ onlyIntegerTypes

struct legalOperandTypes onlyIntegerTypes[]
Initial value:
= {
{0, 0}}

◆ plusTypes

struct legalOperandTypes plusTypes[]

◆ relativeOperatorList

struct opDescription relativeOperatorList[]
Initial value:
= {
{{"=="}, {"equals"}, {"false"}, 0,
{{"!="}, {"not-equals"}, {"true"}, 0,
{{"<"}, {"less-than"}, {""}, 0,
{{"<="}, {"less-than-equals"}, {""}, 0,
{{">"}, {"greater-than"}, {""}, 0,
{{">="}, {"greater-than-equals"}, {""}, 0,
{{""}, {""}, {""}, 0, 0, nullptr, 0, 0}
}

Referenced by main().

◆ setTypes

struct legalOperandTypes setTypes[]

◆ srcFile

std::ofstream srcFile

◆ typeList

struct typeDescription typeList[]
Initial value:
= {
{{"OMEtype"}, {"OME_ANY"}, {""}, {""}, 0, 0, 0, 0, 0, TYPE_BIT(OME_ANY)},
{{"OMEtype"}, {"OME_NIL"}, {""}, {""}, 0, 0, 0, 0, 0, TYPE_BIT(OME_NIL)},
{{"int32_t"}, {"OME_INT32"}, {""}, {"i"}, 4, 1, 0, 1, 0, TYPE_BIT(OME_INT32)},
{{"int64_t"}, {"OME_INT64"}, {""}, {"i64"}, 8, 1, 0, 1, 1, TYPE_BIT(OME_INT64)},
{{"uint64_t"}, {"OME_UINT64"}, {""}, {"ui64"}, 8, 1, 0, 0, 1, TYPE_BIT(OME_UINT64)},
{{"uint32_t"}, {"OME_UINT32"}, {""}, {"ui"}, 4, 1, 0, 0, 0, TYPE_BIT(OME_UINT32)},
{{"uint16_t"}, {"OME_UINT16"}, {""}, {"ui"}, 2, 1, 0, 0, 0, TYPE_BIT(OME_UINT16)},
{{"uint8_t"}, {"OME_UINT8"}, {""}, {"ui"}, 1, 1, 0, 0, 0, TYPE_BIT(OME_UINT8)},
{{"float"}, {"OME_FLOAT"}, {""}, {"f"}, 4, 0, 1, 1, 0, TYPE_BIT(OME_FLOAT)},
{{"double"}, {"OME_DOUBLE"}, {""}, {"df"}, 8, 0, 1, 1, 1, TYPE_BIT(OME_DOUBLE)},
{{"OMEfixed"}, {"OME_FIXED"}, {"*"}, {"fixed"}, 8, 0, 0, 1, 4, TYPE_BIT(OME_FIXED)},
{{"OMEoid"}, {"OME_OID"}, {"*"}, {"oid"}, 8, 0, 0, 0, 4, TYPE_BIT(OME_OID)},
{{"OMEstring"}, {"OME_STRING"}, {"*"}, {"s"}, 8, 0, 0, 0, 4, TYPE_BIT(OME_STRING)},
{{"OMEarray"}, {"OME_ARRAY"}, {"*"}, {"arrayPtr"}, 8, 0, 0, 0, 4, TYPE_BIT(OME_ARRAY)},
{{"OMEassoc"}, {"OME_ASSOC"}, {"*"}, {"assoc"}, 8, 0, 0, 0, 4, TYPE_BIT(OME_ASSOC)},
{{"OMEset"}, {"OME_SET"}, {"*"}, {"set"}, 8, 0, 0, 0, 4, TYPE_BIT(OME_SET)},
{{"OMEnlm"}, {"OME_NLM"}, {"*"}, {"nlm"}, 8, 0, 0, 0, 4, TYPE_BIT(OME_NLM)},
{{""}, {""}, {""}, {""}, 0, 0, 0, 0, 0, 0}}

Referenced by doBinaryOp(), doRelativeOp(), and doUnaryOp().

◆ unaryMathOperatorList

struct opDescription unaryMathOperatorList[]
Initial value:
= {
{{"+="}, {"plus-equals"}, {""}, 1,
{{"-="}, {"minus-equals"}, {""}, 1,
{{"&="}, {"and-equals"}, {""}, 1,
{{"|="}, {"or-equals"}, {""}, 1,
{{"*="}, {"times-equals"}, {""}, 1,
{{"/="}, {"divide-equals"}, {""}, 1,
{{"%="}, {"modulo-equals"}, {""}, 1,
{{"^="}, {"xor-equals"}, {""}, 1,
{{""}, {""}, {""}, 0, 0, nullptr, 0, 0}
}

Referenced by main().

NUMBERS_AND_STRINGS_OR_ANY
#define NUMBERS_AND_STRINGS_OR_ANY
Definition: generateOMEtypesOps.cpp:37
OME_NLM
@ OME_NLM
Definition: OMEmanifests.h:90
OME_FLOAT
@ OME_FLOAT
Definition: OMEmanifests.h:82
NATIVE_NUMBERS_AND_SETS_OR_ANY
#define NATIVE_NUMBERS_AND_SETS_OR_ANY
Definition: generateOMEtypesOps.cpp:47
OME_UINT16
@ OME_UINT16
Definition: OMEmanifests.h:98
onlyIntegerTypes
struct legalOperandTypes onlyIntegerTypes[]
Definition: generateOMEtypesOps.cpp:113
NUMBERS_AND_SETS_OR_ANY
#define NUMBERS_AND_SETS_OR_ANY
Definition: generateOMEtypesOps.cpp:45
ALL_NATIVE_NUMBERS_OR_ANY
#define ALL_NATIVE_NUMBERS_OR_ANY
Definition: generateOMEtypesOps.cpp:25
NUMBERS_STRINGS_SETS_OR_ANY
#define NUMBERS_STRINGS_SETS_OR_ANY
Definition: generateOMEtypesOps.cpp:53
OME_DOUBLE
@ OME_DOUBLE
Definition: OMEmanifests.h:83
OME_UINT32
@ OME_UINT32
Definition: OMEmanifests.h:96
EVERYTHING
#define EVERYTHING
Definition: generateOMEtypesOps.cpp:63
plusTypes
struct legalOperandTypes plusTypes[]
Definition: generateOMEtypesOps.cpp:123
OME_STRING
@ OME_STRING
Definition: OMEmanifests.h:85
logicalBitwiseTypes
struct legalOperandTypes logicalBitwiseTypes[]
Definition: generateOMEtypesOps.cpp:138
OME_NIL
@ OME_NIL
Definition: OMEmanifests.h:78
TYPE_BIT
#define TYPE_BIT(n)
Definition: generateOMEtypesOps.cpp:9
setTypes
struct legalOperandTypes setTypes[]
Definition: generateOMEtypesOps.cpp:131
OME_OID
@ OME_OID
Definition: OMEmanifests.h:84
allSameContainerTypes
struct legalOperandTypes allSameContainerTypes[]
Definition: generateOMEtypesOps.cpp:144
numericTypes
struct legalOperandTypes numericTypes[]
Definition: generateOMEtypesOps.cpp:109
OME_UINT64
@ OME_UINT64
Definition: OMEmanifests.h:97
ALL_NUMERICS
#define ALL_NUMERICS
Definition: generateOMEtypesOps.cpp:27
NATIVE_NUMBERS_STRINGS_SETS_OR_ANY
#define NATIVE_NUMBERS_STRINGS_SETS_OR_ANY
Definition: generateOMEtypesOps.cpp:55
ALL_INTEGERS_OR_ANY
#define ALL_INTEGERS_OR_ANY
Definition: generateOMEtypesOps.cpp:19
OME_SET
@ OME_SET
Definition: OMEmanifests.h:89
OME_UINT8
@ OME_UINT8
Definition: OMEmanifests.h:99
ALL_NUMERICS_OR_ANY
#define ALL_NUMERICS_OR_ANY
Definition: generateOMEtypesOps.cpp:29
OME_FIXED
@ OME_FIXED
Definition: OMEmanifests.h:91
ALL_INTEGERS
#define ALL_INTEGERS
Definition: generateOMEtypesOps.cpp:17
OME_ANY
@ OME_ANY
Definition: OMEmanifests.h:93
numberAndStringTypes
struct legalOperandTypes numberAndStringTypes[]
Definition: generateOMEtypesOps.cpp:117
OME_ARRAY
@ OME_ARRAY
Definition: OMEmanifests.h:86
OME_ASSOC
@ OME_ASSOC
Definition: OMEmanifests.h:87
OME_INT32
@ OME_INT32
Definition: OMEmanifests.h:79
OME_INT64
@ OME_INT64
Definition: OMEmanifests.h:81
Generated: Tue Jul 28 2020 16:03:26
Support Information