mirror of
https://github.com/eddyem/BTA_lib.git
synced 2025-12-06 18:55:14 +03:00
test version
This commit is contained in:
parent
6b3ca8a34b
commit
dd6821cecb
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.hg*
|
||||||
|
*.tgz
|
||||||
|
*~
|
||||||
|
.dropbox.attr
|
||||||
@ -684,7 +684,7 @@ int main(int argc, char **argv){
|
|||||||
if(showinfo != NO_INFO) bta_print(showinfo, GP->infoargs);
|
if(showinfo != NO_INFO) bta_print(showinfo, GP->infoargs);
|
||||||
else if(GP->listinfo) bta_print(NO_INFO, NULL); // show arguments available
|
else if(GP->listinfo) bta_print(NO_INFO, NULL); // show arguments available
|
||||||
#define RUN(arg) do{if(!arg) retcode = 1;}while(0)
|
#define RUN(arg) do{if(!arg) retcode = 1;}while(0)
|
||||||
#define RUNBLK(arg) do{if(!arg) return 1;}while(0)
|
#define RUNBLK(arg) do{if(!arg){retcode = 1; goto restoring;}}while(0)
|
||||||
if(GP->telstop) RUN(stop_telescope());
|
if(GP->telstop) RUN(stop_telescope());
|
||||||
if(GP->eqcrds) RUNBLK(setCoords(GP->eqcrds, TRUE));
|
if(GP->eqcrds) RUNBLK(setCoords(GP->eqcrds, TRUE));
|
||||||
else if(GP->horcrds) RUNBLK(setCoords(GP->horcrds, FALSE));
|
else if(GP->horcrds) RUNBLK(setCoords(GP->horcrds, FALSE));
|
||||||
@ -700,6 +700,7 @@ int main(int argc, char **argv){
|
|||||||
else if(GP->corrRAD) RUN(run_correction(GP->corrRAD, FALSE));
|
else if(GP->corrRAD) RUN(run_correction(GP->corrRAD, FALSE));
|
||||||
#undef RUN
|
#undef RUN
|
||||||
#undef RUNBLK
|
#undef RUNBLK
|
||||||
|
restoring:
|
||||||
unlink(PIDFILE);
|
unlink(PIDFILE);
|
||||||
restore_console();
|
restore_console();
|
||||||
return retcode;
|
return retcode;
|
||||||
|
|||||||
12
bta_shdata.c
12
bta_shdata.c
@ -13,10 +13,10 @@ static char msg[80];
|
|||||||
#define PERR(...) do{sprintf(msg, __VA_ARGS__); perror(msg);} while(0)
|
#define PERR(...) do{sprintf(msg, __VA_ARGS__); perror(msg);} while(0)
|
||||||
|
|
||||||
#ifndef BTA_MODULE
|
#ifndef BTA_MODULE
|
||||||
struct BTA_Data *sdt;
|
volatile struct BTA_Data *sdt;
|
||||||
struct BTA_Local *sdtl;
|
volatile struct BTA_Local *sdtl;
|
||||||
|
|
||||||
struct SHM_Block sdat = {
|
volatile struct SHM_Block sdat = {
|
||||||
{"Sdat"},
|
{"Sdat"},
|
||||||
sizeof(struct BTA_Data),
|
sizeof(struct BTA_Data),
|
||||||
2048,0444,
|
2048,0444,
|
||||||
@ -97,7 +97,7 @@ void bta_data_close() {
|
|||||||
/**
|
/**
|
||||||
* Allocate shared memory segment
|
* Allocate shared memory segment
|
||||||
*/
|
*/
|
||||||
int get_shm_block( struct SHM_Block *sb, int server) {
|
int get_shm_block(volatile struct SHM_Block *sb, int server) {
|
||||||
int getsize = (server)? sb->maxsize : sb->size;
|
int getsize = (server)? sb->maxsize : sb->size;
|
||||||
// first try to find existing one
|
// first try to find existing one
|
||||||
sb->id = shmget(sb->key.code, getsize, sb->mode);
|
sb->id = shmget(sb->key.code, getsize, sb->mode);
|
||||||
@ -135,7 +135,7 @@ int get_shm_block( struct SHM_Block *sb, int server) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int close_shm_block(struct SHM_Block *sb){
|
int close_shm_block(volatile struct SHM_Block *sb){
|
||||||
int ret;
|
int ret;
|
||||||
if(sb->close != NULL)
|
if(sb->close != NULL)
|
||||||
sb->close();
|
sb->close();
|
||||||
@ -179,7 +179,7 @@ void get_cmd_queue(struct CMD_Queue *cq, int server){
|
|||||||
#endif // BTA_MODULE
|
#endif // BTA_MODULE
|
||||||
|
|
||||||
|
|
||||||
int check_shm_block( struct SHM_Block *sb) {
|
int check_shm_block(volatile struct SHM_Block *sb) {
|
||||||
if(sb->check)
|
if(sb->check)
|
||||||
return(sb->check());
|
return(sb->check());
|
||||||
else return(0);
|
else return(0);
|
||||||
|
|||||||
14
bta_shdata.h
14
bta_shdata.h
@ -33,7 +33,7 @@ struct SHM_Block {
|
|||||||
uint8_t *addr; // connection address
|
uint8_t *addr; // connection address
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct SHM_Block sdat;
|
extern volatile struct SHM_Block sdat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Command queue descriptor
|
* Command queue descriptor
|
||||||
@ -788,7 +788,7 @@ struct BTA_Data {
|
|||||||
uint32_t pep_code_di, pep_code_do; // dome PEP codes
|
uint32_t pep_code_di, pep_code_do; // dome PEP codes
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct BTA_Data *sdt;
|
extern volatile struct BTA_Data *sdt;
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Local data structure *
|
* Local data structure *
|
||||||
@ -819,7 +819,7 @@ struct my_msgbuf {
|
|||||||
char mtext[100]; // message itself
|
char mtext[100]; // message itself
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct BTA_Local *sdtl;
|
extern volatile struct BTA_Local *sdtl;
|
||||||
extern int snd_id;
|
extern int snd_id;
|
||||||
extern int cmd_src_pid;
|
extern int cmd_src_pid;
|
||||||
extern uint32_t cmd_src_ip;
|
extern uint32_t cmd_src_ip;
|
||||||
@ -831,12 +831,12 @@ extern uint32_t cmd_src_ip;
|
|||||||
void bta_data_init();
|
void bta_data_init();
|
||||||
int bta_data_check();
|
int bta_data_check();
|
||||||
void bta_data_close();
|
void bta_data_close();
|
||||||
int get_shm_block( struct SHM_Block *sb, int server);
|
int get_shm_block(volatile struct SHM_Block *sb, int server);
|
||||||
int close_shm_block(struct SHM_Block *sb);
|
int close_shm_block(volatile struct SHM_Block *sb);
|
||||||
void get_cmd_queue( struct CMD_Queue *cq, int server);
|
void get_cmd_queue(struct CMD_Queue *cq, int server);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int check_shm_block( struct SHM_Block *sb);
|
int check_shm_block(volatile struct SHM_Block *sb);
|
||||||
|
|
||||||
void encode_lev_passwd(char *passwd, int nlev, uint32_t *keylev, uint32_t *codlev);
|
void encode_lev_passwd(char *passwd, int nlev, uint32_t *keylev, uint32_t *codlev);
|
||||||
int find_lev_passwd(char *passwd, uint32_t *keylev, uint32_t *codlev);
|
int find_lev_passwd(char *passwd, uint32_t *keylev, uint32_t *codlev);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user