source: git/MP/MP/h/MP_Env.h @ 554c78c

spielwiese
Last change on this file since 554c78c was 554c78c, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes/krueger: syntax, format git-svn-id: file:///usr/local/Singular/svn/trunk@9424 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.0 KB
Line 
1/***************************************************************************
2 *
3 *   HEADER FILE:  MP_Env.h
4 *
5 *        Declarations to maintain the MP environment.  The environment
6 *        includes the name of the host machine, the log file name and
7 *      file descriptor and the buffer pool containing all the buffers
8 *      to be shared among the links.  The initialization should be
9 *      done once before any MP-related activities occur.
10 *
11 *  Change Log:
12 *       September 10, 1995  SG - Updated implementation.  Much cleaning
13 *                                to make it presentable.
14 *       November 25, 1995   SG - Added field in env struct to support
15 *                                negotiation of endian order.
16 *       April 32, 1996      SG - Added support to handle different
17 *                                Big Integer packages.  See note in
18 *                                MP_SacBigInt.c for some details.
19 ***************************************************************************/
20#ifndef _MP_Env_h
21#define _MP_Env_h
22
23
24
25#include "MP.h"
26
27#define MP_HOST_NAME_LEN    64
28#define MP_INIT_LOGFILE_EXT 100
29
30/* These are the transport types currently supported   */
31/* These are the values stored in transp_dev.         */
32/* If you add to this list, you must also add a string */
33/* equivalent to transp_dev2string[] in MP_Link.c.    */
34
35#define MP_TcpTransportDev   0
36#define MP_FileTransportDev  1
37#define MP_PvmTransportDev   2
38#define MP_TbTransportDev    3
39
40
41/*
42 * Options that can be set for an environment
43 */
44#define MP_BUFFER_SIZE_OPT       1
45#define MP_MAX_FREE_BUFFERS_OPT  2
46#define MP_INIT_FREE_BUFFERS_OPT 3
47
48typedef struct  {
49    long         (*write_buf)VARARGS;       /* write buffer to transport   */
50    long         (*read_buf)VARARGS;        /* read transport to buffer    */
51    MP_Status_t  (*flush_buf)VARARGS;       /* flush buffer to transport   */
52    MP_Boolean_t (*get_status)VARARGS;      /* check status of the link    */
53    MP_Status_t  (*open_transp)VARARGS;     /* open the transport device   */
54    MP_Status_t  (*close_transp)VARARGS;    /* close the transport device  */
55    MP_Status_t  (*kill_transp)VARARGS;    /* kill the transport device  */
56} MP_TranspOps_t;
57
58
59typedef struct {
60    int            transp_dev;
61    MP_TranspOps_t *transp_ops;
62    char           *private1;    /* for opaque transport-specific structure */
63} MP_Transport_t;
64
65typedef struct transp_list_elem *MP_TranspList_pt;
66
67struct transp_list_elem {
68    int               transp_dev;
69    MP_TranspOps_t    transp_ops;
70    MP_TranspList_pt *next;
71};
72
73
74typedef struct mp_environment {
75    MP_TranspList_pt transp_dev_list; /* list of supported transport devices */
76    buffer_pool_pt   buff_pool;       /* buffer pool shared by  links in this
77                                       *  env
78                                       */
79    int   num_o_buff;
80    int   buffer_size;                /* size of each buffer in the pool     */
81    int   max_free_buffers;           /* max number of free buffers in the
82                                       * pool
83                                       */
84
85    int   init_free_buffers;          /* initial number of free buffers in the
86                                       * pool
87                                       */
88
89    int   num_links;                  /* to handout unique link ids for this
90                                       * env
91                                       */
92
93    FILE  *logfd;                     /* log file for all logging events     */
94    char  *logfilename;
95    char  thishost[MP_HOST_NAME_LEN];
96    MP_Boolean_t initialized;         /* can't set options after env has been
97                                       * init
98                                       */
99
100    MP_WordOrder_t native_word_order; /* what this machine uses internally   */
101    MP_FpFormat_t  native_fp_format;  /* floating pnt format used internally */
102    MP_BigNum_t    bignum;            /* info on bignum package to be used   */
103} MP_Env_t;
104
105typedef MP_Env_t *MP_Env_pt;
106typedef MP_Env_pt MP_ENV;
107
108EXTERN MP_ENV MP_AllocateEnv _ANSI_ARGS_((void));
109EXTERN MP_ENV MP_InitializeEnv _ANSI_ARGS_((MP_Env_pt env));
110EXTERN void MP_ReleaseEnv _ANSI_ARGS_((MP_Env_pt env));
111EXTERN int MP_SetEnvOption _ANSI_ARGS_((MP_Env_pt env, int option, int value));
112EXTERN int    MP_GetEnvOption _ANSI_ARGS_((MP_Env_pt env, int option));
113EXTERN MP_TranspList_pt IMP_GetTranspByName _ANSI_ARGS_((MP_Env_pt env,
114                                                         int transp_dev));
115EXTERN MP_Status_t MP_AddEnvTranspDevice _ANSI_ARGS_((MP_Env_pt env,
116                                        int transp_dev, MP_TranspOps_t *ops));
117EXTERN MP_Status_t MP_SetEnvBigIntFormat _ANSI_ARGS_((MP_Env_t *env,
118                             MP_BigIntOps_t *ops, MP_BigNumFormat_t format));
119EXTERN MP_Status_t MP_SetEnvBigRealFormat _ANSI_ARGS_((MP_Env_t *env,
120                             MP_BigRealOps_t *ops, MP_BigNumFormat_t format));
121EXTERN MP_Status_t open_logfile _ANSI_ARGS_((MP_ENV env));
122#endif /* _MP_Env_h */
Note: See TracBrowser for help on using the repository browser.