From ee17821a2e2ab539cf44cc7ea39cdf51c94af2fa Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Tue, 2 Jun 2020 17:08:48 +0800 Subject: [PATCH] fix tars proto, overflow bug --- servant/tup/Tars.h | 2950 ++++++++++++++++---------------- tools/tarsgrammar/tars.tab.cpp | 266 +-- tools/tarsparse/tars.lex.cpp | 36 +- tools/tarsparse/tars.tab.cpp | 266 +-- 4 files changed, 1762 insertions(+), 1756 deletions(-) diff --git a/servant/tup/Tars.h b/servant/tup/Tars.h index 9414887..5774742 100755 --- a/servant/tup/Tars.h +++ b/servant/tup/Tars.h @@ -37,9 +37,9 @@ //支持iphone #ifdef __APPLE__ - #include "TarsType.h" +#include "TarsType.h" #elif defined ANDROID // android - #include "TarsType.h" +#include "TarsType.h" #else #include "tup/TarsType.h" #endif @@ -355,293 +355,299 @@ do { \ namespace tars { ////////////////////////////////////////////////////////////////// - struct TarsStructBase - { - protected: - TarsStructBase() {} +struct TarsStructBase +{ +protected: + TarsStructBase() {} - ~TarsStructBase() {} - }; + ~TarsStructBase() {} +}; - struct TarsProtoException : public std::runtime_error - { - TarsProtoException(const std::string& s) : std::runtime_error(s) {} - }; +struct TarsProtoException : public std::runtime_error +{ + TarsProtoException(const std::string& s) : std::runtime_error(s) {} +}; - struct TarsEncodeException : public TarsProtoException - { - TarsEncodeException(const std::string& s) : TarsProtoException(s) {} - }; +struct TarsEncodeException : public TarsProtoException +{ + TarsEncodeException(const std::string& s) : TarsProtoException(s) {} +}; - struct TarsDecodeException : public TarsProtoException - { - TarsDecodeException(const std::string& s) : TarsProtoException(s) {} - }; +struct TarsDecodeException : public TarsProtoException +{ + TarsDecodeException(const std::string& s) : TarsProtoException(s) {} +}; - struct TarsDecodeMismatch : public TarsDecodeException - { - TarsDecodeMismatch(const std::string & s) : TarsDecodeException(s) {} - }; +struct TarsDecodeMismatch : public TarsDecodeException +{ + TarsDecodeMismatch(const std::string & s) : TarsDecodeException(s) {} +}; - struct TarsDecodeRequireNotExist : public TarsDecodeException - { - TarsDecodeRequireNotExist(const std::string & s) : TarsDecodeException(s) {} - }; +struct TarsDecodeRequireNotExist : public TarsDecodeException +{ + TarsDecodeRequireNotExist(const std::string & s) : TarsDecodeException(s) {} +}; - struct TarsDecodeInvalidValue : public TarsDecodeException - { - TarsDecodeInvalidValue(const std::string & s) : TarsDecodeException(s) {} - }; +struct TarsDecodeInvalidValue : public TarsDecodeException +{ + TarsDecodeInvalidValue(const std::string & s) : TarsDecodeException(s) {} +}; - struct TarsNotEnoughBuff : public TarsProtoException - { - TarsNotEnoughBuff(const std::string & s) : TarsProtoException(s) {} - }; +struct TarsNotEnoughBuff : public TarsProtoException +{ + TarsNotEnoughBuff(const std::string & s) : TarsProtoException(s) {} +}; ////////////////////////////////////////////////////////////////// - namespace - { - /// 数据头信息的封装,包括类型和tag - class DataHead - { - uint8_t _type; - uint8_t _tag; - public: - enum - { - eChar = 0, - eShort = 1, - eInt32 = 2, - eInt64 = 3, - eFloat = 4, - eDouble = 5, - eString1 = 6, - eString4 = 7, - eMap = 8, - eList = 9, - eStructBegin = 10, - eStructEnd = 11, - eZeroTag = 12, - eSimpleList = 13, - }; +namespace +{ +/// 数据头信息的封装,包括类型和tag +class DataHead +{ + uint8_t _type; + uint8_t _tag; +public: + enum + { + eChar = 0, + eShort = 1, + eInt32 = 2, + eInt64 = 3, + eFloat = 4, + eDouble = 5, + eString1 = 6, + eString4 = 7, + eMap = 8, + eList = 9, + eStructBegin = 10, + eStructEnd = 11, + eZeroTag = 12, + eSimpleList = 13, + }; - #pragma pack(1) - struct helper - { - uint8_t type : 4; - uint8_t tag : 4; - }; - #pragma pack() - public: - DataHead() : _type(0), _tag(0) {} - DataHead(uint8_t type, uint8_t tag) : _type(type), _tag(tag) {} +#pragma pack(1) + struct helper + { + uint8_t type : 4; + uint8_t tag : 4; + }; +#pragma pack() +public: + DataHead() : _type(0), _tag(0) {} + DataHead(uint8_t type, uint8_t tag) : _type(type), _tag(tag) {} - uint8_t getTag() const { return _tag;} - void setTag(uint8_t t) { _tag = t;} - uint8_t getType() const { return _type;} - void setType(uint8_t t) { _type = t;} + uint8_t getTag() const { return _tag;} + void setTag(uint8_t t) { _tag = t;} + uint8_t getType() const { return _type;} + void setType(uint8_t t) { _type = t;} - /// 读取数据头信息 - template - void readFrom(InputStreamT& is) - { - size_t n = peekFrom(is); - is.skip(n); - } + /// 读取数据头信息 + template + void readFrom(InputStreamT& is) + { + size_t n = peekFrom(is); + is.skip(n); + } - /// 读取头信息,但不前移流的偏移量 - template - size_t peekFrom(InputStreamT& is) - { - helper h; - size_t n = sizeof(h); - is.peekBuf(&h, sizeof(h)); - _type = h.type; - if (h.tag == 15) - { - is.peekBuf(&_tag, sizeof(_tag), sizeof(h)); - n += sizeof(_tag); - } - else - { - _tag = h.tag; - } - return n; - } + /// 读取头信息,但不前移流的偏移量 + template + size_t peekFrom(InputStreamT& is) + { + helper h; + size_t n = sizeof(h); + is.peekBuf(&h, sizeof(h)); + _type = h.type; + if (h.tag == 15) + { + is.peekBuf(&_tag, sizeof(_tag), sizeof(h)); + n += sizeof(_tag); + } + else + { + _tag = h.tag; + } + return n; + } - /// 写入数据头信息 - template - void writeTo(OutputStreamT& os) - { - /* - helper h; - h.type = _type; - if(_tag < 15){ - h.tag = _tag; - os.writeBuf(&h, sizeof(h)); - }else{ - h.tag = 15; - os.writeBuf(&h, sizeof(h)); - os.writeBuf(&_tag, sizeof(_tag)); - } - */ - writeTo(os, _type, _tag); - } + /// 写入数据头信息 + template + void writeTo(OutputStreamT& os) + { + /* + helper h; + h.type = _type; + if(_tag < 15){ + h.tag = _tag; + os.writeBuf(&h, sizeof(h)); + }else{ + h.tag = 15; + os.writeBuf(&h, sizeof(h)); + os.writeBuf(&_tag, sizeof(_tag)); + } + */ + writeTo(os, _type, _tag); + } - /// 写入数据头信息 - template - static void writeTo(OutputStreamT& os, uint8_t type, uint8_t tag) - { - helper h; - h.type = type; - if (tag < 15) - { - h.tag = tag; - os.writeBuf((const char *)&h, sizeof(h)); - } - else - { - h.tag = 15; - os.writeBuf((const char *)&h, sizeof(h)); - os.writeBuf((const char *)&tag, sizeof(tag)); - } - } - }; - } + /// 写入数据头信息 + template + static void writeTo(OutputStreamT& os, uint8_t type, uint8_t tag) + { + helper h; + h.type = type; + if (tag < 15) + { + h.tag = tag; + os.writeBuf((const char *)&h, sizeof(h)); + } + else + { + h.tag = 15; + os.writeBuf((const char *)&h, sizeof(h)); + os.writeBuf((const char *)&tag, sizeof(tag)); + } + } +}; +} ////////////////////////////////////////////////////////////////// /// 缓冲区读取器封装 - class BufferReader - { - private: - BufferReader(const BufferReader&); +class BufferReader +{ +private: + BufferReader(const BufferReader&); - BufferReader& operator=(const BufferReader&); + BufferReader& operator=(const BufferReader&); - public: - const char * _buf; ///< 缓冲区 - size_t _buf_len; ///< 缓冲区长度 - size_t _cur; ///< 当前位置 +public: + const char * _buf; ///< 缓冲区 + size_t _buf_len; ///< 缓冲区长度 + size_t _cur; ///< 当前位置 - public: +public: - BufferReader() : _buf(NULL),_buf_len(0),_cur(0) {} + BufferReader() : _buf(NULL),_buf_len(0),_cur(0) {} - void reset() { _cur = 0;} + void reset() { _cur = 0;} - /// 读取缓存 - void readBuf(void * buf, size_t len) - { - if(len <= _buf_len && (_cur + len) <= _buf_len) - { - peekBuf(buf, len); - _cur += len; - } - else - { - char s[64]; - snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); - throw TarsDecodeException(s); - } - } + /// 读取缓存 + void readBuf(void * buf, size_t len) + { + if(len <= _buf_len && (_cur + len) <= _buf_len) + { + peekBuf(buf, len); + _cur += len; + } + else + { + char s[64]; + snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); + throw TarsDecodeException(s); + } + } - /// 读取缓存,但不改变偏移量 - void peekBuf(void * buf, size_t len, size_t offset = 0) - { - if (_cur + offset + len > _buf_len) - { - char s[64]; - snprintf(s, sizeof(s), "buffer overflow when peekBuf, over %u.", (uint32_t)_buf_len); - throw TarsDecodeException(s); - } - ::memcpy(buf, _buf + _cur + offset, len); - } + /// 读取缓存,但不改变偏移量 + void peekBuf(void * buf, size_t len, size_t offset = 0) + { + if (_cur + offset + len > _buf_len) + { + char s[64]; + snprintf(s, sizeof(s), "buffer overflow when peekBuf, over %u.", (uint32_t)_buf_len); + throw TarsDecodeException(s); + } + ::memcpy(buf, _buf + _cur + offset, len); + } - /// 读取缓存 for vector - template - void readBuf(std::vector& v, size_t len) - { - if(len <= _buf_len && (_cur + len) <= _buf_len) - { - peekBuf(v, len); - _cur += len; - } - else - { - char s[64]; - snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); - throw TarsDecodeException(s); - } - } + /// 读取缓存 for vector + template + void readBuf(std::vector& v, size_t len) + { + if(len <= _buf_len && (_cur + len) <= _buf_len) + { + peekBuf(v, len); + _cur += len; + } + else + { + char s[64]; + snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); + throw TarsDecodeException(s); + } + } - /// 读取缓存,但不改变偏移量 for vector - template - void peekBuf(std::vector& v, size_t len, size_t offset = 0) - { - if (_cur + offset + len > _buf_len) - { - char s[64]; - snprintf(s, sizeof(s), "buffer overflow when peekBuf, over %u.", (uint32_t)_buf_len); - throw TarsDecodeException(s); - } + /// 读取缓存,但不改变偏移量 for vector + template + void peekBuf(std::vector& v, size_t len, size_t offset = 0) + { + if (_cur + offset + len > _buf_len) + { + char s[64]; + snprintf(s, sizeof(s), "buffer overflow when peekBuf, over %u.", (uint32_t)_buf_len); + throw TarsDecodeException(s); + } - const char* begin = _buf + _cur + offset; - v.assign(begin, begin + len); - } + const char* begin = _buf + _cur + offset; + v.assign(begin, begin + len); + } - /// 跳过len个字节 - void skip(size_t len) - { - if(len <= _buf_len && (_cur + len) <= _buf_len) - { - _cur += len; - } - else - { - char s[64]; - snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); - throw TarsDecodeException(s); - } - } + /// 跳过len个字节 + void skip(size_t len) + { + if(len <= _buf_len && (_cur + len) <= _buf_len) + { + _cur += len; + } + else + { + char s[64]; + snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); + throw TarsDecodeException(s); + } + } - /// 设置缓存 - void setBuffer(const char * buf, size_t len) - { - _buf = buf; - _buf_len = len; - _cur = 0; - } + /// 设置缓存 + void setBuffer(const char * buf, size_t len) + { + _buf = buf; + _buf_len = len; + _cur = 0; + } - /// 设置缓存 - template - void setBuffer(const std::vector &buf) - { - _buf = buf.data(); - _buf_len = buf.size(); - _cur = 0; - } + /// 设置缓存 + template + void setBuffer(const std::vector &buf) + { + _buf = buf.data(); + _buf_len = buf.size(); + _cur = 0; + } - /** - * 判断是否已经到BUF的末尾 - */ - bool hasEnd() - { - return _cur >= _buf_len; - } - size_t tellp() const - { - return _cur; - } - const char* base() const - { - return _buf; - } - size_t size() const - { - return _buf_len; - } - }; + /** + * 判断是否已经到BUF的末尾 + */ + bool hasEnd() + { + if(_cur > _buf_len) + { + char s[64]; + snprintf(s, sizeof(s), "buffer overflow when skip, over %u.", (uint32_t)_buf_len); + throw TarsDecodeException(s); + } + return _cur >= _buf_len; + } + size_t tellp() const + { + return _cur; + } + const char* base() const + { + return _buf; + } + size_t size() const + { + return _buf_len; + } +}; //当tars文件中含有指针型类型的数据用MapBufferReader读取 //在读数据时利用MapBufferReader提前分配的内存 减少运行过程中频繁内存分配 @@ -649,1320 +655,1320 @@ namespace tars //byte *m; //指针类型使用时需要MapBufferReader提前设定预分配内存块setMapBuffer(), //指针需要内存时通过偏移指向预分配内存块,减少解码过程中的内存申请 - class MapBufferReader : public BufferReader - { +class MapBufferReader : public BufferReader +{ - public: - MapBufferReader() : _buf_m(NULL),_buf_len_m(0),_cur_m(0) {} +public: + MapBufferReader() : _buf_m(NULL),_buf_len_m(0),_cur_m(0) {} - void reset() { _cur_m = 0; BufferReader::reset();} + void reset() { _cur_m = 0; BufferReader::reset();} - char* cur() - { - if (tars_unlikely(_buf_m == NULL)) - { - char s[64]; - snprintf(s, sizeof(s), "MapBufferReader's buff not set,_buf = null"); - throw TarsDecodeException(s); - } - return _buf_m+_cur_m; - } + char* cur() + { + if (tars_unlikely(_buf_m == NULL)) + { + char s[64]; + snprintf(s, sizeof(s), "MapBufferReader's buff not set,_buf = null"); + throw TarsDecodeException(s); + } + return _buf_m+_cur_m; + } - size_t left(){return _buf_len_m-_cur_m;} + size_t left(){return _buf_len_m-_cur_m;} - /// 跳过len个字节 - void mapBufferSkip(size_t len) - { - if (tars_unlikely(_cur_m + len > _buf_len_m)) - { - char s[64]; - snprintf(s, sizeof(s), "MapBufferReader's buffer overflow when peekBuf, over %u.", (uint32_t)_buf_len_m); - throw TarsDecodeException(s); - } - _cur_m += len; - } + /// 跳过len个字节 + void mapBufferSkip(size_t len) + { + if (tars_unlikely(_cur_m + len > _buf_len_m)) + { + char s[64]; + snprintf(s, sizeof(s), "MapBufferReader's buffer overflow when peekBuf, over %u.", (uint32_t)_buf_len_m); + throw TarsDecodeException(s); + } + _cur_m += len; + } - /// 设置缓存 - void setMapBuffer(char * buf, size_t len) - { - _buf_m = buf; - _buf_len_m = len; - _cur_m = 0; - } + /// 设置缓存 + void setMapBuffer(char * buf, size_t len) + { + _buf_m = buf; + _buf_len_m = len; + _cur_m = 0; + } - /// 设置缓存 - template - void setMapBuffer(std::vector &buf) - { - _buf_m = buf.data(); - _buf_len_m = buf.size(); - _cur_m = 0; - } - public: - char * _buf_m; ///< 缓冲区 - size_t _buf_len_m; ///< 缓冲区长度 - size_t _cur_m; ///< 当前位置 - }; + /// 设置缓存 + template + void setMapBuffer(std::vector &buf) + { + _buf_m = buf.data(); + _buf_len_m = buf.size(); + _cur_m = 0; + } +public: + char * _buf_m; ///< 缓冲区 + size_t _buf_len_m; ///< 缓冲区长度 + size_t _cur_m; ///< 当前位置 +}; ////////////////////////////////////////////////////////////////// /// 缓冲区写入器封装 - class BufferWriter - { - public: - char * _buf; - size_t _len; - size_t _buf_len; - std::function _reserve = BufferWriter::reserve; //扩展空间 +class BufferWriter +{ +public: + char * _buf; + size_t _len; + size_t _buf_len; + std::function _reserve = BufferWriter::reserve; //扩展空间 - static char* reserve(BufferWriter &os, size_t len) - { - char * p = new char[(len)]; - memcpy(p, (os)._buf, (os)._len); - delete[] (os)._buf; - return p; - } + static char* reserve(BufferWriter &os, size_t len) + { + char * p = new char[(len)]; + memcpy(p, (os)._buf, (os)._len); + delete[] (os)._buf; + return p; + } - private: - BufferWriter(const BufferWriter & bw); - BufferWriter& operator=(const BufferWriter& buf); +private: + BufferWriter(const BufferWriter & bw); + BufferWriter& operator=(const BufferWriter& buf); - public: - BufferWriter() - : _buf(NULL) - , _len(0) - , _buf_len(0) - {} - ~BufferWriter() - { - delete[] _buf; - } +public: + BufferWriter() + : _buf(NULL) + , _len(0) + , _buf_len(0) + {} + ~BufferWriter() + { + delete[] _buf; + } - void reset() { _len = 0;} - void writeBuf(const char * buf, size_t len) - { - TarsReserveBuf(*this, _len + len); - memcpy(_buf + _len, buf, len); - _len += len; - } - std::vector getByteBuffer() const { return std::vector(_buf, _buf + _len);} - const char * getBuffer() const { return _buf;}//{ return &_buf[0]; } - size_t getLength() const { return _len;} //{ return _buf.size(); } - void swap(std::vector& v) { v.assign(_buf, _buf + _len); } - void swap(std::string& v) { v.assign(_buf, _len); } - void swap(BufferWriter& buf) - { - std::swap(_buf, buf._buf); - std::swap(_buf_len, buf._buf_len); - std::swap(_len, buf._len); - } - }; + void reset() { _len = 0;} + void writeBuf(const char * buf, size_t len) + { + TarsReserveBuf(*this, _len + len); + memcpy(_buf + _len, buf, len); + _len += len; + } + std::vector getByteBuffer() const { return std::vector(_buf, _buf + _len);} + const char * getBuffer() const { return _buf;}//{ return &_buf[0]; } + size_t getLength() const { return _len;} //{ return _buf.size(); } + void swap(std::vector& v) { v.assign(_buf, _buf + _len); } + void swap(std::string& v) { v.assign(_buf, _len); } + void swap(BufferWriter& buf) + { + std::swap(_buf, buf._buf); + std::swap(_buf_len, buf._buf_len); + std::swap(_len, buf._len); + } +}; /////////////////////////////////////////////////////////////////////////////////////////////////// /// 实际buffer是std::string /// 可以swap, 把buffer交换出来, 避免一次内存copy - class BufferWriterString - { - protected: - mutable std::string _buffer; - char * _buf; - size_t _len; - size_t _buf_len; - std::function _reserve; +class BufferWriterString +{ +protected: + mutable std::string _buffer; + char * _buf; + size_t _len; + size_t _buf_len; + std::function _reserve; - private: - //不让copy 复制 - BufferWriterString(const BufferWriterString&); - BufferWriterString& operator=(const BufferWriterString& buf); +private: + //不让copy 复制 + BufferWriterString(const BufferWriterString&); + BufferWriterString& operator=(const BufferWriterString& buf); - public: - BufferWriterString() - : _buf(NULL) - , _len(0) - , _buf_len(0) - { +public: + BufferWriterString() + : _buf(NULL) + , _len(0) + , _buf_len(0) + { #ifndef GEN_PYTHON_MASK - //内存分配器 - _reserve = [](BufferWriterString &os, size_t len) { - os._buffer.resize(len); - return (char*)os._buffer.data(); - } ; + //内存分配器 + _reserve = [](BufferWriterString &os, size_t len) { + os._buffer.resize(len); + return (char*)os._buffer.data(); + } ; #endif - } + } - ~BufferWriterString() - { - } + ~BufferWriterString() + { + } - void reset() { _len = 0;} + void reset() { _len = 0;} - void writeBuf(const char * buf, size_t len) - { - TarsReserveBuf(*this, _len + len); - memcpy(_buf + _len, buf, len); - _len += len; - } + void writeBuf(const char * buf, size_t len) + { + TarsReserveBuf(*this, _len + len); + memcpy(_buf + _len, buf, len); + _len += len; + } - const std::string &getByteBuffer() const { _buffer.resize(_len); return _buffer;} - std::string &getByteBuffer() { _buffer.resize(_len); return _buffer;} - const char * getBuffer() const { return _buf;} - size_t getLength() const { return _len;} - void swap(std::string& v) - { - _buffer.resize(_len); - v.swap(_buffer); - _buf = NULL; - _buf_len = 0; - _len = 0; - } - void swap(std::vector& v) - { - _buffer.resize(_len); - v.assign(_buffer.c_str(), _buffer.c_str() + _buffer.size()); - _buf = NULL; - _buf_len = 0; - _len = 0; - } - void swap(BufferWriterString& buf) - { - buf._buffer.swap(_buffer); - std::swap(_buf, buf._buf); - std::swap(_buf_len, buf._buf_len); - std::swap(_len, buf._len); - } - }; + const std::string &getByteBuffer() const { _buffer.resize(_len); return _buffer;} + std::string &getByteBuffer() { _buffer.resize(_len); return _buffer;} + const char * getBuffer() const { return _buf;} + size_t getLength() const { return _len;} + void swap(std::string& v) + { + _buffer.resize(_len); + v.swap(_buffer); + _buf = NULL; + _buf_len = 0; + _len = 0; + } + void swap(std::vector& v) + { + _buffer.resize(_len); + v.assign(_buffer.c_str(), _buffer.c_str() + _buffer.size()); + _buf = NULL; + _buf_len = 0; + _len = 0; + } + void swap(BufferWriterString& buf) + { + buf._buffer.swap(_buffer); + std::swap(_buf, buf._buf); + std::swap(_buf_len, buf._buf_len); + std::swap(_len, buf._len); + } +}; /// 实际buffer是std::vector /// 可以swap, 把buffer交换出来, 避免一次内存copy - class BufferWriterVector - { - protected: - mutable std::vector _buffer; - char * _buf; - size_t _len; - size_t _buf_len; - std::function _reserve; +class BufferWriterVector +{ +protected: + mutable std::vector _buffer; + char * _buf; + size_t _len; + size_t _buf_len; + std::function _reserve; - private: - //不让copy 复制 - BufferWriterVector(const BufferWriterVector&); - BufferWriterVector& operator=(const BufferWriterVector& buf); +private: + //不让copy 复制 + BufferWriterVector(const BufferWriterVector&); + BufferWriterVector& operator=(const BufferWriterVector& buf); - public: - BufferWriterVector() - : _buf(NULL) - , _len(0) - , _buf_len(0) - { +public: + BufferWriterVector() + : _buf(NULL) + , _len(0) + , _buf_len(0) + { #ifndef GEN_PYTHON_MASK - //内存分配器 - _reserve = [](BufferWriterVector &os, size_t len) { - os._buffer.resize(len); - return os._buffer.data(); - } ; + //内存分配器 + _reserve = [](BufferWriterVector &os, size_t len) { + os._buffer.resize(len); + return os._buffer.data(); + } ; #endif - } + } - ~BufferWriterVector() - { - } + ~BufferWriterVector() + { + } - void reset() { _len = 0;} + void reset() { _len = 0;} - void writeBuf(const char * buf, size_t len) - { - TarsReserveBuf(*this, _len + len); - memcpy(_buf + _len, buf, len); - _len += len; - } + void writeBuf(const char * buf, size_t len) + { + TarsReserveBuf(*this, _len + len); + memcpy(_buf + _len, buf, len); + _len += len; + } - const std::vector &getByteBuffer() const { _buffer.resize(_len); return _buffer;} - std::vector &getByteBuffer() { _buffer.resize(_len); return _buffer;} - const char * getBuffer() const { return _buf;} - size_t getLength() const { return _len;} - void swap(std::string& v) - { - _buffer.resize(_len); - v.assign(_buffer.data(), _buffer.size()); - _buf = NULL; - _buf_len = 0; - _len = 0; - } - void swap(std::vector& v) - { - _buffer.resize(_len); - v.swap(_buffer); - _buf = NULL; - _buf_len = 0; - _len = 0; - } - void swap(BufferWriterVector& buf) - { - buf._buffer.swap(_buffer); - std::swap(_buf, buf._buf); - std::swap(_buf_len, buf._buf_len); - std::swap(_len, buf._len); - } - }; + const std::vector &getByteBuffer() const { _buffer.resize(_len); return _buffer;} + std::vector &getByteBuffer() { _buffer.resize(_len); return _buffer;} + const char * getBuffer() const { return _buf;} + size_t getLength() const { return _len;} + void swap(std::string& v) + { + _buffer.resize(_len); + v.assign(_buffer.data(), _buffer.size()); + _buf = NULL; + _buf_len = 0; + _len = 0; + } + void swap(std::vector& v) + { + _buffer.resize(_len); + v.swap(_buffer); + _buf = NULL; + _buf_len = 0; + _len = 0; + } + void swap(BufferWriterVector& buf) + { + buf._buffer.swap(_buffer); + std::swap(_buf, buf._buf); + std::swap(_buf_len, buf._buf_len); + std::swap(_len, buf._len); + } +}; ////////////////////////////////////////////////////////////////// - template - class TarsInputStream : public ReaderT - { - public: +template +class TarsInputStream : public ReaderT +{ +public: - /// 跳到指定标签的元素前 - bool skipToTag(uint8_t tag) - { - try - { - uint8_t headType = 0, headTag = 0; - while (!ReaderT::hasEnd()) - { - size_t len = 0; - TarsPeekFromHead(*this, headType, headTag, len); - if (tag <= headTag || headType == TarsHeadeStructEnd) - return headType == TarsHeadeStructEnd?false:(tag == headTag); - TarsReadHeadSkip(*this, len); - skipField(headType); - } - } - catch (TarsDecodeException& e) - { - } - return false; - } + /// 跳到指定标签的元素前 + bool skipToTag(uint8_t tag) + { + try + { + uint8_t headType = 0, headTag = 0; + while (!ReaderT::hasEnd()) + { + size_t len = 0; + TarsPeekFromHead(*this, headType, headTag, len); + if (tag <= headTag || headType == TarsHeadeStructEnd) + return headType == TarsHeadeStructEnd?false:(tag == headTag); + TarsReadHeadSkip(*this, len); + skipField(headType); + } + } + catch (TarsDecodeException& e) + { + } + return false; + } - /// 跳到当前结构的结束 - void skipToStructEnd() - { - uint8_t headType = 0; - do - { - readFromHeadNoTag(*this, headType); - skipField(headType); - }while (headType != TarsHeadeStructEnd); - } + /// 跳到当前结构的结束 + void skipToStructEnd() + { + uint8_t headType = 0; + do + { + readFromHeadNoTag(*this, headType); + skipField(headType); + }while (headType != TarsHeadeStructEnd); + } - /// 跳过一个字段 - void skipField() - { - uint8_t headType = 0; - readFromHeadNoTag(*this, headType); - skipField(headType); - } + /// 跳过一个字段 + void skipField() + { + uint8_t headType = 0; + readFromHeadNoTag(*this, headType); + skipField(headType); + } - /// 跳过一个字段,不包含头信息 - void skipField(uint8_t type) - { - switch (type) - { - case TarsHeadeChar: - TarsReadHeadSkip(*this, sizeof(Char)); - break; - case TarsHeadeShort: - TarsReadHeadSkip(*this, sizeof(Short)); - break; - case TarsHeadeInt32: - TarsReadHeadSkip(*this, sizeof(Int32)); - break; - case TarsHeadeInt64: - TarsReadHeadSkip(*this, sizeof(Int64)); - break; - case TarsHeadeFloat: - TarsReadHeadSkip(*this, sizeof(Float)); - break; - case TarsHeadeDouble: - TarsReadHeadSkip(*this, sizeof(Double)); - break; - case TarsHeadeString1: - { - size_t len = 0; - TarsReadTypeBuf(*this, len, uint8_t); - TarsReadHeadSkip(*this, len); - } - break; - case TarsHeadeString4: - { - size_t len = 0; - TarsReadTypeBuf(*this, len, uint32_t); - len = ntohl((uint32_t)len); - TarsReadHeadSkip(*this, len); - } - break; - case TarsHeadeMap: - { - Int32 size = 0; - read(size, 0); - for (Int32 i = 0; i < size * 2; ++i) - skipField(); - } - break; - case TarsHeadeList: - { - Int32 size = 0; - read(size, 0); - for (Int32 i = 0; i < size; ++i) - skipField(); - } - break; - case TarsHeadeSimpleList: - { - uint8_t headType = 0, headTag = 0; - readFromHead(*this, headType, headTag); - if (tars_unlikely(headType != TarsHeadeChar)) - { - char s[64]; - snprintf(s, sizeof(s), "skipField with invalid type, type value: %d, %d, %d.", type, headType, headTag); - throw TarsDecodeMismatch(s); - } - Int32 size = 0; - read(size, 0); - TarsReadHeadSkip(*this, size); - } - break; - case TarsHeadeStructBegin: - skipToStructEnd(); - break; - case TarsHeadeStructEnd: - case TarsHeadeZeroTag: - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "skipField with invalid type, type value:%d.", type); - throw TarsDecodeMismatch(s); - } - } - } + /// 跳过一个字段,不包含头信息 + void skipField(uint8_t type) + { + switch (type) + { + case TarsHeadeChar: + TarsReadHeadSkip(*this, sizeof(Char)); + break; + case TarsHeadeShort: + TarsReadHeadSkip(*this, sizeof(Short)); + break; + case TarsHeadeInt32: + TarsReadHeadSkip(*this, sizeof(Int32)); + break; + case TarsHeadeInt64: + TarsReadHeadSkip(*this, sizeof(Int64)); + break; + case TarsHeadeFloat: + TarsReadHeadSkip(*this, sizeof(Float)); + break; + case TarsHeadeDouble: + TarsReadHeadSkip(*this, sizeof(Double)); + break; + case TarsHeadeString1: + { + size_t len = 0; + TarsReadTypeBuf(*this, len, uint8_t); + TarsReadHeadSkip(*this, len); + } + break; + case TarsHeadeString4: + { + size_t len = 0; + TarsReadTypeBuf(*this, len, uint32_t); + len = ntohl((uint32_t)len); + TarsReadHeadSkip(*this, len); + } + break; + case TarsHeadeMap: + { + UInt32 size = 0; + read(size, 0); + for (Int32 i = 0; i < size * 2; ++i) + skipField(); + } + break; + case TarsHeadeList: + { + UInt32 size = 0; + read(size, 0); + for (Int32 i = 0; i < size; ++i) + skipField(); + } + break; + case TarsHeadeSimpleList: + { + uint8_t headType = 0, headTag = 0; + readFromHead(*this, headType, headTag); + if (tars_unlikely(headType != TarsHeadeChar)) + { + char s[64]; + snprintf(s, sizeof(s), "skipField with invalid type, type value: %d, %d, %d.", type, headType, headTag); + throw TarsDecodeMismatch(s); + } + UInt32 size = 0; + read(size, 0); + TarsReadHeadSkip(*this, size); + } + break; + case TarsHeadeStructBegin: + skipToStructEnd(); + break; + case TarsHeadeStructEnd: + case TarsHeadeZeroTag: + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "skipField with invalid type, type value:%d.", type); + throw TarsDecodeMismatch(s); + } + } + } - /// 读取一个指定类型的数据(基本类型) - template - inline T readByType() - { - T n; - this->readBuf(&n, sizeof(n)); - return n; - } - void readUnknown(std::string & sUnkown, uint8_t tag) - { + /// 读取一个指定类型的数据(基本类型) + template + inline T readByType() + { + T n; + this->readBuf(&n, sizeof(n)); + return n; + } + void readUnknown(std::string & sUnkown, uint8_t tag) + { - size_t start = ReaderT::tellp(); - size_t last = start; - try - { - uint8_t lasttag = tag; - DataHead h; - while (!ReaderT::hasEnd()) - { - size_t len = h.peekFrom(*this); - if ( h.getTag() <=lasttag) - { - break; - } - lasttag = h.getTag(); - this->skip(len); - skipField(h.getType()); - last = ReaderT::tellp(); //记录下最后一次正常到达的位置 - } - } - catch (...) // - { - throw; - } - std::string s(ReaderT::base() +start, last - start); - sUnkown = s; - return ; + size_t start = ReaderT::tellp(); + size_t last = start; + try + { + uint8_t lasttag = tag; + DataHead h; + while (!ReaderT::hasEnd()) + { + size_t len = h.peekFrom(*this); + if ( h.getTag() <=lasttag) + { + break; + } + lasttag = h.getTag(); + this->skip(len); + skipField(h.getType()); + last = ReaderT::tellp(); //记录下最后一次正常到达的位置 + } + } + catch (...) // + { + throw; + } + std::string s(ReaderT::base() +start, last - start); + sUnkown = s; + return ; - } - friend class XmlProxyCallback; + } + friend class XmlProxyCallback; - void read(Bool& b, uint8_t tag, bool isRequire = true) - { - Char c = b; - read(c, tag, isRequire); - b = c ? true : false; - } + void read(Bool& b, uint8_t tag, bool isRequire = true) + { + Char c = b; + read(c, tag, isRequire); + b = c ? true : false; + } - void read(Char& c, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch (headType) - { - case TarsHeadeZeroTag: - c = 0; - break; - case TarsHeadeChar: - TarsReadTypeBuf(*this, c, Char); - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'Char' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } + void read(Char& c, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch (headType) + { + case TarsHeadeZeroTag: + c = 0; + break; + case TarsHeadeChar: + TarsReadTypeBuf(*this, c, Char); + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'Char' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d.", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d.", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - void read(UInt8& n, uint8_t tag, bool isRequire = true) - { - Short i = (Short)n; - read(i,tag,isRequire); - n = (UInt8)i; - } + void read(UInt8& n, uint8_t tag, bool isRequire = true) + { + Short i = (Short)n; + read(i,tag,isRequire); + n = (UInt8)i; + } - void read(Short& n, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch (headType) - { - case TarsHeadeZeroTag: - n = 0; - break; - case TarsHeadeChar: - TarsReadTypeBuf(*this, n, Char); - break; - case TarsHeadeShort: - TarsReadTypeBuf(*this, n, Short); - n = ntohs(n); - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'Short' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + void read(Short& n, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch (headType) + { + case TarsHeadeZeroTag: + n = 0; + break; + case TarsHeadeChar: + TarsReadTypeBuf(*this, n, Char); + break; + case TarsHeadeShort: + TarsReadTypeBuf(*this, n, Short); + n = ntohs(n); + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'Short' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - void read(UInt16& n, uint8_t tag, bool isRequire = true) - { - Int32 i = (Int32)n; - read(i,tag,isRequire); - n = (UInt16)i; - } + void read(UInt16& n, uint8_t tag, bool isRequire = true) + { + Int32 i = (Int32)n; + read(i,tag,isRequire); + n = (UInt16)i; + } - void read(Int32& n, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 1, headTag = 1; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch (headType) - { - case TarsHeadeZeroTag: - n = 0; - break; - case TarsHeadeChar: - TarsReadTypeBuf(*this, n, Char); - break; - case TarsHeadeShort: - TarsReadTypeBuf(*this, n, Short); - n = (Short)ntohs(n); - break; - case TarsHeadeInt32: - TarsReadTypeBuf(*this, n, Int32); - n = ntohl(n); - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'Int32' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d headType: %d, headTag: %d", tag, headType, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + void read(Int32& n, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 1, headTag = 1; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch (headType) + { + case TarsHeadeZeroTag: + n = 0; + break; + case TarsHeadeChar: + TarsReadTypeBuf(*this, n, Char); + break; + case TarsHeadeShort: + TarsReadTypeBuf(*this, n, Short); + n = (Short)ntohs(n); + break; + case TarsHeadeInt32: + TarsReadTypeBuf(*this, n, Int32); + n = ntohl(n); + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'Int32' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d headType: %d, headTag: %d", tag, headType, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - void read(UInt32& n, uint8_t tag, bool isRequire = true) - { - Int64 i = (Int64)n; - read(i,tag,isRequire); - n = (UInt32)i; - } + void read(UInt32& n, uint8_t tag, bool isRequire = true) + { + Int64 i = (Int64)n; + read(i,tag,isRequire); + n = (UInt32)i; + } - void read(Int64& n, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeZeroTag: - n = 0; - break; - case TarsHeadeChar: - TarsReadTypeBuf(*this, n, Char); - break; - case TarsHeadeShort: - TarsReadTypeBuf(*this, n, Short); - n = (Short) ntohs(n); - break; - case TarsHeadeInt32: - TarsReadTypeBuf(*this, n, Int32); - n = (Int32) ntohl(n); - break; - case TarsHeadeInt64: - TarsReadTypeBuf(*this, n, Int64); - n = tars_ntohll(n); - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'Int64' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } + void read(Int64& n, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeZeroTag: + n = 0; + break; + case TarsHeadeChar: + TarsReadTypeBuf(*this, n, Char); + break; + case TarsHeadeShort: + TarsReadTypeBuf(*this, n, Short); + n = (Short) ntohs(n); + break; + case TarsHeadeInt32: + TarsReadTypeBuf(*this, n, Int32); + n = (Int32) ntohl(n); + break; + case TarsHeadeInt64: + TarsReadTypeBuf(*this, n, Int64); + n = tars_ntohll(n); + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'Int64' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - void read(Float& n, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeZeroTag: - n = 0; - break; - case TarsHeadeFloat: - TarsReadTypeBuf(*this, n, float); - n = tars_ntohf(n); - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'Float' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + void read(Float& n, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeZeroTag: + n = 0; + break; + case TarsHeadeFloat: + TarsReadTypeBuf(*this, n, float); + n = tars_ntohf(n); + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'Float' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - void read(Double& n, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeZeroTag: - n = 0; - break; - case TarsHeadeFloat: - TarsReadTypeBuf(*this, n, float); - n = tars_ntohf(n); - break; - case TarsHeadeDouble: - TarsReadTypeBuf(*this, n, double); - n = tars_ntohd(n); - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'Double' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + void read(Double& n, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeZeroTag: + n = 0; + break; + case TarsHeadeFloat: + TarsReadTypeBuf(*this, n, float); + n = tars_ntohf(n); + break; + case TarsHeadeDouble: + TarsReadTypeBuf(*this, n, double); + n = tars_ntohd(n); + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'Double' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - /*void read(std::string& s, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeString1: - { - size_t len = 0; - TarsReadTypeBuf(*this, len, uint8_t); - char ss[256]; - //s.resize(len); - //this->readBuf((void *)s.c_str(), len); - TarsReadStringBuf(*this, s, len); - //TarsReadBuf(*this, s, len); - //s.assign(ss, ss + len); - } - break; - case TarsHeadeString4: - { - uint32_t len = 0; - TarsReadTypeBuf(*this, len, uint32_t); - len = ntohl(len); - if (tars_unlikely(len > TARS_MAX_STRING_LENGTH)) - { - char s[128]; - snprintf(s, sizeof(s), "invalid string size, tag: %d, size: %d", tag, len); - throw TarsDecodeInvalidValue(s); - } - //char *ss = new char[len]; - //s.resize(len); - //this->readBuf((void *)s.c_str(), len); + /*void read(std::string& s, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeString1: + { + size_t len = 0; + TarsReadTypeBuf(*this, len, uint8_t); + char ss[256]; + //s.resize(len); + //this->readBuf((void *)s.c_str(), len); + TarsReadStringBuf(*this, s, len); + //TarsReadBuf(*this, s, len); + //s.assign(ss, ss + len); + } + break; + case TarsHeadeString4: + { + uint32_t len = 0; + TarsReadTypeBuf(*this, len, uint32_t); + len = ntohl(len); + if (tars_unlikely(len > TARS_MAX_STRING_LENGTH)) + { + char s[128]; + snprintf(s, sizeof(s), "invalid string size, tag: %d, size: %d", tag, len); + throw TarsDecodeInvalidValue(s); + } + //char *ss = new char[len]; + //s.resize(len); + //this->readBuf((void *)s.c_str(), len); - char *ss = new char[len]; - try - { - TarsReadBuf(*this, ss, len); - s.assign(ss, ss + len); - } - catch (...) - { - delete[] ss; - throw; - } - delete[] ss; - TarsReadStringBuf(*this, s, len); - } - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'string' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d", tag); - throw TarsDecodeRequireNotExist(s); - } - }*/ + char *ss = new char[len]; + try + { + TarsReadBuf(*this, ss, len); + s.assign(ss, ss + len); + } + catch (...) + { + delete[] ss; + throw; + } + delete[] ss; + TarsReadStringBuf(*this, s, len); + } + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'string' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d", tag); + throw TarsDecodeRequireNotExist(s); + } + }*/ - void read(std::string& s, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - uint32_t strLength = 0; - switch (headType) - { - case TarsHeadeString1: - { - TarsReadTypeBuf(*this, strLength, uint8_t); - } - break; - case TarsHeadeString4: - { - TarsReadTypeBuf(*this, strLength, uint32_t); - strLength = ntohl(strLength); - if (tars_unlikely(strLength > TARS_MAX_STRING_LENGTH)) - { - char s[128]; - snprintf(s, sizeof(s), "invalid string size, tag: %d, size: %d", tag, strLength); - throw TarsDecodeInvalidValue(s); - } - } - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'string' type mismatch, tag: %d, get type: %d, tag: %d.", tag, headType, headTag); - throw TarsDecodeMismatch(s); - } - } - TarsReadStringBuf(*this, s, strLength); - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d", tag); - throw TarsDecodeRequireNotExist(s); - } - } + void read(std::string& s, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + uint32_t strLength = 0; + switch (headType) + { + case TarsHeadeString1: + { + TarsReadTypeBuf(*this, strLength, uint8_t); + } + break; + case TarsHeadeString4: + { + TarsReadTypeBuf(*this, strLength, uint32_t); + strLength = ntohl(strLength); + if (tars_unlikely(strLength > TARS_MAX_STRING_LENGTH)) + { + char s[128]; + snprintf(s, sizeof(s), "invalid string size, tag: %d, size: %d", tag, strLength); + throw TarsDecodeInvalidValue(s); + } + } + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'string' type mismatch, tag: %d, get type: %d, tag: %d.", tag, headType, headTag); + throw TarsDecodeMismatch(s); + } + } + TarsReadStringBuf(*this, s, strLength); + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d", tag); + throw TarsDecodeRequireNotExist(s); + } + } - void read(char *buf, const UInt32 bufLen, UInt32 & readLen, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeSimpleList: - { - uint8_t hheadType, hheadTag; - readFromHead(*this, hheadType, hheadTag); - if (tars_unlikely(hheadType != TarsHeadeChar)) - { - char s[128]; - snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d, %d, %d", tag, headType, hheadType, hheadTag); - throw TarsDecodeMismatch(s); - } - UInt32 size = 0; - read(size, 0); - if (tars_unlikely(size > bufLen)) - { - char s[128]; - snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, %d, size: %d", tag, headType, hheadType, size); - throw TarsDecodeInvalidValue(s); - } - //TarsReadTypeBuf(*this, size, UInt32); - this->readBuf(buf, size); - readLen = size; - } - break; + void read(char *buf, const UInt32 bufLen, UInt32 & readLen, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeSimpleList: + { + uint8_t hheadType, hheadTag; + readFromHead(*this, hheadType, hheadTag); + if (tars_unlikely(hheadType != TarsHeadeChar)) + { + char s[128]; + snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d, %d, %d", tag, headType, hheadType, hheadTag); + throw TarsDecodeMismatch(s); + } + UInt32 size = 0; + read(size, 0); + if (tars_unlikely(size > bufLen)) + { + char s[128]; + snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, %d, size: %d", tag, headType, hheadType, size); + throw TarsDecodeInvalidValue(s); + } + //TarsReadTypeBuf(*this, size, UInt32); + this->readBuf(buf, size); + readLen = size; + } + break; - default: - { - char s[128]; - snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[128]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + default: + { + char s[128]; + snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[128]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - template - void read(std::map& m, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeMap: - { - UInt32 size = 0; - read(size, 0); - if (tars_unlikely(size > this->size())) - { - char s[128]; - snprintf(s, sizeof(s), "invalid map, tag: %d, size: %d", tag, size); - throw TarsDecodeInvalidValue(s); - } - m.clear(); + template + void read(std::map& m, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeMap: + { + UInt32 size = 0; + read(size, 0); + if (tars_unlikely(size > this->size())) + { + char s[128]; + snprintf(s, sizeof(s), "invalid map, tag: %d, size: %d", tag, size); + throw TarsDecodeInvalidValue(s); + } + m.clear(); - for (UInt32 i = 0; i < size; ++i) - { - std::pair pr; - read(pr.first, 0); - read(pr.second, 1); - m.insert(pr); - } - } - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'map' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + for (UInt32 i = 0; i < size; ++i) + { + std::pair pr; + read(pr.first, 0); + read(pr.second, 1); + m.insert(pr); + } + } + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'map' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - template - void read(std::vector& v, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeSimpleList: - { - uint8_t hheadType, hheadTag; - readFromHead(*this, hheadType, hheadTag); - if (tars_unlikely(hheadType != TarsHeadeChar)) - { - char s[128]; - snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d, %d, %d", tag, headType, hheadType, hheadTag); - throw TarsDecodeMismatch(s); - } - UInt32 size = 0; - read(size, 0); - if (tars_unlikely(size > this->size())) - { - char s[128]; - snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, %d, size: %d", tag, headType, hheadType, size); - throw TarsDecodeInvalidValue(s); - } + template + void read(std::vector& v, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeSimpleList: + { + uint8_t hheadType, hheadTag; + readFromHead(*this, hheadType, hheadTag); + if (tars_unlikely(hheadType != TarsHeadeChar)) + { + char s[128]; + snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d, %d, %d", tag, headType, hheadType, hheadTag); + throw TarsDecodeMismatch(s); + } + UInt32 size = 0; + read(size, 0); + if (tars_unlikely(size > this->size())) + { + char s[128]; + snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, %d, size: %d", tag, headType, hheadType, size); + throw TarsDecodeInvalidValue(s); + } - this->readBuf(v, size); - } - break; - case TarsHeadeList: - { - UInt32 size = 0; - read(size, 0); - if (tars_unlikely(size > this->size())) - { - char s[128]; - snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, size: %d", tag, headType, size); - throw TarsDecodeInvalidValue(s); - } - v.reserve(size); - v.resize(size); - for (UInt32 i = 0; i < size; ++i) - read(v[i], 0); - } - break; - default: - { - char s[128]; - snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[128]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + this->readBuf(v, size); + } + break; + case TarsHeadeList: + { + UInt32 size = 0; + read(size, 0); + if (tars_unlikely(size > this->size())) + { + char s[128]; + snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, size: %d", tag, headType, size); + throw TarsDecodeInvalidValue(s); + } + v.reserve(size); + v.resize(size); + for (UInt32 i = 0; i < size; ++i) + read(v[i], 0); + } + break; + default: + { + char s[128]; + snprintf(s, sizeof(s), "type mismatch, tag: %d, type: %d", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[128]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - template - void read(std::vector& v, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeList: - { - UInt32 size = 0; - read(size, 0); - if (tars_unlikely(size > this->size())) - { - char s[128]; - snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, size: %d", tag, headType, size); - throw TarsDecodeInvalidValue(s); - } - v.reserve(size); - v.resize(size); - for (UInt32 i = 0; i < size; ++i) - read(v[i], 0); - } - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'vector' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + template + void read(std::vector& v, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeList: + { + UInt32 size = 0; + read(size, 0); + if (tars_unlikely(size > this->size())) + { + char s[128]; + snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, size: %d", tag, headType, size); + throw TarsDecodeInvalidValue(s); + } + v.reserve(size); + v.resize(size); + for (UInt32 i = 0; i < size; ++i) + read(v[i], 0); + } + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'vector' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - /// 读取结构数组 - template - void read(T* v, const UInt32 len, UInt32 & readLen, uint8_t tag, bool isRequire = true) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - switch(headType) - { - case TarsHeadeList: - { - UInt32 size = 0; - read(size, 0); - if (tars_unlikely(size > this->size())) - { - char s[128]; - snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, size: %d", tag, headType, size); - throw TarsDecodeInvalidValue(s); - } - for (UInt32 i = 0; i < size; ++i) - read(v[i], 0); - readLen = size; - } - break; - default: - { - char s[64]; - snprintf(s, sizeof(s), "read 'vector struct' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - } - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } + /// 读取结构数组 + template + void read(T* v, const UInt32 len, UInt32 & readLen, uint8_t tag, bool isRequire = true) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + switch(headType) + { + case TarsHeadeList: + { + UInt32 size = 0; + read(size, 0); + if (tars_unlikely(size > this->size())) + { + char s[128]; + snprintf(s, sizeof(s), "invalid size, tag: %d, type: %d, size: %d", tag, headType, size); + throw TarsDecodeInvalidValue(s); + } + for (UInt32 i = 0; i < size; ++i) + read(v[i], 0); + readLen = size; + } + break; + default: + { + char s[64]; + snprintf(s, sizeof(s), "read 'vector struct' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + } + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } - template - void read(T& v, uint8_t tag, bool isRequire = true, typename detail::disable_if, void ***>::type dummy = 0) - { - Int32 n = 0; - read(n, tag, isRequire); - v = (T) n; - } + template + void read(T& v, uint8_t tag, bool isRequire = true, typename detail::disable_if, void ***>::type dummy = 0) + { + Int32 n = 0; + read(n, tag, isRequire); + v = (T) n; + } - /// 读取结构 - template - void read(T& v, uint8_t tag, bool isRequire = true, typename detail::enable_if, void ***>::type dummy = 0) - { - uint8_t headType = 0, headTag = 0; - bool skipFlag = false; - TarsSkipToTag(skipFlag, tag, headType, headTag); - if (tars_likely(skipFlag)) - { - if (tars_unlikely(headType != TarsHeadeStructBegin)) - { - char s[64]; - snprintf(s, sizeof(s), "read 'struct' type mismatch, tag: %d, get type: %d.", tag, headType); - throw TarsDecodeMismatch(s); - } - v.readFrom(*this); - skipToStructEnd(); - } - else if (tars_unlikely(isRequire)) - { - char s[64]; - snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); - throw TarsDecodeRequireNotExist(s); - } - } - }; + /// 读取结构 + template + void read(T& v, uint8_t tag, bool isRequire = true, typename detail::enable_if, void ***>::type dummy = 0) + { + uint8_t headType = 0, headTag = 0; + bool skipFlag = false; + TarsSkipToTag(skipFlag, tag, headType, headTag); + if (tars_likely(skipFlag)) + { + if (tars_unlikely(headType != TarsHeadeStructBegin)) + { + char s[64]; + snprintf(s, sizeof(s), "read 'struct' type mismatch, tag: %d, get type: %d.", tag, headType); + throw TarsDecodeMismatch(s); + } + v.readFrom(*this); + skipToStructEnd(); + } + else if (tars_unlikely(isRequire)) + { + char s[64]; + snprintf(s, sizeof(s), "require field not exist, tag: %d, headTag: %d", tag, headTag); + throw TarsDecodeRequireNotExist(s); + } + } +}; ////////////////////////////////////////////////////////////////// - template - class TarsOutputStream : public WriterT - { - public: - void writeUnknown(const std::string& s) - { - this->writeBuf(s.data(), s.size()); - } - void writeUnknownV2(const std::string& s) - { - DataHead::writeTo(*this, DataHead::eStructBegin, 0); - this->writeBuf(s.data(), s.size()); - DataHead::writeTo(*this, DataHead::eStructEnd, 0); - } - void write(Bool b, uint8_t tag) - { - write((Char) b, tag); - } +template +class TarsOutputStream : public WriterT +{ +public: + void writeUnknown(const std::string& s) + { + this->writeBuf(s.data(), s.size()); + } + void writeUnknownV2(const std::string& s) + { + DataHead::writeTo(*this, DataHead::eStructBegin, 0); + this->writeBuf(s.data(), s.size()); + DataHead::writeTo(*this, DataHead::eStructEnd, 0); + } + void write(Bool b, uint8_t tag) + { + write((Char) b, tag); + } - void write(Char n, uint8_t tag) - { - /* - DataHead h(DataHead::eChar, tag); - if(n == 0){ - h.setType(DataHead::eZeroTag); - h.writeTo(*this); - }else{ - h.writeTo(*this); - this->writeBuf(&n, sizeof(n)); - } - */ - if (tars_unlikely(n == 0)) - { - TarsWriteToHead(*this, TarsHeadeZeroTag, tag); - } - else - { - TarsWriteToHead(*this, TarsHeadeChar, tag); - TarsWriteCharTypeBuf(*this, n, (*this)._len); - } - } + void write(Char n, uint8_t tag) + { + /* + DataHead h(DataHead::eChar, tag); + if(n == 0){ + h.setType(DataHead::eZeroTag); + h.writeTo(*this); + }else{ + h.writeTo(*this); + this->writeBuf(&n, sizeof(n)); + } + */ + if (tars_unlikely(n == 0)) + { + TarsWriteToHead(*this, TarsHeadeZeroTag, tag); + } + else + { + TarsWriteToHead(*this, TarsHeadeChar, tag); + TarsWriteCharTypeBuf(*this, n, (*this)._len); + } + } - void write(UInt8 n, uint8_t tag) - { - write((Short) n, tag); - } + void write(UInt8 n, uint8_t tag) + { + write((Short) n, tag); + } - void write(Short n, uint8_t tag) - { - //if(n >= CHAR_MIN && n <= CHAR_MAX){ - if (n >= (-128) && n <= 127) - { - write((Char) n, tag); - } - else - { - /* - DataHead h(DataHead::eShort, tag); - h.writeTo(*this); - n = htons(n); - this->writeBuf(&n, sizeof(n)); - */ - TarsWriteToHead(*this, TarsHeadeShort, tag); - n = htons(n); - TarsWriteShortTypeBuf(*this, n, (*this)._len); - } - } + void write(Short n, uint8_t tag) + { + //if(n >= CHAR_MIN && n <= CHAR_MAX){ + if (n >= (-128) && n <= 127) + { + write((Char) n, tag); + } + else + { + /* + DataHead h(DataHead::eShort, tag); + h.writeTo(*this); + n = htons(n); + this->writeBuf(&n, sizeof(n)); + */ + TarsWriteToHead(*this, TarsHeadeShort, tag); + n = htons(n); + TarsWriteShortTypeBuf(*this, n, (*this)._len); + } + } - void write(UInt16 n, uint8_t tag) - { - write((Int32) n, tag); - } + void write(UInt16 n, uint8_t tag) + { + write((Int32) n, tag); + } - void write(Int32 n, uint8_t tag) - { - //if(n >= SHRT_MIN && n <= SHRT_MAX){ - if (n >= (-32768) && n <= 32767) - { - write((Short) n, tag); - } - else - { - //DataHead h(DataHead::eInt32, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeInt32, tag); - n = htonl(n); - TarsWriteInt32TypeBuf(*this, n, (*this)._len); - } - } + void write(Int32 n, uint8_t tag) + { + //if(n >= SHRT_MIN && n <= SHRT_MAX){ + if (n >= (-32768) && n <= 32767) + { + write((Short) n, tag); + } + else + { + //DataHead h(DataHead::eInt32, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeInt32, tag); + n = htonl(n); + TarsWriteInt32TypeBuf(*this, n, (*this)._len); + } + } - void write(UInt32 n, uint8_t tag) - { - write((Int64) n, tag); - } + void write(UInt32 n, uint8_t tag) + { + write((Int64) n, tag); + } - void write(Int64 n, uint8_t tag) - { - //if(n >= INT_MIN && n <= INT_MAX){ - if (n >= (-2147483647-1) && n <= 2147483647) - { - write((Int32) n, tag); - } - else - { - //DataHead h(DataHead::eInt64, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeInt64, tag); - n = tars_htonll(n); - TarsWriteInt64TypeBuf(*this, n, (*this)._len); - } - } + void write(Int64 n, uint8_t tag) + { + //if(n >= INT_MIN && n <= INT_MAX){ + if (n >= (-2147483647-1) && n <= 2147483647) + { + write((Int32) n, tag); + } + else + { + //DataHead h(DataHead::eInt64, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeInt64, tag); + n = tars_htonll(n); + TarsWriteInt64TypeBuf(*this, n, (*this)._len); + } + } - void write(Float n, uint8_t tag) - { - //DataHead h(DataHead::eFloat, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeFloat, tag); - n = tars_htonf(n); - TarsWriteFloatTypeBuf(*this, n, (*this)._len); - } + void write(Float n, uint8_t tag) + { + //DataHead h(DataHead::eFloat, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeFloat, tag); + n = tars_htonf(n); + TarsWriteFloatTypeBuf(*this, n, (*this)._len); + } - void write(Double n, uint8_t tag) - { - //DataHead h(DataHead::eDouble, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeDouble, tag); - n = tars_htond(n); - TarsWriteDoubleTypeBuf(*this, n, (*this)._len); - } + void write(Double n, uint8_t tag) + { + //DataHead h(DataHead::eDouble, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeDouble, tag); + n = tars_htond(n); + TarsWriteDoubleTypeBuf(*this, n, (*this)._len); + } - void write(const std::string& s, uint8_t tag) - { - if (tars_unlikely(s.size() > 255)) - { - if (tars_unlikely(s.size() > TARS_MAX_STRING_LENGTH)) - { - char ss[128]; - snprintf(ss, sizeof(ss), "invalid string size, tag: %d, size: %u", tag, (uint32_t)s.size()); - throw TarsDecodeInvalidValue(ss); - } - TarsWriteToHead(*this, TarsHeadeString4, tag); - uint32_t n = htonl((uint32_t)s.size()); - TarsWriteUInt32TTypeBuf(*this, n, (*this)._len); - //this->writeBuf(s.data(), s.size()); - TarsWriteTypeBuf(*this, s.data(), s.size()); - } - else - { - TarsWriteToHead(*this, TarsHeadeString1, tag); - uint8_t n = (uint8_t)s.size(); - TarsWriteUInt8TTypeBuf(*this, n, (*this)._len); - //this->writeBuf(s.data(), s.size()); - TarsWriteTypeBuf(*this, s.data(), s.size()); - } - } + void write(const std::string& s, uint8_t tag) + { + if (tars_unlikely(s.size() > 255)) + { + if (tars_unlikely(s.size() > TARS_MAX_STRING_LENGTH)) + { + char ss[128]; + snprintf(ss, sizeof(ss), "invalid string size, tag: %d, size: %u", tag, (uint32_t)s.size()); + throw TarsDecodeInvalidValue(ss); + } + TarsWriteToHead(*this, TarsHeadeString4, tag); + uint32_t n = htonl((uint32_t)s.size()); + TarsWriteUInt32TTypeBuf(*this, n, (*this)._len); + //this->writeBuf(s.data(), s.size()); + TarsWriteTypeBuf(*this, s.data(), s.size()); + } + else + { + TarsWriteToHead(*this, TarsHeadeString1, tag); + uint8_t n = (uint8_t)s.size(); + TarsWriteUInt8TTypeBuf(*this, n, (*this)._len); + //this->writeBuf(s.data(), s.size()); + TarsWriteTypeBuf(*this, s.data(), s.size()); + } + } - void write(const char *buf, const UInt32 len, uint8_t tag) - { - TarsWriteToHead(*this, TarsHeadeSimpleList, tag); - TarsWriteToHead(*this, TarsHeadeChar, 0); - write(len, 0); - //this->writeBuf(buf, len); - TarsWriteTypeBuf(*this, buf, len); - } + void write(const char *buf, const UInt32 len, uint8_t tag) + { + TarsWriteToHead(*this, TarsHeadeSimpleList, tag); + TarsWriteToHead(*this, TarsHeadeChar, 0); + write(len, 0); + //this->writeBuf(buf, len); + TarsWriteTypeBuf(*this, buf, len); + } - template - void write(const std::map& m, uint8_t tag) - { - //DataHead h(DataHead::eMap, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeMap, tag); - Int32 n = (Int32)m.size(); - write(n, 0); - typedef typename std::map::const_iterator IT; - for (IT i = m.begin(); i != m.end(); ++i) - { - write(i->first, 0); - write(i->second, 1); - } - } + template + void write(const std::map& m, uint8_t tag) + { + //DataHead h(DataHead::eMap, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeMap, tag); + Int32 n = (Int32)m.size(); + write(n, 0); + typedef typename std::map::const_iterator IT; + for (IT i = m.begin(); i != m.end(); ++i) + { + write(i->first, 0); + write(i->second, 1); + } + } - template - void write(const std::vector& v, uint8_t tag) - { - //DataHead h(DataHead::eList, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeList, tag); - Int32 n = (Int32)v.size(); - write(n, 0); - typedef typename std::vector::const_iterator IT; - for (IT i = v.begin(); i != v.end(); ++i) - write(*i, 0); - } + template + void write(const std::vector& v, uint8_t tag) + { + //DataHead h(DataHead::eList, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeList, tag); + Int32 n = (Int32)v.size(); + write(n, 0); + typedef typename std::vector::const_iterator IT; + for (IT i = v.begin(); i != v.end(); ++i) + write(*i, 0); + } - template - void write(const T *v, const UInt32 len, uint8_t tag) - { - TarsWriteToHead(*this, TarsHeadeList, tag); - write(len, 0); - for (Int32 i = 0; i < (Int32)len; ++i) - { - write(v[i], 0); - } - } + template + void write(const T *v, const UInt32 len, uint8_t tag) + { + TarsWriteToHead(*this, TarsHeadeList, tag); + write(len, 0); + for (Int32 i = 0; i < (Int32)len; ++i) + { + write(v[i], 0); + } + } - template - void write(const std::vector& v, uint8_t tag) - { - //DataHead h(DataHead::eSimpleList, tag); - //h.writeTo(*this); - //DataHead hh(DataHead::eChar, 0); - //hh.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeSimpleList, tag); - TarsWriteToHead(*this, TarsHeadeChar, 0); - Int32 n = (Int32)v.size(); - write(n, 0); - //writeBuf(&v[0], v.size()); - TarsWriteTypeBuf(*this, v.data(), v.size()); - } + template + void write(const std::vector& v, uint8_t tag) + { + //DataHead h(DataHead::eSimpleList, tag); + //h.writeTo(*this); + //DataHead hh(DataHead::eChar, 0); + //hh.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeSimpleList, tag); + TarsWriteToHead(*this, TarsHeadeChar, 0); + Int32 n = (Int32)v.size(); + write(n, 0); + //writeBuf(&v[0], v.size()); + TarsWriteTypeBuf(*this, v.data(), v.size()); + } - template - void write(const T& v, uint8_t tag, typename detail::disable_if, void ***>::type dummy = 0) - { - write((Int32) v, tag); - } + template + void write(const T& v, uint8_t tag, typename detail::disable_if, void ***>::type dummy = 0) + { + write((Int32) v, tag); + } - template - void write(const T& v, uint8_t tag, typename detail::enable_if, void ***>::type dummy = 0) - { - //DataHead h(DataHead::eStructBegin, tag); - //h.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeStructBegin, tag); - v.writeTo(*this); - TarsWriteToHead(*this, TarsHeadeStructEnd, 0); - /* - h.setType(DataHead::eStructEnd); - h.setTag(0); - h.writeTo(*this); - */ - } - }; + template + void write(const T& v, uint8_t tag, typename detail::enable_if, void ***>::type dummy = 0) + { + //DataHead h(DataHead::eStructBegin, tag); + //h.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeStructBegin, tag); + v.writeTo(*this); + TarsWriteToHead(*this, TarsHeadeStructEnd, 0); + /* + h.setType(DataHead::eStructEnd); + h.setTag(0); + h.writeTo(*this); + */ + } +}; //////////////////////////////////////////////////////////////////////////////////////////////////// } //支持iphone #ifdef __APPLE__ - #include "TarsDisplayer.h" +#include "TarsDisplayer.h" #else - #include "tup/TarsDisplayer.h" +#include "tup/TarsDisplayer.h" #endif #endif \ No newline at end of file diff --git a/tools/tarsgrammar/tars.tab.cpp b/tools/tarsgrammar/tars.tab.cpp index 3d5e113..234486d 100644 --- a/tools/tarsgrammar/tars.tab.cpp +++ b/tools/tarsgrammar/tars.tab.cpp @@ -136,7 +136,7 @@ /* Copy the first part of user declarations. */ -#line 17 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 17 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" #include #include @@ -1649,81 +1649,81 @@ yyreduce: switch (yyn) { case 3: -#line 75 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 75 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 5: -#line 79 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 79 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { yyerrok; ;} break; case 7: -#line 84 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 84 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("`;' missing after definition"); ;} break; case 8: -#line 88 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 88 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 9: -#line 96 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 96 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || NamespacePtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 10: -#line 100 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 100 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || InterfacePtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 11: -#line 104 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 104 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || StructPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 12: -#line 108 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 108 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 13: -#line 111 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 111 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || EnumPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 14: -#line 115 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 115 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || ConstPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 15: -#line 124 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 124 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 16: -#line 128 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 128 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(3) - (5)])) { @@ -1740,7 +1740,7 @@ yyreduce: break; case 17: -#line 147 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 147 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { NamespacePtr c = NamespacePtr::dynamicCast(g_parse->currentContainer()); if(!c) @@ -1756,7 +1756,7 @@ yyreduce: break; case 18: -#line 160 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 160 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); g_parse->error("keyword `" + ident->v + "' cannot be used as enumeration name"); @@ -1765,20 +1765,20 @@ yyreduce: break; case 19: -#line 171 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 171 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(2) - (3)]); ;} break; case 20: -#line 175 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 175 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 21: -#line 183 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 183 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast(g_parse->createBuiltin(Builtin::KindLong)); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -1792,7 +1792,7 @@ yyreduce: break; case 22: -#line 194 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 194 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); g_parse->error("keyword `" + ident->v + "' cannot be used as enumerator"); @@ -1800,7 +1800,7 @@ yyreduce: break; case 23: -#line 199 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 199 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast(g_parse->createBuiltin(Builtin::KindLong)); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (3)])); @@ -1816,13 +1816,13 @@ yyreduce: break; case 24: -#line 212 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 212 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 25: -#line 220 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 220 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); ContainerPtr c = g_parse->currentContainer(); @@ -1840,7 +1840,7 @@ yyreduce: break; case 26: -#line 235 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 235 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(3) - (6)])) { @@ -1855,7 +1855,7 @@ yyreduce: break; case 27: -#line 253 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 253 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(3) - (4)])); StructPtr sp = StructPtr::dynamicCast(g_parse->findUserType(ident->v)); @@ -1869,13 +1869,13 @@ yyreduce: break; case 28: -#line 264 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 264 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 29: -#line 272 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 272 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); StructPtr np = g_parse->getKeyStruct(); @@ -1891,7 +1891,7 @@ yyreduce: break; case 30: -#line 285 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 285 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(3) - (3)])); StructPtr np = g_parse->getKeyStruct(); @@ -1907,7 +1907,7 @@ yyreduce: break; case 31: -#line 304 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 304 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -1927,7 +1927,7 @@ yyreduce: break; case 32: -#line 321 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 321 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(2) - (5)])) { @@ -1942,14 +1942,14 @@ yyreduce: break; case 33: -#line 338 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 338 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; case 34: -#line 342 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 342 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); g_parse->error("keyword `" + ident->v + "' cannot be used as interface name"); @@ -1958,32 +1958,32 @@ yyreduce: break; case 35: -#line 353 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 353 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 36: -#line 356 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 356 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 37: -#line 359 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 359 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("`;' missing after definition"); ;} break; case 38: -#line 363 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 363 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 40: -#line 377 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 377 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(1) - (3)])) { @@ -1998,7 +1998,7 @@ yyreduce: break; case 41: -#line 394 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 394 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr returnType = TypePtr::dynamicCast((yyvsp[(1) - (2)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2025,20 +2025,20 @@ yyreduce: break; case 43: -#line 424 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 424 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = 0; ;} break; case 44: -#line 434 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 434 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 45: -#line 437 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 437 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -2052,7 +2052,7 @@ yyreduce: break; case 46: -#line 448 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 448 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -2066,7 +2066,7 @@ yyreduce: break; case 47: -#line 459 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 459 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isOutParam = BoolGrammarPtr::dynamicCast((yyvsp[(1) - (2)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2081,7 +2081,7 @@ yyreduce: break; case 48: -#line 471 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 471 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isOutParam = BoolGrammarPtr::dynamicCast((yyvsp[(3) - (4)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(4) - (4)])); @@ -2096,7 +2096,7 @@ yyreduce: break; case 49: -#line 483 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 483 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isRouteKeyParam = BoolGrammarPtr::dynamicCast((yyvsp[(1) - (2)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2111,7 +2111,7 @@ yyreduce: break; case 50: -#line 495 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 495 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isRouteKeyParam = BoolGrammarPtr::dynamicCast((yyvsp[(3) - (4)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(4) - (4)])); @@ -2126,21 +2126,21 @@ yyreduce: break; case 51: -#line 507 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 507 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("'out' must be defined with a type"); ;} break; case 52: -#line 511 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 511 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("'routekey' must be defined with a type"); ;} break; case 53: -#line 520 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 520 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr routekey = new BoolGrammar; routekey->v = true; @@ -2149,7 +2149,7 @@ yyreduce: break; case 54: -#line 531 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 531 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr out = new BoolGrammar; out->v = true; @@ -2158,7 +2158,7 @@ yyreduce: break; case 55: -#line 542 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 542 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); NamespacePtr np = NamespacePtr::dynamicCast(g_parse->currentContainer()); @@ -2183,7 +2183,7 @@ yyreduce: break; case 56: -#line 564 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 564 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(2) - (5)])) { @@ -2201,14 +2201,14 @@ yyreduce: break; case 57: -#line 584 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 584 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; case 58: -#line 588 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 588 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2217,41 +2217,41 @@ yyreduce: break; case 59: -#line 594 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 594 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("abstract declarator '' used as declaration"); ;} break; case 60: -#line 603 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 603 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 61: -#line 607 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 607 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("';' missing after definition"); ;} break; case 62: -#line 611 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 611 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 63: -#line 621 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 621 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast((yyvsp[(1) - (1)])); ;} break; case 64: -#line 630 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 630 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2272,7 +2272,7 @@ yyreduce: break; case 65: -#line 648 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 648 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2297,7 +2297,7 @@ yyreduce: break; case 66: -#line 670 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 670 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2322,7 +2322,7 @@ yyreduce: break; case 67: -#line 692 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 692 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2342,35 +2342,35 @@ yyreduce: break; case 68: -#line 709 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 709 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'tag'"); ;} break; case 69: -#line 713 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 713 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'tag'"); ;} break; case 70: -#line 717 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 717 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'require' or 'optional'"); ;} break; case 71: -#line 721 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 721 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'tag' or 'require' or 'optional'"); ;} break; case 72: -#line 730 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 730 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { IntergerGrammarPtr intVal = IntergerGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ostringstream sstr; @@ -2383,7 +2383,7 @@ yyreduce: break; case 73: -#line 740 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 740 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { FloatGrammarPtr floatVal = FloatGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ostringstream sstr; @@ -2396,7 +2396,7 @@ yyreduce: break; case 74: -#line 750 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 750 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ConstGrammarPtr c = new ConstGrammar(); @@ -2407,7 +2407,7 @@ yyreduce: break; case 75: -#line 758 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 758 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ConstGrammarPtr c = new ConstGrammar(); @@ -2418,7 +2418,7 @@ yyreduce: break; case 76: -#line 766 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 766 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ConstGrammarPtr c = new ConstGrammar(); @@ -2429,7 +2429,7 @@ yyreduce: break; case 77: -#line 774 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 774 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -2445,7 +2445,7 @@ yyreduce: break; case 78: -#line 787 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 787 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr scoped = StringGrammarPtr::dynamicCast((yyvsp[(1) - (3)])); @@ -2463,7 +2463,7 @@ yyreduce: break; case 79: -#line 807 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 807 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { NamespacePtr np = NamespacePtr::dynamicCast(g_parse->currentContainer()); if(!np) @@ -2479,7 +2479,7 @@ yyreduce: break; case 80: -#line 825 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 825 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (2)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2491,7 +2491,7 @@ yyreduce: break; case 81: -#line 834 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 834 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = g_parse->createVector(TypePtr::dynamicCast((yyvsp[(1) - (5)]))); IntergerGrammarPtr iPtrSize = IntergerGrammarPtr::dynamicCast((yyvsp[(4) - (5)])); @@ -2504,7 +2504,7 @@ yyreduce: break; case 82: -#line 844 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 844 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = g_parse->createVector(TypePtr::dynamicCast((yyvsp[(1) - (3)]))); //IntergerGrammarPtr iPtrSize = IntergerGrammarPtr::dynamicCast($4); @@ -2517,7 +2517,7 @@ yyreduce: break; case 83: -#line 854 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 854 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (4)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2529,7 +2529,7 @@ yyreduce: break; case 84: -#line 863 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 863 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); g_parse->error("keyword `" + ident->v + "' cannot be used as data member name"); @@ -2537,21 +2537,21 @@ yyreduce: break; case 85: -#line 868 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 868 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("missing data member name"); ;} break; case 86: -#line 872 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 872 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("unkown type"); ;} break; case 87: -#line 881 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 881 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (3)])); @@ -2563,112 +2563,112 @@ yyreduce: break; case 88: -#line 890 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 890 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 89: -#line 894 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 894 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("array missing size"); ;} break; case 90: -#line 903 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 903 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindBool); ;} break; case 91: -#line 907 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 907 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindByte); ;} break; case 92: -#line 911 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 911 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindShort,true); ;} break; case 93: -#line 915 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 915 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindShort); ;} break; case 94: -#line 919 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 919 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindInt,true); ;} break; case 95: -#line 923 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 923 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindInt); ;} break; case 96: -#line 927 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 927 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindLong,true); ;} break; case 97: -#line 931 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 931 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindLong); ;} break; case 98: -#line 935 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 935 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindFloat); ;} break; case 99: -#line 939 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 939 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindDouble); ;} break; case 100: -#line 943 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 943 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindString); ;} break; case 101: -#line 947 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 947 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast((yyvsp[(1) - (1)])); ;} break; case 102: -#line 951 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 951 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast((yyvsp[(1) - (1)])); ;} break; case 103: -#line 955 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 955 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); TypePtr sp = g_parse->findUserType(ident->v); @@ -2684,55 +2684,55 @@ yyreduce: break; case 104: -#line 973 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 973 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast(g_parse->createVector(TypePtr::dynamicCast((yyvsp[(3) - (4)])))); ;} break; case 105: -#line 977 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 977 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("vector error"); ;} break; case 106: -#line 981 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 981 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("vector missing '>'"); ;} break; case 107: -#line 985 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 985 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("vector missing type"); ;} break; case 108: -#line 994 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 994 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast(g_parse->createMap(TypePtr::dynamicCast((yyvsp[(3) - (6)])), TypePtr::dynamicCast((yyvsp[(5) - (6)])))); ;} break; case 109: -#line 998 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 998 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("map error"); ;} break; case 110: -#line 1007 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1007 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 111: -#line 1010 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1010 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); ident->v = "::" + ident->v; @@ -2741,7 +2741,7 @@ yyreduce: break; case 112: -#line 1016 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1016 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr scoped = StringGrammarPtr::dynamicCast((yyvsp[(1) - (3)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -2752,151 +2752,151 @@ yyreduce: break; case 113: -#line 1029 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1029 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 114: -#line 1032 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1032 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 115: -#line 1035 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1035 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 116: -#line 1038 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1038 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 117: -#line 1041 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1041 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 118: -#line 1044 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1044 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 119: -#line 1047 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1047 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 120: -#line 1050 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1050 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 121: -#line 1053 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1053 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 122: -#line 1056 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1056 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 123: -#line 1059 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1059 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 124: -#line 1062 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1062 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 125: -#line 1065 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1065 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 126: -#line 1068 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1068 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 127: -#line 1071 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1071 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 128: -#line 1074 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1074 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 129: -#line 1077 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1077 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 130: -#line 1080 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1080 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 131: -#line 1083 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1083 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 132: -#line 1086 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1086 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 133: -#line 1089 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1089 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 134: -#line 1092 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1092 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 135: -#line 1095 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1095 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 136: -#line 1098 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1098 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 137: -#line 1101 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1101 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; @@ -3117,7 +3117,7 @@ yyreturn: } -#line 1105 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1105 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" diff --git a/tools/tarsparse/tars.lex.cpp b/tools/tarsparse/tars.lex.cpp index bf25792..8265e74 100644 --- a/tools/tarsparse/tars.lex.cpp +++ b/tools/tarsparse/tars.lex.cpp @@ -513,7 +513,7 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 1 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" /** * Tencent is pleased to support the open source community by making Tars available. * @@ -529,7 +529,7 @@ char *yytext; * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ -#line 20 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 20 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" #include #include #include @@ -742,7 +742,7 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 67 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 67 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" #line 749 "tars.lex.cpp" @@ -840,12 +840,12 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 69 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 69 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { BEGIN(INCL); } YY_BREAK case 2: YY_RULE_SETUP -#line 71 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 71 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { if ( include_file_stack_ptr >= MAX_INCLUDE_DEPTH ) { @@ -878,7 +878,7 @@ YY_RULE_SETUP YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INCL): -#line 101 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 101 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { --include_file_stack_ptr; if ( include_file_stack_ptr < 0 ) @@ -897,14 +897,14 @@ case YY_STATE_EOF(INCL): YY_BREAK case 3: YY_RULE_SETUP -#line 117 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 117 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { return TARS_SCOPE_DELIMITER; } YY_BREAK case 4: YY_RULE_SETUP -#line 121 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 121 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { // C++ comment bool e = false; @@ -925,7 +925,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 139 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 139 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { // C comment bool e = false; @@ -976,7 +976,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 187 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 187 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { StringGrammarPtr ident = new StringGrammar; ident->v = yytext; @@ -987,7 +987,7 @@ YY_RULE_SETUP case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 194 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 194 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { StringGrammarPtr ident = new StringGrammar; ident->v = yytext; @@ -1000,7 +1000,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 204 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 204 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { StringGrammarPtr str = new StringGrammar; bool e = false; @@ -1115,7 +1115,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 316 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 316 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { errno = 0; IntergerGrammarPtr ptr = new IntergerGrammar; @@ -1140,7 +1140,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 338 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 338 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { errno = 0; FloatGrammarPtr ptr = new FloatGrammar; @@ -1175,7 +1175,7 @@ YY_RULE_SETUP case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 369 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 369 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { if(yytext[0] == '\n') { @@ -1185,7 +1185,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 376 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 376 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" { if(yytext[0] < 32 || yytext[0] > 126) { @@ -1204,7 +1204,7 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 392 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 392 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" ECHO; YY_BREAK #line 1211 "tars.lex.cpp" @@ -2214,7 +2214,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 392 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" +#line 392 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l" diff --git a/tools/tarsparse/tars.tab.cpp b/tools/tarsparse/tars.tab.cpp index 3d5e113..234486d 100644 --- a/tools/tarsparse/tars.tab.cpp +++ b/tools/tarsparse/tars.tab.cpp @@ -136,7 +136,7 @@ /* Copy the first part of user declarations. */ -#line 17 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 17 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" #include #include @@ -1649,81 +1649,81 @@ yyreduce: switch (yyn) { case 3: -#line 75 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 75 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 5: -#line 79 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 79 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { yyerrok; ;} break; case 7: -#line 84 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 84 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("`;' missing after definition"); ;} break; case 8: -#line 88 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 88 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 9: -#line 96 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 96 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || NamespacePtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 10: -#line 100 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 100 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || InterfacePtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 11: -#line 104 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 104 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || StructPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 12: -#line 108 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 108 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 13: -#line 111 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 111 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || EnumPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 14: -#line 115 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 115 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { assert((yyvsp[(1) - (1)]) == 0 || ConstPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} break; case 15: -#line 124 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 124 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 16: -#line 128 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 128 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(3) - (5)])) { @@ -1740,7 +1740,7 @@ yyreduce: break; case 17: -#line 147 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 147 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { NamespacePtr c = NamespacePtr::dynamicCast(g_parse->currentContainer()); if(!c) @@ -1756,7 +1756,7 @@ yyreduce: break; case 18: -#line 160 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 160 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); g_parse->error("keyword `" + ident->v + "' cannot be used as enumeration name"); @@ -1765,20 +1765,20 @@ yyreduce: break; case 19: -#line 171 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 171 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(2) - (3)]); ;} break; case 20: -#line 175 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 175 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 21: -#line 183 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 183 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast(g_parse->createBuiltin(Builtin::KindLong)); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -1792,7 +1792,7 @@ yyreduce: break; case 22: -#line 194 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 194 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); g_parse->error("keyword `" + ident->v + "' cannot be used as enumerator"); @@ -1800,7 +1800,7 @@ yyreduce: break; case 23: -#line 199 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 199 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast(g_parse->createBuiltin(Builtin::KindLong)); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (3)])); @@ -1816,13 +1816,13 @@ yyreduce: break; case 24: -#line 212 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 212 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 25: -#line 220 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 220 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); ContainerPtr c = g_parse->currentContainer(); @@ -1840,7 +1840,7 @@ yyreduce: break; case 26: -#line 235 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 235 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(3) - (6)])) { @@ -1855,7 +1855,7 @@ yyreduce: break; case 27: -#line 253 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 253 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(3) - (4)])); StructPtr sp = StructPtr::dynamicCast(g_parse->findUserType(ident->v)); @@ -1869,13 +1869,13 @@ yyreduce: break; case 28: -#line 264 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 264 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 29: -#line 272 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 272 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); StructPtr np = g_parse->getKeyStruct(); @@ -1891,7 +1891,7 @@ yyreduce: break; case 30: -#line 285 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 285 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(3) - (3)])); StructPtr np = g_parse->getKeyStruct(); @@ -1907,7 +1907,7 @@ yyreduce: break; case 31: -#line 304 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 304 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -1927,7 +1927,7 @@ yyreduce: break; case 32: -#line 321 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 321 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(2) - (5)])) { @@ -1942,14 +1942,14 @@ yyreduce: break; case 33: -#line 338 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 338 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; case 34: -#line 342 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 342 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); g_parse->error("keyword `" + ident->v + "' cannot be used as interface name"); @@ -1958,32 +1958,32 @@ yyreduce: break; case 35: -#line 353 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 353 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 36: -#line 356 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 356 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 37: -#line 359 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 359 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("`;' missing after definition"); ;} break; case 38: -#line 363 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 363 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 40: -#line 377 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 377 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(1) - (3)])) { @@ -1998,7 +1998,7 @@ yyreduce: break; case 41: -#line 394 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 394 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr returnType = TypePtr::dynamicCast((yyvsp[(1) - (2)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2025,20 +2025,20 @@ yyreduce: break; case 43: -#line 424 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 424 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = 0; ;} break; case 44: -#line 434 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 434 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 45: -#line 437 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 437 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -2052,7 +2052,7 @@ yyreduce: break; case 46: -#line 448 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 448 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -2066,7 +2066,7 @@ yyreduce: break; case 47: -#line 459 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 459 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isOutParam = BoolGrammarPtr::dynamicCast((yyvsp[(1) - (2)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2081,7 +2081,7 @@ yyreduce: break; case 48: -#line 471 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 471 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isOutParam = BoolGrammarPtr::dynamicCast((yyvsp[(3) - (4)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(4) - (4)])); @@ -2096,7 +2096,7 @@ yyreduce: break; case 49: -#line 483 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 483 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isRouteKeyParam = BoolGrammarPtr::dynamicCast((yyvsp[(1) - (2)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2111,7 +2111,7 @@ yyreduce: break; case 50: -#line 495 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 495 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr isRouteKeyParam = BoolGrammarPtr::dynamicCast((yyvsp[(3) - (4)])); TypeIdPtr tsp = TypeIdPtr::dynamicCast((yyvsp[(4) - (4)])); @@ -2126,21 +2126,21 @@ yyreduce: break; case 51: -#line 507 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 507 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("'out' must be defined with a type"); ;} break; case 52: -#line 511 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 511 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("'routekey' must be defined with a type"); ;} break; case 53: -#line 520 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 520 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr routekey = new BoolGrammar; routekey->v = true; @@ -2149,7 +2149,7 @@ yyreduce: break; case 54: -#line 531 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 531 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { BoolGrammarPtr out = new BoolGrammar; out->v = true; @@ -2158,7 +2158,7 @@ yyreduce: break; case 55: -#line 542 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 542 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); NamespacePtr np = NamespacePtr::dynamicCast(g_parse->currentContainer()); @@ -2183,7 +2183,7 @@ yyreduce: break; case 56: -#line 564 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 564 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { if((yyvsp[(2) - (5)])) { @@ -2201,14 +2201,14 @@ yyreduce: break; case 57: -#line 584 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 584 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; case 58: -#line 588 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 588 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2217,41 +2217,41 @@ yyreduce: break; case 59: -#line 594 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 594 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("abstract declarator '' used as declaration"); ;} break; case 60: -#line 603 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 603 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 61: -#line 607 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 607 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("';' missing after definition"); ;} break; case 62: -#line 611 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 611 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 63: -#line 621 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 621 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast((yyvsp[(1) - (1)])); ;} break; case 64: -#line 630 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 630 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2272,7 +2272,7 @@ yyreduce: break; case 65: -#line 648 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 648 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2297,7 +2297,7 @@ yyreduce: break; case 66: -#line 670 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 670 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2322,7 +2322,7 @@ yyreduce: break; case 67: -#line 692 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 692 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StructPtr np = StructPtr::dynamicCast(g_parse->currentContainer()); if(np) @@ -2342,35 +2342,35 @@ yyreduce: break; case 68: -#line 709 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 709 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'tag'"); ;} break; case 69: -#line 713 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 713 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'tag'"); ;} break; case 70: -#line 717 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 717 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'require' or 'optional'"); ;} break; case 71: -#line 721 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 721 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("struct member need 'tag' or 'require' or 'optional'"); ;} break; case 72: -#line 730 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 730 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { IntergerGrammarPtr intVal = IntergerGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ostringstream sstr; @@ -2383,7 +2383,7 @@ yyreduce: break; case 73: -#line 740 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 740 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { FloatGrammarPtr floatVal = FloatGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ostringstream sstr; @@ -2396,7 +2396,7 @@ yyreduce: break; case 74: -#line 750 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 750 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ConstGrammarPtr c = new ConstGrammar(); @@ -2407,7 +2407,7 @@ yyreduce: break; case 75: -#line 758 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 758 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ConstGrammarPtr c = new ConstGrammar(); @@ -2418,7 +2418,7 @@ yyreduce: break; case 76: -#line 766 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 766 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); ConstGrammarPtr c = new ConstGrammar(); @@ -2429,7 +2429,7 @@ yyreduce: break; case 77: -#line 774 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 774 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -2445,7 +2445,7 @@ yyreduce: break; case 78: -#line 787 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 787 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr scoped = StringGrammarPtr::dynamicCast((yyvsp[(1) - (3)])); @@ -2463,7 +2463,7 @@ yyreduce: break; case 79: -#line 807 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 807 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { NamespacePtr np = NamespacePtr::dynamicCast(g_parse->currentContainer()); if(!np) @@ -2479,7 +2479,7 @@ yyreduce: break; case 80: -#line 825 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 825 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (2)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2491,7 +2491,7 @@ yyreduce: break; case 81: -#line 834 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 834 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = g_parse->createVector(TypePtr::dynamicCast((yyvsp[(1) - (5)]))); IntergerGrammarPtr iPtrSize = IntergerGrammarPtr::dynamicCast((yyvsp[(4) - (5)])); @@ -2504,7 +2504,7 @@ yyreduce: break; case 82: -#line 844 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 844 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = g_parse->createVector(TypePtr::dynamicCast((yyvsp[(1) - (3)]))); //IntergerGrammarPtr iPtrSize = IntergerGrammarPtr::dynamicCast($4); @@ -2517,7 +2517,7 @@ yyreduce: break; case 83: -#line 854 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 854 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (4)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2529,7 +2529,7 @@ yyreduce: break; case 84: -#line 863 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 863 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); g_parse->error("keyword `" + ident->v + "' cannot be used as data member name"); @@ -2537,21 +2537,21 @@ yyreduce: break; case 85: -#line 868 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 868 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("missing data member name"); ;} break; case 86: -#line 872 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 872 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("unkown type"); ;} break; case 87: -#line 881 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 881 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (3)])); @@ -2563,112 +2563,112 @@ yyreduce: break; case 88: -#line 890 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 890 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = (yyvsp[(1) - (1)]); ;} break; case 89: -#line 894 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 894 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("array missing size"); ;} break; case 90: -#line 903 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 903 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindBool); ;} break; case 91: -#line 907 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 907 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindByte); ;} break; case 92: -#line 911 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 911 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindShort,true); ;} break; case 93: -#line 915 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 915 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindShort); ;} break; case 94: -#line 919 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 919 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindInt,true); ;} break; case 95: -#line 923 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 923 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindInt); ;} break; case 96: -#line 927 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 927 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindLong,true); ;} break; case 97: -#line 931 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 931 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindLong); ;} break; case 98: -#line 935 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 935 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindFloat); ;} break; case 99: -#line 939 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 939 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindDouble); ;} break; case 100: -#line 943 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 943 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = g_parse->createBuiltin(Builtin::KindString); ;} break; case 101: -#line 947 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 947 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast((yyvsp[(1) - (1)])); ;} break; case 102: -#line 951 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 951 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast((yyvsp[(1) - (1)])); ;} break; case 103: -#line 955 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 955 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(1) - (1)])); TypePtr sp = g_parse->findUserType(ident->v); @@ -2684,55 +2684,55 @@ yyreduce: break; case 104: -#line 973 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 973 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast(g_parse->createVector(TypePtr::dynamicCast((yyvsp[(3) - (4)])))); ;} break; case 105: -#line 977 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 977 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("vector error"); ;} break; case 106: -#line 981 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 981 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("vector missing '>'"); ;} break; case 107: -#line 985 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 985 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("vector missing type"); ;} break; case 108: -#line 994 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 994 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { (yyval) = GrammarBasePtr::dynamicCast(g_parse->createMap(TypePtr::dynamicCast((yyvsp[(3) - (6)])), TypePtr::dynamicCast((yyvsp[(5) - (6)])))); ;} break; case 109: -#line 998 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 998 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { g_parse->error("map error"); ;} break; case 110: -#line 1007 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1007 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 111: -#line 1010 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1010 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(2) - (2)])); ident->v = "::" + ident->v; @@ -2741,7 +2741,7 @@ yyreduce: break; case 112: -#line 1016 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1016 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { StringGrammarPtr scoped = StringGrammarPtr::dynamicCast((yyvsp[(1) - (3)])); StringGrammarPtr ident = StringGrammarPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -2752,151 +2752,151 @@ yyreduce: break; case 113: -#line 1029 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1029 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 114: -#line 1032 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1032 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 115: -#line 1035 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1035 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 116: -#line 1038 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1038 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 117: -#line 1041 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1041 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 118: -#line 1044 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1044 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 119: -#line 1047 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1047 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 120: -#line 1050 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1050 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 121: -#line 1053 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1053 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 122: -#line 1056 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1056 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 123: -#line 1059 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1059 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 124: -#line 1062 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1062 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 125: -#line 1065 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1065 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 126: -#line 1068 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1068 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 127: -#line 1071 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1071 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 128: -#line 1074 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1074 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 129: -#line 1077 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1077 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 130: -#line 1080 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1080 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 131: -#line 1083 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1083 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 132: -#line 1086 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1086 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 133: -#line 1089 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1089 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 134: -#line 1092 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1092 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 135: -#line 1095 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1095 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 136: -#line 1098 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1098 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; case 137: -#line 1101 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1101 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" { ;} break; @@ -3117,7 +3117,7 @@ yyreturn: } -#line 1105 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y" +#line 1105 "/Users/jarod/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.y"