bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] mig: replace boolean.h with stdbool.h


From: Flavio Cruz
Subject: [PATCH] mig: replace boolean.h with stdbool.h
Date: Thu, 24 Nov 2022 15:53:40 -0500

---
Tested by bootstrapping the system from scratch.

 boolean.h    | 60 -------------------------------------------
 global.c     | 12 ++++-----
 global.h     | 14 +++++-----
 mig_string.h |  5 ++--
 migcom.c     | 14 +++++-----
 parser.y     | 12 ++++-----
 routine.c    | 68 ++++++++++++++++++++++++-------------------------
 routine.h    | 38 +++++++++++++--------------
 server.c     | 38 +++++++++++++--------------
 string.c     |  6 ++---
 type.c       | 72 ++++++++++++++++++++++++++--------------------------
 type.h       | 34 ++++++++++++-------------
 user.c       |  4 +--
 utils.c      | 32 +++++++++++------------
 utils.h      |  8 +++---
 15 files changed, 178 insertions(+), 239 deletions(-)
 delete mode 100644 boolean.h

diff --git a/boolean.h b/boolean.h
deleted file mode 100644
index 823b404..0000000
--- a/boolean.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
- *  School of Computer Science
- *  Carnegie Mellon University
- *  Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- *     Boolean data type.
- *
- */
-
-#ifndef        _MIG_BOOLEAN_H_
-#define        _MIG_BOOLEAN_H_
-
-/*
- *     Pick up "boolean_t" type definition
- */
-
-#ifndef        __ASSEMBLER__
-typedef int            boolean_t;
-#endif /* __ASSEMBLER__ */
-
-#endif /* _MIG_BOOLEAN_H_ */
-
-/*
- *     Define TRUE and FALSE, only if they haven't been before,
- *     and not if they're explicitly refused.  Note that we're
- *     outside the BOOLEAN_H_ conditional, to avoid ordering
- *     problems.
- */
-
-#if    !defined(NOBOOL)
-
-#ifndef        TRUE
-#define TRUE   ((boolean_t) 1)
-#endif /* TRUE */
-
-#ifndef        FALSE
-#define FALSE  ((boolean_t) 0)
-#endif /* FALSE */
-
-#endif /* !defined(NOBOOL) */
diff --git a/global.c b/global.c
index e2eb76e..bf3d10d 100644
--- a/global.c
+++ b/global.c
@@ -28,13 +28,13 @@
 #include "error.h"
 #include "global.h"
 
-boolean_t DefaultFiles = TRUE;
-boolean_t BeQuiet = FALSE;
-boolean_t BeVerbose = FALSE;
-boolean_t GenSymTab = FALSE;
+bool DefaultFiles = true;
+bool BeQuiet = false;
+bool BeVerbose = false;
+bool GenSymTab = false;
 
-boolean_t IsKernelUser = FALSE;
-boolean_t IsKernelServer = FALSE;
+bool IsKernelUser = false;
+bool IsKernelServer = false;
 
 const_string_t RCSId = strNULL;
 
diff --git a/global.h b/global.h
index cadd7e7..8e57df2 100644
--- a/global.h
+++ b/global.h
@@ -27,18 +27,18 @@
 #ifndef        _GLOBAL_H
 #define        _GLOBAL_H
 
+#include <stdbool.h>
 #include <sys/types.h>
 
-#include "boolean.h"
 #include "mig_string.h"
 
-extern boolean_t DefaultFiles; /* default output file names if no arguments */
-extern boolean_t BeQuiet;      /* no warning messages */
-extern boolean_t BeVerbose;    /* summarize types, routines */
-extern boolean_t GenSymTab;
+extern bool DefaultFiles;      /* default output file names if no arguments */
+extern bool BeQuiet;   /* no warning messages */
+extern bool BeVerbose; /* summarize types, routines */
+extern bool GenSymTab;
 
-extern boolean_t IsKernelUser;
-extern boolean_t IsKernelServer;
+extern bool IsKernelUser;
+extern bool IsKernelServer;
 
 extern const_string_t RCSId;
 
diff --git a/mig_string.h b/mig_string.h
index d6cef95..920171c 100644
--- a/mig_string.h
+++ b/mig_string.h
@@ -27,10 +27,9 @@
 #ifndef        _MIG_STRING_H
 #define        _MIG_STRING_H
 
+#include <stdbool.h>
 #include <string.h>
 
-#include "boolean.h"
-
 typedef char *string_t;
 typedef const char *const_string_t;
 typedef const_string_t identifier_t;
@@ -43,7 +42,7 @@ extern void strfree(string_t string);
 
 #define        streql(a, b)    (strcmp((a), (b)) == 0)
 
-extern const char *strbool(boolean_t bool);
+extern const char *strbool(bool v);
 extern const char *strstring(const_string_t string);
 
 #endif /* _MIG_STRING_H */
diff --git a/migcom.c b/migcom.c
index e61c79b..2174836 100644
--- a/migcom.c
+++ b/migcom.c
@@ -91,19 +91,19 @@ parseArgs(int argc, char **argv)
            switch (argv[0][1])
            {
              case 'n':
-               DefaultFiles = FALSE;
+               DefaultFiles = false;
                break;
              case 'q':
-               BeQuiet = TRUE;
+               BeQuiet = true;
                break;
              case 'Q':
-               BeQuiet = FALSE;
+               BeQuiet = false;
                break;
              case 'v':
-               BeVerbose = TRUE;
+               BeVerbose = true;
                break;
              case 'V':
-               BeVerbose = FALSE;
+               BeVerbose = false;
                break;
              case 'r':
                /* This is the default and `-R' doesn't work anymore.  */
@@ -144,10 +144,10 @@ parseArgs(int argc, char **argv)
                    SubrPrefix = strmake(argv[0]);
                  }
                else
