/* This is -*- C -*- */
/* vim: set sw=2: */
/* $Id$ */

/*
 * token.h
 *
 * Copyright (C) 2003 The Free Software Foundation, Inc.
 *
 * Developed by Jon Trowbridge <trow@gnu.org>
 */

/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA.
 */

#ifndef __TOKEN_H__
#define __TOKEN_H__

#include <Python.h>
#include <glib.h>

#include "phoneme.h"
#include "meter.h"
#include "dictionary.h"

typedef struct _Token Token;
struct _Token {
  char            *word;
  Phoneme         *decomp;
  PartOfSpeechMask pos_mask;
  int              syllables;
  int              word_count;
  Meter           *meter;

  unsigned left_glue : 1;
  unsigned is_start  : 1;
  unsigned is_stop   : 1;
};

typedef void (*TokenFn) (Token *, gpointer);

#define token_is_start(t) ((t)->is_start)
#define token_is_stop(t)  ((t)->is_stop)

Token *token_lookup     (const char *word);
int    token_syllables  (Token *token);
Meter *token_meter      (Token *token);
int    token_word_count (Token *token);

Token *token_get_start (void);
Token *token_get_stop (void);

PyObject *token_to_py (Token *token);
Token    *token_from_py (PyObject *py_token);

/* Python Extensions */

PyObject *py_token_lookup    (PyObject *self, PyObject *args);
PyObject *py_token_get_start (PyObject *self, PyObject *args);
PyObject *py_token_get_stop  (PyObject *self, PyObject *args);




#endif /* __TOKEN_H__ */

