cLinkedList
A simple C library for doubly linked list creation and management
Loading...
Searching...
No Matches
macrodef.h
Go to the documentation of this file.
1//
2// Created by surajcha on 7/24/18.
3//
4#pragma once
5#ifndef MACRODEF_H
6#define MACRODEF_H
7
8#include <math.h>
9#include <stdio.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15// ---------------------------
16// Define NULL, TRUE and FALSE
17// ---------------------------
18#ifndef NULL
19 #define NULL 0L
20#endif /* ~NULL */
21
22#ifndef TRUE
23 #define FALSE 0
24 #define TRUE 1
25#endif /* ~TRUE */
26
27// -----------------------------------
28// Platform specific macro definitions
29// -----------------------------------
30#ifdef _WIN32
31 // Windows-specific definitions
32 // ----------------------------
33 #define DIR_SEP '\\'
34 #define WIN32_LEAN_AND_MEAN
35#else /* ~_WIN32 */
36 #define DIR_SEP '/'
37#endif /* ~_WIN32 */
38
39// --------------------------------
40// Platform-independent math macros
41// --------------------------------
42#ifndef round
43 #define round(X) (((X) >= 0) ? (int)((X)+0.5) : (int)((X)-0.5))
44#endif /* ~round */
45
46#ifndef floor
47 #define floor(X) ((long)X)
48#endif
49
50// -------------------
51// C++ specific macros
52// -------------------
53#ifdef __cplusplus
54 #ifdef __max
55 #define max __max
56 #else
57 #ifndef max
58 #define max(A,B) ( ((A) > (B)) ? (A) : (B) )
59 #endif // max not defined
60 #endif /* ~__max */
61
62 #ifdef __min
63 #define min __min
64 #else
65 #ifndef min
66 #define min(A,B) ( ((A) > (B)) ? (B) : (A) )
67 #endif // min not defined
68 #endif /* ~__min */
69#endif // __cplusplus
70
71// -------------------------------------------
72// Max length of paths allowed in our programs
73// -------------------------------------------
74#ifndef MAXPATHLENGTH
75 #define MAXPATHLENGTH 256
76#endif /* ~MAXPATHLENGTH */
77
78// -------------------------
79// Output stream definitions
80// -------------------------
81#ifndef ERRSTREAM
82 #define ERRSTREAM stdout
83#endif
84
85#ifndef LOGSTREAM
86 #define LOGSTREAM stdout
87#endif // !LOGSTREAM
88
89#ifdef __cplusplus
90}
91#endif
92
93#endif //MACRODEF_H