LIB_EXPORT rc_t CC VTableTypespec ( const VTable *self, char *ts_buff, size_t ts_size ) { rc_t rc; if ( ts_size == 0 ) rc = RC ( rcVDB, rcTable, rcAccessing, rcBuffer, rcInsufficient ); else if ( ts_buff == NULL ) rc = RC ( rcVDB, rcTable, rcAccessing, rcBuffer, rcNull ); else { if ( self == NULL ) rc = RC ( rcVDB, rcTable, rcAccessing, rcSelf, rcNull ); else { rc_t rc2; #if USE_SDUMPER SDumper dumper; flush_tblspec_pb pb; /* initialize pb */ pb . buff = ts_buff; pb . size = ts_size; pb . bytes = 0; /* initialize dumper for extracting name */ SDumperInit ( & dumper, self -> schema, sdmCompact, flush_tbl_typespec, & pb ); /* dump only the table name */ assert ( self -> stbl != NULL ); rc = SDumperPrint ( & dumper, "%N%V", self -> stbl -> name, self -> stbl -> version ); /* done */ rc2 = SDumperWhack ( & dumper ); if ( rc == 0 ) { if ( rc2 == 0 ) return 0; rc = rc2; } #else rc2 = string_printf ( ts_buff, ts_size, NULL, "%N#%V", self -> stbl -> name, self -> stbl -> version ); if ( rc2 == 0 ) return 0; #endif } ts_buff [ 0 ] = 0; } return rc; }
static const char *VProdResolvePrintExpr ( const VProdResolve *self, const SExpression *expr ) { SDumper dumper; SDumperInit ( & dumper, self -> schema, sdmPrint, VProdResolveCapture, NULL ); xsz = 0; SDumperPrint ( & dumper, "%E", expr ); SDumperWhack ( & dumper ); xbuffer [ xsz ] = 0; return xbuffer; }