static void mktime_cmd (void) { struct tm tm; if (-1 == SLang_pop_cstruct (&tm, TM_Struct)) return; (void) push_time_t (mktime (&tm)); }
static int pop_tm_struct (struct tm *tms) { /* The memset is necessary because GLIBC has extra fields that may be * meaningful. In fact, without it strftime will generate access errors */ memset ((char *) tms, 0, sizeof (*tms)); if (-1 == SLang_pop_cstruct (tms, TM_Struct)) return -1; return validate_tm (tms); }
static int set_struct_sockopt (Socket_Type *s, int level, int optname, SLang_CStruct_Field_Type *cs, VOID_STAR v, socklen_t len) { int ret; if (-1 == SLang_pop_cstruct (v, cs)) return -1; ret = do_setsockopt (s->fd, level, optname, v, len); SLang_free_cstruct (v, cs); return ret; }
static void set_c_struct (void) { SLang_Array_Type *at; SLang_free_cstruct ((VOID_STAR) &C_Struct_Buf, C_Struct); if (-1 == SLang_pop_cstruct ((VOID_STAR) &C_Struct_Buf, C_Struct)) return; at = C_Struct_Buf.a; if ((at != NULL) && (at->data_type == SLANG_INT_TYPE)) { /* The point of this is to look for access errors */ SLindex_Type i, imax = (SLindex_Type)at->num_elements; int sum = 0; int *data = (int *)at->data; for (i = 0; i < imax; i++) sum += data[i]; } }
int Plot_set_library_interface (void) /*{{{*/ { Plot_Library_Interface_Type *pli; int status = -1; if (NULL == (pli = (Plot_Library_Interface_Type *) ISIS_MALLOC (sizeof *pli))) return -1; if (-1 == SLang_pop_cstruct ((VOID_STAR)pli, Plot_Library_Interface_Table)) { isis_vmesg (INTR, I_FAILED, __FILE__, __LINE__, "couldn't set library interface"); return -1; } #define PLI_SET(field) \ do { \ if (pli->field##_ref == NULL) \ goto return_status; \ else { \ pli->field = SLang_get_fun_from_ref (pli->field##_ref); \ if (pli->field == NULL) \ goto return_status; \ } \ } while (0) PLI_SET(open); PLI_SET(close); PLI_SET(subdivide); PLI_SET(select_window); PLI_SET(select_viewport); PLI_SET(set_plot_limits); PLI_SET(query_plot_limits); PLI_SET(erase); PLI_SET(update); PLI_SET(next_page); PLI_SET(get_color); PLI_SET(set_color); PLI_SET(set_line_style); PLI_SET(set_clipping); PLI_SET(set_line_width); PLI_SET(plot_xy); PLI_SET(plot_points); PLI_SET(plot_symbol_points); PLI_SET(plot_histogram); PLI_SET(plot_y_errorbar); PLI_SET(set_viewer_size); PLI_SET(set_char_size); PLI_SET(draw_box); PLI_SET(label_axes); PLI_SET(put_text_xy); PLI_SET(put_text_offset); PLI_SET(default_axis); PLI_SET(configure_axis); PLI_SET(read_cursor); #undef PLI_SET Plot_free_library_interface (); PLI = pli; status = 0; return_status: if (status) { SLang_free_cstruct ((VOID_STAR)pli, Plot_Library_Interface_Table); ISIS_FREE(pli); } return status; }