svn-id: r13690
This commit is contained in:
Paweł Kołodziejski 2004-05-01 06:35:06 +00:00
parent 1ecf43aabe
commit e8cb50e17f
6 changed files with 121 additions and 409 deletions

View file

@ -20,34 +20,22 @@
* $Header$ * $Header$
* *
*/ */
/*
Description:
Console module
Notes: // Console module
*/
#include "reinherit.h" #include "reinherit.h"
/*
Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "font_mod.h" #include "font_mod.h"
#include "cvar_mod.h" #include "cvar_mod.h"
#include "events_mod.h" #include "events_mod.h"
#include "gfx_mod.h" #include "gfx_mod.h"
/*
Begin module
\*--------------------------------------------------------------------------*/
#include "console_mod.h" #include "console_mod.h"
#include "console.h" #include "console.h"
namespace Saga { namespace Saga {
static R_CONSOLEINFO ConInfo = { static R_CONSOLEINFO ConInfo = {
0, 0,
R_CON_DEFAULTPOS, R_CON_DEFAULTPOS,
R_CON_DEFAULTLINES, R_CON_DEFAULTLINES,
@ -67,31 +55,19 @@ static R_CON_SCROLLBACK ConHistory;
static int CV_ConResize = R_CON_DEFAULTPOS; static int CV_ConResize = R_CON_DEFAULTPOS;
static int CV_ConDroptime = R_CON_DROPTIME; static int CV_ConDroptime = R_CON_DROPTIME;
int CON_Register(void) int CON_Register() {
{ CVAR_Register_I(&CV_ConResize, "con_h", NULL, R_CVAR_NONE, 12, R_CON_DEFAULTPOS);
CVAR_Register_I(&CV_ConDroptime, "con_droptime", NULL, R_CVAR_NONE, 0, 5000);
CVAR_Register_I(&CV_ConResize, "con_h", CVAR_Register_I(&ConInfo.line_max, "con_lines", NULL, R_CVAR_NONE, 5, 5000);
NULL, R_CVAR_NONE, 12, R_CON_DEFAULTPOS);
CVAR_Register_I(&CV_ConDroptime, "con_droptime",
NULL, R_CVAR_NONE, 0, 5000);
CVAR_Register_I(&ConInfo.line_max, "con_lines",
NULL, R_CVAR_NONE, 5, 5000);
return R_SUCCESS; return R_SUCCESS;
} }
int CON_Init(void) int CON_Init() {
{
return R_SUCCESS; return R_SUCCESS;
} }
int CON_Shutdown(void) int CON_Shutdown() {
{ R_printf(R_STDOUT, "CON_Shutdown(): Deleting console scrollback and command history.\n");
R_printf(R_STDOUT,
"CON_Shutdown(): Deleting console scrollback and command history.\n");
CON_DeleteScroll(&ConScrollback); CON_DeleteScroll(&ConScrollback);
CON_DeleteScroll(&ConHistory); CON_DeleteScroll(&ConHistory);
@ -99,8 +75,7 @@ int CON_Shutdown(void)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_Activate(void) int CON_Activate() {
{
R_EVENT con_event; R_EVENT con_event;
if (ConInfo.active) { if (ConInfo.active) {
@ -120,8 +95,7 @@ int CON_Activate(void)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_Deactivate(void) int CON_Deactivate() {
{
R_EVENT con_event; R_EVENT con_event;
if (!ConInfo.active) { if (!ConInfo.active) {
@ -139,26 +113,20 @@ int CON_Deactivate(void)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_IsActive(void) int CON_IsActive(void) {
{
return ConInfo.active; return ConInfo.active;
} }
int CON_Type(int in_char) // Responsible for processing character input to the console and maintaining
/****************************************************************************\ // the console input buffer.
Responsible for processing character input to the console and maintaining // Input buffer is processed by EXPR_Parse on enter.
the console input buffer. // High ASCII characters are ignored.
Input buffer is processed by EXPR_Parse on enter. int CON_Type(int in_char) {
High ASCII characters are ignored.
\****************************************************************************/
{
int input_pos = ConInfo.input_pos; int input_pos = ConInfo.input_pos;
const char *expr; const char *expr;
int expr_len; int expr_len;
int result; int result;
/*char *lvalue; */ //char *lvalue;
char *rvalue = NULL; char *rvalue = NULL;
R_CVAR_P con_cvar = NULL; R_CVAR_P con_cvar = NULL;
@ -167,27 +135,22 @@ int CON_Type(int in_char)
const char *err_str; const char *err_str;
if (ConInfo.y_pos != ConInfo.y_max) { if (ConInfo.y_pos != ConInfo.y_max) {
/* Ignore keypress until console fully down */ // Ignore keypress until console fully down
return R_SUCCESS; return R_SUCCESS;
} }
if ((in_char > 127) || (!in_char)) { if ((in_char > 127) || (!in_char)) {
/* Ignore non-ascii codes */ // Ignore non-ascii codes
return R_SUCCESS; return R_SUCCESS;
} }
switch (in_char) { switch (in_char) {
case '\r': case '\r':
expr = ConInfo.input_buf; expr = ConInfo.input_buf;
CON_Print("> %s", ConInfo.input_buf); CON_Print("> %s", ConInfo.input_buf);
expr_len = strlen(ConInfo.input_buf); expr_len = strlen(ConInfo.input_buf);
result = EXPR_Parse(&expr, &expr_len, &con_cvar, &rvalue); result = EXPR_Parse(&expr, &expr_len, &con_cvar, &rvalue);
CON_AddLine(&ConHistory, ConInfo.hist_max, ConInfo.input_buf); CON_AddLine(&ConHistory, ConInfo.hist_max, ConInfo.input_buf);
memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN); memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
ConInfo.input_pos = 0; ConInfo.input_pos = 0;
ConInfo.hist_pos = 0; ConInfo.hist_pos = 0;
@ -208,18 +171,14 @@ int CON_Type(int in_char)
CVAR_GetError(&err_str); CVAR_GetError(&err_str);
CON_Print("Illegal assignment: %s.", err_str); CON_Print("Illegal assignment: %s.", err_str);
} }
break; break;
case '\b': case '\b':
ConInfo.input_buf[input_pos] = 0; ConInfo.input_buf[input_pos] = 0;
if (input_pos > 0) { if (input_pos > 0) {
ConInfo.input_pos--; ConInfo.input_pos--;
ConInfo.input_buf[ConInfo.input_pos] = 0; ConInfo.input_buf[ConInfo.input_pos] = 0;
} }
break; break;
default: default:
if (input_pos < R_CON_INPUTBUF_LEN) { if (input_pos < R_CON_INPUTBUF_LEN) {
ConInfo.input_buf[input_pos] = (char)in_char; ConInfo.input_buf[input_pos] = (char)in_char;
@ -234,19 +193,13 @@ int CON_Type(int in_char)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_Draw(R_SURFACE * ds) int CON_Draw(R_SURFACE *ds) {
{
int line_y; int line_y;
R_CONSOLE_LINE *walk_ptr; R_CONSOLE_LINE *walk_ptr;
R_CONSOLE_LINE *start_ptr; R_CONSOLE_LINE *start_ptr;
int txt_fgcolor; int txt_fgcolor;
int txt_shcolor; int txt_shcolor;
R_RECT fill_rect; R_RECT fill_rect;
int i; int i;
if (!ConInfo.active) { if (!ConInfo.active) {
@ -260,27 +213,18 @@ int CON_Draw(R_SURFACE * ds)
fill_rect.top = 0; fill_rect.top = 0;
fill_rect.left = 0; fill_rect.left = 0;
fill_rect.bottom = ConInfo.y_pos; fill_rect.bottom = ConInfo.y_pos;
fill_rect.right = ds->buf_w - 1; fill_rect.right = ds->buf_w - 1;
GFX_DrawRect(ds, &fill_rect, SYSGFX_MatchColor(R_CONSOLE_BGCOLOR)); GFX_DrawRect(ds, &fill_rect, SYSGFX_MatchColor(R_CONSOLE_BGCOLOR));
txt_fgcolor = SYSGFX_MatchColor(R_CONSOLE_TXTCOLOR); txt_fgcolor = SYSGFX_MatchColor(R_CONSOLE_TXTCOLOR);
txt_shcolor = SYSGFX_MatchColor(R_CONSOLE_TXTSHADOW); txt_shcolor = SYSGFX_MatchColor(R_CONSOLE_TXTSHADOW);
FONT_Draw(SMALL_FONT_ID, FONT_Draw(SMALL_FONT_ID, ds, ">", 1, 2, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
ds, FONT_Draw(SMALL_FONT_ID, ds, ConInfo.input_buf, strlen(ConInfo.input_buf),
">", 1, 10, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
2, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
FONT_Draw(SMALL_FONT_ID,
ds,
ConInfo.input_buf, strlen(ConInfo.input_buf),
10, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
line_y = ConInfo.y_pos - (R_CON_INPUT_H + R_CON_LINE_H); line_y = ConInfo.y_pos - (R_CON_INPUT_H + R_CON_LINE_H);
start_ptr = ConScrollback.head; start_ptr = ConScrollback.head;
for (i = 0; i < ConInfo.line_pos; i++) { for (i = 0; i < ConInfo.line_pos; i++) {
@ -292,15 +236,8 @@ int CON_Draw(R_SURFACE * ds)
} }
for (walk_ptr = start_ptr; walk_ptr; walk_ptr = walk_ptr->next) { for (walk_ptr = start_ptr; walk_ptr; walk_ptr = walk_ptr->next) {
FONT_Draw(SMALL_FONT_ID, ds, walk_ptr->str_p, walk_ptr->str_len, 2, line_y, txt_fgcolor, txt_shcolor, FONT_SHADOW);
FONT_Draw(SMALL_FONT_ID,
ds,
walk_ptr->str_p,
walk_ptr->str_len,
2, line_y, txt_fgcolor, txt_shcolor, FONT_SHADOW);
line_y -= R_CON_LINE_H; line_y -= R_CON_LINE_H;
if (line_y < -R_CON_LINE_H) if (line_y < -R_CON_LINE_H)
break; break;
} }
@ -308,29 +245,21 @@ int CON_Draw(R_SURFACE * ds)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_Print(const char *fmt_str, ...) int CON_Print(const char *fmt_str, ...) {
{
char vsstr_p[R_CON_PRINTFLIMIT + 1]; char vsstr_p[R_CON_PRINTFLIMIT + 1];
va_list argptr; va_list argptr;
int ret_val; int ret_val;
va_start(argptr, fmt_str); va_start(argptr, fmt_str);
ret_val = vsprintf(vsstr_p, fmt_str, argptr); ret_val = vsprintf(vsstr_p, fmt_str, argptr);
CON_AddLine(&ConScrollback, ConInfo.line_max, vsstr_p); CON_AddLine(&ConScrollback, ConInfo.line_max, vsstr_p);
va_end(argptr); va_end(argptr);
ConInfo.line_pos = 0; ConInfo.line_pos = 0;
return ret_val; return ret_val;
} }
int CON_CmdUp(void) int CON_CmdUp() {
{
R_CONSOLE_LINE *start_ptr = ConHistory.head; R_CONSOLE_LINE *start_ptr = ConHistory.head;
int i; int i;
@ -354,15 +283,12 @@ int CON_CmdUp(void)
strcpy(ConInfo.input_buf, start_ptr->str_p); strcpy(ConInfo.input_buf, start_ptr->str_p);
ConInfo.input_pos = start_ptr->str_len - 1; ConInfo.input_pos = start_ptr->str_len - 1;
R_printf(R_STDOUT, "History pos: %d/%d", ConInfo.hist_pos, R_printf(R_STDOUT, "History pos: %d/%d", ConInfo.hist_pos, ConHistory.lines);
ConHistory.lines);
return R_SUCCESS; return R_SUCCESS;
} }
int CON_CmdDown(void) int CON_CmdDown(void) {
{
R_CONSOLE_LINE *start_ptr = ConHistory.head; R_CONSOLE_LINE *start_ptr = ConHistory.head;
int i; int i;
@ -396,11 +322,8 @@ int CON_CmdDown(void)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_PageUp(void) int CON_PageUp() {
{
int n_lines; int n_lines;
n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H; n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H;
if (ConInfo.line_pos < (ConScrollback.lines - n_lines)) { if (ConInfo.line_pos < (ConScrollback.lines - n_lines)) {
@ -408,15 +331,11 @@ int CON_PageUp(void)
} }
R_printf(R_STDOUT, "Line pos: %d", ConInfo.line_pos); R_printf(R_STDOUT, "Line pos: %d", ConInfo.line_pos);
return R_SUCCESS; return R_SUCCESS;
} }
int CON_PageDown(void) int CON_PageDown() {
{
int n_lines; int n_lines;
n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H; n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H;
if (ConInfo.line_pos > n_lines) { if (ConInfo.line_pos > n_lines) {
@ -428,9 +347,7 @@ int CON_PageDown(void)
return R_SUCCESS; return R_SUCCESS;
} }
int CON_DropConsole(double percent) int CON_DropConsole(double percent) {
{
R_SURFACE *back_buf; R_SURFACE *back_buf;
if (percent > 1.0) { if (percent > 1.0) {
@ -439,15 +356,12 @@ int CON_DropConsole(double percent)
back_buf = SYSGFX_GetBackBuffer(); back_buf = SYSGFX_GetBackBuffer();
CON_SetDropPos(percent); CON_SetDropPos(percent);
CON_Draw(back_buf); CON_Draw(back_buf);
return R_SUCCESS; return R_SUCCESS;
} }
int CON_RaiseConsole(double percent) int CON_RaiseConsole(double percent) {
{
R_SURFACE *back_buf; R_SURFACE *back_buf;
if (percent >= 1.0) { if (percent >= 1.0) {
@ -456,17 +370,13 @@ int CON_RaiseConsole(double percent)
} }
back_buf = SYSGFX_GetBackBuffer(); back_buf = SYSGFX_GetBackBuffer();
CON_SetDropPos(1.0 - percent); CON_SetDropPos(1.0 - percent);
CON_Draw(back_buf); CON_Draw(back_buf);
return R_SUCCESS; return R_SUCCESS;
} }
static int CON_SetDropPos(double percent) static int CON_SetDropPos(double percent) {
{
double exp_percent; double exp_percent;
if (percent > 1.0) if (percent > 1.0)
@ -475,16 +385,12 @@ static int CON_SetDropPos(double percent)
percent = 0.0; percent = 0.0;
exp_percent = percent * percent; exp_percent = percent * percent;
ConInfo.y_pos = (int)(ConInfo.y_max * exp_percent); ConInfo.y_pos = (int)(ConInfo.y_max * exp_percent);
return R_SUCCESS; return R_SUCCESS;
} }
static int static int CON_AddLine(R_CON_SCROLLBACK *scroll, int line_max, const char *constr_p) {
CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p)
{
int constr_len; int constr_len;
char *newstr_p; char *newstr_p;
R_CONSOLE_LINE *newline_p; R_CONSOLE_LINE *newline_p;
@ -492,7 +398,6 @@ CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p)
int i; int i;
constr_len = strlen(constr_p) + 1; constr_len = strlen(constr_p) + 1;
newstr_p = (char *)malloc(constr_len); newstr_p = (char *)malloc(constr_len);
if (newstr_p == NULL) { if (newstr_p == NULL) {
return R_MEM; return R_MEM;
@ -531,9 +436,7 @@ CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p)
return R_SUCCESS; return R_SUCCESS;
} }
static int CON_DeleteLine(R_CON_SCROLLBACK * scroll) static int CON_DeleteLine(R_CON_SCROLLBACK *scroll) {
{
R_CONSOLE_LINE *temp_p = scroll->tail; R_CONSOLE_LINE *temp_p = scroll->tail;
if (temp_p->prev == NULL) { if (temp_p->prev == NULL) {
@ -552,9 +455,7 @@ static int CON_DeleteLine(R_CON_SCROLLBACK * scroll)
return R_SUCCESS; return R_SUCCESS;
} }
static int CON_DeleteScroll(R_CON_SCROLLBACK * scroll) static int CON_DeleteScroll(R_CON_SCROLLBACK * scroll) {
{
R_CONSOLE_LINE *walk_ptr; R_CONSOLE_LINE *walk_ptr;
R_CONSOLE_LINE *temp_ptr; R_CONSOLE_LINE *temp_ptr;

View file

@ -20,13 +20,8 @@
* $Header$ * $Header$
* *
*/ */
/*
Description:
Console module header file
Notes: // Console module header file
*/
#ifndef SAGA_CONSOLE_H_ #ifndef SAGA_CONSOLE_H_
#define SAGA_CONSOLE_H_ #define SAGA_CONSOLE_H_
@ -40,7 +35,6 @@ namespace Saga {
#define R_CONSOLE_TXTSHADOW 0x00202020UL #define R_CONSOLE_TXTSHADOW 0x00202020UL
struct R_CONSOLEINFO { struct R_CONSOLEINFO {
int active; int active;
int y_max; int y_max;
int line_max; int line_max;
@ -52,33 +46,24 @@ struct R_CONSOLEINFO {
int prompt_w; int prompt_w;
char input_buf[R_CON_INPUTBUF_LEN + 1]; char input_buf[R_CON_INPUTBUF_LEN + 1];
int input_pos; int input_pos;
}; };
struct R_CONSOLE_LINE { struct R_CONSOLE_LINE {
R_CONSOLE_LINE *next; R_CONSOLE_LINE *next;
R_CONSOLE_LINE *prev; R_CONSOLE_LINE *prev;
char *str_p; char *str_p;
int str_len; int str_len;
}; };
struct R_CON_SCROLLBACK { struct R_CON_SCROLLBACK {
R_CONSOLE_LINE *head; R_CONSOLE_LINE *head;
R_CONSOLE_LINE *tail; R_CONSOLE_LINE *tail;
int lines; int lines;
}; };
static int static int CON_AddLine(R_CON_SCROLLBACK *scroll, int line_max, const char *constr_p);
CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p); static int CON_DeleteLine(R_CON_SCROLLBACK *scroll);
static int CON_DeleteScroll(R_CON_SCROLLBACK *scroll);
static int CON_DeleteLine(R_CON_SCROLLBACK * scroll);
static int CON_DeleteScroll(R_CON_SCROLLBACK * scroll);
static int CON_SetDropPos(double percent); static int CON_SetDropPos(double percent);
#define R_CON_DEFAULTPOS 136 #define R_CON_DEFAULTPOS 136
@ -91,6 +76,4 @@ static int CON_SetDropPos(double percent);
} // End of namespace Saga } // End of namespace Saga
#endif /* R_CONSOLE_H_ */ #endif
/* end "r_console.h" */

View file

@ -20,13 +20,8 @@
* $Header$ * $Header$
* *
*/ */
/*
Description:
Console module public header file
Notes: // Console module public header file
*/
#ifndef SAGA_CONSOLE_MOD_H_ #ifndef SAGA_CONSOLE_MOD_H_
#define SAGA_CONSOLE_MOD_H_ #define SAGA_CONSOLE_MOD_H_
@ -42,7 +37,7 @@ int CON_Deactivate(void);
int CON_IsActive(void); int CON_IsActive(void);
int CON_Type(int in_char); int CON_Type(int in_char);
int CON_Draw(R_SURFACE * ds); int CON_Draw(R_SURFACE *ds);
int CON_Print(const char *fmt_str, ...); int CON_Print(const char *fmt_str, ...);
int CON_CmdUp(void); int CON_CmdUp(void);
@ -55,5 +50,4 @@ int CON_RaiseConsole(double percent);
} // End of namespace Saga } // End of namespace Saga
#endif /* R_CONSOLE_MOD_H_ */ #endif
/* end "r_console_mod.h" */

View file

@ -20,27 +20,17 @@
* $Header$ * $Header$
* *
*/ */
/*
Description:
Configuration Variable Module
Notes: // Configuration Variable Module
*/
#include "reinherit.h" #include "reinherit.h"
#include <limits.h> #include <limits.h>
#include <stddef.h> #include <stddef.h>
/*
Uses the following modules:
\*--------------------------------------------------------------------------*/
#include "console_mod.h" #include "console_mod.h"
/*
Begin module
\*--------------------------------------------------------------------------*/
#include "cvar_mod.h" #include "cvar_mod.h"
#include "cvar.h" #include "cvar.h"
@ -49,7 +39,6 @@ namespace Saga {
R_CVAR *CVHashTbl[R_CVAR_HASHLEN]; R_CVAR *CVHashTbl[R_CVAR_HASHLEN];
static const char *CVAR_ErrMsg[] = { static const char *CVAR_ErrMsg[] = {
"No Error", "No Error",
"Not implememented.", "Not implememented.",
"Memory allocation failed", "Memory allocation failed",
@ -65,7 +54,6 @@ static const char *CVAR_ErrMsg[] = {
}; };
enum CVAR_Errors { enum CVAR_Errors {
CVERR_NONE, CVERR_NONE,
CVERR_NOTIMPL, CVERR_NOTIMPL,
CVERR_MEM, CVERR_MEM,
@ -82,23 +70,13 @@ enum CVAR_Errors {
static enum CVAR_Errors CVAR_ErrorState; static enum CVAR_Errors CVAR_ErrorState;
int CVAR_GetError(const char **err_str) //Returns the appropriate cvar error string
/****************************************************************************\ int CVAR_GetError(const char **err_str) {
Returns the appropriate cvar error string
\****************************************************************************/
{
*err_str = CVAR_ErrMsg[CVAR_ErrorState]; *err_str = CVAR_ErrMsg[CVAR_ErrorState];
return CVAR_ErrorState; return CVAR_ErrorState;
} }
// Frees the cvar hash table
int CVAR_Shutdown(void) int CVAR_Shutdown() {
/****************************************************************************\
Frees the cvar hash table
\****************************************************************************/
{
R_CVAR *walk_ptr; R_CVAR *walk_ptr;
R_CVAR *temp_ptr; R_CVAR *temp_ptr;
int i; int i;
@ -106,9 +84,7 @@ int CVAR_Shutdown(void)
R_printf(R_STDOUT, "CVAR_Shutdown(): Deleting cvar hash table.\n"); R_printf(R_STDOUT, "CVAR_Shutdown(): Deleting cvar hash table.\n");
for (i = 0; i < R_CVAR_HASHLEN; i++) { for (i = 0; i < R_CVAR_HASHLEN; i++) {
for (walk_ptr = CVHashTbl[i]; walk_ptr; walk_ptr = temp_ptr) { for (walk_ptr = CVHashTbl[i]; walk_ptr; walk_ptr = temp_ptr) {
temp_ptr = walk_ptr->next; temp_ptr = walk_ptr->next;
free(walk_ptr); free(walk_ptr);
} }
@ -117,13 +93,9 @@ int CVAR_Shutdown(void)
return R_SUCCESS; return R_SUCCESS;
} }
unsigned int CVAR_HashString(const char *str) // Returns hash index for string 'str'.
/****************************************************************************\ // Cannot fail.
Returns hash index for string 'str'. unsigned int CVAR_HashString(const char *str) {
Cannot fail.
\****************************************************************************/
{
unsigned int index; unsigned int index;
for (index = 0; *str != '\0'; str++) { for (index = 0; *str != '\0'; str++) {
@ -133,13 +105,9 @@ unsigned int CVAR_HashString(const char *str)
return index % R_CVAR_HASHLEN; return index % R_CVAR_HASHLEN;
} }
int CVAR_Add(int index, R_CVAR * cvar) // Adds a copy of the given cvar into the hash table.
/****************************************************************************\ // Returns R_SUCCESS if cvar was added, R_MEM if allocation failed.
Adds a copy of the given cvar into the hash table. int CVAR_Add(int index, R_CVAR *cvar) {
Returns R_SUCCESS if cvar was added, R_MEM if allocation failed.
\****************************************************************************/
{
R_CVAR *new_cvar; R_CVAR *new_cvar;
R_CVAR *temp_ptr; R_CVAR *temp_ptr;
@ -165,14 +133,10 @@ int CVAR_Add(int index, R_CVAR * cvar)
return R_SUCCESS; return R_SUCCESS;
} }
int CVAR_Exec(R_CVAR_P cvar_func, char *r_value) // Attempts to execute the specified console function with the given argument
/****************************************************************************\ // string.
Attempts to execute the specified console function with the given argument // Returns R_FAILURE if cvar_func is not a valid console function
string. int CVAR_Exec(R_CVAR_P cvar_func, char *r_value) {
Returns R_FAILURE if cvar_func is not a valid console function
\****************************************************************************/
{
int cf_argc = 0; int cf_argc = 0;
char **cf_argv = NULL; char **cf_argv = NULL;
int max_args; int max_args;
@ -199,7 +163,7 @@ int CVAR_Exec(R_CVAR_P cvar_func, char *r_value)
return R_FAILURE; return R_FAILURE;
} }
/* Call function */ // Call function
(cvar_func->t.func.func_p) (cf_argc, cf_argv); (cvar_func->t.func.func_p) (cf_argc, cf_argv);
if (cf_argv) if (cf_argv)
@ -208,13 +172,9 @@ int CVAR_Exec(R_CVAR_P cvar_func, char *r_value)
return R_SUCCESS; return R_SUCCESS;
} }
int CVAR_SetValue(R_CVAR_P cvar, char *r_value) // Attempts to assign the value contained in the string 'r_value' to cvar.
/****************************************************************************\ // Returns R_FAILURE if there was an error parsing 'r_value'
Attempts to assign the value contained in the string 'r_value' to cvar. int CVAR_SetValue(R_CVAR_P cvar, char *r_value) {
Returns R_FAILURE if there was an error parsing 'r_value'
\****************************************************************************/
{
long int int_param; long int int_param;
unsigned long uint16_param; unsigned long uint16_param;
@ -230,44 +190,38 @@ int CVAR_SetValue(R_CVAR_P cvar, char *r_value)
} }
switch (cvar->type) { switch (cvar->type) {
case R_CVAR_INT: case R_CVAR_INT:
int_param = strtol(r_value, &end_p, 10); int_param = strtol(r_value, &end_p, 10);
if ((int_param == LONG_MIN) || (int_param == LONG_MAX)) { if ((int_param == LONG_MIN) || (int_param == LONG_MAX)) {
CVAR_ErrorState = CVERR_PARSEOVERFLOW; CVAR_ErrorState = CVERR_PARSEOVERFLOW;
return R_FAILURE; return R_FAILURE;
} }
scan_len = end_p - r_value; scan_len = end_p - r_value;
if (int_param == 0) { if (int_param == 0) {
if (!scan_len || r_value[scan_len - 1] != '0') { if (!scan_len || r_value[scan_len - 1] != '0') {
/* strtol() returned 0, but string isn't "0". Invalid. */ // strtol() returned 0, but string isn't "0". Invalid.
CVAR_ErrorState = CVERR_INVALID; CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE; return R_FAILURE;
} }
} }
if (scan_len != r_value_len) { if (scan_len != r_value_len) {
/* Entire string wasn't converted...Invalid */ // Entire string wasn't converted...Invalid
CVAR_ErrorState = CVERR_INVALID; CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE; return R_FAILURE;
} }
if ((int_param < CV_INTMIN) || (int_param > CV_INTMAX)) { if ((int_param < CV_INTMIN) || (int_param > CV_INTMAX)) {
/* Overflows destination type */ // Overflows destination type
CVAR_ErrorState = CVERR_DESTOVERFLOW; CVAR_ErrorState = CVERR_DESTOVERFLOW;
return R_FAILURE; return R_FAILURE;
} }
/* Ignore bounds if equal */ // Ignore bounds if equal
if (cvar->t.i.lbound != cvar->t.i.ubound) { if (cvar->t.i.lbound != cvar->t.i.ubound) {
if ((int_param < cvar->t.i.lbound) || (int_param > cvar->t.i.ubound)) {
if ((int_param < cvar->t.i.lbound) || // Value is outside of cvar bounds
(int_param > cvar->t.i.ubound)) {
/* Value is outside of cvar bounds */
CVAR_ErrorState = CVERR_BOUND; CVAR_ErrorState = CVERR_BOUND;
return R_FAILURE; return R_FAILURE;
} }
@ -280,76 +234,62 @@ int CVAR_SetValue(R_CVAR_P cvar, char *r_value)
#endif #endif
break; break;
case R_CVAR_UINT: case R_CVAR_UINT:
if (*r_value == '-') { if (*r_value == '-') {
CVAR_ErrorState = CVERR_SIGN; CVAR_ErrorState = CVERR_SIGN;
return R_FAILURE; return R_FAILURE;
} }
uint16_param = strtoul(r_value, &end_p, 10); uint16_param = strtoul(r_value, &end_p, 10);
if (uint16_param == ULONG_MAX) { if (uint16_param == ULONG_MAX) {
CVAR_ErrorState = CVERR_PARSEOVERFLOW; CVAR_ErrorState = CVERR_PARSEOVERFLOW;
return R_FAILURE; return R_FAILURE;
} }
scan_len = end_p - r_value; scan_len = end_p - r_value;
if (uint16_param == 0) { if (uint16_param == 0) {
if (!scan_len || r_value[scan_len - 1] != '0') { if (!scan_len || r_value[scan_len - 1] != '0') {
/* strtol() returned 0, but string isn't "0". Invalid. */ // strtol() returned 0, but string isn't "0". Invalid.
CVAR_ErrorState = CVERR_INVALID; CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE; return R_FAILURE;
} }
} }
if (scan_len != r_value_len) { if (scan_len != r_value_len) {
/* Entire string wasn't converted...Invalid */ // Entire string wasn't converted...Invalid
CVAR_ErrorState = CVERR_INVALID; CVAR_ErrorState = CVERR_INVALID;
return R_FAILURE; return R_FAILURE;
} }
if (uint16_param > CV_UINTMAX) { if (uint16_param > CV_UINTMAX) {
/* Overflows destination type */ // Overflows destination type
CVAR_ErrorState = CVERR_DESTOVERFLOW; CVAR_ErrorState = CVERR_DESTOVERFLOW;
return R_FAILURE; return R_FAILURE;
} }
/* Ignore bounds if equal */ // Ignore bounds if equal
if (cvar->t.ui.lbound != cvar->t.ui.ubound) { if (cvar->t.ui.lbound != cvar->t.ui.ubound) {
if ((uint16_param < cvar->t.ui.lbound) || (uint16_param > cvar->t.ui.ubound)) {
if ((uint16_param < cvar->t.ui.lbound) || // Value is outside cvar bounds
(uint16_param > cvar->t.ui.ubound)) {
/* Value is outside cvar bounds */
CVAR_ErrorState = CVERR_BOUND; CVAR_ErrorState = CVERR_BOUND;
return R_FAILURE; return R_FAILURE;
} }
} }
*(cvar->t.ui.var_p) = (cv_uint16_t) uint16_param; *(cvar->t.ui.var_p) = (cv_uint16_t) uint16_param;
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
printf("Set cvar to value %lu.\n", uint16_param); printf("Set cvar to value %lu.\n", uint16_param);
#endif #endif
break; break;
case R_CVAR_FLOAT: case R_CVAR_FLOAT:
CVAR_ErrorState = CVERR_NOTIMPL; CVAR_ErrorState = CVERR_NOTIMPL;
return R_FAILURE; return R_FAILURE;
break; break;
case R_CVAR_STRING: case R_CVAR_STRING:
if (strrchr(r_value, '\"') != NULL) { if (strrchr(r_value, '\"') != NULL) {
CVAR_ErrorState = CVERR_STRING; CVAR_ErrorState = CVERR_STRING;
return R_FAILURE; return R_FAILURE;
} }
strncpy(cvar->t.s.var_str, r_value, cvar->t.s.ubound); strncpy(cvar->t.s.var_str, r_value, cvar->t.s.ubound);
if (cvar->t.s.ubound < r_value_len) { if (cvar->t.s.ubound < r_value_len) {
cvar->t.s.var_str[cvar->t.s.ubound] = 0; cvar->t.s.var_str[cvar->t.s.ubound] = 0;
@ -357,69 +297,48 @@ int CVAR_SetValue(R_CVAR_P cvar, char *r_value)
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
printf("Set cvar to value \"%s\".\n", cvar->t.s.var_str); printf("Set cvar to value \"%s\".\n", cvar->t.s.var_str);
#endif #endif
break; break;
default: default:
CVAR_ErrorState = CVERR_TYPE; CVAR_ErrorState = CVERR_TYPE;
return R_FAILURE; return R_FAILURE;
break; break;
} }
CVAR_ErrorState = CVERR_NONE; CVAR_ErrorState = CVERR_NONE;
return R_SUCCESS; return R_SUCCESS;
} }
R_CVAR_P CVAR_Find(const char *var_str) // Given a cvar name this function returns a pointer to the appropriate
/****************************************************************************\ // cvar structure or NULL if no match was found.
Given a cvar name this function returns a pointer to the appropriate R_CVAR_P CVAR_Find(const char *var_str) {
cvar structure or NULL if no match was found.
\****************************************************************************/
{
R_CVAR *walk_ptr; R_CVAR *walk_ptr;
int hash; int hash;
hash = CVAR_HashString(var_str); hash = CVAR_HashString(var_str);
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
printf("Performing lookup on hash bucket %d.\n", hash); printf("Performing lookup on hash bucket %d.\n", hash);
#endif #endif
walk_ptr = CVHashTbl[hash]; walk_ptr = CVHashTbl[hash];
while (walk_ptr != NULL) { while (walk_ptr != NULL) {
if (strcmp(var_str, walk_ptr->name) == 0) { if (strcmp(var_str, walk_ptr->name) == 0) {
return walk_ptr; return walk_ptr;
} }
walk_ptr = walk_ptr->next; walk_ptr = walk_ptr->next;
} }
return NULL; return NULL;
} }
int CVAR_IsFunc(R_CVAR_P cvar_func) int CVAR_IsFunc(R_CVAR_P cvar_func) {
{
if (cvar_func->type == R_CVAR_FUNC) if (cvar_func->type == R_CVAR_FUNC)
return 1; return 1;
else else
return 0; return 0;
} }
int // Registers a console function 'cvar'
CVAR_RegisterFunc(cv_func_t func, // (could think of a better place to put these...?)
const char *func_name, int CVAR_RegisterFunc(cv_func_t func, const char *func_name,
const char *func_argstr, uint16 flags, int min_args, int max_args) const char *func_argstr, uint16 flags, int min_args, int max_args) {
/****************************************************************************\
Registers a console function 'cvar'
(could think of a better place to put these...?)
\****************************************************************************/
{
R_CVAR new_cvar; R_CVAR new_cvar;
int hash; int hash;
@ -427,7 +346,6 @@ CVAR_RegisterFunc(cv_func_t func,
new_cvar.type = R_CVAR_FUNC; new_cvar.type = R_CVAR_FUNC;
new_cvar.section = NULL; new_cvar.section = NULL;
new_cvar.flags = flags; new_cvar.flags = flags;
new_cvar.t.func.func_p = func; new_cvar.t.func.func_p = func;
new_cvar.t.func.func_argstr = func_argstr; new_cvar.t.func.func_argstr = func_argstr;
new_cvar.t.func.min_args = min_args; new_cvar.t.func.min_args = min_args;
@ -441,14 +359,9 @@ CVAR_RegisterFunc(cv_func_t func,
return CVAR_Add(hash, &new_cvar); return CVAR_Add(hash, &new_cvar);
} }
int // Registers an integer type cvar.
CVAR_Register_I(cv_int_t * var_p, int CVAR_Register_I(cv_int_t * var_p, const char *var_name,
const char *var_name, const char *section, uint16 flags, cv_int_t lbound, cv_int_t ubound) {
const char *section, uint16 flags, cv_int_t lbound, cv_int_t ubound)
/****************************************************************************\
Registers an integer type cvar.
\****************************************************************************/
{
R_CVAR new_cvar; R_CVAR new_cvar;
int hash; int hash;
@ -457,12 +370,9 @@ CVAR_Register_I(cv_int_t * var_p,
new_cvar.type = R_CVAR_INT; new_cvar.type = R_CVAR_INT;
new_cvar.section = section; new_cvar.section = section;
new_cvar.flags = flags; new_cvar.flags = flags;
new_cvar.t.i.var_p = var_p; new_cvar.t.i.var_p = var_p;
new_cvar.t.i.lbound = lbound; new_cvar.t.i.lbound = lbound;
new_cvar.t.i.ubound = ubound; new_cvar.t.i.ubound = ubound;
hash = CVAR_HashString(var_name); hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
@ -472,15 +382,9 @@ CVAR_Register_I(cv_int_t * var_p,
return CVAR_Add(hash, &new_cvar); return CVAR_Add(hash, &new_cvar);
} }
int // Registers an unsigned integer type cvar.
CVAR_Register_UI(cv_uint16_t * var_p, int CVAR_Register_UI(cv_uint16_t * var_p, const char *var_name,
const char *var_name, const char *section, uint16 flags, cv_uint16_t lbound, cv_uint16_t ubound) {
const char *section, uint16 flags, cv_uint16_t lbound, cv_uint16_t ubound)
/****************************************************************************\
Registers an unsigned integer type cvar.
\****************************************************************************/
{
R_CVAR new_cvar; R_CVAR new_cvar;
int hash; int hash;
@ -488,12 +392,9 @@ CVAR_Register_UI(cv_uint16_t * var_p,
new_cvar.type = R_CVAR_UINT; new_cvar.type = R_CVAR_UINT;
new_cvar.section = section; new_cvar.section = section;
new_cvar.flags = flags; new_cvar.flags = flags;
new_cvar.t.ui.var_p = var_p; new_cvar.t.ui.var_p = var_p;
new_cvar.t.ui.lbound = lbound; new_cvar.t.ui.lbound = lbound;
new_cvar.t.ui.ubound = ubound; new_cvar.t.ui.ubound = ubound;
hash = CVAR_HashString(var_name); hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
@ -503,15 +404,9 @@ CVAR_Register_UI(cv_uint16_t * var_p,
return CVAR_Add(hash, &new_cvar); return CVAR_Add(hash, &new_cvar);
} }
int // Registers a floating point type cvar.
CVAR_Register_F(cv_float_t * var_p, int CVAR_Register_F(cv_float_t * var_p, const char *var_name,
const char *var_name, const char *section, uint16 flags, cv_float_t lbound, cv_float_t ubound) {
const char *section, uint16 flags, cv_float_t lbound, cv_float_t ubound)
/****************************************************************************\
Registers a floating point type cvar.
\****************************************************************************/
{
R_CVAR new_cvar; R_CVAR new_cvar;
int hash; int hash;
@ -519,12 +414,9 @@ CVAR_Register_F(cv_float_t * var_p,
new_cvar.type = R_CVAR_FLOAT; new_cvar.type = R_CVAR_FLOAT;
new_cvar.section = section; new_cvar.section = section;
new_cvar.flags = flags; new_cvar.flags = flags;
new_cvar.t.f.var_p = var_p; new_cvar.t.f.var_p = var_p;
new_cvar.t.f.lbound = lbound; new_cvar.t.f.lbound = lbound;
new_cvar.t.f.ubound = ubound; new_cvar.t.f.ubound = ubound;
hash = CVAR_HashString(var_name); hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
@ -534,15 +426,9 @@ CVAR_Register_F(cv_float_t * var_p,
return CVAR_Add(hash, &new_cvar); return CVAR_Add(hash, &new_cvar);
} }
int // Registers a string type cvar. Storage must be provided in var_p for 'ubound'
CVAR_Register_S(cv_char_t * var_str, // characters plus 1 for NUL char.
const char *var_name, const char *section, uint16 flags, int ubound) int CVAR_Register_S(cv_char_t * var_str, const char *var_name, const char *section, uint16 flags, int ubound) {
/****************************************************************************\
Registers a string type cvar. Storage must be provided in var_p for 'ubound'
characters plus 1 for NUL char.
\****************************************************************************/
{
R_CVAR new_cvar; R_CVAR new_cvar;
int hash; int hash;
@ -550,10 +436,8 @@ CVAR_Register_S(cv_char_t * var_str,
new_cvar.type = R_CVAR_STRING; new_cvar.type = R_CVAR_STRING;
new_cvar.section = section; new_cvar.section = section;
new_cvar.flags = flags; new_cvar.flags = flags;
new_cvar.t.s.var_str = var_str; new_cvar.t.s.var_str = var_str;
new_cvar.t.s.ubound = ubound; new_cvar.t.s.ubound = ubound;
hash = CVAR_HashString(var_name); hash = CVAR_HashString(var_name);
#ifdef R_CVAR_TRACE #ifdef R_CVAR_TRACE
@ -563,41 +447,31 @@ CVAR_Register_S(cv_char_t * var_str,
return CVAR_Add(hash, &new_cvar); return CVAR_Add(hash, &new_cvar);
} }
int CVAR_Print(R_CVAR_P con_cvar) // Displays the value and type of the given cvar to the console.
/****************************************************************************\ int CVAR_Print(R_CVAR_P con_cvar) {
Displays the value and type of the given cvar to the console.
\****************************************************************************/
{
switch (con_cvar->type) { switch (con_cvar->type) {
case R_CVAR_INT: case R_CVAR_INT:
CON_Print("\"%s\"(i) = %d", CON_Print("\"%s\"(i) = %d", con_cvar->name, *(con_cvar->t.i.var_p));
con_cvar->name, *(con_cvar->t.i.var_p));
break; break;
case R_CVAR_UINT: case R_CVAR_UINT:
CON_Print("\"%s\"(ui) = %u", CON_Print("\"%s\"(ui) = %u", con_cvar->name, *(con_cvar->t.ui.var_p));
con_cvar->name, *(con_cvar->t.ui.var_p));
break; break;
case R_CVAR_FLOAT: case R_CVAR_FLOAT:
CON_Print("\"%s\"(ui) = %f", CON_Print("\"%s\"(ui) = %f", con_cvar->name, *(con_cvar->t.f.var_p));
con_cvar->name, *(con_cvar->t.f.var_p));
break; break;
case R_CVAR_STRING: case R_CVAR_STRING:
CON_Print("\"%s\"(s) = \"%s\"", con_cvar->name, CON_Print("\"%s\"(s) = \"%s\"", con_cvar->name, con_cvar->t.s.var_str);
con_cvar->t.s.var_str);
break; break;
case R_CVAR_FUNC: case R_CVAR_FUNC:
if (con_cvar->t.func.func_argstr) { if (con_cvar->t.func.func_argstr) {
CON_Print("\"%s\"(func) Args: %s", con_cvar->name, CON_Print("\"%s\"(func) Args: %s", con_cvar->name, con_cvar->t.func.func_argstr);
con_cvar->t.func.func_argstr);
} else { } else {
CON_Print("\"%s\"(func) No arguments.", CON_Print("\"%s\"(func) No arguments.", con_cvar->name);
con_cvar->name);
} }
break; break;

View file

@ -20,13 +20,8 @@
* $Header$ * $Header$
* *
*/ */
/*
Description:
Configuration Variable Module
Notes: // Configuration Variable Module
*/
#ifndef SAGA_CVAR_H_ #ifndef SAGA_CVAR_H_
#define SAGA_CVAR_H_ #define SAGA_CVAR_H_
@ -36,15 +31,12 @@ namespace Saga {
#define R_CVAR_HASHLEN 32 #define R_CVAR_HASHLEN 32
struct R_SUBCVAR_INT { struct R_SUBCVAR_INT {
cv_int_t *var_p; cv_int_t *var_p;
cv_int_t ubound; cv_int_t ubound;
cv_int_t lbound; cv_int_t lbound;
}; };
struct R_SUBCVAR_UINT { struct R_SUBCVAR_UINT {
cv_uint16_t *var_p; cv_uint16_t *var_p;
cv_uint16_t ubound; cv_uint16_t ubound;
cv_uint16_t lbound; cv_uint16_t lbound;
@ -52,31 +44,24 @@ struct R_SUBCVAR_UINT {
}; };
struct R_SUBCVAR_FLOAT { struct R_SUBCVAR_FLOAT {
cv_float_t *var_p; cv_float_t *var_p;
cv_float_t ubound; cv_float_t ubound;
cv_float_t lbound; cv_float_t lbound;
}; };
struct R_SUBCVAR_STRING { struct R_SUBCVAR_STRING {
cv_char_t *var_str; cv_char_t *var_str;
int ubound; int ubound;
}; };
struct R_SUBCVAR_FUNC { struct R_SUBCVAR_FUNC {
cv_func_t func_p; cv_func_t func_p;
const char *func_argstr; const char *func_argstr;
int min_args; int min_args;
int max_args; int max_args;
}; };
typedef struct R_CVAR_tag { typedef struct R_CVAR_tag {
int type; int type;
const char *name; const char *name;
const char *section; const char *section;
@ -96,5 +81,4 @@ typedef struct R_CVAR_tag {
} // End of namespace Saga } // End of namespace Saga
#endif /* R_CVAR_H_ */ #endif
/* end "r_cvar.h" */

View file

@ -20,20 +20,15 @@
* $Header$ * $Header$
* *
*/ */
/*
Description:
Configuration variable module public header file
Notes: // Configuration variable module public header file
*/
#ifndef SAGA_CVAR_MOD_H_ #ifndef SAGA_CVAR_MOD_H_
#define SAGA_CVAR_MOD_H_ #define SAGA_CVAR_MOD_H_
namespace Saga { namespace Saga {
/* Modify these to change base cvar types */ // Modify these to change base cvar types
#define CV_INTMAX INT_MAX #define CV_INTMAX INT_MAX
#define CV_INTMIN INT_MIN #define CV_INTMIN INT_MIN
@ -45,10 +40,9 @@ typedef char cv_char_t;
typedef void (*cv_func_t) (int cv_argc, char *cv_argv[]); typedef void (*cv_func_t) (int cv_argc, char *cv_argv[]);
/******************************************/ /******************************************/
typedef struct R_CVAR_tag *R_CVAR_P; /* opaque typedef */ typedef struct R_CVAR_tag *R_CVAR_P; // opaque typedef
typedef enum R_CVAR_TYPES_tag { typedef enum R_CVAR_TYPES_tag {
R_CVAR_INVALID, R_CVAR_INVALID,
R_CVAR_INT, R_CVAR_INT,
R_CVAR_UINT, R_CVAR_UINT,
@ -58,7 +52,6 @@ typedef enum R_CVAR_TYPES_tag {
} R_CVAR_TYPES; } R_CVAR_TYPES;
typedef enum R_CVAR_FLAGS_tag { typedef enum R_CVAR_FLAGS_tag {
R_CVAR_NONE, R_CVAR_NONE,
R_CVAR_READONLY, R_CVAR_READONLY,
R_CVAR_LBOUND, R_CVAR_LBOUND,
@ -69,44 +62,27 @@ typedef enum R_CVAR_FLAGS_tag {
#define R_CVAR_BOUNDED ( R_CVAR_LBOUND | R_CVAR_UBOUND ) #define R_CVAR_BOUNDED ( R_CVAR_LBOUND | R_CVAR_UBOUND )
int CVAR_Shutdown(void); int CVAR_Shutdown();
R_CVAR_P CVAR_Find(const char *var_str); R_CVAR_P CVAR_Find(const char *var_str);
int CVAR_SetValue(R_CVAR_P cvar, char *r_value); int CVAR_SetValue(R_CVAR_P cvar, char *r_value);
int CVAR_Print(R_CVAR_P con_cvar); int CVAR_Print(R_CVAR_P con_cvar);
int CVAR_GetError(const char **err_str); int CVAR_GetError(const char **err_str);
int CVAR_IsFunc(R_CVAR_P cvar_func); int CVAR_IsFunc(R_CVAR_P cvar_func);
int CVAR_Exec(R_CVAR_P cvar_func, char *r_value); int CVAR_Exec(R_CVAR_P cvar_func, char *r_value);
int CVAR_RegisterFunc(cv_func_t func, const char *func_name,
int const char *func_argstr, uint16 flags, int min_args, int max_args);
CVAR_RegisterFunc(cv_func_t func, int CVAR_Register_I(cv_int_t * var_p, const char *var_name,
const char *func_name, const char *section, uint16 flags, cv_int_t lbound, cv_int_t ubound);
const char *func_argstr, uint16 flags, int min_args, int max_args); int CVAR_Register_UI(cv_uint16_t * var_p, const char *var_name,
const char *section, uint16 flags, cv_uint16_t lbound, cv_uint16_t ubound);
int CVAR_Register_I(cv_int_t * var_p, int CVAR_Register_F(cv_float_t * var_p, const char *var_name,
const char *var_name, const char *section, uint16 flags, cv_float_t lbound, cv_float_t ubound);
const char *section, uint16 flags, cv_int_t lbound, cv_int_t ubound); int CVAR_Register_S(cv_char_t * var_str, const char *var_name, const char *section, uint16 flags, int ubound);
int EXPR_Parse(const char **exp_pp, int *len, R_CVAR_P * expr_cvar, char **rvalue);
int CVAR_Register_UI(cv_uint16_t * var_p,
const char *var_name,
const char *section, uint16 flags, cv_uint16_t lbound, cv_uint16_t ubound);
int CVAR_Register_F(cv_float_t * var_p,
const char *var_name,
const char *section, uint16 flags, cv_float_t lbound, cv_float_t ubound);
int CVAR_Register_S(cv_char_t * var_str,
const char *var_name, const char *section, uint16 flags, int ubound);
int EXPR_Parse(const char **exp_pp, int *len, R_CVAR_P * expr_cvar,
char **rvalue);
char *EXPR_ReadString(const char **string_p, int *len, int term_char); char *EXPR_ReadString(const char **string_p, int *len, int term_char);
int EXPR_GetError(const char **err_str); int EXPR_GetError(const char **err_str);
int EXPR_GetArgs(char *cmd_str, char ***expr_argv); int EXPR_GetArgs(char *cmd_str, char ***expr_argv);
} // End of namespace Saga } // End of namespace Saga
#endif /* R_CVAR_MOD_H_ */ #endif
/* end r_cvar_mod.h_ */