FIX: warnings

This commit is contained in:
Vítor Santos Costa 2014-05-30 00:59:42 +01:00
parent 2400911db9
commit 21fe137d27
18 changed files with 150 additions and 11 deletions

View File

@ -15,6 +15,8 @@
/*--------------------------------------------------------------------*/
/* Functions from B-Prolog */
int bpx_mount_query_term(TERM t);
/* cpred.c */
int bp_string_2_term(const char *, TERM, TERM);
char* bp_term_2_string(TERM);

View File

@ -220,14 +220,17 @@ write_term(TERM t)
YAP_Write(t,NULL,0);
}
static NORET quit(const char *s)
INLINE_ONLY inline EXTERN NORET quit(const char *s);
INLINE_ONLY inline EXTERN NORET myquit(int i, const char *s);
INLINE_ONLY inline EXTERN NORET quit(const char *s)
{
fprintf(stderr,"PRISM QUIT: %s\n",s);
exit(0);
}
static NORET myquit(int i, const char *s)
INLINE_ONLY inline EXTERN NORET myquit(int i, const char *s)
{
fprintf(stderr,"PRISM QUIT: %s\n",s);
exit(i);

View File

@ -7,6 +7,11 @@
#ifndef __YAP_PROLOG__
TERM bpx_build_atom(const char *);
#endif
TERM build_runtime_error(const char *s);
TERM build_internal_error(const char *s);
void register_prism_errors(void);
void emit_error(const char *fmt, ...);
void emit_internal_error(const char *fmt, ...);
/*--------------------------------------------------------------------*/

View File

@ -1,5 +1,10 @@
#include <stdlib.h>
void bp4p_init(int *argc, char **argv[]);
void bp4p_exit(int status);
void bp4p_quit(int status);
void bp4p_register_preds(void);
/*--------------------------------------------------------------------*/
#define REGISTER_CPRED(p,n) \
@ -14,8 +19,6 @@ void exit(int);
#ifdef __YAP_PROLOG__
int YAP_UserCpredicate(const char *s, int (*f)(void), unsigned long int n);
SYM_REC_PTR insert_cpred(const char *s, int n, int(*f)(void))
{
YAP_UserCPredicate(s, f, n);

View File

@ -172,5 +172,5 @@ TERM unnumber_var_term(TERM term)
{
CACHE_REGS
BPLONG mvn = -1;
return unnumberVarTerm(term, local_top, &mvn);
return unnumberVarTerm(term, (BPLONG_PTR)local_top, &mvn);
}

View File

@ -46,6 +46,17 @@ Here is the original copyright notice.
/***********[ REDUCED VERSION OF MT19937AR.C STARTS HERE ]***********/
void init_by_array(unsigned long init_key[], int key_length);
int pc_random_auto_seed_1(void);
int pc_random_init_by_seed_1(void);
int pc_random_init_by_list_1(void);
int pc_random_float_1(void);
int pc_random_gaussian_1(void);
int pc_random_int_2(void);
int pc_random_int_3(void);
int pc_random_get_state_1(void);
int pc_random_set_state_1(void);
/* Period parameters */
#define N 624
#define M 397

View File

@ -81,7 +81,7 @@ static void revert_vars(void)
assert(trail_pos0 != 0);
trail_top0 = trail_up_addr - trail_pos0;
trail_top0 = (BPLONG_PTR)(trail_up_addr - trail_pos0);
UNDO_TRAILING;
trail_pos0 = 0;
}
@ -92,7 +92,6 @@ static void revert_vars(void)
*/
static BPULONG prism_hash_value(TERM term)
{
CACHE_REGS
TERM t, *rest;
BPLONG i, n;
SYM_REC_PTR sym;
@ -201,7 +200,7 @@ nderef_loop:
break;
case LST:
q = term_pool_allocate(this, 2);
q = (TERM *)term_pool_allocate(this, 2);
*(q + 1) = GET_CDR(*p);
VECTOR_PUSH(rest, q + 1);
*(q + 0) = GET_CAR(*p);
@ -212,7 +211,7 @@ nderef_loop:
case STR:
sym = GET_STR_SYM_REC(*p);
n = GET_ARITY_STR(sym);
q = term_pool_allocate(this, n + 1);
q = (TERM *)term_pool_allocate(this, n + 1);
*q = (TERM)(sym);
for (i = n; i >= 1; i--) {
*(q + i) = GET_ARG(*p, i);

View File

@ -19,11 +19,22 @@ int failure_observed;
/* mic.c (B-Prolog) */
int compare(TERM,TERM);
void quit(const char *);
void alloc_occ_switches(void);
void sort_occ_switches(void);
void release_occ_switches(void);
void alloc_num_sw_vals(void);
void release_num_sw_vals(void);
void transfer_hyperparams_prolog(void);
int pc_compute_viterbi_5(void);
void release_num_sw_vals(void);
void transfer_hyperparams_prolog(void);
int pc_compute_n_viterbi_3(void);
/*------------------------------------------------------------------------*/
/* for sort_occ_switches() */
static int compare_sw_ins(const void *a, const void *b)
static int
compare_sw_ins(const void *a, const void *b)
{
SW_INS_PTR sw_ins_a, sw_ins_b;
TERM msw_a, msw_b;

View File

@ -11,6 +11,29 @@
#include "up/em_aux.h"
#include "up/util.h"
int check_smooth(int *smooth);
void initialize_params(void);
int compute_inside_scaling_none(void);
int compute_inside_scaling_none(void);
int compute_daem_inside_scaling_none(void);
int compute_daem_inside_scaling_log_exp(void);
int examine_inside_scaling_none(void);
int examine_inside_scaling_log_exp(void);
int compute_expectation_scaling_none(void);
int compute_expectation_scaling_log_exp(void);
double compute_daem_log_prior(void);
double compute_likelihood_scaling_none(void);
void release_num_sw_vals(void);
void transfer_hyperparams_prolog(void);
double compute_likelihood_scaling_log_exp(void);
void save_params(void);
void restore_params(void);
double compute_log_prior(void);
double compute_bic(double likelihood);
double compute_cs(double likelihood);
int update_params(void);
int update_params_smooth(void);
/*------------------------------------------------------------------------*/
/* We check if all smoothing constants are positive (MAP),

View File

@ -12,6 +12,27 @@
#include "up/flags.h"
#include "up/util.h"
int check_smooth_vb(void);
int compute_daem_inside_vb_scaling_none(void);
double compute_free_energy_l0(void);
double compute_free_energy_l1_scaling_none(void);
double compute_free_energy_l1_scaling_log_exp(void);
double compute_daem_free_energy_l1_scaling_none(void);
double compute_daem_free_energy_l1_scaling_log_exp(void);
void initialize_hyperparams(void);
int update_hyperparams(void);
int update_daem_hyperparams(void);
void save_hyperparams(void);
void restore_hyperparams(void);
void transfer_hyperparams(void);
void get_param_means(void);
int compute_pi_scaling_none(void);
int compute_pi_scaling_log_exp(void);
int compute_inside_vb_scaling_none(void);
int compute_inside_vb_scaling_log_exp(void);
int compute_daem_inside_vb_scaling_log_exp(void);
double compute_daem_free_energy_l0(void);
/*------------------------------------------------------------------------*/
/* Just check if there is any negative hyperparameter */

View File

@ -11,6 +11,9 @@
#include "up/flags.h"
#include "up/util.h"
void config_em(EM_ENG_PTR em_ptr);
int run_em(EM_ENG_PTR em_ptr);
/*------------------------------------------------------------------------*/
void config_em(EM_ENG_PTR em_ptr)

View File

@ -22,6 +22,13 @@
/* mic.c (B-Prolog) */
NORET myquit(int, const char *);
int pc_prism_prepare_4(void);
int pc_prism_em_6(void);
int pc_prism_vbem_2(void);
int pc_prism_both_em_2(void);
int pc_compute_inside_2(void);
int pc_compute_probf_1(void);
/*------------------------------------------------------------------------*/
int pc_prism_prepare_4(void)

View File

@ -13,6 +13,9 @@
#include "up/flags.h"
#include "up/util.h"
void config_vbem(VBEM_ENG_PTR vb_ptr);
int run_vbem(VBEM_ENG_PTR vb_ptr);
/*------------------------------------------------------------------------*/
void config_vbem(VBEM_ENG_PTR vb_ptr)

View File

@ -39,6 +39,28 @@ static int warn = 0;
*/
int debug_level = 0;
int pc_set_daem_1(void);
int pc_set_em_message_1(void);
int pc_set_em_progress_1(void);
int pc_set_error_on_cycle_1(void);
int pc_set_explicit_empty_expls_1(void);
int pc_set_fix_init_order_1(void);
int pc_set_init_method_1(void);
int pc_set_init_method_1(void);
int pc_set_itemp_rate_1(void);
int pc_set_log_scale_1(void);
int pc_set_max_iterate_1(void);
int pc_set_num_restart_1(void);
int pc_set_num_restart_1(void);
int pc_set_show_itemp_1(void);
int pc_set_std_ratio_1(void);
int pc_set_verb_em_1(void);
int pc_set_verb_graph_1(void);
int pc_set_warn_1(void);
int pc_set_debug_level_1(void);
int pc_set_itemp_init_1(void);
int pc_set_prism_epsilon_1(void);
/*------------------------------------------------------------------------*/
int pc_set_daem_1(void)

View File

@ -12,6 +12,8 @@ NORET myquit(int, const char *);
/* univ.c (B-Prolog) */
int list_length(BPLONG, BPLONG);
int pc_import_graph_stats_4(void);
/*------------------------------------------------------------------------*/
static int max_egraph_size = INIT_MAX_EGRAPH_SIZE;

View File

@ -13,7 +13,13 @@
/*------------------------------------------------------------------------*/
/* mic.c (B-Prolog) */
NORET quit(const char *);
extern NORET quit(const char *);
int compute_outside_scaling_none(void);
int compute_outside_scaling_log_exp(void);
int pc_compute_hindsight_4(void);
int compute_outside_scaling_none(void);
int compute_outside_scaling_log_exp(void);
int pc_compute_hindsight_4(void);
/*------------------------------------------------------------------------*/

View File

@ -7,6 +7,16 @@
/* mic.c (B-Prolog) */
int compare(TERM, TERM);
int prism_printf(const char *fmt, ...);
int pc_mp_mode_0(void);
int compare_sw_ins(const void *a, const void *b);
int get_term_depth(TERM t);
int pc_get_term_depth_2(void);
int pc_lngamma_2(void);
int pc_mtrace_0(void);
int pc_muntrace_0(void);
void xsleep(unsigned int milliseconds);
int pc_sleep_1(void);
/*------------------------------------------------------------------------*/

View File

@ -21,6 +21,10 @@ struct ViterbiRankEntry {
NORET quit(const char *);
NORET myquit(int, const char *);
int pc_compute_n_viterbi_3(void);
int pc_compute_n_viterbi_rerank_4(void);
void transfer_hyperparams_prolog(void);
/*------------------------------------------------------------------------*/
static EG_NODE_PTR * viterbi_egraphs = NULL;
@ -39,6 +43,10 @@ static int n_viterbi_egraph_size;
static V_RANK_PTR viterbi_rank = NULL;
void compute_max(void);
void compute_n_max(int n);
int pc_compute_viterbi_5(void);
/* Viterbi works on only one explanation graph */
void compute_max(void)
{