![]() |
cacao
Release 0.1.03-dev
Compute And Control For Adaptive Optics
|
Command line interface. More...
#include <stdint.h>#include <stdio.h>#include <errno.h>#include <unistd.h>#include <stdlib.h>#include <sys/types.h>#include <semaphore.h>#include <fftw3.h>#include <gsl/gsl_rng.h>#include <signal.h>#include <string.h>#include "ImageStreamIO/ImageStreamIO.h"#include "ImageStreamIO/ImageStruct.h"#include "processtools.h"#include "streamCTRL.h"#include "function_parameters.h"
Go to the source code of this file.
Data Structures | |
| struct | CMD |
| struct | MODULE |
| struct | CMDARGTOKEN |
| struct | VARIABLE |
| struct | DATA |
Macros | |
| #define | _CLICORE_H |
| #define | _POSIX_C_SOURCE 200809L |
| #define | PI 3.14159265358979323846264338328 |
| #define | SZ_CLICOREVARRAY 1000 |
| Size of array CLICOREVARRAY. More... | |
| #define | STRINGMAXLEN_DEFAULT 1000 |
| #define | STRINGMAXLEN_ERRORMSG 1000 |
| #define | STRINGMAXLEN_CLICMD 1000 |
| #define | STRINGMAXLEN_COMMAND 1000 |
| #define | STRINGMAXLEN_STREAMNAME 100 |
| #define | STRINGMAXLEN_IMGNAME 100 |
| #define | STRINGMAXLEN_FILENAME 200 |
| #define | STRINGMAXLEN_FULLFILENAME 1000 |
| #define | STRINGMAXLEN_FUNCTIONNAME 200 |
| #define | STRINGMAXLEN_FUNCTIONARGS 1000 |
| #define | STRINGMAXLEN_SHMDIRNAME 200 |
| #define | CFITSEXIT printf("Program abnormally terminated, File \"%s\", line %d\n", __FILE__, __LINE__);exit(0) |
| #define | nmalloc(f, type, n) f = (type*) malloc(sizeof(type)*n);if(f==NULL){printf("ERROR: pointer \"" #f "\" allocation failed\n");exit(0);} |
| #define | nfree(f) free(f); |
| #define | TEST_ALLOC(f) if(f==NULL){printf("ERROR: pointer \"" #f "\" allocation failed\n");exit(0);} |
| #define | NB_ARG_MAX 20 |
| #define | INIT_MODULE_LIB(modname) |
| Initialize module. More... | |
| #define | PRINT_ERROR(...) |
| Print error (in red) and continue. More... | |
| #define | PRINT_WARNING(...) |
| Print warning and continue. More... | |
| #define | DEBUG_TRACEPOINT(...) |
| register trace point More... | |
| #define | DEBUG_TRACEPOINTLOG(...) |
| register and log trace point More... | |
| #define | EXECUTE_SYSTEM_COMMAND(...) |
| system call with error checking and handling More... | |
| #define | SNPRINTF_CHECK(string, maxlen, ...) |
| snprintf with error checking and handling More... | |
| #define | WRITE_IMAGENAME(imname, ...) |
| Write image name to string. More... | |
| #define | WRITE_FILENAME(fname, ...) |
| Write filename to string. More... | |
| #define | WRITE_FULLFILENAME(ffname, ...) |
| Write full path filename to string. More... | |
| #define | WRITE_STRING_TO_FILE(fname, ...) |
| Write a string to file. More... | |
| #define | RETURN_SUCCESS 0 |
| #define | RETURN_FAILURE 1 |
| #define | RETURN_MISSINGFILE 2 |
| #define | MAX_NB_FRAMENAME_CHAR 500 |
| #define | MAX_NB_EXCLUSIONS 40 |
| #define | CLIARG_FLOAT 1 |
| #define | CLIARG_LONG 2 |
| #define | CLIARG_STR_NOT_IMG 3 |
| #define | CLIARG_IMG 4 |
| #define | CLIARG_STR 5 |
| #define | CLICMD_SUCCESS 0 |
| #define | CLICMD_INVALID_ARG 1 |
| #define | CLICMD_ERROR 2 |
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | DATA_NB_MAX_COMMAND 1000 |
| #define | DATA_NB_MAX_MODULE 100 |
| #define | STATIC_NB_MAX_IMAGE 520 |
| #define | STATIC_NB_MAX_VARIABLE 5030 |
Typedefs | |
| typedef int | errno_t |
| typedef long | imageID |
| typedef long | variableID |
| typedef uint_fast8_t | BOOL |
Functions | |
| int | CLI_checkarg (int argnum, int argtype) |
| int | CLI_checkarg_noerrmsg (int argnum, int argtype) |
| errno_t | set_signal_catch () |
| signal catching More... | |
| void | sig_handler (int signo) |
| errno_t | RegisterModule (const char *restrict FileName, const char *restrict PackageName, const char *restrict InfoString) |
| uint_fast16_t | RegisterCLIcommand (const char *restrict CLIkey, const char *restrict CLImodulesrc, errno_t(*CLIfptr)(), const char *restrict CLIinfo, const char *restrict CLIsyntax, const char *restrict CLIexample, const char *restrict CLICcall) |
| errno_t | runCLItest (int argc, char *argv[], char *promptstring) |
| errno_t | runCLI (int argc, char *argv[], char *promptstring) |
| Command Line Interface (CLI) main . More... | |
| errno_t | write_process_log () |
| Write entry into debug log. More... | |
Variables | |
| pid_t | CLIPID |
| important directories and info More... | |
| char | DocDir [200] |
| char | SrcDir [200] |
| char | BuildFile [200] |
| char | BuildDate [200] |
| char | BuildTime [200] |
| int | C_ERRNO |
| uid_t | euid_real |
| uid_t | euid_called |
| uid_t | suid |
| uint8_t | TYPESIZE [32] |
| DATA | data |
Command line interface.
Command line interface (CLI) definitions and function prototypes
| #define _CLICORE_H |
| #define _POSIX_C_SOURCE 200809L |
| #define CFITSEXIT printf("Program abnormally terminated, File \"%s\", line %d\n", __FILE__, __LINE__);exit(0) |
| #define CLIARG_FLOAT 1 |
| #define CLIARG_IMG 4 |
| #define CLIARG_LONG 2 |
| #define CLIARG_STR 5 |
| #define CLIARG_STR_NOT_IMG 3 |
| #define CLICMD_ERROR 2 |
| #define CLICMD_INVALID_ARG 1 |
| #define CLICMD_SUCCESS 0 |
| #define DATA_NB_MAX_COMMAND 1000 |
| #define DATA_NB_MAX_MODULE 100 |
| #define FALSE 0 |
| #define INIT_MODULE_LIB | ( | modname | ) |
Initialize module.
| #define MAX_NB_EXCLUSIONS 40 |
| #define MAX_NB_FRAMENAME_CHAR 500 |
| #define NB_ARG_MAX 20 |
| #define nfree | ( | f | ) | free(f); |
| #define nmalloc | ( | f, | |
| type, | |||
| n | |||
| ) | f = (type*) malloc(sizeof(type)*n);if(f==NULL){printf("ERROR: pointer \"" #f "\" allocation failed\n");exit(0);} |
| #define PI 3.14159265358979323846264338328 |
| #define RETURN_FAILURE 1 |
| #define RETURN_MISSINGFILE 2 |
| #define RETURN_SUCCESS 0 |
| #define STATIC_NB_MAX_IMAGE 520 |
| #define STATIC_NB_MAX_VARIABLE 5030 |
| #define STRINGMAXLEN_CLICMD 1000 |
| #define STRINGMAXLEN_COMMAND 1000 |
| #define STRINGMAXLEN_DEFAULT 1000 |
| #define STRINGMAXLEN_ERRORMSG 1000 |
| #define STRINGMAXLEN_FILENAME 200 |
| #define STRINGMAXLEN_FULLFILENAME 1000 |
| #define STRINGMAXLEN_FUNCTIONARGS 1000 |
| #define STRINGMAXLEN_FUNCTIONNAME 200 |
| #define STRINGMAXLEN_IMGNAME 100 |
| #define STRINGMAXLEN_SHMDIRNAME 200 |
| #define STRINGMAXLEN_STREAMNAME 100 |
| #define SZ_CLICOREVARRAY 1000 |
Size of array CLICOREVARRAY.
| #define TEST_ALLOC | ( | f | ) | if(f==NULL){printf("ERROR: pointer \"" #f "\" allocation failed\n");exit(0);} |
| #define TRUE 1 |
| typedef uint_fast8_t BOOL |
| typedef int errno_t |
| typedef long imageID |
| typedef long variableID |
| int CLI_checkarg | ( | int | argnum, |
| int | argtype | ||
| ) |
| int CLI_checkarg_noerrmsg | ( | int | argnum, |
| int | argtype | ||
| ) |
| uint_fast16_t RegisterCLIcommand | ( | const char *restrict | CLIkey, |
| const char *restrict | CLImodulesrc, | ||
| errno_t(*)() | CLIfptr, | ||
| const char *restrict | CLIinfo, | ||
| const char *restrict | CLIsyntax, | ||
| const char *restrict | CLIexample, | ||
| const char *restrict | CLICcall | ||
| ) |
| errno_t RegisterModule | ( | const char *restrict | FileName, |
| const char *restrict | PackageName, | ||
| const char *restrict | InfoString | ||
| ) |
| errno_t runCLI | ( | int | argc, |
| char * | argv[], | ||
| char * | promptstring | ||
| ) |
Command Line Interface (CLI) main
.
uses readline to read user input
parsing done with bison and flex
becomes 1 after startup
| errno_t runCLItest | ( | int | argc, |
| char * | argv[], | ||
| char * | promptstring | ||
| ) |
| errno_t set_signal_catch | ( | ) |
signal catching
| void sig_handler | ( | int | signo | ) |
Signal handler
| errno_t write_process_log | ( | ) |
Write entry into debug log.
| char BuildDate[200] |
| char BuildFile[200] |
| char BuildTime[200] |
| int C_ERRNO |
| pid_t CLIPID |
important directories and info
| DATA data |
| char DocDir[200] |
| uid_t euid_called |
| uid_t euid_real |
| char SrcDir[200] |
| uid_t suid |
| uint8_t TYPESIZE[32] |