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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
1 #ifndef _LINDAAPI_H
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
2
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
3 #define _LINDAAPI_H 1
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
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
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
7 #ifdef __cplusplus
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
8 extern "C" {
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
9 #endif
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
10
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
11 /* $Id$ */
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 /*----------------------------------------------------------------------
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
14 マクロ定義
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ----------------------------------------------------------------------*/
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 #define FAIL (-1)
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 #define PS_DEB 0xf8
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #define MAX_QUEUE 1024
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #define INT_SIZE 4 // Byte = sizeof(int)
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
25 #define LDSERV_PORT 11511
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
26
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 /*----------------------------------------------------------------------
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
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
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 ----------------------------------------------------------------------*/
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 #define LINDA_MODE_OFFSET 0
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 #define LINDA_ID_OFFSET 1
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 /*----------------------------------------------------------------------
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
41 構造体定義
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 ----------------------------------------------------------------------*/
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 typedef struct psx_reply{
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 unsigned char *answer;
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 unsigned int seq;
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 struct psx_reply *next;
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 char mode;
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
48 void(*callback)(unsigned char * tuple, void * obj);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
51
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 typedef struct command_queue{
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
53 struct command_queue *next;
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
54 unsigned int tspace_id; /* ID of destination Tuple Space */
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
55 unsigned int size;
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 unsigned char *command;
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
57 } COMMAND;
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
58
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 /*----------------------------------------------------------------------
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
61 Linda API
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 ----------------------------------------------------------------------*/
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
64 extern void init_linda(void);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
65 extern int open_linda(char *hostname, int port);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
66 extern int open_linda_java(char *hostname, int port);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
67 extern int close_linda(int tspace_id);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
69 extern void psx_free(void*);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
71 extern unsigned char *psx_reply(unsigned int seq);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
72 extern void psx_sync_n(void);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
73 extern unsigned int psx_get_datalength(unsigned char *);
577
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
74 extern unsigned char *psx_get_data(unsigned char *);
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
75 extern unsigned int psx_get_seq(unsigned char *);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
76 extern unsigned short psx_get_id(unsigned char *);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
77 extern unsigned char psx_get_mode(unsigned char *);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
78 extern unsigned char * psx_get_data(unsigned char *);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
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
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
83 char mode, void(*callback)(unsigned char *,void *),void * obj);
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
84
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
85 #define psx_in(tid, id) psx_ld(tid, id, 'i', NULL, NULL)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
86 #define psx_rd(tid, id) psx_ld(tid, id, 'r', NULL, NULL)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
87 #define psx_ck(tid, id) psx_ld(tid, id, 'c', NULL, NULL)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
88 #define psx_wait_rd(tid, id) psx_ld(tid, id, 'w', NULL, NULL)
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
90 #define psx_callback_in(tid, id,callback,obj) psx_ld(tid, id, 'i', callback, obj)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
91 #define psx_callback_rd(tid, id,callback,obj) psx_ld(tid, id, 'r', callback, obj)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
92 #define psx_callback_ck(tid, id,callback,obj) psx_ld(tid, id, 'c', callback, obj)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
93 #define psx_callback_wait_rd(tid, id,callback,obj) psx_ld(tid, id, 'w', callback, obj)
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
94
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
96
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
97 #ifdef __cplusplus
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
98 }; // for extern "C"
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
99 #endif
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
100 #endif // _LINDAAPI_H