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:
parent
6367467499
commit
b5b1da6f1a
|
@ -1,12 +1,13 @@
|
||||||
clibrary {
|
clibrary {
|
||||||
name = "lib",
|
name = "lib",
|
||||||
srcs = { "./*.c" },
|
srcs = {
|
||||||
|
"./doprnt.c", "./format.c", "./fprint.c", "./print.c",
|
||||||
|
"./sprint.c",
|
||||||
|
},
|
||||||
hdrs = { "./print.h" },
|
hdrs = { "./print.h" },
|
||||||
deps = {
|
deps = {
|
||||||
"modules+headers",
|
"./param.h",
|
||||||
|
"modules/src/string+lib",
|
||||||
"modules/src/system+lib",
|
"modules/src/system+lib",
|
||||||
"./*.h"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
%d = int
|
%d = int
|
||||||
$ */
|
$ */
|
||||||
void
|
void
|
||||||
doprnt(fp, fmt, argp)
|
doprnt(File *fp, char *fmt, va_list argp)
|
||||||
File *fp;
|
|
||||||
char *fmt;
|
|
||||||
va_list argp;
|
|
||||||
{
|
{
|
||||||
char buf[SSIZE];
|
char buf[SSIZE];
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,12 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ack_string.h>
|
||||||
#include <system.h>
|
#include <system.h>
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
|
||||||
extern char *long2str();
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
integral(c)
|
integral(int c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
|
@ -36,9 +35,7 @@ integral(c)
|
||||||
%d = int
|
%d = int
|
||||||
$ */
|
$ */
|
||||||
int
|
int
|
||||||
_format(buf, fmt, argp)
|
_format(char *buf, char *fmt, va_list argp)
|
||||||
char *buf, *fmt;
|
|
||||||
register va_list argp;
|
|
||||||
{
|
{
|
||||||
register char *pf = fmt;
|
register char *pf = fmt;
|
||||||
register char *pb = buf;
|
register char *pb = buf;
|
||||||
|
|
|
@ -17,27 +17,12 @@
|
||||||
$ */
|
$ */
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
fprint
|
fprint(File *fp, char *fmt, ...)
|
||||||
#if __STDC__
|
|
||||||
(File *fp, char *fmt, ...)
|
|
||||||
{
|
{
|
||||||
#else
|
|
||||||
(va_alist)
|
|
||||||
va_dcl
|
|
||||||
{
|
|
||||||
File *fp;
|
|
||||||
char *fmt;
|
|
||||||
#endif
|
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[SSIZE];
|
char buf[SSIZE];
|
||||||
|
|
||||||
#if __STDC__
|
|
||||||
va_start(args, fmt);
|
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));
|
sys_write(fp, buf, _format(buf, fmt, args));
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,25 +17,12 @@
|
||||||
$ */
|
$ */
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
print
|
print(char *fmt, ...)
|
||||||
#if __STDC__
|
|
||||||
(char *fmt, ...)
|
|
||||||
{
|
{
|
||||||
#else
|
|
||||||
(va_alist)
|
|
||||||
va_dcl
|
|
||||||
{
|
|
||||||
char *fmt;
|
|
||||||
#endif
|
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[SSIZE];
|
char buf[SSIZE];
|
||||||
|
|
||||||
#if __STDC__
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
#else
|
|
||||||
va_start(args);
|
|
||||||
fmt = va_arg(args, char *);
|
|
||||||
#endif
|
|
||||||
sys_write(STDOUT, buf, _format(buf, fmt, args));
|
sys_write(STDOUT, buf, _format(buf, fmt, args));
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,12 @@
|
||||||
#ifndef __PRINT_INCLUDED__
|
#ifndef __PRINT_INCLUDED__
|
||||||
#define __PRINT_INCLUDED__
|
#define __PRINT_INCLUDED__
|
||||||
|
|
||||||
#include <ansi.h>
|
|
||||||
#if __STDC__
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_PROTOTYPE(void print, (char *fmt, ...));
|
void print(char *fmt, ...);
|
||||||
_PROTOTYPE(void fprint, (File *f, char *fmt, ...));
|
void fprint(File *f, char *fmt, ...);
|
||||||
_PROTOTYPE(void doprnt, (File *f, char *fmt, va_list ap));
|
void doprnt(File *f, char *fmt, va_list ap);
|
||||||
_PROTOTYPE(int _format, (char *buf, char *fmt, va_list ap));
|
int _format(char *buf, char *fmt, va_list ap);
|
||||||
_PROTOTYPE(char *sprint, (char *buf, char *fmt, ...));
|
char *sprint(char *buf, char *fmt, ...);
|
||||||
|
|
||||||
#endif /* __PRINT_INCLUDED__ */
|
#endif /* __PRINT_INCLUDED__ */
|
||||||
|
|
|
@ -17,25 +17,11 @@
|
||||||
$ */
|
$ */
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
char *
|
char *
|
||||||
sprint
|
sprint(char *buf, char *fmt, ...)
|
||||||
#if __STDC__
|
|
||||||
(char *buf, char *fmt, ...)
|
|
||||||
{
|
{
|
||||||
#else
|
|
||||||
(va_alist)
|
|
||||||
va_dcl
|
|
||||||
{
|
|
||||||
char *buf, *fmt;
|
|
||||||
#endif
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
#if __STDC__
|
|
||||||
va_start(args, fmt);
|
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';
|
buf[_format(buf, fmt, args)] = '\0';
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
@ -6,8 +6,5 @@ clibrary {
|
||||||
"./str2bts.c", "./str2long.c", "./strindex.c",
|
"./str2bts.c", "./str2long.c", "./strindex.c",
|
||||||
"./strrindex.c", "./strzero.c",
|
"./strrindex.c", "./strzero.c",
|
||||||
},
|
},
|
||||||
deps = {
|
hdrs = { "./ack_string.h", },
|
||||||
"./ack_string.h",
|
|
||||||
"modules+headers",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
clibrary {
|
clibrary {
|
||||||
name = "lib",
|
name = "lib",
|
||||||
srcs = { "./*.c" },
|
srcs = {
|
||||||
hdrs = { "./system.h" },
|
"./access.c", "./break.c", "./chmode.c", "./close.c",
|
||||||
deps = {
|
"./create.c", "./filesize.c",
|
||||||
"modules+headers",
|
--"./lock.c",
|
||||||
"./*.h"
|
"./modtime.c", "./open.c", "./read.c", "./remove.c",
|
||||||
|
"./rename.c", "./seek.c", "./stop.c", "./system.c",
|
||||||
|
--"./unlock.c",
|
||||||
|
"./write.c",
|
||||||
},
|
},
|
||||||
|
hdrs = { "./system.h" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#ifndef __SYSTEM_INCLUDED__
|
#ifndef __SYSTEM_INCLUDED__
|
||||||
#define __SYSTEM_INCLUDED__
|
#define __SYSTEM_INCLUDED__
|
||||||
|
|
||||||
#include <ansi.h>
|
|
||||||
|
|
||||||
struct _sys_fildes {
|
struct _sys_fildes {
|
||||||
int o_fd; /* UNIX filedescriptor */
|
int o_fd; /* UNIX filedescriptor */
|
||||||
int o_flags; /* flags for open; 0 if not used */
|
int o_flags; /* flags for open; 0 if not used */
|
||||||
|
@ -33,24 +31,24 @@ extern File _sys_ftab[];
|
||||||
#define S_EXIT 1
|
#define S_EXIT 1
|
||||||
#define S_ABORT 2
|
#define S_ABORT 2
|
||||||
|
|
||||||
_PROTOTYPE(int sys_open, (char *, int, File **));
|
int sys_open(char *, int, File **);
|
||||||
_PROTOTYPE(void sys_close, (File *));
|
void sys_close(File *);
|
||||||
_PROTOTYPE(int sys_read, (File *, char *, int, int *));
|
int sys_read(File *, char *, int, int *);
|
||||||
_PROTOTYPE(int sys_write, (File *, char *, int));
|
int sys_write(File *, char *, int);
|
||||||
_PROTOTYPE(int sys_seek, (File *, long, int, long *));
|
int sys_seek(File *, long, int, long *);
|
||||||
_PROTOTYPE(int sys_reset, (File *));
|
int sys_reset(File *);
|
||||||
_PROTOTYPE(int sys_access, (char *, int));
|
int sys_access(char *, int);
|
||||||
_PROTOTYPE(int sys_remove, (char *));
|
int sys_remove(char *);
|
||||||
_PROTOTYPE(int sys_rename, (char *, char *));
|
int sys_rename(char *, char *);
|
||||||
_PROTOTYPE(long sys_filesize, (char *));
|
long sys_filesize(char *);
|
||||||
_PROTOTYPE(int sys_chmode, (char *, int));
|
int sys_chmode(char *, int);
|
||||||
#if 0
|
#if 0
|
||||||
_PROTOTYPE(int sys_lock, (char *));
|
int sys_lock(char *);
|
||||||
_PROTOTYPE(int sys_unlock, (char *));
|
int sys_unlock(char *);
|
||||||
#endif
|
#endif
|
||||||
_PROTOTYPE(char *sys_break, (int));
|
char *sys_break(int);
|
||||||
_PROTOTYPE(void sys_stop, (int));
|
void sys_stop(int);
|
||||||
_PROTOTYPE(long sys_modtime, (char *));
|
long sys_modtime(char *);
|
||||||
|
|
||||||
/* standard file decsriptors */
|
/* standard file decsriptors */
|
||||||
#define STDIN &_sys_ftab[0]
|
#define STDIN &_sys_ftab[0]
|
||||||
|
|
Loading…
Reference in a new issue