Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Enumerations | Functions | Variables
nsVCard.cpp File Reference
#include "nsVCard.h"
#include "nsVCardObj.h"
#include "nsFileStream.h"
#include "prprf.h"
#include "prmem.h"
#include "plstr.h"

Go to the source code of this file.

Classes

union  YYSTYPE
struct  LexBuf

Defines

#define DBG_(x)
#define _SUPPORT_LINE_FOLDING
#define yyparse   mime_parse
#define yylex   mime_lex
#define yyerror   mime_error
#define yychar   mime_char
#define yyval   mime_yyval
#define yylval   mime_yylval
#define yydebug   mime_debug
#define yynerrs   mime_nerrs
#define yyerrflag   mime_errflag
#define yyss   mime_ss
#define yyssp   mime_ssp
#define yyvs   mime_vs
#define yyvsp   mime_vsp
#define yylhs   mime_lhs
#define yylen   mime_len
#define yydefred   mime_defred
#define yydgoto   mime_dgoto
#define yysindex   mime_sindex
#define yyrindex   mime_rindex
#define yygindex   mime_gindex
#define yytable   mime_table
#define yycheck   mime_check
#define yyname   mime_name
#define yyrule   mime_rule
#define YYPREFIX   "mime_"
#define FALSE   0
#define TRUE   1
#define YYDEBUG   0 /* 1 to compile in some debugging code */
#define PR_MAXTOKEN   256 /* maximum token (line) length */
#define YYSTACKSIZE   50 /* ~unref ?*/
#define PR_MAXLEVEL   10 /* max # of nested objects parseable */
#define EQ   257
#define COLON   258
#define DOT   259
#define SEMICOLON   260
#define SPACE   261
#define HTAB   262
#define LINESEP   263
#define NEWLINE   264
#define BEGIN_VCARD   265
#define END_VCARD   266
#define BEGIN_VCAL   267
#define END_VCAL   268
#define BEGIN_VEVENT   269
#define END_VEVENT   270
#define BEGIN_VTODO   271
#define END_VTODO   272
#define ID   273
#define STRING   274
#define YYERRCODE   256
#define YYTABLESIZE   268
#define YYFINAL   3
#define YYPR_MAXTOKEN   274
#define yyclearin   (yychar=(-1))
#define yyerrok   (yyerrflag=0)
#define yystacksize   YYSTACKSIZE
#define PR_MAX_LEX_LOOKAHEAD_0   32
#define PR_MAX_LEX_LOOKAHEAD   64
#define PR_MAX_LEX_MODE_STACK_SIZE   10
#define LEXMODE()   (lexBuf.lexModeStack[lexBuf.lexModeStackTop])
#define YYABORT   goto yyabort
#define YYACCEPT   goto yyaccept
#define YYERROR   goto yyerrlab

Enumerations

enum  LexMode {
  L_NORMAL, L_VCARD, L_VCAL, L_VEVENT,
  L_VTODO, L_VALUES, L_BASE64, L_QUOTED_PRINTABLE
}

Functions

void yyerror (char *s)
int yyparse ()
static int pushVObject (const char *prop)
static VObjectpopVObject ()
static int lexGeta ()
static int lexGetc_ ()
static int lexGetc ()
static void lexSkipLookahead ()
static int lexLookahead ()
static void lexSkipWhite ()
static void lexClearToken ()
static char * lexStr ()
static char * lexGetDataFromBase64 ()
static char * lexGetQuotedPrintable ()
static char * lexGet1Value ()
static char * lexGetWord ()
static void finiLex ()
static VObjectparse_MIMEHelper ()
static void lexPopMode (int top)
static int lexWithinMode (enum LexMode mode)
static void lexPushMode (enum LexMode mode)
static void enterProps (const char *s)
static void enterAttr (const char *s1, const char *s2)
static void enterValues (const char *value)
static void mime_error_ (char *s)
void deleteString (char *p)
static int lexGeta_ (int i)
static void lexSkipLookaheadWord ()
static void lexAppendc (int c)
static void lexPushLookaheadc (int c)
static char * lexLookaheadWord ()
static void handleMoreRFC822LineBreak (int c)
static int match_begin_name (int end)
void initLex (const char *inputstring, unsigned long inputlen, nsInputFileStream *inputFile)
static int match_begin_end_name (int end)
static int yylex ()
VObjectparse_MIME (const char *input, unsigned long len)
VObjectparse_MIME_FromFile (nsInputFileStream *file)
VObjectparse_MIME_FromFileName (nsFileSpec *fname)
void registerMimeErrorHandler (MimeErrorHandler me)
void mime_error (char *s)

Variables

char yysccsid [] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90"
int mime_lineNum
int mime_numErrors
static VObjectvObjList
static VObjectcurProp
static VObjectcurObj
static VObjectObjStack [PR_MAXLEVEL]
static int ObjStackTop
char ** fieldedProp
short yylhs []
short yylen []
short yydefred []
short yydgoto []
short yysindex []
short yyrindex []
short yygindex []
short yytable []
short yycheck []
int yydebug
int yynerrs
int yyerrflag
int yychar
short * yyssp
YYSTYPEyyvsp
YYSTYPE yyval
YYSTYPE yylval
short yyss [YYSTACKSIZE]
YYSTYPE yyvs [YYSTACKSIZE]
struct LexBuf lexBuf
static MimeErrorHandler mimeErrorHandler

