gint compare_plgi_blobs(atom_t a, atom_t b) { PLGIBlob *blob_a = PL_blob_data(a, NULL, NULL); PLGIBlob *blob_b = PL_blob_data(b, NULL, NULL); return ( blob_a->data > blob_b->data ? 1 : blob_a->data < blob_b->data ? -1 : 0 ); }
static int compare_archives(atom_t a, atom_t b) { archive_wrapper *ara = PL_blob_data(a, NULL, NULL); archive_wrapper *arb = PL_blob_data(b, NULL, NULL); return ( ara > arb ? 1 : ara < arb ? -1 : 0 ); }
// BLOB functions int addr_release(atom_t a) { PL_blob_t *type; size_t len; void *p=PL_blob_data(a,&len,&type); if (p) lo_address_free(*(lo_address *)p); return TRUE; }
static int save_clause_ref(atom_t aref, IOSTREAM *fd) { clref *ref = PL_blob_data(aref, NULL, NULL); (void)fd; return PL_warning("Cannot save reference to <clause>(%p)", ref->clause); }
int server_release(atom_t a) { PL_blob_t *type; size_t len; void *p=PL_blob_data(a,&len,&type); if (p) my_server_thread_free(*(my_server_thread *)p); return TRUE; }
static int write_record_ref(IOSTREAM *s, atom_t aref, int flags) { recref *ref = PL_blob_data(aref, NULL, NULL); Sfprintf(s, "<record>(%p)", ref->record); return TRUE; }
static int write_clingo(IOSTREAM *s, atom_t symbol, int flags) { (void)flags; clingo_wrapper *ar = PL_blob_data(symbol, NULL, NULL); Sfprintf(s, "<clingo>(%p)", ar); return TRUE; }
static int write_archive(IOSTREAM *s, atom_t symbol, int flags) { archive_wrapper *ar = PL_blob_data(symbol, NULL, NULL); Sfprintf(s, "<archive>(%p)", ar); return TRUE; }
gint write_plgi_blob(IOSTREAM *s, atom_t a, gint flags) { PLGIBlob *blob = PL_blob_data(a, NULL, NULL); Sfprintf(s, "<%s>(%p)", PL_atom_chars(blob->name), blob->data); return TRUE; }
static int write_clause_ref(IOSTREAM *s, atom_t aref, int flags) { clref *ref = PL_blob_data(aref, NULL, NULL); (void)flags; Sfprintf(s, "<clause>(%p)", ref->clause); return TRUE; }
static int release_clause(atom_t aref) { clref *ref = PL_blob_data(aref, NULL, NULL); clear(ref->clause, DBREF_CLAUSE); if ( true(ref->clause, DBREF_ERASED_CLAUSE) ) unallocClause(ref->clause); return TRUE; }
int server_write(IOSTREAM *s, atom_t a, int flags) { PL_blob_t *type; size_t len; my_server_thread *p=(my_server_thread *)PL_blob_data(a,&len,&type); if (p) { char *url=lo_server_get_url((*p)->s); Sfprintf(s,"osc_server<%s>",url); free(url); } return TRUE; }
static int release_record(atom_t aref) { recref *ref = PL_blob_data(aref, NULL, NULL); if ( ref->record->record ) clear(ref->record->record, R_DBREF); else unallocRecordRef(ref->record); return TRUE; }
int addr_write(IOSTREAM *s, atom_t a, int flags) { PL_blob_t *type; size_t len; lo_address *p=(lo_address *)PL_blob_data(a,&len,&type); if (p) { const char *host = lo_address_get_hostname(*p); const char *port = lo_address_get_port(*p); if (host!=NULL && port!=NULL) { Sfprintf(s,"osc_address<%s:%s>",host,port); } else { Sfprintf(s,"osc_address<invalid>"); } } return TRUE; }
static int release_clingo(atom_t symbol) { clingo_wrapper *ar = PL_blob_data(symbol, NULL, NULL); assert(ar->magic == CLINGO_MAGIC); if (ar->clingo) { if (ar->clingo->control) { clingo_control_free(ar->clingo->control); } PL_free(ar->clingo); ar->clingo = NULL; } PL_free(ar); return TRUE; }
static int release_archive(atom_t symbol) { archive_wrapper *ar = PL_blob_data(symbol, NULL, NULL); struct archive *a; assert(ar->status != AR_OPENED_ENTRY); if ( (a=ar->archive) ) { ar->archive = NULL; archive_read_free(a); } free_archive(ar); PL_free(ar); return TRUE; }
gint release_plgi_blob(atom_t a) { PLGIBlob *blob = PL_blob_data(a, NULL, NULL); PLGI_debug("[GC] releasing: <%s>%p", PL_atom_chars(blob->name), blob->data); if ( blob->magic != PLGI_BLOB_MAGIC) { return TRUE; } blob->magic = 0x0; switch ( blob->blob_type ) { case PLGI_BLOB_GOBJECT: { g_object_unref(blob->data); break; } case PLGI_BLOB_GPARAMSPEC: { g_param_spec_unref(blob->data); break; } case PLGI_BLOB_GVARIANT: { g_variant_unref(blob->data); break; } case PLGI_BLOB_SIMPLE: { if ( blob->is_owned ) { g_free(blob->data); } break; } case PLGI_BLOB_BOXED: { if ( blob->is_owned ) { g_boxed_free(blob->gtype, blob->data); } break; } case PLGI_BLOB_FOREIGN: { chokeme(PLGI_BLOB_FOREIGN); break; } case PLGI_BLOB_OPAQUE: { break; } case PLGI_BLOB_UNTYPED: { break; } default: { g_assert_not_reached(); } } return TRUE; }
static void acquire_clingo(atom_t symbol) { clingo_wrapper *ar = PL_blob_data(symbol, NULL, NULL); ar->symbol = symbol; }
static void acquire_clause(atom_t aref) { clref *ref = PL_blob_data(aref, NULL, NULL); set(ref->clause, DBREF_CLAUSE); }
static void acquire_record(atom_t aref) { recref *ref = PL_blob_data(aref, NULL, NULL); set(ref->record->record, R_DBREF); }
static int compare_clingos(atom_t a, atom_t b) { clingo_wrapper *ara = PL_blob_data(a, NULL, NULL); clingo_wrapper *arb = PL_blob_data(b, NULL, NULL); return (ara > arb ? 1 : ara < arb ? -1 : 0); }
static void acquire_archive(atom_t symbol) { archive_wrapper *ar = PL_blob_data(symbol, NULL, NULL); ar->symbol = symbol; }