1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
// This file is part of The New Aspell
// Copyright (C) 2004 by Kevin Atkinson under the GNU LGPL
// license version 2.0 or 2.1. You should have received a copy of the
// LGPL license along with this library if you did not you can find it
// at http://www.gnu.org/.
#ifndef __aspeller_check_list__
#define __aspeller_check_list__
#include "objstack.hpp"
#include "speller.hpp"
namespace aspeller {
using acommon::CheckInfo;
static inline void clear_check_info(CheckInfo & ci)
{
memset(static_cast<void *>(&ci), 0, sizeof(ci));
}
struct GuessInfo
{
int num;
CheckInfo * head;
GuessInfo() : num(0), head(0) {}
void reset() { buf.reset(); num = 0; head = 0; }
CheckInfo * add() {
num++;
CheckInfo * tmp = (CheckInfo *)buf.alloc_top(sizeof(CheckInfo),
sizeof(void*));
clear_check_info(*tmp);
tmp->next = head;
head = tmp;
head->guess = true;
return head;
}
void * alloc(unsigned s) {return buf.alloc_bottom(s);}
char * dup(ParmString str) {return buf.dup(str);}
private:
ObjStack buf;
};
}
#endif
|