2012-04-13 17:16:23 +02:00
|
|
|
/*
|
|
|
|
* main.c - gb.ncurses main object
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Tobias Boege <tobias@gambas-buch.de>
|
|
|
|
*
|
|
|
|
* 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, 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., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define __MAIN_C
|
|
|
|
|
|
|
|
#include "c_ncurses.h"
|
|
|
|
#include "c_window.h"
|
2012-04-14 21:42:04 +02:00
|
|
|
#include "c_key.h"
|
2012-04-20 22:40:56 +02:00
|
|
|
#include "c_color.h"
|
|
|
|
#include "c_screen.h"
|
2012-04-13 17:16:23 +02:00
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
GB_INTERFACE GB EXPORT;
|
|
|
|
|
|
|
|
GB_DESC *GB_CLASSES[] EXPORT =
|
|
|
|
{
|
|
|
|
CNCursesDesc,
|
|
|
|
CWindowDesc,
|
|
|
|
CWindowAttrsDesc,
|
2012-04-14 21:42:04 +02:00
|
|
|
CCharAttrsDesc,
|
|
|
|
CKeyDesc,
|
2012-04-20 22:40:56 +02:00
|
|
|
CColorDesc,
|
|
|
|
CColorCapabilitiesDesc,
|
|
|
|
CColorPairDesc,
|
|
|
|
CColorContentDesc,
|
|
|
|
CScreenDesc,
|
2012-04-13 17:16:23 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2012-04-14 00:11:24 +02:00
|
|
|
static void hook_error(int code, char *error, char *where)
|
|
|
|
{
|
|
|
|
NCURSES_exit();
|
|
|
|
}
|
|
|
|
|
2012-04-20 22:40:56 +02:00
|
|
|
static void hook_main(int *argc, char **argv)
|
2012-04-14 21:42:04 +02:00
|
|
|
{
|
|
|
|
NCURSES_init();
|
|
|
|
}
|
2012-04-13 17:16:23 +02:00
|
|
|
|
|
|
|
int EXPORT GB_INIT()
|
|
|
|
{
|
2012-04-14 21:42:04 +02:00
|
|
|
GB.Hook(GB_HOOK_ERROR, (void *) hook_error);
|
2012-04-20 22:40:56 +02:00
|
|
|
GB.Hook(GB_HOOK_MAIN, (void *) hook_main);
|
2012-04-14 00:11:24 +02:00
|
|
|
return 0;
|
2012-04-13 17:16:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EXPORT GB_EXIT()
|
|
|
|
{
|
2012-04-14 00:11:24 +02:00
|
|
|
NCURSES_exit();
|
2012-04-13 17:16:23 +02:00
|
|
|
}
|