Added a pc.h to contain libpc prototypes; some ansification.
authorDavid Given <dg@cowlark.com>
Sun, 17 Jun 2018 13:54:18 +0000 (15:54 +0200)
committerDavid Given <dg@cowlark.com>
Sun, 17 Jun 2018 13:54:18 +0000 (15:54 +0200)
lang/pc/libpc/pc.h [new file with mode: 0644]
lang/pc/libpc/wrs.c
lang/pc/libpc/wrz.c

diff --git a/lang/pc/libpc/pc.h b/lang/pc/libpc/pc.h
new file mode 100644 (file)
index 0000000..3590b25
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef PC_H
+#define PC_H
+
+#include "pc_err.h"
+#include "pc_file.h"
+#include "pc_math.h"
+
+extern void _trp(int trapno);
+extern void _wrb(int b, struct file* f);
+extern void _wrs(int len, char* s, struct file* f);
+extern void _wrz(char* s, struct file* f);
+extern void _wsb(int w, int b, struct file* f);
+extern void _wsc(int w, char c, struct file* f);
+extern void _wss(int w, int len, char* s, struct file* f);
+extern void _wstrin(int width, int len, char* buf, struct file* f);
+extern void _wsz(int w, char* s, struct file* f);
+
+#endif
index d95d0f2..427f0d7 100644 (file)
 
 /* Author: J.W. Stevenson */
 
-#include       <pc_err.h>
-#include       <pc_file.h>
-
-extern         _wf();
-extern         _outcpt();
-
-_wstrin(width,len,buf,f) int width,len; char *buf; struct file *f; {
+#include "pc.h"
 
+void _wstrin(int width, int len, char* buf, struct file* f)
+{
        _wf(f);
-       for (width -= len; width>0; width--) {
+       for (width -= len; width > 0; width--)
+       {
                *f->ptr = ' ';
                _outcpt(f);
        }
-       while (--len >= 0) {
+       while (--len >= 0)
+       {
                *f->ptr = *buf++;
                _outcpt(f);
        }
 }
 
-_wsc(w,c,f) int w; char c; struct file *f; {
-
-       if (w < 0) _trp(EWIDTH);
-       _wss(w,1,&c,f);
+void _wsc(int w, char c, struct file* f)
+{
+       if (w < 0)
+               _trp(EWIDTH);
+       _wss(w, 1, &c, f);
 }
 
-_wss(w,len,s,f) int w,len; char *s; struct file *f; {
-
-       if (w < 0 || len < 0) _trp(EWIDTH);
+void _wss(int w, int len, char* s, struct file* f)
+{
+       if (w < 0 || len < 0)
+               _trp(EWIDTH);
        if (w < len)
                len = w;
-       _wstrin(w,len,s,f);
+       _wstrin(w, len, s, f);
 }
 
-_wrs(len,s,f) int len; char *s; struct file *f; {
-       if (len < 0) _trp(EWIDTH);
-       _wss(len,len,s,f);
+void _wrs(int len, char* s, struct file* f)
+{
+       if (len < 0)
+               _trp(EWIDTH);
+       _wss(len, len, s, f);
 }
 
-_wsb(w,b,f) int w,b; struct file *f; {
+void _wsb(int w, int b, struct file* f)
+{
        if (b)
-               _wss(w,4,"true",f);
+               _wss(w, 4, "true", f);
        else
-               _wss(w,5,"false",f);
+               _wss(w, 5, "false", f);
 }
 
-_wrb(b,f) int b; struct file *f; {
-       _wsb(5,b,f);
+void _wrb(int b, struct file* f)
+{
+       _wsb(5, b, f);
 }
index 77e3046..553b94c 100644 (file)
  *
  */
 
-#include       <pc_err.h>
-#include       <pc_file.h>
+#include "pc.h"
 
-extern         _wss();
-extern         _wrs();
+void _wsz(int w, char* s, struct file* f)
+{
+       char* p;
 
-_wsz(w,s,f) int w; char *s; struct file *f; {
-       char *p;
-
-       if (w < 0) _trp(EWIDTH);
-       for (p=s; *p; p++);
-       _wss(w,(int)(p-s),s,f);
+       if (w < 0)
+               _trp(EWIDTH);
+       for (p = s; *p; p++)
+               ;
+       _wss(w, (int)(p - s), s, f);
 }
 
-_wrz(s,f) char *s; struct file *f; {
-       char *p;
+void _wrz(char* s, struct file* f)
+{
+       char* p;
 
-       for (p=s; *p; p++);
-       _wrs((int)(p-s),s,f);
+       for (p = s; *p; p++)
+               ;
+       _wrs((int)(p - s), s, f);
 }