Class Documentation

union YYSTYPE

Definition at line 229 of file nsVCard.cpp.

Collaboration diagram for YYSTYPE:
Class Members
char * str
VObject * vobj
struct LexBuf

Definition at line 534 of file nsVCard.cpp.

Class Members
short buf
unsigned long curPos
unsigned long getPtr
nsInputFileStream * inputFile
unsigned long inputLen
char * inputString
unsigned long len
unsigned long lexModeStackTop

Define Documentation

Definition at line 108 of file nsVCard.cpp.

#define BEGIN_VCAL   267

Definition at line 244 of file nsVCard.cpp.

#define BEGIN_VCARD   265

Definition at line 242 of file nsVCard.cpp.

#define BEGIN_VEVENT   269

Definition at line 246 of file nsVCard.cpp.

#define BEGIN_VTODO   271

Definition at line 248 of file nsVCard.cpp.

#define COLON   258

Definition at line 235 of file nsVCard.cpp.

#define DBG_ (   x)

Definition at line 105 of file nsVCard.cpp.

#define DOT   259

Definition at line 236 of file nsVCard.cpp.

#define END_VCAL   268

Definition at line 245 of file nsVCard.cpp.

#define END_VCARD   266

Definition at line 243 of file nsVCard.cpp.

#define END_VEVENT   270

Definition at line 247 of file nsVCard.cpp.

#define END_VTODO   272

Definition at line 249 of file nsVCard.cpp.

#define EQ   257

Definition at line 234 of file nsVCard.cpp.

#define FALSE   0

Definition at line 151 of file nsVCard.cpp.

#define HTAB   262

Definition at line 239 of file nsVCard.cpp.

#define ID   273

Definition at line 250 of file nsVCard.cpp.

#define LEXMODE ( )    (lexBuf.lexModeStack[lexBuf.lexModeStackTop])

Definition at line 532 of file nsVCard.cpp.

#define LINESEP   263

Definition at line 240 of file nsVCard.cpp.

#define NEWLINE   264

Definition at line 241 of file nsVCard.cpp.

Definition at line 530 of file nsVCard.cpp.

Definition at line 529 of file nsVCard.cpp.

Definition at line 531 of file nsVCard.cpp.

#define PR_MAXLEVEL   10 /* max # of nested objects parseable */

Definition at line 162 of file nsVCard.cpp.

#define PR_MAXTOKEN   256 /* maximum token (line) length */

Definition at line 160 of file nsVCard.cpp.

#define SEMICOLON   260

Definition at line 237 of file nsVCard.cpp.

#define SPACE   261

Definition at line 238 of file nsVCard.cpp.

#define STRING   274

Definition at line 251 of file nsVCard.cpp.

#define TRUE   1

Definition at line 154 of file nsVCard.cpp.

#define YYABORT   goto yyabort

Definition at line 1308 of file nsVCard.cpp.

#define YYACCEPT   goto yyaccept

Definition at line 1309 of file nsVCard.cpp.

#define yychar   mime_char

Definition at line 120 of file nsVCard.cpp.

#define yycheck   mime_check

Definition at line 142 of file nsVCard.cpp.

#define yyclearin   (yychar=(-1))

Definition at line 427 of file nsVCard.cpp.

#define yydebug   mime_debug

Definition at line 127 of file nsVCard.cpp.

#define YYDEBUG   0 /* 1 to compile in some debugging code */

Definition at line 159 of file nsVCard.cpp.

#define yydefred   mime_defred

Definition at line 136 of file nsVCard.cpp.

#define yydgoto   mime_dgoto

Definition at line 137 of file nsVCard.cpp.

#define YYERRCODE   256

Definition at line 252 of file nsVCard.cpp.

#define yyerrflag   mime_errflag

Definition at line 129 of file nsVCard.cpp.

Definition at line 428 of file nsVCard.cpp.

Definition at line 119 of file nsVCard.cpp.

#define YYERROR   goto yyerrlab

Definition at line 1310 of file nsVCard.cpp.

#define YYFINAL   3

Definition at line 360 of file nsVCard.cpp.

#define yygindex   mime_gindex

Definition at line 140 of file nsVCard.cpp.

#define yylen   mime_len

Definition at line 135 of file nsVCard.cpp.

#define yylex   mime_lex

Definition at line 118 of file nsVCard.cpp.

#define yylhs   mime_lhs

Definition at line 134 of file nsVCard.cpp.

#define yylval   mime_yylval

Definition at line 126 of file nsVCard.cpp.

#define yyname   mime_name

Definition at line 143 of file nsVCard.cpp.

#define yynerrs   mime_nerrs

Definition at line 128 of file nsVCard.cpp.

#define yyparse   mime_parse

Definition at line 117 of file nsVCard.cpp.

#define YYPR_MAXTOKEN   274

