Use M3_IMPLEMENT_ERROR_STRINGS for better code structure

extensions
Volodymyr Shymanskyy 5 years ago
parent 2c7957b6f7
commit 7a499fbe0f

@ -29,7 +29,8 @@
#ifndef m3_h
#define m3_h
#include <inttypes.h>
#include <stdlib.h>
#include <stdint.h>
typedef const char * M3Result;
@ -89,8 +90,10 @@ typedef M3ImportInfo * IM3ImportInfo;
// error codes
// -------------------------------------------------------------------------------------------------------------------------------
# ifndef d_m3ErrorConst
# define d_m3ErrorConst(LABEL, STRING) extern const M3Result c_m3Err_##LABEL;
# if defined(M3_IMPLEMENT_ERROR_STRINGS)
# define d_m3ErrorConst(LABEL, STRING) M3Result c_m3Err_##LABEL = { STRING };
# else
# define d_m3ErrorConst(LABEL, STRING) extern M3Result c_m3Err_##LABEL;
# endif
// -------------------------------------------------------------------------------------------------------------------------------

@ -4,8 +4,8 @@
// Copyright © 2019 Steven Massey. All rights reserved.
//
// instantiate error strings here
# define d_m3ErrorConst(LABEL, STRING) const M3Result c_m3Err_##LABEL = { STRING };
#define M3_IMPLEMENT_ERROR_STRINGS
#include "m3.h"
#include "m3_core.h"

Loading…
Cancel
Save