stage4/generate_c/plc.h
author 'Laurent Bessard <laurent.bessard@lolitech.fr>'
Wed, 02 Sep 2009 14:05:27 +0200
changeset 205 96d8b6e006f0
parent 70 e1f0ebd2d9ec
permissions -rwxr-xr-x
Mario changes merged
70
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     1
/*
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     2
 * (c) 2000 Jiri Baum
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     3
 *          Mario de Sousa
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     4
 *
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     5
 * Offered to the public under the terms of the GNU General Public License
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     6
 * as published by the Free Software Foundation; either version 2 of the
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     7
 * License, or (at your option) any later version.
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     8
 *
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful, but
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    10
 * WITHOUT ANY WARRANTY; without even the implied warranty of
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    12
 * Public License for more details.
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    13
 *
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    14
 * This code is made available on the understanding that it will not be
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    15
 * used in safety-critical situations without a full and competent review.
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    16
 */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    17
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    18
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    19
#ifndef __PLC_H
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    20
#define __PLC_H
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    21
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    22
#include <stdio.h>  /* required for declaration of FILE */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    23
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    24
#ifdef __cplusplus
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    25
extern "C" {
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    26
#endif
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    27
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    28
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    29
#include "types.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    30
#include "log/log.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    31
#include "conffile/conffile.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    32
#include "cmm/cmm.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    33
#include "gmm/gmm.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    34
#include "synch/synch.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    35
#include "period/period.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    36
#include "state/state.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    37
#include "rt/rt.h"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    38
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    39
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    40
#define PLC_PT_NAME_MAX_LEN CMM_NAME_MAX_LEN
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    41
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    42
/*** GENERAL ***/
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    43
int plc_init(char const *module_name, int argc, char **argv);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    44
int plc_done(void);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    45
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    46
/*** SYNCHING ***/
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    47
int plc_scan_beg(void);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    48
int plc_scan_end(void);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    49
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    50
/* memory must be de-allocated with free() */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    51
const char *plc_module_name(void);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    52
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    53
/*
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    54
 * UTIL functions;
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    55
 */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    56
int plc_print_usage(FILE *output);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    57
/* prints the command line arguments the plc_init() function accepts */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    58
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    59
/* not to be used by general plc modules. This function is used by the
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    60
 * plc_shutdown() function.
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    61
 */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    62
int plc_init_try(char const *module_name, int argc, char **argv);
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    63
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    64
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    65
/* plc command line options leader */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    66
#define CLO_LEADER "--PLC"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    67
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    68
/* plc command line options */
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    69
#define CLO_plc_id             CLO_LEADER "plc_id="
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    70
#define CLO_loc_local          CLO_LEADER "local"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    71
#define CLO_loc_isolate        CLO_LEADER "isolate"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    72
#define CLO_loc_shared         CLO_LEADER "shared"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    73
#define CLO_privmap_key        CLO_LEADER "local_map_key="
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    74
#define CLO_log_level          CLO_LEADER "debug="
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    75
#define CLO_log_file           CLO_LEADER "logfile="
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    76
#define CLO_config_file        CLO_LEADER "conf="
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    77
#define CLO_module_name        CLO_LEADER "module="
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    78
#define CLO_force_init         CLO_LEADER "force-init"
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    79
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    80
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    81
#ifdef __cplusplus
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    82
}
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    83
#endif
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    84
e1f0ebd2d9ec Change generate_cc to generate_c
lbessard
parents:
diff changeset
    85
#endif /* __PLC_H */