int r;
// Create a new parser
- r = pakfire_parser_create(parser, root, NULL, NULL, PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS);
+ r = pakfire_parser_create(parser, ctx, root, NULL, NULL,
+ PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS);
if (r < 0)
goto ERROR;
free(parser);
}
-int pakfire_parser_create(pakfire_parser** parser,
- pakfire_root* root, pakfire_parser* parent, const char* namespace, int flags) {
+int pakfire_parser_create(pakfire_parser** parser, pakfire_ctx* ctx, pakfire_root* root,
+ pakfire_parser* parent, const char* namespace, int flags) {
pakfire_parser* self = NULL;
int r;
return -errno;
// Store a reference to the context
- self->ctx = pakfire_root_get_ctx(root);
+ self->ctx = pakfire_ctx_ref(ctx);
// Store a reference to the root
self->root = pakfire_root_ref(root);
int r;
// Create the parser
- r = pakfire_parser_create(&child, parser->root, parser, namespace, parser->flags);
+ r = pakfire_parser_create(&child, parser->ctx, parser->root, parser, namespace, parser->flags);
if (r < 0)
return NULL;
typedef struct pakfire_parser pakfire_parser;
+#include <pakfire/ctx.h>
#include <pakfire/env.h>
#include <pakfire/package.h>
#include <pakfire/parser.h>
typedef struct pakfire_parser_error pakfire_parser_error;
-int pakfire_parser_create(pakfire_parser** parser, pakfire_root* root,
+int pakfire_parser_create(pakfire_parser** parser, pakfire_ctx* ctx, pakfire_root* root,
pakfire_parser* parent, const char* namespace, int flags);
pakfire_parser* pakfire_parser_create_child(pakfire_parser* parser,
const char* namespace);
}
%initial-action {
- int r = pakfire_parser_create(parser, root, parent, NULL, 0);
+ int r = pakfire_parser_create(parser, ctx, root, parent, NULL, 0);
if (r < 0)
ABORT;
};
grammar : %empty
{
- int r = pakfire_parser_create(&$$, root, *parser, NULL, 0);
+ int r = pakfire_parser_create(&$$, ctx, root, *parser, NULL, 0);
if (r < 0)
ABORT;
int r;
// Create a new parser
- r = pakfire_parser_create(&$$, root, *parser, NULL, 0);
+ r = pakfire_parser_create(&$$, ctx, root, *parser, NULL, 0);
if (r < 0)
ABORT;
FILE* f = fopen(path, "r");
ASSERT(f);
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL, 0));
ASSERT_SUCCESS(pakfire_parser_read(parser, f, NULL));
pakfire_parser* parser = NULL;
int r = EXIT_FAILURE;
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL, 0));
// Load 'em all
ASSERT_SUCCESS(load_macros(parser));
ASSERT_SUCCESS(pakfire_repo_create(&repo, t->root, "test"));
ASSERT(repo);
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL,
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL,
PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS));
// Set some architecture
char* s = NULL;
// Create a new parser
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL, 0));
// Retrieve a value that does not exist
ASSERT_NULL(pakfire_parser_get(parser, NULL, "null"));
ASSERT_SUCCESS(pakfire_string_format(path, "%s/%s", TEST_SRC_PATH, *file));
// Create a new parser
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL, 0));
FILE* f = fopen(path, "r");
ASSERT(f);
char* s = NULL;
// Create a new parser
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL, 0));
const char* str1 =
"a = 1\n"
pakfire_parser* parser = NULL;
int r = EXIT_FAILURE;
- ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS));
+ ASSERT_SUCCESS(pakfire_parser_create(&parser, t->ctx, t->root, NULL, NULL,
+ PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS));
ASSERT_SUCCESS(pakfire_parser_set(parser, NULL, "command", command, 0));
}
// Create a new parser
- r = pakfire_parser_create(&parser, root, NULL, NULL, 0);
+ r = pakfire_parser_create(&parser, ctx, root, NULL, NULL, 0);
if (r < 0) {
fprintf(stderr, "Could not create a parser: %s\n", strerror(-r));
goto ERROR;