#! /bin/sh
-# From configure.ac Revision: 1.1.1.1 .
+# From configure.ac Revision: 1.2 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for GRAS 0.0.040129.
#
<SECTION>
<FILE>core_dico</FILE>
+gras_dict_new
gras_dict_free
gras_dict_insert
gras_dict_retrieve
</para>
+<!-- ##### FUNCTION gras_dict_new ##### -->
+<para>
+
+</para>
+
+@dict:
+@Returns:
+
+
<!-- ##### FUNCTION gras_dict_free ##### -->
<para>
dict.h \
config.h \
\
- datadesc.h \
+ datadesc_simple.h \
data_description.h dd_type_bag.h \
\
socket.h messages.h \
sizeof(structType) - offsetof(structType, lastMember) - \
sizeof(memberType) * repetitions
+
+gras_error_t gras_datadesc_parse(const char *def,
+ gras_datadesc_t **dst);
+gras_error_t gras_datadesc_from_nws(const DataDescriptor *desc,
+ size_t howmany,
+ gras_datadesc_t **dst);
+gras_error_t gras_datadesc_eq(const gras_datadesc_t *d1,
+ const gras_datadesc_t *d2);
+gras_error_t gras_datadesc_cpy(gras_datadesc_t *src,
+ gras_datadesc_t **dst);
+gras_error_t gras_datadesc_sizeof_host(gras_datadesc_t *desc,
+ size_t *dst);
+gras_error_t gras_datadesc_sizeof_network(gras_datadesc_t *desc,
+ size_t *dst);
+
+
+
END_DECL
#endif /* GRAS_DATADESC_H */
--- /dev/null
+/* $Id$ */
+
+/* gras/datadesc.h - Describing the data you want to exchange */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2003 the OURAGAN project. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef GRAS_DATADESC_SIMPLE_H
+#define GRAS_DATADESC_SIMPLE_H
+
+#include <stddef.h> /* offsetof() */
+#include <sys/types.h> /* size_t */
+#include <stdarg.h>
+
+
+/*! C++ users need love */
+#ifndef BEGIN_DECL
+# ifdef __cplusplus
+# define BEGIN_DECL extern "C" {
+# else
+# define BEGIN_DECL
+# endif
+#endif
+
+/*! C++ users need love */
+#ifndef END_DECL
+# ifdef __cplusplus
+# define END_DECL }
+# else
+# define END_DECL
+# endif
+#endif
+/* End of cruft for C++ */
+
+BEGIN_DECL
+
+/****
+ **** The NWS type and constructors
+ ****/
+
+typedef enum
+ {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
+ UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE}
+ DataTypes;
+#define SIMPLE_TYPE_COUNT 9
+
+typedef struct DataDescriptorStruct {
+ DataTypes type;
+ size_t repetitions;
+ size_t offset;
+ struct DataDescriptorStruct *members;
+ size_t length;
+ size_t tailPadding;
+} DataDescriptor;
+#ifndef NULL
+#define NULL 0
+#endif
+#define SIMPLE_DATA(type,repetitions) {type, repetitions, 0, NULL, 0, 0}
+#define SIMPLE_MEMBER(type,repetitions,offset) \
+ {type, repetitions, offset, NULL, 0, 0}
+#define PAD_BYTES(structType,lastMember,memberType,repetitions) \
+ sizeof(structType) - offsetof(structType, lastMember) - \
+ sizeof(memberType) * repetitions
+
+/****
+ **** Gras (opaque) type, constructors and functions
+ ****/
+
+typedef struct gras_datadesc_ gras_datadesc_t;
+
+/* constructors, memory management */
+gras_error_t gras_datadesc_parse(const char *def,
+ gras_datadesc_t **dst);
+gras_error_t gras_datadesc_from_nws(const DataDescriptor *desc,
+ size_t howmany,
+ gras_datadesc_t **dst);
+
+gras_error_t gras_datadesc_cpy(gras_datadesc_t *src,
+ gras_datadesc_t **dst);
+void gras_datadesc_free(gras_datadesc_t **dd);
+
+/* basic functionnalities */
+int gras_datadesc_cmp(const gras_datadesc_t *d1,
+ const gras_datadesc_t *d2);
+
+gras_error_t gras_datadesc_sizeof_host(gras_datadesc_t *desc,
+ size_t *dst);
+gras_error_t gras_datadesc_sizeof_network(gras_datadesc_t *desc,
+ size_t *dst);
+
+/* high level function needed in SG */
+gras_error_t gras_datadesc_data_cpy(const gras_datadesc_t *dd,
+ const void *src,
+ void **dst);
+
+/* high level functions needed in RL */
+gras_error_t gras_datadesc_convert_recv(const gras_datadesc_t *dd,
+ gras_trp_plugin_t *trp,
+ void **dst);
+gras_error_t gras_datadesc_convert_send(const gras_datadesc_t *dd,
+ gras_trp_plugin_t *trp,
+ void *src);
+
+END_DECL
+
+#endif /* GRAS_DATADESC_SIMPLE_H */
+
#define RAISE_MALLOC RAISE0(malloc_error,"Malloc error")
#define RAISE_IMPOSSIBLE RAISE0(unknown_error,"The Impossible did happen")
+#define RAISE_UNIMPLEMENTED RAISE1(unknown_error,"Function %s unimplemented",__FUNCTION__)
#define gras_abort abort
#include <gras/config.h>
#include <gras/core.h>
-#include <gras/datadesc.h>
+
+#include <gras/transport.h>
+#include <gras/datadesc_simple.h>
#include <gras/socket.h>
#include <gras/messages.h>
/* gras/messages.h - Public interface to GRAS messages */
/* Authors: Martin Quinson */
-/* Copyright (C) 2003 the OURAGAN project. */
+/* Copyright (C) 2003,2004 Martin Quinson. */
/* This program is free software; you can redistribute it and/or modify it
under the terms of the license (GNU LGPL) which comes with this package. */
--- /dev/null
+/* $Id$ */
+
+/* trp (transport) - send/receive a bunch of bytes */
+
+/* This file implements the public interface of this module, exported to the*/
+/* other modules of GRAS, but not to the end user. */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2004 Martin Quinson. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef GRAS_TRANSPORT_H
+#define GRAS_TRANSPORT_H
+
+/* each plugin implements the socket the way it wants */
+typedef void gras_trp_sock_t;
+
+/* A plugin type */
+typedef struct gras_trp_plugin_ gras_trp_plugin_t;
+
+/* Module, and get plugin by name */
+gras_error_t gras_trp_init(void);
+
+void gras_trp_exit(void);
+
+gras_error_t gras_trp_plugin_get_by_name(const char *name,
+ gras_trp_plugin_t **dst);
+
+
+
+#endif /* GRAS_TRANSPORT_H */
# Core/dict_multi.c
# Common/gras.c Common/gras_datadesc.c Common/gras_msg.c
+# Messaging/messaging.c
COMMON_S=\
\
\
Core/config.c \
\
+ Messaging/transport.c Messaging/transport.h \
+ Messaging/transport_sg.c Messaging/transport_tcp.c \
+ \
+ Messaging/datadesc_simple.c \
+ \
gs/datadesc.c \
gs/tools.c \
gs/categories.h \
libgrasutils_a_LIBADD = $(COMMON_L)
-libgrasrl_a_SOURCES= $(COMMON_S) RL/gras_rl.c RL/gras_rl.h
+
+# RL/gras_rl.c RL/gras_rl.h FIXME
+libgrasrl_a_SOURCES= $(COMMON_S) Messaging/messaging_rl.c
libgrasrl_a_LIBADD= \
$(foreach file,\
exp_smooth forc median mse_forc protocol \
$(COMMON_L)
-libgrassg_a_SOURCES= $(COMMON_S) SG/gras_sg.c SG/gras_sg.h
+# SG/gras_sg.c SG/gras_sg.h FIXME
+libgrassg_a_SOURCES= $(COMMON_S) Messaging/messaging_sg.c
libgrassg_a_LIBADD= \
$(COMMON_L)
GRAS_LOG_DEFAULT_CATEGORY(GRAS);
-gras_error_t
-gras_process_init() {
- gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
- grasProcessData_t *pd;
- int i;
-
- if (!(pd=(grasProcessData_t *)malloc(sizeof(grasProcessData_t)))) {
- fprintf(stderr,"grasInit: out of memory\n");
- return malloc_error;
- }
- pd->grasMsgQueueLen=0;
- pd->grasMsgQueue = NULL;
-
- pd->grasCblListLen = 0;
- pd->grasCblList = NULL;
-
- if (MSG_process_set_data(MSG_process_self(),(void*)pd) != MSG_OK) {
- return unknown_error;
- }
-
- if (!hd) {
- if (!(hd=(gras_hostdata_t *)malloc(sizeof(gras_hostdata_t)))) {
- fprintf(stderr,"grasInit: out of memory\n");
- return malloc_error;
- }
- hd->portLen = 0;
- hd->port=NULL;
- hd->port2chan=NULL;
- for (i=0; i<MAX_CHANNEL; i++) {
- hd->proc[i]=0;
- }
-
- if (MSG_host_set_data(MSG_host_self(),(void*)hd) != MSG_OK) {
- return unknown_error;
- }
- }
-
- /* take a free channel for this process */
- for (i=0; i<MAX_CHANNEL && hd->proc[i]; i++);
- if (i == MAX_CHANNEL) {
- fprintf(stderr,
- "GRAS: Can't add a new process on %s, because all channel are already in use. Please increase MAX CHANNEL (which is %d for now) and recompile GRAS\n.",
- MSG_host_get_name(MSG_host_self()),MAX_CHANNEL);
- return system_error;
- }
- pd->chan = i;
- hd->proc[ i ] = MSG_process_self_PID();
-
- /* take a free channel for this process */
- for (i=0; i<MAX_CHANNEL && hd->proc[i]; i++);
- if (i == MAX_CHANNEL) {
- fprintf(stderr,
- "GRAS: Can't add a new process on %s, because all channel are already in use. Please increase MAX CHANNEL (which is %d for now) and recompile GRAS\n.",
- MSG_host_get_name(MSG_host_self()),MAX_CHANNEL);
- return system_error;
- }
- pd->rawChan = i;
- hd->proc[ i ] = MSG_process_self_PID();
-
- /*
- fprintf(stderr,"GRAS: Creating process '%s' (%d)\n",
- MSG_process_get_name(MSG_process_self()),MSG_process_self_PID());
- */
- return no_error;
-}
-
-gras_error_t
-gras_process_finalize() {
- gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
- grasProcessData_t *pd=(grasProcessData_t *)MSG_process_get_data(MSG_process_self());
- int myPID=MSG_process_self_PID();
- int i;
-
- gras_assert0(hd && pd,"Run gras_process_init!!\n");
-
-
- fprintf(stderr,"GRAS: Finalizing process '%s' (%d)\n",
- MSG_process_get_name(MSG_process_self()),MSG_process_self_PID());
- if (pd->grasMsgQueueLen) {
- fprintf(stderr,"GRAS: Warning: process %d terminated, but some queued messages where not handled\n",MSG_process_self_PID());
- }
-
- for (i=0; i< MAX_CHANNEL; i++)
- if (myPID == hd->proc[i])
- hd->proc[i] = 0;
-
- for (i=0; i<hd->portLen; i++) {
- if (hd->port2chan[ i ] == pd->chan) {
- memmove(&(hd->port[i]), &(hd->port[i+1]), (hd->portLen -i -1) * sizeof(int));
- memmove(&(hd->port2chan[i]), &(hd->port2chan[i+1]), (hd->portLen -i -1) * sizeof(int));
- hd->portLen--;
- i--; /* counter the effect of the i++ at the end of the iteration */
- }
- }
-
- return no_error;
-}
/* **************************************************************************
* Openning/Maintaining/Closing connexions (private functions for both raw
* and regular sockets)
#include "gras/dd_type_bag.h"
#include "gras/core.h"
-#include "gras/datadesc.h"
+#include "gras/transport.h"
+#include "gras/datadesc_simple.h"
#include "gras/socket.h"
#include "gras/messages.h"
/* **************************************************************************
* Handling DataDescriptors
* **************************************************************************/
+#if 0
+FIXME: Kill it
typedef enum {HOST_FORMAT, NETWORK_FORMAT} FormatTypes;
size_t DataSize(const DataDescriptor *description,
size_t length,
int gras_datadesc_cmp(/*@null@*/const DataDescriptor *dd1, unsigned int c1,
/*@null@*/const DataDescriptor *dd2, unsigned int c2);
void gras_datadesc_dump(/*@null@*/const DataDescriptor *dd, unsigned int c);
-
+#endif
#endif /* GRAS_PRIVATE_H */
parse_log_opt(argc,argv,"dynar.thresh=debug");
fprintf(stderr,"==== Traverse the empty dynar\n");
- TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
+ TRYFAIL(gras_dynar_new(&d,sizeof(char *),&free_string));
gras_dynar_foreach(d,cpt,i){
fprintf(stderr,
"Damnit, there is something in the empty dynar\n");