4 source macros
forgejo docs edited this page 2026-11-17 17:33:00 +00:00

Source macros

This file contains the macros that are written in the source files

Go back to homepage
Skip to files index

Defined in this file

The following 40 macros are referenced in this file

macro ARG_MISSING

Go back to top

#define ARG_MISSING(arg) {
  fprintf(stderr, "\x1b[33m%s\x1b[0m is missing, specify it using : \x1b[90m%s", (arg).name, (arg).name);
  switch ((arg).type) {
    case String:
      printf(" \"some value\"");
      break;
    case Int:
      printf(" 2");
      break;
    case Presence:
      break;
  }
  printf("\x1b[0m\n");
  return 1;
}

Defined in src/main.c:10

macro ARGS_T

Go back to top

#define ARGS_T char * buffer, int fd

Defined in src/reader/reader.c:175

macro ARGS_V

Go back to top

#define ARGS_V buffer, fd

Defined in src/reader/reader.c:176

macro BAS_OPE

Go back to top

#define BAS_OPE(base, value, coef) if (coef == -1) base = (base) * 10 - (value);
											else base = (base) * 10 + (value);

Defined in src/parsers/parsers.c:6

macro BAS_COM

Go back to top

#define BAS_COM(base, verif, coef) ((coef == -1) ? (base <= verif) : (base >= verif))

Defined in src/parsers/parsers.c:8

macro CHECK

Go back to top

#define CHECK(instruction) {
  if (instruction != 0) return 1;
}

Defined in src/core/linkage.c:699

macro DUMP

Go back to top

#define DUMP(...) {
  size_t bytes = snprintf(buffer, BUFSIZ, __VA_ARGS__);
  write(fd, buffer, bytes);
  write(fd, "\n", 1);
}

Defined in src/reader/reader.c:177

macro FREE_IF_NEEDED

Go back to top

#define FREE_IF_NEEDED(status, args, td) {
  if (status->is_header) args->source_code->definitions.typedefs.count--;
  else args->source_code->implementations.typedefs.count--;
  if (GET_TCOUNT(status->is_header, args->source_code) == 1) free(td);
}

Defined in src/core/auxiliary.c:1788

macro FREE_ALL

Go back to top

#define FREE_ALL(data, status, td) {
  if (data->buffer != NULL) free(data->buffer);
  if (td != NULL && td->ref != NULL) free(td->ref);
  free(data);
  status->data = NULL;
  status->reading_multiline_typedef = 0;
}

Defined in src/core/auxiliary.c:1781

macro FREE_ENUMDATA

Go back to top

#define FREE_ENUMDATA(status, data) {
  if (data->members_count > 0 && data->members != NULL) free(data->members);
  free(data);
  status->data = NULL;
}

Defined in src/core/auxiliary.c:1386

macro FREE_DATA

Go back to top

#define FREE_DATA(status, data) {
  if (data->args_count > 0) {
    while (data->args_count > 0) {
      free(data->args[data->args_count - 1]);
      (data->args_count)--;
    }
    free(data->args);
  };
  free(data);
  status->data = NULL;
}

Defined in src/core/auxiliary.c:894

macro GOBACK_TO_TOP

Go back to top

#define GOBACK_TO_TOP "\n> [*Go back to top*](#defined-in-this-file)"

Defined in src/render/render.c:39

Note


Variable to go back to top of the page
Purely a string, include it wherever it is needed

It is based on the ## Defined in this file anchor

macro GOBACK_TO_HP

Go back to top

#define GOBACK_TO_HP "\n> [Go back to homepage](./Home.md)<br>"

Defined in src/render/render.c:40

macro GET_TDCOUNT

Go back to top

#define GET_TDCOUNT(header, code) ((header) ? (code->definitions.typedefs.count) : (code->implementations.typedefs.count))

Defined in src/core/auxiliary.c:1819

macro GOTO_NEXTWORD

Go back to top

#define GOTO_NEXTWORD(buffer) {
  while (*(buffer) != ' ') buffer++;
  while (*(buffer) == ' ') buffer++;
}

Defined in src/core/linkage.c:10

macro GET_TCOUNT

Go back to top

#define GET_TCOUNT(header, code) (header ? (code->definitions.typedefs.count) : (code->implementations.typedefs.count))

Defined in src/core/auxiliary.c:1780

macro GET_ECOUNT

Go back to top

#define GET_ECOUNT(header, code) ((header) ? (code->definitions.enums.count) : (code->implementations.enums.count))

Defined in src/core/auxiliary.c:1385

macro GET_FCOUNT

Go back to top

