return x; } <?php $gContent .= ob_get_clean(); ?> ////////////// // Operators // all operators defined by C++ <?php return array('kind' => 'TYPE', "system_headers" => array("cstdlib", "cstdio", "cinttypes", 'limits'), "complex" => false, "global_content" => $gContent, 'binary_operators' => ['+', '-', '*', '/', '%', '==', '!=', '>', '<', '>=', '<='], 'unary_operators' => ['+', '-'], 'constructors' => $constructors, 'functions' => $functions, 'properties' => ['integral', 'numeric', '_primative_', 'clusterable'], 'describe_json' => DescribeJson('integer'), 'extras' => ['size.bytes' => 4]); } declareOperator('//', ['base::INT', 'base::INT'], function ($args) { $l = lookupType('base::INT'); return ['kind' => 'OPERATOR', 'name' => '/', 'input' => [$l, $l], 'result' => $l, 'deterministic' => true]; }); // Define the constructors from the various other types. foreach (['BYTE', 'SMALLINT', 'INT', 'BIGINT', 'FLOAT', 'DOUBLE'] as $type) { $fullType = 'base::' . $type; $call = function ($args, $targs = []) use($fullType) { $arg = lookupType($fullType); $ret = lookupType('base::INT'); return array('kind' => 'FUNCTION', 'input' => [$arg], 'result' => $ret, 'deterministic' => true); }; declareFunctionGlobal('base', 'INT', [$fullType], $call); } declareSynonym('BASE::INTEGER', 'BASE::INT');
; } <?php $gContent .= ob_get_clean(); ?> ////////////// // Operators // all operators defined by C++ <?php return array('kind' => 'TYPE', "system_headers" => array("cstdlib", "cstdio", "cinttypes", 'limits'), "complex" => false, "global_content" => $gContent, 'binary_operators' => ['+', '-', '*', '/', '%', '==', '!=', '>', '<', '>=', '<='], 'unary_operators' => ['+', '-'], 'constructors' => $constructors, 'functions' => $functions, 'properties' => ['integral', 'numeric', '_primative_'], 'describe_json' => DescribeJson('integer'), 'extras' => ['size.bytes' => 2]); } declareOperator('//', ['base::SMALLINT', 'base::SMALLINT'], function ($args) { $l = lookupType('base::SMALLINT'); return ['kind' => 'OPERATOR', 'name' => '/', 'input' => [$l, $l], 'result' => $l, 'deterministic' => true]; }); // Define the constructors from the various other types. foreach (['BYTE', 'SMALLINT', 'INT', 'BIGINT', 'FLOAT', 'DOUBLE'] as $type) { $fullType = 'base::' . $type; $call = function ($args, $targs = []) use($fullType) { $arg = lookupType($fullType); $ret = lookupType('base::SMALLINT'); return array('kind' => 'FUNCTION', 'input' => [$arg], 'result' => $ret, 'deterministic' => true); }; declareFunctionGlobal('base', 'SMALLINT', [$fullType], $call); } declareSynonym("base::SMALL", "base::SMALLINT");
} #ifdef _HAS_STD_HASH #include <functional> // C++11 STL-Compliant hash struct specialization namespace std { template <> class hash<@type> { size_t operator () (const @type & key) const { return Hash( key ); } }; } #endif // _HAS_STD_HASH <?php $gContent .= ob_get_clean(); ?> <?php return array('kind' => 'TYPE', "system_headers" => array("cstring", "cinttypes", 'iostream', 'cstdlib', 'string'), "user_headers" => array("HashFunctions.h", "Constants.h", "Config.h", "Errors.h", "ColumnVarIterator.h"), "complex" => "ColumnVarIterator< @type >", "global_content" => $gContent, 'binary_operators' => ['==', '!=', '>', '<', '>=', '<='], 'constructors' => $constructors, 'methods' => $methods, 'functions' => $functions, 'fixed_size' => false, 'describe_json' => DescribeJson('string'), 'properties' => ['string']); } // end of function declareSynonym("base::VARCHAR", "base::STRING"); ?>