2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
gbx_subr.h
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-08-17 12:41:51 +02:00
|
|
|
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
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
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2007-12-30 17:41:49 +01:00
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GBX_SUBR_H
|
|
|
|
#define __GBX_SUBR_H
|
|
|
|
|
|
|
|
#include "gb_error.h"
|
|
|
|
#include "gbx_exec.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
void (*SUBR_FUNC)(VALUE *);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
double (*MATH_FUNC)(double);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
double (*MATH_FUNC_2)(double, double);
|
|
|
|
|
|
|
|
/*
|
|
|
|
#ifndef __GBX_SUBR_C
|
|
|
|
EXTERN int NPARAM;
|
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SUBR_ENTER() \
|
2010-06-05 01:48:53 +02:00
|
|
|
int NPARAM = code & 0x3F; \
|
2007-12-30 17:41:49 +01:00
|
|
|
VALUE *PARAM = (SP - NPARAM)
|
|
|
|
|
|
|
|
#define SUBR_GET_PARAM(nparam) \
|
|
|
|
VALUE *PARAM = (SP - nparam);
|
|
|
|
|
|
|
|
#define SUBR_ENTER_PARAM(nparam) \
|
|
|
|
const int NPARAM = nparam; \
|
|
|
|
SUBR_GET_PARAM(NPARAM);
|
|
|
|
|
|
|
|
#define RETURN RP
|
|
|
|
|
|
|
|
#define SUBR_LEAVE() SUBR_leave(NPARAM)
|
|
|
|
|
|
|
|
/* BORROW(RP); \
|
|
|
|
SUBR_leave_void(NPARAM); \
|
|
|
|
*SP++ = *RP; \
|
|
|
|
RP->type = T_VOID;*/
|
|
|
|
|
|
|
|
#define SUBR_LEAVE_VOID() SUBR_leave_void(NPARAM);
|
|
|
|
/*SP->type = T_VOID; \
|
|
|
|
SP++;*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Common routines */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_leave(int nparam);
|
|
|
|
void SUBR_leave_void(int nparam);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
#define SUBR_check_string(_value) (TYPE_is_string((_value)->type) ? ((_value)->_string.len == 0) : SUBR_check_string_real(_value))
|
|
|
|
|
|
|
|
bool SUBR_check_string_real(VALUE *param);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_check_integer(VALUE *param);
|
|
|
|
void SUBR_check_float(VALUE *param);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
int SUBR_get_integer(VALUE *param);
|
|
|
|
double SUBR_get_float(VALUE *param);
|
|
|
|
void *SUBR_get_pointer(VALUE *param);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
char *SUBR_get_string(VALUE *param);
|
|
|
|
char *SUBR_copy_string(VALUE *param);
|
|
|
|
void SUBR_get_string_len(VALUE *param, char **str, int *len);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2009-09-10 21:30:41 +02:00
|
|
|
bool SUBR_get_boolean(VALUE *param);
|
|
|
|
|
2009-09-20 19:32:12 +02:00
|
|
|
TYPE SUBR_get_type(VALUE *param);
|
2009-09-17 22:58:27 +02:00
|
|
|
TYPE SUBR_check_good_type(VALUE *param, int count);
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
/* subr_math.c */
|
|
|
|
|
2010-06-09 01:08:04 +02:00
|
|
|
//void SUBR_add(ushort code);
|
|
|
|
//void SUBR_sub(ushort code);
|
|
|
|
//void SUBR_mul(ushort code);
|
|
|
|
//void SUBR_div(ushort code);
|
|
|
|
void SUBR_quo(ushort code);
|
|
|
|
void SUBR_rem(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_pow(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_and_(ushort code);
|
|
|
|
void SUBR_not(ushort code);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_neg_(ushort code);
|
|
|
|
void SUBR_sgn(ushort code);
|
|
|
|
void SUBR_pi(ushort code);
|
|
|
|
void SUBR_math(ushort code);
|
|
|
|
void SUBR_math2(ushort code);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_randomize(ushort code);
|
|
|
|
void SUBR_rnd(ushort code);
|
|
|
|
void SUBR_round(ushort code);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* subr_string.c */
|
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_cat(ushort code);
|
|
|
|
void SUBR_file(ushort code);
|
2008-01-27 15:00:04 +01:00
|
|
|
//void SUBR_left(void);
|
|
|
|
//void SUBR_right(void);
|
|
|
|
//void SUBR_mid(void);
|
|
|
|
//void SUBR_len(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_trim(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_space(void);
|
|
|
|
void SUBR_string(void);
|
|
|
|
void SUBR_upper(void);
|
|
|
|
void SUBR_lower(void);
|
|
|
|
void SUBR_chr(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_asc(ushort code);
|
|
|
|
void SUBR_instr(ushort code);
|
|
|
|
void SUBR_like(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_scan(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_subst(ushort code);
|
|
|
|
void SUBR_replace(ushort code);
|
|
|
|
void SUBR_split(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_iconv(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_sconv(ushort code);
|
|
|
|
void SUBR_is_chr(ushort code);
|
2009-01-01 14:42:17 +01:00
|
|
|
void SUBR_tr(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_quote(ushort code);
|
2009-01-02 01:05:38 +01:00
|
|
|
void SUBR_unquote(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* subr_test.c */
|
|
|
|
|
2010-06-09 01:08:04 +02:00
|
|
|
//void SUBR_comp(ushort code);
|
|
|
|
//void SUBR_compn(ushort code);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_compi(ushort code);
|
|
|
|
void SUBR_case(ushort code);
|
|
|
|
void SUBR_bit(ushort code);
|
|
|
|
void SUBR_min_max(ushort code);
|
|
|
|
void SUBR_if(ushort code);
|
|
|
|
void SUBR_choose(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_near(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_strcomp(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_is(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* subr_conv.c */
|
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_is_type(ushort code);
|
|
|
|
void SUBR_conv(ushort code);
|
|
|
|
void SUBR_type(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_str(void);
|
|
|
|
void SUBR_val(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_format(ushort code);
|
|
|
|
void SUBR_hex(ushort code);
|
|
|
|
void SUBR_bin(ushort code);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* subr_time.c */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_timer(void);
|
|
|
|
void SUBR_now(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_year(ushort code);
|
|
|
|
void SUBR_time(ushort code);
|
|
|
|
void SUBR_date(ushort code);
|
|
|
|
void SUBR_date_op(ushort code);
|
|
|
|
void SUBR_week(ushort code);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* subr_file.c */
|
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_open(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_close(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_print(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_linput(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_eof(ushort code);
|
|
|
|
void SUBR_lof(ushort code);
|
|
|
|
void SUBR_seek(ushort code);
|
|
|
|
void SUBR_input(ushort code);
|
|
|
|
void SUBR_read(ushort code);
|
|
|
|
void SUBR_write(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_flush(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_lock(ushort code);
|
|
|
|
void SUBR_inp_out(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_stat(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_exist(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_dir(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_kill(void);
|
|
|
|
void SUBR_mkdir(void);
|
|
|
|
void SUBR_rmdir(void);
|
|
|
|
void SUBR_rename(void);
|
|
|
|
void SUBR_copy(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_temp(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_isdir(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_access(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_link(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_rdir(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_dfree();
|
|
|
|
|
|
|
|
void SUBR_exit_inp_out(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
#define SUBR_exit SUBR_exit_inp_out
|
|
|
|
|
|
|
|
/* subr_extern.c */
|
|
|
|
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_alloc(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_free(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_realloc(ushort code);
|
|
|
|
void SUBR_strptr(ushort code);
|
2008-01-19 02:36:38 +01:00
|
|
|
void SUBR_varptr(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
/* subr_misc.c */
|
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_error(void);
|
|
|
|
void SUBR_shell(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_wait(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_sleep(void);
|
2010-06-05 01:48:53 +02:00
|
|
|
void SUBR_exec(ushort code);
|
|
|
|
void SUBR_eval(ushort code);
|
|
|
|
void SUBR_array(ushort code);
|
|
|
|
void SUBR_collection(ushort code);
|
2008-01-17 22:39:26 +01:00
|
|
|
void SUBR_debug(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-01-17 22:39:26 +01:00
|
|
|
void EVAL_string(char *expr);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#endif
|