Definition at line 364 of file nsVCard.cpp.

#define YYPREFIX   "mime_"

Definition at line 145 of file nsVCard.cpp.

#define yyrindex   mime_rindex

Definition at line 139 of file nsVCard.cpp.

#define yyrule   mime_rule

Definition at line 144 of file nsVCard.cpp.

#define yysindex   mime_sindex

Definition at line 138 of file nsVCard.cpp.

#define yyss   mime_ss

Definition at line 130 of file nsVCard.cpp.

#define yyssp   mime_ssp

Definition at line 131 of file nsVCard.cpp.

#define YYSTACKSIZE   50 /* ~unref ?*/

Definition at line 161 of file nsVCard.cpp.

Definition at line 444 of file nsVCard.cpp.

#define yytable   mime_table

Definition at line 141 of file nsVCard.cpp.

#define YYTABLESIZE   268

Definition at line 301 of file nsVCard.cpp.

#define yyval   mime_yyval

Definition at line 123 of file nsVCard.cpp.

#define yyvs   mime_vs

Definition at line 132 of file nsVCard.cpp.

#define yyvsp   mime_vsp

Definition at line 133 of file nsVCard.cpp.


Enumeration Type Documentation

enum LexMode
Enumerator:
L_NORMAL 
L_VCARD 
L_VCAL 
L_VEVENT 
L_VTODO 
L_VALUES 
L_BASE64 
L_QUOTED_PRINTABLE 

Definition at line 189 of file nsVCard.cpp.


Function Documentation

void deleteString ( char *  p)

Definition at line 182 of file nsVCardObj.cpp.

{
    if (p) 
      PR_Free ((void*)p);
}

Here is the caller graph for this function:

static void enterAttr ( const char *  s1,
const char *  s2 
) [static]

Definition at line 508 of file nsVCard.cpp.

Here is the call graph for this function:

static void enterProps ( const char *  s) [static]

Definition at line 502 of file nsVCard.cpp.

    {
    curProp = addGroup(curObj,s);
    deleteString((char *)s);
    }

Here is the call graph for this function:

static void enterValues ( const char *  value) [static]

Definition at line 485 of file nsVCard.cpp.

    {
    if (fieldedProp && *fieldedProp) {
       if (value) {
           addPropValue(curProp,*fieldedProp,value);
           }
       /* else this field is empty, advance to next field */
       fieldedProp++;
       }
    else {
       if (value) {
           setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
           }
       }
    deleteString((char *)value);
    }

Here is the call graph for this function:

static void finiLex ( ) [static]

Definition at line 906 of file nsVCard.cpp.

                      {
    PR_FREEIF(lexBuf.strs);
    }

Here is the caller graph for this function:

static void handleMoreRFC822LineBreak ( int  c) [static]