-                   GenSymTab = TRUE;
+                   GenSymTab = true;
                break;
              case 'S':
-               GenSymTab = FALSE;
+               GenSymTab = false;
                break;
              case 'i':
                if (streql(argv[0], "-iheader"))
diff --git a/parser.y b/parser.y
index 23294bf..03c5ec8 100644
--- a/parser.y
+++ b/parser.y
@@ -221,8 +221,8 @@ SubsystemStart              :       sySubsystem
     if (SubsystemName != strNULL)
     {
        warn("previous Subsystem decl (of %s) will be ignored", SubsystemName);
-       IsKernelUser = FALSE;
-       IsKernelServer = FALSE;
+       IsKernelUser = false;
+       IsKernelServer = false;
        strfree((string_t) SubsystemName);
     }
 }
@@ -236,7 +236,7 @@ SubsystemMod                :       syKernelUser
 {
     if (IsKernelUser)
        warn("duplicate KernelUser keyword");
-    IsKernelUser = TRUE;
+    IsKernelUser = true;
     port_size = vm_offset_size;
     port_size_in_bits = vm_offset_size_in_bits;
 }
@@ -244,7 +244,7 @@ SubsystemMod                :       syKernelUser
 {
     if (IsKernelServer)
        warn("duplicate KernelServer keyword");
-    IsKernelServer = TRUE;
+    IsKernelServer = true;
     port_size = vm_offset_size;
     port_size_in_bits = vm_offset_size_in_bits;
 }
@@ -605,10 +605,10 @@ StructHead                :       syStruct syLBrack 
IntExp syRBrack syOf
                        ;
 
 CStringSpec            :       syCString syLBrack IntExp syRBrack
-                               { $$ = itCStringDecl($3, FALSE); }
+                               { $$ = itCStringDecl($3, false); }
                        |       syCString syLBrack syStar syColon
                                IntExp syRBrack
-                               { $$ = itCStringDecl($5, TRUE); }
+                               { $$ = itCStringDecl($5, true); }
                        ;
 
 IntExp                 :       IntExp  syPlus  IntExp
diff --git a/routine.c b/routine.c
index 6972e14..c0a016c 100644
--- a/routine.c
+++ b/routine.c
@@ -87,9 +87,9 @@ argAlloc(void)
        strNULL,                /* string_t argPadName */
        flNone,                 /* ipc_flags_t argFlags */
        d_NO,                   /* dealloc_t argDeallocate */
-       FALSE,                  /* boolean_t argLongForm */
-       FALSE,                  /* boolean_t argServerCopy */
-       FALSE,                  /* boolean_t argCountInOut */
+       false,                  /* bool argLongForm */
+       false,                  /* bool argServerCopy */
+       false,                  /* bool argCountInOut */
        rtNULL,                 /* routine_t *argRoutine */
        argNULL,                /* argument_t *argCount */
        argNULL,                /* argument_t *argCInOut */
@@ -100,8 +100,8 @@ argAlloc(void)
        1,                      /* int argMultiplier */
        0,                      /* int argRequestPos */
        0,                      /* int argReplyPos */
-       FALSE,                  /* boolean_t argByReferenceUser */
-       FALSE                   /* boolean_t argByReferenceServer */
+       false,                  /* bool argByReferenceUser */
+       false                   /* bool argByReferenceServer */
     };
     argument_t *new;
 
@@ -242,17 +242,17 @@ rtPrintRoutine(const routine_t *rt)
 /*
  * Determines appropriate value of msg-simple for the message,
  * and whether this value can vary at runtime.  (If it can vary,
- * then the simple value is optimistically returned as TRUE.)
+ * then the simple value is optimistically returned as true.)
  * Uses itInName values, so useful when sending messages.
  */
 
 static void
