SWIGINTERN int SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) { swig_cast_info *cast; swig_type_info *from; SCM smob = SWIG_Guile_GetSmob(s); if (SCM_NULLP(smob)) { *result = NULL; return SWIG_OK; } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) { /* we do not accept smobs representing destroyed pointers */ from = (swig_type_info *) SCM_CELL_WORD_2(smob); if (!from) return SWIG_ERROR; if (type) { cast = SWIG_TypeCheckStruct(from, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ return SWIG_OK; } else { return SWIG_ERROR; } } else { *result = (void *) SCM_CELL_WORD_1(smob); return SWIG_OK; } } return SWIG_ERROR; }
/* Mark a pointer object destroyed */ SWIGINTERN void SWIG_Guile_MarkPointerDestroyed(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); if (!SCM_NULLP(smob)) { if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) { SCM_SET_CELL_TYPE(smob, swig_destroyed_tag); } else scm_wrong_type_arg(NULL, 0, s); } }
SWIGINTERN unsigned long SWIG_Guile_PointerAddress(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); if (SCM_NULLP(smob)) return 0; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { return (unsigned long) (void *) SCM_CELL_WORD_1(smob); } else scm_wrong_type_arg("SWIG-Guile-PointerAddress", 1, object); }
SWIGINTERN swig_type_info * SWIG_Guile_PointerType(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); if (SCM_NULLP(smob)) return NULL; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { return (swig_type_info *) SCM_CELL_WORD_2(smob); } else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object); }
SCM is_Segment2(SCM smob) { if (SCM_SMOB_PREDICATE(tag_Segment2, smob)) return SCM_BOOL_T; return SCM_BOOL_F; }
static SCM guile_server_p (SCM server) { if (SCM_SMOB_PREDICATE (guile_svz_server_tag, server)) return SCM_BOOL_T; else return SCM_BOOL_F; }
static SCM guile_sock_p (SCM sock) { if (SCM_SMOB_PREDICATE (guile_svz_socket_tag, sock)) return SCM_BOOL_T; else return SCM_BOOL_F; }
int _scm_is_termios (SCM x) { if (SCM_SMOB_PREDICATE (termios_tag, x)) { if (SCM_SMOB_DATA (x) == 0) return 0; else return 1; } else return 0; }
int _scm_is_plparams (SCM x) { if (SCM_SMOB_PREDICATE (plparams_tag, x)) { if (SCM_SMOB_DATA (x) != 0) return 1; else return 0; } else return 0; }
int _scm_is_plotter (SCM x) { if (SCM_SMOB_PREDICATE (plotter_tag, x)) { if (SCM_SMOB_DATA (x) != 0) return 1; else return 0; } else return 0; }
size_t free_plparams (SCM x) { plPlotterParams *plparams; assert (SCM_SMOB_PREDICATE (plparams_tag, x)); plparams = (plPlotterParams *) SCM_SMOB_DATA (x); if (plparams != NULL) { pl_deleteplparams (plparams); SCM_SET_SMOB_DATA (x, 0); } return 0; }
size_t free_plotter (SCM x) { plPlotter *plotter; assert (SCM_SMOB_PREDICATE (plotter_tag, x)); plotter = (plPlotter *) SCM_SMOB_DATA (x); /* Plotters should already be null if delwin has been called on them */ if (plotter != NULL) { pl_deletepl_r (plotter); SCM_SET_SMOB_DATA (x, 0); } return 0; }
SWIGINTERN int SWIG_Guile_ConvertMember(SCM smob, void *ptr, size_t sz, swig_type_info *type, const char *func_name) { swig_cast_info *cast; swig_type_info *from; if (SCM_SMOB_PREDICATE(swig_member_function_tag, smob)) { from = (swig_type_info *) SCM_CELL_WORD_2(smob); if (!from) return SWIG_ERROR; if (type) { cast = SWIG_TypeCheckStruct(from, type); if (!cast) return SWIG_ERROR; } memcpy(ptr, (void *) SCM_CELL_WORD_1(smob), sz); return SWIG_OK; } return SWIG_ERROR; }
static SCM pg_format_sql(SCM conn, SCM obj) { struct pg_conn *pgc; SCM out; if (SCM_SMOB_PREDICATE(time_tag, obj)) { out = format_time(obj, c2s("'%Y-%m-%d %H:%M:%S'")); } else if (scm_boolean_p(obj) == SCM_BOOL_T) { if (scm_is_true(obj)) out = c2s("'t'"); else out = c2s("'f'"); } else if (scm_is_number(obj)) { out = scm_number_to_string(obj, scm_from_signed_integer(10)); } else if (scm_is_symbol(obj)) { out = pg_format_sql(conn, scm_symbol_to_string(obj)); } else if (scm_is_string(obj)) { if (scm_string_null_p(obj) == SCM_BOOL_T) out = c2s("NULL"); else { char *src = scm_to_utf8_string(obj); scm_assert_smob_type(pg_conn_tag, conn); pgc = (struct pg_conn *)SCM_SMOB_DATA(conn); scm_lock_mutex(pgc->mutex); char *sql = PQescapeLiteral(pgc->conn, src, strlen(src)); out = safe_from_utf8(sql); scm_unlock_mutex(pgc->mutex); free(src); PQfreemem(sql); } } else if (scm_is_null(obj)) out = c2s("NULL"); else out = c2s("NULL"); scm_remember_upto_here_1(out); scm_remember_upto_here_2(conn, obj); return out; }
int print_plotter (SCM x, SCM port, scm_print_state * pstate) { plPlotter *plotter = (plPlotter *) SCM_SMOB_DATA (x); char *str; assert (SCM_SMOB_PREDICATE (plotter_tag, x)); scm_puts ("#<plotter ", port); if (plotter == 0) scm_puts ( "(freed)", port); else { if (asprintf (&str, "%p", (void *) plotter) < 0) scm_puts ("???", port); else scm_puts (str, port); } scm_puts (">", port); // non-zero means success return 1; }
static int cmdscm_is_command (SCM scm) { return SCM_SMOB_PREDICATE (command_smob_tag, scm); }
int lsscm_is_lazy_string (SCM scm) { return SCM_SMOB_PREDICATE (lazy_string_smob_tag, scm); }
int frscm_is_frame (SCM scm) { return SCM_SMOB_PREDICATE (frame_smob_tag, scm); }
static SCM is_gzip(SCM smob) { return (SCM_SMOB_PREDICATE(deflate_tag, smob) ? SCM_BOOL_T : SCM_BOOL_F); }
unsigned char *deflate_data(SCM smob) { if (!SCM_SMOB_PREDICATE(deflate_tag, smob)) return NULL; DEFLATE_BLOB *blob = (DEFLATE_BLOB *)SCM_SMOB_DATA(smob); return blob->payload; }
int syscm_is_symbol (SCM scm) { return SCM_SMOB_PREDICATE (symbol_smob_tag, scm); }
static int bpscm_is_breakpoint (SCM scm) { return SCM_SMOB_PREDICATE (breakpoint_smob_tag, scm); }
static int stscm_is_sal (SCM scm) { return SCM_SMOB_PREDICATE (sal_smob_tag, scm); }
static int stscm_is_symtab (SCM scm) { return SCM_SMOB_PREDICATE (symtab_smob_tag, scm); }
int gdbscm_is_exception (SCM scm) { return SCM_SMOB_PREDICATE (exception_smob_tag, scm); }
static int pascm_is_parameter (SCM scm) { return SCM_SMOB_PREDICATE (parameter_smob_tag, scm); }
static int arscm_is_arch (SCM scm) { return SCM_SMOB_PREDICATE (arch_smob_tag, scm); }
SCM tf_outputq(SCM scm_value) { return scm_from_bool(SCM_SMOB_PREDICATE(tf_output_tag, scm_value)); }
static int ppscm_is_pretty_printer_worker (SCM scm) { return SCM_SMOB_PREDICATE (pretty_printer_worker_smob_tag, scm); }
int scm_smob_predicate(scm_t_bits tag, SCM exp) { return SCM_SMOB_PREDICATE (tag, exp); }