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