-rtCheckSimpleIn(const argument_t *args, u_int mask, boolean_t *fixed,
-               boolean_t *simple)
+rtCheckSimpleIn(const argument_t *args, u_int mask, bool *fixed,
+               bool *simple)
 {
     const argument_t *arg;
-    boolean_t MayBeComplex = FALSE;
-    boolean_t MustBeComplex = FALSE;
+    bool MayBeComplex = false;
+    bool MustBeComplex = false;
 
     for (arg = args; arg != argNULL; arg = arg->argNext)
        if (akCheck(arg->argKind, mask))
@@ -260,14 +260,14 @@ rtCheckSimpleIn(const argument_t *args, u_int mask, 
boolean_t *fixed,
            const ipc_type_t *it = arg->argType;
 
            if (it->itInName == MACH_MSG_TYPE_POLYMORPHIC)
-               MayBeComplex = TRUE;
+               MayBeComplex = true;
 
            if (it->itIndefinite)
-               MayBeComplex = TRUE;
+               MayBeComplex = true;
 
            if (MACH_MSG_TYPE_PORT_ANY(it->itInName) ||
                !it->itInLine)
-               MustBeComplex = TRUE;
+               MustBeComplex = true;
        }
 
     *fixed = MustBeComplex || !MayBeComplex;
@@ -277,18 +277,18 @@ rtCheckSimpleIn(const argument_t *args, u_int mask, 
boolean_t *fixed,
 /*
  * Determines appropriate value of msg-simple for the message,
  * and whether this value can vary at runtime.  (If it can vary,
- * then the simple value is optimistically returned as TRUE.)
+ * then the simple value is optimistically returned as true.)
  * Uses itOutName values, so useful when receiving messages
  * (and sending reply messages in KernelServer interfaces).
  */
 
 static void
-rtCheckSimpleOut(const argument_t *args, u_int mask, boolean_t *fixed,
-                boolean_t *simple)
+rtCheckSimpleOut(const argument_t *args, u_int mask, bool *fixed,
+                bool *simple)
 {
     const argument_t *arg;
-    boolean_t MayBeComplex = FALSE;
-    boolean_t MustBeComplex = FALSE;
+    bool MayBeComplex = false;
+    bool MustBeComplex = false;
 
     for (arg = args; arg != argNULL; arg = arg->argNext)
        if (akCheck(arg->argKind, mask))
@@ -296,14 +296,14 @@ rtCheckSimpleOut(const argument_t *args, u_int mask, 
boolean_t *fixed,
            const ipc_type_t *it = arg->argType;
 
            if (it->itOutName == MACH_MSG_TYPE_POLYMORPHIC)
-               MayBeComplex = TRUE;
+               MayBeComplex = true;
 
            if (it->itIndefinite)
-               MayBeComplex = TRUE;
+               MayBeComplex = true;
 
            if (MACH_MSG_TYPE_PORT_ANY(it->itOutName) ||
                !it->itInLine)
-               MustBeComplex = TRUE;
+               MustBeComplex = true;
        }
 
     *fixed = MustBeComplex || !MayBeComplex;
@@ -335,28 +335,28 @@ rtFindSize(const argument_t *args, u_int mask)
     return size;
 }
 
-boolean_t
+bool
 rtCheckMask(const argument_t *args, u_int mask)
 {
     const argument_t *arg;
 
     for (arg = args; arg != argNULL; arg = arg->argNext)
        if (akCheckAll(arg->argKind, mask))
-           return TRUE;
-    return FALSE;
+           return true;
+    return false;
 }
 
-boolean_t
+bool
 rtCheckMaskFunction(const argument_t *args, u_int mask,
-                   boolean_t (*func)(const argument_t *))
+                   bool (*func)(const argument_t *))
 {
     const argument_t *arg;
 
     for (arg = args; arg != argNULL; arg = arg->argNext)
        if (akCheckAll(arg->argKind, mask))
            if ((*func)(arg))
-               return TRUE;
-    return FALSE;
+               return true;
+    return false;
 }
 
 /* arg->argType may be NULL in this function */
@@ -406,7 +406,7 @@ rtProcessArgFlags(argument_t *arg)
 
     if (arg->argFlags & flServerCopy) {
        if (it->itIndefinite && akCheck(arg->argKind, akbSend))
-           arg->argServerCopy = TRUE;
+           arg->argServerCopy = true;
        else
            warn("%s: ServerCopy on argument is meaningless", arg->argName);
     }
@@ -414,7 +414,7 @@ rtProcessArgFlags(argument_t *arg)
     if (arg->argFlags & flCountInOut) {
        if (it->itVarArray && it->itInLine &&
            akCheck(arg->argKind, akbReply))
-           arg->argCountInOut = TRUE;
+           arg->argCountInOut = true;
        else
            warn("%s: CountInOut on argument is meaningless", arg->argName);
     }
@@ -790,7 +790,7 @@ rtAddDeallocArg(argument_t *arg)
 
        if (arg->argType->itIndefinite) {
            dealloc->argKind = akAddFeature(dealloc->argKind, akbVarNeeded);
-           dealloc->argByReferenceServer = TRUE;
+           dealloc->argByReferenceServer = true;
        }
     }
 
@@ -1164,7 +1164,7 @@ rtAddByReference(routine_t *rt)
 
        if (akCheck(arg->argKind, akbReturnRcv) &&
            (it->itStruct || it->itIndefinite)) {
-           arg->argByReferenceUser = TRUE;
+           arg->argByReferenceUser = true;
 
            /*
             *  A CountInOut arg itself is not akbReturnRcv,
@@ -1172,12 +1172,12 @@ rtAddByReference(routine_t *rt)
             */
 
            if (arg->argCInOut != argNULL)
-               arg->argCInOut->argByReferenceUser = TRUE;
+               arg->argCInOut->argByReferenceUser = true;
        }
 
        if (akCheck(arg->argKind, akbReturnSnd) &&
            (it->itStruct || it->itIndefinite))
-           arg->argByReferenceServer = TRUE;
+           arg->argByReferenceServer = true;
     }
 }
 
diff --git a/routine.h b/routine.h
index 2b79b27..d828f59 100644
--- a/routine.h
+++ b/routine.h
@@ -27,9 +27,9 @@
 #ifndef        _ROUTINE_H
 #define        _ROUTINE_H
 
+#include <stdbool.h>
 #include <sys/types.h>
 
-#include "boolean.h"
 #include "type.h"
 
 /* base kind arg */
@@ -277,9 +277,9 @@ typedef struct argument
 
     ipc_flags_t argFlags;
     dealloc_t argDeallocate;   /* overrides argType->itDeallocate */
-    boolean_t argLongForm;     /* overrides argType->itLongForm */
-    boolean_t argServerCopy;
-    boolean_t argCountInOut;
+    bool argLongForm;  /* overrides argType->itLongForm */
+    bool argServerCopy;
+    bool argCountInOut;
 
     struct routine *argRoutine;        /* routine we are part of */
 
@@ -298,8 +298,8 @@ typedef struct argument
     int argRequestPos;
     int argReplyPos;
     /* whether argument is by reference, on user and server side */
-    boolean_t  argByReferenceUser;
-    boolean_t  argByReferenceServer;
+    bool       argByReferenceUser;
+    bool       argByReferenceServer;
 } argument_t;
 
 /*
@@ -324,17 +324,17 @@ typedef struct routine
     identifier_t rtUserName;   /* user-visible name (UserPrefix + Name) */
     identifier_t rtServerName; /* server-side name (ServerPrefix + Name) */
 
-    boolean_t rtOneWay;                /* TRUE for SimpleRoutine */
+    bool rtOneWay;             /* true for SimpleRoutine */
 
