- Compiling fixes

- GNOME version isn't anymore build here so you don't need all that GTK and
GNOME crap to compile irssi-text.
- Some fixes to compile with -ansi -pedantic


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@200 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-05-09 11:42:42 +00:00 committed by cras
commit 93d6032151
34 changed files with 524 additions and 535 deletions

View file

@ -2,11 +2,6 @@ if BUILD_TEXTUI
TEXTUI=fe-text
endif
if BUILD_GNOMEUI
#GNOMEUI=fe-gnome
GNOMEUI=
endif
if BUILD_IRSSIBOT
BOTUI=fe-none
endif
@ -20,4 +15,4 @@ noinst_HEADERS = \
common.h \
common-setup.h
SUBDIRS = lib-popt lib-config core irc fe-common $(PERLDIR) $(GNOMEUI) $(TEXTUI) $(BOTUI)
SUBDIRS = lib-popt lib-config core irc fe-common $(PERLDIR) $(TEXTUI) $(BOTUI)

View file

@ -310,7 +310,7 @@ char *cmd_get_callfuncs(const char *data, int *count, va_list *args)
ret = g_strdup(data);
for (tmp = cmdget_funcs; tmp != NULL; tmp = tmp->next) {
func = tmp->data;
func = (CMD_GET_FUNC) tmp->data;
old = ret;
ret = func(ret, count, args);
@ -361,12 +361,12 @@ char *cmd_get_params(const char *data, int count, ...)
void cmd_get_add_func(CMD_GET_FUNC func)
{
cmdget_funcs = g_slist_prepend(cmdget_funcs, func);
cmdget_funcs = g_slist_prepend(cmdget_funcs, (void *) func);
}
void cmd_get_remove_func(CMD_GET_FUNC func)
{
cmdget_funcs = g_slist_prepend(cmdget_funcs, func);
cmdget_funcs = g_slist_prepend(cmdget_funcs, (void *) func);
}
static void parse_outgoing(const char *line, SERVER_REC *server, void *item)

View file

@ -377,7 +377,7 @@ int match_wildcards(const char *cmask, const char *data)
char *mask, *newmask, *p1, *p2;
int ret;
newmask = mask = strdup(cmask);
newmask = mask = g_strdup(cmask);
for (; *mask != '\0' && *data != '\0'; mask++) {
if (*mask == '?' || toupper(*mask) == toupper(*data)) {
data++;

View file

@ -8,7 +8,7 @@ typedef struct _config_rec CONFIG_REC;
enum {
SETTING_TYPE_STRING,
SETTING_TYPE_INT,
SETTING_TYPE_BOOLEAN,
SETTING_TYPE_BOOLEAN
};
typedef struct {

View file

@ -108,7 +108,7 @@ static char *get_long_variable_value(const char *key, void *server, void *item,
*free_ret = FALSE;
/* expando? */
func = g_hash_table_lookup(expandos, key);
func = (EXPANDO_FUNC) g_hash_table_lookup(expandos, key);
if (func != NULL)
return func(server, item, free_ret);
@ -502,7 +502,7 @@ void expando_create(const char *key, EXPANDO_FUNC func)
g_free(origkey);
g_hash_table_remove(expandos, key);
}
g_hash_table_insert(expandos, g_strdup(key), func);
g_hash_table_insert(expandos, g_strdup(key), (void *) func);
}
/* Destroy expando */

View file

@ -66,3 +66,5 @@ enum {
extern FORMAT_REC fecommon_core_formats[];
#define MODULE_FORMATS fecommon_core_formats
#include "printformat.h"

View file

@ -0,0 +1,25 @@
/* printformat(...) = printformat_format(module_formats, ...)
Could this be any harder? :) With GNU C compiler and C99 compilers,
use #define. With others use either inline functions if they are
supported or static functions if they are not..
*/
#if defined (__GNUC__) && !defined (__STRICT_ANSI__)
/* GCC */
# define printformat(server, channel, level, formatnum...) \
printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum)
#elif defined (_ISOC99_SOURCE)
/* C99 */
# define printformat(server, channel, level, formatnum, ...) \
printformat_format(MODULE_FORMATS, server, channel, level, formatnum, __VA_ARGS__)
#else
/* inline/static */
static
#ifdef G_CAN_INLINE
inline
#endif
void printformat(void *server, const char *channel, int level, int formatnum, ...)
{
printformat_format(MODULE_FORMATS, server, channel, level, formatnum);
}
#endif

View file

@ -24,32 +24,6 @@ typedef struct {
#define PRINTFLAG_MIRC_COLOR 0x20
#define PRINTFLAG_INDENT 0x40
/* printformat(...) = printformat_format(module_formats, ...)
Could this be any harder? :) With GNU C compiler and C99 compilers,
use #define. With others use either inline functions if they are
supported or static functions if they are not..
*/
#ifdef __GNUC__
/* GCC */
# define printformat(server, channel, level, formatnum...) \
printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum)
#elif defined (_ISOC99_SOURCE)
/* C99 */
# define printformat(server, channel, level, formatnum, ...) \
printformat_format(MODULE_FORMATS, server, channel, level, formatnum, __VA_ARGS__)
#else
/* inline/static */
#ifdef G_CAN_INLINE
inline
#else
static
#endif
void printformat(void *server, const char *channel, int level, int formatnum, ...)
{
printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum);
}
#endif
void printformat_format(FORMAT_REC *formats, void *server, const char *channel, int level, int formatnum, ...);
void printtext(void *server, const char *channel, int level, const char *str, ...);

View file

@ -181,6 +181,17 @@ void window_set_level(WINDOW_REC *window, int level)
signal_emit("window level changed", 1, window);
}
/* return active item's name, or if none is active, window's name */
char *window_get_active_name(WINDOW_REC *window)
{
g_return_val_if_fail(window != NULL, NULL);
if (window->active != NULL)
return window->active->name;
return window->name;
}
WINDOW_REC *window_find_level(void *server, int level)
{
WINDOW_REC *match;

View file

@ -58,8 +58,11 @@ void window_change_server(WINDOW_REC *window, void *server);
void window_set_refnum(WINDOW_REC *window, int refnum);
void window_set_name(WINDOW_REC *window, const char *name);
void window_set_level(WINDOW_REC *window, int level);
/* return active item's name, or if none is active, window's name */
char *window_get_active_name(WINDOW_REC *window);
WINDOW_REC *window_find_level(void *server, int level);
WINDOW_REC *window_find_closest(void *server, const char *name, int level);
WINDOW_REC *window_find_refnum(int refnum);

View file

@ -32,8 +32,10 @@ enum {
IRCTXT_DCC_CONNECT_ERROR,
IRCTXT_DCC_CANT_CREATE,
IRCTXT_DCC_REJECTED,
IRCTXT_DCC_CLOSE,
IRCTXT_DCC_CLOSE
};
extern FORMAT_REC fecommon_irc_dcc_formats[];
#define MODULE_FORMATS fecommon_irc_dcc_formats
#include "printformat.h"

View file

@ -47,17 +47,17 @@ static void ctcp_print(const char *pre, const char *data, IRC_SERVER_REC *server
static void ctcp_default_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{
return ctcp_print("unknown CTCP", data, server, nick, addr, target);
ctcp_print("unknown CTCP", data, server, nick, addr, target);
}
static void ctcp_ping_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{
return ctcp_print("CTCP PING", data, server, nick, addr, target);
ctcp_print("CTCP PING", data, server, nick, addr, target);
}
static void ctcp_version_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{
return ctcp_print("CTCP VERSION", data, server, nick, addr, target);
ctcp_print("CTCP VERSION", data, server, nick, addr, target);
}
static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)

View file

@ -11,3 +11,5 @@ enum {
extern FORMAT_REC fecommon_irc_flood_formats[];
#define MODULE_FORMATS fecommon_irc_flood_formats
#include "printformat.h"

View file

@ -162,3 +162,5 @@ enum {
extern FORMAT_REC fecommon_irc_formats[];
#define MODULE_FORMATS fecommon_irc_formats
#include "printformat.h"

View file

@ -17,3 +17,5 @@ enum {
extern FORMAT_REC fecommon_irc_notifylist_formats[];
#define MODULE_FORMATS fecommon_irc_notifylist_formats
#include "printformat.h"

View file

@ -8,13 +8,11 @@ INCLUDES = \
-I$(top_srcdir)/src/core/ \
-I$(top_srcdir)/src/irc/core/
irssi_bot_DEPENDENCIES = @IRC_LIBS@ @CORE_LIBS@
irssi_bot_DEPENDENCIES = @COMMON_NOUI_LIBS@
irssi_bot_LDADD = \
@IRC_LIBS@ \
@CORE_LIBS@ \
$(PROG_LIBS) \
$(INTLLIBS) \
@COMMON_NOUI_LIBS@ \
$(PROG_LIBS) \
$(PERL_LDFLAGS)
irssi_bot_SOURCES = \

View file

@ -13,10 +13,9 @@ irssi_text_DEPENDENCIES = @COMMON_LIBS@
irssi_text_LDADD = \
@COMMON_LIBS@ \
$(PROG_LIBS) \
$(CURSES_LIBS) \
$(INTLLIBS) \
$(PERL_LDFLAGS)
$(PROG_LIBS) \
$(PERL_LDFLAGS) \
$(CURSES_LIBS)
irssi_text_SOURCES = \
gui-entry.c \

View file

@ -1,237 +0,0 @@
/*
gui-statusbar.c : irssi
Copyright (C) 1999 Timo Sirainen
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
*/
#include "module.h"
#include "signals.h"
#include "server.h"
#include "windows.h"
#include "screen.h"
#include "gui-statusbar.h"
#include "gui-mainwindows.h"
#include "gui-windows.h"
typedef struct
{
gint tag;
gint xpos, ypos;
gint size;
gboolean right_justify, up;
STATUSBAR_FUNC func;
}
STATUSBAR_REC;
static GList *sbars;
static gint sbars_tag;
static void gui_statusbar_redraw_line(gboolean up, gint ypos)
{
GList *tmp;
gint xpos, rxpos;
xpos = 1;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (!rec->right_justify)
{
if (rec->up == up && rec->ypos == ypos && xpos+rec->size < COLS)
{
rec->xpos = xpos;
rec->func(xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size);
if (rec->size > 0) xpos += rec->size+1;
}
}
}
rxpos = COLS-1;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->right_justify)
{
if (rec->up == up && rec->ypos == ypos && rxpos-rec->size > xpos)
{
rec->xpos = rxpos-rec->size;
rec->func(rec->xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size);
if (rec->size > 0) rxpos -= rec->size+1;
}
}
}
}
static void gui_statusbar_redraw_all(void)
{
gint n;
screen_refresh_freeze();
set_bg((1<<4)+15);
for (n = 0; n < first_text_line; n++)
{
move(n, 0); clrtoeol();
}
for (n = last_text_line; n < LINES-1; n++)
{
move(n, 0); clrtoeol();
}
set_bg(0);
for (n = 0; n < LINES-1; n++)
{
gui_statusbar_redraw_line(FALSE, n);
gui_statusbar_redraw_line(TRUE, n);
}
screen_refresh_thaw();
}
void gui_statusbar_redraw(gint tag)
{
GList *tmp;
if (tag == -1)
{
gui_statusbar_redraw_all();
return;
}
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->tag == tag)
{
rec->func(rec->xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size);
break;
}
}
}
/* create new statusbar, return position */
gint gui_statusbar_create(gboolean up)
{
gint pos;
pos = up ? first_text_line++ :
(LINES-2)-last_text_line--;
set_bg((1<<4)+15);
move(up ? pos : last_text_line+pos, 0); clrtoeol();
set_bg(0);
gui_windows_resize(-1, FALSE);
return pos;
}
void gui_statusbar_delete(gboolean up, gint ypos)
{
GList *tmp, *next;
if (up && first_text_line > 0)
first_text_line--;
else if (!up && last_text_line < LINES-1)
last_text_line++;
for (tmp = sbars; tmp != NULL; tmp = next)
{
STATUSBAR_REC *rec = tmp->data;
next = tmp->next;
if (rec->up == up && rec->ypos == ypos)
gui_statusbar_remove(rec->tag);
else if (rec->up == up && rec->ypos > ypos)
rec->ypos--;
}
gui_windows_resize(1, FALSE);
}
/* allocate area in statusbar, returns tag or -1 if failed */
gint gui_statusbar_allocate(gint size, gboolean right_justify, gboolean up, gint ypos, STATUSBAR_FUNC func)
{
STATUSBAR_REC *rec;
g_return_val_if_fail(func != NULL, -1);
rec = g_new0(STATUSBAR_REC, 1);
sbars = g_list_append(sbars, rec);
rec->tag = ++sbars_tag;
rec->xpos = -1;
rec->up = up;
rec->ypos = ypos;
rec->size = size;
rec->right_justify = right_justify;
rec->func = func;
gui_statusbar_redraw_all();
return rec->tag;
}
void gui_statusbar_resize(gint tag, gint size)
{
GList *tmp;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->tag == tag)
{
rec->size = size;
gui_statusbar_redraw_all();
break;
}
}
}
void gui_statusbar_remove(gint tag)
{
GList *tmp;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->tag == tag)
{
g_free(rec);
sbars = g_list_remove(sbars, rec);
if (!quitting) gui_statusbar_redraw_all();
break;
}
}
}
void gui_statusbar_init(void)
{
sbars = NULL;
sbars_tag = 0;
gui_statusbar_create(FALSE);
}
void gui_statusbar_deinit(void)
{
gui_statusbar_delete(FALSE, 0);
}

