Skip to main content

Thread: expected primary-expression before "char"


hi,
new in linux code compiling , use cygwin.
ran vocab.cc: in member function `vocabindex vocab::metatagoftype(unsigned int)': vocab.cc:259: error: expected primary-expression before "char" error.
can me handle error?

here vocab.cc:

code:
/*  * vocab.cc --  *    vocabulary class implementation.  *  */  #ifndef lint static char copyright[] = "copyright (c) 1995-2010 sri international.  rights reserved."; static char rcsid[] = "@(#)$header: /home/srilm/devel/lm/src/rcs/vocab.cc,v 1.43 2010/06/02 05:49:58 stolcke exp $"; #endif  #ifdef pre_iso_cxx # include <iostream.h> #else # include <iostream> using namespace std; #endif #include <string.h> #include <ctype.h> #include <assert.h>  #include "c:\cygwin\semanlm\include\srilm\file.h" #include "c:\cygwin\semanlm\include\srilm\vocab.h"  #include "c:\cygwin\semanlm\include\srilm\lhash.cc" #include "c:\cygwin\semanlm\include\srilm\array.cc"  #ifdef instantiate_templates instantiate_lhash(vocabstring,vocabindex); instantiate_array(vocabstring); #endif  vocab::vocab(vocabindex start, vocabindex end)     : byindex(start), nextindex(start), maxindex(end), _metatag(0) {     /*      * vocab_none both non-index value , end-token      * key sequences used tries.  both need      * same value user or lm library doesn't have      * deal map_nokey() , friends.      */     assert(map_nokeyp(vocab_none));      /*      * make last vocab created default 1 used in      * ostream output      */     outputvocab = this;      /*      * default closed-vocabulary model      */     _unkisword = false;      /*      * not map word strings lowercase defaults      */     _tolower = false;      /*      * set special vocabulary tokens defaults      */     _unkindex = addword(vocab_unknown);     _ssindex = addword(vocab_sentstart);     _seindex = addword(vocab_sentend);     _pauseindex = addword(vocab_pause);      /*      * declare known non-events      */     addnonevent(_ssindex);     addnonevent(_pauseindex); }  // compute memory usage void vocab::memstats(memstats &stats) const {     stats.total += sizeof(*this) - sizeof(byname) - sizeof(byindex);     byname.memstats(stats);     byindex.memstats(stats); }  // map word string lowercase // returns static buffer static vocabstring maptolower(vocabstring name) {     static char lower[maxwordlength + 1];      unsigned  i;     (i = 0; name[i] != 0 && < maxwordlength; i++) {     lower[i] = tolower((unsigned char)name[i]);     }     lower[i] = '\0';      assert(i < maxwordlength);      return lower; }  // add word vocabulary vocabindex vocab::addword(vocabstring name) {     if (_tolower) {     name = maptolower(name);     }      boolean found;     vocabindex *indexptr = byname.insert(name, found);      if (found) {     return *indexptr;     } else {     if (nextindex == maxindex) {         return vocab_none;     } else {         *indexptr = nextindex;         byindex[nextindex] = byname.getinternalkey(name);          /*          * check metatags, , intern them our metatag type map          */         if (_metatag != 0) {         unsigned metataglength = strlen(_metatag);          if (strncmp(name, _metatag, metataglength) == 0) {             int type = -1;             if (name[metataglength] == '\0') {             type = 0;             } else {             sscanf(&name[metataglength], "%u", &type);             }             if (type >= 0) {             *metatagmap.insert(nextindex) = type;             }         }         }          return nextindex++;     }     }  }  // add alternate (alias) name word index vocabindex vocab::addwordalias(vocabindex word, vocabstring name) {     if (_tolower) {     name = maptolower(name);     }      // make sure word valid index     if (byindex[word] == 0) {     return vocab_none;     } else {     // avoid aliasing name     if (strcmp(name, byindex[word]) == 0) {         return word;     }      // make sure name isn't otherwise used     remove(name);      vocabindex *indexptr = byname.insert(name);      *indexptr = word;      return word;     } }  // declare word non-event vocabindex vocab::addnonevent(vocabindex word) {     /*       * first make sure word defined      */     if (getword(word) == 0) {     return vocab_none;     } else {     *noneventmap.insert(word) = 1;     return word;     } }  // declare set of non-events boolean vocab::addnonevents(vocab &nonevents) {     vocabiter viter(nonevents);     boolean ok = true;      vocabstring name;     while ((name = viter.next())) {     if (addnonevent(name) == vocab_none) {         ok = false;     }     }      return ok; }  // remove word non-event boolean vocab::removenonevent(vocabindex word) {     /*       * first make sure word defined      */     if (getword(word) == 0) {     return false;     } else {     return noneventmap.remove(word) != 0;     } }  // word's index name vocabindex vocab::getindex(vocabstring name, vocabindex unkindex) {     if (_tolower) {     name = maptolower(name);     }      vocabindex *indexptr = byname.find(name);      /*      * if word metatag , not interned,      */     if (indexptr == 0 &&     _metatag != 0 &&     strncmp(name, _metatag, strlen(_metatag)) == 0)     {     return addword(name);     } else {     return indexptr ? *indexptr : unkindex;     } }  // index of metatag vocabindex vocab::metatagoftype(unsigned type) {     if (_metatag == 0)     {     return vocab_none;     }      else      {     if (type == 0)     {         return getindex(_metatag);     }      else     {         makearray(char, tagname, strlen(_metatag) + 20);         sprintf(tagname, "%s%u", _metatag, type);         return getindex(tagname);     }     } }  // word's name index vocabstring vocab::getword(vocabindex index) {     if (index < (vocabindex)byindex.base() || index >= nextindex) {     return 0;     } else {     return (*(array<vocabstring>*)&byindex)[index];    // discard const     } }  // delete word name void vocab::remove(vocabstring name) {     if (_tolower) {     name = maptolower(name);     }      vocabindex *indexptr = byname.find(name);      if (indexptr == 0) {         return;     } else if (strcmp(name, byindex[*indexptr]) != 0) {     // name alias: remove string mapping, not index     byname.remove(name);     } else {     vocabindex idx = *indexptr;      byname.remove(name);     byindex[idx] = 0;     noneventmap.remove(idx);     metatagmap.remove(idx);      if (idx == _ssindex) {         _ssindex = vocab_none;     }     if (idx == _seindex) {         _seindex = vocab_none;     }     if (idx == _unkindex) {         _unkindex = vocab_none;     }     if (idx == _pauseindex) {         _pauseindex = vocab_none;     }     } }  // delete word index void vocab::remove(vocabindex index) {     if (index < (vocabindex)byindex.base() || index >= nextindex) {     return;     } else {     vocabstring name = byindex[index];     if (name) {         byname.remove(name);         byindex[index] = 0;         noneventmap.remove(index);         metatagmap.remove(index);          if (index == _ssindex) {         _ssindex = vocab_none;         }         if (index == _seindex) {         _seindex = vocab_none;         }         if (index == _unkindex) {         _unkindex = vocab_none;         }         if (index == _pauseindex) {         _pauseindex = vocab_none;         }     }     } }  // convert index sequence string sequence unsigned int vocab::getwords(const vocabindex *wids, vocabstring *words,                             unsigned int max) {     unsigned int i;      (i = 0; < max && wids[i] != vocab_none; i++) {     words[i] = getword(wids[i]);     }     if (i < max) {     words[i] = 0;     }     return i; }  // convert word sequence index sequence, adding words if needed unsigned int vocab::addwords(const vocabstring *words, vocabindex *wids, unsigned int max) {     unsigned int i;      (i = 0; < max && words[i] != 0; i++) {     wids[i] = addword(words[i]);     }     if (i < max) {     wids[i] = vocab_none;     }     return i; }  // convert word sequence index sequence (without adding words) unsigned int vocab::getindices(const vocabstring *words,           vocabindex *wids, unsigned int max,           vocabindex unkindex) {     unsigned int i;      (i = 0; < max && words[i] != 0; i++) {     wids[i] = getindex(words[i], unkindex);     }     if (i < max) {     wids[i] = vocab_none;     }     return i; }  // convert word sequence index sequence, checking if words in  // vocabulary; return false not, true otherwise. boolean vocab::checkwords(const vocabstring *words, vocabindex *wids, unsigned int max) {     unsigned int i;      (i = 0; < max && words[i] != 0; i++) {     if ((wids[i] = getindex(words[i], vocab_none)) == vocab_none) {         return false;     }     }     if (i < max) {     wids[i] = vocab_none;     }     return true; }  // parse strings words , update stats unsigned int vocab::parsewords(char *sentence, vocabstring *words, unsigned int max) {     char *word;     unsigned i;      (i = 0, word = strtok(sentence, wordseparators);      < max && word != 0;      i++, word = strtok(0, wordseparators))     {     words[i] = word;     }     if (i < max) {     words[i] = 0;     }      return i; }  /*  * length of ngrams  */ unsigned int vocab::length(const vocabindex *words) {     unsigned int len = 0;      while (words[len] != vocab_none) len++;     return len; }  unsigned int vocab::length(const vocabstring *words) {     unsigned int len = 0;      while (words[len] != 0) len++;     return len; }  /*  * copying (a la strcpy())  */ vocabindex * vocab::copy(vocabindex *to, const vocabindex *from) {     unsigned i;     (i = 0; from[i] != vocab_none; ++) {     to[i] = from[i];     }     to[i] = vocab_none;      return to; }  vocabstring * vocab::copy(vocabstring *to, const vocabstring *from) {     unsigned i;     (i = 0; from[i] != 0; ++) {     to[i] = from[i];     }     to[i] = 0;      return to; }  /*  * word containment  */ boolean vocab::contains(const vocabindex *words, vocabindex word) {     unsigned i;      (i = 0; words[i] != vocab_none; i++) {     if (words[i] == word) {         return true;     }     }     return false; }  /*  * reversal of ngrams  */ vocabindex * vocab::reverse(vocabindex *words) {     int i, j;    /* j can negative ! */      (i = 0, j = length(words) - 1;      < j;      i++, j--)     {     vocabindex x = words[i];     words[i] = words[j];     words[j] = x;     }     return words; }  vocabstring * vocab::reverse(vocabstring *words) {     int i, j;    /* j can negative ! */      (i = 0, j = length(words) - 1;      < j;      i++, j--)     {     vocabstring x = words[i];     words[i] = words[j];     words[j] = x;     }     return words; }  /*  * output of ngrams  */ vocab *vocab::outputvocab;    /* vocabulary implicitly used operator<< */  void vocab::write(file &file, const vocabstring *words) {     (unsigned int = 0; words[i] != 0; i++) {     fprintf(file, "%s%s", (i > 0 ? " " : ""), words[i]);     } }  ostream & operator<< (ostream &stream, const vocabstring *words) {     (unsigned int = 0; words[i] != 0; i++) {     stream << (i > 0 ? " " : "") << words[i];     }     return stream; }  ostream & operator<< (ostream &stream, const vocabindex *words) {     (unsigned int = 0; words[i] != vocab_none; i++) {     vocabstring word = vocab::outputvocab->getword(words[i]);      stream << (i > 0 ? " " : "")            << (word ? word : "unknown");     }     return stream; }  /*   * sorting of words , word sequences  */ vocab *vocab::comparevocab;    /* implicit parameter compare() */  // compare word indices associated word strings // should non-static member, don't have pass // vocab in global variable, couldn't use function // qsort() , friends. // if comparevocab == 0 comparison index performed. int vocab::compare(vocabindex word1, vocabindex word2) {     if (comparevocab == 0) {     return word2 - word1;     } else {     return strcmp(comparevocab->getword(word1),               comparevocab->getword(word2));     } }  int vocab::compare(const vocabstring *words1, const vocabstring *words2) {     unsigned int = 0;      (i = 0; ; i++) {     if (words1[i] == 0) {         if (words2[i] == 0) {         return 0;         } else {         return -1;    /* words1 shorter */         }     } else {         if (words2[i] == 0) {         return 1;    /* words2 shorted */         } else {         int comp = compare(words1[i], words2[i]);         if (comp != 0) {             return comp;    /* differ pos */         }         }     }     }     /*notreached*/ }  int vocab::compare(const vocabindex *words1, const vocabindex *words2) {     unsigned int = 0;      (i = 0; ; i++) {     if (words1[i] == vocab_none) {         if (words2[i] == vocab_none) {         return 0;         } else {         return -1;    /* words1 shorter */         }     } else {         if (words2[i] == vocab_none) {         return 1;    /* words2 shorted */         } else {         int comp = compare(words1[i], words2[i]);         if (comp != 0) {             return comp;    /* differ pos */         }         }     }     }     /*notreached*/ }  /*  * these convenience methods set implicit vocab used  * comparison functions , returns pointer them.  * suitable generate 'sort' argument used iterators.  */ vocabindexcomparator vocab::compareindex() const {     comparevocab = (vocab *)this;    // discard const     return &vocab::compare; }  vocabindicescomparator vocab::compareindices() const {     comparevocab = (vocab *)this;    // discard const     return &vocab::compare; }  // write vocabulary file void vocab::write(file &file, boolean sorted) const {     vocabiter iter(*this, sorted);     vocabstring word;      while (!file.error() && (word = iter.next())) {     fprintf(file, "%s\n", word);     } }  // read vocabulary file unsigned int vocab::read(file &file) {     char *line;     unsigned int howmany = 0;      while ((line = file.getline())) {     /*      * getline() returns non-empty lines, strtok()      * find @ least 1 word.  further ones on line      * ignored.      */     vocabstring word = strtok(line, wordseparators);      if (addword(word) == vocab_none) {         file.position() << "warning: failed add " << word                 << " vocabulary\n";         continue;     }     howmany++;     }     return howmany; }  // read alias mapping file unsigned int vocab::readaliases(file &file) {     char *line;     unsigned int howmany = 0;      while ((line = file.getline())) {     /*      * getline() returns non-empty lines, strtok()      * find @ least 1 word.  after second word      * ignored.      */     vocabstring alias = strtok(line, wordseparators);     vocabstring word = strtok(0, wordseparators);      if (word == 0) {         file.position() << "warning: line contains 1 token\n";         continue;     }      vocabindex windex;      if ((windex = addword(word)) == vocab_none) {         file.position() << "warning: failed add " << word                 << " vocabulary\n";         continue;     }      if (addwordalias(windex, alias) == vocab_none) {         file.position() << "warning: failed add alias " << alias                 << " word " << word                 << " vocabulary\n";         continue;     }      howmany++;     }     return howmany; }  vocabindex vocab::highindex() const {     if (nextindex == 0) {     return vocab_none;     } else {     return nextindex - 1;     } }  /*  * check vocabulary contains words in range of ngrams given  * (used reading google ngrams efficiently)  * startrange == 0 means beginning (initial) of sorting order  * endrange == 0 means end (final) of sorting order implicitly  *  * algorithm:  *    if empty(startrange)  *        return true  *    else  *        if first(startrange) == first(endrange) ,   *           first(startrange) in vocab  *        return ngramsinrange(rest(startrange), rest(endrange))  *        else  *        if first(startrange) in vocab ,  *           ngramsinrange(rest(startrange), final)  *            return true  *        if first(endrange) in vocab ,  *           ngramsinrange(initial, rest(endrange))  *            return true  *        w in vocab  *           if w > first(startrange) , w < last(endrange)  *            return true;  */ boolean vocab::ngramsinrange(vocabstring *startrange, vocabstring *endrange) {     if ((startrange && startrange[0] == 0) ||         (endrange && endrange[0] == 0))     {     return true;     } else if (startrange && endrange &&                strcmp(startrange[0], endrange[0]) == 0 &&                getindex(startrange[0]) != vocab_none)     {     return ngramsinrange(&startrange[1], &endrange[1]);     } else {         if (startrange && getindex(startrange[0]) != vocab_none &&         ngramsinrange(&startrange[1], 0))         {         return true;     }     if (endrange && getindex(endrange[0]) != vocab_none &&         ngramsinrange(0, &endrange[1]))     {         return true;     }          /*      * cycle through entire vocabulary, looking word that's in range      */     vocabiter iter(*this);     vocabstring word;      while ((word = iter.next())) {         if ((startrange == 0 || strcmp(startrange[0], word) < 0) &&             (endrange == 0 || strcmp(word, endrange[0]) < 0))         {         return true;         }     }     return false;     } }  /*  * input/output of word-index mappings  *    word-index mappings store vocabstring-vocabindex mapping in  *    binary data formats.  *    format ascii 1 word per line:  *        index    string  *    mapping terminated eof or line consisting of ".".  */ void vocab::writeindexmap(file &file) {     // output index map in order of internal vocab indices.     // ensures vocab strings assigned indices in same order     // on reading, , ensures faster insertions sarray-based tries.     (unsigned = byindex.base(); < nextindex; ++) {     if (byindex[i]) {         fprintf(file, "%u %s\n", i, byindex[i]);     }     }     fprintf(file, ".\n"); }  boolean vocab::readindexmap(file &file, array<vocabindex> &map, boolean limitvocab) {     char *line;      while ((line = file.getline())) {     vocabindex id, newid;      /*      * getline() returns non-empty lines, strtok()      * find @ least 1 word.  after second word      * ignored.      */          vocabstring idstring = strtok(line, wordseparators);     vocabstring word = strtok(0, wordseparators);      if (idstring[0] == '.' && idstring[1] == '\0' && word == 0) {         // end of vocabulary table         break;     }      if (sscanf(idstring, "%u", &id) != 1 || word == 0) {         file.position() << "malformed vocab index line\n";         return false;     }      if (limitvocab) {         newid = getindex(word);     } else {         newid = addword(word);     }     map[id] = newid;     }      return true; }   /*  * iteration  */ vocabiter::vocabiter(const vocab &vocab, boolean sorted)     : myiter(vocab.byname, !sorted ? 0 : (int(*)(const char*,const char*))strcmp) { }  void vocabiter::init() {     myiter.init(); }  vocabstring vocabiter::next(vocabindex &index) {     vocabstring word;     vocabindex *idx;     if ((idx = myiter.next(word))) {     index = *idx;     return word;     } else {     return 0;     } }
and vocab.h file:
code:
/*  * vocab.h --  *    interface vocab class.  *  *  * synopsis  *  * vocab represents sets of string tokens typically used vocabularies,  * word class names, etc.  additionally, vocab provides mapping  * such string tokens (type vocabstring) integers (type vocabindex).  * vocabindex typically used index words in language models  * conserve space , speed comparisons etc.  thus, vocab  * implements symbol table strings can "interned."  *  * interface  *  * vocabindex(vocabindex start, vocabindex end)  *    initializes vocab , sets index range.  *    indices allocated starting @ start , incremented there.  *    no indices allowed beyond end.  *    provides way map several distinct vocabs disjoint  *    ranges of integers, , use them jointly without danger of  *    confusion.  *  * vocabindex addword(vocabstring token)  *    adds new string vocab, returning assigned index,  *    or looks index if token exists.  *  * vocabstring getword(vocabindex index)  *    returns string token associated index, or 0 if none  *    exists.  *  * vocabindex getindex(vocabstring token)  *    returns index string token, or vocab_none if none exists.  *  * void remove(vocabstring token)  * void remove(vocabindex index)  *    deletes item vocab, either token or index.  *  * unsigned int numwords()  *    returns number of tokens (and indices) in vocab.  *  * vocabindex highindex()  *    returns highest word index in use, or vocab_none if   *    vocabulary empty.  *  * iteration  *  * vocabiter implements iterations on vocabs.   *  * vocabiter(vocab &vocab)  *    creates , initializes iteration on vocab.  *  * void init()  *    reset iteration "first" element.  *  * vocabstring next()  * vocabstring next(vocabindex &index)  *    returns next vocab token in iteration, or 0 if  *    iteration finished.  index set corresponding  *    index.  *  * unsigned int read(file &file)  *    read word list file vocab, implicitly performing  *    addword() on each token read.  returns number of tokens read.  *  * void write(file &file)  *    write current set of word tokes file, in random order.  *  * note: while iteration on vocab ongoing, no modifications  * allowed vocab, except possibly removal of  * "current" token/index.  *  * iteration returns elements of vocab in random, deterministic  * order. furthermore, when copied or used in initialization of other objects,  * vocabiter objects retain current "position" in iteration.   * allows nested iterations enumerate pairs of distinct elements.  *  * copyright (c) 1995-2010 sri international.  rights reserved.  *  * @(#)$header: /home/srilm/devel/lm/src/rcs/vocab.h,v 1.41 2010/06/02 05:49:58 stolcke exp $  *  */  #ifndef _vocab_h_ #define _vocab_h_  #ifdef pre_iso_cxx # include <iostream.h> #else # include <iostream> using namespace std; #endif  #include "c:\cygwin\semanlm\include\srilm\boolean.h" #include "c:\cygwin\semanlm\include\srilm\file.h" #include "c:\cygwin\semanlm\include\srilm\lhash.h" #include "sarray.h" #include "array.h" #include "c:\cygwin\semanlm\include\srilm\memstats.h"  #ifdef use_short_vocab typedef unsigned short    vocabindex; #else typedef unsigned int    vocabindex; #endif typedef const char*    vocabstring;  const unsigned int    maxwordlength = 1024;  const vocabindex    vocab_none = (vocabindex)-1;  const vocabstring    vocab_unknown = "<unk>"; const vocabstring    vocab_sentstart = "<s>"; const vocabstring    vocab_sentend = "</s>"; const vocabstring    vocab_pause = "-pau-";  typedef int (*vocabindexcomparator)(vocabindex, vocabindex); typedef int (*vocabindicescomparator)(const vocabindex *, const vocabindex *);  class vocab {     friend class vocabiter;  public:     vocab(vocabindex start = 0, vocabindex end = (vocab_none-1));     virtual ~vocab() {};      virtual vocabindex addword(vocabstring name);     virtual vocabindex addwordalias(vocabindex word, vocabstring name);     virtual vocabstring getword(vocabindex index);     virtual vocabindex getindex(vocabstring name,                     vocabindex unkindex = vocab_none);     virtual void remove(vocabstring name);     virtual void remove(vocabindex index);     virtual unsigned int numwords() const { return byname.numentries(); };     virtual vocabindex highindex() const;      /*      * special (pseudo-) vocabulary tokens      */     virtual vocabindex &unkindex() { return _unkindex; };  /* <unk> index */     virtual vocabindex &ssindex() { return _ssindex; };       /* <s> index */     virtual vocabindex &seindex() { return _seindex; };       /* </s> index */     virtual vocabindex &pauseindex() { return _pauseindex; }; /* -pau- index */      virtual boolean &unkisword() { return _unkisword; };                     /* consider <unk> regular word */      virtual boolean &tolower() { return _tolower; };                     /* map word strings lowercase */      /*      * vocab tokens/indices "pseudo words", i.e., don't      * probabilities since can occur in contexts.      */     virtual boolean isnonevent(vocabstring word)    /* pseudo-word? */     { return isnonevent(getindex(word)); };     virtual boolean isnonevent(vocabindex word) const    /* non-event? */     { return (!_unkisword && (word == _unkindex)) ||          noneventmap.find(word) != 0; };      virtual vocabindex addnonevent(vocabindex word);     virtual vocabindex addnonevent(vocabstring name)     { return addnonevent(addword(name)); };     virtual boolean addnonevents(vocab &nonevents);     virtual boolean removenonevent(vocabindex word);      /*      * handling of meta-count tags: these tags represent token      * count total, or type frequency count (count-of-count).      * if metatag == "__meta__", following tags acquire special meaning:      *      *    __meta__        word count total      *    __meta__1        count of singleton word types      *    __meta__2        count of word types occurring twice      *    ...            ...      *    __meta__n        count of word types occurring n times      */     virtual vocabstring &metatag() { return _metatag; }; /* meta-count tag */     boolean ismetatag(vocabindex word)     { return metatagmap.find(word) != 0; };     unsigned typeofmetatag(vocabindex word)     { unsigned *type = metatagmap.find(word);       return type != 0 ? *type : (unsigned)-1; };     vocabindex metatagoftype(unsigned);      /*      * utilities handling vocab sequences      */     virtual unsigned int getwords(const vocabindex *wids,               vocabstring *words, unsigned int max);     virtual unsigned int addwords(const vocabstring *words,               vocabindex *wids, unsigned int max);     virtual unsigned int getindices(const vocabstring *words,                 vocabindex *wids, unsigned int max,                 vocabindex unkindex = vocab_none);     virtual boolean checkwords(const vocabstring *words,                    vocabindex *wids, unsigned int max);     static unsigned int parsewords(char *line,                    vocabstring *words, unsigned int max);      static unsigned int length(const vocabindex *words);     static unsigned int length(const vocabstring *words);     static vocabindex *copy(vocabindex *to, const vocabindex *from);     static vocabstring *copy(vocabstring *to, const vocabstring *from);     static vocabindex *reverse(vocabindex *words);     static boolean contains(const vocabindex *words, vocabindex word);     static vocabstring *reverse(vocabstring *words);     static void write(file &file, const vocabstring *words);      /*      *  comparison of vocabs , sequences      */     static int compare(vocabindex word1, vocabindex word2);                 /* order on word indices induced vocab */     static int compare(vocabstring word1, vocabstring word2)     { return strcmp(word1, word2); };     static int compare(const vocabindex *word1, const vocabindex *word2);                 /* order on word index sequences */     static int compare(const vocabstring *word1, const vocabstring *word2);      vocabindexcomparator compareindex() const;     vocabindicescomparator compareindices() const;     boolean ngramsinrange(vocabstring *startrange, vocabstring *endrange);      /*      * miscellaneous      */     virtual unsigned int read(file &file);     virtual unsigned int readaliases(file &file);     virtual void write(file &file, boolean sorted = true) const;     virtual void use() const { outputvocab = (vocab *)this; }; // discard const      virtual boolean readindexmap(file &file, array<vocabindex> &map,                         boolean limitvocab = false);     virtual void writeindexmap(file &file);      virtual void memstats(memstats &stats) const;      static vocab *outputvocab;  /* implicit parameter operator<< */      static vocab *comparevocab;    /* implicit parameter compare() */ protected:     lhash<vocabstring,vocabindex> byname;     array<vocabstring> byindex;     vocabindex nextindex;     vocabindex maxindex;      lhash<vocabindex, unsigned> noneventmap;    /* set of non-event words */     lhash<vocabindex, unsigned> metatagmap;    /* maps metatags type:                            0    count total                            1    single counts                            ...                            n    count of count n */      // hidden data members (accessed through virtual functions     vocabindex _unkindex;        /* <unk> index */     vocabindex _ssindex;        /* <s> index */     vocabindex _seindex;        /* </s> index */     vocabindex _pauseindex;        /* -pau- index */     boolean _unkisword;            /* consider <unk> regular word */     boolean _tolower;            /* map word strings lowercase */     vocabstring _metatag;        /* meta-count tag */ };  ostream &operator<< (ostream &, const vocabstring *words); ostream &operator<< (ostream &, const vocabindex *words);  class vocabiter { public:     vocabiter(const vocab &vocab, boolean sorted = false);     void init();     vocabstring next() { vocabindex index; return next(index); };     vocabstring next(vocabindex &index); private:     lhashiter<vocabstring,vocabindex> myiter; };  /*   * use strings on vocabindex keys maps.  * define necessary support functions (see map.h, lhash.cc, sarray.cc).  */ static inline unsigned lhash_hashkey(const vocabindex *key, unsigned maxbits) {     unsigned = 0;      /*      * rationale here similar lhash_hashkey(unsigned),      * except shift more preserve more of typical number of      * bits in vocabindex.  value optimized encoding 3 words      * @ time (trigrams).      */     (; *key != vocab_none; key ++) {     += (i << 12) + *key;     }     return lhash_hashkey(i, maxbits); }  static inline const vocabindex * map_copykey(const vocabindex *key) {     vocabindex *copy = new vocabindex[vocab::length(key) + 1];     assert(copy != 0);      unsigned i;     (i = 0; key[i] != vocab_none; ++) {     copy[i] = key[i];     }     copy[i] = vocab_none;      return copy; }  static inline void map_freekey(const vocabindex *key) {     delete [] (vocabindex *)key; }  static inline boolean lhash_equalkey(const vocabindex *key1, const vocabindex *key2) {     unsigned i;     (i = 0; key1[i] != vocab_none && key2[i] != vocab_none; ++) {     if (key1[i] != key2[i]) {         return false;     }     }     if (key1[i] == vocab_none && key2[i] == vocab_none) {     return true;     } else {     return false;     } }       static inline int sarray_comparekey(const vocabindex *key1, const vocabindex *key2) {     unsigned int = 0;      (i = 0; ; i++) {     if (key1[i] == vocab_none) {         if (key2[i] == vocab_none) {         return 0;         } else {         return -1;    /* key1 shorter */         }     } else {         if (key2[i] == vocab_none) {         return 1;    /* key2 shorted */         } else {         int comp = sarray_comparekey(key1[i], key2[i]);         if (comp != 0) {             return comp;    /* differ @ pos */         }         }     }     }     /*notreached*/ }  #endif /* _vocab_h_ */
thanks alot

pay attention error.
here's line 259:
code:
        makearray(char, tagname, strlen(_metatag) + 20);
you can't pass type argument (or macro?) did omit "sizeof" here?
function array.cc?


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Packaging and Compiling Programs expected primary-expression before "char"


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support