~ubuntu-branches/ubuntu/saucy/igraph/saucy

« back to all changes in this revision

Viewing changes to src/f2c/rsli.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2013-05-27 14:01:54 UTC
  • mfrom: (4.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130527140154-oxwwmr0gj3kdy4ol
Tags: 0.6.5-2
Upload to sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "f2c.h"
 
2
#include "fio.h"
 
3
#include "lio.h"
 
4
#include "fmt.h" /* for f__doend */
 
5
#ifdef __cplusplus
 
6
extern "C" {
 
7
#endif
 
8
 
 
9
extern flag f__lquit;
 
10
extern int f__lcount;
 
11
extern char *f__icptr;
 
12
extern char *f__icend;
 
13
extern icilist *f__svic;
 
14
extern int f__icnum, f__recpos;
 
15
 
 
16
static int i_getc(Void)
 
17
{
 
18
        if(f__recpos >= f__svic->icirlen) {
 
19
                if (f__recpos++ == f__svic->icirlen)
 
20
                        return '\n';
 
21
                z_rnew();
 
22
                }
 
23
        f__recpos++;
 
24
        if(f__icptr >= f__icend)
 
25
                return EOF;
 
26
        return(*f__icptr++);
 
27
        }
 
28
 
 
29
 static
 
30
#ifdef KR_headers
 
31
int i_ungetc(ch, f) int ch; FILE *f;
 
32
#else
 
33
int i_ungetc(int ch, FILE *f)
 
34
#endif
 
35
{
 
36
        if (--f__recpos == f__svic->icirlen)
 
37
                return '\n';
 
38
        if (f__recpos < -1)
 
39
                err(f__svic->icierr,110,"recend");
 
40
        /* *--icptr == ch, and icptr may point to read-only memory */
 
41
        return *--f__icptr /* = ch */;
 
42
        }
 
43
 
 
44
 static void
 
45
#ifdef KR_headers
 
46
c_lir(a) icilist *a;
 
47
#else
 
48
c_lir(icilist *a)
 
49
#endif
 
50
{
 
51
        extern int l_eof;
 
52
        f__reading = 1;
 
53
        f__external = 0;
 
54
        f__formatted = 1;
 
55
        f__svic = a;
 
56
        L_len = a->icirlen;
 
57
        f__recpos = -1;
 
58
        f__icnum = f__recpos = 0;
 
59
        f__cursor = 0;
 
60
        l_getc = i_getc;
 
61
        l_ungetc = i_ungetc;
 
62
        l_eof = 0;
 
63
        f__icptr = a->iciunit;
 
64
        f__icend = f__icptr + a->icirlen*a->icirnum;
 
65
        f__cf = 0;
 
66
        f__curunit = 0;
 
67
        f__elist = (cilist *)a;
 
68
        }
 
69
 
 
70
 
 
71
#ifdef KR_headers
 
72
integer s_rsli(a) icilist *a;
 
73
#else
 
74
integer s_rsli(icilist *a)
 
75
#endif
 
76
{
 
77
        f__lioproc = l_read;
 
78
        f__lquit = 0;
 
79
        f__lcount = 0;
 
80
        c_lir(a);
 
81
        f__doend = 0;
 
82
        return(0);
 
83
        }
 
84
 
 
85
integer e_rsli(Void)
 
86
{ return 0; }
 
87
 
 
88
#ifdef KR_headers
 
89
integer s_rsni(a) icilist *a;
 
90
#else
 
91
extern int x_rsne(cilist*);
 
92
 
 
93
integer s_rsni(icilist *a)
 
94
#endif
 
95
{
 
96
        extern int nml_read;
 
97
        integer rv;
 
98
        cilist ca;
 
99
        ca.ciend = a->iciend;
 
100
        ca.cierr = a->icierr;
 
101
        ca.cifmt = a->icifmt;
 
102
        c_lir(a);
 
103
        rv = x_rsne(&ca);
 
104
        nml_read = 0;
 
105
        return rv;
 
106
        }
 
107
#ifdef __cplusplus
 
108
}
 
109
#endif