Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

cfget.c

Go to the documentation of this file.
00001 /*
00002  * $Id: cfget.c,v 1.2 2009/02/16 08:04:35 schubert Exp $
00003  *
00004  * Revision 1.2  2002/12/02 16:37:45  brun
00005  * Changes from Federico Carminati and Peter Hristov who ported the system
00006  * on the Ithanium processors.It is tested on HP, Sun, and Alpha, everything
00007  * seems to work. The optimisation is switched off in case of gcc2.xx.yyy
00008  *
00009  * Revision 1.1.1.1  2002/07/24 15:56:28  rdm
00010  * initial import into CVS
00011  *
00012  * Revision 1.1.1.1  2002/06/16 15:18:46  hristov
00013  * Separate distribution  of Geant3
00014  *
00015  * Revision 1.1.1.1  1999/05/18 15:55:29  fca
00016  * AliRoot sources
00017  *
00018  * Revision 1.5  1997/10/23 16:33:18  mclareni
00019  * NT mods
00020  *
00021  * Revision 1.4  1997/09/02 14:26:44  mclareni
00022  * WINNT correction
00023  *
00024  * Revision 1.3  1997/02/04 17:35:10  mclareni
00025  * Merge Winnt and 97a versions
00026  *
00027  * Revision 1.2  1997/01/15 16:25:31  cernlib
00028  * fix from F.Hemmer to return rfio return code
00029  *
00030  * Revision 1.1.1.1.2.1  1997/01/21 11:30:09  mclareni
00031  * All mods for Winnt 96a on winnt branch
00032  *
00033  * Revision 1.1.1.1  1996/02/15 17:49:36  mclareni
00034  * Kernlib
00035  *
00036  */
00037 #include "kerngen/pilot.h"
00038 #include "kerngen/fortranc.h"
00039 #include "stdio.h"
00040 
00041 #if defined(CERNLIB_QMOS9)
00042 #include "os9gs/cfget.c"
00043 #else
00044 /*>    ROUTINE CFGET
00045   CERN PROGLIB# Z310    CFGET           .VERSION KERNFOR  4.29  910718
00046   ORIG. 12/01/91, JZ
00047       CALL CFGET (LUNDES, MEDIUM, NWREC, NWTAK, MBUF, ISTAT)
00048       read from the file :
00049        LUNDES  file descriptor
00050        MEDIUM  = 0,1,2,3 : primary disk/tape, secondary disk/tape
00051        NWREC   number of words record size
00052       *NWTAK*  number of words to be read / actually read
00053       *MBUF    vector to be read into
00054       *ISTAT   status, =zero if success
00055 */
00056 #include "kerngen/cf_reaw.h"
00057 #ifndef WIN32
00058 #  include <errno.h>
00059 #else
00060 #  include <stdlib.h>
00061 #endif
00062 #include "kerngen/cf_xaft.h"
00063 #include "kerngen/wordsizc.h"
00064 #if defined(CERNLIB_QX_SC)
00065 void type_of_call cfget_(lundes, medium, nwrec, nwtak, mbuf, stat)
00066 #endif
00067 #if defined(CERNLIB_QXNO_SC)
00068 void type_of_call cfget(lundes, medium, nwrec, nwtak, mbuf, stat)
00069 #endif
00070 #if defined(CERNLIB_QXCAPT)
00071 void type_of_call CFGET(lundes, medium, nwrec, nwtak, mbuf, 
00072 # ifdef CERNLIB_CFGET_CHARACTER
00073      lmbuf,
00074 # endif
00075             stat)
00076 #  ifdef CERNLIB_CFGET_CHARACTER
00077      int lmbuf;
00078 #  endif
00079 #endif
00080       char *mbuf;
00081       int  *lundes, *medium, *nwrec, *nwtak, *stat;
00082 {
00083       int  fildes;
00084       int  nbdn, nbdo;
00085 
00086       *stat = 0;
00087       if (*nwtak <= 0)            return;
00088 
00089 /*        read the file      */
00090 
00091       fildes = *lundes;
00092       nbdo   = *nwrec * NBYTPW;
00093       nbdn   = read (fildes, mbuf, nbdo);
00094       if (nbdn == 0)               goto heof;
00095       if (nbdn <  0)               goto herror;
00096       *nwtak = (nbdn - 1) / NBYTPW + 1;
00097       return;
00098 
00099 /*        Handle exceptions        */
00100 
00101 heof:     *stat = -1;
00102           return;
00103 
00104 #if defined(CERNLIB_PROJSHIFT)
00105 herror:   *stat = (serrno ? serrno : (rfio_errno ? rfio_errno : errno));
00106 #else
00107 herror:   *stat = errno;
00108 #endif
00109           perror (" error in CFGET");
00110           return;
00111 }
00112 /*> END <----------------------------------------------------------*/
00113 #endif

Generated on Mon Feb 15 11:06:31 2010 for loon by  doxygen 1.3.9.1