mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
This is a tool written in C which does basically the same job as regtools' headergen_v2, but using a new input format which is less verbose than XML. In the interests of simplicity it omits some features that regtools does support, like variant registers or the SoC selector stuff so it cannot completely replace regtools on the i.MX platforms that use these features. RegGen doesn't generate API macros like regtools does; instead these are expected to be maintained by hand, since it's arguably easier to do that way. Since RegGen has no dependencies beyond a C compiler it can be integrated with the build system without adding any new build time dependencies. This will allow generating headers automatically, which is a substantial improvement over running headergen_v2 by hand and committing the generated output. The RegGen tool itself is licensed as GPLv3+, but generated headers can be licensed as the user chooses. Change-Id: If18f9577f8f4df6e2c97c1665b725773dd5466f0
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
/*
|
|
* This file is part of RegGen -- register definition generator
|
|
* Copyright (C) 2025 Aidan MacDonald
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef REGGEN_OUTPUT_H
|
|
#define REGGEN_OUTPUT_H
|
|
|
|
#include "array.h"
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <stddef.h>
|
|
|
|
struct output_file
|
|
{
|
|
FILE *fstream;
|
|
|
|
const char *filename;
|
|
const char *include_guard_token;
|
|
|
|
char *linebuf;
|
|
size_t linesize;
|
|
|
|
struct array lines;
|
|
size_t num_lines;
|
|
};
|
|
|
|
void output_vaddcol(struct output_file *file, size_t column_nr,
|
|
const char *fmt, va_list ap_in);
|
|
void output_addcol(struct output_file *file, size_t column_nr,
|
|
const char *fmt, ...);
|
|
void output_newline(struct output_file *file);
|
|
void output_flush(struct output_file *file);
|
|
void output_free(struct output_file *file);
|
|
|
|
#endif /* REGGEN_OUTPUT_H */
|