Changeset 2086
- Timestamp:
- 06/03/09 14:47:19 (9 months ago)
- Location:
- trunk/slv2
- Files:
-
- 9 modified
-
src/collections.c (modified) (1 diff)
-
src/plugin.c (modified) (4 diffs)
-
src/plugininstance.c (modified) (5 diffs)
-
src/pluginuiinstance.c (modified) (4 diffs)
-
src/query.c (modified) (4 diffs)
-
src/slv2_internal.h (modified) (1 diff)
-
src/value.c (modified) (2 diffs)
-
src/world.c (modified) (2 diffs)
-
utils/lv2_inspect.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/slv2/src/collections.c
r2000 r2086 54 54 prefix ## _get_at(CollType coll, unsigned index) \ 55 55 { \ 56 if ( index > INT_MAX) \56 if (!coll || index > INT_MAX) \ 57 57 return NULL; \ 58 58 else \ -
trunk/slv2/src/plugin.c
r2085 r2086 154 154 const char* index = (const char*)librdf_node_get_literal_value(index_node); 155 155 156 //printf("PORT: %s %s %s\n", type, index, symbol);157 158 156 const int this_index = atoi(index); 159 157 SLV2Port this_port = NULL; … … 373 371 374 372 if ( ! (has_type && has_name && has_license && has_port) ) { 375 fprintf(stderr, "Invalid LV2 Plugin %s\n", 376 slv2_value_as_uri(slv2_plugin_get_uri(plugin))); 373 SLV2_WARNF("Invalid plugin <%s>\n", slv2_value_as_uri(slv2_plugin_get_uri(plugin))); 377 374 return false; 378 375 } else { … … 401 398 } 402 399 400 if (!ret) 401 SLV2_WARNF("<%s> has no (mandatory) doap:name\n", 402 slv2_value_as_string(slv2_plugin_get_uri(plugin))); 403 403 404 return ret; 404 405 } … … 469 470 { 470 471 if ( ! slv2_value_is_uri(subject)) { 471 fprintf(stderr, "slv2_plugin_get_value_for_subject error: " 472 "subject is not a URI\n"); 472 SLV2_ERROR("slv2_plugin_get_value_for_subject: subject not a URI\n"); 473 473 return NULL; 474 474 } -
trunk/slv2/src/plugininstance.c
r2000 r2086 54 54 void* lib = dlopen(lib_path, RTLD_NOW); 55 55 if (!lib) { 56 fprintf(stderr,"Unable to open library %s (%s)\n", lib_path, dlerror());56 SLV2_ERRORF("Unable to open library %s (%s)\n", lib_path, dlerror()); 57 57 return NULL; 58 58 } … … 61 61 62 62 if (!df) { 63 fprintf(stderr,"Could not find symbol 'lv2_descriptor', "63 SLV2_ERRORF("Could not find symbol 'lv2_descriptor', " 64 64 "%s is not a LV2 plugin.\n", lib_path); 65 65 dlclose(lib); … … 72 72 slv2_plugin_get_bundle_uri(plugin))); 73 73 74 //printf("Bundle path: %s\n", bundle_path);75 76 74 for (uint32_t i=0; 1; ++i) { 77 75 … … 79 77 80 78 if (!ld) { 81 fprintf(stderr,"Did not find plugin %s in %s\n",79 SLV2_ERRORF("Did not find plugin %s in %s\n", 82 80 slv2_value_as_uri(slv2_plugin_get_uri(plugin)), lib_path); 83 81 dlclose(lib); 84 82 break; // return NULL 85 83 } else if (!strcmp(ld->URI, slv2_value_as_uri(slv2_plugin_get_uri(plugin)))) { 86 87 84 assert(plugin->plugin_uri); 88 89 //printf("Found %s at index %u in:\n\t%s\n\n",90 // librdf_uri_as_string(plugin->plugin_uri), i, lib_path);91 92 85 assert(ld->instantiate); 93 86 … … 111 104 // Failed to instantiate 112 105 if (result->lv2_handle == NULL) { 113 //printf("Failed to instantiate %s\n", plugin->plugin_uri);114 106 free(result); 115 107 return NULL; -
trunk/slv2/src/pluginuiinstance.c
r2000 r2086 57 57 void* lib = dlopen(lib_path, RTLD_NOW); 58 58 if (!lib) { 59 fprintf(stderr,"Unable to open UI library %s (%s)\n", lib_path, dlerror());59 SLV2_ERRORF("Unable to open UI library %s (%s)\n", lib_path, dlerror()); 60 60 return NULL; 61 61 } … … 64 64 65 65 if (!df) { 66 fprintf(stderr,"Could not find symbol 'lv2ui_descriptor', "66 SLV2_ERRORF("Could not find symbol 'lv2ui_descriptor', " 67 67 "%s is not a LV2 plugin UI.\n", lib_path); 68 68 dlclose(lib); … … 77 77 78 78 if (!ld) { 79 fprintf(stderr,"Did not find UI %s in %s\n",79 SLV2_ERRORF("Did not find UI %s in %s\n", 80 80 slv2_value_as_uri(slv2_ui_get_uri(ui)), lib_path); 81 81 dlclose(lib); 82 82 break; // return NULL 83 83 } else if (!strcmp(ld->URI, slv2_value_as_uri(slv2_ui_get_uri(ui)))) { 84 85 84 assert(plugin->plugin_uri); 86 87 printf("Found UI %s at index %u in:\n\t%s\n\n",88 slv2_value_as_uri(plugin->plugin_uri), i, lib_path);89 90 85 assert(ld->instantiate); 91 86 … … 111 106 // Failed to instantiate 112 107 if (result == NULL || result->pimpl->lv2ui_handle == NULL) { 113 //printf("Failed to instantiate %s\n", plugin->plugin_uri);114 108 free(result); 115 109 return NULL; -
trunk/slv2/src/query.c
r2007 r2086 65 65 type = SLV2_VALUE_FLOAT; 66 66 else 67 fprintf(stderr,"Unknown datatype %s\n", librdf_uri_as_string(datatype_uri));67 SLV2_ERRORF("Unknown datatype %s\n", librdf_uri_as_string(datatype_uri)); 68 68 } 69 69 result = slv2_value_new(world, type, (const char*)librdf_node_get_literal_value(node)); … … 75 75 case LIBRDF_NODE_TYPE_UNKNOWN: 76 76 default: 77 fprintf(stderr,"Unknown RDF node type %d\n", librdf_node_get_type(node));77 SLV2_ERRORF("Unknown RDF node type %d\n", librdf_node_get_type(node)); 78 78 break; 79 79 } … … 97 97 98 98 if (node == NULL) { 99 fprintf(stderr, "SLV2 ERROR:Variable %d bound to NULL.\n", variable);99 SLV2_ERRORF("Variable %d bound to NULL.\n", variable); 100 100 librdf_query_results_next(results->rdf_results); 101 101 continue; … … 138 138 char* query_str = slv2_strjoin(slv2_query_prefixes, sparql_str, NULL); 139 139 140 //printf("******** Query \n%s********\n", query_str);141 142 140 librdf_query* query = librdf_new_query(plugin->world->world, "sparql", NULL, 143 141 (const unsigned char*)query_str, base_uri); 144 142 145 143 if (!query) { 146 fprintf(stderr, "ERROR: Could not create query\n");144 SLV2_ERRORF("Failed to create query:\n%s", query_str); 147 145 return NULL; 148 146 } 149 147 150 // FIXME: locale kludges to work around librdf bug148 // Reset numeric locale to correctly interpret turtle numeric constants 151 149 char* locale = strdup(setlocale(LC_NUMERIC, NULL)); 152 153 150 setlocale(LC_NUMERIC, "POSIX"); 151 154 152 librdf_query_results* results = librdf_query_execute(query, plugin->rdf); 153 154 // Restore numeric locale 155 155 setlocale(LC_NUMERIC, locale); 156 156 -
trunk/slv2/src/slv2_internal.h
r2000 r2086 241 241 char* slv2_get_lang(); 242 242 243 #define SLV2_ERROR(str) fprintf(stderr, "ERROR: %s: " str, __func__) 244 #define SLV2_ERRORF(fmt, ...) fprintf(stderr, "ERROR: %s: " fmt, __func__, __VA_ARGS__) 245 246 #define SLV2_WARN(str) fprintf(stderr, "WARNING: %s: " str, __func__) 247 #define SLV2_WARNF(fmt, ...) fprintf(stderr, "WARNING: %s: " fmt, __func__, __VA_ARGS__) 243 248 244 249 #ifdef __cplusplus -
trunk/slv2/src/value.c
r2007 r2086 97 97 val->type = SLV2_VALUE_FLOAT; 98 98 else 99 fprintf(stderr,"Unknown datatype %s\n", librdf_uri_as_string(datatype_uri));99 SLV2_ERRORF("Unknown datatype %s\n", librdf_uri_as_string(datatype_uri)); 100 100 } 101 101 val->str_val = strdup((char*)librdf_node_get_literal_value(node)); … … 104 104 case LIBRDF_NODE_TYPE_UNKNOWN: 105 105 default: 106 fprintf(stderr, "slv2_value_new_librdf_node error: Unknown node type.");106 SLV2_ERROR("Unknown node type"); 107 107 free(val); 108 108 val = NULL; -
trunk/slv2/src/world.c
r2085 r2086 45 45 world->storage = librdf_new_storage(world->world, "trees", NULL, NULL); 46 46 if (!world->storage) { 47 fprintf(stderr,"Warning: Unable to create \"trees\" RDF storage.\n"48 "Performance can be improved by upgrading librdf.\n");47 SLV2_WARN("Warning: Unable to create \"trees\" RDF storage.\n" 48 "Performance can be improved by upgrading librdf.\n"); 49 49 world->storage = librdf_new_storage(world->world, "hashes", NULL, 50 50 "hash-type='memory'"); … … 178 178 { 179 179 if (!slv2_value_is_uri(bundle_uri)) { 180 fprintf(stderr, "ERROR: slv2_world_load_bundle called with non-URI argument\n");180 SLV2_ERROR("Bundle 'URI' is not a URI\n"); 181 181 return; 182 182 } -
trunk/slv2/utils/lv2_inspect.c
r2000 r2086 103 103 104 104 val = slv2_plugin_get_name(p); 105 printf("\tName: %s\n", slv2_value_as_string(val)); 106 slv2_value_free(val); 105 if (val) { 106 printf("\tName: %s\n", slv2_value_as_string(val)); 107 slv2_value_free(val); 108 } 107 109 108 110 SLV2Value class_label = slv2_plugin_class_get_label(slv2_plugin_get_class(p)); 109 printf("\tClass: %s\n", slv2_value_as_string(class_label)); 111 if (class_label) { 112 printf("\tClass: %s\n", slv2_value_as_string(class_label)); 113 } 110 114 111 115 val = slv2_plugin_get_author_name(p);
