fmidas.c

Go to the documentation of this file.
00001 /********************************************************************\
00002 
00003   Name:         FMIDAS.C
00004   Created by:   Stefan Ritt
00005 
00006   Contents:     Wrapper functions for MIDAS library functions to be
00007                 called from Fortran programs.
00008 
00009   $Id: fmidas.c 2753 2005-10-07 14:55:31Z ritt $
00010 
00011 \********************************************************************/
00012 
00013 #include <stdio.h>
00014 #include <midas.h>
00015 
00016 /*---- Windows NT section ------------------------------------------*/
00017 
00018 #ifdef OS_WINNT
00019 
00020 int __stdcall CM_CONNECT_EXPERIMENT(char *fhost, int lhost,
00021                                     char *fexp, int lexp, char *fname, int lname)
00022 {
00023    char host[256], exp[256], name[256];
00024 
00025    strncpy(host, fhost, lhost);
00026    host[lhost] = 0;
00027 
00028    strncpy(exp, fexp, lexp);
00029    exp[lexp] = 0;
00030 
00031    strncpy(name, fname, lname);
00032    name[lname] = 0;
00033 
00034    return cm_connect_experiment(host, exp, name, NULL);
00035 }
00036 
00037 int __stdcall CM_DISCONNECT_EXPERIMENT()
00038 {
00039    return cm_disconnect_experiment();
00040 }
00041 
00042 int __stdcall BM_OPEN_BUFFER(char *fname, int lname, int *buffer_size, int *buffer_handle)
00043 {
00044    char name[256];
00045 
00046    strncpy(name, fname, lname);
00047    name[lname] = 0;
00048 
00049    return bm_open_buffer(name, *buffer_size, buffer_handle);
00050 }
00051 
00052 extern void __stdcall PROCESS_EVENT();
00053 
00054 void _process_event(HNDLE hBuf, HNDLE hRequest, EVENT_HEADER * pevent, void *pdata)
00055 {
00056    PROCESS_EVENT(&hBuf, &hRequest, pevent, pdata);
00057 }
00058 
00059 int __stdcall BM_REQUEST_EVENT(int *buffer_handle, int *event_id,
00060                                int *trigger_mask, int *sampling_type, int *request_id)
00061 {
00062    return bm_request_event(*buffer_handle,
00063                            (short int) *event_id,
00064                            (short int) *trigger_mask,
00065                            *sampling_type, request_id, _process_event);
00066 }
00067 
00068 int __stdcall CM_YIELD(int *millisec)
00069 {
00070    return cm_yield(*millisec);
00071 }
00072 
00073 #endif
00074 
00075 /*-----------------------------------------------------------------*/

Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk