shithub: rgbds

ref: 46a402f7d76dd90b668bc79c9d11b0f9f0c98e44
dir: /include/link/patch.h/

View raw version
/*
 * This file is part of RGBDS.
 *
 * Copyright (c) 1997-2019, Carsten Sorensen and RGBDS contributors.
 *
 * SPDX-License-Identifier: MIT
 */

/* Applying patches to SECTIONs */
#ifndef RGBDS_LINK_PATCH_H
#define RGBDS_LINK_PATCH_H

#include <stdbool.h>
#include <stdint.h>

#include "link/section.h"

#include "linkdefs.h"

struct Assertion {
	struct Patch patch;
	// enum AssertionType type; The `patch`'s field is instead re-used
	struct Section *section;
	char *message;

	struct Assertion *next;
};

/**
 * Checks all assertions
 * @return true if assertion failed
 */
void patch_CheckAssertions(struct Assertion *assertion);

/**
 * Applies all SECTIONs' patches to them
 */
void patch_ApplyPatches(void);

#endif /* RGBDS_LINK_PATCH_H */