Adjust dependencies in modules/src{print,string,system}

Drop dependency on <ansi.h> in modules+headers; assume that compiler
knows ANSI C89.

Add missing dependency from print to string; #include <ack_string.h>.

Because <print.h> had commented out the declarations of sys_lock() and
sys_unlock(), I now stop building lock.c and unlock.c.
This commit is contained in:
George Koehler 2017-11-10 16:26:27 -05:00
parent 6367467499
commit b5b1da6f1a
10 changed files with 44 additions and 99 deletions

View file

@ -1,12 +1,13 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
srcs = {
"./doprnt.c", "./format.c", "./fprint.c", "./print.c",
"./sprint.c",
},
hdrs = { "./print.h" },
deps = {
"modules+headers",
"./param.h",
"modules/src/string+lib",
"modules/src/system+lib",
"./*.h"
}
}

View file

@ -16,10 +16,7 @@
%d = int
$ */
void
doprnt(fp, fmt, argp)
File *fp;
char *fmt;
va_list argp;
doprnt(File *fp, char *fmt, va_list argp)
{
char buf[SSIZE];

View file

@ -5,13 +5,12 @@
/* $Id$ */
#include <string.h>
#include <ack_string.h>
#include <system.h>
#include "print.h"
extern char *long2str();
static int
integral(c)
integral(int c)
{
switch (c) {
case 'b':
@ -36,9 +35,7 @@ integral(c)
%d = int
$ */
int
_format(buf, fmt, argp)
char *buf, *fmt;
register va_list argp;
_format(char *buf, char *fmt, va_list argp)
{
register char *pf = fmt;
register char *pb = buf;

View file

@ -17,27 +17,12 @@
$ */
/*VARARGS*/
void
fprint
#if __STDC__
(File *fp, char *fmt, ...)
fprint(File *fp, char *fmt, ...)
{
#else
(va_alist)
va_dcl
{
File *fp;
char *fmt;
#endif
va_list args;
char buf[SSIZE];
#if __STDC__
va_start(args, fmt);
#else
va_start(args);
fp = va_arg(args, File *);
fmt = va_arg(args, char *);
#endif
sys_write(fp, buf, _format(buf, fmt, args));
va_end(args);
}

View file

@ -17,25 +17,12 @@
$ */
/*VARARGS*/
void
print
#if __STDC__
(char *fmt, ...)
print(char *fmt, ...)
{
#else
(va_alist)
va_dcl
{
char *fmt;
#endif
va_list args;
char buf[SSIZE];
#if __STDC__
va_start(args, fmt);
#else
va_start(args);
fmt = va_arg(args, char *);
#endif
sys_write(STDOUT, buf, _format(buf, fmt, args));
va_end(args);
}

View file

@ -7,17 +7,12 @@
#ifndef __PRINT_INCLUDED__
#define __PRINT_INCLUDED__
#include <ansi.h>
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
_PROTOTYPE(void print, (char *fmt, ...));
_PROTOTYPE(void fprint, (File *f, char *fmt, ...));
_PROTOTYPE(void doprnt, (File *f, char *fmt, va_list ap));
_PROTOTYPE(int _format, (char *buf, char *fmt, va_list ap));
_PROTOTYPE(char *sprint, (char *buf, char *fmt, ...));
void print(char *fmt, ...);
void fprint(File *f, char *fmt, ...);
void doprnt(File *f, char *fmt, va_list ap);
int _format(char *buf, char *fmt, va_list ap);
char *sprint(char *buf, char *fmt, ...);
#endif /* __PRINT_INCLUDED__ */

View file

@ -17,25 +17,11 @@
$ */
/*VARARGS*/
char *
sprint
#if __STDC__
(char *buf, char *fmt, ...)
sprint(char *buf, char *fmt, ...)
{
#else
(va_alist)
va_dcl
{
char *buf, *fmt;
#endif
va_list args;
#if __STDC__
va_start(args, fmt);
#else
va_start(args);
buf = va_arg(args, char *);
fmt = va_arg(args, char *);
#endif
buf[_format(buf, fmt, args)] = '\0';
va_end(args);
return buf;

View file

@ -6,8 +6,5 @@ clibrary {
"./str2bts.c", "./str2long.c", "./strindex.c",
"./strrindex.c", "./strzero.c",
},
deps = {
"./ack_string.h",
"modules+headers",
},
hdrs = { "./ack_string.h", },
}

View file

@ -1,11 +1,13 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./system.h" },
deps = {
"modules+headers",
"./*.h"
srcs = {
"./access.c", "./break.c", "./chmode.c", "./close.c",
"./create.c", "./filesize.c",
--"./lock.c",
"./modtime.c", "./open.c", "./read.c", "./remove.c",
"./rename.c", "./seek.c", "./stop.c", "./system.c",
--"./unlock.c",
"./write.c",
},
hdrs = { "./system.h" },
}

View file

@ -6,8 +6,6 @@
#ifndef __SYSTEM_INCLUDED__
#define __SYSTEM_INCLUDED__
#include <ansi.h>
struct _sys_fildes {
int o_fd; /* UNIX filedescriptor */
int o_flags; /* flags for open; 0 if not used */
@ -33,24 +31,24 @@ extern File _sys_ftab[];
#define S_EXIT 1
#define S_ABORT 2
_PROTOTYPE(int sys_open, (char *, int, File **));
_PROTOTYPE(void sys_close, (File *));
_PROTOTYPE(int sys_read, (File *, char *, int, int *));
_PROTOTYPE(int sys_write, (File *, char *, int));
_PROTOTYPE(int sys_seek, (File *, long, int, long *));
_PROTOTYPE(int sys_reset, (File *));
_PROTOTYPE(int sys_access, (char *, int));
_PROTOTYPE(int sys_remove, (char *));
_PROTOTYPE(int sys_rename, (char *, char *));
_PROTOTYPE(long sys_filesize, (char *));
_PROTOTYPE(int sys_chmode, (char *, int));
int sys_open(char *, int, File **);
void sys_close(File *);
int sys_read(File *, char *, int, int *);
int sys_write(File *, char *, int);
int sys_seek(File *, long, int, long *);
int sys_reset(File *);
int sys_access(char *, int);
int sys_remove(char *);
int sys_rename(char *, char *);
long sys_filesize(char *);
int sys_chmode(char *, int);
#if 0
_PROTOTYPE(int sys_lock, (char *));
_PROTOTYPE(int sys_unlock, (char *));
int sys_lock(char *);
int sys_unlock(char *);
#endif
_PROTOTYPE(char *sys_break, (int));
_PROTOTYPE(void sys_stop, (int));
_PROTOTYPE(long sys_modtime, (char *));
char *sys_break(int);
void sys_stop(int);
long sys_modtime(char *);
/* standard file decsriptors */
#define STDIN &_sys_ftab[0]