00001 /* 00002 Copyright (c) 2009, 2010 mingw-w64 project 00003 00004 Contributing authors: Kai Tietz, Jonathan Yong 00005 00006 Permission is hereby granted, free of charge, to any person obtaining a 00007 copy of this software and associated documentation files (the "Software"), 00008 to deal in the Software without restriction, including without limitation 00009 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00010 and/or sell copies of the Software, and to permit persons to whom the 00011 Software is furnished to do so, subject to the following conditions: 00012 00013 The above copyright notice and this permission notice shall be included in 00014 all copies or substantial portions of the Software. 00015 00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00021 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00022 DEALINGS IN THE SOFTWARE. 00023 */ 00046 #ifndef _M_MS_HXX 00047 #define _M_MS_HXX 00048 00049 #include "m_token.h" 00050 00051 #define ENCODING_TYPE_MS 1 00052 00059 typedef struct sCached { 00060 int count; 00061 uMToken *arr[10]; 00062 } sCached; 00063 00064 typedef struct sMSCtx { 00065 libmangle_gc_context_t *gc; 00066 const char *name; 00067 const char *end; 00068 const char *pos; 00069 int err; 00070 int fExplicitTemplateParams; 00071 int fGetTemplateArgumentList; 00072 sCached *pZNameList; 00073 sCached *pTemplateArgList; 00074 sCached *pArgList; 00075 } sMSCtx; 00076 00077 #define GET_CHAR(CTX) ((CTX)->pos == (CTX)->end ? 0 : (CTX)->pos[0]) 00078 #define INC_CHAR(CTX) do { if ((CTX)->pos != (CTX)->end) (CTX)->pos++; } while (0) 00079 #define DEC_CHAR(CTX) do { if ((CTX)->pos != (CTX)->name) (CTX)->pos--; } while (0) 00080 #define SKIP_CHAR(CTX,LEN) do { (CTX)->pos += (LEN); if ((CTX)->pos > (CTX)->end) (CTX)->pos=(CTX)->end; } while (0) 00081 00092 uMToken *libmangle_decode_ms_name (libmangle_gc_context_t *gc, const char *name); 00093 char *libmangle_encode_ms_name (libmangle_gc_context_t *gc, uMToken *tok); 00094 00095 #endif