View file

@ -12,3 +12,5 @@ enum {
extern FORMAT_REC gui_text_formats[];
#define MODULE_FORMATS gui_text_formats
#include "printformat.h"

View file

@ -11,18 +11,16 @@
#define ATTR_COLOR8 0x200
#define ATTR_REVERSE 0x400
extern gboolean use_colors;
gint init_screen(void); /* Initialize screen, detect screen length */
int init_screen(void); /* Initialize screen, detect screen length */
void deinit_screen(void); /* Deinitialize screen */
void set_color(gint col);
void set_bg(gint col);
void set_color(int col);
void set_bg(int col);
void scroll_up(gint y1, gint y2); /* Scroll area up */
void scroll_down(gint y1, gint y2); /* Scroll area down */
void scroll_up(int y1, int y2); /* Scroll area up */
void scroll_down(int y1, int y2); /* Scroll area down */
void move_cursor(gint y, gint x);
void move_cursor(int y, int x);
void screen_refresh_freeze(void);
void screen_refresh_thaw(void);

View file

@ -58,7 +58,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar)
if (!rec->right_justify && xpos+rec->size < COLS) {
rec->xpos = xpos;
func = rec->func;
func = (STATUSBAR_FUNC) rec->func;
func(rec, bar->ypos);
if (resized) break;
@ -73,7 +73,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar)
if (rec->right_justify && rxpos-rec->size > xpos) {
rec->xpos = rxpos-rec->size;
func = rec->func;
func = (STATUSBAR_FUNC) rec->func;
func(rec, bar->ypos);
if (resized) break;
@ -131,7 +131,7 @@ void statusbar_item_redraw(SBAR_ITEM_REC *item)
g_return_if_fail(item != NULL);
func = item->func;
func = (STATUSBAR_FUNC) item->func;
func(item, item->bar->ypos);
}
@ -215,7 +215,7 @@ SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar, int size, int right_jus
rec->xpos = -1;
rec->size = size;
rec->right_justify = right_justify;
rec->func = func;
rec->func = (void *) func;
return rec;
}

