Changeset 160 for trunk/src/byteplex.h


Ignore:
Timestamp:
Jun 20, 2008, 3:30:40 PM (11 years ago)
Author:
lindanl
Message:

Restructured character set architecture; StringPool? in symbol table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/byteplex.h

    r143 r160  
    8080        virtual void InitializeBuffer(unsigned char * src, int lgth) = 0;
    8181        virtual void AdvanceInputBuffer(int advance_amt) = 0;
    82 
     82        virtual int UTF8_Length(int name_pos, int lgth)=0;
     83        virtual void to_UTF8(int name_pos, int lgth, char * u8_ptr)=0;
    8384        /* Source code unit buffer. */
    8485        BytePack * src_buffer;
     
    109110class X8_Buffer : public Byteplex {
    110111public:
     112        static const CodeUnit_Base Base = C;
     113        static const CodeUnit_Size Size = SingleByte;
    111114        X8_Buffer();
    112115        ~X8_Buffer();
     
    116119        void AdvanceInputBuffer(int advance_amt);
    117120        void InitializeBuffer(unsigned char * src, int lgth);
     121        int UTF8_Length(int name_pos, int lgth);
     122        void to_UTF8(int name_pos, int lgth, char * u8_ptr);
     123};
     124
     125class UTF8_Buffer : public Byteplex {
     126public:
     127        static const CodeUnit_Base Base = ASCII;
     128        static const CodeUnit_Size Size = SingleByte;
     129        UTF8_Buffer();
     130        ~UTF8_Buffer();
     131       
     132        void DoByteplex();
     133        void PreparePseudoASCII_Stream();
     134        void AdvanceInputBuffer(int advance_amt);
     135        void InitializeBuffer(unsigned char * src, int lgth);
     136        int UTF8_Length(int name_pos, int lgth);
     137        void to_UTF8(int name_pos, int lgth, char * u8_ptr);
    118138};
    119139
     
    127147class U16_Buffer : public Byteplex {
    128148public:
     149        static const CodeUnit_Base Base = ASCII;
     150        static const CodeUnit_Size Size = DoubleByte;
    129151        U16_Buffer();
    130152        ~U16_Buffer();
     
    133155        void AdvanceInputBuffer(int advance_amt);
    134156        void InitializeBuffer(unsigned char * src, int lgth);
     157        int UTF8_Length(int name_pos, int lgth);
     158        void to_UTF8(int name_pos, int lgth, char * u8_ptr);
    135159protected:
    136160        BytePack * x16hi;
     
    158182class U32_Buffer : public Byteplex {
    159183public:
     184        static const CodeUnit_Base Base = ASCII;
     185        static const CodeUnit_Size Size = QuadByte;
    160186        U32_Buffer();
    161187        ~U32_Buffer();
     
    164190        void AdvanceInputBuffer(int advance_amt);
    165191        void InitializeBuffer(unsigned char * src, int lgth);
     192        int UTF8_Length(int name_pos, int lgth);
     193        void to_UTF8(int name_pos, int lgth, char * u8_ptr);
    166194protected:
    167195        BytePack * x32hh;
     
    195223};
    196224
     225
     226inline char * copy_name (char * s, int lgth){           
     227        char * d = new char[lgth+1];
     228        memcpy(d, s,lgth);
     229        d[lgth] = '\0';
     230        return d;
     231}
     232
    197233#endif
     234
     235
Note: See TracChangeset for help on using the changeset viewer.