From efff1cd2352694d55eae7b6a5dc318a5a7da8685 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 9 Nov 2016 14:12:21 -0600 Subject: [PATCH] Untangle some header files --- graphics/traveler/tools/include/.gitignore | 3 + graphics/traveler/tools/include/Makefile | 58 +++++++++++++++++++ .../tools/libwld/wld_loadbitmapfile.c | 8 +-- graphics/traveler/tools/libwld/wld_loadgif.c | 6 +- .../traveler/tools/libwld/wld_loadpaltable.c | 4 +- .../traveler/tools/libwld/wld_readdecimal.c | 4 +- graphics/traveler/tools/tcledit/Imakefile | 3 +- graphics/traveler/tools/tcledit/README.txt | 13 +++-- .../traveler/tools/tcledit/tcl_x11graphics.c | 8 +-- 9 files changed, 87 insertions(+), 20 deletions(-) create mode 100644 graphics/traveler/tools/include/.gitignore create mode 100644 graphics/traveler/tools/include/Makefile diff --git a/graphics/traveler/tools/include/.gitignore b/graphics/traveler/tools/include/.gitignore new file mode 100644 index 000000000..131f52c16 --- /dev/null +++ b/graphics/traveler/tools/include/.gitignore @@ -0,0 +1,3 @@ +/debug.h +/nuttx + diff --git a/graphics/traveler/tools/include/Makefile b/graphics/traveler/tools/include/Makefile new file mode 100644 index 000000000..9b325b76e --- /dev/null +++ b/graphics/traveler/tools/include/Makefile @@ -0,0 +1,58 @@ +############################################################################ +# apps/graphics/traveler/tools/nuttx/Makefile +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# Directories + +NXINC = $(TOPDIR)/include +NXINCNX = $(TOPDIR)/include/nuttx + +# Targets + +all: debug.h nuttx + +default: all + +.PHONY: clean + +debug.h : $(NXINC)/debug.h + @cp $(NXINC)/debug.h debug.h + +nuttx : $(NXINCNX) + @cp -a $(NXINCNX) nuttx + + +clean: + @rm -f debug.h + @rm -rf nuttx diff --git a/graphics/traveler/tools/libwld/wld_loadbitmapfile.c b/graphics/traveler/tools/libwld/wld_loadbitmapfile.c index 0a95b593d..5d89404b8 100644 --- a/graphics/traveler/tools/libwld/wld_loadbitmapfile.c +++ b/graphics/traveler/tools/libwld/wld_loadbitmapfile.c @@ -183,7 +183,7 @@ static boolean wld_ReadFileName(FILE *fp, char *fileName) do { ch = getc(fp); - if (ch == EOF) return FALSE; + if (ch == EOF) return false; } while ((ch == ' ') || (ch == '\n') || (ch == '\r')); @@ -198,7 +198,7 @@ static boolean wld_ReadFileName(FILE *fp, char *fileName) { /* Make sure that the file name is not too large */ - if (numBytes >= FILE_NAME_SIZE) return FALSE; + if (numBytes >= FILE_NAME_SIZE) return false; /* Add the new character to the file name */ @@ -219,10 +219,10 @@ static boolean wld_ReadFileName(FILE *fp, char *fileName) */ ch = getc(fp); - if (ch == EOF) return FALSE; + if (ch == EOF) return false; } - return TRUE; + return true; } diff --git a/graphics/traveler/tools/libwld/wld_loadgif.c b/graphics/traveler/tools/libwld/wld_loadgif.c index 6833ff6fa..f8813e3ce 100644 --- a/graphics/traveler/tools/libwld/wld_loadgif.c +++ b/graphics/traveler/tools/libwld/wld_loadgif.c @@ -90,7 +90,7 @@ int BitOffset = 0, /* Bit Offset of next code */ ReadMask; /* Code AND mask for current code size */ boolean Interlace, HasColormap; -boolean Verbose = TRUE; +boolean Verbose = true; uint8_t *Image; /* The result array */ uint8_t *RawGIF; /* The heap array to hold it, raw */ @@ -264,7 +264,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname) fprintf(stderr, "screen dims: %dx%d.\n", RWidth, RHeight); ch = NEXTBYTE; - HasColormap = ((ch & COLORMAPMASK) ? TRUE : FALSE); + HasColormap = ((ch & COLORMAPMASK) ? true : false); BitsPerPixel = (ch & 7) + 1; numcols = ColorMapSize = 1 << BitsPerPixel; @@ -340,7 +340,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname) Width = ch + 0x100 * NEXTBYTE; ch = NEXTBYTE; Height = ch + 0x100 * NEXTBYTE; - Interlace = ((NEXTBYTE & INTERLACEMASK) ? TRUE : FALSE); + Interlace = ((NEXTBYTE & INTERLACEMASK) ? true : false); if (Verbose) fprintf(stderr, "Reading a %d by %d %sinterlaced image...", diff --git a/graphics/traveler/tools/libwld/wld_loadpaltable.c b/graphics/traveler/tools/libwld/wld_loadpaltable.c index f7681fb45..62bdf03cb 100644 --- a/graphics/traveler/tools/libwld/wld_loadpaltable.c +++ b/graphics/traveler/tools/libwld/wld_loadpaltable.c @@ -39,12 +39,12 @@ * Included files *************************************************************************/ -/* If the following switch is FALSE, then the whole palTable is loaded from +/* If the following switch is false, then the whole palTable is loaded from * the file. Otherwise, the palTable will be calculated from a range * table */ -#define USE_PAL_RANGES TRUE +#define USE_PAL_RANGES true #include "trv_types.h" #include "wld_world.h" diff --git a/graphics/traveler/tools/libwld/wld_readdecimal.c b/graphics/traveler/tools/libwld/wld_readdecimal.c index da1853830..2785527e8 100644 --- a/graphics/traveler/tools/libwld/wld_readdecimal.c +++ b/graphics/traveler/tools/libwld/wld_readdecimal.c @@ -54,7 +54,7 @@ int16_t wld_read_decimal(FILE *fp) { int16_t value = 0; - boolean negative = FALSE; + boolean negative = false; int ch; /* Skip over any leading spaces, new lines, or carriage returns (for @@ -68,7 +68,7 @@ int16_t wld_read_decimal(FILE *fp) if (ch == '-') { - negative = TRUE; + negative = true; ch = getc(fp); } diff --git a/graphics/traveler/tools/tcledit/Imakefile b/graphics/traveler/tools/tcledit/Imakefile index 9ab436c46..24fd953ce 100644 --- a/graphics/traveler/tools/tcledit/Imakefile +++ b/graphics/traveler/tools/tcledit/Imakefile @@ -68,7 +68,8 @@ endif TOOLS = $(TRAVELER)/tools LIBWLD = $(TOOLS)/libwld - INC_PATH = -I$(TRAVELER)/include -I$(TOOLS)/tcledit -I$(LIBWLD) + NUTTXINC = $(TOOLS)/include + INC_PATH = -I$(TRAVELER)/include -I$(TOOLS)/tcledit -I$(LIBWLD) -isystem $(NUTTXINC) VPATH = $(TOOLS)/tcledit diff --git a/graphics/traveler/tools/tcledit/README.txt b/graphics/traveler/tools/tcledit/README.txt index cd5f8335b..029a30ea0 100644 --- a/graphics/traveler/tools/tcledit/README.txt +++ b/graphics/traveler/tools/tcledit/README.txt @@ -10,14 +10,19 @@ Build instuctions: tools/sethost.sh -w or -l make context + Prepare some header files + + 3. cd pps/graphics/traveler/tools/nuttx + 4. make TOPDIR= + Then you can use xmfmk to create the Makefile and build the tool: - 3. cd apps/graphics/traveler/tools/tcledit - 4. Review Imakefile. You will probabaly to to change the APPDIR and TOPDIR paths + 5. cd apps/graphics/traveler/tools/tcledit + 6. Review Imakefile. You will probabaly to to change the APPDIR and TOPDIR paths a minimum. These are the paths to where you have clones the apps/ repository and the nuttx/ repositories, respectively. - 5. xmfmk - 6. make + 7. xmfmk + 8. make diff --git a/graphics/traveler/tools/tcledit/tcl_x11graphics.c b/graphics/traveler/tools/tcledit/tcl_x11graphics.c index e82f51342..91b7f9f62 100644 --- a/graphics/traveler/tools/tcledit/tcl_x11graphics.c +++ b/graphics/traveler/tools/tcledit/tcl_x11graphics.c @@ -124,7 +124,7 @@ static void x11_create_window(tcl_window_t *w) XSelectInput(w->display, w->win, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | KeyPressMask | ExposureMask); - gcValues.graphics_exposures = FALSE; + gcValues.graphics_exposures = false; gc = XCreateGC(w->display, w->win, GCGraphicsExposures, &gcValues); } @@ -193,7 +193,7 @@ static bool x11_allocate_colors(tcl_window_t *w, Colormap colormap) if (!XAllocColor(w->display, colormap, &color)) { - return FALSE; + return false; } /* Save the RGB to pixel lookup data */ @@ -206,7 +206,7 @@ static bool x11_allocate_colors(tcl_window_t *w, Colormap colormap) w->colorLookup[i] = color.pixel; w->ncolors++; } - return TRUE; + return true; } /**************************************************************************** @@ -312,7 +312,7 @@ static void x11_map_sharedmemory(tcl_window_t *w, int depth) shmCheckPoint++; xshminfo.shmaddr = w->image->data; - xshminfo.readOnly = FALSE; + xshminfo.readOnly = false; trapErrors(); result = XShmAttach(w->display, &xshminfo);