Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
a843efa0
Commit
a843efa0
authored
May 19, 1998
by
Craig Burley
Committed by
Dave Love
May 19, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to Netlib version of 1998-04-20
From-SVN: r19877
parent
deec641e
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
527 additions
and
475 deletions
+527
-475
libf2c/ChangeLog
+14
-0
libf2c/changes.netlib
+54
-0
libf2c/libF77/Version.c
+1
-1
libf2c/libF77/dtime_.c
+2
-0
libf2c/libF77/etime_.c
+2
-0
libf2c/libF77/h_dnnt.c
+1
-2
libf2c/libF77/h_nint.c
+1
-2
libf2c/libF77/i_dnnt.c
+1
-2
libf2c/libF77/i_nint.c
+1
-2
libf2c/libF77/main.c
+12
-6
libf2c/libF77/s_paus.c
+3
-3
libf2c/libF77/signal1.h0
+12
-0
libf2c/libI77/Version.c
+20
-2
libf2c/libI77/backspace.c
+30
-60
libf2c/libI77/close.c
+4
-5
libf2c/libI77/dfe.c
+16
-32
libf2c/libI77/endfile.c
+20
-94
libf2c/libI77/err.c
+33
-45
libf2c/libI77/fio.h
+9
-4
libf2c/libI77/iio.c
+14
-8
libf2c/libI77/ilnw.c
+3
-3
libf2c/libI77/lread.c
+1
-1
libf2c/libI77/lwrite.c
+4
-12
libf2c/libI77/open.c
+140
-84
libf2c/libI77/rawio.h
+1
-3
libf2c/libI77/sfe.c
+5
-10
libf2c/libI77/util.c
+2
-0
libf2c/libI77/wrtfmt.c
+4
-24
libf2c/libI77/wsfe.c
+22
-33
libf2c/libI77/wsle.c
+6
-9
libf2c/libI77/wsne.c
+1
-1
libf2c/libU77/Version.c
+1
-1
libf2c/readme.netlib
+87
-26
No files found.
libf2c/ChangeLog
View file @
a843efa0
Fri May 1 11:57:45 1998 Craig Burley <burley@gnu.org>
Update to Netlib version of 1998-04-20:
* libF77/dtime_.c, libF77/etime_.c, libF77/h_dnnt.c,
libF77/h_nint.c, libF77/i_dnnt.c, libF77/i_nint.c,
libF77/main.c, libF77/s_paus.c, libF77/signal1.h0,
libI77/backspace.c, libI77/close.c, libI77/dfe.c,
libI77/endfile.c, libI77/err.c, libI77/fio.h,
libI77/iio.c, libI77/ilnw.c, libI77/lread.c,
libI77/lwrite.c, libI77/open.c, libI77/rawio.h,
libI77/sfe.c, libI77/util.c, libI77/wrtfmt.c,
libI77/wsfe.c, libI77/wsle.c, libI77/wsne.c:
See changes.netlib for info.
Sun Apr 26 09:13:41 1998 Craig Burley <burley@gnu.org>
Sun Apr 26 09:13:41 1998 Craig Burley <burley@gnu.org>
* libU77/hostnm_.c (G77_hostnm_0): Fix off-by-one error
* libU77/hostnm_.c (G77_hostnm_0): Fix off-by-one error
...
...
libf2c/changes.netlib
View file @
a843efa0
...
@@ -2848,3 +2848,57 @@ invisible on other machines.
...
@@ -2848,3 +2848,57 @@ invisible on other machines.
Sun Sep 21 22:05:19 EDT 1997
Sun Sep 21 22:05:19 EDT 1997
libf77: [de]time_.c (Unix systems only): change return type to double.
libf77: [de]time_.c (Unix systems only): change return type to double.
Thu Dec 4 22:10:09 EST 1997
Fix bug with handling large blocks of comments (over 4k); parts of the
second and subsequent blocks were likely to be lost (not copied into
comments in the resulting C). Allow comment lines to be longer before
breaking them.
Mon Jan 19 17:19:27 EST 1998
makefile: change the rule for making gram.c to one for making gram1.c;
henceforth, asking netlib to "send all from f2c/src" will bring you a
working gram.c. Nowadays there are simply too many broken versions of
yacc floating around.
libi77: backspace.c: for b->ufmt==0, change sizeof(int) to
sizeof(uiolen). On machines where this would make a difference, it is
best for portability to compile libI77 with -DUIOLEN_int, which will
render the change invisible.
Tue Feb 24 08:35:33 EST 1998
makefile: remove gram.c from the "make clean" rule.
Wed Feb 25 08:29:39 EST 1998
makefile: change CFLAGS assignment to -O; add "veryclean" rule.
Wed Mar 4 13:13:21 EST 1998
libi77: open.c: fix glitch in comparing file names under
-DNON_UNIX_STDIO.
Mon Mar 9 23:56:56 EST 1998
putpcc.c: omit an unnecessary temporary variable in computing
(expr)**3.
libf77, libi77: minor tweaks to make some C++ compilers happy;
Version.c not changed.
Wed Mar 18 18:08:47 EST 1998
libf77: minor tweaks to [ed]time_.c; Version.c not changed.
libi77: endfile.c, open.c: acquire temporary files from tmpfile(),
unless compiled with -DNON_ANSI_STDIO, which uses mktemp().
New buffering scheme independent of NON_UNIX_STDIO for handling T
format items. Now -DNON_UNIX_STDIO is no longer be necessary for
Linux, and libf2c no longer causes stderr to be buffered -- the former
setbuf or setvbuf call for stderr was to make T format items work.
open.c: use the Posix access() function to check existence or
nonexistence of files, except under -DNON_POSIX_STDIO, where trial
fopen calls are used. In open.c, fix botch in changes of 19980304.
libf2c.zip: the PC makefiles are now set for NT/W95, with comments
about changes for DOS.
Fri Apr 3 17:22:12 EST 1998
Adjust fix of 19960913 to again permit substring notation on
character variables in data statements.
Sun Apr 5 19:26:50 EDT 1998
libi77: wsfe.c: make $ format item work: this was lost in the changes
of 17 March 1998.
libf2c/libF77/Version.c
View file @
a843efa0
...
@@ -3,7 +3,7 @@ static char junk[] = "\n@(#)LIBF77 VERSION 19970919\n";
...
@@ -3,7 +3,7 @@ static char junk[] = "\n@(#)LIBF77 VERSION 19970919\n";
/*
/*
*/
*/
char
__G77_LIBF77_VERSION__
[]
=
"0.5.2
2
"
;
char
__G77_LIBF77_VERSION__
[]
=
"0.5.2
3-19980501
"
;
/*
/*
2.00 11 June 1980. File version.c added to library.
2.00 11 June 1980. File version.c added to library.
...
...
libf2c/libF77/dtime_.c
View file @
a843efa0
#include "time.h"
#include "time.h"
#ifndef USE_CLOCK
#ifndef USE_CLOCK
#define _INCLUDE_POSIX_SOURCE
/* for HP-UX */
#define _INCLUDE_XOPEN_SOURCE
/* for HP-UX */
#include "sys/types.h"
#include "sys/types.h"
#include "sys/times.h"
#include "sys/times.h"
#endif
#endif
...
...
libf2c/libF77/etime_.c
View file @
a843efa0
#include "time.h"
#include "time.h"
#ifndef USE_CLOCK
#ifndef USE_CLOCK
#define _INCLUDE_POSIX_SOURCE
/* for HP-UX */
#define _INCLUDE_XOPEN_SOURCE
/* for HP-UX */
#include "sys/types.h"
#include "sys/types.h"
#include "sys/times.h"
#include "sys/times.h"
#endif
#endif
...
...
libf2c/libF77/h_dnnt.c
View file @
a843efa0
...
@@ -9,6 +9,5 @@ shortint h_dnnt(x) doublereal *x;
...
@@ -9,6 +9,5 @@ shortint h_dnnt(x) doublereal *x;
shortint
h_dnnt
(
doublereal
*
x
)
shortint
h_dnnt
(
doublereal
*
x
)
#endif
#endif
{
{
return
(
(
*
x
)
>=
0
?
return
(
shortint
)(
*
x
>=
0
.
?
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
));
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
)
);
}
}
libf2c/libF77/h_nint.c
View file @
a843efa0
...
@@ -9,6 +9,5 @@ shortint h_nint(x) real *x;
...
@@ -9,6 +9,5 @@ shortint h_nint(x) real *x;
shortint
h_nint
(
real
*
x
)
shortint
h_nint
(
real
*
x
)
#endif
#endif
{
{
return
(
(
*
x
)
>=
0
?
return
(
shortint
)(
*
x
>=
0
?
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
));
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
)
);
}
}
libf2c/libF77/i_dnnt.c
View file @
a843efa0
...
@@ -9,6 +9,5 @@ integer i_dnnt(x) doublereal *x;
...
@@ -9,6 +9,5 @@ integer i_dnnt(x) doublereal *x;
integer
i_dnnt
(
doublereal
*
x
)
integer
i_dnnt
(
doublereal
*
x
)
#endif
#endif
{
{
return
(
(
*
x
)
>=
0
?
return
(
integer
)(
*
x
>=
0
.
?
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
));
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
)
);
}
}
libf2c/libF77/i_nint.c
View file @
a843efa0
...
@@ -9,6 +9,5 @@ integer i_nint(x) real *x;
...
@@ -9,6 +9,5 @@ integer i_nint(x) real *x;
integer
i_nint
(
real
*
x
)
integer
i_nint
(
real
*
x
)
#endif
#endif
{
{
return
(
(
*
x
)
>=
0
?
return
(
integer
)(
*
x
>=
0
?
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
));
floor
(
*
x
+
.
5
)
:
-
floor
(.
5
-
*
x
)
);
}
}
libf2c/libF77/main.c
View file @
a843efa0
...
@@ -50,38 +50,44 @@ extern int MAIN__(void);
...
@@ -50,38 +50,44 @@ extern int MAIN__(void);
#define Int int
#define Int int
#endif
#endif
static
VOID
sigfdie
(
Int
n
)
static
VOID
sigfdie
(
Sigarg
)
{
{
Use_Sigarg
;
sig_die
(
"Floating Exception"
,
1
);
sig_die
(
"Floating Exception"
,
1
);
}
}
static
VOID
sigidie
(
Int
n
)
static
VOID
sigidie
(
Sigarg
)
{
{
Use_Sigarg
;
sig_die
(
"IOT Trap"
,
1
);
sig_die
(
"IOT Trap"
,
1
);
}
}
#ifdef SIGQUIT
#ifdef SIGQUIT
static
VOID
sigqdie
(
Int
n
)
static
VOID
sigqdie
(
Sigarg
)
{
{
Use_Sigarg
;
sig_die
(
"Quit signal"
,
1
);
sig_die
(
"Quit signal"
,
1
);
}
}
#endif
#endif
static
VOID
sigindie
(
Int
n
)
static
VOID
sigindie
(
Sigarg
)
{
{
Use_Sigarg
;
sig_die
(
"Interrupt"
,
0
);
sig_die
(
"Interrupt"
,
0
);
}
}
static
VOID
sigtdie
(
Int
n
)
static
VOID
sigtdie
(
Sigarg
)
{
{
Use_Sigarg
;
sig_die
(
"Killed"
,
0
);
sig_die
(
"Killed"
,
0
);
}
}
#ifdef SIGTRAP
#ifdef SIGTRAP
static
VOID
sigtrdie
(
Int
n
)
static
VOID
sigtrdie
(
Sigarg
)
{
{
Use_Sigarg
;
sig_die
(
"Trace trap"
,
1
);
sig_die
(
"Trace trap"
,
1
);
}
}
#endif
#endif
...
...
libf2c/libF77/s_paus.c
View file @
a843efa0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include "f2c.h"
#include "f2c.h"
#define PAUSESIG 15
#define PAUSESIG 15
#include "signal1.h"
#ifdef KR_headers
#ifdef KR_headers
#define Void
/* void */
#define Void
/* void */
#define Int
/* int */
#define Int
/* int */
...
@@ -12,7 +13,6 @@
...
@@ -12,7 +13,6 @@
#undef min
#undef min
#undef max
#undef max
#include <stdlib.h>
#include <stdlib.h>
#include "signal1.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
...
@@ -22,8 +22,8 @@ extern int getpid(void), isatty(int), pause(void);
...
@@ -22,8 +22,8 @@ extern int getpid(void), isatty(int), pause(void);
extern
VOID
f_exit
(
Void
);
extern
VOID
f_exit
(
Void
);
static
VOID
static
VOID
waitpause
(
Int
n
)
waitpause
(
Sigarg
)
{
n
=
n
;
/* shut up compiler warning */
{
Use_Sigarg
;
return
;
return
;
}
}
...
...
libf2c/libF77/signal1.h0
View file @
a843efa0
...
@@ -12,8 +12,12 @@
...
@@ -12,8 +12,12 @@
#ifdef KR_headers
#ifdef KR_headers
#define Sigarg_t
#define Sigarg_t
#else
#else
#ifdef __cplusplus
#define Sigarg_t ...
#else
#define Sigarg_t int
#define Sigarg_t int
#endif
#endif
#endif
#endif /*Sigarg_t*/
#endif /*Sigarg_t*/
#ifdef USE_SIG_PF /* compile with -DUSE_SIG_PF under IRIX */
#ifdef USE_SIG_PF /* compile with -DUSE_SIG_PF under IRIX */
...
@@ -23,3 +27,11 @@ typedef Sigret_t (*sig_pf)(Sigarg_t);
...
@@ -23,3 +27,11 @@ typedef Sigret_t (*sig_pf)(Sigarg_t);
#endif
#endif
#define signal1(a,b) signal(a,(sig_pf)b)
#define signal1(a,b) signal(a,(sig_pf)b)
#ifdef __cplusplus
#define Sigarg ...
#define Use_Sigarg
#else
#define Sigarg Int n
#define Use_Sigarg n = n /* shut up compiler warning */
#endif
libf2c/libI77/Version.c
View file @
a843efa0
static
char
junk
[]
=
"
\n
@(#) LIBI77 VERSION pjw,dmg-mods 199
70916
\n
"
;
static
char
junk
[]
=
"
\n
@(#) LIBI77 VERSION pjw,dmg-mods 199
80405
\n
"
;
/*
/*
*/
*/
char
__G77_LIBI77_VERSION__
[]
=
"0.5.22"
;
char
__G77_LIBI77_VERSION__
[]
=
"0.5.2
3-1998050
2"
;
/*
/*
2.01 $ format added
2.01 $ format added
...
@@ -267,6 +267,24 @@ wrtfmt.c:
...
@@ -267,6 +267,24 @@ wrtfmt.c:
/* 16 Sept. 1997:fmt.[ch] rdfmt.c wrtfmt.c: tweak struct syl for machines
/* 16 Sept. 1997:fmt.[ch] rdfmt.c wrtfmt.c: tweak struct syl for machines
with 64-bit pointers and 32-bit ints that did not 64-bit
with 64-bit pointers and 32-bit ints that did not 64-bit
align struct syl (e.g., Linux on the DEC Alpha). */
align struct syl (e.g., Linux on the DEC Alpha). */
/* 19 Jan. 1998: backspace.c: for b->ufmt==0, change sizeof(int) to
sizeof(uiolen). On machines where this would make a
difference, it is best for portability to compile libI77 with
-DUIOLEN_int (which will render the change invisible). */
/* 4 March 1998: open.c: fix glitch in comparing file names under
-DNON_UNIX_STDIO */
/* 17 March 1998: endfile.c, open.c: acquire temporary files from tmpfile(),
unless compiled with -DNON_ANSI_STDIO, which uses mktemp().
New buffering scheme independent of NON_UNIX_STDIO for
handling T format items. Now -DNON_UNIX_STDIO is no
longer be necessary for Linux, and libf2c no longer
causes stderr to be buffered -- the former setbuf or
setvbuf call for stderr was to make T format items work.
open.c: use the Posix access() function to check existence
or nonexistence of files, except under -DNON_POSIX_STDIO,
where trial fopen calls are used. */
/* 5 April 1998: wsfe.c: make $ format item work: this was lost in the
changes of 17 March 1998. */
...
...
libf2c/libI77/backspace.c
View file @
a843efa0
...
@@ -7,21 +7,17 @@ integer f_back(a) alist *a;
...
@@ -7,21 +7,17 @@ integer f_back(a) alist *a;
integer
f_back
(
alist
*
a
)
integer
f_back
(
alist
*
a
)
#endif
#endif
{
unit
*
b
;
{
unit
*
b
;
int
i
,
ndec
;
long
v
,
w
,
x
,
y
,
z
;
uiolen
n
;
uiolen
n
;
#if defined (MSDOS) && !defined (GO32)
FILE
*
f
;
int
j
,
k
;
long
w
,
z
;
#endif
long
x
,
y
;
char
buf
[
32
];
if
(
f__init
&
2
)
if
(
f__init
&
2
)
f__fatal
(
131
,
"I/O recursion"
);
f__fatal
(
131
,
"I/O recursion"
);
if
(
a
->
aunit
>=
MXUNIT
||
a
->
aunit
<
0
)
if
(
a
->
aunit
>=
MXUNIT
||
a
->
aunit
<
0
)
err
(
a
->
aerr
,
101
,
"backspace"
);
err
(
a
->
aerr
,
101
,
"backspace"
);
b
=
&
f__units
[
a
->
aunit
];
f__curunit
=
b
=
&
f__units
[
a
->
aunit
];
/* curunit for error messages */
if
(
b
->
useek
==
0
)
err
(
a
->
aerr
,
106
,
"backspace"
);
if
(
b
->
useek
==
0
)
err
(
a
->
aerr
,
106
,
"backspace"
);
if
(
b
->
ufd
==
NULL
)
{
if
(
(
f
=
b
->
ufd
)
==
NULL
)
{
fk_open
(
1
,
1
,
a
->
aunit
);
fk_open
(
1
,
1
,
a
->
aunit
);
return
(
0
);
return
(
0
);
}
}
...
@@ -36,67 +32,41 @@ integer f_back(alist *a)
...
@@ -36,67 +32,41 @@ integer f_back(alist *a)
}
}
if
(
b
->
url
>
0
)
if
(
b
->
url
>
0
)
{
{
x
=
ftell
(
b
->
ufd
);
x
=
ftell
(
f
);
y
=
x
%
b
->
url
;
y
=
x
%
b
->
url
;
if
(
y
==
0
)
x
--
;
if
(
y
==
0
)
x
--
;
x
/=
b
->
url
;
x
/=
b
->
url
;
x
*=
b
->
url
;
x
*=
b
->
url
;
(
void
)
fseek
(
b
->
ufd
,
x
,
SEEK_SET
);
(
void
)
fseek
(
f
,
x
,
SEEK_SET
);
return
(
0
);
return
(
0
);
}
}
if
(
b
->
ufmt
==
0
)
if
(
b
->
ufmt
==
0
)
{
(
void
)
fseek
(
b
->
ufd
,
-
(
long
)
sizeof
(
uiolen
),
SEEK_CUR
);
{
fseek
(
f
,
-
(
long
)
sizeof
(
uiolen
),
SEEK_CUR
);
(
void
)
fread
((
char
*
)
&
n
,
sizeof
(
uiolen
),
1
,
b
->
ufd
);
fread
((
char
*
)
&
n
,
sizeof
(
uiolen
),
1
,
f
);
(
void
)
fseek
(
b
->
ufd
,
-
(
long
)
n
-
2
*
sizeof
(
uiolen
),
SEEK_CUR
);
fseek
(
f
,
-
(
long
)
n
-
2
*
sizeof
(
uiolen
),
SEEK_CUR
);
return
(
0
);
return
(
0
);
}
}
#if defined (MSDOS) && !defined (GO32)
w
=
x
=
ftell
(
f
);
w
=
-
1
;
z
=
0
;
#endif
loop
:
for
(
ndec
=
1
;;
ndec
=
0
)
while
(
x
)
{
{
x
-=
x
<
64
?
x
:
64
;
y
=
x
=
ftell
(
b
->
ufd
);
fseek
(
f
,
x
,
SEEK_SET
);
if
(
x
<
sizeof
(
buf
))
for
(
y
=
x
;
y
<
w
;
y
++
)
{
x
=
0
;
if
(
getc
(
f
)
!=
'\n'
)
else
continue
;
x
-=
sizeof
(
buf
);
v
=
ftell
(
f
);
(
void
)
fseek
(
b
->
ufd
,
x
,
SEEK_SET
);
if
(
v
==
w
)
{
n
=
fread
(
buf
,
1
,(
size_t
)(
y
-
x
),
b
->
ufd
);
if
(
z
)
for
(
i
=
n
-
ndec
;
--
i
>=
0
;
)
goto
break2
;
{
goto
loop
;
if
(
buf
[
i
]
!=
'\n'
)
continue
;
}
#if defined (MSDOS) && !defined (GO32)
z
=
v
;
for
(
j
=
k
=
0
;
j
<=
i
;
j
++
)
}
if
(
buf
[
j
]
==
'\n'
)
err
(
a
->
aerr
,(
EOF
),
"backspace"
);
k
++
;
fseek
(
b
->
ufd
,
x
,
SEEK_SET
);
for
(;;)
if
(
getc
(
b
->
ufd
)
==
'\n'
)
{
if
((
z
=
ftell
(
b
->
ufd
))
>=
y
&&
ndec
)
{
if
(
w
==
-
1
)
goto
break2
;
break
;
}
if
(
--
k
<=
0
)
return
0
;
w
=
z
;
}
fseek
(
b
->
ufd
,
w
,
SEEK_SET
);
#else
fseek
(
b
->
ufd
,(
long
)(
i
+
1
-
n
),
SEEK_CUR
);
#endif
return
(
0
);
}
}
#if defined (MSDOS) && !defined (GO32)
break2
:
break2
:
#endif
fseek
(
f
,
z
,
SEEK_SET
);
if
(
x
==
0
)
return
0
;
{
(
void
)
fseek
(
b
->
ufd
,
0L
,
SEEK_SET
);
return
(
0
);
}
else
if
(
n
<=
0
)
err
(
a
->
aerr
,(
EOF
),
"backspace"
);
(
void
)
fseek
(
b
->
ufd
,
x
,
SEEK_SET
);
}
}
}
libf2c/libI77/close.c
View file @
a843efa0
...
@@ -33,11 +33,10 @@ integer f_clos(cllist *a)
...
@@ -33,11 +33,10 @@ integer f_clos(cllist *a)
b
=
&
f__units
[
a
->
cunit
];
b
=
&
f__units
[
a
->
cunit
];
if
(
b
->
ufd
==
NULL
)
if
(
b
->
ufd
==
NULL
)
goto
done
;
goto
done
;
if
(
b
->
uscrtch
==
1
)
goto
Delete
;
if
(
!
a
->
csta
)
if
(
!
a
->
csta
)
if
(
b
->
uscrtch
==
1
)
goto
Keep
;
goto
Delete
;
else
goto
Keep
;
switch
(
*
a
->
csta
)
{
switch
(
*
a
->
csta
)
{
default
:
default
:
Keep
:
Keep
:
...
@@ -53,8 +52,8 @@ integer f_clos(cllist *a)
...
@@ -53,8 +52,8 @@ integer f_clos(cllist *a)
case
'd'
:
case
'd'
:
case
'D'
:
case
'D'
:
Delete
:
Delete
:
fclose
(
b
->
ufd
);
if
(
b
->
ufnm
)
{
if
(
b
->
ufnm
)
{
fclose
(
b
->
ufd
);
unlink
(
b
->
ufnm
);
/*SYSDEP*/
unlink
(
b
->
ufnm
);
/*SYSDEP*/
free
(
b
->
ufnm
);
free
(
b
->
ufnm
);
}
}
...
...
libf2c/libI77/dfe.c
View file @
a843efa0
...
@@ -31,41 +31,30 @@ y_getc(Void)
...
@@ -31,41 +31,30 @@ y_getc(Void)
}
}
err
(
f__elist
->
cierr
,
errno
,
"readingd"
);
err
(
f__elist
->
cierr
,
errno
,
"readingd"
);
}
}
#ifdef KR_headers
y_putc
(
c
)
static
int
#else
y_putc
(
int
c
)
#endif
{
f__recpos
++
;
if
(
f__recpos
<=
f__curunit
->
url
||
f__curunit
->
url
==
1
)
putc
(
c
,
f__cf
);
else
err
(
f__elist
->
cierr
,
110
,
"dout"
);
return
(
0
);
}
y_rev
(
Void
)
y_rev
(
Void
)
{
/*what about work done?*/
{
if
(
f__curunit
->
url
==
1
||
f__recpos
==
f__curunit
->
url
)
if
(
f__recpos
<
f__hiwater
)
return
(
0
);
f__recpos
=
f__hiwater
;
while
(
f__recpos
<
f__curunit
->
url
)
if
(
f__curunit
->
url
>
1
)
(
*
f__putn
)(
' '
);
while
(
f__recpos
<
f__curunit
->
url
)
f__recpos
=
0
;
(
*
f__putn
)(
' '
);
if
(
f__recpos
)
f__putbuf
(
0
);
f__recpos
=
0
;
return
(
0
);
return
(
0
);
}
}
static
int
y_err
(
Void
)
y_err
(
Void
)
{
{
err
(
f__elist
->
cierr
,
110
,
"dfe"
);
err
(
f__elist
->
cierr
,
110
,
"dfe"
);
}
}
static
int
y_newrec
(
Void
)
y_newrec
(
Void
)
{
{
if
(
f__curunit
->
url
==
1
||
f__recpos
==
f__curunit
->
url
)
{
f__hiwater
=
f__recpos
=
f__cursor
=
0
;
return
(
1
);
}
if
(
f__hiwater
>
f__recpos
)
f__recpos
=
f__hiwater
;
y_rev
();
y_rev
();
f__hiwater
=
f__cursor
=
0
;
f__hiwater
=
f__cursor
=
0
;
return
(
1
);
return
(
1
);
...
@@ -132,7 +121,7 @@ integer s_wdfe(cilist *a)
...
@@ -132,7 +121,7 @@ integer s_wdfe(cilist *a)
if
(
n
=
c_dfe
(
a
))
return
(
n
);
if
(
n
=
c_dfe
(
a
))
return
(
n
);
if
(
f__curunit
->
uwrt
!=
1
&&
f__nowwriting
(
f__curunit
))
if
(
f__curunit
->
uwrt
!=
1
&&
f__nowwriting
(
f__curunit
))
err
(
a
->
cierr
,
errno
,
"startwrt"
);
err
(
a
->
cierr
,
errno
,
"startwrt"
);
f__putn
=
y
_putc
;
f__putn
=
x
_putc
;
f__doed
=
w_ed
;
f__doed
=
w_ed
;
f__doned
=
w_ned
;
f__doned
=
w_ned
;
f__dorevert
=
y_err
;
f__dorevert
=
y_err
;
...
@@ -146,11 +135,6 @@ integer s_wdfe(cilist *a)
...
@@ -146,11 +135,6 @@ integer s_wdfe(cilist *a)
integer
e_rdfe
(
Void
)
integer
e_rdfe
(
Void
)
{
{
f__init
=
1
;
f__init
=
1
;
(
void
)
en_fio
();
en_fio
();
return
(
0
);
return
(
0
);
}
}
integer
e_wdfe
(
Void
)
{
f__init
=
1
;
return
en_fio
();
}
libf2c/libI77/endfile.c
View file @
a843efa0
#include "f2c.h"
#include "f2c.h"
#include "fio.h"
#include "fio.h"
#include <sys/types.h>
#include "rawio.h"
#ifdef KR_headers
#ifdef KR_headers
extern
char
*
strcpy
();
extern
char
*
strcpy
();
extern
FILE
*
tmpfile
();
#else
#else
#undef abs
#undef abs
#undef min
#undef min
...
@@ -13,19 +12,7 @@ extern char *strcpy();
...
@@ -13,19 +12,7 @@ extern char *strcpy();
#include <string.h>
#include <string.h>
#endif
#endif
#ifdef NON_UNIX_STDIO
#ifndef unlink
#define unlink remove
#endif
#else
#if defined (MSDOS) && !defined (GO32)
#include "io.h"
#endif
#endif
#ifdef NON_UNIX_STDIO
extern
char
*
f__r_mode
[],
*
f__w_mode
[];
extern
char
*
f__r_mode
[],
*
f__w_mode
[];
#endif
#ifdef KR_headers
#ifdef KR_headers
integer
f_end
(
a
)
alist
*
a
;
integer
f_end
(
a
)
alist
*
a
;
...
@@ -34,21 +21,17 @@ integer f_end(alist *a)
...
@@ -34,21 +21,17 @@ integer f_end(alist *a)
#endif
#endif
{
{
unit
*
b
;
unit
*
b
;
FILE
*
tf
;
if
(
f__init
&
2
)
if
(
f__init
&
2
)
f__fatal
(
131
,
"I/O recursion"
);
f__fatal
(
131
,
"I/O recursion"
);
if
(
a
->
aunit
>=
MXUNIT
||
a
->
aunit
<
0
)
err
(
a
->
aerr
,
101
,
"endfile"
);
if
(
a
->
aunit
>=
MXUNIT
||
a
->
aunit
<
0
)
err
(
a
->
aerr
,
101
,
"endfile"
);
b
=
&
f__units
[
a
->
aunit
];
b
=
&
f__units
[
a
->
aunit
];
if
(
b
->
ufd
==
NULL
)
{
if
(
b
->
ufd
==
NULL
)
{
char
nbuf
[
10
];
char
nbuf
[
10
];
(
void
)
sprintf
(
nbuf
,
"fort.%ld"
,
a
->
aunit
);
sprintf
(
nbuf
,
"fort.%ld"
,
a
->
aunit
);
#ifdef NON_UNIX_STDIO
if
(
tf
=
fopen
(
nbuf
,
f__w_mode
[
0
]))
{
FILE
*
tf
;
fclose
(
tf
);
if
(
tf
=
fopen
(
nbuf
,
f__w_mode
[
0
]))
fclose
(
tf
);
}
#else
close
(
creat
(
nbuf
,
0666
));
#endif
return
(
0
);
return
(
0
);
}
}
b
->
uend
=
1
;
b
->
uend
=
1
;
...
@@ -56,14 +39,13 @@ integer f_end(alist *a)
...
@@ -56,14 +39,13 @@ integer f_end(alist *a)
}
}
static
int
static
int
#ifdef NON_UNIX_STDIO
#ifdef KR_headers
#ifdef KR_headers
copy
(
from
,
len
,
to
)
char
*
from
,
*
to
;
register
long
len
;
copy
(
from
,
len
,
to
)
FILE
*
from
,
*
to
;
register
long
len
;
#else
#else
copy
(
FILE
*
from
,
register
long
len
,
FILE
*
to
)
copy
(
FILE
*
from
,
register
long
len
,
FILE
*
to
)
#endif
#endif
{
{
int
k
,
len1
;
int
len1
;
char
buf
[
BUFSIZ
];
char
buf
[
BUFSIZ
];
while
(
fread
(
buf
,
len1
=
len
>
BUFSIZ
?
BUFSIZ
:
(
int
)
len
,
1
,
from
))
{
while
(
fread
(
buf
,
len1
=
len
>
BUFSIZ
?
BUFSIZ
:
(
int
)
len
,
1
,
from
))
{
...
@@ -74,36 +56,6 @@ copy(FILE *from, register long len, FILE *to)
...
@@ -74,36 +56,6 @@ copy(FILE *from, register long len, FILE *to)
}
}
return
0
;
return
0
;
}
}
#else
#ifdef KR_headers
copy
(
from
,
len
,
to
)
char
*
from
,
*
to
;
register
long
len
;
#else
copy
(
char
*
from
,
register
long
len
,
char
*
to
)
#endif
{
register
size_t
n
;
int
k
,
rc
=
0
,
tmp
;
char
buf
[
BUFSIZ
];
if
((
k
=
open
(
from
,
O_RDONLY
))
<
0
)
return
1
;
if
((
tmp
=
creat
(
to
,
0666
))
<
0
)
return
1
;
while
((
n
=
read
(
k
,
buf
,
(
size_t
)
(
len
>
BUFSIZ
?
BUFSIZ
:
(
int
)
len
)))
>
0
)
{
if
(
write
(
tmp
,
buf
,
n
)
!=
n
)
{
rc
=
1
;
break
;
}
if
((
len
-=
n
)
<=
0
)
break
;
}
close
(
k
);
close
(
tmp
);
return
n
<
0
?
1
:
rc
;
}
#endif
#ifndef L_tmpnam
#define L_tmpnam 16
#endif
int
int
#ifdef KR_headers
#ifdef KR_headers
...
@@ -112,14 +64,9 @@ t_runc(a) alist *a;
...
@@ -112,14 +64,9 @@ t_runc(a) alist *a;
t_runc
(
alist
*
a
)
t_runc
(
alist
*
a
)
#endif
#endif
{
{
char
nm
[
L_tmpnam
+
12
];
/* extra space in case L_tmpnam is tiny */
long
loc
,
len
;
long
loc
,
len
;
unit
*
b
;
unit
*
b
;
#ifdef NON_UNIX_STDIO
FILE
*
bf
,
*
tf
;
FILE
*
bf
,
*
tf
;
#else
FILE
*
bf
;
#endif
int
rc
=
0
;
int
rc
=
0
;
b
=
&
f__units
[
a
->
aunit
];
b
=
&
f__units
[
a
->
aunit
];
...
@@ -130,36 +77,20 @@ t_runc(alist *a)
...
@@ -130,36 +77,20 @@ t_runc(alist *a)
len
=
ftell
(
bf
);
len
=
ftell
(
bf
);
if
(
loc
>=
len
||
b
->
useek
==
0
||
b
->
ufnm
==
NULL
)
if
(
loc
>=
len
||
b
->
useek
==
0
||
b
->
ufnm
==
NULL
)
return
(
0
);
return
(
0
);
#ifdef NON_UNIX_STDIO
fclose
(
b
->
ufd
);
fclose
(
b
->
ufd
);
#else
rewind
(
b
->
ufd
);
/* empty buffer */
#endif
if
(
!
loc
)
{
if
(
!
loc
)
{
#ifdef NON_UNIX_STDIO
if
(
!
(
bf
=
fopen
(
b
->
ufnm
,
f__w_mode
[
b
->
ufmt
])))
if
(
!
(
bf
=
fopen
(
b
->
ufnm
,
f__w_mode
[
b
->
ufmt
])))
#else
if
(
close
(
creat
(
b
->
ufnm
,
0666
)))
#endif
rc
=
1
;
rc
=
1
;
if
(
b
->
uwrt
)
if
(
b
->
uwrt
)
b
->
uwrt
=
1
;
b
->
uwrt
=
1
;
goto
done
;
goto
done
;
}
}
#ifdef _POSIX_SOURCE
if
(
!
(
bf
=
fopen
(
b
->
ufnm
,
f__r_mode
[
0
]))
tmpnam
(
nm
);
||
!
(
tf
=
tmpfile
()))
{
#else
strcpy
(
nm
,
"tmp.FXXXXXX"
);
mktemp
(
nm
);
#endif
#ifdef NON_UNIX_STDIO
if
(
!
(
bf
=
fopen
(
b
->
ufnm
,
f__r_mode
[
0
])))
{
bad
:
bad
:
rc
=
1
;
rc
=
1
;
goto
done
;
goto
done
;
}
}
if
(
!
(
tf
=
fopen
(
nm
,
f__w_mode
[
0
])))
goto
bad
;
if
(
copy
(
bf
,
loc
,
tf
))
{
if
(
copy
(
bf
,
loc
,
tf
))
{
bad1
:
bad1
:
rc
=
1
;
rc
=
1
;
...
@@ -167,28 +98,23 @@ t_runc(alist *a)
...
@@ -167,28 +98,23 @@ t_runc(alist *a)
}
}
if
(
!
(
bf
=
freopen
(
b
->
ufnm
,
f__w_mode
[
0
],
bf
)))
if
(
!
(
bf
=
freopen
(
b
->
ufnm
,
f__w_mode
[
0
],
bf
)))
goto
bad1
;
goto
bad1
;
if
(
!
(
tf
=
freopen
(
nm
,
f__r_mode
[
0
],
tf
)))
rewind
(
tf
);
goto
bad1
;
if
(
copy
(
tf
,
loc
,
bf
))
if
(
copy
(
tf
,
loc
,
bf
))
goto
bad1
;
goto
bad1
;
if
(
f__w_mode
[
0
]
!=
f__w_mode
[
b
->
ufmt
])
{
b
->
urw
=
2
;
if
(
!
(
bf
=
freopen
(
b
->
ufnm
,
f__w_mode
[
b
->
ufmt
|
2
],
bf
)))
#ifdef NON_UNIX_STDIO
goto
bad1
;
if
(
b
->
ufmt
)
{
fseek
(
bf
,
loc
,
SEEK_SET
);
fclose
(
bf
);
if
(
!
(
bf
=
fopen
(
b
->
ufnm
,
f__w_mode
[
3
])))
goto
bad
;
fseek
(
bf
,
0L
,
SEEK_END
);
b
->
urw
=
3
;
}
}
#endif
done1
:
done1
:
fclose
(
tf
);
fclose
(
tf
);
unlink
(
nm
);
done
:
done
:
f__cf
=
b
->
ufd
=
bf
;
f__cf
=
b
->
ufd
=
bf
;
#else
if
(
copy
(
b
->
ufnm
,
loc
,
nm
)
||
copy
(
nm
,
loc
,
b
->
ufnm
))
rc
=
1
;
unlink
(
nm
);
fseek
(
b
->
ufd
,
loc
,
SEEK_SET
);
done
:
#endif
if
(
rc
)
if
(
rc
)
err
(
a
->
aerr
,
111
,
"endfile"
);
err
(
a
->
aerr
,
111
,
"endfile"
);
return
0
;
return
0
;
...
...
libf2c/libI77/err.c
View file @
a843efa0
#ifndef NON_UNIX_STDIO
#ifndef NON_UNIX_STDIO
#define _INCLUDE_POSIX_SOURCE
/* for HP-UX */
#define _INCLUDE_XOPEN_SOURCE
/* for HP-UX */
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#endif
#endif
#include "f2c.h"
#include "f2c.h"
#if defined (NON_UNIX_STDIO) || defined (MISSING_FILE_ELEMS)
#ifdef KR_headers
#ifdef KR_headers
extern
char
*
malloc
();
extern
char
*
malloc
();
#else
#else
...
@@ -12,10 +13,8 @@ extern char *malloc();
...
@@ -12,10 +13,8 @@ extern char *malloc();
#undef max
#undef max
#include <stdlib.h>
#include <stdlib.h>
#endif
#endif
#endif
#include "fio.h"
#include "fio.h"
#include "fmt.h"
/* for struct syl */
#include "fmt.h"
/* for struct syl */
#include "rawio.h"
/* for fcntl.h, fdopen */
/*global definitions*/
/*global definitions*/
unit
f__units
[
MXUNIT
];
/*unit table*/
unit
f__units
[
MXUNIT
];
/*unit table*/
...
@@ -32,9 +31,11 @@ flag f__external; /*1 if external io, 0 if internal */
...
@@ -32,9 +31,11 @@ flag f__external; /*1 if external io, 0 if internal */
#ifdef KR_headers
#ifdef KR_headers
int
(
*
f__doed
)(),(
*
f__doned
)();
int
(
*
f__doed
)(),(
*
f__doned
)();
int
(
*
f__doend
)(),(
*
f__donewrec
)(),(
*
f__dorevert
)();
int
(
*
f__doend
)(),(
*
f__donewrec
)(),(
*
f__dorevert
)();
int
(
*
f__getn
)(),(
*
f__putn
)();
/*for formatted io*/
int
(
*
f__getn
)();
/* for formatted input */
void
(
*
f__putn
)();
/* for formatted output */
#else
#else
int
(
*
f__getn
)(
void
),(
*
f__putn
)(
int
);
/*for formatted io*/
int
(
*
f__getn
)(
void
);
/* for formatted input */
void
(
*
f__putn
)(
int
);
/* for formatted output */
int
(
*
f__doed
)(
struct
syl
*
,
char
*
,
ftnlen
),(
*
f__doned
)(
struct
syl
*
);
int
(
*
f__doed
)(
struct
syl
*
,
char
*
,
ftnlen
),(
*
f__doned
)(
struct
syl
*
);
int
(
*
f__dorevert
)(
void
),(
*
f__donewrec
)(
void
),(
*
f__doend
)(
void
);
int
(
*
f__dorevert
)(
void
),(
*
f__donewrec
)(
void
),(
*
f__doend
)(
void
);
#endif
#endif
...
@@ -188,15 +189,6 @@ f_init(Void)
...
@@ -188,15 +189,6 @@ f_init(Void)
p
=
&
f__units
[
0
];
p
=
&
f__units
[
0
];
p
->
ufd
=
stderr
;
p
->
ufd
=
stderr
;
p
->
useek
=
f__canseek
(
stderr
);
p
->
useek
=
f__canseek
(
stderr
);
#ifdef _IOLBF
setvbuf
(
stderr
,
(
char
*
)
malloc
(
BUFSIZ
+
8
),
_IOLBF
,
BUFSIZ
+
8
);
#else
#if defined (NON_UNIX_STDIO) || defined (MISSING_FILE_ELEMS)
setbuf
(
stderr
,
(
char
*
)
malloc
(
BUFSIZ
+
8
));
#else
stderr
->
_flag
&=
~
_IONBF
;
#endif
#endif
p
->
ufmt
=
1
;
p
->
ufmt
=
1
;
p
->
uwrt
=
1
;
p
->
uwrt
=
1
;
p
=
&
f__units
[
5
];
p
=
&
f__units
[
5
];
...
@@ -217,21 +209,29 @@ f__nowreading(unit *x)
...
@@ -217,21 +209,29 @@ f__nowreading(unit *x)
#endif
#endif
{
{
long
loc
;
long
loc
;
int
ufmt
;
int
ufmt
,
urw
;
extern
char
*
f__r_mode
[];
extern
char
*
f__r_mode
[]
,
*
f__w_mode
[]
;
if
(
x
->
urw
&
1
)
goto
done
;
if
(
!
x
->
ufnm
)
if
(
!
x
->
ufnm
)
goto
cantread
;
goto
cantread
;
ufmt
=
x
->
ufmt
;
ufmt
=
x
->
url
?
0
:
x
->
ufmt
;
loc
=
ftell
(
x
->
ufd
);
loc
=
ftell
(
x
->
ufd
);
if
(
freopen
(
x
->
ufnm
,
f__r_mode
[
ufmt
],
x
->
ufd
)
==
NULL
)
{
urw
=
3
;
if
(
!
freopen
(
x
->
ufnm
,
f__w_mode
[
ufmt
|
2
],
x
->
ufd
))
{
urw
=
1
;
if
(
!
freopen
(
x
->
ufnm
,
f__r_mode
[
ufmt
],
x
->
ufd
))
{
cantread
:
cantread
:
errno
=
126
;
errno
=
126
;
return
(
1
);
return
1
;
}
}
}
x
->
uwrt
=
0
;
fseek
(
x
->
ufd
,
loc
,
SEEK_SET
);
(
void
)
fseek
(
x
->
ufd
,
loc
,
SEEK_SET
);
x
->
urw
=
urw
;
return
(
0
);
done
:
x
->
uwrt
=
0
;
return
0
;
}
}
#ifdef KR_headers
#ifdef KR_headers
f__nowwriting
(
x
)
unit
*
x
;
f__nowwriting
(
x
)
unit
*
x
;
...
@@ -242,46 +242,34 @@ f__nowwriting(unit *x)
...
@@ -242,46 +242,34 @@ f__nowwriting(unit *x)
long
loc
;
long
loc
;
int
ufmt
;
int
ufmt
;
extern
char
*
f__w_mode
[];
extern
char
*
f__w_mode
[];
#ifndef NON_UNIX_STDIO
int
k
;
#endif
if
(
x
->
urw
&
2
)
goto
done
;
if
(
!
x
->
ufnm
)
if
(
!
x
->
ufnm
)
goto
cantwrite
;
goto
cantwrite
;
ufmt
=
x
->
ufmt
;
ufmt
=
x
->
url
?
0
:
x
->
ufmt
;
#ifdef NON_UNIX_STDIO
ufmt
|=
2
;
#endif
if
(
x
->
uwrt
==
3
)
{
/* just did write, rewind */
if
(
x
->
uwrt
==
3
)
{
/* just did write, rewind */
#ifdef NON_UNIX_STDIO
if
(
!
(
f__cf
=
x
->
ufd
=
if
(
!
(
f__cf
=
x
->
ufd
=
freopen
(
x
->
ufnm
,
f__w_mode
[
ufmt
],
x
->
ufd
)))
freopen
(
x
->
ufnm
,
f__w_mode
[
ufmt
],
x
->
ufd
)))
#else
if
(
close
(
creat
(
x
->
ufnm
,
0666
)))
#endif
goto
cantwrite
;
goto
cantwrite
;
x
->
urw
=
2
;
}
}
else
{
else
{
loc
=
ftell
(
x
->
ufd
);
loc
=
ftell
(
x
->
ufd
);
#ifdef NON_UNIX_STDIO
if
(
!
(
f__cf
=
x
->
ufd
=
if
(
!
(
f__cf
=
x
->
ufd
=
freopen
(
x
->
ufnm
,
f__w_mode
[
ufmt
],
x
->
ufd
)))
freopen
(
x
->
ufnm
,
f__w_mode
[
ufmt
|=
2
],
x
->
ufd
)))
#else
if
(
fclose
(
x
->
ufd
)
<
0
||
(
k
=
x
->
uwrt
==
2
?
creat
(
x
->
ufnm
,
0666
)
:
open
(
x
->
ufnm
,
O_WRONLY
))
<
0
||
(
f__cf
=
x
->
ufd
=
fdopen
(
k
,
f__w_mode
[
ufmt
]))
==
NULL
)
#endif
{
{
x
->
ufd
=
NULL
;
x
->
ufd
=
NULL
;
cantwrite
:
cantwrite
:
errno
=
127
;
errno
=
127
;
return
(
1
);
return
(
1
);
}
}
(
void
)
fseek
(
x
->
ufd
,
loc
,
SEEK_SET
);
x
->
urw
=
3
;
fseek
(
x
->
ufd
,
loc
,
SEEK_SET
);
}
}
done
:
x
->
uwrt
=
1
;
x
->
uwrt
=
1
;
return
(
0
)
;
return
0
;
}
}
int
int
...
...
libf2c/libI77/fio.h
View file @
a843efa0
...
@@ -37,7 +37,7 @@ typedef struct
...
@@ -37,7 +37,7 @@ typedef struct
int
url
;
/*0=sequential*/
int
url
;
/*0=sequential*/
flag
useek
;
/*true=can backspace, use dir, ...*/
flag
useek
;
/*true=can backspace, use dir, ...*/
flag
ufmt
;
flag
ufmt
;
flag
u
prnt
;
flag
u
rw
;
/* (1 for can read) | (2 for can write) */
flag
ublnk
;
flag
ublnk
;
flag
uend
;
flag
uend
;
flag
uwrt
;
/*last io was write*/
flag
uwrt
;
/*last io was write*/
...
@@ -50,17 +50,21 @@ extern flag f__reading,f__external,f__sequential,f__formatted;
...
@@ -50,17 +50,21 @@ extern flag f__reading,f__external,f__sequential,f__formatted;
#undef Void
#undef Void
#ifdef KR_headers
#ifdef KR_headers
#define Void
/*void*/
#define Void
/*void*/
extern
int
(
*
f__getn
)(),(
*
f__putn
)();
/*for formatted io*/
extern
int
(
*
f__getn
)();
/* for formatted input */
extern
void
(
*
f__putn
)();
/* for formatted output */
extern
void
x_putc
();
extern
long
f__inode
();
extern
long
f__inode
();
extern
VOID
sig_die
();
extern
VOID
sig_die
();
extern
int
(
*
f__donewrec
)(),
t_putc
(),
x_wSL
();
extern
int
(
*
f__donewrec
)(),
t_putc
(),
x_wSL
();
extern
int
c_sfe
(),
err__fl
(),
xrd_SL
();
extern
int
c_sfe
(),
err__fl
(),
xrd_SL
()
,
f__putbuf
()
;
#else
#else
#define Void void
#define Void void
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
extern
int
(
*
f__getn
)(
void
),(
*
f__putn
)(
int
);
/*for formatted io*/
extern
int
(
*
f__getn
)(
void
);
/* for formatted input */
extern
void
(
*
f__putn
)(
int
);
/* for formatted output */
extern
void
x_putc
(
int
);
extern
long
f__inode
(
char
*
,
int
*
);
extern
long
f__inode
(
char
*
,
int
*
);
extern
void
sig_die
(
char
*
,
int
);
extern
void
sig_die
(
char
*
,
int
);
extern
void
f__fatal
(
int
,
char
*
);
extern
void
f__fatal
(
int
,
char
*
);
...
@@ -75,6 +79,7 @@ extern int c_sfe(cilist*), z_rnew(void);
...
@@ -75,6 +79,7 @@ extern int c_sfe(cilist*), z_rnew(void);
extern
int
isatty
(
int
);
extern
int
isatty
(
int
);
extern
int
err__fl
(
int
,
int
,
char
*
);
extern
int
err__fl
(
int
,
int
,
char
*
);
extern
int
xrd_SL
(
void
);
extern
int
xrd_SL
(
void
);
extern
int
f__putbuf
(
int
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
libf2c/libI77/iio.c
View file @
a843efa0
...
@@ -14,17 +14,16 @@ z_getc(Void)
...
@@ -14,17 +14,16 @@ z_getc(Void)
}
}
return
'\n'
;
return
'\n'
;
}
}
void
#ifdef KR_headers
#ifdef KR_headers
z_putc
(
c
)
z_putc
(
c
)
#else
#else
z_putc
(
int
c
)
z_putc
(
int
c
)
#endif
#endif
{
{
if
(
f__icptr
>=
f__icend
)
err
(
f__svic
->
icierr
,
110
,
"inwrite"
);
if
(
f__icptr
<
f__icend
&&
f__recpos
++
<
f__svic
->
icirlen
)
if
(
f__recpos
++
<
f__svic
->
icirlen
)
*
f__icptr
++
=
c
;
*
f__icptr
++
=
c
;
else
err
(
f__svic
->
icierr
,
110
,
"recend"
);
return
0
;
}
}
z_rnew
(
Void
)
z_rnew
(
Void
)
{
{
...
@@ -139,10 +138,17 @@ integer e_wsfi(Void)
...
@@ -139,10 +138,17 @@ integer e_wsfi(Void)
f__init
&=
~
2
;
f__init
&=
~
2
;
n
=
en_fio
();
n
=
en_fio
();
f__fmtbuf
=
NULL
;
f__fmtbuf
=
NULL
;
if
(
f__icnum
>=
f__svic
->
icirnum
if
(
f__svic
->
icirnum
!=
1
||
!
f__recpos
&&
f__icnum
)
&&
(
f__icnum
>
f__svic
->
icirnum
return
(
n
);
||
(
f__icnum
==
f__svic
->
icirnum
&&
(
f__recpos
|
f__hiwater
))))
err
(
f__svic
->
icierr
,
110
,
"inwrite"
);
if
(
f__recpos
<
f__hiwater
)
f__recpos
=
f__hiwater
;
if
(
f__recpos
>=
f__svic
->
icirlen
)
err
(
f__svic
->
icierr
,
110
,
"recend"
);
if
(
!
f__recpos
&&
f__icnum
)
return
n
;
while
(
f__recpos
++
<
f__svic
->
icirlen
)
while
(
f__recpos
++
<
f__svic
->
icirlen
)
*
f__icptr
++
=
' '
;
*
f__icptr
++
=
' '
;
return
(
n
)
;
return
n
;
}
}
libf2c/libI77/ilnw.c
View file @
a843efa0
...
@@ -6,9 +6,9 @@ extern char *f__icend;
...
@@ -6,9 +6,9 @@ extern char *f__icend;
extern
icilist
*
f__svic
;
extern
icilist
*
f__svic
;
extern
int
f__icnum
;
extern
int
f__icnum
;
#ifdef KR_headers
#ifdef KR_headers
extern
int
z_putc
();
extern
void
z_putc
();
#else
#else
extern
int
z_putc
(
int
);
extern
void
z_putc
(
int
);
#endif
#endif
static
int
static
int
...
@@ -19,7 +19,7 @@ z_wSL(Void)
...
@@ -19,7 +19,7 @@ z_wSL(Void)
return
z_rnew
();
return
z_rnew
();
}
}
VOID
static
void
#ifdef KR_headers
#ifdef KR_headers
c_liw
(
a
)
icilist
*
a
;
c_liw
(
a
)
icilist
*
a
;
#else
#else
...
...
libf2c/libI77/lread.c
View file @
a843efa0
...
@@ -622,7 +622,7 @@ l_read(ftnint *number, char *ptr, ftnlen len, ftnint type)
...
@@ -622,7 +622,7 @@ l_read(ftnint *number, char *ptr, ftnlen len, ftnint type)
break
;
break
;
case
TYLOGICAL
:
case
TYLOGICAL
:
case
TYLONG
:
case
TYLONG
:
Ptr
->
flint
=
f__lx
;
Ptr
->
flint
=
(
ftnint
)
f__lx
;
break
;
break
;
#ifdef Allow_TYQUAD
#ifdef Allow_TYQUAD
case
TYQUAD
:
case
TYQUAD
:
...
...
libf2c/libI77/lwrite.c
View file @
a843efa0
...
@@ -13,16 +13,6 @@ donewrec(Void)
...
@@ -13,16 +13,6 @@ donewrec(Void)
(
*
f__donewrec
)();
(
*
f__donewrec
)();
}
}
#ifdef KR_headers
t_putc
(
c
)
#else
t_putc
(
int
c
)
#endif
{
f__recpos
++
;
putc
(
c
,
f__cf
);
return
(
0
);
}
static
VOID
static
VOID
#ifdef KR_headers
#ifdef KR_headers
lwrt_I
(
n
)
longint
n
;
lwrt_I
(
n
)
longint
n
;
...
@@ -184,10 +174,12 @@ l_put(register char *s)
...
@@ -184,10 +174,12 @@ l_put(register char *s)
#endif
#endif
{
{
#ifdef KR_headers
#ifdef KR_headers
register
int
c
,
(
*
pn
)()
=
f__putn
;
register
void
(
*
pn
)()
=
f__putn
;
#else
#else
register
int
c
,
(
*
pn
)(
int
)
=
f__putn
;
register
void
(
*
pn
)(
int
)
=
f__putn
;
#endif
#endif
register
int
c
;
while
(
c
=
*
s
++
)
while
(
c
=
*
s
++
)
(
*
pn
)(
c
);
(
*
pn
)(
c
);
}
}
...
...
libf2c/libI77/open.c
View file @
a843efa0
#ifndef NON_UNIX_STDIO
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include "f2c.h"
#include "f2c.h"
#include "fio.h"
#include "fio.h"
#include <string.h>
#include <string.h>
#include "rawio.h"
#ifndef NON_POSIX_STDIO
#ifdef MSDOS
#include "io.h"
#else
#include "unistd.h"
/* for access */
#endif
#endif
#ifdef KR_headers
#ifdef KR_headers
extern
char
*
malloc
(),
*
mktemp
();
extern
char
*
malloc
();
#ifdef NON_ANSI_STDIO
extern
char
*
mktemp
();
#endif
extern
integer
f_clos
();
extern
integer
f_clos
();
#else
#else
#undef abs
#undef abs
...
@@ -27,44 +32,97 @@ char *f__r_mode[2] = {"rb", "r"};
...
@@ -27,44 +32,97 @@ char *f__r_mode[2] = {"rb", "r"};
char
*
f__w_mode
[
4
]
=
{
"wb"
,
"w"
,
"r+b"
,
"r+"
};
char
*
f__w_mode
[
4
]
=
{
"wb"
,
"w"
,
"r+b"
,
"r+"
};
#endif
#endif
static
char
f__buf0
[
400
],
*
f__buf
=
f__buf0
;
int
f__buflen
=
(
int
)
sizeof
(
f__buf0
);
static
void
#ifdef KR_headers
#ifdef KR_headers
f__
isdev
(
s
)
char
*
s
;
f__
bufadj
(
n
,
c
)
int
n
,
c
;
#else
#else
f__
isdev
(
char
*
s
)
f__
bufadj
(
int
n
,
int
c
)
#endif
#endif
{
{
#ifdef NON_UNIX_STDIO
unsigned
int
len
;
int
i
,
j
;
char
*
nbuf
,
*
s
,
*
t
,
*
te
;
i
=
open
(
s
,
O_RDONLY
);
if
(
f__buf
==
f__buf0
)
if
(
i
==
-
1
)
f__buflen
=
1024
;
return
0
;
while
(
f__buflen
<=
n
)
j
=
isatty
(
i
);
f__buflen
<<=
1
;
close
(
i
);
len
=
(
unsigned
int
)
f__buflen
;
return
j
;
if
(
len
!=
f__buflen
||
!
(
nbuf
=
(
char
*
)
malloc
(
len
)))
f__fatal
(
113
,
"malloc failure"
);
s
=
nbuf
;
t
=
f__buf
;
te
=
t
+
c
;
while
(
t
<
te
)
*
s
++
=
*
t
++
;
if
(
f__buf
!=
f__buf0
)
free
(
f__buf
);
f__buf
=
nbuf
;
}
int
#ifdef KR_headers
f__putbuf
(
c
)
int
c
;
#else
#else
struct
stat
x
;
f__putbuf
(
int
c
)
#endif
{
char
*
s
,
*
se
;
int
n
;
if
(
stat
(
s
,
&
x
)
==
-
1
)
return
(
0
);
if
(
f__hiwater
>
f__recpos
)
#ifdef S_IFMT
f__recpos
=
f__hiwater
;
switch
(
x
.
st_mode
&
S_IFMT
)
{
n
=
f__recpos
+
1
;
case
S_IFREG
:
if
(
n
>=
f__buflen
)
case
S_IFDIR
:
f__bufadj
(
n
,
f__recpos
);
return
(
0
);
s
=
f__buf
;
se
=
s
+
f__recpos
;
if
(
c
)
*
se
++
=
c
;
*
se
=
0
;
for
(;;)
{
fputs
(
s
,
f__cf
);
s
+=
strlen
(
s
);
if
(
s
>=
se
)
break
;
/* normally happens the first time */
putc
(
*
s
++
,
f__cf
);
}
}
return
0
;
}
void
#ifdef KR_headers
x_putc
(
c
)
#else
#else
#ifdef S_ISREG
x_putc
(
int
c
)
/* POSIX version */
if
(
S_ISREG
(
x
.
st_mode
)
||
S_ISDIR
(
x
.
st_mode
))
return
(
0
);
else
#else
Help
!
How
does
stat
work
on
this
system
?
#endif
#endif
#endif
return
(
1
);
{
if
(
f__recpos
>=
f__buflen
)
f__bufadj
(
f__recpos
,
f__buflen
);
f__buf
[
f__recpos
++
]
=
c
;
}
#define opnerr(f,m,s) \
do {if(f) {f__init &= ~2; errno= m;} else opn_err(m,s,a); return(m);} while(0)
static
void
#ifdef KR_headers
opn_err
(
m
,
s
,
a
)
int
m
;
char
*
s
;
olist
*
a
;
#else
opn_err
(
int
m
,
char
*
s
,
olist
*
a
)
#endif
#endif
}
{
if
(
a
->
ofnm
)
{
/* supply file name to error message */
if
(
a
->
ofnmlen
>=
f__buflen
)
f__bufadj
((
int
)
a
->
ofnmlen
,
0
);
g_char
(
a
->
ofnm
,
a
->
ofnmlen
,
f__curunit
->
ufnm
=
f__buf
);
}
f__fatal
(
m
,
s
);
}
#ifdef KR_headers
#ifdef KR_headers
integer
f_open
(
a
)
olist
*
a
;
integer
f_open
(
a
)
olist
*
a
;
#else
#else
...
@@ -75,11 +133,9 @@ integer f_open(olist *a)
...
@@ -75,11 +133,9 @@ integer f_open(olist *a)
char
buf
[
256
],
*
s
;
char
buf
[
256
],
*
s
;
cllist
x
;
cllist
x
;
int
ufmt
;
int
ufmt
;
#ifdef NON_UNIX_STDIO
FILE
*
tf
;
FILE
*
tf
;
#
else
#
ifndef NON_UNIX_STDIO
int
n
;
int
n
;
struct
stat
stb
;
#endif
#endif
if
(
f__init
!=
1
)
f_init
();
if
(
f__init
!=
1
)
f_init
();
if
(
a
->
ounit
>=
MXUNIT
||
a
->
ounit
<
0
)
if
(
a
->
ounit
>=
MXUNIT
||
a
->
ounit
<
0
)
...
@@ -95,7 +151,7 @@ integer f_open(olist *a)
...
@@ -95,7 +151,7 @@ integer f_open(olist *a)
#ifdef NON_UNIX_STDIO
#ifdef NON_UNIX_STDIO
if
(
b
->
ufnm
if
(
b
->
ufnm
&&
strlen
(
b
->
ufnm
)
==
a
->
ofnmlen
&&
strlen
(
b
->
ufnm
)
==
a
->
ofnmlen
&&
!
strncmp
(
b
->
ufnm
,
b
->
u
fnm
,
(
unsigned
)
a
->
ofnmlen
))
&&
!
strncmp
(
b
->
ufnm
,
a
->
o
fnm
,
(
unsigned
)
a
->
ofnmlen
))
goto
same
;
goto
same
;
#else
#else
g_char
(
a
->
ofnm
,
a
->
ofnmlen
,
buf
);
g_char
(
a
->
ofnm
,
a
->
ofnmlen
,
buf
);
...
@@ -124,25 +180,32 @@ integer f_open(olist *a)
...
@@ -124,25 +180,32 @@ integer f_open(olist *a)
if
(
a
->
ofnm
)
{
if
(
a
->
ofnm
)
{
g_char
(
a
->
ofnm
,
a
->
ofnmlen
,
buf
);
g_char
(
a
->
ofnm
,
a
->
ofnmlen
,
buf
);
if
(
!
buf
[
0
])
if
(
!
buf
[
0
])
err
(
a
->
oerr
,
107
,
"open"
);
opn
err
(
a
->
oerr
,
107
,
"open"
);
}
}
else
else
sprintf
(
buf
,
"fort.%ld"
,
a
->
ounit
);
sprintf
(
buf
,
"fort.%ld"
,
a
->
ounit
);
b
->
uscrtch
=
0
;
b
->
uscrtch
=
0
;
b
->
uend
=
0
;
b
->
uwrt
=
0
;
b
->
ufd
=
0
;
b
->
urw
=
3
;
switch
(
a
->
osta
?
*
a
->
osta
:
'u'
)
switch
(
a
->
osta
?
*
a
->
osta
:
'u'
)
{
{
case
'o'
:
case
'o'
:
case
'O'
:
case
'O'
:
#ifdef NON_UNIX_STDIO
#ifdef NON_POSIX_STDIO
if
(
access
(
buf
,
0
))
if
(
!
(
tf
=
fopen
(
buf
,
"r"
)))
opnerr
(
a
->
oerr
,
errno
,
"open"
);
fclose
(
tf
);
#else
#else
if
(
stat
(
buf
,
&
stb
))
if
(
access
(
buf
,
0
))
opnerr
(
a
->
oerr
,
errno
,
"open"
);
#endif
#endif
err
(
a
->
oerr
,
errno
,
"open"
);
break
;
break
;
case
's'
:
case
's'
:
case
'S'
:
case
'S'
:
b
->
uscrtch
=
1
;
b
->
uscrtch
=
1
;
#ifdef NON_ANSI_STDIO
#ifdef HAVE_TEMPNAM
/* Allow use of TMPDIR preferentially. */
#ifdef HAVE_TEMPNAM
/* Allow use of TMPDIR preferentially. */
s
=
tempnam
(
0
,
buf
);
s
=
tempnam
(
0
,
buf
);
if
(
strlen
(
s
)
>=
sizeof
(
buf
))
if
(
strlen
(
s
)
>=
sizeof
(
buf
))
...
@@ -158,71 +221,64 @@ integer f_open(olist *a)
...
@@ -158,71 +221,64 @@ integer f_open(olist *a)
#endif
#endif
#endif
/* ! defined (HAVE_TEMPNAM) */
#endif
/* ! defined (HAVE_TEMPNAM) */
goto
replace
;
goto
replace
;
#else
if
(
!
(
b
->
ufd
=
tmpfile
()))
opnerr
(
a
->
oerr
,
errno
,
"open"
);
b
->
ufnm
=
0
;
#ifndef NON_UNIX_STDIO
b
->
uinode
=
b
->
udev
=
-
1
;
#endif
b
->
useek
=
1
;
return
0
;
#endif
case
'n'
:
case
'n'
:
case
'N'
:
case
'N'
:
#ifdef NON_UNIX_STDIO
#ifdef NON_POSIX_STDIO
if
(
!
access
(
buf
,
0
))
if
((
tf
=
fopen
(
buf
,
"r"
))
||
(
tf
=
fopen
(
buf
,
"a"
)))
{
fclose
(
tf
);
opnerr
(
a
->
oerr
,
128
,
"open"
);
}
#else
#else
if
(
!
stat
(
buf
,
&
stb
))
if
(
!
access
(
buf
,
0
))
opnerr
(
a
->
oerr
,
128
,
"open"
);
#endif
#endif
err
(
a
->
oerr
,
128
,
"open"
);
/* no break */
/* no break */
case
'r'
:
/* Fortran 90 replace option */
case
'r'
:
/* Fortran 90 replace option */
case
'R'
:
case
'R'
:
#ifdef NON_ANSI_STDIO
replace
:
replace
:
#
ifdef NON_UNIX_STDIO
#
endif
if
(
tf
=
fopen
(
buf
,
f__w_mode
[
0
]))
if
(
tf
=
fopen
(
buf
,
f__w_mode
[
0
]))
fclose
(
tf
);
fclose
(
tf
);
#else
(
void
)
close
(
creat
(
buf
,
0666
));
#endif
}
}
b
->
ufnm
=
(
char
*
)
malloc
((
unsigned
int
)(
strlen
(
buf
)
+
1
));
b
->
ufnm
=
(
char
*
)
malloc
((
unsigned
int
)(
strlen
(
buf
)
+
1
));
if
(
b
->
ufnm
==
NULL
)
err
(
a
->
oerr
,
113
,
"no space"
);
if
(
b
->
ufnm
==
NULL
)
opn
err
(
a
->
oerr
,
113
,
"no space"
);
(
void
)
strcpy
(
b
->
ufnm
,
buf
);
(
void
)
strcpy
(
b
->
ufnm
,
buf
);
b
->
uend
=
0
;
if
((
s
=
a
->
oacc
)
&&
b
->
url
)
b
->
uwrt
=
0
;
#ifdef NON_UNIX_STDIO
if
((
s
=
a
->
oacc
)
&&
(
*
s
==
'd'
||
*
s
==
'D'
))
ufmt
=
0
;
ufmt
=
0
;
#endif
if
(
!
(
tf
=
fopen
(
buf
,
f__w_mode
[
ufmt
|
2
])))
{
if
(
f__isdev
(
buf
))
if
(
tf
=
fopen
(
buf
,
f__r_mode
[
ufmt
]))
{
b
->
ufd
=
fopen
(
buf
,
f__r_mode
[
ufmt
]);
b
->
urw
=
1
;
if
(
b
->
ufd
==
NULL
)
err
(
a
->
oerr
,
errno
,
buf
);
else
if
(
tf
=
fopen
(
buf
,
f__w_mode
[
ufmt
]))
{
}
b
->
uwrt
=
1
;
else
{
b
->
urw
=
2
;
if
(
!
(
b
->
ufd
=
fopen
(
buf
,
f__r_mode
[
ufmt
])))
{
#ifdef NON_UNIX_STDIO
if
(
b
->
ufd
=
fopen
(
buf
,
f__w_mode
[
ufmt
|
2
]))
b
->
uwrt
=
2
;
else
if
(
b
->
ufd
=
fopen
(
buf
,
f__w_mode
[
ufmt
]))
b
->
uwrt
=
1
;
else
#else
if
((
n
=
open
(
buf
,
O_WRONLY
))
>=
0
)
b
->
uwrt
=
2
;
else
{
n
=
creat
(
buf
,
0666
);
b
->
uwrt
=
1
;
}
if
(
n
<
0
||
(
b
->
ufd
=
fdopen
(
n
,
f__w_mode
[
ufmt
]))
==
NULL
)
#endif
err
(
a
->
oerr
,
errno
,
"open"
);
}
}
}
else
b
->
useek
=
f__canseek
(
b
->
ufd
);
err
(
a
->
oerr
,
errno
,
"open"
);
}
b
->
useek
=
f__canseek
(
b
->
ufd
=
tf
);
#ifndef NON_UNIX_STDIO
#ifndef NON_UNIX_STDIO
if
((
b
->
uinode
=
f__inode
(
buf
,
&
b
->
udev
))
==
-
1
)
if
((
b
->
uinode
=
f__inode
(
buf
,
&
b
->
udev
))
==
-
1
)
err
(
a
->
oerr
,
108
,
"open"
);
opn
err
(
a
->
oerr
,
108
,
"open"
);
#endif
#endif
if
(
b
->
useek
)
if
(
b
->
useek
)
if
(
a
->
orl
)
if
(
a
->
orl
)
rewind
(
b
->
ufd
);
rewind
(
b
->
ufd
);
else
if
((
s
=
a
->
oacc
)
&&
(
*
s
==
'a'
||
*
s
==
'A'
)
else
if
((
s
=
a
->
oacc
)
&&
(
*
s
==
'a'
||
*
s
==
'A'
)
&&
fseek
(
b
->
ufd
,
0L
,
SEEK_END
))
&&
fseek
(
b
->
ufd
,
0L
,
SEEK_END
))
err
(
a
->
oerr
,
129
,
"open"
);
opn
err
(
a
->
oerr
,
129
,
"open"
);
return
(
0
);
return
(
0
);
}
}
#ifdef KR_headers
#ifdef KR_headers
...
...
libf2c/libI77/rawio.h
View file @
a843efa0
#ifdef KR_headers
#ifndef KR_headers
extern
FILE
*
fdopen
();
#else
#if defined (MSDOS) && !defined (GO32)
#if defined (MSDOS) && !defined (GO32)
#include "io.h"
#include "io.h"
#ifndef WATCOM
#ifndef WATCOM
...
...
libf2c/libI77/sfe.c
View file @
a843efa0
...
@@ -8,10 +8,6 @@ integer e_rsfe(Void)
...
@@ -8,10 +8,6 @@ integer e_rsfe(Void)
{
int
n
;
{
int
n
;
f__init
=
1
;
f__init
=
1
;
n
=
en_fio
();
n
=
en_fio
();
if
(
f__cf
==
stdout
)
fflush
(
stdout
);
else
if
(
f__cf
==
stderr
)
fflush
(
stderr
);
f__fmtbuf
=
NULL
;
f__fmtbuf
=
NULL
;
return
(
n
);
return
(
n
);
}
}
...
@@ -30,15 +26,14 @@ c_sfe(cilist *a) /* check */
...
@@ -30,15 +26,14 @@ c_sfe(cilist *a) /* check */
}
}
integer
e_wsfe
(
Void
)
integer
e_wsfe
(
Void
)
{
{
#ifdef ALWAYS_FLUSH
int
n
;
int
n
;
f__init
=
1
;
f__init
=
1
;
n
=
en_fio
();
n
=
en_fio
();
f__fmtbuf
=
NULL
;
f__fmtbuf
=
NULL
;
if
(
!
n
&&
fflush
(
f__cf
))
err
(
f__elist
->
cierr
,
errno
,
"write end"
);
return
n
;
return
n
;
#else
}
return
(
e_rsfe
());
#endif
integer
e_wdfe
(
Void
)
{
return
en_fio
();
}
}
libf2c/libI77/util.c
View file @
a843efa0
#ifndef NON_UNIX_STDIO
#ifndef NON_UNIX_STDIO
#define _INCLUDE_POSIX_SOURCE
/* for HP-UX */
#define _INCLUDE_XOPEN_SOURCE
/* for HP-UX */
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#endif
#endif
...
...
libf2c/libI77/wrtfmt.c
View file @
a843efa0
...
@@ -40,43 +40,23 @@ mv_cur(Void) /* shouldn't use fseek because it insists on calling fflush */
...
@@ -40,43 +40,23 @@ mv_cur(Void) /* shouldn't use fseek because it insists on calling fflush */
}
}
return
(
0
);
return
(
0
);
}
}
if
(
cursor
>
0
)
{
if
(
cursor
>
0
)
{
if
(
f__hiwater
<=
f__recpos
)
if
(
f__hiwater
<=
f__recpos
)
for
(;
cursor
>
0
;
cursor
--
)
(
*
f__putn
)(
' '
);
for
(;
cursor
>
0
;
cursor
--
)
(
*
f__putn
)(
' '
);
else
if
(
f__hiwater
<=
f__recpos
+
cursor
)
{
else
if
(
f__hiwater
<=
f__recpos
+
cursor
)
{
#if ! defined (NON_UNIX_STDIO) && ! defined (MISSING_FILE_ELEMS)
if
(
f__cf
->
_ptr
+
f__hiwater
-
f__recpos
<
buf_end
(
f__cf
))
f__cf
->
_ptr
+=
f__hiwater
-
f__recpos
;
else
#endif
(
void
)
fseek
(
f__cf
,
(
long
)
(
f__hiwater
-
f__recpos
),
SEEK_CUR
);
cursor
-=
f__hiwater
-
f__recpos
;
cursor
-=
f__hiwater
-
f__recpos
;
f__recpos
=
f__hiwater
;
f__recpos
=
f__hiwater
;
for
(;
cursor
>
0
;
cursor
--
)
for
(;
cursor
>
0
;
cursor
--
)
(
*
f__putn
)(
' '
);
(
*
f__putn
)(
' '
);
}
}
else
{
else
{
#if ! defined (NON_UNIX_STDIO) && ! defined (MISSING_FILE_ELEMS)
if
(
f__cf
->
_ptr
+
cursor
<
buf_end
(
f__cf
))
f__cf
->
_ptr
+=
cursor
;
else
#endif
(
void
)
fseek
(
f__cf
,
(
long
)
cursor
,
SEEK_CUR
);
f__recpos
+=
cursor
;
f__recpos
+=
cursor
;
}
}
}
}
if
(
cursor
<
0
)
else
if
(
cursor
<
0
)
{
{
if
(
cursor
+
f__recpos
<
0
)
err
(
f__elist
->
cierr
,
110
,
"left off"
);
if
(
cursor
+
f__recpos
<
0
)
#if ! defined (NON_UNIX_STDIO) && ! defined (MISSING_FILE_ELEMS)
err
(
f__elist
->
cierr
,
110
,
"left off"
);
if
(
f__cf
->
_ptr
+
cursor
>=
f__cf
->
_base
)
f__cf
->
_ptr
+=
cursor
;
else
#endif
if
(
f__curunit
&&
f__curunit
->
useek
)
(
void
)
fseek
(
f__cf
,(
long
)
cursor
,
SEEK_CUR
);
else
err
(
f__elist
->
cierr
,
106
,
"fmt"
);
if
(
f__hiwater
<
f__recpos
)
if
(
f__hiwater
<
f__recpos
)
f__hiwater
=
f__recpos
;
f__hiwater
=
f__recpos
;
f__recpos
+=
cursor
;
f__recpos
+=
cursor
;
...
...
libf2c/libI77/wsfe.c
View file @
a843efa0
...
@@ -4,49 +4,38 @@
...
@@ -4,49 +4,38 @@
#include "fmt.h"
#include "fmt.h"
extern
int
f__hiwater
;
extern
int
f__hiwater
;
#ifdef KR_headers
x_putc
(
c
)
#else
x_putc
(
int
c
)
#endif
{
/* this uses \n as an indicator of record-end */
if
(
c
==
'\n'
&&
f__recpos
<
f__hiwater
)
{
/* fseek calls fflush, a loss */
#if ! defined (NON_UNIX_STDIO) && ! defined (MISSING_FILE_ELEMS)
if
(
f__cf
->
_ptr
+
f__hiwater
-
f__recpos
<
buf_end
(
f__cf
))
f__cf
->
_ptr
+=
f__hiwater
-
f__recpos
;
else
#endif
(
void
)
fseek
(
f__cf
,
(
long
)(
f__hiwater
-
f__recpos
),
SEEK_CUR
);
}
#ifdef OMIT_BLANK_CC
if
(
!
f__recpos
++
&&
c
==
' '
)
return
c
;
#else
f__recpos
++
;
#endif
return
putc
(
c
,
f__cf
);
}
x_wSL
(
Void
)
x_wSL
(
Void
)
{
{
(
*
f__putn
)(
'\n'
);
int
n
=
f__putbuf
(
'\n'
);
f__recpos
=
0
;
f__hiwater
=
f__recpos
=
f__cursor
=
0
;
f__cursor
=
0
;
return
(
n
==
0
);
f__hiwater
=
0
;
return
(
1
);
}
}
static
int
xw_end
(
Void
)
xw_end
(
Void
)
{
{
if
(
f__nonl
==
0
)
int
n
;
(
*
f__putn
)(
'\n'
);
if
(
f__nonl
)
{
f__putbuf
(
n
=
0
);
fflush
(
f__cf
);
}
else
n
=
f__putbuf
(
'\n'
);
f__hiwater
=
f__recpos
=
f__cursor
=
0
;
f__hiwater
=
f__recpos
=
f__cursor
=
0
;
return
(
0
)
;
return
n
;
}
}
static
int
xw_rev
(
Void
)
xw_rev
(
Void
)
{
{
if
(
f__workdone
)
(
*
f__putn
)(
'\n'
);
int
n
=
0
;
if
(
f__workdone
)
{
n
=
f__putbuf
(
'\n'
);
f__workdone
=
0
;
}
f__hiwater
=
f__recpos
=
f__cursor
=
0
;
f__hiwater
=
f__recpos
=
f__cursor
=
0
;
return
(
f__workdone
=
0
)
;
return
n
;
}
}
#ifdef KR_headers
#ifdef KR_headers
...
...
libf2c/libI77/wsle.c
View file @
a843efa0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include "fio.h"
#include "fio.h"
#include "fmt.h"
#include "fmt.h"
#include "lio.h"
#include "lio.h"
#include "string.h"
#ifdef KR_headers
#ifdef KR_headers
integer
s_wsle
(
a
)
cilist
*
a
;
integer
s_wsle
(
a
)
cilist
*
a
;
...
@@ -14,7 +15,7 @@ integer s_wsle(cilist *a)
...
@@ -14,7 +15,7 @@ integer s_wsle(cilist *a)
f__reading
=
0
;
f__reading
=
0
;
f__external
=
1
;
f__external
=
1
;
f__formatted
=
1
;
f__formatted
=
1
;
f__putn
=
t
_putc
;
f__putn
=
x
_putc
;
f__lioproc
=
l_write
;
f__lioproc
=
l_write
;
L_len
=
LINE
;
L_len
=
LINE
;
f__donewrec
=
x_wSL
;
f__donewrec
=
x_wSL
;
...
@@ -25,17 +26,13 @@ integer s_wsle(cilist *a)
...
@@ -25,17 +26,13 @@ integer s_wsle(cilist *a)
integer
e_wsle
(
Void
)
integer
e_wsle
(
Void
)
{
{
int
n
;
f__init
=
1
;
f__init
=
1
;
t_putc
(
'\n'
);
n
=
f__putbuf
(
'\n'
);
f__recpos
=
0
;
f__recpos
=
0
;
#ifdef ALWAYS_FLUSH
#ifdef ALWAYS_FLUSH
if
(
fflush
(
f__cf
))
if
(
!
n
&&
fflush
(
f__cf
))
err
(
f__elist
->
cierr
,
errno
,
"write end"
);
err
(
f__elist
->
cierr
,
errno
,
"write end"
);
#else
if
(
f__cf
==
stdout
)
fflush
(
stdout
);
else
if
(
f__cf
==
stderr
)
fflush
(
stderr
);
#endif
#endif
return
(
0
);
return
(
n
);
}
}
libf2c/libI77/wsne.c
View file @
a843efa0
...
@@ -16,7 +16,7 @@ s_wsne(cilist *a)
...
@@ -16,7 +16,7 @@ s_wsne(cilist *a)
f__reading
=
0
;
f__reading
=
0
;
f__external
=
1
;
f__external
=
1
;
f__formatted
=
1
;
f__formatted
=
1
;
f__putn
=
t
_putc
;
f__putn
=
x
_putc
;
L_len
=
LINE
;
L_len
=
LINE
;
f__donewrec
=
x_wSL
;
f__donewrec
=
x_wSL
;
if
(
f__curunit
->
uwrt
!=
1
&&
f__nowwriting
(
f__curunit
))
if
(
f__curunit
->
uwrt
!=
1
&&
f__nowwriting
(
f__curunit
))
...
...
libf2c/libU77/Version.c
View file @
a843efa0
static
char
junk
[]
=
"
\n
@(#) LIBU77 VERSION 19970919
\n
"
;
static
char
junk
[]
=
"
\n
@(#) LIBU77 VERSION 19970919
\n
"
;
char
__G77_LIBU77_VERSION__
[]
=
"0.5.2
2
"
;
char
__G77_LIBU77_VERSION__
[]
=
"0.5.2
3-19980501
"
;
#include <stdio.h>
#include <stdio.h>
...
...
libf2c/readme.netlib
View file @
a843efa0
...
@@ -77,18 +77,17 @@ f2c/src Source for the converter itself, including a file of checksums
...
@@ -77,18 +77,17 @@ f2c/src Source for the converter itself, including a file of checksums
mailsize 200k
mailsize 200k
send exec.c expr.c format.c format_data.c from f2c/src
send exec.c expr.c format.c format_data.c from f2c/src
If you have trouble generating gram.c, you can ask netlib to
The makefile used to generate gram.c; now we distribute a
send gram.c from f2c/src
working gram.c, and you must say
Then `xsum gram.c` should report
make gram1.c
gram.c 5529f4f 58745
mv gram1.c gram.c
Alternatively, if you have bison, you might get a working
if you want to generate your own gram.c -- there are just too
gram.c by saying
many broken variants of yacc floating around nowadays for
make gram.c YACC=bison YFLAGS=-y
generation of gram.c to be the default.
(but please do not complain if this gives a bad gram.c).
NOTE: You may exercise f2c by sending netlib@netlib.bell-labs.com
NOTE: For now, you may exercise f2c by sending netlib a message whose
a message whose first line is "execute f2c" and whose remaining
first line is "execute f2c" and whose remaining lines are
lines are the Fortran 77 source that you wish to have converted.
the Fortran 77 source that you wish to have converted.
Return mail brings you the resulting C, with f2c's error
Return mail brings you the resulting C, with f2c's error
messages between #ifdef uNdEfInEd and #endif at the end.
messages between #ifdef uNdEfInEd and #endif at the end.
(To understand line numbers in the error messages, regard
(To understand line numbers in the error messages, regard
...
@@ -168,15 +167,22 @@ FTP: All the material described above is now available by anonymous
...
@@ -168,15 +167,22 @@ FTP: All the material described above is now available by anonymous
cd /netlib/f2c/src
cd /netlib/f2c/src
binary
binary
prompt
prompt
mget *.
Z
mget *.
gz
to get all the .
Z files in src. You must uncompress the .Z
to get all the .
gz files in src. You must uncompress the .gz
files once you have a copy of them, e.g., by
files once you have a copy of them, e.g., by
uncompress *.Z
gzip -dN *.gz
You can also get the entire f2c tree as a tar file:
ftp://netlib.bell-labs.com/netlib/f2c.tar
(which is a synthetic file -- created on the fly and not visible
to ftp's "ls" or "dir" commands).
Subdirectory msdos contains two PC versions of f2c,
Subdirectory msdos contains two PC versions of f2c,
f2c.exe.
Z and f2cx.exe.Z
; the latter uses extended memory.
f2c.exe.
gz and f2cx.exe.gz
; the latter uses extended memory.
The README in that directory provides more details.
The README in that directory provides more details.
Changes appear first in the f2c files available by E-mail
Changes appear first in the f2c files available by E-mail
...
@@ -534,41 +540,96 @@ invisible on other machines.
...
@@ -534,41 +540,96 @@ invisible on other machines.
Sun Sep 21 22:05:19 EDT 1997
Sun Sep 21 22:05:19 EDT 1997
libf77: [de]time_.c (Unix systems only): change return type to double.
libf77: [de]time_.c (Unix systems only): change return type to double.
Thu Dec 4 22:10:09 EST 1997
Fix bug with handling large blocks of comments (over 4k); parts of the
second and subsequent blocks were likely to be lost (not copied into
comments in the resulting C). Allow comment lines to be longer before
breaking them.
Mon Jan 19 17:19:27 EST 1998
makefile: change the rule for making gram.c to one for making gram1.c;
henceforth, asking netlib to "send all from f2c/src" will bring you a
working gram.c. Nowadays there are simply too many broken versions of
yacc floating around.
libi77: backspace.c: for b->ufmt==0, change sizeof(int) to
sizeof(uiolen). On machines where this would make a difference, it is
best for portability to compile libI77 with -DUIOLEN_int, which will
render the change invisible.
Tue Feb 24 08:35:33 EST 1998
makefile: remove gram.c from the "make clean" rule.
Wed Feb 25 08:29:39 EST 1998
makefile: change CFLAGS assignment to -O; add "veryclean" rule.
Wed Mar 4 13:13:21 EST 1998
libi77: open.c: fix glitch in comparing file names under
-DNON_UNIX_STDIO.
Mon Mar 9 23:56:56 EST 1998
putpcc.c: omit an unnecessary temporary variable in computing
(expr)**3.
libf77, libi77: minor tweaks to make some C++ compilers happy;
Version.c not changed.
Wed Mar 18 18:08:47 EST 1998
libf77: minor tweaks to [ed]time_.c; Version.c not changed.
libi77: endfile.c, open.c: acquire temporary files from tmpfile(),
unless compiled with -DNON_ANSI_STDIO, which uses mktemp().
New buffering scheme independent of NON_UNIX_STDIO for handling T
format items. Now -DNON_UNIX_STDIO is no longer be necessary for
Linux, and libf2c no longer causes stderr to be buffered -- the former
setbuf or setvbuf call for stderr was to make T format items work.
open.c: use the Posix access() function to check existence or
nonexistence of files, except under -DNON_POSIX_STDIO, where trial
fopen calls are used. In open.c, fix botch in changes of 19980304.
libf2c.zip: the PC makefiles are now set for NT/W95, with comments
about changes for DOS.
Fri Apr 3 17:22:12 EST 1998
Adjust fix of 19960913 to again permit substring notation on
character variables in data statements.
Sun Apr 5 19:26:50 EDT 1998
libi77: wsfe.c: make $ format item work: this was lost in the changes
of 17 March 1998.
Current timestamps of files in "all from f2c/src", sorted by time,
Current timestamps of files in "all from f2c/src", sorted by time,
appear below (mm/dd/year hh:mm:ss). To bring your source up to date,
appear below (mm/dd/year hh:mm:ss). To bring your source up to date,
obtain source files with a timestamp later than the time shown in your
obtain source files with a timestamp later than the time shown in your
version.c. Note that the time shown in the current version.c is the
version.c. Note that the time shown in the current version.c is the
timestamp of the source module that immediately follows version.c below:
timestamp of the source module that immediately follows version.c below:
8/05/1997 14:51:56 xsum0.out
4/03/1998 17:20:55 xsum0.out
8/05/1997 14:42:48 version.c
4/03/1998 17:15:05 gram.c
4/03/1998 17:15:05 version.c
4/03/1998 17:14:59 gram.dcl
3/09/1998 0:30:23 putpcc.c
2/25/1998 8:18:04 makefile
12/04/1997 17:44:11 format.c
12/04/1997 17:44:11 niceprintf.c
12/04/1997 17:14:05 lex.c
8/05/1997 10:31:26 malloc.c
8/05/1997 10:31:26 malloc.c
7/24/1997 17:10:55 README
7/24/1997 17:10:55 README
7/24/1997 17:00:57 makefile
7/24/1997 16:06:19 Notice
7/24/1997 16:06:19 Notice
7/21/1997 12:58:44 proc.c
7/21/1997 12:58:44 proc.c
2/19/1997 13:34:09 lex.c
2/11/1997 23:39:14 vax.c
2/11/1997 23:39:14 vax.c
12/22/1996 11:51:22 output.c
12/22/1996 11:51:22 output.c
12/04/1996 13:07:53 gram.exec
12/04/1996 13:07:53 gram.exec
10/17/1996 13:10:40 putpcc.c
10/01/1996 14:36:18 gram.dcl
10/01/1996 14:36:18 init.c
10/01/1996 14:36:18 defs.h
10/01/1996 14:36:18 defs.h
10/01/1996 14:36:18 init.c
10/01/1996 14:36:17 data.c
10/01/1996 14:36:17 data.c
9/17/1996 17:29:44 expr.c
9/17/1996 17:29:44 expr.c
9/12/1996 12:12:46 equiv.c
9/12/1996 12:12:46 equiv.c
8/27/1996 8:30:32 intr.c
8/27/1996 8:30:32 intr.c
8/26/1996 9:41:13 sysdep.c
8/26/1996 9:41:13 sysdep.c
7/09/1996 10:41:13 format.c
7/09/1996 10:40:45 names.c
7/09/1996 10:40:45 names.c
7/04/1996 9:58:31 formatdata.c
7/04/1996 9:58:31 formatdata.c
7/04/1996 9:55:45 sysdep.h
7/04/1996 9:55:45 sysdep.h
7/04/1996 9:55:43 put.c
7/04/1996 9:55:43 put.c
7/04/1996 9:55:41 pread.c
7/04/1996 9:55:41 pread.c
7/04/1996 9:55:40 parse_args.c
7/04/1996 9:55:40 p1output.c
7/04/1996 9:55:40 p1output.c
7/04/1996 9:55:
38 niceprintf
.c
7/04/1996 9:55:
40 parse_args
.c
7/04/1996 9:55:37 misc.c
7/04/1996 9:55:37 misc.c
7/04/1996 9:55:36 memset.c
7/04/1996 9:55:36 memset.c
7/04/1996 9:55:36 mem.c
7/04/1996 9:55:36 mem.c
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment