Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/lindaapi.h @ 606:32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
64bit ABI requires 64bit SDL library etc.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Nov 2009 18:05:52 +0900 |
parents | 42c94f85c779 |
children | 0decff4e867b |
rev | line source |
---|---|
565 | 1 #ifndef _LINDAAPI_H |
2 | |
3 #define _LINDAAPI_H 1 | |
4 | |
606
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
5 #include "types.h" |
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
6 |
565 | 7 #ifdef __cplusplus |
8 extern "C" { | |
9 #endif | |
10 | |
11 /* $Id$ */ | |
507 | 12 |
13 /*---------------------------------------------------------------------- | |
565 | 14 マクロ定義 |
507 | 15 ----------------------------------------------------------------------*/ |
16 | |
17 #define FAIL (-1) | |
18 | |
19 #define PS_DEB 0xf8 | |
20 | |
21 #define MAX_QUEUE 1024 | |
22 | |
23 #define INT_SIZE 4 // Byte = sizeof(int) | |
24 | |
565 | 25 #define LDSERV_PORT 11511 |
26 | |
507 | 27 /*---------------------------------------------------------------------- |
565 | 28 パケットフォーマット |
606
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
29 char short int int |
507 | 30 Mode + ID + Seq + Data_len + Padding + Data |
606
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
31 0 1 3 7 11 12 |
507 | 32 ----------------------------------------------------------------------*/ |
33 | |
34 #define LINDA_MODE_OFFSET 0 | |
35 #define LINDA_ID_OFFSET 1 | |
36 #define LINDA_SEQ_OFFSET 3 | |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
37 #define LINDA_DATA_LENGTH_OFFSET 7 |
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
38 #define LINDA_HEADER_SIZE 12 |
507 | 39 |
40 /*---------------------------------------------------------------------- | |
565 | 41 構造体定義 |
507 | 42 ----------------------------------------------------------------------*/ |
43 typedef struct psx_reply{ | |
44 unsigned char *answer; | |
45 unsigned int seq; | |
46 struct psx_reply *next; | |
47 char mode; | |
565 | 48 void(*callback)(unsigned char * tuple, void * obj); |
507 | 49 void * obj; |
606
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
50 } REPLY; |
565 | 51 |
507 | 52 typedef struct command_queue{ |
565 | 53 struct command_queue *next; |
54 unsigned int tspace_id; /* ID of destination Tuple Space */ | |
55 unsigned int size; | |
507 | 56 unsigned char *command; |
565 | 57 } COMMAND; |
58 | |
507 | 59 |
60 /*---------------------------------------------------------------------- | |
565 | 61 Linda API |
507 | 62 ----------------------------------------------------------------------*/ |
63 | |
565 | 64 extern void init_linda(void); |
65 extern int open_linda(char *hostname, int port); | |
66 extern int open_linda_java(char *hostname, int port); | |
67 extern int close_linda(int tspace_id); | |
507 | 68 |
565 | 69 extern void psx_free(void*); |
507 | 70 |
565 | 71 extern unsigned char *psx_reply(unsigned int seq); |
72 extern void psx_sync_n(void); | |
73 extern unsigned int psx_get_datalength(unsigned char *); | |
577 | 74 extern unsigned char *psx_get_data(unsigned char *); |
565 | 75 extern unsigned int psx_get_seq(unsigned char *); |
76 extern unsigned short psx_get_id(unsigned char *); | |
77 extern unsigned char psx_get_mode(unsigned char *); | |
78 extern unsigned char * psx_get_data(unsigned char *); | |
507 | 79 |
606
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
80 extern long psx_out(unsigned int tspace_id, unsigned int id, |
565 | 81 unsigned char *data, unsigned int size); |
606
32a7260fad2f
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
603
diff
changeset
|
82 extern long psx_ld(unsigned int tspace_id, unsigned int id, |
565 | 83 char mode, void(*callback)(unsigned char *,void *),void * obj); |
84 | |
85 #define psx_in(tid, id) psx_ld(tid, id, 'i', NULL, NULL) | |
86 #define psx_rd(tid, id) psx_ld(tid, id, 'r', NULL, NULL) | |
87 #define psx_ck(tid, id) psx_ld(tid, id, 'c', NULL, NULL) | |
88 #define psx_wait_rd(tid, id) psx_ld(tid, id, 'w', NULL, NULL) | |
507 | 89 |
565 | 90 #define psx_callback_in(tid, id,callback,obj) psx_ld(tid, id, 'i', callback, obj) |
91 #define psx_callback_rd(tid, id,callback,obj) psx_ld(tid, id, 'r', callback, obj) | |
92 #define psx_callback_ck(tid, id,callback,obj) psx_ld(tid, id, 'c', callback, obj) | |
93 #define psx_callback_wait_rd(tid, id,callback,obj) psx_ld(tid, id, 'w', callback, obj) | |
94 | |
507 | 95 |
565 | 96 |
97 #ifdef __cplusplus | |
98 }; // for extern "C" | |
99 #endif | |
100 #endif // _LINDAAPI_H |