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

/*
 * scanner.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 __SCANNER_H__
#define __SCANNER_H__

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

typedef struct _Scanner Scanner;

typedef void (*ScannerAddWordFn) (Scanner    *scan,
				  const char *pos_tag,
				  const char *word,
				  gboolean    is_terminal,
				  gpointer    user_data);

struct _Scanner {
  
  void (*dealloc)   (Scanner *);
  void (*scan_line) (Scanner *, char *line,
		     ScannerAddWordFn add_word_fn, gpointer user_data);
};

void scanner_free      (Scanner *scan);
void scanner_load_file (Scanner *scan,
			const char *filename,
			ScannerAddWordFn add_word_fn,
			gpointer user_data);

/* Python Extensions */

PyObject *scanner_to_py   (Scanner *scan); /* the ref to the scan is stolen! */
Scanner  *scanner_from_py (PyObject *py_scan);

#endif /* __SCANNER_H__ */

