Mercurial > hg > old > magoroku_racing
view Linda/#lindaapi.h# @ 153:0a375e9c4288 gongo tip
close
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jul 2011 14:45:21 +0900 |
parents | cb6c6de125dc |
children |
line wrap: on
line source
// $Id$ // /*---------------------------------------------------------------------- ’¥Þ’¥¯’¥í’Äê’µÁ ----------------------------------------------------------------------*/ #define FAIL (-1) #define PS_DEB 0xf8 #define MAX_QUEUE 1024 #define INT_SIZE 4 // Byte = sizeof(int) /*---------------------------------------------------------------------- ’¥Ñ’¥±’¥Ã’¥È’¥Õ’¥©’¡¼’¥Þ’¥Ã’¥È char short int int Mode + ID + Seq + Data_len + Padding + Data 0 1 3 7 11 12 ----------------------------------------------------------------------*/ #define LINDA_MODE_OFFSET 0 #define LINDA_ID_OFFSET 1 #define LINDA_SEQ_OFFSET 3 #define LINDA_DATA_LENGTH_OFFSET 7 #define LINDA_TID_OFFSET 11 #define LINDA_HEADER_SIZE 12 /*---------------------------------------------------------------------- ’¹½’¤’ÂÎ’Äê’µÁ ----------------------------------------------------------------------*/ typedef struct psx_reply{ unsigned char *answer; unsigned int seq; struct psx_reply *next; char mode; void(*callback)(char * tuple, void * obj); void * obj; } REPLY, *REPLY_PTR; typedef struct command_queue{ unsigned char *command; struct command_queue *next; unsigned int size; INDA_H COMMAND, *COMMAND_PTR; /*---------------------------------------------------------------------- ’ÀŒŪ’´Ø’¿ô’¥Æ’¥ó’¥×’¥ì’¡¼’¥È ----------------------------------------------------------------------*/ int start_linda(char *hostname); void unix_chkserv(); int psx_out(unsigned int id, unsigned char *data, unsigned int size); int psx_ld(unsigned int id, char mode, void(*callback)(char *,void *),void * obj); #define psx_in(id) psx_ld(id, 'i', NULL, NULL) #define psx_rd(id) psx_ld(id, 'r', NULL, NULL) #define psx_ck(id) psx_ld(id, 'c', NULL, NULL) #define psx_wait_rd(id) psx_ld(id, 'w', NULL, NULL) #define psx_callback_in(id,callback,obj) psx_ld(id, 'i', callback, obj) #define psx_callback_rd(id,callback,obj) psx_ld(id, 'r', callback, obj) #define psx_callback_ck(id,callback,obj) psx_ld(id, 'c', callback, obj) #define psx_callback_wait_rd(id,callback,obj) psx_ld(id, 'w', callback, obj) unsigned char *psx_reply(int seq); void psx_sync_n(); void psx_free(unsigned char *); int psx_queue(unsigned int id, unsigned int size, unsigned char *data, char mode, void(*callback)(char *,void *),void * obj); int psx_get_datalength(unsigned char *); unsigned char *psx_get_data(unsigned char *); int psx_get_seq(unsigned char *); short psx_get_id(unsigned char *); char psx_get_mode(unsigned char *); int unix_open(); /* UNIX ’ÄÌ’¿®’¤ò’³«’Àß’¤¹’¤ë */ int unix_read(int,char *,unsigned int); /* UNIX ’¤«’¤é’ÆÉ’¤ß’¹þ’¤à */ int unix_read_w(int,char *,int); /* UNIX ’¤«’¤é’ÆÉ’¤ß’¹þ’¤à(non wait) */ int unix_write(int,unsigned char *,unsigned int);/* UNIX ’¤Ø’½ñ’¤’¹þ’¤à */ int unix_write_w(int,unsigned char *,unsigned int);/* UNIX ’¤Ø’½ñ’¤’¹þ’¤à(non wait) */ int send_able(); /* ’ÆÉ’¤ß’½ñ’¤’¤Ç’¤’¤ë’¥Ñ’¥±’¥Ã’¥È’¿ô’¤ò’µá’¤á’¤ë */