Definition at line 768 of file nsVCard.cpp.

                                             {
    /* support RFC 822 line break in cases like
     * ADR: foo;
     *    morefoo;
     *    more foo;
     */
    if (c == ';') {
       int a;
       lexSkipLookahead();
       /* skip white spaces */
       a = lexLookahead();
       while (a == ' ' || a == '\t') {
           lexSkipLookahead();
           a = lexLookahead();
           }
       if (a == '\n') {
           lexSkipLookahead();
           a = lexLookahead();
           if (a == ' ' || a == '\t') {
              /* continuation, throw away all the \n and spaces read so
               * far
               */
              lexSkipWhite();
              lexPushLookaheadc(';');
              }
           else {
              lexPushLookaheadc('\n');
              lexPushLookaheadc(';');
              }
           }
       else {
           lexPushLookaheadc(';');
           }
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void initLex ( const char *  inputstring,
unsigned long  inputlen,
nsInputFileStream *  inputFile 
)

Definition at line 886 of file nsVCard.cpp.

    {
    /* initialize lex mode stack */
    lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL;

    /* iniatialize lex buffer. */
    lexBuf.inputString = (char*) inputstring;
    lexBuf.inputLen = inputlen;
    lexBuf.curPos = 0;
    lexBuf.inputFile = inputFile;

    lexBuf.len = 0;
    lexBuf.getPtr = 0;

    lexBuf.maxToken = PR_MAXTOKEN;
    lexBuf.strs = (char*)PR_CALLOC(PR_MAXTOKEN);
    lexBuf.strsLen = 0;

    }

Here is the caller graph for this function:

static void lexAppendc ( int  c) [static]

Definition at line 670 of file nsVCard.cpp.

    {
    lexBuf.strs[lexBuf.strsLen] = c;
    /* append up to zero termination */
    if (c == 0) return;
    lexBuf.strsLen++;
    if (lexBuf.strsLen >= lexBuf.maxToken) {
       /* double the token string size */
       lexBuf.maxToken <<= 1;
       lexBuf.strs = (char*) PR_Realloc(lexBuf.strs,lexBuf.maxToken);
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static void lexClearToken ( ) [static]

Definition at line 665 of file nsVCard.cpp.

    {
    lexBuf.strsLen = 0;
    }

Here is the caller graph for this function:

static char * lexGet1Value ( ) [static]

Definition at line 804 of file nsVCard.cpp.

                            {
/*  int size = 0; */
    int c;
    lexSkipWhite();
    c = lexLookahead();
    lexClearToken();
    while (c != EOF && c != ';') {
       if (c == '\n') {
           int a;
           lexSkipLookahead();
           a  = lexLookahead();
           if (a == ' ' || a == '\t') {
              lexAppendc(' ');
              lexSkipLookahead();
              }
           else {
              lexPushLookaheadc('\n');
              break;
              }
           }
       else if (c == '\\') {
           int a;
           lexSkipLookahead();
           a = lexLookahead();
           if (a == '\\' || a == ',' || a == ';' || a == ':') {
              lexAppendc(a);
              }
           else if (a == 'n' || a == 'N') {
              lexAppendc('\n');
              }
           else {
              lexAppendc(c);
              lexAppendc(a);
              }
           lexSkipLookahead();
           }
       else {
           lexAppendc(c);
           lexSkipLookahead();
           }
       c = lexLookahead();
       }
    lexAppendc(0);
    handleMoreRFC822LineBreak(c);
    return c==EOF?0:lexStr();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int lexGeta ( ) [static]

Definition at line 602 of file nsVCard.cpp.

    {
    ++lexBuf.len;
    return (lexBuf.buf[lexBuf.getPtr] = lexGetc_());
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int lexGeta_ ( int  i) [static]

Definition at line 608 of file nsVCard.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static int lexGetc ( ) [static]

Definition at line 648 of file nsVCard.cpp.

                     {
    int c = lexLookahead();
    if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
       /* EOF will remain in lookahead buffer */
        lexBuf.getPtr = (lexBuf.getPtr + 1) % PR_MAX_LEX_LOOKAHEAD;
       lexBuf.len--;
        }
    return c;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int lexGetc_ ( ) [static]

Definition at line 582 of file nsVCard.cpp.

{
  /* get next char from input, no buffering. */
  if (lexBuf.curPos == lexBuf.inputLen)
    return EOF;
  else if (lexBuf.inputString)
    return *(lexBuf.inputString + lexBuf.curPos++);
  else 
  {
    char        c;
    nsresult    status;

    status = lexBuf.inputFile->read(&c, 1);
    if (status != 1)
      return -1;
    else
      return c;  
  }
}

Here is the caller graph for this function:

static char * lexGetDataFromBase64 ( ) [static]

Definition at line 915 of file nsVCard.cpp.

    {
    unsigned long bytesLen = 0, bytesMax = 0;
    int quadIx = 0, pad = 0;
    unsigned long trip = 0;
    unsigned char b;
    int c;
    unsigned char *bytes = NULL;
    unsigned char *oldBytes = NULL;

    DBG_(("db: lexGetDataFromBase64\n"));
    while (1) {
       c = lexGetc();
       if (c == '\n') {
           ++mime_lineNum;
           if (lexLookahead() == '\n') {
              /* a '\n' character by itself means end of data */
              break;
              }
           else continue; /* ignore '\n' */
           }
       else {
           if ((c >= 'A') && (c <= 'Z'))
              b = (unsigned char)(c - 'A');
           else if ((c >= 'a') && (c <= 'z'))
              b = (unsigned char)(c - 'a') + 26;
           else if ((c >= '0') && (c <= '9'))
              b = (unsigned char)(c - '0') + 52;
           else if (c == '+')
              b = 62;
           else if (c == '/')
              b = 63;
      else if (c == '=' && (quadIx == 2 || quadIx == 3)) {
              b = 0;
              pad++;
           } else if ((c == ' ') || (c == '\t')) {
              continue;
           } else { /* error condition */
                if (bytes)
                PR_Free (bytes);
                else if (oldBytes)
                PR_Free (oldBytes);
              /* error recovery: skip until 2 adjacent newlines. */
              DBG_(("db: invalid character 0x%x '%c'\n", c,c));
              if (c != EOF)  {
                  c = lexGetc();
                  while (c != EOF) {
                     if (c == '\n' && lexLookahead() == '\n') {
                         ++mime_lineNum;
                         break;
                         }
                     c = lexGetc();
                     }
                  }
              return NULL;
              }
           trip = (trip << 6) | b;
           if (++quadIx == 4) {
              unsigned char outBytes[3];
              int numOut;
              int i;
              for (i = 0; i < 3; i++) {
                  outBytes[2-i] = (unsigned char)(trip & 0xFF);
                  trip >>= 8;
                  }
              numOut = 3 - pad;
              if (bytesLen + numOut > bytesMax) {
                  if (!bytes) {
                     bytesMax = 1024;
                     bytes = (unsigned char*)PR_CALLOC(bytesMax);
                     }
                  else {
                     bytesMax <<= 2;
                     oldBytes = bytes;
                     bytes = (unsigned char*)PR_Realloc(bytes,bytesMax);
                     }
                     if (bytes == 0) {
                     mime_error("out of memory while processing BASE64 data\n");
                     }
                  }
              if (bytes) {
                     memcpy(bytes + bytesLen, outBytes, numOut);
                     bytesLen += numOut;
              }
              trip = 0;
              quadIx = 0;
        pad = 0;
              }
           }
       } /* while */
    DBG_(("db: bytesLen = %d\n",  bytesLen));
    /* kludge: all this won't be necessary if we have tree form
       representation */
       if (bytes) {
       setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
       PR_FREEIF(bytes);
       }
    else if (oldBytes) {
       setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
       PR_FREEIF(oldBytes);
       }
    return 0;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static char * lexGetQuotedPrintable ( ) [static]

Definition at line 1040 of file nsVCard.cpp.

    {
    char cur;
/*  unsigned long len = 0; */

    lexClearToken();
    do {
       cur = lexGetc();
       switch (cur) {
           case '=': {
              int c = 0;
              int next[2];
              int tab [1];
              int i;
              for (i = 0; i < 2; i++) {
                  next[i] = lexGetc();
                  if (next[i] >= '0' && next[i] <= '9')
                     c = c * 16 + next[i] - '0';
                  else if (next[i] >= 'A' && next[i] <= 'F')
                     c = c * 16 + next[i] - 'A' + 10;
                  else
                     break;
                  }
              if (i == 0) {
                  /* single '=' follow by LINESEP is continuation sign? */
                  if (next[0] == '\n') {
                     tab[0] = lexGetc();
                     if (tab[0] == '\t') 
                            lexSkipWhite();
                     ++mime_lineNum;
                     }
                 else {
                            lexAppendc(cur);
                            /* lexPushLookaheadc('=');
                            goto EndString; */
                     } 
                  }
              else if (i == 1) {
                  lexPushLookaheadc(next[1]);
                  lexPushLookaheadc(next[0]);
                  lexAppendc('=');
              } else {
                  lexAppendc(c);
                  }
              break;
              } /* '=' */
           case '\n': {
              lexPushLookaheadc('\n');
              goto EndString;
              }
           case ';': {
              lexPushLookaheadc(';');
              goto EndString;
              }
           case (char)EOF:
              break;
           default:
              lexAppendc(cur);
              break;
           } /* switch */
       } while (cur != (char)EOF);

EndString:
    lexAppendc(0);
    return lexStr();
    } /* LexQuotedPrintable */

Here is the call graph for this function:

Here is the caller graph for this function:

static char * lexGetWord ( ) [static]

Definition at line 695 of file nsVCard.cpp.

                          {
    int c;
    lexSkipWhite();
    lexClearToken();
    c = lexLookahead();
    while (c != EOF && !PL_strchr("\t\n ;:=",(char)c)) {
       lexAppendc(c);
       lexSkipLookahead();
       c = lexLookahead();
       }
    lexAppendc(0);
    return lexStr();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int lexLookahead ( ) [static]

Definition at line 622 of file nsVCard.cpp.

                          {
    int c = (lexBuf.len)?
       lexBuf.buf[lexBuf.getPtr]:
       lexGeta();
    /* do the \r\n -> \n or \r -> \n translation here */
    if (c == '\r') {
       int a = (lexBuf.len>1)?
           lexBuf.buf[(lexBuf.getPtr+1)%PR_MAX_LEX_LOOKAHEAD]:
           lexGeta_(1);
       if (a == '\n') {
           lexSkipLookahead();
           }
       lexBuf.buf[lexBuf.getPtr] = c = '\n';
       }
    else if (c == '\n') {
       int a = (lexBuf.len>1)?
           lexBuf.buf[lexBuf.getPtr+1]:
           lexGeta_(1);
       if (a == '\r') {
           lexSkipLookahead();
           }
       lexBuf.buf[lexBuf.getPtr] = '\n';
       }
    return c;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static char* lexLookaheadWord ( ) [static]

Definition at line 738 of file nsVCard.cpp.

                                {
    /* this function can lookahead word with max size of PR_MAX_LEX_LOOKAHEAD_0
     /  and thing bigger than that will stop the lookahead and return 0;
     / leading white spaces are not recoverable.
     */
    int c;
    int len = 0;
    int curgetptr = 0;
    lexSkipWhite();
    lexClearToken();
    curgetptr = (int) lexBuf.getPtr;      /* remember! */
    while (len < (PR_MAX_LEX_LOOKAHEAD_0)) {
       c = lexGetc();
       len++;
       if (c == EOF || PL_strchr("\t\n ;:=", (char)c)) {
           lexAppendc(0);
           /* restore lookahead buf. */
           lexBuf.len += len;
           lexBuf.getPtr = curgetptr;
           return lexStr();
           }
        else
           lexAppendc(c);
       }
    lexBuf.len += len;      /* char that has been moved to lookahead buffer */
    lexBuf.getPtr = curgetptr;
    return 0;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static void lexPopMode ( int  top) [static]

Definition at line 565 of file nsVCard.cpp.

    {
    /* special case of pop for ease of error recovery -- this
       version will never underflow */
    if (top)
       lexBuf.lexModeStackTop = 0;
    else
       if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--;
    }
static void lexPushLookaheadc ( int  c) [static]

Definition at line 727 of file nsVCard.cpp.

                                     {
    int putptr;
    /* can't putback EOF, because it never leaves lookahead buffer */
    if (c == EOF) return;
    putptr = (int) lexBuf.getPtr - 1;
    if (putptr < 0) putptr += PR_MAX_LEX_LOOKAHEAD;
    lexBuf.getPtr = putptr;
    lexBuf.buf[putptr] = c;
    lexBuf.len += 1;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static void lexPushMode ( enum LexMode  mode) [static]

Definition at line 556 of file nsVCard.cpp.

    {
    if (lexBuf.lexModeStackTop == (PR_MAX_LEX_MODE_STACK_SIZE-1))
       yyerror("lexical context stack overflow");
    else {
       lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode;
       }
    }

Here is the caller graph for this function:

static void lexSkipLookahead ( ) [static]

Definition at line 614 of file nsVCard.cpp.

                               {
    if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
       /* don't skip EOF. */
        lexBuf.getPtr = (lexBuf.getPtr + 1) % PR_MAX_LEX_LOOKAHEAD;
       lexBuf.len--;
        }
    }

Here is the caller graph for this function:

static void lexSkipLookaheadWord ( ) [static]

Definition at line 658 of file nsVCard.cpp.

                                   {
    if (lexBuf.strsLen <= lexBuf.len) {
       lexBuf.len -= lexBuf.strsLen;
       lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % PR_MAX_LEX_LOOKAHEAD;
       }
    }

Here is the caller graph for this function:

static void lexSkipWhite ( ) [static]

Definition at line 687 of file nsVCard.cpp.

                           {
    int c = lexLookahead();
    while (c == ' ' || c == '\t') {
       lexSkipLookahead();
       c = lexLookahead();
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static char * lexStr ( ) [static]

Definition at line 683 of file nsVCard.cpp.

                      {
    return dupStr(lexBuf.strs,lexBuf.strsLen+1);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int lexWithinMode ( enum LexMode  mode) [static]

Definition at line 575 of file nsVCard.cpp.

                                            {
    unsigned long i;
    for (i=0;i<lexBuf.lexModeStackTop;i++)
       if (mode == lexBuf.lexModeStack[i]) return 1;
    return 0;
    }

Here is the caller graph for this function:

static int match_begin_end_name ( int  end) [static]

Definition at line 1019 of file nsVCard.cpp.

                                         {
    int token;
    lexSkipWhite();
    if (lexLookahead() != ':') return ID;
    lexSkipLookahead();
    lexSkipWhite();
    token = match_begin_name(end);
    if (token == ID) {
       lexPushLookaheadc(':');
       DBG_(("db: ID '%s'\n", yylval.str));
       return ID;
       }
    else if (token != 0) {
       lexSkipLookaheadWord();
       deleteString(yylval.str);
       DBG_(("db: begin/end %d\n", token));
       return token;
       }
    return 0;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int match_begin_name ( int  end) [static]

Definition at line 867 of file nsVCard.cpp.

                                     {
    char *n = lexLookaheadWord();
    int token = ID;
    if (n) {
       if (!PL_strcasecmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
       else if (!PL_strcasecmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
       else if (!PL_strcasecmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
       else if (!PL_strcasecmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
       deleteString(n);
       return token;
       }
    return 0;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void mime_error ( char *  s)

Definition at line 1291 of file nsVCard.cpp.

{
  char msg[256];
  if (mimeErrorHandler) {
    PR_snprintf(msg, sizeof(msg), "%s at line %d", s, mime_lineNum);
    mimeErrorHandler(msg);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void mime_error_ ( char *  s) [static]

Definition at line 1300 of file nsVCard.cpp.

Here is the caller graph for this function:

VObject* parse_MIME ( const char *  input,
unsigned long  len 
)

Definition at line 1242 of file nsVCard.cpp.

    {
    initLex(input, len, 0);
    return parse_MIMEHelper();
    }

Here is the call graph for this function:

VObject* parse_MIME_FromFile ( nsInputFileStream *  file)

Definition at line 1249 of file nsVCard.cpp.

{
  VObject *result;   
  long startPos;
  
  initLex(0,(unsigned long)-1,file);
  startPos = file->tell();
  if (!(result = parse_MIMEHelper())) {
    file->seek(startPos);
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1262 of file nsVCard.cpp.

{
#if !defined(MOZADDRSTANDALONE)
  nsInputFileStream *fp = new nsInputFileStream(*fname);
  if (fp) 
  {
    VObject* o = parse_MIME_FromFile(fp);
    fp->close();
    return o;
  }
  else {
    char msg[80];
    PR_snprintf(msg, sizeof(msg), "Can't open file for reading\n");
    mime_error_(msg);
    return 0;
  }
#else
  NS_ASSERTION(FALSE, "1.5 <rhp@netscape.com> 06 Jan 2000 08:00");
  return 0;
#endif
}

Here is the call graph for this function:

static VObject * parse_MIMEHelper ( ) [static]

Definition at line 1226 of file nsVCard.cpp.

    {
    ObjStackTop = -1;
    mime_numErrors = 0;
    mime_lineNum = 1;
    vObjList = 0;
    curObj = 0;

    if (yyparse() != 0)
       return 0;

    finiLex();
    return vObjList;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static VObject * popVObject ( ) [static]

Definition at line 470 of file nsVCard.cpp.

    {
    VObject *oldObj;
    if (ObjStackTop < 0) {
       yyerror("pop on empty Object Stack\n");
       return 0;
       }
    oldObj = curObj;
    curObj = ObjStack[ObjStackTop--];

    return oldObj;
    }
static int pushVObject ( const char *  prop) [static]

Definition at line 449 of file nsVCard.cpp.

    {
    VObject *newObj;
    if (ObjStackTop == PR_MAXLEVEL)
       return FALSE;

    ObjStack[++ObjStackTop] = curObj;

    if (curObj) {
        newObj = addProp(curObj,prop);
        curObj = newObj;
       }
    else
       curObj = newVObject(prop);

    return TRUE;
    }

Here is the call graph for this function:

Definition at line 1286 of file nsVCard.cpp.

    {
    mimeErrorHandler = me;
    }
void yyerror ( char *  s)
static int yylex ( ) [static]

Definition at line 1107 of file nsVCard.cpp.

                   {
/*  int token = 0; */

    int lexmode = LEXMODE();
    if (lexmode == L_VALUES) {
       int c = lexGetc();
       if (c == ';') {
           DBG_(("db: SEMICOLON\n"));
#ifdef _SUPPORT_LINE_FOLDING
           lexPushLookaheadc(c);
           handleMoreRFC822LineBreak(c);
           lexSkipLookahead();
#endif
           return SEMICOLON;
           }
       else if (PL_strchr("\n",(char)c)) {
           ++mime_lineNum;
           /* consume all line separator(s) adjacent to each other */
           c = lexLookahead();
           while (PL_strchr("\n",(char)c)) {
              lexSkipLookahead();
              c = lexLookahead();
              ++mime_lineNum;
              }
           DBG_(("db: LINESEP\n"));
           return LINESEP;
           }
       else {
           char *p = 0;
           lexPushLookaheadc(c);
           if (lexWithinMode(L_BASE64)) {
              /* get each char and convert to bin on the fly... */
              p = lexGetDataFromBase64();
                yylval.str = p;
                return !p && lexLookahead() == EOF ? 0 : STRING;
            }
           else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
              p = lexGetQuotedPrintable();
              }
           else {
#ifdef _SUPPORT_LINE_FOLDING
              p = lexGet1Value();
#else
              p = lexGetStrUntil(";\n");
#endif
              }
           if (p && (*p || lexLookahead() != EOF)) {
              DBG_(("db: STRING: '%s'\n", p));
              yylval.str = p;
              return STRING;
              }
           else return 0;
           }
       }
    else {
       /* normal mode */
       while (1) {
           int c = lexGetc();
           switch(c) {
              case ':': {
                  /* consume all line separator(s) adjacent to each other */
                  /* ignoring linesep immediately after colon. */
                  c = lexLookahead();
                  while (PL_strchr("\n",(char)c)) {
                     lexSkipLookahead();
                     c = lexLookahead();
                     ++mime_lineNum;
                     }
                  DBG_(("db: COLON\n"));
                  return COLON;
                  }
              case ';':
                  DBG_(("db: SEMICOLON\n"));
                  return SEMICOLON;
              case '=':
                  DBG_(("db: EQ\n"));
                  return EQ;
              /* ignore whitespace in this mode */
              case '\t':
              case ' ': continue;
              case '\n': {
                  ++mime_lineNum;
                  continue;
                  }
              case EOF: return 0;
                  break;
              default: {
                  lexPushLookaheadc(c);
                  if (isalpha(c)) {
                     char *t = lexGetWord();
                     yylval.str = t;
                     if (!PL_strcasecmp(t, "BEGIN")) {
                         return match_begin_end_name(0);
                         }
                     else if (!PL_strcasecmp(t,"END")) {
                         return match_begin_end_name(1);
                         }
                      else {
                         DBG_(("db: ID '%s'\n", t));
                         return ID;
                         }
                     }
                  else {
                     /* unknow token */
                     return 0;
                     }
                  break;
                  }
              }
           }
       }
    return 0;
    }

Here is the call graph for this function:

int yyparse ( )

Variable Documentation

VObject* curObj [static]

Definition at line 170 of file nsVCard.cpp.

VObject* curProp [static]

Definition at line 169 of file nsVCard.cpp.

char** fieldedProp

Definition at line 96 of file nsVCardObj.cpp.

struct LexBuf lexBuf

Definition at line 167 of file nsVCard.cpp.

Definition at line 167 of file nsVCard.cpp.

Definition at line 1284 of file nsVCard.cpp.

Definition at line 171 of file nsVCard.cpp.

int ObjStackTop [static]

Definition at line 172 of file nsVCard.cpp.

VObject* vObjList [static]

Definition at line 168 of file nsVCard.cpp.

Definition at line 439 of file nsVCard.cpp.

short yycheck[]
Initial value:
 {                                       8,
    0,  256,  256,  266,  260,  256,  256,  263,   17,  268,
  256,  256,  260,  268,  269,  269,  271,  271,  273,  273,
  266,  272,  273,  273,   33,  270,   35,  273,  273,   39,
  266,  266,  268,  269,  270,  271,  272,  265,  258,  267,
  260,  258,  258,  260,  268,   55,  272,  270,  273,  270,
  257,  260,  274,  272,  268,  263,  258,  263,   12,   41,
   59,   24,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  265,   -1,  267,
}

Definition at line 331 of file nsVCard.cpp.

Definition at line 436 of file nsVCard.cpp.

short yydefred[]
Initial value:
 {                                      0,
    0,    0,    0,    5,    6,    0,    1,    0,    0,    0,
    0,    0,   15,   24,    0,    0,    0,    0,   10,    0,
    0,   38,    0,    0,   36,   37,   33,    3,    0,    8,
   11,   13,    0,    0,    0,    0,   31,   34,    0,   17,
    0,    0,    0,   42,    0,   46,    0,   21,   19,   28,
    0,    0,   40,   44,    0,   25,   14,   23,    0,   26,
}

Definition at line 267 of file nsVCard.cpp.

short yydgoto[]
Initial value:
 {                                       3,
   15,   51,    4,    5,    6,    7,   12,   22,    8,    9,
   17,   18,   52,   42,   40,   29,   41,   48,   59,   23,
   10,   11,   24,   25,   26,   33,   34,   35,   36,
}

Definition at line 275 of file nsVCard.cpp.

Definition at line 438 of file nsVCard.cpp.

short yygindex[]
Initial value:
 {                                      0,
   -9,    0,    0,    0,    0,   47,    0,   -8,    0,    0,
    0,    0,    2,    0,   19,    0,    0,    0,    0,   38,
    0,    0,    0,    0,    0,    0,    0,    0,    0,
}

Definition at line 296 of file nsVCard.cpp.

short yylen[]
Initial value:
 {                                         2,
    1,    0,    3,    1,    1,    1,    0,    4,    0,    3,
    2,    1,    0,    5,    1,    0,    3,    1,    2,    1,
    2,    1,    3,    1,    0,    4,    1,    1,    0,    0,
    4,    0,    3,    2,    1,    1,    1,    1,    0,    4,
    0,    3,    0,    4,    0,    3,
}

Definition at line 260 of file nsVCard.cpp.

short yylhs[]
Initial value:
 {                                        -1,
    0,    7,    6,    6,    5,    5,    9,    3,   10,    3,
    8,    8,   14,   11,   11,   16,   12,   12,   15,   15,
   17,   18,   18,    1,   19,   13,   13,    2,    2,   21,
    4,   22,    4,   20,   20,   23,   23,   23,   26,   24,
   27,   24,   28,   25,   29,   25,
}

Definition at line 253 of file nsVCard.cpp.

Definition at line 443 of file nsVCard.cpp.

Definition at line 437 of file nsVCard.cpp.

short yyrindex[]
Initial value:
 {                                      0,
 -245, -254,    0,    0,    0,    1,    0,    0,    0,    0,
    0,    0,    0,    0, -219,    0, -235,    0,    0, -244,
 -250,    0,    0, -213,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 -201, -255,    0,    0,    0,    0, -216,    0,    0,    0,
 -205,    0,    0,    0,    0,    0,    0,    0, -255,    0,
}

Definition at line 288 of file nsVCard.cpp.

char yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90"

Definition at line 100 of file nsVCard.cpp.

short yysindex[]
Initial value:
 {                                   -227,
    0,    0,    0,    0,    0,    0,    0, -249, -262, -253,
 -258, -227,    0,    0,    0, -234, -249, -215,    0,    0,
    0,    0, -223, -253,    0,    0,    0,    0, -247,    0,
    0,    0, -249, -222, -249, -225,    0,    0, -224,    0,
 -247, -221, -220,    0, -218,    0, -206,    0,    0,    0,
 -208, -207,    0,    0, -224,    0,    0,    0, -221,    0,
}

Definition at line 280 of file nsVCard.cpp.

short yyss[YYSTACKSIZE]

Definition at line 445 of file nsVCard.cpp.

short* yyssp

Definition at line 440 of file nsVCard.cpp.

short yytable[]
Initial value:
 {                                      16,
    4,   30,   13,   19,   29,   43,   13,   29,   31,   27,
    7,   39,   39,   32,   30,   20,   30,   21,   30,   14,
    9,   45,   43,   14,   43,   41,   45,    7,   39,   47,
   12,   30,   12,   12,   12,   12,   12,    1,   18,    2,
   16,   22,   32,   22,   37,   58,   46,   44,   14,   53,
   55,   56,   50,   54,   35,   57,   20,   27,   28,   49,
   60,   38,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    2,    0,    2,
}

Definition at line 302 of file nsVCard.cpp.

Definition at line 442 of file nsVCard.cpp.

Definition at line 446 of file nsVCard.cpp.

Definition at line 441 of file nsVCard.cpp.