-    boolean_t rtSimpleFixedRequest;    /* fixed msg-simple value in request */
-    boolean_t rtSimpleSendRequest;     /* in any case, initial value */
-    boolean_t rtSimpleCheckRequest;    /* check msg-simple in request */
-    boolean_t rtSimpleReceiveRequest;  /* if so, the expected value */
+    bool rtSimpleFixedRequest; /* fixed msg-simple value in request */
+    bool rtSimpleSendRequest;  /* in any case, initial value */
+    bool rtSimpleCheckRequest; /* check msg-simple in request */
+    bool rtSimpleReceiveRequest;       /* if so, the expected value */
 
-    boolean_t rtSimpleFixedReply;      /* fixed msg-simple value in reply */
-    boolean_t rtSimpleSendReply;       /* in any case, initial value */
-    boolean_t rtSimpleCheckReply;      /* check msg-simple in reply */
-    boolean_t rtSimpleReceiveReply;    /* if so, the expected value */
+    bool rtSimpleFixedReply;   /* fixed msg-simple value in reply */
+    bool rtSimpleSendReply;    /* in any case, initial value */
+    bool rtSimpleCheckReply;   /* check msg-simple in reply */
+    bool rtSimpleReceiveReply; /* if so, the expected value */
 
     u_int rtRequestSize;       /* minimal size of a legal request msg */
     u_int rtReplySize;         /* minimal size of a legal reply msg */
@@ -345,7 +345,7 @@ typedef struct routine
     int rtMaxRequestPos;       /* maximum of argRequestPos */
     int rtMaxReplyPos;         /* maximum of argReplyPos */
 
-    boolean_t rtNoReplyArgs;   /* if so, no reply message arguments beyond
+    bool rtNoReplyArgs;        /* if so, no reply message arguments beyond
                                   what the server dispatch routine inserts */
 
     /* distinguished arguments */
@@ -371,10 +371,10 @@ extern void rtSkip(int);
 
 extern argument_t *argAlloc(void);
 
-extern boolean_t rtCheckMask(const argument_t *args, u_int mask);
+extern bool rtCheckMask(const argument_t *args, u_int mask);
 
-extern boolean_t rtCheckMaskFunction(const argument_t *args, u_int mask,
-                                    boolean_t (*func)(const argument_t *arg));
+extern bool rtCheckMaskFunction(const argument_t *args, u_int mask,
+                                    bool (*func)(const argument_t *arg));
 
 extern routine_t *rtMakeRoutine(identifier_t name, argument_t *args);
 extern routine_t *rtMakeSimpleRoutine(identifier_t name, argument_t *args);
diff --git a/server.c b/server.c
index 0b6d93d..3a09aa2 100644
--- a/server.c
+++ b/server.c
@@ -184,7 +184,7 @@ WriteEpilog(FILE *file, const statement_t *stats)
 
     WriteStaticDecl(file, itRetCodeType,
                    itRetCodeType->itDeallocate, itRetCodeType->itLongForm,
-                   /*is_server=*/ TRUE, !IsKernelServer, "RetCodeType");
+                   /*is_server=*/ true, !IsKernelServer, "RetCodeType");
     fprintf(file, "\n");
 
     fprintf(file, "\tmig_routine_t routine;\n");
