Compare commits

...

2 Commits

Author SHA1 Message Date
Sara 3f5189f221 feat: added mathext 2024-01-26 22:58:09 +01:00
Sara 63c6a536e8 feat: replaced _fencer_ header guards with CUTES_ 2024-01-26 22:58:02 +01:00
10 changed files with 36 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#ifndef _fencer_debug_h #ifndef CUTES_DEBUG_H
#define _fencer_debug_h #define CUTES_DEBUG_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -66,4 +66,4 @@ extern int g_debug_log_lvl;
}\ }\
} while(0) } while(0)
#endif // !_fencer_debug_h #endif // !CUTES_DEBUG_H

View File

@ -1,5 +1,5 @@
#ifndef _fencer_hash_map_h #ifndef CUTES_DICTIONARY_H
#define _fencer_hash_map_h #define CUTES_DICTIONARY_H
#include "list.h" #include "list.h"
@ -43,4 +43,4 @@ dictionary_new(sizeof(Type_))
#define dictionary_get_value(Type_, Dict_, Key_)\ #define dictionary_get_value(Type_, Dict_, Key_)\
*((Type_*)dictionary_get_raw(Dict_, Key_)) *((Type_*)dictionary_get_raw(Dict_, Key_))
#endif // !_fencer_hash_map_h #endif // !CUTES_DICTIONARY_H

6
drop.h
View File

@ -1,5 +1,5 @@
#ifndef _fencer_drop_h #ifndef CUTES_DROP_H
#define _fencer_drop_h #define CUTES_DROP_H
#include "typeclass_helpers.h" #include "typeclass_helpers.h"
@ -30,4 +30,4 @@ Drop T##_as_Drop(T* x) {\
};\ };\
return (Drop){.tc = &tc, .data = x};\ return (Drop){.tc = &tc, .data = x};\
} }
#endif // !_fencer_drop_h #endif // !CUTES_DROP_H

6
list.h
View File

@ -1,5 +1,5 @@
#ifndef _fencer_list_h #ifndef CUTES_LIST_H
#define _fencer_list_h #define CUTES_LIST_H
#include "stddef.h" #include "stddef.h"
@ -38,4 +38,4 @@ extern size_t list_contains(List* self, void* query);
#define list_iterator_begin_as(T, __list) ((T*)(list_iterator_begin(__list))) #define list_iterator_begin_as(T, __list) ((T*)(list_iterator_begin(__list)))
#endif // !_fencer_list_h #endif // !CUTES_LIST_H

9
mathext.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef CUTES_MATHEXT_H
#define CUTES_MATHEXT_H
#define MIN(x__, min__) (((x__)<=(min__))?(min__):(x__))
#define MAX(x__, max__) (((x__)>=(max__))?(max__):(x__))
#define CLAMP(x__, min__, max__) MIN(MAX(x__, max__), min__)
#endif // !CUTES_MATHEXT_H

View File

@ -1,5 +1,5 @@
#ifndef _fencer_mirror_h #ifndef CUTES_MIRROR_H
#define _fencer_mirror_h #define CUTES_MIRROR_H
#include "typeclass_helpers.h" #include "typeclass_helpers.h"
#include "stdint.h" #include "stdint.h"
@ -123,4 +123,4 @@ Dictionary* T##_get_typeclasses(T* self) {\
}\ }\
impl_Mirror_for(T, T##_get_typestring, T##_get_typeid, T##_get_typeclasses) impl_Mirror_for(T, T##_get_typestring, T##_get_typeid, T##_get_typeclasses)
#endif // !_fencer_mirror_h #endif // !CUTES_MIRROR_H

View File

@ -1,5 +1,5 @@
#ifndef _fencer_strutil_h #ifndef CUTES_STRUTIL_H
#define _fencer_strutil_h #define CUTES_STRUTIL_H
#include "stdlib.h" #include "stdlib.h"
#include "stdint.h" #include "stdint.h"
@ -14,4 +14,4 @@ extern long strcount(const char* begin, const char* end, char search);
extern long strfirst_pred(const char* begin, const char* end, CharPredFn pred); extern long strfirst_pred(const char* begin, const char* end, CharPredFn pred);
extern long strlast_pred(const char* rbegin, const char* rend, CharPredFn pred); extern long strlast_pred(const char* rbegin, const char* rend, CharPredFn pred);
#endif // !_fencer_strutil_h #endif // !CUTES_STRUTIL_H

View File

@ -1,5 +1,5 @@
#ifndef _fencer_typeclass_helpers_h #ifndef CUTES_TYPECLASS_HELPERS_H
#define _fencer_typeclass_helpers_h #define CUTES_TYPECLASS_HELPERS_H
#define TC_FN_TYPECHECK(__Return, __Name, ...)\ #define TC_FN_TYPECHECK(__Return, __Name, ...)\
__Return (*const __Name##_)(__VA_ARGS__) = __Name; (void)__Name##_ __Return (*const __Name##_)(__VA_ARGS__) = __Name; (void)__Name##_
@ -7,4 +7,4 @@ __Return (*const __Name##_)(__VA_ARGS__) = __Name; (void)__Name##_
#define decl_typeclass_impl(__Typeclass, __Type)\ #define decl_typeclass_impl(__Typeclass, __Type)\
extern __Typeclass __Type##_as_##__Typeclass(__Type*); extern __Typeclass __Type##_as_##__Typeclass(__Type*);
#endif // !_fencer_typeclass_helpers_h #endif // !CUTES_TYPECLASS_HELPERS_H

View File

@ -1,5 +1,5 @@
#ifndef _fencer_variant_h #ifndef CUTES_VARIANT_H
#define _fencer_variant_h #define CUTES_VARIANT_H
#include "vmath.h" #include "vmath.h"
#include "mirror.h" #include "mirror.h"
@ -33,4 +33,4 @@ extern void destroy_contained(Variant* self);
#define StringVariant(Value_, BufSize_) (Variant){.type = Variant_String, .as_string = Value_, .string_size = BufSize_} #define StringVariant(Value_, BufSize_) (Variant){.type = Variant_String, .as_string = Value_, .string_size = BufSize_}
#define UndefinedVariant() (Variant){.type = Variant_Undefined } #define UndefinedVariant() (Variant){.type = Variant_Undefined }
#endif // !_fencer_variant_h #endif // !CUTES_VARIANT_H

View File

@ -1,5 +1,5 @@
#ifndef _fencer_vmath_h #ifndef CUTES_VMATH_H
#define _fencer_vmath_h #define CUTES_VMATH_H
#include "stddef.h" #include "stddef.h"
#include <math.h> #include <math.h>
@ -178,4 +178,4 @@ IVector vmuli(IVector a, IVector b) {
return (IVector){a.x * b.x, a.y * b.y}; return (IVector){a.x * b.x, a.y * b.y};
} }
#endif // !_fencer_vmath_h #endif // !CUTES_VMATH_H