NEW

P&K TAL2K

Multi-Core

Berechnung wird mit fast 2-facher (Dual Core) oder 4-facher (Quad-Core) Geschwindigkeit ausgeführt.

Cluster

Berechnung wird mit bis zu 16-facher Geschwindigkeit ausgeführt. (Bedarf mehrere speziell vernetzte ausreichende PCs; Spezielles Installationswissen ist notwendig)

Petersen & Kade


AUSTAL2000 (modifiziert)

TalTmn.c

//==================================================================== TalTmn.c
//
// Table Manager, uses array's from the gen-lib.
// =============================================
//
// Copyright (C) Umweltbundesamt, 14191 Berlin, Germany, 2002-2005
// Copyright (C) Janicke Consulting, 26427 Dunum, Germany, 2002-2005
// email: info@austal2000.de
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// last change: 2006-10-26 lj
//
//==========================================================================
// A table is an array with a header string, valid for a specified time
// interval. The data are stored in memory or on disk or both. They can
// be created by the user, read from disk or created automatically, if
// a creator is specified by the user. Attributes are:
// TMN_UNIQUE: The data exist only once, either on disk or in memory.
// TMN_FIXED: The data are not moved within in the memory, therefore
// the addresses of the elements will not change during execution
// of the program.
// TMN_WAIT: If the data are not available on disk, wait and try it again.
// TMN_LOCKED: The data may not be removed from the work space (memory).
// TMN_MODIFY: The data will be modified and hence only one routine can
// get access at one time.
//============================================================================

#include
#include
#include
#include
#include
#include "limits.h"

#include "IBJmsg.h"
#include "IBJary.h"
static char *eMODn = "TalTmn";

#include "genio.h"
#include "genutl.h"
#include "gencnv.h"

#include "IBJstamp.h"
#include "TalNms.h"
#include "TalTmn.h"
#include "TalTmn.nls"

#define TMN_VERSION 2
#define TMN_SUBVERSION 3
#define TMN_PATCH "0"
#define TMN_STDXTN ".arr"

#define DISPLAY (TmnFlags & TMN_DISPLAY)

typedef struct tmnrec *TMNRECPTR;
typedef struct tmnrec {
TMNRECPTR next, last;
long id, mask, usage, storage, count;
long t1, t2;
long *depends;
TMNDATSRV datserver;
TMNHDRSRV hdrserver;
char servname[TMN_SNMLEN];
char *header;
char *tag;
long lpos1, lpos2, lt1, lt2;
ARYDSC dsc;
} TMNREC;

static const long TMN_DISK = 0x0001;
static const long TMN_MYWRKSPC = 0x0002;

static TMNRECPTR TmnHead, TmnTail;
static TMNNAMSRV NameServer;
static TMNHDRSRV HeaderServer;
static char TmnHeader[GENHDRLEN];
static char TmnWorkDir[256];
static long TmnFlags, TmnLogAction;
static FILE *TmnLog;
static long IdCounter = 0x80000000;

/*================ Prototypes of static functions ========================*/

/*=================================================================== AddRec
Add a record with id and return a pointer to the record. If a record
with this id already exist, NULL is returned.
*/
static TMNRECPTR AddRec( /* pointer to new record */
long id ) /* id of the table */
;
/*=================================================================== AddXtn
*/
static void AddXtn( /* add standard extension to file name */
char *fname )
;
/*=================================================================== DelRec
Delete a record of the table chain and the data of the table.
*/
static TMNRECPTR DelRec( /* pointer to the next record */
TMNRECPTR pthis ) /* pointer to the record to be deleted */
;
/*================================================================== FindRec
Find the record where the table id is defined.
*/
static TMNRECPTR FindRec( /* pointer to the record or NULL */
long id ) /* table id */
;
/*============================================================ FindDatServer
Find the record where a server for the masked id is defined.
*/
static TMNRECPTR FindDatServer( /* pointer to the record or NULL */
long id ) /* table id */
;
/*============================================================ FindHdrServer
Find the record where a server for the masked id is defined.
*/
static TMNRECPTR FindHdrServer( /* pointer to the record or NULL */
long id ) /* table id */
;
/*================================================================== PrnRec
Print the most important data of a record in the form:
: u: c: s: [-]
*/
static int PrnRec( /* return -1, if not initialized */
FILE *prn, /* print file */
int n, /* line number */
TMNRECPTR prec ) /* pointer to the record */
;
/*=================================================================== TmnGet
Try to read a table from disk. Time series of arrays are scanned. If
the wait flag is set for the table, the routine tries infinitely
every 2 seconds to read the table.
*/
static TMNRECPTR TmnGet( /* pointer to the table record */
long id, /* identification */
long *pt1, /* start of the requested time */
long *pt2 ) /* not used */
;
/*========================================================== TmnHeaderServer
Creates a header for storage on disk, if the user did not
supply a header server.
*/
static char *TmnHeaderServer( /* the header (global storage) */
long id, /* identification */
long *pt1, /* start of the validity time */
long *pt2 ) /* end of validity time */
;
/*================================================================== TmnMake
Make an array by calling the user supplied creator or by a call
to system() with the user supplied text. In addition the name of
the working directory and the options -n and -t

Google
  Web www.Petersen-Kade.com