2 Philosophy

Contents of this section

The various commands in DRP communicate with each other through a mechanism which will be dependent on the underlying operating systems. The optimal choice (and this is the case for HP-UX) is through shared memory areas, but it can be done through disk files if shared memory is not available.

There are three areas (in memory or on disk) that will hold one scan (spectrum) each. In the following these will be refered to as CWORK, CHOLD and CTEMP.

CWORK

normally holds the scan on which the user wants to perform an action. As a rule, a command takes the scan from CWORK, modifies it and returns it to CWORK. If the user wants to act on the average area or the temporary area (see below) these have to be copied to CWORK first.

CHOLD

is used for averaging scans. Commands that act on CHOLD are e.g. zero , accum and average (see the command description part for details).

CTEMP

may hold a temporary scan, e.g. the results of a baseline or gaussian fit. There are commands to copy/subtract it to/from the work area.

2.1 Data storage

DRP stores individual scans as individual files. This has the advantage of being able to use shell commands to selectively access files (copying, renaming, deleting ...). The disadvantage is a loss in performance, if very large number of scans are to be processed. (It may be good idea to store scans in different subdirectories, corresponding to name and/or frequency.) On the other hand there is a varity of external formats which are known to DRP (see section import for details). By default, DRP uses a file naming convention according to the pattern:

 
source.nnnn
where source are the alphanumerical characters of the source name (i.e. blanks, punctuation etc. are not used) and nnnn will be the scan number (ranging from 0000 to 9999, bigger numbers will be taken modulo 10000).

If the user wishes he/she can always use whatever file name he/she wants, the price to be paid is a somewhat more complicated syntax to retrieve them later on (see command description for get and put ).

These files will consist of two binary records, the first one being a header of fixed length, and the second one the channel values as 32 bit floating point numbers, the number of which is recorded in the header. A C-callable library is available to read and write these scans (a FORTRAN version would be easy to produce on request).

A typical DRP command from the point of view of the C programmer therefore looks roughly like this: (the handling of runstring parameters and options is omitted here for brevity)


#include <stdio.h>
#include "drp.h"

SCAN myscan;

main()
{
   int i;

   GetScan(&myscan);    /* get scan from CWORK */
   /* perform some action on each channel */
   for (i=0; i<myscan.NChannel; i++) {
      .....
   }
   PutScan(&myscan);    /* put back to CWORK   */
   exit(0);  /* indicate success to shell      */
}

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter