Changes between Version 4 and Version 5 of Libsrc_functions


Ignore:
Timestamp:
01/20/12 09:12:16 (10 years ago)
Author:
branden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Libsrc_functions

    v4 v5  
    269269{{{ 
    270270#include <fft99.h> 
    271 getutil.c 
     271}}} 
     272 
     273=== getutil.c === 
    272274 
    273275Functions in this file map various Earthworm abstractions from character strings to integers. They use information from the include file vx.x/include/earthworm.h (hard-coded into each module) and from ${EW_PARAMS}/earthworm.d (configured at run-time) as well as from certain environment variables. 
     276{{{ 
    274277#include <earthworm.h> 
    275278 
     
    315318Calculations are based upon the reference spheroid of 1968 and 
    316319are defined by the major radius (RAD) and the flattening (FL). 
     320 
    317321=== kom.c === 
    318322 
     
    405409 
    406410parseSnippet() parses a trigger message. Inspired by, and uses, strtok. Therefore, IT IS NOT MULTI-THREAD SAFE. It must be mutex protected against concurrent calls to strtok. 
     411{{{ 
    407412#include <parse_trig.h> 
    408413 
     
    417422        will result in the next line of the message being parsed.  
    418423        When the last line has been parsed, a EW_FAILURE will be returned.   
    419  
    420 putaway.c 
     424}}} 
     425 
     426=== putaway.c === 
    421427 
    422428These routines provide the ability to create seismic datafiles in several different formats from the TRACEBUF messages obtained from wave_serverV. Current formats are AH, SAC, SUDS and earthworm tankplayer files. Other formats can be added as needed. 
     429{{{ 
    423430int PA_init (char *DataFormat, long TraceBufferLen, long *OutBufferLen,  
    424431            int *FormatInd, char *OutDir, int debug); 
     
    490497        debug: =1 for debugging printout; =0 for silence. 
    491498        Returns: EW_SUCCESS or EW_FAILURE. 
    492  
    493 queue_max_size.c 
     499}}} 
     500 
     501=== queue_max_size.c === 
    494502 
    495503Functions in queue_max_size.c implement a first-in/first-out message buffer. Note that these routines allocate memory whenever a new element is added to the queue. Since this may occur during a large event, when the machine is busiest, it is better to use the mem_circ_queue routines which allocate all their memory when the module starts up. 
     504{{{ 
    496505#include <queue_max_size.h> 
    497506 
     
    527536        Returns pointer to the data at the front (oldest) element of 
    528537        the queue. 
    529 read_arc.c 
     538}}} 
     539 
     540=== read_arc.c === 
    530541 
    531542Routines for reading HYP2000ARC summary lines and phase lines. These routines are provided for the use of arc2trig and two UW-spcific modules, uw_report and eqtee. They only read the fields that are required by these modules. If you need to read more info from the HYP2000ARC message, feel free to make additions here. You probably will need to add to the structures in read_arc.h as well. 
     543{{{ 
    532544#include <read_arc.h> 
    533545int read_hyp( char *sumLine, char *shdw, struct Hsum *sumP ); 
     
    548560              pckP - pointer to Hpck structure provided by the caller 
    549561        Returns 0 on success, -1 on parsing errors. 
    550  
    551 site.c 
     562}}} 
     563 
     564=== site.c === 
    552565 
    553566Functions in site.c maintain and access a table of station names and coordinates. See the modules binder and eqproc for examples. 
     567{{{ 
    554568#include <site.h> 
    555569 
     
    579593void site_init(); 
    580594        Allocate the site table. Only called by site_com(); 
    581 socket_ew_common.c 
     595}}} 
     596 
     597=== socket_ew_common.c === 
    582598 
    583599Contains routines for using sockets with timeouts. The timeout argument is in milliseconds. A timeout of -1 is used to turn off timing, while a time of 0 means "give it a try an honest try but return if there are delays". If you want the timing features of these routines, then you must create the socket with socket_ew() (and not socket(2)) which puts the socket in non-blocking mode. When the -1 timeout is used, the socket is set to blocking mode for the duration of the socket_ew_common call. To get details of any failures, use socketGetError_ew() in socket_ew.c. The "flags" argument is the same as for the corresponding system socket call. 
    584600cc [ flag ... ] file ... -lsocket -lnsl [ library ... ]  (Solaris version) 
    585601 
     602{{{ 
    586603#include <socket_ew.h> 
    587604 
     
    699716        resources.  It first calls socket(), and then sets the socket 
    700717        descriptor to non-blocking mode. No network I/O occurs. 
    701 swap.c 
     718}}} 
     719 
     720=== swap.c === 
    702721 
    703722This file contains some simple byte-swapping routines. 
     723{{{ 
    704724#include <earthworm.h> 
    705725 
     
    718738        'datatype' field in the message header. 
    719739        Returns -1 if unknown data type, 0 elsewise. 
    720 tlay.c 
     740}}} 
     741 
     742=== tlay.c === 
    721743 
    722744This file contains routines to calculate travel-times in a layered half space of various phases (written by Carl Johnson). Regional travel time phases are denoted by the following indices: 0 = P, 1 = S, 2 = Pn, 3 = Sn, 4 = Pg, 5 = Sg 
     745{{{ 
    723746#include <tlay.h> 
    724747 
     
    738761        Calculate the minimum travel time given epicentral distance  
    739762        and hypocentral depth. 
    740 transfer.c 
     763}}} 
     764 
     765=== transfer.c === 
    741766 
    742767Routines for dealing with instrument transfer functions using pseudospectral methods and the Temperton FFT package, fft99.c. The instrument response functions used here are the poles and zeros of the Laplace transform of analog devices. 
     768{{{ 
    743769#include <fft_prep.h> 
    744770#include <fft99.h> 
     
    908934 *              every two datapoints input to convertWave. 
    909935 */ 
    910 wave_client.c 
     936}}} 
     937 
     938=== wave_client.c === 
    911939 
    912940Functions for connecting to the original wave_server's socket, making a request for a time-chunk of waveforms, and writing the requested data to a disk file. 
     941{{{ 
    913942#include "wave_client.h" 
    914943 
     
    935964        Initializes or resets the global variables ServerIPAdr & ServerPort  
    936965        used by wave_client routines to connect to a wave_server. 
    937  
    938 ws_clientII.c 
     966}}} 
     967 
     968=== ws_clientII.c === 
    939969 
    940970Version II of WaveServerV client utility routines. This file contains various routines useful for communicating with WaveServerV, and beyond. These routines are built on top of the socket_ew_common routines; thus the timeout value is given in milliseconds. The intended method of using these routines is to call wsAppendMenu() to open connections to one or more servers and learn what the servers have to offer, make the desired trace requests with wsGetTraceAscii() or wsGetTraceBin(), and then close the connections with wsKillMenu(). Except in the case of certain errors, these routines leave the socket connections open until wsKillMenu() (or wsDetachServer()) are called. Error conditions are reported via the return codes from these functions, defined in ws_clientII.h. Logging may be turned on by a call to setWsClient_ewDebug(), but normally is turned off. 
     
    943973For an example of the use of these routines, see SnippetMaker() [snippet.c] in earth2uw. 
    944974 
     975{{{ 
    945976#include <ws_clientII.h> 
    946977 
     
    10781109        Turns debugging on (debug > 0) or off (debug = 0; default) for 
    10791110        the ws_clientII routines. Returns zero. 
    1080 copyfile.c 
     1111}}} 
     1112 
     1113=== copyfile.c === 
    10811114 
    10821115This file contains a system-specific routine that transfers a file to a remote machine. Under OS/2, the file is transfered via ftp functions; under Solaris and WindowsNT, it is transfered with rcp. 
     1116{{{ 
    10831117#include <earthworm.h> 
    10841118 
     
    10941128                 2 if error waiting for the child process to complete 
    10951129                 3 if the child process ended abnormally 
    1096 dirops_ew.c 
     1130}}} 
     1131 
     1132=== dirops_ew.c === 
    10971133 
    10981134This file contains system-specific functions for performing directory operations. 
     1135{{{ 
    10991136#include <earthworm.h> 
    11001137 
     
    11101147        Returns: 0 on success 
    11111148                -1 on failure 
    1112 errexit.c 
     1149}}} 
     1150 
     1151=== errexit.c === 
    11131152 
    11141153This file exists only for Solaris to provide a function that exists in WindowsNT. 
     1154{{{ 
    11151155void ErrExit( int returnCode ); 
    11161156        Causes the program to exit with status returnCode. 
    1117 getavail.c 
     1157}}} 
     1158 
     1159=== getavail.c === 
    11181160 
    11191161This file contains system-specific function to find the available disk space. 
     1162{{{ 
    11201163#include <earthworm.h> 
    11211164 
     
    11241167        Returns: 0 on success 
    11251168                -1 on error. 
    1126 getsysname_ew.c 
     1169}}} 
     1170 
     1171=== getsysname_ew.c === 
    11271172 
    11281173Contains system-specific function to get the system name from the system. 
     1174 
     1175{{{ 
    11291176#include <earthworm.h> 
    11301177 
     
    11361183                -1 on error finding name 
    11371184                -2 name is longer than maxlen bytes. 
    1138 pipe.c 
     1185}}} 
     1186 
     1187=== pipe.c === 
    11391188 
    11401189This file contains system-specific routines to start a new process (as part of a mega-module) and to pass messages downstream by use of a pipe. 
     1190{{{ 
    11411191#include <earthworm.h> 
    11421192 
     
    11611211void pipe_close( void );    
    11621212        Close the pipe that was created with pipe_init(). 
    1163 sema_ew.c 
     1213}}} 
     1214 
     1215=== sema_ew.c === 
    11641216 
    11651217This file contains system-specific functions for handling event and mutex semaphores which allow communication between processes and threads. `mutex' is short for mutual exclusion. 
     1218{{{ 
    11661219#include <earthworm.h> 
    11671220 
     
    12101263void CloseSpecificMutex( mutex_t *mp );  
    12111264        Destroy the semaphore *mp, created by CreateSpecificMutex. 
    1212 sendmail.c 
     1265}}} 
     1266=== sendmail.c === 
    12131267 
    12141268This file contains a system-specific function for sending email. 
     1269{{{ 
    12151270#include <earthworm.h> 
    12161271 
     
    12181273        Send the email msg (less than 32,000 bytes) to the nmail 
    12191274        addresses (up to 60) listed in string array recip. 
    1220 sendpage.c 
     1275}}} 
     1276 
     1277=== sendpage.c === 
    12211278 
    12221279This file contains system-specific function for communicating with a Pageit computer over a serial port. 
     1280{{{ 
    12231281#include <earthworm.h> 
    12241282 
     
    12291287                -1 on timeout 
    12301288                -2 error while writing to port. 
    1231 sleep_ew.c 
     1289}}} 
     1290 
     1291=== sleep_ew.c === 
    12321292 
    12331293This file contains a system-specific function for sleeping with millisecond resolution. Under Solaris, any executable that uses sleep_ew must be linked with the posix4 library. The granularity of this function is 10 msec on winNT, 1 msec on Solaris. 
     1294{{{ 
    12341295cc [ flag ... ] file ...  -lposix4 [ library ... ]  (Solaris version) 
    12351296 
     
    12411302        extremely large unsigned integer and would essentially put the 
    12421303        process in a coma). 
    1243 socket_ew.c 
     1304}}} 
     1305 
     1306=== socket_ew.c === 
    12441307 
    12451308This file contains a few socket-related functions that are system-specific. Most socket functions are standard across all systems and are not included here. 
     1309{{{ 
    12461310cc [ flag ... ] file ... -lsocket -lnsl [ library ... ]  (Solaris version) 
    12471311 
     
    12571321void SocketPerror( char *note ); 
    12581322        Print to stderr an error message related to a socket. 
    1259 threads_ew.c 
     1323}}} 
     1324 
     1325=== threads_ew.c === 
    12601326 
    12611327This file contains simple system-speific multi-thread-related functions. 
     1328{{{ 
    12621329cc [ flag ... ] file ... -lthread [ library ... ]  (Solaris version) 
    12631330 
     
    12951362        Makes a thread kill itself without affecting other threads 
    12961363        in the same process. 
    1297 time_ew.c 
     1364}}} 
     1365 
     1366=== time_ew.c === 
    12981367 
    12991368This file contains system-specific reentrant system clock functions. 
     1369{{{ 
    13001370cc [ flag ... ] file ... -lposix4 [ library ... ]  (Solaris version) 
    13011371 
     
    13251395        in seconds since 1970.  Resolution is to the millisecond  
    13261396        level (OS/2, WindowsNT) or greater (nanoseconds on Solaris) 
    1327 transport.c 
     1397}}} 
     1398 
     1399=== transport.c === 
    13281400 
    13291401This file defines the standard system-specific intra-computer Earthworm messages-passing protocol. A more thorough description of these routines can be found in the file vx.x/programmer_doc/transport.doc. 
     1402{{{ 
    13301403#include <transport.h> 
    13311404 
     
    13731446        Get a message out of public shared memory; save the 
    13741447        sequence number from the transport layer. 
    1375 truetime.c 
     1448}}} 
     1449 
     1450=== truetime.c === 
    13761451 
    13771452(OS/2 and WindowsNT only) 
     1453{{{ 
    13781454#include <truetime.h> 
    13791455 
     
    13951471                -1 on device error 
    13961472                -2 on excessive passes. 
    1397 Module Index 
     1473}}} 
     1474 
     1475 
    13981476The EARTHWORM development team is headed by Alex Bittenbinder and coordinated by Barbara Bogaert; both with the U.S. Geological Survey. Advice and assistance with EARTHWORM development is provided by members of the CNSS. 
    1399 Questions? Issues? Subscribe to the Earthworm Google Groups List.