Untangle some header files

This commit is contained in:
Gregory Nutt 2016-11-09 14:12:21 -06:00
parent 487e6197c8
commit efff1cd235
9 changed files with 87 additions and 20 deletions

View File

@ -0,0 +1,3 @@
/debug.h
/nuttx

View File

@ -0,0 +1,58 @@
############################################################################
# apps/graphics/traveler/tools/nuttx/Makefile
#
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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

View File

@ -183,7 +183,7 @@ static boolean wld_ReadFileName(FILE *fp, char *fileName)
do do
{ {
ch = getc(fp); ch = getc(fp);
if (ch == EOF) return FALSE; if (ch == EOF) return false;
} }
while ((ch == ' ') || (ch == '\n') || (ch == '\r')); 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 */ /* 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 */ /* Add the new character to the file name */
@ -219,10 +219,10 @@ static boolean wld_ReadFileName(FILE *fp, char *fileName)
*/ */
ch = getc(fp); ch = getc(fp);
if (ch == EOF) return FALSE; if (ch == EOF) return false;
} }
return TRUE; return true;
} }

View File

@ -90,7 +90,7 @@ int BitOffset = 0, /* Bit Offset of next code */
ReadMask; /* Code AND mask for current code size */ ReadMask; /* Code AND mask for current code size */
boolean Interlace, HasColormap; boolean Interlace, HasColormap;
boolean Verbose = TRUE; boolean Verbose = true;
uint8_t *Image; /* The result array */ uint8_t *Image; /* The result array */
uint8_t *RawGIF; /* The heap array to hold it, raw */ 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); fprintf(stderr, "screen dims: %dx%d.\n", RWidth, RHeight);
ch = NEXTBYTE; ch = NEXTBYTE;
HasColormap = ((ch & COLORMAPMASK) ? TRUE : FALSE); HasColormap = ((ch & COLORMAPMASK) ? true : false);
BitsPerPixel = (ch & 7) + 1; BitsPerPixel = (ch & 7) + 1;
numcols = ColorMapSize = 1 << BitsPerPixel; numcols = ColorMapSize = 1 << BitsPerPixel;
@ -340,7 +340,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname)
Width = ch + 0x100 * NEXTBYTE; Width = ch + 0x100 * NEXTBYTE;
ch = NEXTBYTE; ch = NEXTBYTE;
Height = ch + 0x100 * NEXTBYTE; Height = ch + 0x100 * NEXTBYTE;
Interlace = ((NEXTBYTE & INTERLACEMASK) ? TRUE : FALSE); Interlace = ((NEXTBYTE & INTERLACEMASK) ? true : false);
if (Verbose) if (Verbose)
fprintf(stderr, "Reading a %d by %d %sinterlaced image...", fprintf(stderr, "Reading a %d by %d %sinterlaced image...",

View File

@ -39,12 +39,12 @@
* Included files * 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 * the file. Otherwise, the palTable will be calculated from a range
* table * table
*/ */
#define USE_PAL_RANGES TRUE #define USE_PAL_RANGES true
#include "trv_types.h" #include "trv_types.h"
#include "wld_world.h" #include "wld_world.h"

View File

@ -54,7 +54,7 @@
int16_t wld_read_decimal(FILE *fp) int16_t wld_read_decimal(FILE *fp)
{ {
int16_t value = 0; int16_t value = 0;
boolean negative = FALSE; boolean negative = false;
int ch; int ch;
/* Skip over any leading spaces, new lines, or carriage returns (for /* Skip over any leading spaces, new lines, or carriage returns (for
@ -68,7 +68,7 @@ int16_t wld_read_decimal(FILE *fp)
if (ch == '-') if (ch == '-')
{ {
negative = TRUE; negative = true;
ch = getc(fp); ch = getc(fp);
} }

View File

@ -68,7 +68,8 @@ endif
TOOLS = $(TRAVELER)/tools TOOLS = $(TRAVELER)/tools
LIBWLD = $(TOOLS)/libwld 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 VPATH = $(TOOLS)/tcledit

View File

@ -10,14 +10,19 @@ Build instuctions:
tools/sethost.sh -w or -l tools/sethost.sh -w or -l
make context make context
Prepare some header files
3. cd pps/graphics/traveler/tools/nuttx
4. make TOPDIR=<nuttx directory>
Then you can use xmfmk to create the Makefile and build the tool: Then you can use xmfmk to create the Makefile and build the tool:
3. cd apps/graphics/traveler/tools/tcledit 5. cd apps/graphics/traveler/tools/tcledit
4. Review Imakefile. You will probabaly to to change the APPDIR and TOPDIR paths 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 a minimum. These are the paths to where you have clones the apps/ repository
and the nuttx/ repositories, respectively. and the nuttx/ repositories, respectively.
5. xmfmk 7. xmfmk
6. make 8. make

View File

@ -124,7 +124,7 @@ static void x11_create_window(tcl_window_t *w)
XSelectInput(w->display, w->win, XSelectInput(w->display, w->win,
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | KeyPressMask | ExposureMask); ButtonMotionMask | KeyPressMask | ExposureMask);
gcValues.graphics_exposures = FALSE; gcValues.graphics_exposures = false;
gc = XCreateGC(w->display, w->win, GCGraphicsExposures, &gcValues); 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)) if (!XAllocColor(w->display, colormap, &color))
{ {
return FALSE; return false;
} }
/* Save the RGB to pixel lookup data */ /* 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->colorLookup[i] = color.pixel;
w->ncolors++; w->ncolors++;
} }
return TRUE; return true;
} }
/**************************************************************************** /****************************************************************************
@ -312,7 +312,7 @@ static void x11_map_sharedmemory(tcl_window_t *w, int depth)
shmCheckPoint++; shmCheckPoint++;
xshminfo.shmaddr = w->image->data; xshminfo.shmaddr = w->image->data;
xshminfo.readOnly = FALSE; xshminfo.readOnly = false;
trapErrors(); trapErrors();
result = XShmAttach(w->display, &xshminfo); result = XShmAttach(w->display, &xshminfo);