@@ -283,8 +283,8 @@ static void
 WriteVarDecls(FILE *file, const routine_t *rt)
 {
     int i;
-    boolean_t NeedMsghSize = FALSE;
-    boolean_t NeedMsghSizeDelta = FALSE;
+    bool NeedMsghSize = false;
+    bool NeedMsghSizeDelta = false;
 
     fprintf(file, "\tRequest *In0P = (Request *) InHeadP;\n");
     for (i = 1; i <= rt->rtMaxRequestPos; i++)
@@ -312,14 +312,14 @@ WriteVarDecls(FILE *file, const routine_t *rt)
        msgh_size_delta and msgh_size */
 
     if (rt->rtNumRequestVar > 0)
-       NeedMsghSize = TRUE;
+       NeedMsghSize = true;
     if (rt->rtMaxRequestPos > 0)
-       NeedMsghSizeDelta = TRUE;
+       NeedMsghSizeDelta = true;
 
     if (rt->rtNumReplyVar > 1)
-       NeedMsghSize = TRUE;
+       NeedMsghSize = true;
     if (rt->rtMaxReplyPos > 0)
-       NeedMsghSizeDelta = TRUE;
+       NeedMsghSizeDelta = true;
 
     if (NeedMsghSize)
        fprintf(file, "\tunsigned int msgh_size;\n");
@@ -339,13 +339,13 @@ WriteMsgError(FILE *file, const char *error_msg)
 static void
 WriteReplyInit(FILE *file, const routine_t *rt)
 {
-    boolean_t printed_nl = FALSE;
+    bool printed_nl = false;
 
     if (rt->rtSimpleFixedReply)
     {
        if (!rt->rtSimpleSendReply) /* complex reply message */
        {
-           printed_nl = TRUE;
+           printed_nl = true;
            fprintf(file, "\n");
            fprintf(file,
                "\tOutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;\n");
@@ -353,7 +353,7 @@ WriteReplyInit(FILE *file, const routine_t *rt)
     }
     else
     {
-       printed_nl = TRUE;
+       printed_nl = true;
        fprintf(file, "\n");
        fprintf(file, "\tmsgh_simple = %s;\n",
                          strbool(rt->rtSimpleSendReply));
@@ -525,7 +525,7 @@ WriteCheckMsgSize(FILE *file, const argument_t *arg)
           then we must check for exact msg-size and we don't need to
           update msgh_size. */
 
-       boolean_t LastVarArg = arg->argRequestPos+1 == rt->rtNumRequestVar;
+       bool LastVarArg = arg->argRequestPos+1 == rt->rtNumRequestVar;
 
        /* calculate the actual size in bytes of the data field.  note
           that this quantity must be a multiple of word_size.  hence, if
@@ -586,7 +586,7 @@ static void
 WriteExtractArgValue(FILE *file, const argument_t *arg)
 {
     const ipc_type_t *it = arg->argType;
-    boolean_t have_payload;
+    bool have_payload;
 
     if (arg->argMultiplier > 1)
        WriteCopyType(file, it, "%s", "/* %s */ %s / %d",
@@ -749,7 +749,7 @@ static void
 WriteServerCallArg(FILE *file, const argument_t *arg)
 {
     const ipc_type_t *it = arg->argType;
-    boolean_t NeedClose = FALSE;
+    bool NeedClose = false;
 
     if (IsKernelServer) {
         /* If the type (incl. array) is handled differently, then we need to
@@ -771,7 +771,7 @@ WriteServerCallArg(FILE *file, const argument_t *arg)
        !akCheck(arg->argKind, akbVarNeeded))
     {
        fprintf(file, "%s(", it->itInTrans);
-       NeedClose = TRUE;
+       NeedClose = true;
     }
 
     if (akCheck(arg->argKind, akbPointer))
@@ -864,7 +864,7 @@ WriteDestroyPortArg(FILE *file, const argument_t *arg)
 /*
  * Check whether WriteDestroyPortArg would generate any code for arg.
  */
-static boolean_t
+static bool
 CheckDestroyPortArg(const argument_t *arg)
 {
     const ipc_type_t *it = arg->argType;
@@ -872,15 +872,15 @@ CheckDestroyPortArg(const argument_t *arg)
     if ((it->itInTrans != strNULL) &&
        (it->itOutName == MACH_MSG_TYPE_PORT_SEND))
     {
-       return TRUE;
+       return true;
     }
-    return FALSE;
+    return false;
 }
 
 static void
 WriteServerCall(FILE *file, const routine_t *rt)
 {
-    boolean_t NeedClose = FALSE;
+    bool NeedClose = false;
 
     fprintf(file, "\t");
     if (rt->rtServerReturn != argNULL)
@@ -892,7 +892,7 @@ WriteServerCall(FILE *file, const routine_t *rt)
        if (it->itOutTrans != strNULL)
        {
            fprintf(file, "%s(", it->itOutTrans);
-           NeedClose = TRUE;
+           NeedClose = true;
        }
     }
     fprintf(file, "%s(", rt->rtServerName);
diff --git a/string.c b/string.c
index 3f69903..e182948 100644
--- a/string.c
+++ b/string.c
@@ -25,9 +25,9 @@
  */
 
 #include <sys/types.h>
+#include <stdbool.h>
 #include <stdlib.h>
 
-#include "boolean.h"
 #include "error.h"
 #include "mig_string.h"
 
@@ -61,9 +61,9 @@ strfree(string_t string)
 }
 
 const char *
-strbool(boolean_t bool)
+strbool(bool v)
 {
-    if (bool)
+    if (v)
        return "TRUE";
     else
        return "FALSE";
diff --git a/type.c b/type.c
index 3846746..f954de4 100644
--- a/type.c
+++ b/type.c
@@ -57,7 +57,7 @@ ipc_type_t *itWaitTimeType;   /* used for dummy WaitTime args 
*/
 ipc_type_t *itMsgOptionType;   /* used for dummy MsgOption args */
 ipc_type_t *itShortType;        /* used for the short type */
 ipc_type_t *itIntType;          /* used for the int type */
-static boolean_t types_initialized = FALSE;
+static bool types_initialized = false;
 
 static ipc_type_t *list = itNULL;
 
@@ -118,17 +118,17 @@ itAlloc(void)
        0,                      /* u_int itOutName */
        0,                      /* u_int itSize */
        1,                      /* u_int itNumber */
-       TRUE,                   /* boolean_t itInLine */
-       FALSE,                  /* boolean_t itLongForm */
+       true,                   /* bool itInLine */
+       false,                  /* bool itLongForm */
        d_NO,                   /* dealloc_t itDeallocate */
        strNULL,                /* string_t itInNameStr */
        strNULL,                /* string_t itOutNameStr */
        flNone,                 /* ipc_flags_t itFlags */
-       TRUE,                   /* boolean_t itStruct */
-       FALSE,                  /* boolean_t itString */
-       FALSE,                  /* boolean_t itVarArray */
-       FALSE,                  /* boolean_t itIndefinite */
-       FALSE,                  /* boolean_t itKernelPort */
+       true,                   /* bool itStruct */
+       false,                  /* bool itString */
+       false,                  /* bool itVarArray */
+       false,                  /* bool itIndefinite */
+       false,                  /* bool itKernelPort */
        itNULL,                 /* ipc_type_t *itElement */
        strNULL,                /* identifier_t itUserType */
        strNULL,                /* identifier_t itServerType */
@@ -238,7 +238,7 @@ itCalculateNameInfo(ipc_type_t *it)
         MACH_MSG_TYPE_PORT_ANY(it->itInName) ||
         MACH_MSG_TYPE_PORT_ANY(it->itOutName))) {
        it->itServerType = "ipc_port_t";
-        it->itKernelPort = TRUE;
+        it->itKernelPort = true;
     } else if (IsKernelUser &&
        streql(it->itUserType, "mach_port_t") &&
        (((it->itInName == MACH_MSG_TYPE_POLYMORPHIC) &&
@@ -246,9 +246,9 @@ itCalculateNameInfo(ipc_type_t *it)
         MACH_MSG_TYPE_PORT_ANY(it->itInName) ||
         MACH_MSG_TYPE_PORT_ANY(it->itOutName))) {
        it->itUserType = "ipc_port_t";
-        it->itKernelPort = TRUE;
+        it->itKernelPort = true;
     } else
-        it->itKernelPort = FALSE;
+        it->itKernelPort = false;
 
     if (it->itTransType == strNULL)
        it->itTransType = it->itServerType;
@@ -346,16 +346,16 @@ itUseLong(const ipc_type_t *it)
     return uselong;
 }
 
-boolean_t
-itCheckIsLong(const ipc_type_t *it, ipc_flags_t flags, boolean_t dfault,
+bool
+itCheckIsLong(const ipc_type_t *it, ipc_flags_t flags, bool dfault,
              identifier_t name)
 {
-    boolean_t islong = dfault;
+    bool islong = dfault;
 
     if (flags & flLong)
-       islong = TRUE;
+       islong = true;
     if (flags & flNotLong)
-       islong = FALSE;
+       islong = false;
 
     if (islong == dfault) {
        if (flags & flLong)
@@ -543,8 +543,8 @@ itLongDecl(u_int inname, const_string_t instr, u_int 
outname,
     it->itAlignment = MIN(word_size, size / 8);
     if (inname == MACH_MSG_TYPE_STRING_C)
     {
-       it->itStruct = FALSE;
-       it->itString = TRUE;
+       it->itStruct = false;
+       it->itString = true;
     }
     it->itFlags = flags;
 
@@ -635,11 +635,11 @@ itVarArrayDecl(u_int number, const ipc_type_t *old)
 
        bytes = (it->itNumber * it->itSize + 7) / 8;
        it->itNumber = (2048 / bytes) * it->itNumber;
-       it->itIndefinite = TRUE;
+       it->itIndefinite = true;
     }
-    it->itVarArray = TRUE;
-    it->itStruct = FALSE;
-    it->itString = FALSE;
+    it->itVarArray = true;
+    it->itStruct = false;
+    it->itString = false;
 
     itCalculateSizeInfo(it);
     return it;
@@ -657,8 +657,8 @@ itArrayDecl(u_int number, const ipc_type_t *old)
     if (!it->itInLine || it->itVarArray)
        error("IPC type decl is too complicated");
     it->itNumber *= number;
-    it->itStruct = FALSE;
-    it->itString = FALSE;
+    it->itStruct = false;
+    it->itString = false;
     it->itAlignment = old->itAlignment;
 
     itCalculateSizeInfo(it);
@@ -676,10 +676,10 @@ itPtrDecl(ipc_type_t *it)
        (it->itVarArray && !it->itIndefinite && (it->itNumber > 0)))
        error("IPC type decl is too complicated");
     it->itNumber = 0;
-    it->itIndefinite = FALSE;
-    it->itInLine = FALSE;
-    it->itStruct = TRUE;
-    it->itString = FALSE;
+    it->itIndefinite = false;
+    it->itInLine = false;
+    it->itStruct = true;
+    it->itString = false;
 
     itCalculateSizeInfo(it);
     return it;
@@ -697,8 +697,8 @@ itStructArrayDecl(u_int number, const ipc_type_t *old)
     if (!it->itInLine || it->itVarArray)
        error("IPC type decl is too complicated");
     it->itNumber *= number;
-    it->itStruct = TRUE;
-    it->itString = FALSE;
+    it->itStruct = true;
+    it->itString = false;
     it->itAlignment = old->itAlignment;
 
     itCalculateSizeInfo(it);
@@ -738,8 +738,8 @@ itStructDecl(u_int min_type_size_in_bytes, u_int 
required_alignment_in_bytes)
     }
     ipc_type_t *it = itResetType(itCopyType(element_type));
     it->itNumber = number_elements;
-    it->itStruct = TRUE;
-    it->itString = FALSE;
+    it->itStruct = true;
+    it->itString = false;
     it->itAlignment = required_alignment_in_bytes;
 
     itCalculateSizeInfo(it);
@@ -751,7 +751,7 @@ itStructDecl(u_int min_type_size_in_bytes, u_int 
required_alignment_in_bytes)
  * 'array[n] of (MSG_TYPE_STRING_C, 8)'
  */
 ipc_type_t *
-itCStringDecl(u_int count, boolean_t varying)
+itCStringDecl(u_int count, bool varying)
 {
     ipc_type_t *it;
     ipc_type_t *itElement;
@@ -766,8 +766,8 @@ itCStringDecl(u_int count, boolean_t varying)
     it = itResetType(itCopyType(itElement));
     it->itNumber = count;
     it->itVarArray = varying;
-    it->itStruct = FALSE;
-    it->itString = TRUE;
+    it->itStruct = false;
+    it->itString = true;
     it->itAlignment = itElement->itAlignment;
 
     itCalculateSizeInfo(it);
@@ -889,7 +889,7 @@ init_type(void)
         exit(EXIT_FAILURE);
     }
     /* Mark initialization here since itInsert below will require it. */
-    types_initialized = TRUE;
+    types_initialized = true;
 
     itByteType = itAlloc();
     itByteType->itName = "unsigned char";
diff --git a/type.h b/type.h
index 6031ee1..1e4e49f 100644
--- a/type.h
+++ b/type.h
@@ -27,9 +27,9 @@
 #ifndef        _TYPE_H
 #define        _TYPE_H
 
+#include <stdbool.h>
 #include <sys/types.h>
 
-#include "boolean.h"
 #include "mig_string.h"
 
 typedef u_int ipc_flags_t;
@@ -111,17 +111,17 @@ typedef enum dealloc {
  *             outtran: itServerType itOutTrans(itTransType)
  *             destructor: itDestructor(itTransType);
  *
- * At most one of itStruct and itString should be TRUE.  If both are
+ * At most one of itStruct and itString should be true.  If both are
  * false, then this is assumed to be an array type (msg data is passed
- * by reference).  If itStruct is TRUE, then msg data is passed by value
- * and can be assigned with =.  If itString is TRUE, then the msg_data
+ * by reference).  If itStruct is true, then msg data is passed by value
+ * and can be assigned with =.  If itString is true, then the msg_data
  * is a null-terminated string, assigned with strncpy.  The itNumber
  * value is a maximum length for the string; the msg field always
  * takes up this much space.
  *
  * itVarArray means this is a variable-sized array.  If it is inline,
- * then itStruct and itString are FALSE.  If it is out-of-line, then
- * itStruct is TRUE (because pointers can be assigned).
+ * then itStruct and itString are false.  If it is out-of-line, then
+ * itStruct is true (because pointers can be assigned).
  *
  * itIndefinite means this is an indefinite-length array - it may be sent
  * either inline or out-of-line.  itNumber is assigned so that at most
@@ -130,7 +130,7 @@ typedef enum dealloc {
  * itElement points to any substructure that the type may have.
  * It is only used with variable-sized array types.
  *
- * itKernelPort is used only on kernel interfaces and is set to TRUE when
+ * itKernelPort is used only on kernel interfaces and is set to true when
  * the initial type is mach_port_t, which in turn is actually translated to
  * internal port pointers (ipc_port_t).
  */
@@ -149,8 +149,8 @@ typedef struct ipc_type
     u_int itOutName;           /* name in received msg */
     u_int itSize;
     u_int itNumber;
-    boolean_t itInLine;
-    boolean_t itLongForm;
+    bool itInLine;
+    bool itLongForm;
     dealloc_t itDeallocate;
 
     const_string_t itInNameStr;        /* string form of itInName */
@@ -159,11 +159,11 @@ typedef struct ipc_type
     /* what the user wants, not necessarily what he gets */
     ipc_flags_t itFlags;
 
-    boolean_t itStruct;
-    boolean_t itString;
-    boolean_t itVarArray;
-    boolean_t itIndefinite;
-    boolean_t itKernelPort;
+    bool itStruct;
+    bool itString;
+    bool itVarArray;
+    bool itIndefinite;
+    bool itKernelPort;
 
     struct ipc_type *itElement;        /* may be NULL */
 
@@ -196,7 +196,7 @@ extern ipc_type_t *itArrayDecl(u_int number, const 
ipc_type_t *it);
 extern ipc_type_t *itPtrDecl(ipc_type_t *it);
 extern ipc_type_t *itStructArrayDecl(u_int number, const ipc_type_t *it);
 extern ipc_type_t *itStructDecl(u_int min_type_size_in_bytes, u_int 
required_alignment_in_bytes);
-extern ipc_type_t *itCStringDecl(u_int number, boolean_t varying);
+extern ipc_type_t *itCStringDecl(u_int number, bool varying);
 
 extern ipc_type_t *itRetCodeType;
 extern ipc_type_t *itDummyType;
@@ -221,7 +221,7 @@ extern void itCheckNaturalType(identifier_t name, 
ipc_type_t *it);
 extern ipc_flags_t itCheckFlags(ipc_flags_t flags, identifier_t name);
 extern dealloc_t itCheckDeallocate(const ipc_type_t *it, ipc_flags_t flags,
                                   dealloc_t dfault, identifier_t name);
-extern boolean_t itCheckIsLong(const ipc_type_t *it, ipc_flags_t flags,
-                              boolean_t dfault, identifier_t name);
+extern bool itCheckIsLong(const ipc_type_t *it, ipc_flags_t flags,
+                              bool dfault, identifier_t name);
 
 #endif /* _TYPE_H */
diff --git a/user.c b/user.c
index 886198b..a189e75 100644
--- a/user.c
+++ b/user.c
@@ -378,7 +378,7 @@ WritePackArgType(FILE *file, const argument_t *arg)
 {
     WritePackMsgType(file, arg->argType,
                     arg->argType->itIndefinite ? d_NO : arg->argDeallocate,
-                    arg->argLongForm, TRUE,
+                    arg->argLongForm, true,
                     "InP->%s", "%s", arg->argTTName);
     fprintf(file, "\n");
 }
@@ -874,7 +874,7 @@ WriteCheckMsgSize(FILE *file, const argument_t *arg)
           then we must check for exact msg-size and we don't need
           to update msgh_size. */
 
-       boolean_t LastVarArg = arg->argReplyPos+1 == rt->rtNumReplyVar;
+       bool LastVarArg = arg->argReplyPos+1 == rt->rtNumReplyVar;
 
        /* calculate the actual size in bytes of the data field.  note
           that this quantity must be a multiple of word_size.  hence, if
diff --git a/utils.c b/utils.c
index a8ebc6b..2fb8c2e 100644
--- a/utils.c
+++ b/utils.c
@@ -88,14 +88,14 @@ WriteList(FILE *file, const argument_t *args, 
write_list_fn_t *func, u_int mask,
          const char *between, const char *after)
 {
     const argument_t *arg;
-    boolean_t sawone = FALSE;
+    bool sawone = false;
 
     for (arg = args; arg != argNULL; arg = arg->argNext)
        if (akCheckAll(arg->argKind, mask))
        {
            if (sawone)
                fprintf(file, "%s", between);
-           sawone = TRUE;
+           sawone = true;
 
            (*func)(file, arg);
        }
@@ -104,11 +104,11 @@ WriteList(FILE *file, const argument_t *args, 
write_list_fn_t *func, u_int mask,
        fprintf(file, "%s", after);
 }
 
-static boolean_t
+static bool
 WriteReverseListPrim(FILE *file, const argument_t *arg,
                     write_list_fn_t *func, u_int mask, const char *between)
 {
-    boolean_t sawone = FALSE;
+    bool sawone = false;
 
     if (arg != argNULL)
     {
@@ -118,7 +118,7 @@ WriteReverseListPrim(FILE *file, const argument_t *arg,
        {
            if (sawone)
                fprintf(file, "%s", between);
-           sawone = TRUE;
+           sawone = true;
 
            (*func)(file, arg);
        }
@@ -131,7 +131,7 @@ void
 WriteReverseList(FILE *file, const argument_t *args, write_list_fn_t *func,
                 u_int mask, const char *between, const char *after)
 {
-    boolean_t sawone;
+    bool sawone;
 
     sawone = WriteReverseListPrim(file, args, func, mask, between);
 
@@ -147,7 +147,7 @@ WriteNameDecl(FILE *file, const argument_t *arg)
 
 /* Returns whether parameter should be qualified with const because we will 
only
    send the pointed data, not receive it. */
-static boolean_t
+static bool
 UserVarConst(const argument_t *arg)
 {
     return (arg->argKind & (akbSend|akbReturn)) == akbSend
@@ -184,7 +184,7 @@ WriteUserVarDecl(FILE *file, const argument_t *arg)
 
 /* Returns whether parameter should be qualified with const because we will 
only
    receive the pointed data, not modify it. */
-static boolean_t
+static bool
 ServerVarConst(const argument_t *arg)
 {
     return (arg->argKind & (akbSend|akbReturn)) == akbSend
@@ -225,7 +225,7 @@ WriteTypeDeclInServer(FILE *file, const argument_t *arg)
 {
     WriteStaticDecl(file, arg->argType,
                    arg->argType->itIndefinite ? d_NO : arg->argDeallocate,
-                   arg->argLongForm, /*is_server=*/TRUE, TRUE, arg->argTTName);
+                   arg->argLongForm, /*is_server=*/true, true, arg->argTTName);
 }
 
 void
@@ -233,7 +233,7 @@ WriteTypeDeclOutServer(FILE *file, const argument_t *arg)
 {
     WriteStaticDecl(file, arg->argType,
                    arg->argType->itIndefinite ? d_NO : arg->argDeallocate,
-                   arg->argLongForm, /*is_server=*/TRUE, FALSE, 
arg->argTTName);
+                   arg->argLongForm, /*is_server=*/true, false, 
arg->argTTName);
 }
 
 void
@@ -241,7 +241,7 @@ WriteTypeDeclInUser(FILE *file, const argument_t *arg)
 {
     WriteStaticDecl(file, arg->argType,
                    arg->argType->itIndefinite ? d_NO : arg->argDeallocate,
-                   arg->argLongForm, /*is_server=*/FALSE, TRUE, 
arg->argTTName);
+                   arg->argLongForm, /*is_server=*/false, true, 
arg->argTTName);
 }
 
 void
@@ -249,7 +249,7 @@ WriteTypeDeclOutUser(FILE *file, const argument_t *arg)
 {
     WriteStaticDecl(file, arg->argType,
                    arg->argType->itIndefinite ? d_NO : arg->argDeallocate,
-                   arg->argLongForm, /*is_server=*/FALSE, FALSE, 
arg->argTTName);
+                   arg->argLongForm, /*is_server=*/false, false, 
arg->argTTName);
 }
 
 void
@@ -349,7 +349,7 @@ WriteStructDecl(FILE *file, const argument_t *args, 
write_list_fn_t *func,
 
 static void
 WriteStaticLongDecl(FILE *file, const ipc_type_t *it,
-                   dealloc_t dealloc, boolean_t inname, identifier_t name)
+                   dealloc_t dealloc, bool inname, identifier_t name)
 {
     fprintf(file, "\tconst mach_msg_type_long_t %s = {\n", name);
     fprintf(file, "\t{\n");
@@ -372,7 +372,7 @@ WriteStaticLongDecl(FILE *file, const ipc_type_t *it,
 
 static void
 WriteStaticShortDecl(FILE *file, const ipc_type_t *it,
-                    dealloc_t dealloc, boolean_t is_server, boolean_t inname,
+                    dealloc_t dealloc, bool is_server, bool inname,
                     identifier_t name)
 {
     fprintf(file, "\tconst mach_msg_type_t %s = {\n", name);
@@ -398,7 +398,7 @@ WriteStaticShortDecl(FILE *file, const ipc_type_t *it,
 
 void
 WriteStaticDecl(FILE *file, const ipc_type_t *it, dealloc_t dealloc,
-               boolean_t longform, boolean_t is_server, boolean_t inname,
+               bool longform, bool is_server, bool inname,
                identifier_t name)
 {
     if (longform)
@@ -506,7 +506,7 @@ WriteCopyType(FILE *file, const ipc_type_t *it, const char 
*left,
 
 void
 WritePackMsgType(FILE *file, const ipc_type_t *it, dealloc_t dealloc,
-                boolean_t longform, boolean_t inname, const char *left,
+                bool longform, bool inname, const char *left,
                 const char *right, ...)
 {
     fprintf(file, "\t");
diff --git a/utils.h b/utils.h
index 64e2ebf..4be4f4c 100644
--- a/utils.h
+++ b/utils.h
@@ -77,16 +77,16 @@ extern void WriteStructDecl(FILE *file, const argument_t 
*args,
                            const char *name);
 
 extern void WriteStaticDecl(FILE *file, const ipc_type_t *it,
-                           dealloc_t dealloc, boolean_t longform,
-                           boolean_t is_server, boolean_t inname,
+                           dealloc_t dealloc, bool longform,
+                           bool is_server, bool inname,
                            identifier_t name);
 
 extern void WriteCopyType(FILE *file, const ipc_type_t *it,
                          const char *left, const char *right, ...);
 
 extern void WritePackMsgType(FILE *file, const ipc_type_t *it,
-                            dealloc_t dealloc, boolean_t longform,
-                            boolean_t inname, const char *left,
+                            dealloc_t dealloc, bool longform,
+                            bool inname, const char *left,
                             const char *right, ...);
 
 #endif /* _UTILS_H */
-- 
2.37.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]