2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 extern int con_totallines;
28 extern int con_backscroll;
29 extern qboolean con_initialized;
31 void Con_Rcon_Redirect_Init(lhnetsocket_t *sock, lhnetaddress_t *dest);
32 void Con_Rcon_Redirect_End();
33 void Con_Rcon_Redirect_Abort();
35 void Con_CheckResize (void);
37 void Con_Init_Commands (void);
38 void Con_Shutdown (void);
39 void Con_DrawConsole (int lines);
40 void Con_Print(const char *txt);
41 void Con_Printf(const char *fmt, ...) DP_FUNC_PRINTF(1);
42 void Con_DPrint(const char *msg);
43 void Con_DPrintf(const char *fmt, ...) DP_FUNC_PRINTF(1);
44 void Con_Clear_f (void);
45 void Con_DrawNotify (void);
46 void Con_ClearNotify (void);
47 void Con_ToggleConsole_f (void);
49 qboolean GetMapList (const char *s, char *completedname, int completednamebufferlength);
51 // wrapper function to attempt to either complete the command line
52 // or to list possible matches grouped by type
53 // (i.e. will display possible variables, aliases, commands
54 // that match what they've typed so far)
55 void Con_CompleteCommandLine(void);
57 // Generic libs/util/console.c function to display a list
58 // formatted in columns on the console
59 void Con_DisplayList(const char **list);
66 void Log_Close (void);
67 void Log_Start (void);
68 void Log_DestBuffer_Flush (void); // call this once per frame to send out replies to rcon streaming clients
70 void Log_Printf(const char *logfilename, const char *fmt, ...) DP_FUNC_PRINTF(2);
72 #define CON_MASK_HIDENOTIFY 128
73 #define CON_MASK_CHAT 1
74 #define CON_MASK_INPUT 2
76 typedef struct con_lineinfo_s
82 // used only by console.c
84 int height; // recalculated line height when needed (-1 to unset)
88 typedef struct conbuffer_s
93 con_lineinfo_t *lines;
95 int lines_count; // cyclic buffer
99 #define CONBUFFER_LINES_IDX(buf, i) (((buf)->lines_first + (i)) % (buf)->maxlines)
100 #define CONBUFFER_LINES_UNIDX(buf, i) (((i) - (buf)->lines_first + (buf)->maxlines) % (buf)->maxlines)
101 #define CONBUFFER_LINES_LAST(buf) CONBUFFER_LINES_IDX(buf, (buf)->lines_count - 1)
102 #define CONBUFFER_LINES(buf, i) (buf)->lines[CONBUFFER_LINES_IDX(buf, i)]
103 #define CONBUFFER_LINES_PRED(buf, i) (((i) + (buf)->maxlines - 1) % (buf)->maxlines)
104 #define CONBUFFER_LINES_SUCC(buf, i) (((i) + 1) % (buf)->maxlines)
105 #define CONBUFFER_LINES_FIRST(buf) ((buf)->lines_first)
106 #define CONBUFFER_LINES_COUNT(buf) ((buf)->lines_count)
108 void ConBuffer_Init(conbuffer_t *buf, int textsize, int maxlines, mempool_t *mempool);
109 void ConBuffer_Clear (conbuffer_t *buf);
110 void ConBuffer_Shutdown(conbuffer_t *buf);
111 void ConBuffer_FixTimes(conbuffer_t *buf);
112 void ConBuffer_DeleteLine(conbuffer_t *buf);
113 void ConBuffer_DeleteLastLine(conbuffer_t *buf);
114 void ConBuffer_AddLine(conbuffer_t *buf, const char *line, int len, int mask);
115 int ConBuffer_FindPrevLine(conbuffer_t *buf, int mask_must, int mask_mustnot, int start);
116 int ConBuffer_FindNextLine(conbuffer_t *buf, int mask_must, int mask_mustnot, int start);
117 const char *ConBuffer_GetLine(conbuffer_t *buf, int i);