#include "problem.h"
#include "solution.h"
-static ProblemObject* Problem_new_core(PyTypeObject* type, PakfireProblem problem) {
+static ProblemObject* Problem_new_core(PyTypeObject* type, struct pakfire_problem* problem) {
ProblemObject* self = (ProblemObject *)type->tp_alloc(type, 0);
if (self) {
self->problem = problem;
return self;
}
-PyObject* new_problem(PakfireProblem problem) {
+PyObject* new_problem(struct pakfire_problem* problem) {
ProblemObject* p = Problem_new_core(&ProblemType, problem);
return (PyObject*)p;
typedef struct {
PyObject_HEAD
- PakfireProblem problem;
+ struct pakfire_problem* problem;
} ProblemObject;
extern PyTypeObject ProblemType;
-PyObject* new_problem(PakfireProblem problem);
+PyObject* new_problem(struct pakfire_problem* problem);
#endif /* PYTHON_PAKFIRE_PROBLEM_H */
#include <pakfire/request.h>
-PakfireProblem pakfire_problem_create(struct pakfire_request* request, Id id);
-PakfireProblem pakfire_problem_ref(PakfireProblem problem);
-PakfireProblem pakfire_problem_unref(PakfireProblem problem);
+struct pakfire_problem;
-PakfireProblem pakfire_problem_next(PakfireProblem problem);
-void pakfire_problem_append(PakfireProblem problem, PakfireProblem new_problem);
+struct pakfire_problem* pakfire_problem_create(struct pakfire_request* request, Id id);
+struct pakfire_problem* pakfire_problem_ref(struct pakfire_problem* problem);
+struct pakfire_problem* pakfire_problem_unref(struct pakfire_problem* problem);
-const char* pakfire_problem_to_string(PakfireProblem problem);
+struct pakfire_problem* pakfire_problem_next(struct pakfire_problem* problem);
+void pakfire_problem_append(struct pakfire_problem* problem, struct pakfire_problem* new_problem);
-struct pakfire_request* pakfire_problem_get_request(PakfireProblem problem);
-PakfireSolution pakfire_problem_get_solutions(PakfireProblem problem);
+const char* pakfire_problem_to_string(struct pakfire_problem* problem);
+
+struct pakfire_request* pakfire_problem_get_request(struct pakfire_problem* problem);
+PakfireSolution pakfire_problem_get_solutions(struct pakfire_problem* problem);
#ifdef PAKFIRE_PRIVATE
-Pakfire pakfire_problem_get_pakfire(PakfireProblem problem);
-Id pakfire_problem_get_id(PakfireProblem problem);
+Pakfire pakfire_problem_get_pakfire(struct pakfire_problem* problem);
+Id pakfire_problem_get_id(struct pakfire_problem* problem);
#endif
#ifndef PAKFIRE_REQUEST_H
#define PAKFIRE_REQUEST_H
+#include <pakfire/problem.h>
#include <pakfire/transaction.h>
#include <pakfire/types.h>
int pakfire_request_solve(struct pakfire_request* request,
struct pakfire_transaction** transaction);
-PakfireProblem pakfire_request_get_problems(struct pakfire_request* request);
+struct pakfire_problem* pakfire_request_get_problems(struct pakfire_request* request);
int pakfire_request_install(struct pakfire_request* request, const char* what, int flags);
int pakfire_request_install_package(struct pakfire_request* request, PakfirePackage package);
#ifndef PAKFIRE_SOLUTION_H
#define PAKFIRE_SOLUTION_H
+#include <solv/pooltypes.h>
+
#include <pakfire/problem.h>
-PakfireSolution pakfire_solution_create(PakfireProblem problem, Id id);
+PakfireSolution pakfire_solution_create(struct pakfire_problem* problem, Id id);
PakfireSolution pakfire_solution_ref(PakfireSolution solution);
PakfireSolution pakfire_solution_unref(PakfireSolution solution);
typedef struct _PakfirePackage* PakfirePackage;
typedef struct _PakfirePackageList* PakfirePackageList;
typedef struct _PakfireParser* PakfireParser;
-typedef struct _PakfireProblem* PakfireProblem;
typedef struct _PakfireRepo* PakfireRepo;
typedef struct _PakfireSolution* PakfireSolution;
#include <pakfire/solution.h>
#include <pakfire/util.h>
-struct _PakfireProblem {
+struct pakfire_problem {
Pakfire pakfire;
struct pakfire_request* request;
Id id;
char* string;
- PakfireProblem next;
+ struct pakfire_problem* next;
int nrefs;
};
-static char* to_string(PakfireProblem problem) {
+static char* to_string(struct pakfire_problem* problem) {
Solver* solver = pakfire_request_get_solver(problem->request);
Pool* pool = solver->pool;
return strdup(s);
}
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_create(struct pakfire_request* request, Id id) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_create(struct pakfire_request* request, Id id) {
Pakfire pakfire = pakfire_request_get_pakfire(request);
- PakfireProblem problem = calloc(1, sizeof(*problem));
+ struct pakfire_problem* problem = calloc(1, sizeof(*problem));
if (problem) {
problem->pakfire = pakfire_ref(pakfire);
problem->nrefs = 1;
return problem;
}
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_ref(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_ref(struct pakfire_problem* problem) {
problem->nrefs++;
return problem;
}
-static void pakfire_problem_free(PakfireProblem problem) {
+static void pakfire_problem_free(struct pakfire_problem* problem) {
pakfire_problem_unref(problem->next);
pakfire_request_unref(problem->request);
free(problem);
}
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_unref(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_unref(struct pakfire_problem* problem) {
if (!problem)
return NULL;
return NULL;
}
-Pakfire pakfire_problem_get_pakfire(PakfireProblem problem) {
+Pakfire pakfire_problem_get_pakfire(struct pakfire_problem* problem) {
return pakfire_ref(problem->pakfire);
}
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_next(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_next(struct pakfire_problem* problem) {
return problem->next;
}
-PAKFIRE_EXPORT void pakfire_problem_append(PakfireProblem problem, PakfireProblem new_problem) {
- PakfireProblem next;
+PAKFIRE_EXPORT void pakfire_problem_append(struct pakfire_problem* problem, struct pakfire_problem* new_problem) {
+ struct pakfire_problem* next;
// Go to last problem in list
while ((next = pakfire_problem_next(problem)) != NULL) {
problem->next = pakfire_problem_ref(new_problem);
}
-PAKFIRE_EXPORT const char* pakfire_problem_to_string(PakfireProblem problem) {
+PAKFIRE_EXPORT const char* pakfire_problem_to_string(struct pakfire_problem* problem) {
return problem->string;
}
-Id pakfire_problem_get_id(PakfireProblem problem) {
+Id pakfire_problem_get_id(struct pakfire_problem* problem) {
return problem->id;
}
-PAKFIRE_EXPORT struct pakfire_request* pakfire_problem_get_request(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_request* pakfire_problem_get_request(struct pakfire_problem* problem) {
return pakfire_request_ref(problem->request);
}
-PAKFIRE_EXPORT PakfireSolution pakfire_problem_get_solutions(PakfireProblem problem) {
+PAKFIRE_EXPORT PakfireSolution pakfire_problem_get_solutions(struct pakfire_problem* problem) {
PakfireSolution ret = NULL;
Solver* solver = pakfire_request_get_solver(problem->request);
return r;
}
-PAKFIRE_EXPORT PakfireProblem pakfire_request_get_problems(struct pakfire_request* request) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_request_get_problems(struct pakfire_request* request) {
Id problem = 0;
- PakfireProblem ret = NULL;
+ struct pakfire_problem* ret = NULL;
while ((problem = solver_next_problem(request->solver, problem)) != 0) {
- PakfireProblem p = pakfire_problem_create(request, problem);
+ struct pakfire_problem* p = pakfire_problem_create(request, problem);
if (ret)
pakfire_problem_append(ret, p);
struct _PakfireSolution {
Pakfire pakfire;
- PakfireProblem problem;
+ struct pakfire_problem* problem;
Id id;
char** elements;
pakfire_request_unref(request);
}
-PAKFIRE_EXPORT PakfireSolution pakfire_solution_create(PakfireProblem problem, Id id) {
+PAKFIRE_EXPORT PakfireSolution pakfire_solution_create(struct pakfire_problem* problem, Id id) {
Pakfire pakfire = pakfire_problem_get_pakfire(problem);
PakfireSolution solution = calloc(1, sizeof(*solution));