readf4.c File Reference

#include "scicos_block.h"
#include <math.h>
#include "machine.h"

Include dependency graph for readf4.c:

Go to the source code of this file.

Data Structures

struct  cilist
struct  doublecomplex

Defines

#define stack_1   stack_
#define vstk_1   vstk_
#define recu_1   recu_
#define iop_1   iop_
#define errgst_1   errgst_
#define com_1   com_
#define cha1_1   cha1_
#define dbg_1   dbg_
#define adre_1   adre_
#define intersci_1   intersci_
#define cstk   ((char *)&stack_1)
#define istk   ((int *)&stack_1)
#define sstk   ((float *)&stack_1)
#define zstk   ((doublecomplex *)&stack_1)
#define cstk   ((char *)&stack_1)
#define istk   ((int *)&stack_1)
#define sstk   ((float *)&stack_1)
#define zstk   ((doublecomplex *)&stack_1)

Typedefs

typedef char * address

Functions

int bfrdr ()
int readf4 (scicos_block *block, int flag)
int bfrdr (int *lunit, int *ipar, double *z__, int *no, int *kmax, int *ierr)

Variables

struct {
   double   stk [2]
stack_
struct {
   int   bot
   int   top
   int   idstk [60000]
   int   lstk [10000]
   int   leps
   int   bbot
   int   bot0
   int   infstk [10000]
   int   gbot
   int   gtop
   int   isiz
vstk_
struct {
   int   ids [24576]
   int   pstk [4096]
   int   rstk [4096]
   int   pt
   int   niv
   int   macr
   int   paus
   int   icall
   int   krec
recu_
struct {
   int   ddt
   int   err
   int   lct [8]
   int   lin [65536]
   int   lpt [6]
   int   hio
   int   rio
   int   wio
   int   rte
   int   wte
iop_
struct {
   int   err1
   int   err2
   int   errct
   int   toperr
   int   errpt
   int   ieee
   int   catch__
errgst_
struct {
   int   sym
   int   syn [6]
   int   char1
   int   fin
   int   fun
   int   lhs
   int   rhs
   int   ran [2]
   int   comp [3]
com_
struct {
   char   alfa [63]
   char   alfb [63]
   char   buf [4096]
cha1_
struct {
   int   wmac
   int   lcntr
   int   nmacs
   int   macnms [600]
   int   lgptrs [101]
   int   bptlg [1000]
dbg_
struct {
   int   lbot
   int   ie
   int   is
   int   ipal
   int   nbarg
   int   ladr [1024]
adre_
struct {
   int   nbvars
   int   iwhere [1024]
   int   nbrows [1024]
   int   nbcols [1024]
   int   itflag [1024]
   int   ntypes [1024]
   int   lad [1024]
   int   ladc [1024]
   int   lhsvar [1024]
intersci_
static int c__1 = 1
static int c__3 = 3
static int c__2 = 2


Define Documentation

#define adre_1   adre_

Definition at line 62 of file readf4.c.

#define cha1_1   cha1_

Definition at line 49 of file readf4.c.

Referenced by bfrdr(), readf4(), and writef4().

#define com_1   com_

Definition at line 43 of file readf4.c.

#define cstk   ((char *)&stack_1)

#define cstk   ((char *)&stack_1)

#define dbg_1   dbg_

Definition at line 56 of file readf4.c.

#define errgst_1   errgst_

Definition at line 37 of file readf4.c.

#define intersci_1   intersci_

Definition at line 77 of file readf4.c.

#define iop_1   iop_

Definition at line 31 of file readf4.c.

Referenced by readf4(), and writef4().

#define istk   ((int *)&stack_1)

#define istk   ((int *)&stack_1)

#define recu_1   recu_

Definition at line 25 of file readf4.c.

#define sstk   ((float *)&stack_1)

#define sstk   ((float *)&stack_1)

#define stack_1   stack_

Definition at line 11 of file readf4.c.

#define vstk_1   vstk_

Definition at line 18 of file readf4.c.

#define zstk   ((doublecomplex *)&stack_1)

#define zstk   ((doublecomplex *)&stack_1)


Typedef Documentation

typedef char* address

Definition at line 79 of file readf4.c.


Function Documentation

int bfrdr ( int lunit,
int ipar,
double *  z__,
int no,
int kmax,
int ierr 
)

Definition at line 257 of file readf4.c.

References c__1, cha1_1, cilist::ciend, cilist::cierr, cilist::cifmt, cilist::ciunit, do_fio(), do_uio(), e_rsfe(), e_rsue(), i__, j, max, n, s_rsfe(), and s_rsue().

00261 {
00262   /* System generated locals */
00263   int i__1, i__2, i__3;
00264   cilist ci__1;
00265   
00266   /* Builtin functions */
00267   int s_rsue(), do_uio(), e_rsue(), s_rsfe(), do_fio(), e_rsfe();
00268   
00269   /* Local variables */
00270 #define cstk ((char *)&stack_1)
00271   static int lfmt;
00272 #define istk ((int *)&stack_1)
00273   static int ievt;
00274 #define sstk ((float *)&stack_1)
00275 #define zstk ((doublecomplex *)&stack_1)
00276   static int i__, j, n, imask;
00277   extern /* Subroutine */ int cvstr_();
00278   static int mm;
00279   static double tmp[100];
00280   
00281   /* Fortran I/O blocks */
00282   static cilist io___26 = { 1, 0, 1, 0, 0 }; 
00283   
00284   
00285   /* *------------------------------------------------------------------ */
00286 
00287   /* Parameter adjustments */
00288   --z__;
00289   --ipar;
00290   
00291   /* Function Body */
00292   ievt = ipar[3];
00293   n = ipar[4];
00294   /*      no=(nz-3)/N */
00295   /*     maximum number of value to read */
00296   imask = ipar[1] + 5 + ipar[2];
00297   if (ievt == 0) {
00298     ++imask;
00299   }
00300   mm = 0;
00301   i__1 = *no - 1;
00302   for (i__ = 0; i__ <= i__1; ++i__) {
00303     /* Computing MAX */
00304     i__2 = mm, i__3 = ipar[imask + i__];
00305     mm = max(i__2,i__3);
00306     /* L10: */
00307   }
00308   
00309   lfmt = ipar[2];
00310   *kmax = 0;
00311   if (lfmt == 0) {
00312     /*     unformatted read */
00313     i__1 = n;
00314     for (i__ = 1; i__ <= i__1; ++i__) {
00315       io___26.ciunit = *lunit;
00316       i__2 = s_rsue(&io___26);
00317       if (i__2 != 0) {
00318         goto L100001;
00319       }
00320       i__3 = mm;
00321       for (j = 1; j <= i__3; ++j) {
00322         i__2 = do_uio(&c__1, (char *)&tmp[j - 1], (short)sizeof(
00323                                                                  double));
00324         if (i__2 != 0) {
00325           goto L100001;
00326         }
00327       }
00328       i__2 = e_rsue();
00329     L100001:
00330       if (i__2 < 0) {
00331         goto L20;
00332       }
00333       if (i__2 > 0) {
00334         goto L100;
00335       }
00336       i__2 = *no - 1;
00337       for (j = 0; j <= i__2; ++j) {
00338         z__[j * n + i__] = tmp[ipar[imask + j] - 1];
00339         /* L11: */
00340       }
00341       ++(*kmax);
00342       /* L12: */
00343     }
00344   } else {
00345     /*     formatted read */
00346     cvstr_(&ipar[2], &ipar[ipar[1] + 5], cha1_1.buf, &c__1, (short)4096);
00347     i__1 = n;
00348     for (i__ = 1; i__ <= i__1; ++i__) {
00349       ci__1.cierr = 1;
00350       ci__1.ciend = 1;
00351       ci__1.ciunit = *lunit;
00352       ci__1.cifmt = cha1_1.buf;
00353       i__2 = s_rsfe(&ci__1);
00354       if (i__2 != 0) {
00355         goto L100002;
00356       }
00357       i__3 = mm;
00358       for (j = 1; j <= i__3; ++j) {
00359         i__2 = do_fio(&c__1, (char *)&tmp[j - 1], (short)sizeof(
00360                                                                  double));
00361         if (i__2 != 0) {
00362           goto L100002;
00363         }
00364       }
00365       i__2 = e_rsfe();
00366     L100002:
00367       if (i__2 < 0) {
00368         goto L20;
00369       }
00370       if (i__2 > 0) {
00371         goto L100;
00372       }
00373       i__2 = *no - 1;
00374       for (j = 0; j <= i__2; ++j) {
00375         z__[j * n + i__] = tmp[ipar[imask + j] - 1];
00376         /* L13: */
00377       }
00378       ++(*kmax);
00379       /* L14: */
00380     }
00381   }
00382  L20:
00383   *ierr = 0;
00384   return 0;
00385  L100:
00386   *ierr = 1;
00387   return 0;
00388 } /* bfrdr */

Here is the call graph for this function:

int bfrdr (  ) 

Referenced by readf4().

Here is the caller graph for this function:

int readf4 ( scicos_block block,
int  flag 
)

Definition at line 89 of file readf4.c.

References bfrdr(), c__1, c__2, c__3, cha1_1, dcopy_(), scicos_block::evout, get_scicos_time(), ierr, int, iop_1, scicos_block::ipar, lunit, mode, n, scicos_block::nz, scicos_block::outptr, scicos_block::outsz, s_cat(), t, y, and scicos_block::z.

00090 {
00091 
00092   int nz=block->nz;
00093   double* z__=block->z;
00094   double* y=block->outptr[0];  
00095   int* ny=block->outsz;
00096   int* ipar=block->ipar;
00097   double *tvec=block->evout;
00098   double t=get_scicos_time();
00099 
00100   /* System generated locals */
00101   address a__1[3], a__2[2];
00102   int i__1, i__2[3], i__3[2];
00103   char ch__1[4118], ch__2[4115];
00104   
00105   /* Builtin functions */
00106   int s_cat();
00107   
00108   /* Local variables */
00109   static int mode[2], lfil, kmax;
00110 #define cstk ((char *)&stack_1)
00111   static int ierr;
00112 #define istk ((int *)&stack_1)
00113   static int ievt, lfmt;
00114 #define sstk ((float *)&stack_1)
00115 #define zstk ((doublecomplex *)&stack_1)
00116   static int k, n;
00117   extern int dcopy_();
00118   static int lunit;
00119   extern int cvstr_();
00120   static int io, no;
00121   extern int basout_(), clunit_();
00122   
00123   /*     Copyright INRIA
00124 
00125      Scicos block simulator
00126      write read from a binary or formatted file
00127      include '../stack.h'
00128      ipar(1) = lfil : file name length
00129      ipar(2) = lfmt : format length (0) if binary file
00130      ipar(3) = ievt  : 1 if each data have a an associated time
00131      ipar(4) = N : buffer length
00132      ipar(5:4+lfil) = character codes for file name
00133      ipar(5+lfil:4+lfil+lfmt) = character codes for format if any
00134      ipar(5+lfil+lfmt:5+lfil+lfmt+ny+ievt) = reading mask */
00135   
00136 
00137   /* Parameter adjustments */
00138   --y;
00139   --ipar;
00140   --tvec;
00141   --z__;
00142   
00143   
00144   /* Function Body */
00145   if (flag == 1) {
00146     /*     discrete state */
00147     n = ipar[4];
00148     k = (int) z__[1];
00149     ievt = ipar[3];
00150     kmax = (int) z__[2];
00151     lunit = (int) z__[3];
00152     if (k + 1 > kmax && kmax == n) {
00153       /*     output */
00154       dcopy_(ny, &z__[n * ievt + 3 + k], &n, &y[1], &c__1);
00155       /*     .     read a new buffer */
00156       no = (nz - 3) / n;
00157       bfrdr(&lunit, &ipar[1], &z__[4], &no, &kmax, &ierr);
00158       if (ierr != 0) {
00159         goto L110;
00160       }
00161       z__[1] = 1.;
00162       z__[2] = (double) kmax;
00163     } else if (k < kmax) {
00164       /*     output */
00165       dcopy_(ny, &z__[n * ievt + 3 + k], &n, &y[1], &c__1);
00166       z__[1] += 1.;
00167     }
00168     
00169   } else if (flag == 3) {
00170     n = ipar[4];
00171     k = (int) z__[1];
00172     kmax = (int) z__[2];
00173     if (k > kmax && kmax < n) {
00174       tvec[1] = t - 1.;
00175     } else {
00176       tvec[1] = z__[k + 3];
00177     }
00178   } else if (flag == 4) {
00179     /*     file opening */
00180     lfil = ipar[1];
00181     ievt = ipar[3];
00182     n = ipar[4];
00183     cvstr_(&lfil, &ipar[5], cha1_1.buf, &c__1, (short)4096);
00184     lfmt = ipar[2];
00185     lunit = 0;
00186     if (lfmt > 0) {
00187       mode[0] = 1;
00188       mode[1] = 0;
00189       clunit_(&lunit, cha1_1.buf, mode, lfil);
00190       if (iop_1.err > 0) {
00191         goto L100;
00192       }
00193     } else {
00194       mode[0] = 101;
00195       mode[1] = 0;
00196       clunit_(&lunit, cha1_1.buf, mode, lfil);
00197       if (iop_1.err > 0) {
00198         goto L100;
00199       }
00200     }
00201     z__[3] = (double) lunit;
00202     /*     buffer initialisation */
00203     no = (nz - 3) / n;
00204     bfrdr(&lunit, &ipar[1], &z__[4], &no, &kmax, &ierr);
00205     if (ierr != 0) {
00206       goto L110;
00207     }
00208     z__[1] = 1.;
00209     z__[2] = (double) kmax;
00210   } else if (flag == 5) {
00211     lfil = ipar[1];
00212     n = ipar[4];
00213     k = (int) z__[1];
00214     lunit = (int) z__[3];
00215     if (lunit == 0) {
00216       return 0;
00217     }
00218     i__1 = -lunit;
00219     clunit_(&i__1, cha1_1.buf, mode, lfil);
00220     if (iop_1.err > 0) {
00221       goto L100;
00222     }
00223     z__[3] = 0.;
00224   }
00225   return 0;
00226  L100:
00227   iop_1.err = 0;
00228   lfil = ipar[1];
00229   /* Writing concatenation */
00230   i__2[0] = 5, a__1[0] = "File ";
00231   i__2[1] = lfil, a__1[1] = cha1_1.buf;
00232   i__2[2] = 17, a__1[2] = " Cannot be opened";
00233   s_cat(ch__1, a__1, i__2, &c__3, (short)4118);
00234   basout_(&io, &iop_1.wte, ch__1, lfil + 22);
00235   flag = -1;
00236   return 0;
00237  L110:
00238   lfil = ipar[1];
00239   cvstr_(&lfil, &ipar[5], cha1_1.buf, &c__1, (short)4096);
00240   i__1 = -lunit;
00241   clunit_(&i__1, cha1_1.buf, mode, lfil);
00242   /* Writing concatenation */
00243   i__3[0] = 19, a__2[0] = "Read error on file ";
00244   i__3[1] = lfil, a__2[1] = cha1_1.buf;
00245   s_cat(ch__2, a__2, i__3, &c__2, (short)4115);
00246   basout_(&io, &iop_1.wte, ch__2, lfil + 19);
00247   flag = -1;
00248   return 0;
00249 } /* readf */

Here is the call graph for this function:


Variable Documentation

struct { ... } adre_

char alfa[63]

Definition at line 46 of file readf4.c.

Referenced by getcode().

char alfb[63]

Definition at line 46 of file readf4.c.

Referenced by codetoascii(), and getcode().

int bbot

Definition at line 14 of file readf4.c.

int bot

Definition at line 14 of file readf4.c.

Referenced by _ShadowSurroundedBox(), _Xaw3dDrawShadows(), _XawSme3dDrawShadows(), arr2num(), arr2numcst(), DeleteLine(), FlushScroll(), getLocalSizefromId(), gwdatastructures1(), gwdatastructures2(), InsertLine(), numberandsize(), ReadbdfFont(), RevScroll(), Scroll(), syncexec(), and Xputchar().

int bot0

Definition at line 14 of file readf4.c.

int bptlg[1000]

Definition at line 52 of file readf4.c.

Referenced by parse(), and run().

char buf[4096]

Definition at line 46 of file readf4.c.

int c__1 = 1 [static]

Definition at line 85 of file readf4.c.

int c__2 = 2 [static]

Definition at line 87 of file readf4.c.

Referenced by readf4().

int c__3 = 3 [static]

Definition at line 86 of file readf4.c.

int catch__

Definition at line 34 of file readf4.c.

struct { ... } cha1_

Referenced by scirun().

int char1

Definition at line 40 of file readf4.c.

Referenced by getval(), and parse().

struct { ... } com_

int comp[3]

Definition at line 40 of file readf4.c.

Referenced by exar2(), ismenu(), and parse().

struct { ... } dbg_

int ddt

Definition at line 28 of file readf4.c.

Referenced by GetCommand(), intscicosimc(), parse(), run(), and TCL_EvalScilabCmd().

int err

Definition at line 28 of file readf4.c.

int err1

Definition at line 34 of file readf4.c.

Referenced by C2F(), intscicosimc(), parse(), putlhsvar(), run(), Scierror_internal(), and scirun().

int err2

Definition at line 34 of file readf4.c.

Referenced by parse(), run(), and Scierror_internal().

int errct

Definition at line 34 of file readf4.c.

Referenced by parse().

struct { ... } errgst_

int errpt

Definition at line 34 of file readf4.c.

Referenced by parse(), and run().

int fin

Definition at line 40 of file readf4.c.

int fun

Definition at line 40 of file readf4.c.

Referenced by handle_onprompt(), intscicosimc(), parse(), putlhsvar(), run(), scibuiltin(), scifunction(), sciops(), scirun(), scistring(), and syncexec().

int gbot

Definition at line 14 of file readf4.c.

int gtop

Definition at line 14 of file readf4.c.

int hio

Definition at line 28 of file readf4.c.

int icall

Definition at line 21 of file readf4.c.

Referenced by parse(), and scibuiltin().

int ids[24576]

Definition at line 21 of file readf4.c.

Referenced by FindFreeGraphicWindow(), get_figures_id_property(), Java_javasci_Scilab_HaveAGraph(), sci_winsid(), sciGetNbFigures(), and ScilabHaveAGraph().

int idstk[60000]

Definition at line 14 of file readf4.c.

int ie

Definition at line 59 of file readf4.c.

Referenced by cstringf(), and scilab_shade().

int ieee

Definition at line 34 of file readf4.c.

Referenced by sci_besselh(), sci_besseli(), sci_besselj(), sci_besselk(), and sci_bessely().

int infstk[10000]

Definition at line 14 of file readf4.c.

struct { ... } intersci_

struct { ... } iop_

int ipal

Definition at line 59 of file readf4.c.

int is

Definition at line 59 of file readf4.c.

Referenced by ExploreMenu(), SciChMenu(), SciDelMenu(), scilab_shade(), and SciSetMenu().

int isiz

Definition at line 14 of file readf4.c.

Referenced by crematvar(), fontidscale(), and getGlobalSizefromId().

int itflag[1024]

Definition at line 65 of file readf4.c.

int iwhere[1024]

Definition at line 65 of file readf4.c.

Referenced by _PARAMS(), intersci_pop(), intersci_push(), intscicosimc(), inttree2(), inttree3(), mxCreateLogicalMatrix(), and mxFree().

int krec

Definition at line 21 of file readf4.c.

Referenced by parse(), scibuiltin(), scifunction(), scirun(), and syncexec().

int lad[1024]

Definition at line 65 of file readf4.c.

Referenced by Check_references(), createlistcvarfrom(), createlistcvarfromptr(), createlistvarfrom(), createlistvarfromptr(), intersci_pop(), intscicosimc(), and mvfromto().

int ladc[1024]

Definition at line 65 of file readf4.c.

int ladr[1024]

Definition at line 59 of file readf4.c.

int lbot

Definition at line 59 of file readf4.c.

int lcntr

Definition at line 52 of file readf4.c.

int lct[8]

Definition at line 28 of file readf4.c.

Referenced by basout(), and Scierror_internal().

int leps

Definition at line 14 of file readf4.c.

Referenced by C2F().

int lgptrs[101]

Definition at line 52 of file readf4.c.

Referenced by parse(), and run().

int lhs

Definition at line 40 of file readf4.c.

Referenced by gwdatastructures1(), gwdatastructures2(), putcat(), and sciex17c().

int lhsvar[1024]

Definition at line 65 of file readf4.c.

Referenced by intersci_pop(), and intscicosimc().

int lin[65536]

Definition at line 28 of file readf4.c.

Referenced by GetIndexLastModifiedFileInList().

int lpt[6]

Definition at line 28 of file readf4.c.

int lstk[10000]

Definition at line 14 of file readf4.c.

Referenced by __PARAMS(), arr2num(), arr2numcst(), clear_mex(), endmex(), getGlobalSizefromId(), getLocalSizefromId(), header2ptr(), initmex(), mexCallSCI(), mxCreateCellArray(), mxDuplicateArray(), mxFreeMatrix(), and numberandsize().

int macnms[600]

Definition at line 52 of file readf4.c.

Referenced by parse(), and run().

int macr

Definition at line 21 of file readf4.c.

Referenced by parse().

int nbarg

Definition at line 59 of file readf4.c.

int nbcols[1024]

Definition at line 65 of file readf4.c.

int nbrows[1024]

Definition at line 65 of file readf4.c.

int nbvars

Definition at line 65 of file readf4.c.

int niv

Definition at line 21 of file readf4.c.

Referenced by parse(), RandI(), run(), and scirun().

int nmacs

Definition at line 52 of file readf4.c.

Referenced by parse(), and run().

int ntypes[1024]

Definition at line 65 of file readf4.c.

Referenced by Check_references(), intersci_pop(), and intscicosimc().

int paus

Definition at line 21 of file readf4.c.

Referenced by parse(), and scirun().

int pstk[4096]

Definition at line 21 of file readf4.c.

int pt

Definition at line 21 of file readf4.c.

Referenced by _ShadowSurroundedBox(), _Xaw3dDrawShadows(), _XawSme3dDrawShadows(), ClearCommandWindow(), EzCreateFont(), gw_core(), gw_io(), InvalidateCursor(), MenuButtonProc(), mkconv(), ON_WND_TEXT_WM_LBUTTONDOWN(), ON_WND_TEXT_WM_MOUSEMOVE(), ON_WND_TEXT_WM_RBUTTONDOWN(), putop(), scibuiltin(), scifunction(), scirun(), SelectAll(), TextClearEOL(), TextClearEOS(), TextCopyClip(), TextDeleteLine(), TextInsertLine(), and UnSelect().

int ran[2]

Definition at line 40 of file readf4.c.

struct { ... } recu_

int rhs

Definition at line 40 of file readf4.c.

Referenced by addinter(), gwdatastructures1(), gwdatastructures2(), matlog(), matops(), sciex17c(), SciLibLoad(), sp(), and stfcall().

int rio

Definition at line 28 of file readf4.c.

Referenced by parse(), and run().

int rstk[4096]

Definition at line 21 of file readf4.c.

Referenced by gw_core(), gw_io(), scibuiltin(), scifunction(), and scirun().

int rte

Definition at line 28 of file readf4.c.

Referenced by parse(), and run().

struct { ... } stack_

double stk[2]

Definition at line 8 of file readf4.c.

int sym

Definition at line 40 of file readf4.c.

Referenced by parse().

int syn[6]

Definition at line 40 of file readf4.c.

Referenced by parse().

int top

Definition at line 14 of file readf4.c.

Referenced by _ShadowSurroundedBox(), _Xaw3dDrawShadows(), _XawSme3dDrawShadows(), _XawTextShowPosition(), _XawTextVScroll(), AddToRefresh(), awalk(), ClearAbove(), ClearBelow(), ClearScreen(), getcd(), getcds(), gwdatastructures1(), gwdatastructures2(), malloc(), MenuFixCurrentWin(), PositionHScrollBar(), Ptoken(), SwitchBufs(), VerifyWidget(), x_rsne(), XmuAreaAnd(), XmuAreaOrXor(), and Xputchar().

int toperr

Definition at line 34 of file readf4.c.

struct { ... } vstk_

int wio

Definition at line 28 of file readf4.c.

Referenced by basout().

int wmac

Definition at line 52 of file readf4.c.

int wte

Definition at line 28 of file readf4.c.

Referenced by basout().


Generated on Sun Mar 4 16:12:12 2007 for Scilab [trunk] by  doxygen 1.5.1