View file

@ -61,7 +61,7 @@ extern char *current_server_event; /* current server event being processed */
/* Send command to IRC server */
void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd);
void irc_send_cmdv(IRC_SERVER_REC *server, const char *cmd, ...) G_GNUC_PRINTF (2, 3);;
void irc_send_cmdv(IRC_SERVER_REC *server, const char *cmd, ...) G_GNUC_PRINTF (2, 3);
/* Send command to IRC server, split to multiple commands if necessary so
that command will never have more target nicks than `max_nicks'. Nicks
are separated with commas. (works with /msg, /kick, ...) */

View file

@ -6,7 +6,7 @@ enum {
NODE_TYPE_VALUE,
NODE_TYPE_BLOCK,
NODE_TYPE_LIST,
NODE_TYPE_COMMENT,
NODE_TYPE_COMMENT
};
#define has_node_value(a) \

View file

@ -102,12 +102,12 @@ void config_node_set_int(CONFIG_NODE *parent, const char *key, int value)
char str[MAX_INT_STRLEN];
g_snprintf(str, sizeof(str), "%d", value);
return config_node_set_str(parent, key, str);
config_node_set_str(parent, key, str);
}
void config_node_set_bool(CONFIG_NODE *parent, const char *key, int value)
{
return config_node_set_str(parent, key, value ? "yes" : "no");
config_node_set_str(parent, key, value ? "yes" : "no");
}
int config_set_str(CONFIG_REC *rec, const char *section, const char *key, const char *value)