ref: 2a98788f4f7b67f06546cfb2a8ef6367796527a0
parent: e61dd8794563ad8a88e713ec0ed56f4a730829d8
author: 9ferno <[email protected]>
date: Thu Nov 11 09:10:03 EST 2021
added a global DBG macro
--- a/9front/include/lib9.h
+++ b/9front/include/lib9.h
@@ -12,3 +12,5 @@
#define setbinmode()
#define USE_FPdbleword
+
+#define DBG if(debug)print
--- a/OpenBSD/amd64/include/lib9.h
+++ b/OpenBSD/amd64/include/lib9.h
@@ -39,6 +39,7 @@
#define __LITTLE_ENDIAN
#define nil ((void*)0)
+#define DBG if(debug)print
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned char uchar;
--- a/include/kern.h
+++ b/include/kern.h
@@ -4,6 +4,8 @@
#define offsetof(s, m) (u32)(&(((s*)0)->m))
#define assert(x) if(x){}else _assert("x")
+#define DBG if(debug)print
+
/*
* mem routines
*/
--- a/libinterp/readmod.c
+++ b/libinterp/readmod.c
@@ -4,6 +4,8 @@
#include "kernel.h"
#include "dynld.h"
+static int debug = 0;
+
Module*
readmod(char *path, Module *m, int sync)
{
--- a/libinterp/xec.c
+++ b/libinterp/xec.c
@@ -1,13 +1,14 @@
-#include <lib9.h>
+#include "lib9.h"
#include "isa.h"
#include "interp.h"
#include "raise.h"
#include "pool.h"
+static int debug = 0;
+
REG R; /* Virtual Machine registers */
String snil; /* String known to be zero length */
-#define DBG if(0)print
#define Stmp *((WORD*)(R.FP+NREG*IBY2WD))
#define Dtmp *((WORD*)(R.FP+(NREG+2)*IBY2WD))
--- a/os/pc/pcipc.c
+++ b/os/pc/pcipc.c
@@ -7,7 +7,7 @@
#include "../port/pci.h"
#include "../port/error.h"
-#define DBG if(1) print
+static int debug = 0;
enum
{ /* configuration mechanism #1 */
--- a/os/port/chan.c
+++ b/os/port/chan.c
@@ -5,7 +5,7 @@
#include "fns.h"
#include "../port/error.h"
-#define DBG if(0)print
+static int debug = 0;
enum
{
--- a/os/port/devmnt.c
+++ b/os/port/devmnt.c
@@ -5,6 +5,8 @@
#include "fns.h"
#include "../port/error.h"
+static int debug = 0;
+
/*
* References are managed as follows:
* The channel to the server - a network connection or pipe - has one
--- a/os/port/dis.c
+++ b/os/port/dis.c
@@ -9,7 +9,7 @@
#include <kernel.h>
#include "raise.h"
-#define DBG if(0)print
+static int debug = 0;
void vmachine(void*);
--- a/os/port/lib.h
+++ b/os/port/lib.h
@@ -6,6 +6,8 @@
#define offsetof(s, m) (u32)(&(((s*)0)->m))
#define assert(x) if(x){}else _assert("x")
+#define DBG if(debug)print
+
/*
* mem routines
*/
--- a/os/port/rdb.c
+++ b/os/port/rdb.c
@@ -8,7 +8,7 @@
int rdbstarted;
-#define DBG if(1)scrprint
+#define DBGS if(1)scrprint
#pragma varargck argpos scrprint 1
static Ureg ureg;
--- a/os/port/sysfile.c
+++ b/os/port/sysfile.c
@@ -5,7 +5,7 @@
#include "fns.h"
#include "../port/error.h"
-#define DBG if(1)print
+static int debug = 0;
static void
unlockfgrp(Fgrp *f)