+ } else if (myQueryType == QueryType_CQL2RPN) {
+ /* ### All this code should be wrapped in a utility function */
+ CQL_parser parser;
+ struct cql_node *node;
+ const char *addinfo;
+ if (cqltrans == 0) {
+ printf("Can't use CQL: no translation file. Try set_cqlfile\n");
+ return 0;
+ }
+ parser = cql_parser_create();
+ if ((error = cql_parser_string(parser, arg)) != 0) {
+ /* ### must do better with the reporting here */
+ printf("CQL ERROR %d: presumably a syntax error?\n", error);
+ return 0;
+ }
+ node = cql_parser_result(parser);
+ if ((error = cql_transform_buf(cqltrans, node, pqfbuf,
+ sizeof pqfbuf)) != 0) {
+ error = cql_transform_error(cqltrans, &addinfo);
+ printf ("Couldn't convert CQL to PQF: error #%d (addinfo=%s)\n",
+ error, addinfo);
+ return 0;
+ }
+ arg = pqfbuf;
+ myQueryType = QueryType_Prefix;