#define GET_FCOUNT(header, code) ((header) ? (code->definitions.functions.count) : (code->implementations.functions.count))

Defined in src/core/auxiliary.c:893

macro GET_MCOUNT

Go back to top

#define GET_MCOUNT(header, code) ((header) ? (code->definitions.macros.count) : (code->implementations.macros.count))

Defined in src/core/auxiliary.c:266

macro GET_COUNT

Go back to top

#define GET_COUNT(is_header, source_code) ((is_header) ? (source_code->definitions.structs.count) : (source_code->implementations.structs.count))

Defined in src/core/auxiliary.c:574

macro IS_SYS_PATH

Go back to top

#define IS_SYS_PATH(str) (*str != 0 && ((*str == '.' && *(str + 1) == 0) || (*str == '.' && *(str + 1) == '.' && *(str + 2) == 0)))

Defined in src/core/core.c:19

macro INCREMENT_RES

Go back to top

#define INCREMENT_RES(res, val, times) res = res * times + (long long int)val;

Defined in src/core/auxiliary.c:1480

macro INIT

Go back to top

#define INIT(code, word) code->definitions.word.array = NULL;
code->definitions.word.count = 0;
code->implementations.word.array = NULL;
code->implementations.word.count = 0;

Defined in src/reader/reader.c:157

macro ISC_NMC

Go back to top

#define ISC_NMC(x) (48 <= (x) && (x) <= 57)

Defined in src/parsers/parsers.c:4

macro LINE_BUFFER_SIZE

Go back to top

#define LINE_BUFFER_SIZE 2048

Defined in src/core/core.c:20

macro MDARGS_V

Go back to top

#define MDARGS_V code, config, result, buffer

Defined in src/render/render.c:11

macro MDDUMP

Go back to top

#define MDDUMP(...) {
  size_t bytes_formatted = snprintf(buffer, BUFSIZ, __VA_ARGS__);
  write(fd, buffer, bytes_formatted);
}

Defined in src/render/render.c:13

macro MDARGS_T

Go back to top

#define MDARGS_T source_code_t code, gen_config_t config, struct result * result, char * buffer

Defined in src/render/render.c:10

macro OPEN

Go back to top

#define OPEN(var, path, result) {
  mkdirp(path);
  if ((var = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IROTH | S_IRGRP)) == -1) {
    perror("open markdown");
    result->fails++;
    return;
  }
}

Defined in src/render/render.c:20

macro O_BINARY

Go back to top

#define O_BINARY 0   

Defined in src/core/core.c:16

macro PTR_COMPARISON

Go back to top

#define PTR_COMPARISON(keyword, structure, ptr) ((code->definitions.keyword.array <= (struct structure *)ptr) && ((struct structure *)ptr < code->definitions.keyword.array + code->definitions.keyword.count))

Defined in src/render/render.c:126

macro PRIMITIVE_DUMP

Go back to top

#define PRIMITIVE_DUMP(p, TEST_MACRO, text) if (TEST_MACRO(p->source)) MDDUMP("- " text "");

Defined in src/render/render.c:328

macro PREPARE

Go back to top

#define PREPARE int fd;
  char pathbuf[PATH_MAX];

Defined in src/render/render.c:17

macro PATHNAME

Go back to top

#define PATHNAME(into, config, ...) {
  size_t written = snprintf(into, PATH_MAX, "%s", config->dest);
  snprintf(into + written, PATH_MAX - written - 1, "/" __VA_ARGS__);
}

Defined in src/render/render.c:28

macro PRIMITIVE_DUMP

Go back to top

#define PRIMITIVE_DUMP(p, TEST_MACRO, text) if (TEST_MACRO(p->source)) DUMP(" - " text);

Defined in src/reader/reader.c:304

macro PATH_MAX

Go back to top

#define PATH_MAX _MAX_PATH

Defined in src/core/auxiliary.c:8

macro SKIP_VOID

Go back to top

#define SKIP_VOID(p) while (*(p) == ' ') p++;

Defined in src/core/auxiliary.c:1474

macro SKIP_BOTH

Go back to top

#define SKIP_BOTH(p) {
  SKIP_WORD(p)
  SKIP_VOID(p);
}

Defined in src/core/auxiliary.c:1475

macro SKIP_WORD

Go back to top

#define SKIP_WORD(buffer) while (*(buffer) != ' ') buffer++;

Defined in src/core/auxiliary.c:1096

macro SET_CTR

Go back to top

#define SET_CTR(x, y) if ((x) != NULL) (*x) = y;

Defined in src/parsers/parsers.c:5

Indexed files