diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2021-09-24 16:42:54 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2021-09-24 16:42:54 +0900 |
| commit | 6b3075d90d945d5e7e8fd4d28284ffd99dbeb82e (patch) | |
| tree | 4d9e58166e36452bc3a19172d9cfb7a245f996b0 /src/mytype.h | |
| parent | dd62122ee43d2c388fb96518eaa527976fddfc38 (diff) | |
| download | inpla-6b3075d90d945d5e7e8fd4d28284ffd99dbeb82e.tar.gz inpla-6b3075d90d945d5e7e8fd4d28284ffd99dbeb82e.zip | |
v0.4.1
Diffstat (limited to 'src/mytype.h')
| -rw-r--r-- | src/mytype.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/mytype.h b/src/mytype.h new file mode 100644 index 0000000..7e55a20 --- /dev/null +++ b/src/mytype.h @@ -0,0 +1,49 @@ +#ifndef _TYPE_ +#define _TYPE_ + +typedef unsigned int IDTYPE; +typedef unsigned long VALUE; + + +typedef struct { + IDTYPE id; +} Basic; + + +#define MAX_PORT 5 + +#ifndef THREAD +typedef struct { + Basic basic; + VALUE port; +} Name; + +typedef struct { + Basic basic; + VALUE port[MAX_PORT]; +} Agent; + +#else +typedef struct { + Basic basic; + volatile VALUE port; +} Name; + +typedef struct { + Basic basic; + volatile VALUE port[MAX_PORT]; +} Agent; +#endif + + +#define FIXNUM_FLAG 0x01 +#define INT2FIX(i) ((VALUE)(((long)(i) << 1) | FIXNUM_FLAG)) +#define FIX2INT(i) ((int)(i) >> 1) +#define IS_FIXNUM(i) ((VALUE)(i) & FIXNUM_FLAG) + + +#define AGENT(a) ((Agent *)(a)) +#define BASIC(a) ((Basic *)(a)) +#define NAME(a) ((Name *)(a)) + +#endif |
