From 7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 3 Nov 2018 10:51:23 +1000 Subject: For all source files update integer types to the new gI8 etc type names --- src/gadc/gadc.c | 12 +-- src/gadc/gadc.h | 8 +- src/gadc/gadc_driver.h | 16 ++-- src/gaudio/gaudio.c | 10 +-- src/gaudio/gaudio.h | 10 +-- src/gaudio/gaudio_driver_play.h | 4 +- src/gaudio/gaudio_driver_record.h | 2 +- src/gdisp/fonts/DejaVuSans10.c | 6 +- src/gdisp/fonts/DejaVuSans12.c | 6 +- src/gdisp/fonts/DejaVuSans12_aa.c | 8 +- src/gdisp/fonts/DejaVuSans16.c | 8 +- src/gdisp/fonts/DejaVuSans16_aa.c | 8 +- src/gdisp/fonts/DejaVuSans20.c | 8 +- src/gdisp/fonts/DejaVuSans20_aa.c | 8 +- src/gdisp/fonts/DejaVuSans24.c | 8 +- src/gdisp/fonts/DejaVuSans24_aa.c | 8 +- src/gdisp/fonts/DejaVuSans32.c | 8 +- src/gdisp/fonts/DejaVuSans32_aa.c | 8 +- src/gdisp/fonts/DejaVuSansBold12.c | 6 +- src/gdisp/fonts/DejaVuSansBold12_aa.c | 8 +- src/gdisp/fonts/LargeNumbers.c | 8 +- src/gdisp/fonts/UI1.c | 16 ++-- src/gdisp/fonts/UI2.c | 8 +- src/gdisp/fonts/fixed_10x20.c | 6 +- src/gdisp/fonts/fixed_5x8.c | 2 +- src/gdisp/fonts/fixed_7x14.c | 2 +- src/gdisp/gdisp.c | 80 ++++++++--------- src/gdisp/gdisp.h | 20 ++--- src/gdisp/gdisp_colors.h | 30 +++---- src/gdisp/gdisp_driver.h | 32 +++---- src/gdisp/gdisp_fonts.c | 2 +- src/gdisp/gdisp_image.c | 58 ++++++------ src/gdisp/gdisp_image.h | 16 ++-- src/gdisp/gdisp_image_bmp.c | 80 ++++++++--------- src/gdisp/gdisp_image_gif.c | 144 ++++++++++++++--------------- src/gdisp/gdisp_image_jpg.c | 150 +++++++++++++++---------------- src/gdisp/gdisp_image_native.c | 15 ++-- src/gdisp/gdisp_image_png.c | 160 ++++++++++++++++----------------- src/gdisp/gdisp_image_support.h | 62 ++++++------- src/gdisp/gdisp_pixmap.c | 14 +-- src/gdisp/mcufont/mf_bwfont.c | 30 +++---- src/gdisp/mcufont/mf_bwfont.h | 34 +++---- src/gdisp/mcufont/mf_encoding.c | 6 +- src/gdisp/mcufont/mf_encoding.h | 6 +- src/gdisp/mcufont/mf_font.c | 10 +-- src/gdisp/mcufont/mf_font.h | 36 ++++---- src/gdisp/mcufont/mf_justify.c | 70 +++++++-------- src/gdisp/mcufont/mf_justify.h | 14 +-- src/gdisp/mcufont/mf_kerning.c | 26 +++--- src/gdisp/mcufont/mf_kerning.h | 2 +- src/gdisp/mcufont/mf_rlefont.c | 74 +++++++-------- src/gdisp/mcufont/mf_rlefont.h | 30 +++---- src/gdisp/mcufont/mf_scaledfont.c | 30 +++---- src/gdisp/mcufont/mf_scaledfont.h | 16 ++-- src/gdisp/mcufont/mf_wordwrap.c | 42 ++++----- src/gdisp/mcufont/mf_wordwrap.h | 4 +- src/gdriver/gdriver.c | 6 +- src/gdriver/gdriver.h | 12 +-- src/gevent/gevent.c | 2 +- src/gevent/gevent.h | 10 +-- src/gfile/gfile.c | 20 ++--- src/gfile/gfile.h | 18 ++-- src/gfile/gfile_fatfs_diskio_chibios.c | 2 +- src/gfile/gfile_fatfs_wrapper.c | 2 +- src/gfile/gfile_fs.h | 12 +-- src/gfile/gfile_fs_chibios.c | 8 +- src/gfile/gfile_fs_fatfs.c | 16 ++-- src/gfile/gfile_fs_mem.c | 4 +- src/gfile/gfile_fs_native.c | 24 ++--- src/gfile/gfile_fs_petitfs.c | 4 +- src/gfile/gfile_fs_rom.c | 20 ++--- src/gfile/gfile_stdio.c | 4 +- src/gfx_types.h | 26 ++++-- src/ginput/ginput_dial.c | 26 +++--- src/ginput/ginput_dial.h | 18 ++-- src/ginput/ginput_driver_dial.h | 2 +- src/ginput/ginput_driver_keyboard.h | 16 ++-- src/ginput/ginput_driver_mouse.h | 8 +- src/ginput/ginput_keyboard.c | 12 +-- src/ginput/ginput_keyboard.h | 4 +- src/ginput/ginput_keyboard_microcode.c | 2 +- src/ginput/ginput_mouse.c | 22 ++--- src/ginput/ginput_mouse.h | 8 +- src/ginput/ginput_toggle.c | 10 +-- src/ginput/ginput_toggle.h | 8 +- src/gmisc/gmisc.h | 16 ++-- src/gmisc/gmisc_arrayops.c | 6 +- src/gmisc/gmisc_hittest.c | 4 +- src/gmisc/gmisc_trig.c | 4 +- src/gos/gos.h | 8 +- src/gos/gos_arduino.c | 4 +- src/gos/gos_chibios.c | 4 +- src/gos/gos_chibios.h | 4 +- src/gos/gos_cmsis.c | 2 +- src/gos/gos_cmsis.h | 14 +-- src/gos/gos_cmsis2.c | 2 +- src/gos/gos_cmsis2.h | 10 +-- src/gos/gos_ecos.c | 2 +- src/gos/gos_ecos.h | 2 +- src/gos/gos_freertos.c | 4 +- src/gos/gos_freertos.h | 10 +-- src/gos/gos_linux.c | 2 +- src/gos/gos_linux.h | 6 +- src/gos/gos_nios.c | 4 +- src/gos/gos_options.h | 15 ++++ src/gos/gos_osx.c | 2 +- src/gos/gos_osx.h | 6 +- src/gos/gos_qt.cpp | 10 +-- src/gos/gos_qt.h | 8 +- src/gos/gos_raw32.c | 4 +- src/gos/gos_rawrtos.c | 2 +- src/gos/gos_rawrtos.h | 8 +- src/gos/gos_win32.c | 2 +- src/gos/gos_win32.h | 4 +- src/gos/gos_x_heap.c | 14 +-- src/gos/gos_x_heap.h | 6 +- src/gos/gos_x_threads.c | 24 ++--- src/gos/gos_x_threads.h | 10 +-- src/gqueue/gqueue.c | 2 +- src/gqueue/gqueue.h | 6 +- src/gtimer/gtimer.h | 2 +- src/gtrans/gtrans.c | 2 +- src/gwin/gwin.c | 6 +- src/gwin/gwin.h | 6 +- src/gwin/gwin_button.c | 8 +- src/gwin/gwin_button.h | 2 +- src/gwin/gwin_checkbox.c | 6 +- src/gwin/gwin_checkbox.h | 2 +- src/gwin/gwin_class.h | 24 ++--- src/gwin/gwin_console.c | 36 ++++---- src/gwin/gwin_console.h | 12 +-- src/gwin/gwin_container.c | 2 +- src/gwin/gwin_container.h | 2 +- src/gwin/gwin_frame.c | 2 +- src/gwin/gwin_frame.h | 2 +- src/gwin/gwin_graph.h | 2 +- src/gwin/gwin_keyboard.c | 10 +-- src/gwin/gwin_keyboard.h | 6 +- src/gwin/gwin_keyboard_layout.h | 4 +- src/gwin/gwin_list.c | 14 +-- src/gwin/gwin_list.h | 12 +-- src/gwin/gwin_radio.c | 10 +-- src/gwin/gwin_radio.h | 10 +-- src/gwin/gwin_slider.c | 16 ++-- src/gwin/gwin_slider.h | 8 +- src/gwin/gwin_tabset.c | 2 +- src/gwin/gwin_tabset.h | 2 +- src/gwin/gwin_textedit.c | 12 +-- src/gwin/gwin_textedit.h | 8 +- src/gwin/gwin_widget.c | 26 +++--- src/gwin/gwin_widget.h | 10 +-- src/gwin/gwin_wm.c | 4 +- 152 files changed, 1176 insertions(+), 1146 deletions(-) (limited to 'src') diff --git a/src/gadc/gadc.c b/src/gadc/gadc.c index 0cd9c82e..77a65c19 100644 --- a/src/gadc/gadc.c +++ b/src/gadc/gadc.c @@ -30,8 +30,8 @@ typedef struct NonTimerData_t { GadcNonTimerJob job; } NonTimerData; -static volatile uint16_t hsFlags; -static size_t hsBytesPerConv; +static volatile gU16 hsFlags; +static gMemSize hsBytesPerConv; static GadcTimerJob hsJob; static GDataBuffer *hsData; static gfxQueueGSync hsListDone; @@ -45,7 +45,7 @@ static gfxQueueGSync lsListToDo; static gfxQueueGSync lsListDone; static NonTimerData *lsData; -void gadcGotDataI(size_t n) { +void gadcGotDataI(gMemSize n) { if ((hsFlags & GADC_HSADC_CONVERTION)) { // A set of timer conversions is done - add them @@ -199,7 +199,7 @@ void _gadcDeinit(void) } #endif -void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency) +void gadcHighSpeedInit(gU32 physdev, gU32 frequency) { if ((hsFlags & GADC_HSADC_RUNNING)) gadcHighSpeedStop(); @@ -291,7 +291,7 @@ static void LowSpeedGTimerCallback(void *param) { } } -void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer) { +void gadcLowSpeedGet(gU32 physdev, adcsample_t *buffer) { NonTimerData ndata; // Prepare the job @@ -319,7 +319,7 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer) { gfxSemDestroy(&ndata.sigdone); } -gBool gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) { +gBool gadcLowSpeedStart(gU32 physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) { NonTimerData *pdata; /* Start the Low Speed Timer */ diff --git a/src/gadc/gadc.h b/src/gadc/gadc.h index d731f9ef..963be473 100644 --- a/src/gadc/gadc.h +++ b/src/gadc/gadc.h @@ -67,7 +67,7 @@ typedef struct GEventADC_t { /** * @brief The event flags */ - uint16_t flags; + gU16 flags; /** * @brief The event flag values. * @{ @@ -121,7 +121,7 @@ typedef void (*GADCISRCallbackFunction)(void); * * @api */ -void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency); +void gadcHighSpeedInit(gU32 physdev, gU32 frequency); #if GFX_USE_GEVENT || defined(__DOXYGEN__) /** @@ -211,7 +211,7 @@ void gadcHighSpeedStop(void); * * @api */ -void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer); +void gadcLowSpeedGet(gU32 physdev, adcsample_t *buffer); /** * @brief Perform a low speed ADC conversion with callback (in a thread context) @@ -236,7 +236,7 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer); * * @api */ -gBool gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param); +gBool gadcLowSpeedStart(gU32 physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param); #endif /* GFX_USE_GADC */ diff --git a/src/gadc/gadc_driver.h b/src/gadc/gadc_driver.h index ba73aa15..886062c9 100644 --- a/src/gadc/gadc_driver.h +++ b/src/gadc/gadc_driver.h @@ -33,11 +33,11 @@ * @{ */ typedef struct GadcTimerJob_t { - uint32_t physdev; // @< The physical device/s. The exact meaning of physdev is hardware dependent. - uint32_t frequency; // @< The frequency to sample + gU32 physdev; // @< The physical device/s. The exact meaning of physdev is hardware dependent. + gU32 frequency; // @< The frequency to sample adcsample_t *buffer; // @< Where to put the samples - size_t todo; // @< How many conversions to do - size_t done; // @< How many conversions have already been done + gMemSize todo; // @< How many conversions to do + gMemSize done; // @< How many conversions have already been done } GadcTimerJob; /** @} */ @@ -46,7 +46,7 @@ typedef struct GadcTimerJob_t { * @{ */ typedef struct GadcNonTimerJob_t { - uint32_t physdev; // @< The physical device/s. The exact meaning of physdev is hardware dependent. + gU32 physdev; // @< The physical device/s. The exact meaning of physdev is hardware dependent. adcsample_t *buffer; // @< Where to put the samples. } GadcNonTimerJob; /** @} */ @@ -75,7 +75,7 @@ extern "C" { * It can be called in this mode on an ADC conversion error. Any job will then be * restarted by the high level code as appropriate. */ - void gadcGotDataI(size_t n); + void gadcGotDataI(gMemSize n); /** * @} */ @@ -96,7 +96,7 @@ void gadc_lld_init(void); * * @api */ -size_t gadc_lld_samplesperconversion(uint32_t physdev); +gMemSize gadc_lld_samplesperconversion(gU32 physdev); /** * @brief Start a periodic timer for high frequency conversions. @@ -108,7 +108,7 @@ size_t gadc_lld_samplesperconversion(uint32_t physdev); * @api * @iclass */ -void gadc_lld_start_timerI(uint32_t freq); +void gadc_lld_start_timerI(gU32 freq); /** * @brief Stop the periodic timer for high frequency conversions. diff --git a/src/gaudio/gaudio.c b/src/gaudio/gaudio.c index d5ee0eee..e20999e6 100644 --- a/src/gaudio/gaudio.c +++ b/src/gaudio/gaudio.c @@ -14,7 +14,7 @@ static gfxQueueASync playList; static gfxSem playComplete; - static uint16_t playFlags; + static gU16 playFlags; #define PLAYFLG_USEEVENTS 0x0001 #define PLAYFLG_PLAYING 0x0002 #define PLAYFLG_ISINIT 0x0004 @@ -28,7 +28,7 @@ #include "gaudio_driver_record.h" static gfxQueueGSync recordList; - static uint16_t recordFlags; + static gU16 recordFlags; #define RECORDFLG_USEEVENTS 0x0001 #define RECORDFLG_RECORDING 0x0002 #define RECORDFLG_STALLED 0x0004 @@ -76,7 +76,7 @@ void _gaudioDeinit(void) #if GAUDIO_NEED_PLAY - gBool gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { + gBool gaudioPlayInit(gU16 channel, gU32 frequency, ArrayDataFormat format) { gaudioPlayStop(); playFlags &= ~PLAYFLG_ISINIT; if (!gaudio_play_lld_init(channel, frequency, format)) @@ -115,7 +115,7 @@ void _gaudioDeinit(void) gfxBufferRelease(pd); } - gBool gaudioPlaySetVolume(uint8_t vol) { + gBool gaudioPlaySetVolume(gU8 vol) { return gaudio_play_lld_set_volume(vol); } @@ -185,7 +185,7 @@ void _gaudioDeinit(void) #endif #if GAUDIO_NEED_RECORD - gBool gaudioRecordInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { + gBool gaudioRecordInit(gU16 channel, gU32 frequency, ArrayDataFormat format) { gaudioRecordStop(); recordFlags &= ~RECORDFLG_ISINIT; if (!gaudio_record_lld_init(channel, frequency, format)) diff --git a/src/gaudio/gaudio.h b/src/gaudio/gaudio.h index 4be67a99..f082234b 100644 --- a/src/gaudio/gaudio.h +++ b/src/gaudio/gaudio.h @@ -51,7 +51,7 @@ /** * @brief The event flags */ - uint16_t flags; + gU16 flags; /** * @brief The event flag values. * @{ @@ -75,7 +75,7 @@ /** * @brief The event flags */ - uint16_t flags; + gU16 flags; /** * @brief The event flag values. * @{ @@ -110,7 +110,7 @@ * * @api */ - gBool gaudioPlayInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); + gBool gaudioPlayInit(gU16 channel, gU32 frequency, ArrayDataFormat format); /** * @brief Play the specified sample data. @@ -164,7 +164,7 @@ * * @api */ - gBool gaudioPlaySetVolume(uint8_t vol); + gBool gaudioPlaySetVolume(gU8 vol); #if GFX_USE_GEVENT || defined(__DOXYGEN__) /** @@ -225,7 +225,7 @@ * * @api */ - gBool gaudioRecordInit(uint16_t channel, uint32_t frequency, ArrayDataFormat format); + gBool gaudioRecordInit(gU16 channel, gU32 frequency, ArrayDataFormat format); /** * @brief Start the audio recording. diff --git a/src/gaudio/gaudio_driver_play.h b/src/gaudio/gaudio_driver_play.h index 9ae26a7c..55342b45 100644 --- a/src/gaudio/gaudio_driver_play.h +++ b/src/gaudio/gaudio_driver_play.h @@ -81,7 +81,7 @@ void gaudioPlayDoneI(void); * * @api */ -gBool gaudio_play_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); +gBool gaudio_play_lld_init(gU16 channel, gU32 frequency, ArrayDataFormat format); /** * @brief Start the audio output playing @@ -117,7 +117,7 @@ void gaudio_play_lld_stop(void); * * @api */ -gBool gaudio_play_lld_set_volume(uint8_t vol); +gBool gaudio_play_lld_set_volume(gU8 vol); #ifdef __cplusplus } diff --git a/src/gaudio/gaudio_driver_record.h b/src/gaudio/gaudio_driver_record.h index 516f6aa1..dcba9bd1 100644 --- a/src/gaudio/gaudio_driver_record.h +++ b/src/gaudio/gaudio_driver_record.h @@ -81,7 +81,7 @@ extern "C" { * * @api */ -gBool gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format); +gBool gaudio_record_lld_init(gU16 channel, gU32 frequency, ArrayDataFormat format); /** * @brief Start the audio recording diff --git a/src/gdisp/fonts/DejaVuSans10.c b/src/gdisp/fonts/DejaVuSans10.c index 604fcd02..f3abbae4 100644 --- a/src/gdisp/fonts/DejaVuSans10.c +++ b/src/gdisp/fonts/DejaVuSans10.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_bwfont_DejaVuSans10_glyph_data_0[1222] = { +static const gU8 mf_bwfont_DejaVuSans10_glyph_data_0[1222] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe8, 0x00, 0x3e, 0x00, 0x28, 0x00, 0xf8, 0x00, 0x2e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x94, 0x00, 0xfe, 0x01, 0xa4, 0x00, @@ -91,7 +91,7 @@ static const uint8_t mf_bwfont_DejaVuSans10_glyph_data_0[1222] = { 0x20, 0x00, 0x20, 0x00, 0x10, 0x00, }; -static const uint16_t mf_bwfont_DejaVuSans10_glyph_offsets_0[96] = { +static const gU16 mf_bwfont_DejaVuSans10_glyph_offsets_0[96] = { 0x0000, 0x0000, 0x0004, 0x0009, 0x0012, 0x0019, 0x0023, 0x002c, 0x002f, 0x0033, 0x0037, 0x003d, 0x0046, 0x0049, 0x004e, 0x0051, 0x0055, 0x005c, 0x0063, 0x006a, 0x0071, 0x0078, 0x007f, 0x0086, @@ -106,7 +106,7 @@ static const uint16_t mf_bwfont_DejaVuSans10_glyph_offsets_0[96] = { 0x0238, 0x023f, 0x0246, 0x024c, 0x0252, 0x0255, 0x025b, 0x0263, }; -static const uint8_t mf_bwfont_DejaVuSans10_glyph_widths_0[95] = { +static const gU8 mf_bwfont_DejaVuSans10_glyph_widths_0[95] = { 0x03, 0x04, 0x05, 0x08, 0x06, 0x0a, 0x09, 0x03, 0x04, 0x04, 0x05, 0x08, 0x03, 0x04, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x08, 0x08, 0x08, 0x05, 0x0b, 0x07, 0x07, 0x08, 0x08, 0x07, 0x06, 0x08, 0x08, 0x03, 0x03, 0x07, 0x06, 0x09, 0x08, 0x08, diff --git a/src/gdisp/fonts/DejaVuSans12.c b/src/gdisp/fonts/DejaVuSans12.c index e9e16118..e7e39ac3 100644 --- a/src/gdisp/fonts/DejaVuSans12.c +++ b/src/gdisp/fonts/DejaVuSans12.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_bwfont_DejaVuSans12_glyph_data_0[1372] = { +static const gU8 mf_bwfont_DejaVuSans12_glyph_data_0[1372] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x90, 0x02, 0xf0, 0x01, 0x9c, 0x00, 0x90, 0x03, 0xf8, 0x00, 0x94, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x01, 0x24, 0x02, @@ -100,7 +100,7 @@ static const uint8_t mf_bwfont_DejaVuSans12_glyph_data_0[1372] = { 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, }; -static const uint16_t mf_bwfont_DejaVuSans12_glyph_offsets_0[96] = { +static const gU16 mf_bwfont_DejaVuSans12_glyph_offsets_0[96] = { 0x0000, 0x0000, 0x0004, 0x0009, 0x0013, 0x001b, 0x0026, 0x0030, 0x0033, 0x0038, 0x003d, 0x0044, 0x004d, 0x0050, 0x0055, 0x0058, 0x005d, 0x0065, 0x006c, 0x0074, 0x007c, 0x0084, 0x008c, 0x0094, @@ -115,7 +115,7 @@ static const uint16_t mf_bwfont_DejaVuSans12_glyph_offsets_0[96] = { 0x027d, 0x0284, 0x028b, 0x0291, 0x0299, 0x029d, 0x02a4, 0x02ae, }; -static const uint8_t mf_bwfont_DejaVuSans12_glyph_widths_0[95] = { +static const gU8 mf_bwfont_DejaVuSans12_glyph_widths_0[95] = { 0x04, 0x05, 0x05, 0x0a, 0x08, 0x0b, 0x0a, 0x03, 0x05, 0x05, 0x06, 0x0a, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x0a, 0x0a, 0x0a, 0x06, 0x0d, 0x08, 0x08, 0x08, 0x09, 0x08, 0x07, 0x09, 0x09, 0x03, 0x03, 0x07, 0x06, 0x0a, 0x09, 0x09, diff --git a/src/gdisp/fonts/DejaVuSans12_aa.c b/src/gdisp/fonts/DejaVuSans12_aa.c index 3384b4e3..9f5021ea 100644 --- a/src/gdisp/fonts/DejaVuSans12_aa.c +++ b/src/gdisp/fonts/DejaVuSans12_aa.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans12_aa_dictionary_data[329] = { +static const gU8 mf_rlefont_DejaVuSans12_aa_dictionary_data[329] = { 0x27, 0x02, 0x0b, 0x80, 0x01, 0x80, 0x07, 0x80, 0x04, 0x80, 0x02, 0x80, 0x06, 0x04, 0x80, 0x02, 0x0e, 0xc9, 0xde, 0xc7, 0x0a, 0x06, 0x2a, 0x10, 0x84, 0x07, 0x80, 0x02, 0x80, 0x0c, 0x80, 0x0c, 0x0f, 0x80, 0x08, 0xcd, 0xc3, 0x86, 0x0d, 0x0c, 0xc2, 0xca, 0x29, 0xc8, 0xcb, 0xc4, 0xcc, 0xce, @@ -35,7 +35,7 @@ static const uint8_t mf_rlefont_DejaVuSans12_aa_dictionary_data[329] = { 0x45, 0x0f, 0x45, 0x0c, 0x08, 0x48, 0x08, 0x0c, 0x3f, }; -static const uint16_t mf_rlefont_DejaVuSans12_aa_dictionary_offsets[122] = { +static const gU16 mf_rlefont_DejaVuSans12_aa_dictionary_offsets[122] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0005, 0x000b, 0x000d, 0x000e, 0x0010, 0x0011, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001c, 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0027, 0x0028, @@ -54,7 +54,7 @@ static const uint16_t mf_rlefont_DejaVuSans12_aa_dictionary_offsets[122] = { 0x0143, 0x0149, }; -static const uint8_t mf_rlefont_DejaVuSans12_aa_glyph_data_0[2069] = { +static const gU8 mf_rlefont_DejaVuSans12_aa_glyph_data_0[2069] = { 0x04, 0x00, 0x10, 0x05, 0x25, 0x8b, 0x0e, 0x2e, 0x0d, 0x20, 0x83, 0x0f, 0x10, 0x05, 0x1a, 0x94, 0x1d, 0x94, 0x6b, 0xac, 0x10, 0x0a, 0x29, 0x25, 0x0d, 0x01, 0x5d, 0x3f, 0x55, 0x0c, 0x00, 0x08, 0x06, 0x23, 0x05, 0xc3, 0x6b, 0x0a, 0x05, 0x49, 0x45, 0x0d, 0x01, 0x5d, 0x3f, 0x2c, 0x05, 0x23, @@ -187,7 +187,7 @@ static const uint8_t mf_rlefont_DejaVuSans12_aa_glyph_data_0[2069] = { 0x05, 0x70, 0x0c, 0x05, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans12_aa_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans12_aa_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000d, 0x0015, 0x0039, 0x005e, 0x008a, 0x00b7, 0x00bb, 0x00d2, 0x00ec, 0x0104, 0x010d, 0x0112, 0x0117, 0x011c, 0x0133, 0x0152, 0x015a, 0x0175, 0x0196, 0x01ad, 0x01c7, 0x01f1, diff --git a/src/gdisp/fonts/DejaVuSans16.c b/src/gdisp/fonts/DejaVuSans16.c index 375ec048..bfe62297 100644 --- a/src/gdisp/fonts/DejaVuSans16.c +++ b/src/gdisp/fonts/DejaVuSans16.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans16_dictionary_data[247] = { +static const gU8 mf_rlefont_DejaVuSans16_dictionary_data[247] = { 0x0f, 0x15, 0x83, 0x0a, 0x41, 0x2f, 0x06, 0x0a, 0x80, 0x01, 0x0b, 0x83, 0x01, 0x3d, 0x05, 0x80, 0x09, 0x80, 0x06, 0x80, 0x09, 0x80, 0x06, 0x80, 0x09, 0x80, 0x01, 0x05, 0x80, 0x03, 0x0a, 0x81, 0x0e, 0x80, 0x0d, 0x03, 0x80, 0x01, 0x0f, 0x80, 0x10, 0x80, 0x10, 0x80, 0x01, 0x09, 0x80, 0x01, @@ -30,7 +30,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_dictionary_data[247] = { 0xc0, 0xc4, 0x2d, 0x2d, 0x23, 0xfc, 0x36, }; -static const uint16_t mf_rlefont_DejaVuSans16_dictionary_offsets[88] = { +static const gU16 mf_rlefont_DejaVuSans16_dictionary_offsets[88] = { 0x0000, 0x0001, 0x0002, 0x0004, 0x0006, 0x0007, 0x000a, 0x000d, 0x000e, 0x001b, 0x001e, 0x0020, 0x0023, 0x0026, 0x002d, 0x0030, 0x0031, 0x0037, 0x0038, 0x003b, 0x0040, 0x0042, 0x0046, 0x0049, @@ -44,7 +44,7 @@ static const uint16_t mf_rlefont_DejaVuSans16_dictionary_offsets[88] = { 0x00e6, 0x00e8, 0x00ea, 0x00ed, 0x00f0, 0x00f1, 0x00f4, 0x00f7, }; -static const uint8_t mf_rlefont_DejaVuSans16_glyph_data_0[1166] = { +static const gU8 mf_rlefont_DejaVuSans16_glyph_data_0[1166] = { 0x05, 0x00, 0x10, 0x06, 0x27, 0x43, 0x49, 0x18, 0x2f, 0x2b, 0x10, 0x06, 0x58, 0x55, 0x3d, 0x55, 0x10, 0x0d, 0xf4, 0x19, 0x41, 0x8d, 0x42, 0xfa, 0x5e, 0x29, 0xdd, 0x5e, 0x29, 0xdd, 0x10, 0x0a, 0x2f, 0x65, 0x2c, 0x1a, 0xfe, 0xa9, 0x1d, 0x55, 0xe0, 0x38, 0x8b, 0x4a, 0x36, 0xd6, 0x1d, 0xde, @@ -120,7 +120,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_glyph_data_0[1166] = { 0x18, 0x8a, 0x4a, 0x49, 0x4c, 0x10, 0x0d, 0x00, 0x1f, 0x1f, 0x93, 0x68, 0x7c, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans16_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans16_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000b, 0x0011, 0x001f, 0x0034, 0x004f, 0x0064, 0x0068, 0x0074, 0x007f, 0x008d, 0x0097, 0x009c, 0x00a2, 0x00a6, 0x00b2, 0x00c0, 0x00ca, 0x00d9, 0x00e7, 0x00f8, 0x0106, 0x0116, diff --git a/src/gdisp/fonts/DejaVuSans16_aa.c b/src/gdisp/fonts/DejaVuSans16_aa.c index adcf9a37..63de43dc 100644 --- a/src/gdisp/fonts/DejaVuSans16_aa.c +++ b/src/gdisp/fonts/DejaVuSans16_aa.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans16_aa_dictionary_data[425] = { +static const gU8 mf_rlefont_DejaVuSans16_aa_dictionary_data[425] = { 0x02, 0x07, 0x05, 0x16, 0x0a, 0x80, 0x02, 0x09, 0x04, 0x11, 0x10, 0x0a, 0x08, 0x01, 0x80, 0x04, 0x80, 0x08, 0x80, 0x40, 0x08, 0x86, 0x14, 0x80, 0x01, 0x80, 0x11, 0x80, 0x11, 0x80, 0xc1, 0x80, 0xc3, 0xcb, 0xde, 0x88, 0x85, 0x80, 0x0e, 0x01, 0xc1, 0x07, 0xc7, 0xc9, 0x07, 0x80, 0x03, 0xca, @@ -41,7 +41,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_aa_dictionary_data[425] = { 0x30, 0x47, 0x05, 0x66, 0x02, 0x65, 0x06, 0x02, 0x00, }; -static const uint16_t mf_rlefont_DejaVuSans16_aa_dictionary_offsets[140] = { +static const gU16 mf_rlefont_DejaVuSans16_aa_dictionary_offsets[140] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000f, 0x0011, 0x0013, 0x0015, 0x0016, 0x0017, 0x0019, 0x001e, 0x0020, 0x0023, 0x0024, 0x0025, @@ -62,7 +62,7 @@ static const uint16_t mf_rlefont_DejaVuSans16_aa_dictionary_offsets[140] = { 0x019a, 0x01a2, 0x01a7, 0x01a9, }; -static const uint8_t mf_rlefont_DejaVuSans16_aa_glyph_data_0[2853] = { +static const gU8 mf_rlefont_DejaVuSans16_aa_glyph_data_0[2853] = { 0x05, 0x00, 0x10, 0x06, 0x6a, 0x89, 0x1f, 0x0e, 0x1f, 0x0d, 0x82, 0x69, 0x61, 0x10, 0x06, 0x28, 0xed, 0x48, 0xa8, 0x48, 0xa8, 0x48, 0xa8, 0x10, 0x0d, 0x18, 0x69, 0x70, 0x00, 0x2b, 0x03, 0x48, 0x0d, 0x06, 0x00, 0x05, 0x0e, 0x48, 0x4a, 0xa2, 0x70, 0x22, 0x65, 0x2d, 0x88, 0x0a, 0x09, 0x65, @@ -244,7 +244,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_aa_glyph_data_0[2853] = { 0x7c, 0x36, 0x19, 0x30, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans16_aa_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans16_aa_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000e, 0x0018, 0x004e, 0x007e, 0x00d1, 0x010e, 0x0111, 0x0136, 0x0158, 0x016f, 0x0179, 0x0183, 0x0188, 0x018e, 0x01ab, 0x01db, 0x01e8, 0x0210, 0x023c, 0x025c, 0x027b, 0x02b1, diff --git a/src/gdisp/fonts/DejaVuSans20.c b/src/gdisp/fonts/DejaVuSans20.c index cf9bd271..ccc36cb3 100644 --- a/src/gdisp/fonts/DejaVuSans20.c +++ b/src/gdisp/fonts/DejaVuSans20.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans20_dictionary_data[320] = { +static const gU8 mf_rlefont_DejaVuSans20_dictionary_data[320] = { 0x05, 0x0a, 0x81, 0x03, 0x17, 0x05, 0x81, 0x0b, 0x81, 0x84, 0x0b, 0x04, 0x83, 0x03, 0x82, 0x0b, 0x81, 0x02, 0x81, 0x02, 0x85, 0x12, 0x81, 0x0a, 0x80, 0x01, 0x80, 0x40, 0x18, 0x01, 0x87, 0x0b, 0x12, 0x81, 0x12, 0x81, 0x12, 0x81, 0x12, 0x81, 0x10, 0x04, 0x81, 0x1e, 0x11, 0x06, 0x81, 0x83, @@ -34,7 +34,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_dictionary_data[320] = { 0xaa, 0x34, 0x1c, 0x34, 0x9c, 0x38, 0x20, 0x37, 0xba, 0x34, 0x28, 0x34, 0x3b, 0x34, 0x39, 0x40, }; -static const uint16_t mf_rlefont_DejaVuSans20_dictionary_offsets[110] = { +static const gU16 mf_rlefont_DejaVuSans20_dictionary_offsets[110] = { 0x0000, 0x0001, 0x0004, 0x0005, 0x0009, 0x000b, 0x000d, 0x000f, 0x0011, 0x0014, 0x0015, 0x0018, 0x001b, 0x001d, 0x0020, 0x0028, 0x0029, 0x002b, 0x002c, 0x002d, 0x002f, 0x0031, 0x0033, 0x0036, @@ -51,7 +51,7 @@ static const uint16_t mf_rlefont_DejaVuSans20_dictionary_offsets[110] = { 0x0135, 0x0137, 0x0139, 0x013b, 0x013e, 0x0140, }; -static const uint8_t mf_rlefont_DejaVuSans20_glyph_data_0[1558] = { +static const gU8 mf_rlefont_DejaVuSans20_glyph_data_0[1558] = { 0x06, 0x00, 0x10, 0x08, 0x1a, 0x83, 0x65, 0x22, 0x29, 0x70, 0x10, 0x0a, 0x3e, 0x80, 0x7b, 0xd0, 0x80, 0x7b, 0x5f, 0xfc, 0xb7, 0x10, 0x11, 0x1a, 0x5e, 0x5f, 0xea, 0x20, 0x1f, 0x8c, 0x38, 0xa6, 0x3d, 0x33, 0x6e, 0x33, 0x3e, 0xa7, 0x38, 0x5b, 0x38, 0xa6, 0x3d, 0x33, 0x6e, 0x33, 0x19, 0x3d, @@ -152,7 +152,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_glyph_data_0[1558] = { 0x3f, 0x42, 0x93, 0x43, 0xc2, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans20_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans20_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000b, 0x0016, 0x0037, 0x0058, 0x0084, 0x00a7, 0x00aa, 0x00b7, 0x00c5, 0x00d9, 0x00e5, 0x00ed, 0x00f4, 0x00fa, 0x0104, 0x0114, 0x011f, 0x012f, 0x013d, 0x0155, 0x0165, 0x017d, diff --git a/src/gdisp/fonts/DejaVuSans20_aa.c b/src/gdisp/fonts/DejaVuSans20_aa.c index d05ab3b0..5297d319 100644 --- a/src/gdisp/fonts/DejaVuSans20_aa.c +++ b/src/gdisp/fonts/DejaVuSans20_aa.c @@ -10,7 +10,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans20_aa_dictionary_data[486] = { +static const gU8 mf_rlefont_DejaVuSans20_aa_dictionary_data[486] = { 0x05, 0x0b, 0x09, 0x81, 0x12, 0x81, 0x81, 0x05, 0x81, 0x0b, 0x0d, 0x17, 0x10, 0x28, 0x0b, 0x86, 0x12, 0x81, 0x12, 0x81, 0x08, 0x0e, 0x06, 0x84, 0x40, 0x1d, 0x80, 0xce, 0x8b, 0x08, 0x8b, 0x15, 0x80, 0xc3, 0x80, 0xcb, 0xca, 0x81, 0x12, 0x0a, 0x02, 0x81, 0xc7, 0x41, 0x3e, 0x01, 0xc9, 0x80, @@ -44,7 +44,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_aa_dictionary_data[486] = { 0x0f, 0x60, 0x08, 0x4e, 0x0d, 0x28, }; -static const uint16_t mf_rlefont_DejaVuSans20_aa_dictionary_offsets[156] = { +static const gU16 mf_rlefont_DejaVuSans20_aa_dictionary_offsets[156] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0006, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x0010, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x001a, 0x001c, 0x001f, 0x0020, 0x0022, 0x0024, 0x0026, 0x0027, @@ -67,7 +67,7 @@ static const uint16_t mf_rlefont_DejaVuSans20_aa_dictionary_offsets[156] = { 0x01e0, 0x01e2, 0x01e4, 0x01e6, }; -static const uint8_t mf_rlefont_DejaVuSans20_aa_glyph_data_0[3979] = { +static const gU8 mf_rlefont_DejaVuSans20_aa_glyph_data_0[3979] = { 0x06, 0x00, 0x10, 0x08, 0x25, 0x22, 0x8a, 0x2e, 0x3d, 0x2e, 0x0d, 0x0d, 0x2e, 0x48, 0x20, 0x22, 0x10, 0x0a, 0x1e, 0xb7, 0x96, 0x96, 0x10, 0x11, 0x58, 0x50, 0x05, 0x6d, 0x30, 0x48, 0x1d, 0x09, 0xf5, 0x01, 0x6f, 0x1d, 0x0d, 0x0b, 0x30, 0x05, 0x6d, 0x37, 0x02, 0x0f, 0x07, 0x00, 0x33, 0x2f, @@ -319,7 +319,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_aa_glyph_data_0[3979] = { 0x00, 0x01, 0x04, 0x08, 0x0c, 0x47, 0x55, 0x01, 0x25, 0x56, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans20_aa_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans20_aa_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x0011, 0x0017, 0x0066, 0x00ad, 0x0120, 0x017c, 0x017f, 0x01ac, 0x01db, 0x0207, 0x0210, 0x0219, 0x0222, 0x0227, 0x024f, 0x029c, 0x02af, 0x02e3, 0x031d, 0x034d, 0x0378, 0x03bb, diff --git a/src/gdisp/fonts/DejaVuSans24.c b/src/gdisp/fonts/DejaVuSans24.c index caabb080..224b6cfe 100644 --- a/src/gdisp/fonts/DejaVuSans24.c +++ b/src/gdisp/fonts/DejaVuSans24.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans24_dictionary_data[395] = { +static const gU8 mf_rlefont_DejaVuSans24_dictionary_data[395] = { 0x80, 0x0a, 0x80, 0x3d, 0x81, 0x02, 0x81, 0x81, 0x09, 0x81, 0x0c, 0x81, 0x09, 0x81, 0x0c, 0x81, 0x09, 0x81, 0x08, 0x16, 0x81, 0x01, 0x82, 0x0e, 0x84, 0x01, 0x07, 0x87, 0x01, 0x86, 0x0d, 0x85, 0x80, 0x0c, 0x83, 0x0f, 0x89, 0x0f, 0x82, 0x07, 0x0b, 0x81, 0x09, 0x81, 0x0c, 0x13, 0x81, 0x16, @@ -39,7 +39,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_dictionary_data[395] = { 0xc2, 0x90, 0x3b, 0x3a, 0x2a, 0xf0, 0x2d, 0x34, 0x3d, 0xf0, 0x54, }; -static const uint16_t mf_rlefont_DejaVuSans24_dictionary_offsets[119] = { +static const gU16 mf_rlefont_DejaVuSans24_dictionary_offsets[119] = { 0x0000, 0x0003, 0x0004, 0x0007, 0x0013, 0x0016, 0x0018, 0x001a, 0x001b, 0x001d, 0x001f, 0x0020, 0x0022, 0x0026, 0x0028, 0x002d, 0x002f, 0x0031, 0x0032, 0x0035, 0x0037, 0x003a, 0x003d, 0x0043, @@ -57,7 +57,7 @@ static const uint16_t mf_rlefont_DejaVuSans24_dictionary_offsets[119] = { 0x0172, 0x0173, 0x0178, 0x017e, 0x0184, 0x0189, 0x018b, }; -static const uint8_t mf_rlefont_DejaVuSans24_glyph_data_0[1873] = { +static const gU8 mf_rlefont_DejaVuSans24_glyph_data_0[1873] = { 0x08, 0x00, 0x10, 0x0a, 0x00, 0x4a, 0x47, 0x5d, 0x56, 0x19, 0x74, 0x10, 0x0b, 0x4c, 0x1a, 0x64, 0xfc, 0x1a, 0x64, 0xfc, 0x1a, 0x10, 0x14, 0xc4, 0x4e, 0xc7, 0xc6, 0x82, 0x8d, 0xc7, 0xc7, 0x82, 0x8d, 0xc5, 0xc7, 0x2b, 0x4b, 0x2c, 0x4b, 0xe7, 0x4a, 0x77, 0x8d, 0x4f, 0x3c, 0x2b, 0xa5, 0x4a, @@ -178,7 +178,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_glyph_data_0[1873] = { 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans24_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans24_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000c, 0x0016, 0x0043, 0x006c, 0x00a8, 0x00cf, 0x00d3, 0x00e0, 0x00ec, 0x0101, 0x010f, 0x0114, 0x011d, 0x0121, 0x0130, 0x014a, 0x0157, 0x016d, 0x0186, 0x01a5, 0x01bb, 0x01dd, diff --git a/src/gdisp/fonts/DejaVuSans24_aa.c b/src/gdisp/fonts/DejaVuSans24_aa.c index 9afd72c9..8a3d235b 100644 --- a/src/gdisp/fonts/DejaVuSans24_aa.c +++ b/src/gdisp/fonts/DejaVuSans24_aa.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans24_aa_dictionary_data[596] = { +static const gU8 mf_rlefont_DejaVuSans24_aa_dictionary_data[596] = { 0x20, 0x0f, 0x04, 0x81, 0x05, 0x1e, 0x11, 0x0c, 0x81, 0x01, 0x81, 0x0e, 0x81, 0x07, 0x81, 0x0e, 0x10, 0xc8, 0x80, 0xce, 0xc5, 0xd1, 0x04, 0x0b, 0x84, 0x09, 0x17, 0x81, 0x17, 0x81, 0x06, 0x88, 0x0e, 0x15, 0x12, 0x0a, 0x17, 0x81, 0x02, 0x09, 0x81, 0xce, 0x85, 0x0c, 0x83, 0x85, 0x06, 0xc2, @@ -52,7 +52,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_aa_dictionary_data[596] = { 0x38, 0x30, 0x0d, 0x65, }; -static const uint16_t mf_rlefont_DejaVuSans24_aa_dictionary_offsets[170] = { +static const gU16 mf_rlefont_DejaVuSans24_aa_dictionary_offsets[170] = { 0x0000, 0x0001, 0x0002, 0x0004, 0x0005, 0x0006, 0x0007, 0x0009, 0x0010, 0x0011, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001e, 0x001f, 0x0021, 0x0022, 0x0023, 0x0024, 0x0026, 0x0027, 0x0029, @@ -77,7 +77,7 @@ static const uint16_t mf_rlefont_DejaVuSans24_aa_dictionary_offsets[170] = { 0x0252, 0x0254, }; -static const uint8_t mf_rlefont_DejaVuSans24_aa_glyph_data_0[4800] = { +static const gU8 mf_rlefont_DejaVuSans24_aa_glyph_data_0[4800] = { 0x08, 0x00, 0x10, 0x0a, 0x2d, 0x4c, 0xae, 0x7e, 0x5c, 0x7e, 0x8a, 0x7e, 0x0d, 0x0d, 0x7e, 0x0c, 0x0c, 0x7f, 0x81, 0x98, 0x10, 0x0b, 0x4c, 0x50, 0x7f, 0x93, 0x93, 0x93, 0x10, 0x14, 0x3a, 0x18, 0x52, 0x54, 0x53, 0x1d, 0x36, 0x01, 0x2d, 0x09, 0x55, 0x1d, 0x4a, 0x3a, 0x6c, 0x44, 0xb3, 0x85, @@ -380,7 +380,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_aa_glyph_data_0[4800] = { 0x58, 0x2b, 0x39, 0x05, 0x01, 0x60, 0x0a, 0xc3, 0x46, 0x2b, 0x07, 0x27, 0x8e, 0x4a, 0x8d, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans24_aa_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans24_aa_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x0015, 0x001d, 0x0077, 0x00d4, 0x0174, 0x01dd, 0x01e1, 0x021d, 0x0251, 0x0282, 0x028f, 0x0299, 0x02a2, 0x02a7, 0x02de, 0x0337, 0x034b, 0x0389, 0x03d2, 0x040b, 0x0440, 0x049d, diff --git a/src/gdisp/fonts/DejaVuSans32.c b/src/gdisp/fonts/DejaVuSans32.c index ca669582..b63d201f 100644 --- a/src/gdisp/fonts/DejaVuSans32.c +++ b/src/gdisp/fonts/DejaVuSans32.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans32_dictionary_data[578] = { +static const gU8 mf_rlefont_DejaVuSans32_dictionary_data[578] = { 0x06, 0x83, 0x1e, 0x82, 0x03, 0x0c, 0x80, 0x09, 0x8b, 0x84, 0x0e, 0x80, 0x82, 0x0c, 0x80, 0x05, 0x83, 0x16, 0x83, 0x93, 0x0d, 0x87, 0x83, 0x11, 0x81, 0x1c, 0x87, 0x17, 0x80, 0x01, 0x1e, 0x82, 0x1e, 0x82, 0x1b, 0x81, 0x07, 0x82, 0x06, 0x06, 0x82, 0x03, 0x0b, 0x82, 0x08, 0x03, 0x82, 0x85, @@ -51,7 +51,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_dictionary_data[578] = { 0xd2, 0x5e, }; -static const uint16_t mf_rlefont_DejaVuSans32_dictionary_offsets[141] = { +static const gU16 mf_rlefont_DejaVuSans32_dictionary_offsets[141] = { 0x0000, 0x0002, 0x0005, 0x0007, 0x0008, 0x0009, 0x000a, 0x000c, 0x000f, 0x0011, 0x0013, 0x0016, 0x0017, 0x0019, 0x001a, 0x001e, 0x0022, 0x0024, 0x0027, 0x002a, 0x002d, 0x002f, 0x0031, 0x0034, @@ -72,7 +72,7 @@ static const uint16_t mf_rlefont_DejaVuSans32_dictionary_offsets[141] = { 0x0233, 0x0239, 0x023b, 0x023f, 0x0242, }; -static const uint8_t mf_rlefont_DejaVuSans32_glyph_data_0[2504] = { +static const gU8 mf_rlefont_DejaVuSans32_glyph_data_0[2504] = { 0x0a, 0x00, 0x10, 0x0d, 0x6e, 0x6c, 0x80, 0x6f, 0x25, 0x6e, 0x8b, 0x10, 0x0f, 0x6e, 0x68, 0x2c, 0x7e, 0x7e, 0x7e, 0x7e, 0x10, 0x1b, 0x67, 0x6e, 0x52, 0x58, 0x5e, 0x74, 0xc7, 0x4f, 0x9d, 0x2c, 0x8c, 0x5a, 0x24, 0x9d, 0x2c, 0x9d, 0x2c, 0x8c, 0x5a, 0x24, 0x9d, 0xb4, 0x9d, 0xdc, 0xa5, 0xc7, @@ -232,7 +232,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_glyph_data_0[2504] = { 0x36, 0x3d, 0xf0, 0x4b, 0x1e, 0x3b, 0xff, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans32_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans32_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000c, 0x0015, 0x0038, 0x0077, 0x00c9, 0x0105, 0x0109, 0x011f, 0x0135, 0x0156, 0x0165, 0x016f, 0x0179, 0x017f, 0x0196, 0x01b7, 0x01c8, 0x01dc, 0x01f8, 0x0225, 0x023e, 0x026b, diff --git a/src/gdisp/fonts/DejaVuSans32_aa.c b/src/gdisp/fonts/DejaVuSans32_aa.c index 8b8f6e8d..78f56141 100644 --- a/src/gdisp/fonts/DejaVuSans32_aa.c +++ b/src/gdisp/fonts/DejaVuSans32_aa.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSans32_aa_dictionary_data[740] = { +static const gU8 mf_rlefont_DejaVuSans32_aa_dictionary_data[740] = { 0x86, 0x1a, 0x86, 0x1a, 0x85, 0x1e, 0x82, 0x1e, 0x81, 0x12, 0x82, 0x08, 0x1a, 0x1d, 0x05, 0x85, 0x13, 0x1c, 0x88, 0x0f, 0x81, 0xcb, 0x0a, 0x82, 0x0f, 0x80, 0x1e, 0x82, 0x1e, 0x82, 0x83, 0x08, 0x0c, 0xce, 0x1d, 0x0d, 0x40, 0x07, 0x8d, 0x13, 0xc9, 0x85, 0x1e, 0x82, 0x15, 0x17, 0x8c, 0x01, @@ -61,7 +61,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_aa_dictionary_data[740] = { 0x3b, 0x2a, 0x0c, 0x1c, }; -static const uint16_t mf_rlefont_DejaVuSans32_aa_dictionary_offsets[188] = { +static const gU16 mf_rlefont_DejaVuSans32_aa_dictionary_offsets[188] = { 0x0000, 0x0005, 0x0009, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, 0x0014, 0x0016, 0x0019, 0x001e, 0x001f, 0x0020, 0x0021, 0x0023, 0x0024, 0x0026, 0x0028, 0x002a, 0x002c, 0x002d, @@ -88,7 +88,7 @@ static const uint16_t mf_rlefont_DejaVuSans32_aa_dictionary_offsets[188] = { 0x02de, 0x02e0, 0x02e2, 0x02e4, }; -static const uint8_t mf_rlefont_DejaVuSans32_aa_glyph_data_0[6702] = { +static const gU8 mf_rlefont_DejaVuSans32_aa_glyph_data_0[6702] = { 0x0a, 0x00, 0x10, 0x0d, 0x82, 0xe0, 0x3b, 0xac, 0x3b, 0x53, 0x28, 0x78, 0x0f, 0x28, 0x78, 0x52, 0x3b, 0x0c, 0x38, 0x3b, 0x0b, 0x88, 0x20, 0x82, 0xc1, 0x10, 0x0f, 0x82, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0x10, 0x1b, 0x76, 0x82, 0x81, 0x4f, 0x3d, 0x0e, 0x93, 0x9f, 0xc6, @@ -510,7 +510,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_aa_glyph_data_0[6702] = { 0x01, 0x29, 0x0e, 0x06, 0x26, 0x04, 0x09, 0x0c, 0x90, 0x45, 0x03, 0x6b, 0x8f, 0x10, }; -static const uint16_t mf_rlefont_DejaVuSans32_aa_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSans32_aa_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x001a, 0x0026, 0x00a6, 0x0132, 0x020e, 0x02a9, 0x02ad, 0x0301, 0x0353, 0x039e, 0x03ad, 0x03b9, 0x03c3, 0x03cb, 0x0416, 0x0497, 0x04b2, 0x0511, 0x0571, 0x05c3, 0x060c, 0x0698, diff --git a/src/gdisp/fonts/DejaVuSansBold12.c b/src/gdisp/fonts/DejaVuSansBold12.c index b2581760..f3fe8701 100644 --- a/src/gdisp/fonts/DejaVuSansBold12.c +++ b/src/gdisp/fonts/DejaVuSansBold12.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_bwfont_DejaVuSansBold12_glyph_data_0[1540] = { +static const gU8 mf_bwfont_DejaVuSansBold12_glyph_data_0[1540] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x03, 0x7e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xc8, 0x03, 0xf8, 0x01, 0x4e, 0x00, 0xc8, 0x03, 0x7c, 0x00, 0x4e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x02, 0x7c, 0x02, @@ -111,7 +111,7 @@ static const uint8_t mf_bwfont_DejaVuSansBold12_glyph_data_0[1540] = { 0x40, 0x00, 0x20, 0x00, }; -static const uint16_t mf_bwfont_DejaVuSansBold12_glyph_offsets_0[96] = { +static const gU16 mf_bwfont_DejaVuSansBold12_glyph_offsets_0[96] = { 0x0000, 0x0000, 0x0005, 0x000a, 0x0014, 0x001d, 0x002a, 0x0035, 0x0038, 0x003e, 0x0043, 0x004a, 0x0053, 0x0057, 0x005d, 0x0061, 0x0066, 0x006f, 0x0077, 0x0080, 0x0089, 0x0092, 0x009b, 0x00a4, @@ -126,7 +126,7 @@ static const uint16_t mf_bwfont_DejaVuSansBold12_glyph_offsets_0[96] = { 0x02cc, 0x02d4, 0x02dc, 0x02e4, 0x02ec, 0x02f0, 0x02f8, 0x0302, }; -static const uint8_t mf_bwfont_DejaVuSansBold12_glyph_widths_0[95] = { +static const gU8 mf_bwfont_DejaVuSansBold12_glyph_widths_0[95] = { 0x04, 0x05, 0x06, 0x0a, 0x08, 0x0c, 0x0a, 0x04, 0x05, 0x05, 0x06, 0x0a, 0x05, 0x05, 0x05, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x05, 0x0a, 0x0a, 0x0a, 0x07, 0x0c, 0x09, 0x09, 0x09, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x04, 0x04, 0x09, 0x08, 0x0c, 0x0a, 0x0b, diff --git a/src/gdisp/fonts/DejaVuSansBold12_aa.c b/src/gdisp/fonts/DejaVuSansBold12_aa.c index bab54f58..798444a0 100644 --- a/src/gdisp/fonts/DejaVuSansBold12_aa.c +++ b/src/gdisp/fonts/DejaVuSansBold12_aa.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_DejaVuSansBold12_aa_dictionary_data[295] = { +static const gU8 mf_rlefont_DejaVuSansBold12_aa_dictionary_data[295] = { 0x09, 0x06, 0xce, 0x80, 0xc2, 0x02, 0x11, 0x80, 0xc5, 0x07, 0x0a, 0x03, 0x0b, 0x02, 0x01, 0xc2, 0x06, 0x81, 0x81, 0x0c, 0x81, 0x86, 0x04, 0x81, 0x2c, 0x83, 0x05, 0x2b, 0x80, 0xc3, 0x80, 0xcb, 0x0f, 0x40, 0x07, 0xce, 0xcb, 0x80, 0xc6, 0x0c, 0xd9, 0x0c, 0x01, 0xca, 0x84, 0x1a, 0xc5, 0xc1, @@ -33,7 +33,7 @@ static const uint8_t mf_rlefont_DejaVuSansBold12_aa_dictionary_data[295] = { 0x36, 0x0b, 0x1c, 0x0d, 0x63, 0x0a, 0x49, }; -static const uint16_t mf_rlefont_DejaVuSansBold12_aa_dictionary_offsets[115] = { +static const gU16 mf_rlefont_DejaVuSansBold12_aa_dictionary_offsets[115] = { 0x0000, 0x0001, 0x0002, 0x0006, 0x0007, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x0010, 0x0012, 0x0015, 0x0016, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001e, 0x0020, 0x0021, 0x0023, @@ -51,7 +51,7 @@ static const uint16_t mf_rlefont_DejaVuSansBold12_aa_dictionary_offsets[115] = { 0x0123, 0x0125, 0x0127, }; -static const uint8_t mf_rlefont_DejaVuSansBold12_aa_glyph_data_0[2289] = { +static const gU8 mf_rlefont_DejaVuSansBold12_aa_glyph_data_0[2289] = { 0x04, 0x00, 0x10, 0x05, 0x1b, 0x6d, 0x50, 0x0d, 0x0d, 0x50, 0x0c, 0x0c, 0x34, 0x24, 0x10, 0x06, 0x2d, 0xee, 0x52, 0xac, 0x52, 0xac, 0x10, 0x0a, 0x52, 0x82, 0x4a, 0x06, 0x0d, 0x18, 0x46, 0x32, 0x09, 0x19, 0x51, 0x56, 0x69, 0x3f, 0x01, 0x1d, 0x74, 0x4a, 0x06, 0x0d, 0x52, 0xc3, 0x1c, 0x1d, @@ -198,7 +198,7 @@ static const uint8_t mf_rlefont_DejaVuSansBold12_aa_glyph_data_0[2289] = { 0x10, }; -static const uint16_t mf_rlefont_DejaVuSansBold12_aa_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_DejaVuSansBold12_aa_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x000f, 0x0017, 0x003e, 0x0064, 0x00a2, 0x00d5, 0x00d9, 0x00f5, 0x0113, 0x0129, 0x0132, 0x0136, 0x013d, 0x0142, 0x0158, 0x017b, 0x0184, 0x01a5, 0x01cd, 0x01eb, 0x0201, 0x0227, diff --git a/src/gdisp/fonts/LargeNumbers.c b/src/gdisp/fonts/LargeNumbers.c index 08517248..d2251524 100644 --- a/src/gdisp/fonts/LargeNumbers.c +++ b/src/gdisp/fonts/LargeNumbers.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_LargeNumbers_dictionary_data[141] = { +static const gU8 mf_rlefont_LargeNumbers_dictionary_data[141] = { 0x82, 0x11, 0x85, 0x11, 0x82, 0x0f, 0x10, 0x82, 0x02, 0x82, 0x10, 0x82, 0x02, 0x82, 0x16, 0x0d, 0x04, 0x15, 0x81, 0x8c, 0x0b, 0x8c, 0x03, 0x86, 0x11, 0x86, 0x80, 0x14, 0x82, 0x84, 0x0a, 0x1a, 0x82, 0x08, 0x03, 0x81, 0x89, 0x80, 0x0c, 0x44, 0x10, 0x09, 0x82, 0x81, 0x13, 0x83, 0x13, 0x84, @@ -23,7 +23,7 @@ static const uint8_t mf_rlefont_LargeNumbers_dictionary_data[141] = { 0x3c, 0x65, 0x39, 0x23, 0x23, 0x00, 0x2e, 0x25, 0x2c, 0x3d, 0x2a, 0x23, 0x0f, }; -static const uint16_t mf_rlefont_LargeNumbers_dictionary_offsets[55] = { +static const gU16 mf_rlefont_LargeNumbers_dictionary_offsets[55] = { 0x0000, 0x0005, 0x0006, 0x000c, 0x000e, 0x000f, 0x0010, 0x0011, 0x0013, 0x0016, 0x0018, 0x001a, 0x001d, 0x001e, 0x001f, 0x0021, 0x0022, 0x0024, 0x0025, 0x0027, 0x0029, 0x002b, 0x003a, 0x003c, @@ -33,7 +33,7 @@ static const uint16_t mf_rlefont_LargeNumbers_dictionary_offsets[55] = { 0x0080, 0x0082, 0x0085, 0x0087, 0x0089, 0x008b, 0x008d, }; -static const uint8_t mf_rlefont_LargeNumbers_glyph_data_0[630] = { +static const gU8 mf_rlefont_LargeNumbers_glyph_data_0[630] = { 0x08, 0x00, 0x10, 0x0b, 0x00, 0x26, 0x45, 0x49, 0x45, 0x3b, 0x7c, 0x49, 0x0f, 0x10, 0x0d, 0x26, 0x1b, 0x1a, 0x1b, 0x1a, 0x1b, 0x1a, 0x1b, 0x10, 0x14, 0x37, 0x1f, 0x75, 0x19, 0x40, 0x42, 0x37, 0x34, 0x29, 0x27, 0xd4, 0x75, 0x19, 0x40, 0xec, 0x2a, 0x34, 0x29, 0x37, 0x40, 0x42, 0x10, 0x11, @@ -76,7 +76,7 @@ static const uint8_t mf_rlefont_LargeNumbers_glyph_data_0[630] = { 0x37, 0x47, 0x3f, 0x3e, 0x21, 0x10, }; -static const uint16_t mf_rlefont_LargeNumbers_glyph_offsets_0[26] = { +static const gU16 mf_rlefont_LargeNumbers_glyph_offsets_0[26] = { 0x0000, 0x0003, 0x000e, 0x0018, 0x002f, 0x0065, 0x00a5, 0x00d5, 0x00db, 0x00eb, 0x00fb, 0x0114, 0x0125, 0x012d, 0x0136, 0x013b, 0x014c, 0x016a, 0x0180, 0x0199, 0x01b7, 0x01dc, 0x01f5, 0x021b, diff --git a/src/gdisp/fonts/UI1.c b/src/gdisp/fonts/UI1.c index c61c0f4f..05af02d8 100644 --- a/src/gdisp/fonts/UI1.c +++ b/src/gdisp/fonts/UI1.c @@ -26,7 +26,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_UI1_dictionary_data[283] = { +static const gU8 mf_rlefont_UI1_dictionary_data[283] = { 0x03, 0x80, 0x05, 0x84, 0x04, 0x03, 0x82, 0x08, 0x07, 0x81, 0x24, 0x0b, 0x05, 0x80, 0x02, 0x02, 0x81, 0x80, 0x0f, 0x83, 0x06, 0x01, 0x80, 0x05, 0x80, 0x03, 0x37, 0x22, 0x03, 0x83, 0x20, 0x06, 0x80, 0x01, 0x80, 0x85, 0x04, 0x80, 0x01, 0x80, 0x06, 0x12, 0x05, 0x82, 0x07, 0x80, 0x07, 0x15, @@ -47,7 +47,7 @@ static const uint8_t mf_rlefont_UI1_dictionary_data[283] = { 0x26, 0x37, 0x2f, 0x3e, 0xec, 0x86, 0x00, 0x85, 0x88, 0x27, 0x86, }; -static const uint16_t mf_rlefont_UI1_dictionary_offsets[108] = { +static const gU16 mf_rlefont_UI1_dictionary_offsets[108] = { 0x0000, 0x0003, 0x0005, 0x0008, 0x000a, 0x000b, 0x000c, 0x000f, 0x0011, 0x0013, 0x0015, 0x001a, 0x001b, 0x001c, 0x001e, 0x001f, 0x0020, 0x0023, 0x0024, 0x0029, 0x002a, 0x002c, 0x002f, 0x0030, @@ -64,15 +64,15 @@ static const uint16_t mf_rlefont_UI1_dictionary_offsets[108] = { 0x0114, 0x0116, 0x0118, 0x011b, }; -static const uint8_t mf_rlefont_UI1_glyph_data_0[3] = { +static const gU8 mf_rlefont_UI1_glyph_data_0[3] = { 0x03, 0x00, 0x10, }; -static const uint16_t mf_rlefont_UI1_glyph_offsets_0[1] = { +static const gU16 mf_rlefont_UI1_glyph_offsets_0[1] = { 0x0000, }; -static const uint8_t mf_rlefont_UI1_glyph_data_1[786] = { +static const gU8 mf_rlefont_UI1_glyph_data_1[786] = { 0x03, 0x00, 0x10, 0x03, 0x56, 0x50, 0x34, 0x32, 0x10, 0x05, 0xfd, 0x5e, 0xee, 0x10, 0x08, 0xc4, 0x44, 0x5e, 0x19, 0x80, 0xac, 0x1b, 0x8b, 0x2a, 0xd8, 0x10, 0x07, 0x35, 0x66, 0x64, 0x35, 0x57, 0x8a, 0x48, 0x88, 0x76, 0x0f, 0x10, 0x0b, 0x2f, 0xd4, 0x8c, 0x8d, 0xa8, 0x81, 0x9a, 0x32, 0x8a, @@ -125,7 +125,7 @@ static const uint8_t mf_rlefont_UI1_glyph_data_1[786] = { 0x1b, 0x10, }; -static const uint16_t mf_rlefont_UI1_glyph_offsets_1[100] = { +static const gU16 mf_rlefont_UI1_glyph_offsets_1[100] = { 0x0000, 0x0003, 0x0009, 0x000e, 0x001a, 0x0026, 0x0036, 0x0045, 0x0048, 0x004f, 0x0056, 0x005e, 0x0066, 0x006c, 0x0070, 0x0075, 0x007c, 0x0088, 0x0090, 0x0098, 0x00a1, 0x00ac, 0x00b5, 0x00bc, @@ -141,7 +141,7 @@ static const uint16_t mf_rlefont_UI1_glyph_offsets_1[100] = { 0x02ff, 0x02fe, 0x02fe, 0x030a, }; -static const uint8_t mf_rlefont_UI1_glyph_data_2[786] = { +static const gU8 mf_rlefont_UI1_glyph_data_2[786] = { 0x06, 0x26, 0xf8, 0x66, 0x21, 0xa2, 0x1b, 0x10, 0x08, 0x23, 0x29, 0x10, 0x0c, 0x23, 0x43, 0x83, 0x10, 0x00, 0x0b, 0x7d, 0x37, 0xdd, 0x8a, 0xad, 0x7a, 0xae, 0x10, 0x03, 0x1d, 0x47, 0x5f, 0x10, 0x06, 0x34, 0x8c, 0x1b, 0x6e, 0xfd, 0x78, 0x70, 0xd0, 0x32, 0x10, 0x07, 0x00, 0x2f, 0x6e, 0x3e, @@ -194,7 +194,7 @@ static const uint8_t mf_rlefont_UI1_glyph_data_2[786] = { 0x82, 0x10, }; -static const uint16_t mf_rlefont_UI1_glyph_offsets_2[107] = { +static const gU16 mf_rlefont_UI1_glyph_offsets_2[107] = { 0x0000, 0x0008, 0x000c, 0x0011, 0x0012, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x0011, 0x001b, 0x0020, 0x002b, 0x0035, 0x0041, 0x004c, 0x0053, 0x0060, 0x0064, 0x0073, 0x007d, 0x0086, diff --git a/src/gdisp/fonts/UI2.c b/src/gdisp/fonts/UI2.c index b1f368c2..6bee68ec 100644 --- a/src/gdisp/fonts/UI2.c +++ b/src/gdisp/fonts/UI2.c @@ -26,7 +26,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_rlefont_UI2_dictionary_data[159] = { +static const gU8 mf_rlefont_UI2_dictionary_data[159] = { 0x2c, 0x80, 0x06, 0x80, 0x03, 0x80, 0x06, 0x80, 0x03, 0x80, 0x01, 0x01, 0x80, 0x06, 0x80, 0x80, 0x0a, 0x80, 0x06, 0x21, 0x82, 0x01, 0x80, 0x07, 0x03, 0x80, 0x01, 0x80, 0x05, 0x02, 0x80, 0x07, 0x80, 0x0a, 0x80, 0x0a, 0x0b, 0x80, 0x01, 0x80, 0x05, 0x80, 0x02, 0x04, 0x80, 0x02, 0x09, 0x01, @@ -39,7 +39,7 @@ static const uint8_t mf_rlefont_UI2_dictionary_data[159] = { 0xc6, 0xa9, 0x25, 0x2e, 0x1e, 0xd6, 0x29, 0x1e, 0x25, 0x28, 0x1b, 0x1f, 0x22, 0x1b, 0x74, }; -static const uint16_t mf_rlefont_UI2_dictionary_offsets[62] = { +static const gU16 mf_rlefont_UI2_dictionary_offsets[62] = { 0x0000, 0x0001, 0x000b, 0x000f, 0x0013, 0x0014, 0x0015, 0x0018, 0x001c, 0x001d, 0x001f, 0x0021, 0x0024, 0x0025, 0x0028, 0x002b, 0x002e, 0x002f, 0x0031, 0x0032, 0x0034, 0x0035, 0x0038, 0x003a, @@ -50,7 +50,7 @@ static const uint16_t mf_rlefont_UI2_dictionary_offsets[62] = { 0x0092, 0x0095, 0x0096, 0x0098, 0x009d, 0x009f, }; -static const uint8_t mf_rlefont_UI2_glyph_data_0[822] = { +static const gU8 mf_rlefont_UI2_glyph_data_0[822] = { 0x03, 0x00, 0x10, 0x03, 0x46, 0x39, 0x4e, 0x10, 0x05, 0x50, 0xee, 0x10, 0x08, 0xfc, 0x24, 0x50, 0xe3, 0x22, 0x86, 0x1f, 0x22, 0x38, 0x50, 0x10, 0x07, 0xfc, 0x1e, 0x92, 0x48, 0x28, 0xd0, 0x23, 0x86, 0x88, 0x41, 0x2e, 0x10, 0x0b, 0x28, 0xdc, 0x94, 0xa8, 0x88, 0x96, 0x85, 0x9a, 0x28, 0x91, @@ -105,7 +105,7 @@ static const uint8_t mf_rlefont_UI2_glyph_data_0[822] = { 0x07, 0x2c, 0x2e, 0x89, 0x6c, 0x10, }; -static const uint16_t mf_rlefont_UI2_glyph_offsets_0[95] = { +static const gU16 mf_rlefont_UI2_glyph_offsets_0[95] = { 0x0000, 0x0003, 0x0008, 0x000c, 0x0018, 0x0025, 0x0036, 0x0045, 0x0048, 0x004e, 0x0054, 0x005e, 0x0067, 0x006c, 0x0070, 0x0075, 0x007e, 0x008c, 0x0095, 0x009e, 0x00a8, 0x00b4, 0x00be, 0x00c5, diff --git a/src/gdisp/fonts/fixed_10x20.c b/src/gdisp/fonts/fixed_10x20.c index 6c6fc416..daff69ff 100644 --- a/src/gdisp/fonts/fixed_10x20.c +++ b/src/gdisp/fonts/fixed_10x20.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_bwfont_fixed_10x20_glyph_data_0[2193] = { +static const gU8 mf_bwfont_fixed_10x20_glyph_data_0[2193] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1b, 0x00, 0xff, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x0f, 0x00, 0xf0, 0x0f, 0x00, 0xfe, 0x01, 0x00, @@ -152,7 +152,7 @@ static const uint8_t mf_bwfont_fixed_10x20_glyph_data_0[2193] = { 0x00, }; -static const uint16_t mf_bwfont_fixed_10x20_glyph_offsets_0[96] = { +static const gU16 mf_bwfont_fixed_10x20_glyph_offsets_0[96] = { 0x0000, 0x0000, 0x0005, 0x000c, 0x0015, 0x001d, 0x0026, 0x002f, 0x0034, 0x003b, 0x0041, 0x0049, 0x0051, 0x0057, 0x005f, 0x0065, 0x006d, 0x0075, 0x007d, 0x0085, 0x008d, 0x0095, 0x009d, 0x00a5, @@ -167,7 +167,7 @@ static const uint16_t mf_bwfont_fixed_10x20_glyph_offsets_0[96] = { 0x02a6, 0x02ae, 0x02b6, 0x02be, 0x02c6, 0x02cb, 0x02d3, 0x02db, }; -static const uint8_t mf_bwfont_fixed_10x20_glyph_widths_0[95] = { +static const gU8 mf_bwfont_fixed_10x20_glyph_widths_0[95] = { 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, diff --git a/src/gdisp/fonts/fixed_5x8.c b/src/gdisp/fonts/fixed_5x8.c index d65d58bf..367971f5 100644 --- a/src/gdisp/fonts/fixed_5x8.c +++ b/src/gdisp/fonts/fixed_5x8.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_bwfont_fixed_5x8_glyph_data_0[475] = { +static const gU8 mf_bwfont_fixed_5x8_glyph_data_0[475] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14, 0x04, 0x2a, 0x7f, 0x2a, 0x10, 0x00, 0x16, 0x08, 0x34, 0x00, 0x36, 0x49, 0x36, 0x40, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x00, 0x00, 0x00, 0x42, 0x3c, diff --git a/src/gdisp/fonts/fixed_7x14.c b/src/gdisp/fonts/fixed_7x14.c index 28b05608..bff0ef77 100644 --- a/src/gdisp/fonts/fixed_7x14.c +++ b/src/gdisp/fonts/fixed_7x14.c @@ -11,7 +11,7 @@ #error The font file is not compatible with this version of mcufont. #endif -static const uint8_t mf_bwfont_fixed_7x14_glyph_data_0[1330] = { +static const gU8 mf_bwfont_fixed_7x14_glyph_data_0[1330] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0xfe, 0x07, diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 8f8dbd7c..7b5438d7 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -196,7 +196,7 @@ static GFXINLINE void fillarea(GDisplay *g) { if (gvmt(g)->writestart) #endif { - uint32_t area; + gU32 area; #if GDISP_HARDWARE_STREAM_POS if ((g->flags & GDISP_FLG_SCRSTREAM)) { @@ -205,7 +205,7 @@ static GFXINLINE void fillarea(GDisplay *g) { } #endif - area = (uint32_t)g->p.cx * g->p.cy; + area = (gU32)g->p.cx * g->p.cy; gdisp_lld_write_start(g); #if GDISP_HARDWARE_STREAM_POS #if GDISP_HARDWARE_STREAM_POS == HARDWARE_AUTODETECT @@ -426,9 +426,9 @@ static void vline_clip(GDisplay *g) { // Parameters: x,y and x1,y1 // Alters: x,y x1,y1 cx,cy static void line_clip(GDisplay *g) { - int16_t dy, dx; - int16_t addx, addy; - int16_t P, diff, i; + gI16 dy, dx; + gI16 addx, addy; + gI16 P, diff, i; // Is this a horizontal line (or a point) if (g->p.y == g->p.y1) { @@ -713,8 +713,8 @@ gCoord gdispGGetWidth(GDisplay *g) { return g->g.Width; } gCoord gdispGGetHeight(GDisplay *g) { return g->g.Height; } gPowermode gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; } gOrientation gdispGGetOrientation(GDisplay *g) { return g->g.Orientation; } -uint8_t gdispGGetBacklight(GDisplay *g) { return g->g.Backlight; } -uint8_t gdispGGetContrast(GDisplay *g) { return g->g.Contrast; } +gU8 gdispGGetBacklight(GDisplay *g) { return g->g.Backlight; } +gU8 gdispGGetContrast(GDisplay *g) { return g->g.Contrast; } void gdispGFlush(GDisplay *g) { #if GDISP_HARDWARE_FLUSH @@ -1041,13 +1041,13 @@ void gdispGClear(GDisplay *g, gColor color) { if (gvmt(g)->writestart) #endif { - uint32_t area; + gU32 area; g->p.x = g->p.y = 0; g->p.cx = g->g.Width; g->p.cy = g->g.Height; g->p.color = color; - area = (uint32_t)g->p.cx * g->p.cy; + area = (gU32)g->p.cx * g->p.cy; gdisp_lld_write_start(g); #if GDISP_HARDWARE_STREAM_POS @@ -1428,8 +1428,8 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor #if GDISP_NEED_ELLIPSE void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color) { gCoord dx, dy; - int32_t a2, b2; - int32_t err, e2; + gI32 a2, b2; + gI32 err, e2; MUTEX_ENTER(g); @@ -1467,8 +1467,8 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor #if GDISP_NEED_ELLIPSE void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color) { gCoord dx, dy; - int32_t a2, b2; - int32_t err, e2; + gI32 a2, b2; + gI32 err, e2; MUTEX_ENTER(g); @@ -1502,7 +1502,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor #endif #if GDISP_NEED_ARCSECTORS - void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color) { + void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color) { gCoord a, b, P; MUTEX_ENTER(g); @@ -1546,7 +1546,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor #endif #if GDISP_NEED_ARCSECTORS - void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color) { + void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color) { gCoord a, b, P; MUTEX_ENTER(g); @@ -1733,7 +1733,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord start, gCoord end, gColor color) { gCoord a, b, P, sedge, eedge; - uint8_t full, sbit, ebit, tbit; + gU8 full, sbit, ebit, tbit; // Normalize the angles if (start < 0) @@ -2036,7 +2036,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor gCoord a, b, P; gCoord sy, ey; fixed sxa, sxb, sxd, exa, exb, exd; - uint8_t qtr; + gU8 qtr; MUTEX_ENTER(g); @@ -3099,7 +3099,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor } } - static int32_t rounding_div(const int32_t n, const int32_t d) + static gI32 rounding_div(const gI32 n, const gI32 d) { if ((n < 0) != (d < 0)) return (n - d/2) / d; @@ -3112,7 +3112,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor static void get_normal_vector(gCoord dx, gCoord dy, gCoord norm, gCoord *nx, gCoord *ny) { gCoord absDx, absDy; - int32_t len_n, len, len2; + gI32 len_n, len, len2; char maxSteps; /* Take the absolute value of dx and dy, multiplied by 2 for precision */ @@ -3259,7 +3259,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #include "mcufont/mcufont.h" #if GDISP_NEED_ANTIALIAS && GDISP_HARDWARE_PIXELREAD - static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { + static void drawcharline(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) { #define GD ((GDisplay *)state) if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1) return; @@ -3282,7 +3282,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #undef GD } #else - static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { + static void drawcharline(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) { #define GD ((GDisplay *)state) if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1) return; @@ -3301,7 +3301,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #endif #if GDISP_NEED_ANTIALIAS - static void fillcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { + static void fillcharline(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) { #define GD ((GDisplay *)state) if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1) return; @@ -3325,14 +3325,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #endif /* Callback to render characters. */ - static uint8_t drawcharglyph(int16_t x, int16_t y, mf_char ch, void *state) { + static gU8 drawcharglyph(gI16 x, gI16 y, mf_char ch, void *state) { #define GD ((GDisplay *)state) return mf_render_character(GD->t.font, x, y, ch, drawcharline, state); #undef GD } /* Callback to render characters. */ - static uint8_t fillcharglyph(int16_t x, int16_t y, mf_char ch, void *state) { + static gU8 fillcharglyph(gI16 x, gI16 y, mf_char ch, void *state) { #define GD ((GDisplay *)state) return mf_render_character(GD->t.font, x, y, ch, fillcharline, state); #undef GD @@ -3340,21 +3340,21 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor /* Callback to render string boxes with word wrap. */ #if GDISP_NEED_TEXT_WORDWRAP - static gBool mf_countline_callback(mf_str line, uint16_t count, void *state) { + static gBool mf_countline_callback(mf_str line, gU16 count, void *state) { (void) line; (void) count; ((gCoord*)state)[0]++; return gTrue; } - static gBool mf_drawline_callback(mf_str line, uint16_t count, void *state) { + static gBool mf_drawline_callback(mf_str line, gU16 count, void *state) { #define GD ((GDisplay *)state) mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, drawcharglyph, state); GD->t.wrapy += GD->t.font->line_height; #undef GD return gTrue; } - static gBool mf_fillline_callback(mf_str line, uint16_t count, void *state) { + static gBool mf_fillline_callback(mf_str line, gU16 count, void *state) { #define GD ((GDisplay *)state) mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, fillcharglyph, state); GD->t.wrapy += GD->t.font->line_height; @@ -3363,7 +3363,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor } #endif - void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color) { + void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color) { if (!font) return; MUTEX_ENTER(g); @@ -3378,7 +3378,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor MUTEX_EXIT(g); } - void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color, gColor bgcolor) { + void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color, gColor bgcolor) { if (!font) return; MUTEX_ENTER(g); @@ -3632,7 +3632,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor return mf_character_width(font, c); } - gCoord gdispGetStringWidthCount(const char* str, gFont font, uint16_t count) { + gCoord gdispGetStringWidthCount(const char* str, gFont font, gU16 count) { if (!str || !font) return 0; @@ -3652,14 +3652,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #if GDISP_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888 // Special alpha hacked version. // Note: this will still work with real RGB888 - gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha) + gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha) { - uint32_t ratio; - uint32_t a1, r1, g1, b1; - uint32_t a2, r2, g2, b2; + gU32 ratio; + gU32 a1, r1, g1, b1; + gU32 a2, r2, g2, b2; // Ratio - add one to get 1 to 256 - ratio = (uint32_t)alpha + 1; // 0 to 1 in 0.8 fixed point + ratio = (gU32)alpha + 1; // 0 to 1 in 0.8 fixed point // Calculate the pre-multiplied values of r, g, b for the fg color a1 = ALPHA_OF(fg); // 0 to 1 in 0.8 fixed point @@ -3699,11 +3699,11 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor return ARGB2COLOR(a1, r1, g1, b1); } #else - gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha) + gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha) { - uint16_t fg_ratio = alpha + 1; - uint16_t bg_ratio = 256 - alpha; - uint16_t r, g, b; + gU16 fg_ratio = alpha + 1; + gU16 bg_ratio = 256 - alpha; + gU16 r, g, b; r = RED_OF(fg) * fg_ratio; g = GREEN_OF(fg) * fg_ratio; @@ -3722,7 +3722,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #endif gColor gdispContrastColor(gColor color) { - uint16_t r, g, b; + gU16 r, g, b; r = RED_OF(color) > 128 ? 0 : 255; g = GREEN_OF(color) > 128 ? 0 : 255; diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h index a7d4ea4c..dffde4aa 100644 --- a/src/gdisp/gdisp.h +++ b/src/gdisp/gdisp.h @@ -36,7 +36,7 @@ /** * @brief The type for a coordinate or length on the screen. */ -typedef int16_t gCoord; +typedef gI16 gCoord; #if GFX_USE_GDISP || defined(__DOXYGEN__) @@ -237,7 +237,7 @@ typedef gColor gPixel; * * @api */ -gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha); +gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha); /** * @brief Find a contrasting color @@ -346,7 +346,7 @@ gOrientation gdispGGetOrientation(GDisplay *g); * * @api */ -uint8_t gdispGGetBacklight(GDisplay *g); +gU8 gdispGGetBacklight(GDisplay *g); #define gdispGetBacklight() gdispGGetBacklight(GDISP) /** @@ -358,7 +358,7 @@ uint8_t gdispGGetBacklight(GDisplay *g); * * @api */ -uint8_t gdispGGetContrast(GDisplay *g); +gU8 gdispGGetContrast(GDisplay *g); #define gdispGetContrast() gdispGGetContrast(GDISP) /* Drawing Functions */ @@ -657,7 +657,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ - void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color); + void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color); #define gdispDrawArcSectors(x,y,r,s,c) gdispGDrawArcSectors(GDISP,x,y,r,s,c) /** @@ -686,7 +686,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ - void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color); + void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color); #define gdispFillArcSectors(x,y,r,s,c) gdispGFillArcSectors(GDISP,x,y,r,s,c) #endif @@ -917,7 +917,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ - void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color); + void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color); #define gdispDrawChar(x,y,s,f,c) gdispGDrawChar(GDISP,x,y,s,f,c) /** @@ -933,7 +933,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ - void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color, gColor bgcolor); + void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color, gColor bgcolor); #define gdispFillChar(x,y,s,f,c,b) gdispGFillChar(GDISP,x,y,s,f,c,b) /** @@ -1040,7 +1040,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ - gCoord gdispGetStringWidthCount(const char* str, gFont font, uint16_t count); + gCoord gdispGetStringWidthCount(const char* str, gFont font, gU16 count); /** * @brief Get the pixel width of an entire string. @@ -1090,7 +1090,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * @param[in] scale_x The scale factor in horizontal direction. * @param[in] scale_y The scale factor in vertical direction. */ - gFont gdispScaleFont(gFont font, uint8_t scale_x, uint8_t scale_y); + gFont gdispScaleFont(gFont font, gU8 scale_x, gU8 scale_y); /** * @brief Get the name of the specified font. diff --git a/src/gdisp/gdisp_colors.h b/src/gdisp/gdisp_colors.h index 4f4521a8..37484165 100644 --- a/src/gdisp/gdisp_colors.h +++ b/src/gdisp/gdisp_colors.h @@ -23,7 +23,7 @@ #if GFX_USE_GDISP || defined(__DOXYGEN__) -typedef uint16_t gColorformat; +typedef gU16 gColorformat; /** * @name Color system masks @@ -173,7 +173,7 @@ typedef uint16_t gColorformat; /** * @brief The color type */ - #define COLOR_TYPE uint16_t + #define COLOR_TYPE gU16 /** * @brief The number of bits in the color type (not necessarily the same as COLOR_BITS). @@ -214,7 +214,7 @@ typedef uint16_t gColorformat; * @note A 5 bit color component maximum value (0x1F) converts to 0xF8 (slightly off-color) * @{ */ - #define LUMA_OF(c) ((RED_OF(c)+((uint16_t)GREEN_OF(c)<<1)+BLUE_OF(c))>>2) + #define LUMA_OF(c) ((RED_OF(c)+((gU16)GREEN_OF(c)<<1)+BLUE_OF(c))>>2) #define RED_OF(c) (((c) & 0xF800)>>8) #define GREEN_OF(c) (((c)&0x007E)>>3) #define BLUE_OF(c) (((c)&0x001F)<<3) @@ -234,7 +234,7 @@ typedef uint16_t gColorformat; * @note A 5 bit color component maximum value (0x1F) converts to 0xFF (the true equivalent color) * @{ */ - #define EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((uint16_t)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2) + #define EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((gU16)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2) #define EXACT_RED_OF(c) (((((c)>>11)&0x1F)*255)/31) #define EXACT_GREEN_OF(c) (((((c)>>5)&0x3F)*255)/63) #define EXACT_BLUE_OF(c) (((((c)>>0)&0x1F)*255)/31) @@ -261,13 +261,13 @@ typedef uint16_t gColorformat; // From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking #if COLOR_BITS <= 8 - #define COLOR_TYPE uint8_t + #define COLOR_TYPE gU8 #define COLOR_TYPE_BITS 8 #elif COLOR_BITS <= 16 - #define COLOR_TYPE uint16_t + #define COLOR_TYPE gU16 #define COLOR_TYPE_BITS 16 #elif COLOR_BITS <= 32 - #define COLOR_TYPE uint32_t + #define COLOR_TYPE gU32 #define COLOR_TYPE_BITS 32 #else #error "GDISP: Cannot define color types with more than 32 bits" @@ -321,11 +321,11 @@ typedef uint16_t gColorformat; #define BLUE_OF(c) (((c) & (((1<> (8-(COLOR_BITS_B+COLOR_SHIFT_B))) #endif - #define LUMA_OF(c) ((RED_OF(c)+((uint16_t)GREEN_OF(c)<<1)+BLUE_OF(c))>>2) - #define EXACT_RED_OF(c) (((uint16_t)(((c)>>COLOR_SHIFT_R)&((1<>COLOR_SHIFT_G)&((1<>COLOR_SHIFT_B)&((1<>2) + #define LUMA_OF(c) ((RED_OF(c)+((gU16)GREEN_OF(c)<<1)+BLUE_OF(c))>>2) + #define EXACT_RED_OF(c) (((gU16)(((c)>>COLOR_SHIFT_R)&((1<>COLOR_SHIFT_G)&((1<>COLOR_SHIFT_B)&((1<>2) #define LUMA2COLOR(l) (RGB2COLOR_R(l) | RGB2COLOR_G(l) | RGB2COLOR_B(l)) #define RGB2COLOR(r,g,b) (RGB2COLOR_R(r) | RGB2COLOR_G(g) | RGB2COLOR_B(b)) @@ -382,7 +382,7 @@ typedef uint16_t gColorformat; // From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking #if COLOR_BITS <= 8 - #define COLOR_TYPE uint8_t + #define COLOR_TYPE gU8 #define COLOR_TYPE_BITS 8 #else #error "GDISP: Cannot define gray-scale color types with more than 8 bits" @@ -402,11 +402,11 @@ typedef uint16_t gColorformat; #define EXACT_LUMA_OF(c) LUMA_OF(c) #else // They eye is more sensitive to green - #define RGB2COLOR(r,g,b) ((COLOR_TYPE)(((uint16_t)(r)+(g)+(g)+(b)) >> (10-COLOR_BITS))) + #define RGB2COLOR(r,g,b) ((COLOR_TYPE)(((gU16)(r)+(g)+(g)+(b)) >> (10-COLOR_BITS))) #define LUMA2COLOR(l) ((COLOR_TYPE)((l)>>(8-COLOR_BITS))) #define HTML2COLOR(h) ((COLOR_TYPE)(((((h)&0xFF0000)>>16)+(((h)&0x00FF00)>>7)+((h)&0x0000FF)) >> (10-COLOR_BITS))) #define LUMA_OF(c) (((c) & ((1<> (8-(LLDCOLOR_BITS_B+LLDCOLOR_SHIFT_B))) #endif - #define LLDLUMA_OF(c) ((LLDRED_OF(c)+((uint16_t)LLDGREEN_OF(c)<<1)+LLDBLUE_OF(c))>>2) - #define LLDEXACT_RED_OF(c) (((uint16_t)(((c)>>LLDCOLOR_SHIFT_R)&((1<>LLDCOLOR_SHIFT_G)&((1<>LLDCOLOR_SHIFT_B)&((1<>2) + #define LLDLUMA_OF(c) ((LLDRED_OF(c)+((gU16)LLDGREEN_OF(c)<<1)+LLDBLUE_OF(c))>>2) + #define LLDEXACT_RED_OF(c) (((gU16)(((c)>>LLDCOLOR_SHIFT_R)&((1<>LLDCOLOR_SHIFT_G)&((1<>LLDCOLOR_SHIFT_B)&((1<>2) #define LLDLUMA2COLOR(l) (LLDRGB2COLOR_R(l) | LLDRGB2COLOR_G(l) | LLDRGB2COLOR_B(l)) #define LLDRGB2COLOR(r,g,b) (LLDRGB2COLOR_R(r) | LLDRGB2COLOR_G(g) | LLDRGB2COLOR_B(b)) @@ -937,7 +937,7 @@ typedef struct GDISPVMT { // From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking #if LLDCOLOR_BITS <= 8 - #define LLDCOLOR_TYPE uint8_t + #define LLDCOLOR_TYPE gU8 #define LLDCOLOR_TYPE_BITS 8 #else #error "GDISP: Cannot define gray-scale low level driver color types with more than 8 bits" @@ -957,11 +957,11 @@ typedef struct GDISPVMT { #define LLDEXACT_LUMA_OF(c) LLDLUMA_OF(c) #else // They eye is more sensitive to green - #define LLDRGB2COLOR(r,g,b) ((LLDCOLOR_TYPE)(((uint16_t)(r)+(g)+(g)+(b)) >> (10-LLDCOLOR_BITS))) + #define LLDRGB2COLOR(r,g,b) ((LLDCOLOR_TYPE)(((gU16)(r)+(g)+(g)+(b)) >> (10-LLDCOLOR_BITS))) #define LLDLUMA2COLOR(l) ((LLDCOLOR_TYPE)((l)>>(8-LLDCOLOR_BITS))) #define LLDHTML2COLOR(h) ((LLDCOLOR_TYPE)(((((h)&0xFF0000)>>16)+(((h)&0x00FF00)>>7)+((h)&0x0000FF)) >> (10-LLDCOLOR_BITS))) #define LLDLUMA_OF(c) (((c) & ((1<fns->next(img); } -uint16_t gdispImageGetPaletteSize(gdispImage *img) { +gU16 gdispImageGetPaletteSize(gdispImage *img) { if (!img || !img->fns) return 0; if (!img->fns->getPaletteSize) return 0; return img->fns->getPaletteSize(img); } -gColor gdispImageGetPalette(gdispImage *img, uint16_t index) { +gColor gdispImageGetPalette(gdispImage *img, gU16 index) { if (!img || !img->fns) return 0; if (!img->fns->getPalette) return 0; return img->fns->getPalette(img, index); } -gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor) { +gBool gdispImageAdjustPalette(gdispImage *img, gU16 index, gColor newColor) { if (!img || !img->fns) return gFalse; if (!img->fns->adjustPalette) return gFalse; return img->fns->adjustPalette(img, index, newColor); @@ -212,7 +212,7 @@ gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor) // Helper Routines -void *gdispImageAlloc(gdispImage *img, size_t sz) { +void *gdispImageAlloc(gdispImage *img, gMemSize sz) { #if GDISP_NEED_IMAGE_ACCOUNTING void *ptr; @@ -229,7 +229,7 @@ void *gdispImageAlloc(gdispImage *img, size_t sz) { #endif } -void gdispImageFree(gdispImage *img, void *ptr, size_t sz) { +void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz) { #if GDISP_NEED_IMAGE_ACCOUNTING gfxFree(ptr); img->memused -= sz; @@ -244,44 +244,44 @@ void gdispImageFree(gdispImage *img, void *ptr, size_t sz) { && GFX_CPU_ENDIAN != GFX_CPU_ENDIAN_WBDWL && GFX_CPU_ENDIAN != GFX_CPU_ENDIAN_WLDWB union wbyteorder_u { - uint8_t b[2]; - uint32_t w; + gU8 b[2]; + gU32 w; }; union dwbyteorder_u { - uint8_t b[4]; - uint32_t l; + gU8 b[4]; + gU32 l; }; - uint16_t gdispImageH16toLE16(uint16_t w) { + gU16 gdispImageH16toLE16(gU16 w) { union wbyteorder_u we; we.w = w; - return (((uint16_t)we.b[0]))|(((uint16_t)we.b[1]) << 8); + return (((gU16)we.b[0]))|(((gU16)we.b[1]) << 8); } - uint16_t gdispImageH16toBE16(uint16_t w) { + gU16 gdispImageH16toBE16(gU16 w) { union wbyteorder_u we; we.w = w; - return (((uint16_t)we.b[0]) << 8)|(((uint16_t)we.b[1])); + return (((gU16)we.b[0]) << 8)|(((gU16)we.b[1])); } - uint32_t gdispImageH32toLE32(uint32_t dw) { + gU32 gdispImageH32toLE32(gU32 dw) { union dwbyteorder_u we; we.l = dw; - return (((uint32_t)we.b[0])) - |(((uint32_t)we.b[1]) << 8) - |(((uint32_t)we.b[2]) << 16) - |(((uint32_t)we.b[3]) << 24); + return (((gU32)we.b[0])) + |(((gU32)we.b[1]) << 8) + |(((gU32)we.b[2]) << 16) + |(((gU32)we.b[3]) << 24); } - uint32_t gdispImageH32toBE32(uint32_t dw) { + gU32 gdispImageH32toBE32(gU32 dw) { union dwbyteorder_u we; we.l = dw; - return (((uint32_t)we.b[0]) << 24) - |(((uint32_t)we.b[1]) << 16) - |(((uint32_t)we.b[2]) << 8) - |(((uint32_t)we.b[3])); + return (((gU32)we.b[0]) << 24) + |(((gU32)we.b[1]) << 16) + |(((gU32)we.b[2]) << 8) + |(((gU32)we.b[3])); } #endif diff --git a/src/gdisp/gdisp_image.h b/src/gdisp/gdisp_image.h index eeb45475..a590774c 100644 --- a/src/gdisp/gdisp_image.h +++ b/src/gdisp/gdisp_image.h @@ -23,7 +23,7 @@ /** * @brief The type of image */ -typedef uint16_t gdispImageType; +typedef gU16 gdispImageType; #define GDISP_IMAGE_TYPE_UNKNOWN 0 #define GDISP_IMAGE_TYPE_NATIVE 1 #define GDISP_IMAGE_TYPE_GIF 2 @@ -34,7 +34,7 @@ typedef uint16_t gdispImageType; /** * @brief An image error code */ -typedef uint16_t gdispImageError; +typedef gU16 gdispImageError; #define GDISP_IMAGE_ERR_OK 0 #define GDISP_IMAGE_ERR_UNRECOVERABLE 0x8000 #define GDISP_IMAGE_ERR_BADFORMAT (GDISP_IMAGE_ERR_UNRECOVERABLE+1) @@ -48,7 +48,7 @@ typedef uint16_t gdispImageError; /** * @brief Image flags */ -typedef uint16_t gdispImageFlags; +typedef gU16 gdispImageFlags; #define GDISP_IMAGE_FLG_TRANSPARENT 0x0001 /* The image has transparency */ #define GDISP_IMAGE_FLG_ANIMATED 0x0002 /* The image has animation */ #define GDISP_IMAGE_FLG_MULTIPAGE 0x0004 /* The image has multiple pages */ @@ -63,8 +63,8 @@ typedef struct gdispImage { gCoord width, height; /* @< The image dimensions */ GFILE * f; /* @< The underlying GFILE */ #if GDISP_NEED_IMAGE_ACCOUNTING - uint32_t memused; /* @< How much RAM is currently allocated */ - uint32_t maxmemused; /* @< How much RAM has been allocated (maximum) */ + gU32 memused; /* @< How much RAM is currently allocated */ + gU32 maxmemused; /* @< How much RAM has been allocated (maximum) */ #endif const struct gdispImageHandlers * fns; /* @< Don't mess with this! */ void * priv; /* @< Don't mess with this! */ @@ -253,7 +253,7 @@ gDelay gdispImageNext(gdispImage *img); * * @pre gdispImageOpen() must have returned successfully. */ -uint16_t gdispImageGetPaletteSize(gdispImage *img); +gU16 gdispImageGetPaletteSize(gdispImage *img); /** * @brief Get an entry in the color palette. @@ -266,7 +266,7 @@ uint16_t gdispImageGetPaletteSize(gdispImage *img); * * @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette. */ -gColor gdispImageGetPalette(gdispImage *img, uint16_t index); +gColor gdispImageGetPalette(gdispImage *img, gU16 index); /** * @brief Modify an entry in the color palette. @@ -279,7 +279,7 @@ gColor gdispImageGetPalette(gdispImage *img, uint16_t index); * @pre gdispImageOpen() must have returned successfully. * @note This function will return @p gFalse if the index is out of bounds or if the image doesn't use a color palette. */ -gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor); +gBool gdispImageAdjustPalette(gdispImage *img, gU16 index, gColor newColor); #endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */ #endif /* _GDISP_IMAGE_H */ diff --git a/src/gdisp/gdisp_image_bmp.c b/src/gdisp/gdisp_image_bmp.c index 98c8b3c9..c358a565 100644 --- a/src/gdisp/gdisp_image_bmp.c +++ b/src/gdisp/gdisp_image_bmp.c @@ -12,7 +12,7 @@ #include "gdisp_image_support.h" typedef struct gdispImagePrivate_BMP { - uint8_t bmpflags; + gU8 bmpflags; #define BMP_V2 0x01 // Version 2 (old) header format #define BMP_V4 0x02 // Version 4 (alpha support) header format #define BMP_PALETTE 0x04 // Uses a palette @@ -21,26 +21,26 @@ typedef struct gdispImagePrivate_BMP { #define BMP_RLE_ENC 0x20 // Currently in RLE encoded run #define BMP_RLE_ABS 0x40 // Currently in RLE absolute run #define BMP_TOP_TO_BOTTOM 0x80 // Decodes bottom to top line - uint8_t bitsperpixel; + gU8 bitsperpixel; #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_4_RLE || GDISP_NEED_IMAGE_BMP_8 || GDISP_NEED_IMAGE_BMP_8_RLE - uint16_t palsize; + gU16 palsize; gPixel *palette; #endif #if GDISP_NEED_IMAGE_BMP_4_RLE || GDISP_NEED_IMAGE_BMP_8_RLE - uint16_t rlerun; - uint8_t rlecode; + gU16 rlerun; + gU8 rlecode; #endif #if GDISP_NEED_IMAGE_BMP_16 || GDISP_NEED_IMAGE_BMP_32 - int8_t shiftred; - int8_t shiftgreen; - int8_t shiftblue; - int8_t shiftalpha; - uint32_t maskred; - uint32_t maskgreen; - uint32_t maskblue; - uint32_t maskalpha; -#endif - size_t frame0pos; + gI8 shiftred; + gI8 shiftgreen; + gI8 shiftblue; + gI8 shiftalpha; + gU32 maskred; + gU32 maskgreen; + gU32 maskblue; + gU32 maskalpha; +#endif + gFileSize frame0pos; gPixel *frame0cache; gPixel buf[GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE]; } gdispImagePrivate_BMP; @@ -63,10 +63,10 @@ void gdispImageClose_BMP(gdispImage *img) { gdispImageError gdispImageOpen_BMP(gdispImage *img) { gdispImagePrivate_BMP *priv; - uint8_t hdr[2]; - uint16_t aword; - uint32_t adword; - uint32_t offsetColorTable; + gU8 hdr[2]; + gU16 aword; + gU32 adword; + gU32 offsetColorTable; /* Read the file identifier */ if (gfileRead(img->f, hdr, 2) != 2) @@ -172,7 +172,7 @@ gdispImageError gdispImageOpen_BMP(gdispImage *img) { img->width = adword; // Get the height adword = gdispImageGetAlignedLE32(priv->buf, 4); - if ((int32_t)adword < 0) { // Negative test + if ((gI32)adword < 0) { // Negative test priv->bmpflags |= BMP_TOP_TO_BOTTOM; adword = -adword; } @@ -267,12 +267,12 @@ gdispImageError gdispImageOpen_BMP(gdispImage *img) { if (priv->bmpflags & BMP_V2) { for(aword = 0; aword < priv->palsize; aword++) { if (gfileRead(img->f, &priv->buf, 3) != 3) goto baddatacleanup; - priv->palette[aword] = RGB2COLOR(((uint8_t *)priv->buf)[2], ((uint8_t *)priv->buf)[1], ((uint8_t *)priv->buf)[0]); + priv->palette[aword] = RGB2COLOR(((gU8 *)priv->buf)[2], ((gU8 *)priv->buf)[1], ((gU8 *)priv->buf)[0]); } } else { for(aword = 0; aword < priv->palsize; aword++) { if (gfileRead(img->f, &priv->buf, 4) != 4) goto baddatacleanup; - priv->palette[aword] = RGB2COLOR(((uint8_t *)priv->buf)[2], ((uint8_t *)priv->buf)[1], ((uint8_t *)priv->buf)[0]); + priv->palette[aword] = RGB2COLOR(((gU8 *)priv->buf)[2], ((gU8 *)priv->buf)[1], ((gU8 *)priv->buf)[0]); } } @@ -365,8 +365,8 @@ static gCoord getPixels(gdispImage *img, gCoord x) { #if GDISP_NEED_IMAGE_BMP_1 case 1: { - uint8_t b[4]; - uint8_t m; + gU8 b[4]; + gU8 m; priv = (gdispImagePrivate_BMP *)img->priv; pc = priv->buf; @@ -398,7 +398,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { if (priv->bmpflags & BMP_COMP_RLE) #endif { - uint8_t b[4]; + gU8 b[4]; while(x < img->width) { if (priv->bmpflags & BMP_RLE_ENC) { @@ -462,7 +462,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { // There are always at least 2 bytes in an RLE code if (gfileRead(img->f, &b, 2) != 2) return 0; - priv->rlerun = b[0] + (uint16_t)b[1] * img->width; + priv->rlerun = b[0] + (gU16)b[1] * img->width; priv->rlecode = 0; // Who knows what color this should really be priv->bmpflags |= BMP_RLE_ENC; } else { // Absolute mode @@ -475,7 +475,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { #endif #if GDISP_NEED_IMAGE_BMP_4 { - uint8_t b[4]; + gU8 b[4]; while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-8) { if (gfileRead(img->f, &b, 4) != 4) @@ -504,7 +504,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { if (priv->bmpflags & BMP_COMP_RLE) #endif { - uint8_t b[4]; + gU8 b[4]; while(x < img->width) { if (priv->bmpflags & BMP_RLE_ENC) { @@ -556,7 +556,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { // There are always at least 2 bytes in an RLE code if (gfileRead(img->f, &b, 2) != 2) return GDISP_IMAGE_ERR_BADDATA; - priv->rlerun = b[0] + (uint16_t)b[1] * img->width; + priv->rlerun = b[0] + (gU16)b[1] * img->width; priv->rlecode = 0; // Who knows what color this should really be priv->bmpflags |= BMP_RLE_ENC; } else { // Absolute mode @@ -569,7 +569,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { #endif #if GDISP_NEED_IMAGE_BMP_8 { - uint8_t b[4]; + gU8 b[4]; while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-4) { if (gfileRead(img->f, &b, 4) != 4) @@ -590,7 +590,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { #if GDISP_NEED_IMAGE_BMP_16 case 16: { - uint16_t w[2]; + gU16 w[2]; gColor r, g, b; while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2) { @@ -623,7 +623,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { if (priv->shiftblue < 0) b = (gColor)((w[1] & priv->maskblue) << -priv->shiftblue); else - b = (uint8_t)((w[1] & priv->maskblue) >> priv->shiftblue); + b = (gU8)((w[1] & priv->maskblue) >> priv->shiftblue); /* We don't support alpha yet */ *pc++ = RGB2COLOR(r, g, b); x += 2; @@ -636,7 +636,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { #if GDISP_NEED_IMAGE_BMP_24 case 24: { - uint8_t b[3]; + gU8 b[3]; while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) { if (gfileRead(img->f, &b, 3) != 3) @@ -658,7 +658,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) { #if GDISP_NEED_IMAGE_BMP_32 case 32: { - uint32_t dw; + gU32 dw; gColor r, g, b; while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) { @@ -696,7 +696,7 @@ gdispImageError gdispImageCache_BMP(gdispImage *img) { gColor * pcs; gColor * pcd; gCoord pos, x, y; - size_t len; + gMemSize len; /* If we are already cached - just return OK */ priv = (gdispImagePrivate_BMP *)img->priv; @@ -822,7 +822,7 @@ gDelay gdispImageNext_BMP(gdispImage *img) { return gDelayForever; } -uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img) { +gU16 gdispImageGetPaletteSize_BMP(gdispImage *img) { #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 gdispImagePrivate_BMP *priv; @@ -839,7 +839,7 @@ uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img) { #endif } -gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) { +gColor gdispImageGetPalette_BMP(gdispImage *img, gU16 index) { #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 gdispImagePrivate_BMP *priv; @@ -853,14 +853,14 @@ gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) { if (index >= priv->palsize) return 0; - return priv->palette[(uint8_t)index]; + return priv->palette[(gU8)index]; #else return 0; #endif } -gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newColor) { +gBool gdispImageAdjustPalette_BMP(gdispImage *img, gU16 index, gColor newColor) { #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 gdispImagePrivate_BMP *priv; @@ -874,7 +874,7 @@ gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newCol if (index >= priv->palsize) return gFalse; - priv->palette[(uint8_t)index] = newColor; + priv->palette[(gU8)index] = newColor; return gTrue; diff --git a/src/gdisp/gdisp_image_gif.c b/src/gdisp/gdisp_image_gif.c index 632d168e..804dce52 100644 --- a/src/gdisp/gdisp_image_gif.c +++ b/src/gdisp/gdisp_image_gif.c @@ -22,7 +22,7 @@ #define GIF_CODE_NONE (GIF_CODE_MAX+3) // Illegal code to signal empty // Convert bits to masks for that number of bits -static const uint16_t GifBitMask[] = { +static const gU16 GifBitMask[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, @@ -31,68 +31,68 @@ static const uint16_t GifBitMask[] = { // Structure for decoding a single frame typedef struct gifimgdecode { - uint8_t blocksz; // The size of the block currently being processed - uint8_t maxpixel; // The maximum allowed pixel value - uint8_t bitsperpixel; - uint8_t bitspercode; - uint8_t shiftbits; - uint16_t maxcodesz; - uint16_t stackcnt; // The number of items on the stack - uint16_t code_clear; - uint16_t code_eof; - uint16_t code_max; - uint16_t code_last; - uint32_t shiftdata; + gU8 blocksz; // The size of the block currently being processed + gU8 maxpixel; // The maximum allowed pixel value + gU8 bitsperpixel; + gU8 bitspercode; + gU8 shiftbits; + gU16 maxcodesz; + gU16 stackcnt; // The number of items on the stack + gU16 code_clear; + gU16 code_eof; + gU16 code_max; + gU16 code_last; + gU32 shiftdata; gColor * palette; - uint8_t buf[GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE]; // Buffer for decoded pixels - uint16_t prefix[1<priv; @@ -182,8 +182,8 @@ static void stopDecodeGif(gdispImage *img) { } } -static uint16_t getPrefixGif(gifimgdecode *decode, uint16_t code) { - uint16_t i; +static gU16 getPrefixGif(gifimgdecode *decode, gU16 code) { + gU16 i; for(i=0; code > decode->code_clear && i <= GIF_CODE_MAX; i++, code = decode->prefix[code]) { if (code > GIF_CODE_MAX) @@ -201,12 +201,12 @@ static uint16_t getPrefixGif(gifimgdecode *decode, uint16_t code) { * * Note: The resulting pixels are stored in decode->buf */ -static uint16_t getBytesGif(gdispImage *img) { +static gU16 getBytesGif(gdispImage *img) { gdispImagePrivate_GIF * priv; gifimgdecode * decode; - uint16_t cnt; - uint16_t code, prefix; - uint8_t bdata; + gU16 cnt; + gU16 code, prefix; + gU8 bdata; priv = (gdispImagePrivate_GIF *)img->priv; decode = priv->decode; @@ -337,8 +337,8 @@ static uint16_t getBytesGif(gdispImage *img) { static gdispImageError initFrameGif(gdispImage *img) { gdispImagePrivate_GIF * priv; gifimgcache * cache; - uint8_t blocktype; - uint8_t blocksz; + gU8 blocktype; + gU8 blocksz; priv = (gdispImagePrivate_GIF *)img->priv; @@ -351,8 +351,8 @@ static gdispImageError initFrameGif(gdispImage *img) { priv->dispose.height = priv->frame.height; // Check for a cached version of this image - for(cache=priv->cache; cache && cache->frame.posstart <= (size_t)gfileGetPos(img->f); cache=cache->next) { - if (cache->frame.posstart == (size_t)gfileGetPos(img->f)) { + for(cache=priv->cache; cache && cache->frame.posstart <= gfileGetPos(img->f); cache=cache->next) { + if (cache->frame.posstart == gfileGetPos(img->f)) { priv->frame = cache->frame; priv->curcache = cache; return GDISP_IMAGE_ERR_OK; @@ -380,9 +380,9 @@ static gdispImageError initFrameGif(gdispImage *img) { priv->frame.y = gdispImageGetAlignedLE16(priv->buf, 2); priv->frame.width = gdispImageGetAlignedLE16(priv->buf, 4); priv->frame.height = gdispImageGetAlignedLE16(priv->buf, 6); - if (((uint8_t *)priv->buf)[8] & 0x80) // Local color table? - priv->frame.palsize = 2 << (((uint8_t *)priv->buf)[8] & 0x07); - if (((uint8_t *)priv->buf)[8] & 0x40) // Interlaced? + if (((gU8 *)priv->buf)[8] & 0x80) // Local color table? + priv->frame.palsize = 2 << (((gU8 *)priv->buf)[8] & 0x07); + if (((gU8 *)priv->buf)[8] & 0x40) // Interlaced? priv->frame.flags |= GIFL_INTERLACE; // We are ready to go for the actual palette read and image decode @@ -406,26 +406,26 @@ static gdispImageError initFrameGif(gdispImage *img) { if (gfileRead(img->f, priv->buf, 6) != 6) return GDISP_IMAGE_ERR_BADDATA; // Check we have read a 4 byte data block and a data block terminator (0) - if (((uint8_t *)priv->buf)[0] != 4 || ((uint8_t *)priv->buf)[5] != 0) + if (((gU8 *)priv->buf)[0] != 4 || ((gU8 *)priv->buf)[5] != 0) return GDISP_IMAGE_ERR_BADDATA; // Process the flags - switch(((uint8_t *)priv->buf)[1] & 0x1C) { + switch(((gU8 *)priv->buf)[1] & 0x1C) { case 0x00: case 0x04: break; // Dispose = do nothing case 0x08: priv->frame.flags |= GIFL_DISPOSECLEAR; break; // Dispose = clear case 0x0C: case 0x10: priv->frame.flags |= GIFL_DISPOSEREST; break; // Dispose = restore. Value 0x10 is a hack for bad encoders default: return GDISP_IMAGE_ERR_UNSUPPORTED; } - if (((uint8_t *)priv->buf)[1] & 0x01) { + if (((gU8 *)priv->buf)[1] & 0x01) { priv->frame.flags |= GIFL_TRANSPARENT; img->flags |= GDISP_IMAGE_FLG_TRANSPARENT; // We set this but never clear it } - if (((uint8_t *)priv->buf)[1] & 0x02) // Wait for user input? + if (((gU8 *)priv->buf)[1] & 0x02) // Wait for user input? img->flags |= GDISP_IMAGE_FLG_MULTIPAGE; else img->flags &= ~GDISP_IMAGE_FLG_MULTIPAGE; // Process frame delay and the transparent color (if any) priv->frame.delay = gdispImageGetAlignedLE16(priv->buf, 2); - priv->frame.paltrans = ((uint8_t *)priv->buf)[4]; + priv->frame.paltrans = ((gU8 *)priv->buf)[4]; break; case 0xFF: // EXTENSION - Application @@ -436,14 +436,14 @@ static gdispImageError initFrameGif(gdispImage *img) { if (gfileRead(img->f, priv->buf, 16) != 16) return GDISP_IMAGE_ERR_BADDATA; // Check we have read a 11 byte data block - if (((uint8_t *)priv->buf)[0] != 11 && ((uint8_t *)priv->buf)[12] != 3) + if (((gU8 *)priv->buf)[0] != 11 && ((gU8 *)priv->buf)[12] != 3) return GDISP_IMAGE_ERR_BADDATA; // Check the vendor - if (((uint8_t *)priv->buf)[1] == 'N' && ((uint8_t *)priv->buf)[2] == 'E' && ((uint8_t *)priv->buf)[3] == 'T' - && ((uint8_t *)priv->buf)[4] == 'S' && ((uint8_t *)priv->buf)[5] == 'C' && ((uint8_t *)priv->buf)[6] == 'A' - && ((uint8_t *)priv->buf)[7] == 'P' && ((uint8_t *)priv->buf)[8] == 'E' && ((uint8_t *)priv->buf)[9] == '2' - && ((uint8_t *)priv->buf)[10] == '.' && ((uint8_t *)priv->buf)[11] == '0') { - if (((uint8_t *)priv->buf)[13] == 1) { + if (((gU8 *)priv->buf)[1] == 'N' && ((gU8 *)priv->buf)[2] == 'E' && ((gU8 *)priv->buf)[3] == 'T' + && ((gU8 *)priv->buf)[4] == 'S' && ((gU8 *)priv->buf)[5] == 'C' && ((gU8 *)priv->buf)[6] == 'A' + && ((gU8 *)priv->buf)[7] == 'P' && ((gU8 *)priv->buf)[8] == 'E' && ((gU8 *)priv->buf)[9] == '2' + && ((gU8 *)priv->buf)[10] == '.' && ((gU8 *)priv->buf)[11] == '0') { + if (((gU8 *)priv->buf)[13] == 1) { priv->loops = gdispImageGetAlignedLE16(priv->buf, 14); priv->flags |= GIF_LOOP; if (!priv->loops) @@ -516,8 +516,8 @@ void gdispImageClose_GIF(gdispImage *img) { gdispImageError gdispImageOpen_GIF(gdispImage *img) { gdispImagePrivate_GIF *priv; - uint8_t hdr[6]; - uint16_t aword; + gU8 hdr[6]; + gU16 aword; /* Read the file identifier */ if (gfileRead(img->f, hdr, 6) != 6) @@ -555,9 +555,9 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) { img->width = gdispImageGetAlignedLE16(priv->buf, 0); // Get the height img->height = gdispImageGetAlignedLE16(priv->buf, 2); - if (((uint8_t *)priv->buf)[4] & 0x80) { + if (((gU8 *)priv->buf)[4] & 0x80) { // Global color table - priv->palsize = 2 << (((uint8_t *)priv->buf)[4] & 0x07); + priv->palsize = 2 << (((gU8 *)priv->buf)[4] & 0x07); // Allocate the global palette if (!(priv->palette = (gColor *)gdispImageAlloc(img, priv->palsize*sizeof(gColor)))) goto nomemcleanup; @@ -565,10 +565,10 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) { for(aword = 0; aword < priv->palsize; aword++) { if (gfileRead(img->f, &priv->buf, 3) != 3) goto baddatacleanup; - priv->palette[aword] = RGB2COLOR(((uint8_t *)priv->buf)[0], ((uint8_t *)priv->buf)[1], ((uint8_t *)priv->buf)[2]); + priv->palette[aword] = RGB2COLOR(((gU8 *)priv->buf)[0], ((gU8 *)priv->buf)[1], ((gU8 *)priv->buf)[2]); } } - priv->bgcolor = ((uint8_t *)priv->buf)[5]; + priv->bgcolor = ((gU8 *)priv->buf)[5]; // Save the fram0pos priv->frame0pos = gfileGetPos(img->f); @@ -599,10 +599,10 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) { gdispImagePrivate_GIF * priv; gifimgcache * cache; gifimgdecode * decode; - uint8_t * p; - uint8_t * q; + gU8 * p; + gU8 * q; gCoord mx, my; - uint16_t cnt; + gU16 cnt; /* If we are already cached - just return OK */ priv = (gdispImagePrivate_GIF *)img->priv; @@ -616,7 +616,7 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) { /* Initialise the cache */ decode = 0; cache->frame = priv->frame; - cache->imagebits = (uint8_t *)(cache+1) + cache->frame.palsize*sizeof(gColor); + cache->imagebits = (gU8 *)(cache+1) + cache->frame.palsize*sizeof(gColor); cache->next = 0; /* Start the decode */ @@ -769,10 +769,10 @@ baddatacleanup: gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) { gdispImagePrivate_GIF * priv; gifimgdecode * decode; - uint8_t * q = 0; + gU8 * q = 0; gCoord mx, my, fx, fy; - uint16_t cnt, gcnt; - uint8_t col; + gU16 cnt, gcnt; + gU8 col; priv = (gdispImagePrivate_GIF *)img->priv; @@ -1109,7 +1109,7 @@ baddatacleanup: gDelay gdispImageNext_GIF(gdispImage *img) { gdispImagePrivate_GIF * priv; gDelay delay; - uint8_t blocksz; + gU8 blocksz; priv = (gdispImagePrivate_GIF *)img->priv; diff --git a/src/gdisp/gdisp_image_jpg.c b/src/gdisp/gdisp_image_jpg.c index 3191d51a..716020fa 100644 --- a/src/gdisp/gdisp_image_jpg.c +++ b/src/gdisp/gdisp_image_jpg.c @@ -33,21 +33,21 @@ typedef struct { /* Decompressor object structure */ typedef struct JDEC { unsigned dctr; /* Number of bytes available in the input buffer */ - uint8_t* dptr; /* Current data read ptr */ - uint8_t* inbuf; /* Bit stream input buffer */ - uint8_t dmsk; /* Current bit in the current read byte */ - uint8_t scale; /* Output scaling ratio */ - uint8_t msx, msy; /* MCU size in unit of block (width, height) */ - uint8_t qtid[3]; /* Quantization table ID of each component */ - int16_t dcv[3]; /* Previous DC element of each component */ - uint16_t nrst; /* Restart inverval */ + gU8* dptr; /* Current data read ptr */ + gU8* inbuf; /* Bit stream input buffer */ + gU8 dmsk; /* Current bit in the current read byte */ + gU8 scale; /* Output scaling ratio */ + gU8 msx, msy; /* MCU size in unit of block (width, height) */ + gU8 qtid[3]; /* Quantization table ID of each component */ + gI16 dcv[3]; /* Previous DC element of each component */ + gU16 nrst; /* Restart inverval */ unsigned width, height; /* Size of the input image (pixel) */ - uint8_t* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */ - uint16_t* huffcode[2][2]; /* Huffman code word tables [id][dcac] */ - uint8_t* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */ - int32_t* qttbl[4]; /* Dequaitizer tables [id] */ + gU8* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */ + gU16* huffcode[2][2]; /* Huffman code word tables [id][dcac] */ + gU8* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */ + gI32* qttbl[4]; /* Dequaitizer tables [id] */ void* workbuf; /* Working buffer for IDCT and RGB output */ - uint8_t* mcubuf; /* Working buffer for the MCU */ + gU8* mcubuf; /* Working buffer for the MCU */ void* pool; /* Pointer to available memory pool */ unsigned sz_pool; /* Size of momory pool (bytes available) */ gdispImage* img; /* Pointer to I/O device identifiler for the session */ @@ -55,7 +55,7 @@ typedef struct JDEC { /* TJpgDec API functions */ gdispImageError jd_prepare(JDEC*, void*, gdispImage*); -gdispImageError jd_decomp(JDEC*, unsigned(*)(gdispImage*,void*,JRECT*), uint8_t); +gdispImageError jd_decomp(JDEC*, unsigned(*)(gdispImage*,void*,JRECT*), gU8); /*---------------------------------------------------------------------------*/ typedef struct gdispImagePrivate_JPG { @@ -64,7 +64,7 @@ typedef struct gdispImagePrivate_JPG { gdispImageError gdispImageOpen_JPG(gdispImage *img){ gdispImagePrivate_JPG *priv; - uint8_t hdr[4]; + gU8 hdr[4]; unsigned len; /* Read the file identifier */ @@ -132,7 +132,7 @@ void gdispImageClose_JPG(gdispImage *img){ static unsigned gdispImage_JPG_WriteToCache(gdispImage *img, void *bitmap, JRECT *rect) { gdispImagePrivate_JPG *priv; - uint8_t *in; + gU8 *in; gPixel *out; gCoord x, y; @@ -233,7 +233,7 @@ gDelay gdispImageNext_JPG(gdispImage *img) { #define ZIG(n) Zig[n] static -const uint8_t Zig[64] = { /* Zigzag-order to raster-order conversion table */ +const gU8 Zig[64] = { /* Zigzag-order to raster-order conversion table */ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, @@ -250,15 +250,15 @@ const uint8_t Zig[64] = { /* Zigzag-order to raster-order conversion table */ #define IPSF(n) Ipsf[n] static -const uint16_t Ipsf[64] = { /* See also aa_idct.png */ - (uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192), - (uint16_t)(1.38704*8192), (uint16_t)(1.92388*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.08979*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.38268*8192), - (uint16_t)(1.30656*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.70711*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.36048*8192), - (uint16_t)(1.17588*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.38268*8192), (uint16_t)(1.17588*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.32442*8192), - (uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192), - (uint16_t)(0.78570*8192), (uint16_t)(1.08979*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.61732*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.21677*8192), - (uint16_t)(0.54120*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.29290*8192), (uint16_t)(0.14932*8192), - (uint16_t)(0.27590*8192), (uint16_t)(0.38268*8192), (uint16_t)(0.36048*8192), (uint16_t)(0.32442*8192), (uint16_t)(0.27590*8192), (uint16_t)(0.21678*8192), (uint16_t)(0.14932*8192), (uint16_t)(0.07612*8192) +const gU16 Ipsf[64] = { /* See also aa_idct.png */ + (gU16)(1.00000*8192), (gU16)(1.38704*8192), (gU16)(1.30656*8192), (gU16)(1.17588*8192), (gU16)(1.00000*8192), (gU16)(0.78570*8192), (gU16)(0.54120*8192), (gU16)(0.27590*8192), + (gU16)(1.38704*8192), (gU16)(1.92388*8192), (gU16)(1.81226*8192), (gU16)(1.63099*8192), (gU16)(1.38704*8192), (gU16)(1.08979*8192), (gU16)(0.75066*8192), (gU16)(0.38268*8192), + (gU16)(1.30656*8192), (gU16)(1.81226*8192), (gU16)(1.70711*8192), (gU16)(1.53636*8192), (gU16)(1.30656*8192), (gU16)(1.02656*8192), (gU16)(0.70711*8192), (gU16)(0.36048*8192), + (gU16)(1.17588*8192), (gU16)(1.63099*8192), (gU16)(1.53636*8192), (gU16)(1.38268*8192), (gU16)(1.17588*8192), (gU16)(0.92388*8192), (gU16)(0.63638*8192), (gU16)(0.32442*8192), + (gU16)(1.00000*8192), (gU16)(1.38704*8192), (gU16)(1.30656*8192), (gU16)(1.17588*8192), (gU16)(1.00000*8192), (gU16)(0.78570*8192), (gU16)(0.54120*8192), (gU16)(0.27590*8192), + (gU16)(0.78570*8192), (gU16)(1.08979*8192), (gU16)(1.02656*8192), (gU16)(0.92388*8192), (gU16)(0.78570*8192), (gU16)(0.61732*8192), (gU16)(0.42522*8192), (gU16)(0.21677*8192), + (gU16)(0.54120*8192), (gU16)(0.75066*8192), (gU16)(0.70711*8192), (gU16)(0.63638*8192), (gU16)(0.54120*8192), (gU16)(0.42522*8192), (gU16)(0.29290*8192), (gU16)(0.14932*8192), + (gU16)(0.27590*8192), (gU16)(0.38268*8192), (gU16)(0.36048*8192), (gU16)(0.32442*8192), (gU16)(0.27590*8192), (gU16)(0.21678*8192), (gU16)(0.14932*8192), (gU16)(0.07612*8192) }; @@ -272,7 +272,7 @@ const uint16_t Ipsf[64] = { /* See also aa_idct.png */ #define BYTECLIP(v) Clip8[(unsigned)(v) & 0x3FF] static -const uint8_t Clip8[1024] = { +const gU8 Clip8[1024] = { /* 0..255 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, @@ -314,14 +314,14 @@ const uint8_t Clip8[1024] = { #else /* JD_TBLCLIP */ inline -uint8_t BYTECLIP ( +gU8 BYTECLIP ( int val ) { if (val < 0) val = 0; if (val > 255) val = 255; - return (uint8_t)val; + return (gU8)val; } #endif @@ -362,13 +362,13 @@ void* alloc_pool ( /* Pointer to allocated memory block (NULL:no memory availabl static unsigned create_qt_tbl ( /* 0:OK, !0:Failed */ JDEC* jd, /* Pointer to the decompressor object */ - const uint8_t* data, /* Pointer to the quantizer tables */ + const gU8* data, /* Pointer to the quantizer tables */ unsigned ndata /* Size of input data */ ) { unsigned i; - uint8_t d, z; - int32_t *pb; + gU8 d, z; + gI32 *pb; while (ndata) { /* Process all tables in the segment */ @@ -377,12 +377,12 @@ unsigned create_qt_tbl ( /* 0:OK, !0:Failed */ d = *data++; /* Get table property */ if (d & 0xF0) return GDISP_IMAGE_ERR_BADDATA; /* Err: not 8-bit resolution */ i = d & 3; /* Get table ID */ - pb = alloc_pool(jd, 64 * sizeof (int32_t));/* Allocate a memory block for the table */ + pb = alloc_pool(jd, 64 * sizeof (gI32));/* Allocate a memory block for the table */ if (!pb) return GDISP_IMAGE_ERR_NOMEMORY; /* Err: not enough memory */ jd->qttbl[i] = pb; /* Register the table */ for (i = 0; i < 64; i++) { /* Load the table */ z = ZIG(i); /* Zigzag-order to raster-order conversion */ - pb[z] = (int32_t)((uint32_t)*data++ * IPSF(z)); /* Apply scale factor of Arai algorithm to the de-quantizers */ + pb[z] = (gI32)((gU32)*data++ * IPSF(z)); /* Apply scale factor of Arai algorithm to the de-quantizers */ } } @@ -399,13 +399,13 @@ unsigned create_qt_tbl ( /* 0:OK, !0:Failed */ static unsigned create_huffman_tbl ( /* 0:OK, !0:Failed */ JDEC* jd, /* Pointer to the decompressor object */ - const uint8_t* data, /* Pointer to the packed huffman tables */ + const gU8* data, /* Pointer to the packed huffman tables */ unsigned ndata /* Size of input data */ ) { unsigned i, j, b, np, cls, num; - uint8_t d, *pb, *pd; - uint16_t hc, *ph; + gU8 d, *pb, *pd; + gU16 hc, *ph; while (ndata) { /* Process all tables in the segment */ @@ -422,7 +422,7 @@ unsigned create_huffman_tbl ( /* 0:OK, !0:Failed */ np += b; /* Get sum of code words for each code */ } - ph = alloc_pool(jd, np * sizeof (uint16_t));/* Allocate a memory block for the code word table */ + ph = alloc_pool(jd, np * sizeof (gU16));/* Allocate a memory block for the code word table */ if (!ph) return GDISP_IMAGE_ERR_NOMEMORY; /* Err: not enough memory */ jd->huffcode[num][cls] = ph; hc = 0; @@ -460,7 +460,7 @@ int bitext ( /* >=0: extracted data, <0: error code */ unsigned nbit /* Number of bits to extract (1 to 11) */ ) { - uint8_t msk, s, *dp; + gU8 msk, s, *dp; unsigned dc, v, f; @@ -508,12 +508,12 @@ int bitext ( /* >=0: extracted data, <0: error code */ static int huffext ( /* >=0: decoded data, <0: error code */ JDEC* jd, /* Pointer to the decompressor object */ - const uint8_t* hbits, /* Pointer to the bit distribution table */ - const uint16_t* hcode, /* Pointer to the code word table */ - const uint8_t* hdata /* Pointer to the data table */ + const gU8* hbits, /* Pointer to the bit distribution table */ + const gU16* hcode, /* Pointer to the code word table */ + const gU8* hdata /* Pointer to the data table */ ) { - uint8_t msk, s, *dp; + gU8 msk, s, *dp; unsigned dc, v, f, bl, nd; @@ -569,13 +569,13 @@ int huffext ( /* >=0: decoded data, <0: error code */ static void block_idct ( - int32_t* src, /* Input block data (de-quantized and pre-scaled for Arai Algorithm) */ - uint8_t* dst /* Pointer to the destination to store the block as byte array */ + gI32* src, /* Input block data (de-quantized and pre-scaled for Arai Algorithm) */ + gU8* dst /* Pointer to the destination to store the block as byte array */ ) { - const int32_t M13 = (int32_t)(1.41421*4096), M2 = (int32_t)(1.08239*4096), M4 = (int32_t)(2.61313*4096), M5 = (int32_t)(1.84776*4096); - int32_t v0, v1, v2, v3, v4, v5, v6, v7; - int32_t t10, t11, t12, t13; + const gI32 M13 = (gI32)(1.41421*4096), M2 = (gI32)(1.08239*4096), M4 = (gI32)(2.61313*4096), M5 = (gI32)(1.84776*4096); + gI32 v0, v1, v2, v3, v4, v5, v6, v7; + gI32 t10, t11, t12, t13; unsigned i; /* Process columns */ @@ -685,13 +685,13 @@ gdispImageError mcu_load ( JDEC* jd /* Pointer to the decompressor object */ ) { - int32_t *tmp = (int32_t*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */ + gI32 *tmp = (gI32*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */ unsigned blk, nby, nbc, i, z, id, cmp; int b, d, e; - uint8_t *bp; - const uint8_t *hb, *hd; - const uint16_t *hc; - const int32_t *dqf; + gU8 *bp; + const gU8 *hb, *hd; + const gU16 *hc; + const gI32 *dqf; nby = jd->msx * jd->msy; /* Number of Y blocks (1, 2 or 4) */ @@ -715,7 +715,7 @@ gdispImageError mcu_load ( b = 1 << (b - 1); /* MSB position */ if (!(e & b)) e -= (b << 1) - 1; /* Restore sign if needed */ d += e; /* Get current value */ - jd->dcv[cmp] = (int16_t)d; /* Save current DC value for next block */ + jd->dcv[cmp] = (gI16)d; /* Save current DC value for next block */ } dqf = jd->qttbl[jd->qtid[cmp]]; /* De-quantizer table ID for this component */ tmp[0] = d * dqf[0] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits */ @@ -774,7 +774,7 @@ gdispImageError mcu_output ( const int CVACC = (sizeof (int) > 2) ? 1024 : 128; unsigned ix, iy, mx, my, rx, ry; int yy, cb, cr; - uint8_t *py, *pc, *rgb24; + gU8 *py, *pc, *rgb24; JRECT rect; @@ -793,7 +793,7 @@ gdispImageError mcu_output ( if (!JD_USE_SCALE || jd->scale != 3) { /* Not for 1/8 scaling */ /* Build an RGB MCU from discrete comopnents */ - rgb24 = (uint8_t*)jd->workbuf; + rgb24 = (gU8*)jd->workbuf; for (iy = 0; iy < my; iy++) { pc = jd->mcubuf; py = pc + iy * 8; @@ -824,16 +824,16 @@ gdispImageError mcu_output ( /* Descale the MCU rectangular if needed */ if (JD_USE_SCALE && jd->scale) { unsigned x, y, r, g, b, s, w, a; - uint8_t *op; + gU8 *op; /* Get averaged RGB value of each square correcponds to a pixel */ s = jd->scale * 2; /* Bumber of shifts for averaging */ w = 1 << jd->scale; /* Width of square */ a = (mx - w) * 3; /* Bytes to skip for next line in the square */ - op = (uint8_t*)jd->workbuf; + op = (gU8*)jd->workbuf; for (iy = 0; iy < my; iy += w) { for (ix = 0; ix < mx; ix += w) { - rgb24 = (uint8_t*)jd->workbuf + (iy * mx + ix) * 3; + rgb24 = (gU8*)jd->workbuf + (iy * mx + ix) * 3; r = g = b = 0; for (y = 0; y < w; y++) { /* Accumulate RGB value in the square */ for (x = 0; x < w; x++) { @@ -843,9 +843,9 @@ gdispImageError mcu_output ( } rgb24 += a; } /* Put the averaged RGB value as a pixel */ - *op++ = (uint8_t)(r >> s); - *op++ = (uint8_t)(g >> s); - *op++ = (uint8_t)(b >> s); + *op++ = (gU8)(r >> s); + *op++ = (gU8)(g >> s); + *op++ = (gU8)(b >> s); } } } @@ -853,7 +853,7 @@ gdispImageError mcu_output ( } else { /* For only 1/8 scaling (left-top pixel in each block are the DC value of the block) */ /* Build a 1/8 descaled RGB MCU from discrete comopnents */ - rgb24 = (uint8_t*)jd->workbuf; + rgb24 = (gU8*)jd->workbuf; pc = jd->mcubuf + mx * my; cb = pc[0] - 128; /* Get Cb/Cr component and restore right level */ cr = pc[64] - 128; @@ -875,10 +875,10 @@ gdispImageError mcu_output ( /* Squeeze up pixel table if a part of MCU is to be truncated */ mx >>= jd->scale; if (rx < mx) { - uint8_t *s, *d; + gU8 *s, *d; unsigned x, y; - s = d = (uint8_t*)jd->workbuf; + s = d = (gU8*)jd->workbuf; for (y = 0; y < ry; y++) { for (x = 0; x < rx; x++) { /* Copy effective pixels */ *d++ = *s++; @@ -892,8 +892,8 @@ gdispImageError mcu_output ( #if 0 /* Convert RGB888 to RGB565 if needed */ if (JD_FORMAT == 1) { - uint8_t *s = (uint8_t*)jd->workbuf; - uint16_t w, *d = (uint16_t*)s; + gU8 *s = (gU8*)jd->workbuf; + gU16 w, *d = (gU16*)s; unsigned n = rx * ry; do { @@ -919,12 +919,12 @@ gdispImageError mcu_output ( static gdispImageError restart ( JDEC* jd, /* Pointer to the decompressor object */ - uint16_t rstn /* Expected restert sequense number */ + gU16 rstn /* Expected restert sequense number */ ) { unsigned i, dc; - uint16_t d; - uint8_t *dp; + gU16 d; + gU8 *dp; /* Discard padding bits and get two bytes from the input stream */ @@ -966,9 +966,9 @@ gdispImageError jd_prepare ( gdispImage* img /* I/O device identifier for the session */ ) { - uint8_t *seg, b; - uint16_t marker; - uint32_t ofs; + gU8 *seg, b; + gU16 marker; + gU32 ofs; unsigned n, i, j, len; gdispImageError rc; @@ -1125,11 +1125,11 @@ gdispImageError jd_prepare ( gdispImageError jd_decomp ( JDEC* jd, /* Initialized decompression object */ unsigned (*outfunc)(gdispImage*, void*, JRECT*), /* RGB output function */ - uint8_t scale /* Output de-scaling factor (0 to 3) */ + gU8 scale /* Output de-scaling factor (0 to 3) */ ) { unsigned x, y, mx, my; - uint16_t rst, rsc; + gU16 rst, rsc; gdispImageError rc; diff --git a/src/gdisp/gdisp_image_native.c b/src/gdisp/gdisp_image_native.c index a7f9363f..4735d71f 100644 --- a/src/gdisp/gdisp_image_native.c +++ b/src/gdisp/gdisp_image_native.c @@ -23,8 +23,8 @@ /** * Helper Routines Needed */ -void *gdispImageAlloc(gdispImage *img, size_t sz); -void gdispImageFree(gdispImage *img, void *ptr, size_t sz); +void *gdispImageAlloc(gdispImage *img, gMemSize sz); +void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz); typedef struct gdispImagePrivate_NATIVE { gPixel *frame0cache; @@ -44,7 +44,7 @@ void gdispImageClose_NATIVE(gdispImage *img) { } gdispImageError gdispImageOpen_NATIVE(gdispImage *img) { - uint8_t hdr[HEADER_SIZE_NATIVE]; + gU8 hdr[HEADER_SIZE_NATIVE]; /* Read the 8 byte header */ if (gfileRead(img->f, hdr, 8) != 8) @@ -58,8 +58,8 @@ gdispImageError gdispImageOpen_NATIVE(gdispImage *img) { /* We know we are a native format image */ img->flags = 0; - img->width = (((uint16_t)hdr[2])<<8) | (hdr[3]); - img->height = (((uint16_t)hdr[4])<<8) | (hdr[5]); + img->width = (((gU16)hdr[2])<<8) | (hdr[3]); + img->height = (((gU16)hdr[4])<<8) | (hdr[5]); if (img->width < 1 || img->height < 1) return GDISP_IMAGE_ERR_BADDATA; if (!(img->priv = gdispImageAlloc(img, sizeof(gdispImagePrivate_NATIVE)))) @@ -71,7 +71,7 @@ gdispImageError gdispImageOpen_NATIVE(gdispImage *img) { } gdispImageError gdispImageCache_NATIVE(gdispImage *img) { - size_t len; + gMemSize len; gdispImagePrivate_NATIVE * priv; /* If we are already cached - just return OK */ @@ -95,7 +95,8 @@ gdispImageError gdispImageCache_NATIVE(gdispImage *img) { gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) { gCoord mx, mcx; - size_t pos, len; + gFileSize pos; + gMemSize len; gdispImagePrivate_NATIVE * priv; priv = (gdispImagePrivate_NATIVE *)img->priv; diff --git a/src/gdisp/gdisp_image_png.c b/src/gdisp/gdisp_image_png.c index ed353ce5..4cb3ca07 100644 --- a/src/gdisp/gdisp_image_png.c +++ b/src/gdisp/gdisp_image_png.c @@ -19,21 +19,21 @@ struct PNG_decode; // PNG info (comes from the PNG header) typedef struct PNG_info { - uint8_t flags; // Flags (global) + gU8 flags; // Flags (global) #define PNG_FLG_HEADERDONE 0x01 // The header has been processed #define PNG_FLG_TRANSPARENT 0x02 // Has transparency #define PNG_FLG_INTERLACE 0x04 // Is Interlaced #define PNG_FLG_BACKGROUND 0x08 // Has a specified background color - uint8_t bitdepth; // 1, 2, 4, 8, 16 - uint8_t mode; // The PNG color-mode + gU8 bitdepth; // 1, 2, 4, 8, 16 + gU8 mode; // The PNG color-mode #define PNG_COLORMODE_GRAY 0x00 // Grayscale #define PNG_COLORMODE_RGB 0x02 // RGB #define PNG_COLORMODE_PALETTE 0x03 // Pallete #define PNG_COLORMODE_GRAYALPHA 0x04 // Grayscale with Alpha #define PNG_COLORMODE_RGBA 0x06 // RGBA - uint8_t bpp; // Bits per pixel + gU8 bpp; // Bits per pixel - uint8_t *cache; // The image cache + gU8 *cache; // The image cache unsigned cachesz; // The image cache size void (*out)(struct PNG_decode *); // The scan line output function @@ -42,13 +42,13 @@ typedef struct PNG_info { gColor bg; // The background color #endif #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY - uint16_t trans_r; // Red/grayscale component of the transparent color (PNG_COLORMODE_GRAY and PNG_COLORMODE_RGB only) - uint16_t trans_g; // Green component of the transparent color (PNG_COLORMODE_RGB only) - uint16_t trans_b; // Blue component of the transparent color (PNG_COLORMODE_RGB only) + gU16 trans_r; // Red/grayscale component of the transparent color (PNG_COLORMODE_GRAY and PNG_COLORMODE_RGB only) + gU16 trans_g; // Green component of the transparent color (PNG_COLORMODE_RGB only) + gU16 trans_b; // Blue component of the transparent color (PNG_COLORMODE_RGB only) #endif #if GDISP_NEED_IMAGE_PNG_PALETTE_124 || GDISP_NEED_IMAGE_PNG_PALETTE_8 - uint16_t palsize; // palette size in number of colors - uint8_t *palette; // palette in RGBA RGBA... order (4 bytes per entry - PNG_COLORMODE_PALETTE only) + gU16 palsize; // palette size in number of colors + gU8 *palette; // palette in RGBA RGBA... order (4 bytes per entry - PNG_COLORMODE_PALETTE only) #endif } PNG_info; @@ -56,10 +56,10 @@ typedef struct PNG_info { typedef struct PNG_input { GFILE * f; // The gfile to retrieve data from unsigned buflen; // The number of bytes left in the buffer - uint8_t *pbuf; // The pointer to the next byte - uint32_t chunklen; // The number of bytes left in the current PNG chunk - uint32_t chunknext; // The file position of the next PNG chunk - uint8_t buf[GDISP_IMAGE_PNG_FILE_BUFFER_SIZE]; // Must be a minimum of 8 bytes to hold a chunk header + gU8 *pbuf; // The pointer to the next byte + gU32 chunklen; // The number of bytes left in the current PNG chunk + gU32 chunknext; // The file position of the next PNG chunk + gU8 buf[GDISP_IMAGE_PNG_FILE_BUFFER_SIZE]; // Must be a minimum of 8 bytes to hold a chunk header } PNG_input; // Handle the display output and windowing @@ -77,20 +77,20 @@ typedef struct PNG_output { typedef struct PNG_filter { unsigned scanbytes; unsigned bytewidth; - uint8_t *line; - uint8_t *prev; + gU8 *line; + gU8 *prev; } PNG_filter; // Handle the PNG inflate decompression typedef struct PNG_zTree { - uint16_t table[16]; // Table of code length counts - uint16_t trans[288]; // Code to symbol translation table + gU16 table[16]; // Table of code length counts + gU16 trans[288]; // Code to symbol translation table } PNG_zTree; typedef struct PNG_zinflate { - uint8_t data; // The current input stream data byte - uint8_t bits; // The number of bits left in the data byte - uint8_t flags; // Decompression flags + gU8 data; // The current input stream data byte + gU8 bits; // The number of bits left in the data byte + gU8 flags; // Decompression flags #define PNG_ZFLG_EOF 0x01 // No more input data #define PNG_ZFLG_FINAL 0x02 // This is the final block #define PNG_ZFLG_RESUME_MASK 0x0C // The mask of bits for the resume state @@ -104,8 +104,8 @@ typedef struct PNG_zinflate { PNG_zTree ltree; // The dynamic length tree PNG_zTree dtree; // The dynamic distance tree - uint8_t tmp[288+32]; // Temporary space for decoding dynamic trees and other temporary uses - uint8_t buf[GDISP_IMAGE_PNG_Z_BUFFER_SIZE]; // The decoding buffer and sliding window + gU8 tmp[288+32]; // Temporary space for decoding dynamic trees and other temporary uses + gU8 buf[GDISP_IMAGE_PNG_Z_BUFFER_SIZE]; // The decoding buffer and sliding window } PNG_zinflate; // Put all the decoding structures together. @@ -139,7 +139,7 @@ static void PNG_iInit(PNG_decode *d) { // Load the next byte of image data from the PNG file static gBool PNG_iLoadData(PNG_decode *d) { - uint32_t sz; + gU32 sz; // Is there data still left in the buffer? if (d->i.buflen) @@ -188,7 +188,7 @@ gotchunk: } // Get the last loaded byte of image data from the PNG file -static uint8_t PNG_iGetByte(PNG_decode *d) { +static gU8 PNG_iGetByte(PNG_decode *d) { d->i.buflen--; return *d->i.pbuf++; } @@ -338,9 +338,9 @@ static unsigned PNG_zGetBits(PNG_decode *d, unsigned num) { } // Build an inflate dynamic tree using a string of byte lengths -static void PNG_zBuildTree(PNG_zTree *t, const uint8_t *lengths, unsigned num) { +static void PNG_zBuildTree(PNG_zTree *t, const gU8 *lengths, unsigned num) { unsigned i, sum; - uint16_t offs[16]; + gU16 offs[16]; for (i = 0; i < 16; ++i) t->table[i] = 0; @@ -360,7 +360,7 @@ static void PNG_zBuildTree(PNG_zTree *t, const uint8_t *lengths, unsigned num) { } // Get an inflate decode symbol -static uint16_t PNG_zGetSymbol(PNG_decode *d, PNG_zTree *t) { +static gU16 PNG_zGetSymbol(PNG_decode *d, PNG_zTree *t) { int sum, cur; unsigned len; @@ -401,11 +401,11 @@ static void PNG_zBuildFixedTrees(PNG_decode *d) { // Build inflate dynamic length and distance trees static gBool PNG_zDecodeTrees(PNG_decode *d) { - static const uint8_t IndexLookup[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; + static const gU8 IndexLookup[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; unsigned hlit, hdist, hclen; unsigned i, num; - uint16_t symbol; - uint8_t val; + gU16 symbol; + gU8 val; hlit = PNG_zGetBits(d, 5) + 257; // 257 - 286 hdist = PNG_zGetBits(d, 5) + 1; // 1 - 32 @@ -501,7 +501,7 @@ static gBool PNG_zUncompressedBlock(PNG_decode *d) { length = gdispImageGetAlignedLE16(d->z.tmp, 0); // Check length - if ((uint16_t)length != (uint16_t)~gdispImageGetAlignedLE16(d->z.tmp, 2)) { + if ((gU16)length != (gU16)~gdispImageGetAlignedLE16(d->z.tmp, 2)) { d->z.flags |= PNG_ZFLG_EOF; return gFalse; } @@ -512,12 +512,12 @@ static gBool PNG_zUncompressedBlock(PNG_decode *d) { // Inflate a compressed inflate block into the output static gBool PNG_zInflateBlock(PNG_decode *d) { - static const uint8_t lbits[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 6 }; - static const uint16_t lbase[30] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 323 }; - static const uint8_t dbits[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; - static const uint16_t dbase[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }; + static const gU8 lbits[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 6 }; + static const gU16 lbase[30] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 323 }; + static const gU8 dbits[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; + static const gU16 dbase[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }; unsigned length, dist, offset; - uint16_t symbol; + gU16 symbol; while(1) { symbol = PNG_zGetSymbol(d, &d->z.ltree); // EOF? @@ -532,7 +532,7 @@ static gBool PNG_zInflateBlock(PNG_decode *d) { if (symbol < 256) { // The symbol is the data - d->z.buf[d->z.bufend++] = (uint8_t)symbol; + d->z.buf[d->z.bufend++] = (gU8)symbol; WRAP_ZBUF(d->z.bufend); if (d->z.bufend == d->z.bufpos) { // Buffer full? d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_INFLATE; @@ -643,8 +643,8 @@ static gBool PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) } // Get a fully decompressed byte from the inflate data stream -static uint8_t PNG_zGetByte(PNG_decode *d) { - uint8_t data; +static gU8 PNG_zGetByte(PNG_decode *d) { + gU8 data; // Do we have any data in the buffers while (d->z.bufpos == d->z.bufend) { @@ -688,7 +688,7 @@ static uint8_t PNG_zGetByte(PNG_decode *d) { *---------------------------------------------------------------*/ // Initialise the scan-line engine -static void PNG_fInit(PNG_filter *f, uint8_t *buf, unsigned bytewidth, unsigned scanbytes) { +static void PNG_fInit(PNG_filter *f, gU8 *buf, unsigned bytewidth, unsigned scanbytes) { f->scanbytes = scanbytes; f->bytewidth = bytewidth; f->line = buf; @@ -707,21 +707,21 @@ static void PNG_fNext(PNG_filter *f) { } // Predictor function for filter0 mode 4 -static uint8_t PNG_fCalcPath(uint16_t a, uint16_t b, uint16_t c) { - uint16_t pa = b > c ? (b - c) : (c - b); - uint16_t pb = a > c ? (a - c) : (c - a); - uint16_t pc = a + b > c + c ? (a + b - c - c) : (c + c - a - b); +static gU8 PNG_fCalcPath(gU16 a, gU16 b, gU16 c) { + gU16 pa = b > c ? (b - c) : (c - b); + gU16 pb = a > c ? (a - c) : (c - a); + gU16 pc = a + b > c + c ? (a + b - c - c) : (c + c - a - b); if (pc < pa && pc < pb) - return (uint8_t)c; + return (gU8)c; if (pb < pa) - return (uint8_t)b; - return (uint8_t)a; + return (gU8)b; + return (gU8)a; } // Scan-line filter type 0 static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 - uint8_t ft; + gU8 ft; unsigned i; // Get the filter type and check for validity (eg not EOF) @@ -781,15 +781,15 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 static void PNG_OutGRAY124(PNG_decode *d) { unsigned i; PNG_info *pinfo; - uint8_t px; - uint8_t bits; + gU8 px; + gU8 bits; pinfo = d->pinfo; for(i = 0; i < d->f.scanbytes; i++) { for(bits = 8; bits; bits -= pinfo->bitdepth) { px = (d->f.line[i] >> (bits - pinfo->bitdepth)) & ((1U << pinfo->bitdepth)-1); #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY - if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (uint16_t)px == pinfo->trans_r) { + if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (gU16)px == pinfo->trans_r) { #if GDISP_NEED_IMAGE_PNG_BACKGROUND if ((pinfo->flags & PNG_FLG_BACKGROUND)) { PNG_oColor(&d->o, pinfo->bg); @@ -810,7 +810,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 #if GDISP_NEED_IMAGE_PNG_GRAYSCALE_8 static void PNG_OutGRAY8(PNG_decode *d) { unsigned i; - uint8_t px; + gU8 px; #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY PNG_info *pinfo = d->pinfo; #endif @@ -818,7 +818,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 for(i = 0; i < d->f.scanbytes; i++) { px = d->f.line[i]; #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY - if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (uint16_t)px == pinfo->trans_r) { + if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (gU16)px == pinfo->trans_r) { #if GDISP_NEED_IMAGE_PNG_BACKGROUND if ((pinfo->flags & PNG_FLG_BACKGROUND)) { PNG_oColor(&d->o, pinfo->bg); @@ -836,7 +836,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 #if GDISP_NEED_IMAGE_PNG_GRAYSCALE_16 static void PNG_OutGRAY16(PNG_decode *d) { unsigned i; - uint8_t px; + gU8 px; #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY PNG_info *pinfo = d->pinfo; #endif @@ -869,9 +869,9 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 for(i = 0; i < d->f.scanbytes; i+=3) { #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY if ((pinfo->flags & PNG_FLG_TRANSPARENT) - && (uint16_t)d->f.line[i+0] == pinfo->trans_r - && (uint16_t)d->f.line[i+1] == pinfo->trans_g - && (uint16_t)d->f.line[i+2] == pinfo->trans_b) { + && (gU16)d->f.line[i+0] == pinfo->trans_r + && (gU16)d->f.line[i+1] == pinfo->trans_g + && (gU16)d->f.line[i+2] == pinfo->trans_b) { #if GDISP_NEED_IMAGE_PNG_BACKGROUND if ((pinfo->flags & PNG_FLG_BACKGROUND)) { PNG_oColor(&d->o, pinfo->bg); @@ -918,14 +918,14 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 unsigned i; PNG_info *pinfo; unsigned idx; - uint8_t bits; + gU8 bits; pinfo = d->pinfo; for(i = 0; i < d->f.scanbytes; i++) { for(bits = 8; bits; bits -= pinfo->bitdepth) { idx = (d->f.line[i] >> (bits - pinfo->bitdepth)) & ((1U << pinfo->bitdepth)-1); - if ((uint16_t)idx >= pinfo->palsize) { + if ((gU16)idx >= pinfo->palsize) { PNG_oColor(&d->o, RGB2COLOR(0, 0, 0)); continue; } @@ -967,7 +967,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 for(i = 0; i < d->f.scanbytes; i++) { idx = (unsigned)d->f.line[i]; - if ((uint16_t)idx >= pinfo->palsize) { + if ((gU16)idx >= pinfo->palsize) { PNG_oColor(&d->o, RGB2COLOR(0, 0, 0)); continue; } @@ -1143,9 +1143,9 @@ void gdispImageClose_PNG(gdispImage *img) { gdispImageError gdispImageOpen_PNG(gdispImage *img) { PNG_info *pinfo; - uint32_t pos; - uint32_t len; - uint8_t buf[13]; + gU32 pos; + gU32 len; + gU8 buf[13]; /* Read the file identifier */ if (gfileRead(img->f, buf, 8) != 8) @@ -1199,9 +1199,9 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) { img->width = gdispImageGetAlignedBE16(buf, 2); img->height = gdispImageGetAlignedBE16(buf, 6); - pinfo->bitdepth = gdispImageGetVar(uint8_t, buf, 8); - pinfo->mode = gdispImageGetVar(uint8_t, buf, 9); - if (gdispImageGetVar(uint8_t, buf, 12)) { + pinfo->bitdepth = gdispImageGetVar(gU8, buf, 8); + pinfo->mode = gdispImageGetVar(gU8, buf, 9); + if (gdispImageGetVar(gU8, buf, 12)) { pinfo->flags |= PNG_FLG_INTERLACE; #if !GDISP_NEED_IMAGE_PNG_INTERLACED goto exit_unsupported; @@ -1209,11 +1209,11 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) { } // Check width and height, filter, compression and interlacing - if (gdispImageGetVar(uint16_t, buf, 0) != 0 || img->width <= 0 // width - || gdispImageGetVar(uint16_t, buf, 4) != 0 || img->height <= 0 // height - || gdispImageGetVar(uint8_t, buf, 10) != 0 // compression - || gdispImageGetVar(uint8_t, buf, 11) != 0 // filter - || gdispImageGetVar(uint8_t, buf, 12) > 1 // interlace + if (gdispImageGetVar(gU16, buf, 0) != 0 || img->width <= 0 // width + || gdispImageGetVar(gU16, buf, 4) != 0 || img->height <= 0 // height + || gdispImageGetVar(gU8, buf, 10) != 0 // compression + || gdispImageGetVar(gU8, buf, 11) != 0 // filter + || gdispImageGetVar(gU8, buf, 12) > 1 // interlace ) goto exit_unsupported; @@ -1343,8 +1343,8 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) { // Read the palette { - uint16_t idx; - uint8_t *p; + gU16 idx; + gU8 *p; for(idx=pinfo->palsize, p=pinfo->palette; idx; p += 4, idx--) { if (gfileRead(img->f, p, 3) != 3) @@ -1373,8 +1373,8 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) { // Adjust the palette { - uint16_t idx; - uint8_t *p; + gU16 idx; + gU8 *p; for(idx=len, p=pinfo->palette+3; idx; p += 4, idx--) { if (gfileRead(img->f, p, 1) != 1) @@ -1427,7 +1427,7 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) { #if GDISP_NEED_IMAGE_PNG_PALETTE_124 || GDISP_NEED_IMAGE_PNG_PALETTE_8 case PNG_COLORMODE_PALETTE: - if (!pinfo->palette || len < 1 || gfileRead(img->f, buf, 1) != 1 || (uint16_t)buf[0] >= pinfo->palsize) + if (!pinfo->palette || len < 1 || gfileRead(img->f, buf, 1) != 1 || (gU16)buf[0] >= pinfo->palsize) goto exit_baddata; pinfo->bg = RGB2COLOR(pinfo->palette[((unsigned)buf[0])*4+0], pinfo->palette[((unsigned)buf[0])*4+1], @@ -1526,7 +1526,7 @@ gdispImageError gdispGImageDraw_PNG(GDisplay *g, gdispImage *img, gCoord x, gCoo #endif { // Non-interlaced decoding - PNG_fInit(&d->f, (uint8_t *)(d+1), (pinfo->bpp + 7) / 8, (img->width * pinfo->bpp + 7) / 8); + PNG_fInit(&d->f, (gU8 *)(d+1), (pinfo->bpp + 7) / 8, (img->width * pinfo->bpp + 7) / 8); for(y = 0; y < sy+cy; PNG_fNext(&d->f), y++) { if (!PNG_unfilter_type0(d)) goto exit_baddata; @@ -1550,8 +1550,8 @@ gdispImageError gdispImageCache_PNG(gdispImage *img) { PNG_info *pinfo; unsigned chunknext; unsigned chunklen; - uint8_t *pcache; - uint8_t buf[8]; + gU8 *pcache; + gU8 buf[8]; // If we are already cached - just return OK pinfo = (PNG_info *)img->priv; diff --git a/src/gdisp/gdisp_image_support.h b/src/gdisp/gdisp_image_support.h index d64eef5b..5a114fc6 100644 --- a/src/gdisp/gdisp_image_support.h +++ b/src/gdisp/gdisp_image_support.h @@ -18,50 +18,50 @@ #define _GDISP_IMAGE_SUPPORT_H /* Base endian handling routines */ -#define gdispImageGetVar(type, p, idx) (*(type *)(((uint8_t *)(p))+(idx))) -#define gdispImageGetByte(type, p, idx, shift) (((type)gdispImageGetVar(uint8_t, p, idx))<<(shift)) -#define gdispImageSwap16(w) ((((uint16_t)(w))>>8)|(((uint16_t)(w))<<8)) -#define gdispImageSwap32(dw) ((((uint32_t)(dw))>>24)|((((uint32_t)(dw))&0x00FF0000)>>8)\ - |((((uint32_t)(dw))&0x0000FF00)<<8)|(((uint32_t)(dw))<<24)) -#define gdispImageSwapWords32(dw) ((((uint32_t)(dw))>>16)|(((uint32_t)(dw))<<16)) -#define gdispImageSwapBytes32(dw) (((((uint32_t)(dw))&0xFF000000)>>8)|((((uint32_t)(dw))&0x00FF0000)<<8)\ - |((((uint32_t)(dw))&0x0000FF00)>>8)|(((uint32_t)(dw))<<8)) +#define gdispImageGetVar(type, p, idx) (*(type *)(((gU8 *)(p))+(idx))) +#define gdispImageGetByte(type, p, idx, shift) (((type)gdispImageGetVar(gU8, p, idx))<<(shift)) +#define gdispImageSwap16(w) ((((gU16)(w))>>8)|(((gU16)(w))<<8)) +#define gdispImageSwap32(dw) ((((gU32)(dw))>>24)|((((gU32)(dw))&0x00FF0000)>>8)\ + |((((gU32)(dw))&0x0000FF00)<<8)|(((gU32)(dw))<<24)) +#define gdispImageSwapWords32(dw) ((((gU32)(dw))>>16)|(((gU32)(dw))<<16)) +#define gdispImageSwapBytes32(dw) (((((gU32)(dw))&0xFF000000)>>8)|((((gU32)(dw))&0x00FF0000)<<8)\ + |((((gU32)(dw))&0x0000FF00)>>8)|(((gU32)(dw))<<8)) /* - * Get a uint16_t/uint32_t from memory in the required endianness. + * Get a gU16/gU32 from memory in the required endianness. * There is no alignment requirement. */ #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_LITTLE && GFX_CPU_NO_ALIGNMENT_FAULTS - #define gdispImageGetLE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx)) - #define gdispImageGetLE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx)) + #define gdispImageGetLE16(p, idx) gdispImageGetVar(gU16, (p), (idx)) + #define gdispImageGetLE32(p, idx) gdispImageGetVar(gU32, (p), (idx)) #else - #define gdispImageGetLE16(p, idx) ( gdispImageGetByte(uint16_t, (p), (idx) , 0) | gdispImageGetByte(uint16_t, (p), (idx)+1, 8)) - #define gdispImageGetLE32(p, idx) ( gdispImageGetByte(uint32_t, (p), (idx) , 0) | gdispImageGetByte(uint32_t, (p), (idx)+1, 8)\ - |gdispImageGetByte(uint32_t, (p), (idx)+2, 16) | gdispImageGetByte(uint32_t, (p), (idx)+3, 24)) + #define gdispImageGetLE16(p, idx) ( gdispImageGetByte(gU16, (p), (idx) , 0) | gdispImageGetByte(gU16, (p), (idx)+1, 8)) + #define gdispImageGetLE32(p, idx) ( gdispImageGetByte(gU32, (p), (idx) , 0) | gdispImageGetByte(gU32, (p), (idx)+1, 8)\ + |gdispImageGetByte(gU32, (p), (idx)+2, 16) | gdispImageGetByte(gU32, (p), (idx)+3, 24)) #endif #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_BIG && GFX_CPU_NO_ALIGNMENT_FAULTS - #define gdispImageGetBE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx)) - #define gdispImageGetBE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx)) + #define gdispImageGetBE16(p, idx) gdispImageGetVar(gU16, (p), (idx)) + #define gdispImageGetBE32(p, idx) gdispImageGetVar(gU32, (p), (idx)) #else - #define gdispImageGetBE16(p, idx) ( gdispImageGetByte(uint16_t, (p), (idx) , 8) | gdispImageGetByte(uint16_t, (p), (idx)+1, 0)) - #define gdispImageGetBE32(p, idx) ( gdispImageGetByte(uint32_t, (p), (idx) , 24) | gdispImageGetByte(uint32_t, (p), (idx)+1, 16)\ - |gdispImageGetByte(uint32_t, (p), (idx)+2, 8) | gdispImageGetByte(uint32_t, (p), (idx)+3, 0)) + #define gdispImageGetBE16(p, idx) ( gdispImageGetByte(gU16, (p), (idx) , 8) | gdispImageGetByte(gU16, (p), (idx)+1, 0)) + #define gdispImageGetBE32(p, idx) ( gdispImageGetByte(gU32, (p), (idx) , 24) | gdispImageGetByte(gU32, (p), (idx)+1, 16)\ + |gdispImageGetByte(gU32, (p), (idx)+2, 8) | gdispImageGetByte(gU32, (p), (idx)+3, 0)) #endif /* - * Get a uint16_t/uint32_t from memory in the required endianness. + * Get a gU16/gU32 from memory in the required endianness. * These are optimised routines but the memory must be word/dword aligned. */ #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_LITTLE - #define gdispImageGetAlignedLE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx)) + #define gdispImageGetAlignedLE16(p, idx) gdispImageGetVar(gU16, (p), (idx)) #define gdispImageGetAlignedBE16(p, idx) gdispImageGetBE16(p, (idx)) - #define gdispImageGetAlignedLE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx)) + #define gdispImageGetAlignedLE32(p, idx) gdispImageGetVar(gU32, (p), (idx)) #define gdispImageGetAlignedBE32(p, idx) gdispImageGetBE32(p, (idx)) #elif GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_BIG #define gdispImageGetAlignedLE16(p, idx) gdispImageGetLE16(p, (idx)) - #define gdispImageGetAlignedBE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx)) + #define gdispImageGetAlignedBE16(p, idx) gdispImageGetVar(gU16, (p), (idx)) #define gdispImageGetAlignedLE32(p, idx) gdispImageGetLE32(p, (idx)) - #define gdispImageGetAlignedBE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx)) + #define gdispImageGetAlignedBE32(p, idx) gdispImageGetVar(gU32, (p), (idx)) #else #define gdispImageGetAlignedLE16(p, idx) gdispImageGetLE16(p, (idx)) #define gdispImageGetAlignedBE16(p, idx) gdispImageGetBE16(p, (idx)) @@ -109,10 +109,10 @@ #define gdispImageMakeLE32(dw) { dw = gdispImageH32toLE32(dw); } #define gdispImageMakeBE32(dw) { dw = gdispImageH32toBE32(dw); } #else - uint16_t gdispImageH16toLE16(uint16_t w); - uint16_t gdispImageH16toBE16(uint16_t w); - uint32_t gdispImageH32toLE32(uint32_t dw); - uint32_t gdispImageH32toBE32(uint32_t dw); + gU16 gdispImageH16toLE16(gU16 w); + gU16 gdispImageH16toBE16(gU16 w); + gU32 gdispImageH32toLE32(gU32 dw); + gU32 gdispImageH32toBE32(gU32 dw); #define gdispImageMakeLE16(w) { w = gdispImageH16toLE16(w); } #define gdispImageMakeBE16(w) { w = gdispImageH16toBE16(w); } #define gdispImageMakeLE32(dw) { dw = gdispImageH32toLE32(dw); } @@ -120,11 +120,11 @@ #endif -void *gdispImageAlloc(gdispImage *img, size_t sz); -void gdispImageFree(gdispImage *img, void *ptr, size_t sz); +void *gdispImageAlloc(gdispImage *img, gMemSize sz); +void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz); #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN - extern const uint8_t gdispImageEndianArray[4]; + extern const gU8 gdispImageEndianArray[4]; #endif #endif /* _GDISP_IMAGE_SUPPORT_H */ diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c index 339e5cd2..c6a1e21e 100644 --- a/src/gdisp/gdisp_pixmap.c +++ b/src/gdisp/gdisp_pixmap.c @@ -44,7 +44,7 @@ typedef struct pixmap { #if GDISP_NEED_PIXMAP_IMAGE - uint8_t imghdr[8]; // This field must come just before the data member. + gU8 imghdr[8]; // This field must come just before the data member. #endif gColor pixels[1]; // We really want pixels[0] but some compilers don't allow that even though it is C standard. } pixmap; @@ -67,12 +67,12 @@ GDisplay *gdispPixmapCreate(gCoord width, gCoord height) { #if GDISP_NEED_PIXMAP_IMAGE p->imghdr[0] = 'N'; p->imghdr[1] = 'I'; - p->imghdr[2] = (uint8_t)(width >> 8); - p->imghdr[3] = (uint8_t)width; - p->imghdr[4] = (uint8_t)(height >> 8); - p->imghdr[5] = (uint8_t)height; - p->imghdr[6] = (uint8_t)(GDISP_PIXELFORMAT >> 8); - p->imghdr[7] = (uint8_t)(GDISP_PIXELFORMAT); + p->imghdr[2] = (gU8)(width >> 8); + p->imghdr[3] = (gU8)width; + p->imghdr[4] = (gU8)(height >> 8); + p->imghdr[5] = (gU8)height; + p->imghdr[6] = (gU8)(GDISP_PIXELFORMAT >> 8); + p->imghdr[7] = (gU8)(GDISP_PIXELFORMAT); #endif // Save the width and height so the driver can retrieve it. diff --git a/src/gdisp/mcufont/mf_bwfont.c b/src/gdisp/mcufont/mf_bwfont.c index a17a1673..b2b17a21 100644 --- a/src/gdisp/mcufont/mf_bwfont.c +++ b/src/gdisp/mcufont/mf_bwfont.c @@ -13,7 +13,7 @@ /* Find the character range and index that contains a given glyph.. */ static const struct mf_bwfont_char_range_s *find_char_range( - const struct mf_bwfont_s *font, uint16_t character, uint16_t *index_ret) + const struct mf_bwfont_s *font, gU16 character, gU16 *index_ret) { unsigned i, index; const struct mf_bwfont_char_range_s *range; @@ -31,7 +31,7 @@ static const struct mf_bwfont_char_range_s *find_char_range( return 0; } -static uint8_t get_width(const struct mf_bwfont_char_range_s *r, uint16_t index) +static gU8 get_width(const struct mf_bwfont_char_range_s *r, gU16 index) { if (r->width) { @@ -43,15 +43,15 @@ static uint8_t get_width(const struct mf_bwfont_char_range_s *r, uint16_t index) } } -static uint8_t render_char(const struct mf_bwfont_char_range_s *r, - int16_t x0, int16_t y0, uint16_t index, +static gU8 render_char(const struct mf_bwfont_char_range_s *r, + gI16 x0, gI16 y0, gU16 index, mf_pixel_callback_t callback, void *state) { - const uint8_t *data, *p; - uint8_t stride, runlen; - uint8_t x, y, height, num_cols; - uint8_t bit, byte, mask; + const gU8 *data, *p; + gU8 stride, runlen; + gU8 x, y, height, num_cols; + gU8 bit, byte, mask; bool oldstate, newstate; if (r->width) @@ -112,15 +112,15 @@ static uint8_t render_char(const struct mf_bwfont_char_range_s *r, return get_width(r, index); } -uint8_t mf_bwfont_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, +gU8 mf_bwfont_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state) { const struct mf_bwfont_s *bwfont = (const struct mf_bwfont_s*)font; const struct mf_bwfont_char_range_s *range; - uint16_t index; + gU16 index; range = find_char_range(bwfont, character, &index); if (!range) @@ -129,12 +129,12 @@ uint8_t mf_bwfont_render_character(const struct mf_font_s *font, return render_char(range, x0, y0, index, callback, state); } -uint8_t mf_bwfont_character_width(const struct mf_font_s *font, - uint16_t character) +gU8 mf_bwfont_character_width(const struct mf_font_s *font, + gU16 character) { const struct mf_bwfont_s *bwfont = (const struct mf_bwfont_s*)font; const struct mf_bwfont_char_range_s *range; - uint16_t index; + gU16 index; range = find_char_range(bwfont, character, &index); if (!range) diff --git a/src/gdisp/mcufont/mf_bwfont.h b/src/gdisp/mcufont/mf_bwfont.h index 537ba22e..e8de21a7 100644 --- a/src/gdisp/mcufont/mf_bwfont.h +++ b/src/gdisp/mcufont/mf_bwfont.h @@ -21,37 +21,37 @@ struct mf_bwfont_char_range_s { /* The number of the first character in this range. */ - uint16_t first_char; + gU16 first_char; /* The total count of characters in this range. */ - uint16_t char_count; + gU16 char_count; /* The left and top skips of the characters in this range. * This is the number of empty rows at left and at top. */ - uint8_t offset_x; - uint8_t offset_y; + gU8 offset_x; + gU8 offset_y; /* Column height for glyphs in this range, in bytes and pixels. */ - uint8_t height_bytes; - uint8_t height_pixels; + gU8 height_bytes; + gU8 height_pixels; /* Positive value if the width of all glyphs in this range is the * same, or zero if it is not. */ - uint8_t width; + gU8 width; /* Lookup table for the character widths. NULL if width is specified. */ - const uint8_t *glyph_widths; + const gU8 *glyph_widths; /* Lookup table for the character offsets. Multiply by height_bytes * to get the byte offset. Also allows lookup of the number of columns. * NULL if width is specified. */ - const uint16_t *glyph_offsets; + const gU16 *glyph_offsets; /* Table for the glyph data. * The data for each glyph is column-by-column, with N bytes per each * column. The LSB of the first byte is the top left pixel. */ - const uint8_t *glyph_data; + const gU8 *glyph_data; }; /* Structure for the font */ @@ -60,10 +60,10 @@ struct mf_bwfont_s struct mf_font_s font; /* Version of the font format. */ - const uint8_t version; + const gU8 version; /* Number of character ranges. */ - const uint16_t char_range_count; + const gU16 char_range_count; /* Array of the character ranges */ const struct mf_bwfont_char_range_s *char_ranges; @@ -71,14 +71,14 @@ struct mf_bwfont_s #ifdef MF_BWFONT_INTERNALS /* Internal functions, don't use these directly. */ -MF_EXTERN uint8_t mf_bwfont_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, +MF_EXTERN gU8 mf_bwfont_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state); -MF_EXTERN uint8_t mf_bwfont_character_width(const struct mf_font_s *font, - uint16_t character); +MF_EXTERN gU8 mf_bwfont_character_width(const struct mf_font_s *font, + gU16 character); #endif #endif diff --git a/src/gdisp/mcufont/mf_encoding.c b/src/gdisp/mcufont/mf_encoding.c index afa16b18..ba9fc7c0 100644 --- a/src/gdisp/mcufont/mf_encoding.c +++ b/src/gdisp/mcufont/mf_encoding.c @@ -13,9 +13,9 @@ mf_char mf_getchar(mf_str *str) { - uint8_t c; - uint8_t tmp, seqlen; - uint16_t result; + gU8 c; + gU8 tmp, seqlen; + gU16 result; c = **str; if (!c) diff --git a/src/gdisp/mcufont/mf_encoding.h b/src/gdisp/mcufont/mf_encoding.h index 18ffb892..7c49f02a 100644 --- a/src/gdisp/mcufont/mf_encoding.h +++ b/src/gdisp/mcufont/mf_encoding.h @@ -20,9 +20,9 @@ /* Type used to represent characters internally. */ #if MF_ENCODING == MF_ENCODING_ASCII typedef char mf_char; - #define MFCHAR2UINT16(c) ((uint16_t)(uint8_t)(c)) + #define MFCHAR2UINT16(c) ((gU16)(gU8)(c)) #else - typedef uint16_t mf_char; + typedef gU16 mf_char; #define MFCHAR2UINT16(c) (c) #endif @@ -32,7 +32,7 @@ typedef const char * mf_str; #elif MF_ENCODING == MF_ENCODING_UTF8 typedef const char * mf_str; #elif MF_ENCODING == MF_ENCODING_UTF16 -typedef const uint16_t * mf_str; +typedef const gU16 * mf_str; #elif MF_ENCODING == MF_ENCODING_WCHAR #include typedef const wchar_t * mf_str; diff --git a/src/gdisp/mcufont/mf_font.c b/src/gdisp/mcufont/mf_font.c index 9a313f8c..09182b56 100644 --- a/src/gdisp/mcufont/mf_font.c +++ b/src/gdisp/mcufont/mf_font.c @@ -26,13 +26,13 @@ #include MF_FONT_FILE_NAME /* Include fonts end here */ -uint8_t mf_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, +gU8 mf_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, mf_char character, mf_pixel_callback_t callback, void *state) { - uint8_t width; + gU8 width; width = font->render_character(font, x0, y0, MFCHAR2UINT16(character), callback, state); if (!width) @@ -44,10 +44,10 @@ uint8_t mf_render_character(const struct mf_font_s *font, return width; } -uint8_t mf_character_width(const struct mf_font_s *font, +gU8 mf_character_width(const struct mf_font_s *font, mf_char character) { - uint8_t width; + gU8 width; width = font->character_width(font, MFCHAR2UINT16(character)); if (!width) diff --git a/src/gdisp/mcufont/mf_font.h b/src/gdisp/mcufont/mf_font.h index 1812d576..b69cc782 100644 --- a/src/gdisp/mcufont/mf_font.h +++ b/src/gdisp/mcufont/mf_font.h @@ -22,8 +22,8 @@ * alpha: The "opaqueness" of the pixels, 0 for background, 255 for text. * state: Free variable that was passed to render_character(). */ -typedef void (*mf_pixel_callback_t) (int16_t x, int16_t y, uint8_t count, - uint8_t alpha, void *state); +typedef void (*mf_pixel_callback_t) (gI16 x, gI16 y, gU8 count, + gU8 alpha, void *state); /* General information about a font. */ struct mf_font_s @@ -35,35 +35,35 @@ struct mf_font_s const char *short_name; /* Width and height of the character bounding box. */ - uint8_t width; - uint8_t height; + gU8 width; + gU8 height; /* Minimum and maximum tracking width of characters. */ - uint8_t min_x_advance; - uint8_t max_x_advance; + gU8 min_x_advance; + gU8 max_x_advance; /* Location of the text baseline relative to character. */ - int8_t baseline_x; - uint8_t baseline_y; + gI8 baseline_x; + gU8 baseline_y; /* Line height of the font (vertical advance). */ - uint8_t line_height; + gU8 line_height; /* Flags identifying various aspects of the font. */ - uint8_t flags; + gU8 flags; /* Fallback character to use for missing glyphs. */ - uint16_t fallback_character; + gU16 fallback_character; /* Function to get character width. Should return 0 if character is * not found. */ - uint8_t (*character_width)(const struct mf_font_s *font, uint16_t character); + gU8 (*character_width)(const struct mf_font_s *font, gU16 character); /* Function to render a character. Returns the character width or 0 if * character is not found. */ - uint8_t (*render_character)(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, + gU8 (*render_character)(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state); }; @@ -90,8 +90,8 @@ struct mf_font_list_s * * Returns width of the character. */ -MF_EXTERN uint8_t mf_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, +MF_EXTERN gU8 mf_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, mf_char character, mf_pixel_callback_t callback, void *state); @@ -105,7 +105,7 @@ MF_EXTERN uint8_t mf_render_character(const struct mf_font_s *font, * * Returns width of the character in pixels. */ -MF_EXTERN uint8_t mf_character_width(const struct mf_font_s *font, +MF_EXTERN gU8 mf_character_width(const struct mf_font_s *font, mf_char character); /* Find a font based on name. The name can be either short name or full name. diff --git a/src/gdisp/mcufont/mf_justify.c b/src/gdisp/mcufont/mf_justify.c index 5314ab45..58f87cc3 100644 --- a/src/gdisp/mcufont/mf_justify.c +++ b/src/gdisp/mcufont/mf_justify.c @@ -12,10 +12,10 @@ #if MF_USE_TABS /* Round the X coordinate up to the nearest tab stop. */ -static int16_t mf_round_to_tab(const struct mf_font_s *font, - int16_t x0, int16_t x) +static gI16 mf_round_to_tab(const struct mf_font_s *font, + gI16 x0, gI16 x) { - int16_t tabw, dx; + gI16 tabw, dx; tabw = mf_character_width(font, 'm') * MF_TABSIZE; @@ -30,10 +30,10 @@ static int16_t mf_round_to_tab(const struct mf_font_s *font, } /* Round the X coordinate down to the nearest tab stop. */ -static int16_t mf_round_to_prev_tab(const struct mf_font_s *font, - int16_t x0, int16_t x) +static gI16 mf_round_to_prev_tab(const struct mf_font_s *font, + gI16 x0, gI16 x) { - int16_t tabw, dx; + gI16 tabw, dx; tabw = mf_character_width(font, 'm') * MF_TABSIZE; @@ -48,11 +48,11 @@ static int16_t mf_round_to_prev_tab(const struct mf_font_s *font, } #endif -int16_t mf_get_string_width(const struct mf_font_s *font, mf_str text, - uint16_t count, bool kern) +gI16 mf_get_string_width(const struct mf_font_s *font, mf_str text, + gU16 count, bool kern) { - int16_t result = 0; - uint16_t c1 = 0, c2; + gI16 result = 0; + gU16 c1 = 0, c2; if (!count) count = 0xFFFF; @@ -83,9 +83,9 @@ int16_t mf_get_string_width(const struct mf_font_s *font, mf_str text, } /* Return the length of the string without trailing spaces. */ -static uint16_t strip_spaces(mf_str text, uint16_t count, mf_char *last_char) +static gU16 strip_spaces(mf_str text, gU16 count, mf_char *last_char) { - uint16_t i = 0, result = 0; + gU16 i = 0, result = 0; mf_char tmp = 0; if (!count) @@ -115,12 +115,12 @@ static uint16_t strip_spaces(mf_str text, uint16_t count, mf_char *last_char) /* Render left-aligned string, left edge at x0. */ static void render_left(const struct mf_font_s *font, - int16_t x0, int16_t y0, - mf_str text, uint16_t count, + gI16 x0, gI16 y0, + mf_str text, gU16 count, mf_character_callback_t callback, void *state) { - int16_t x; + gI16 x; mf_char c1 = 0, c2; x = x0 - font->baseline_x; @@ -150,13 +150,13 @@ static void render_left(const struct mf_font_s *font, #if !MF_USE_ALIGN void mf_render_aligned(const struct mf_font_s *font, - int16_t x0, int16_t y0, + gI16 x0, gI16 y0, enum mf_align_t align, - mf_str text, uint16_t count, + mf_str text, gU16 count, mf_character_callback_t callback, void *state) { - int16_t string_width; + gI16 string_width; count = strip_spaces(text, count, 0); render_left(font, x0, y0, text, count, callback, state); } @@ -165,13 +165,13 @@ void mf_render_aligned(const struct mf_font_s *font, /* Render right-aligned string, right edge at x0. */ static void render_right(const struct mf_font_s *font, - int16_t x0, int16_t y0, - mf_str text, uint16_t count, + gI16 x0, gI16 y0, + mf_str text, gU16 count, mf_character_callback_t callback, void *state) { - int16_t x; - uint16_t i; + gI16 x; + gU16 i; mf_char c1, c2 = 0; mf_str tmp; @@ -211,13 +211,13 @@ static void render_right(const struct mf_font_s *font, } void mf_render_aligned(const struct mf_font_s *font, - int16_t x0, int16_t y0, + gI16 x0, gI16 y0, enum mf_align_t align, - mf_str text, uint16_t count, + mf_str text, gU16 count, mf_character_callback_t callback, void *state) { - int16_t string_width; + gI16 string_width; count = strip_spaces(text, count, 0); if (align == MF_ALIGN_LEFT) @@ -242,8 +242,8 @@ void mf_render_aligned(const struct mf_font_s *font, #if !MF_USE_JUSTIFY void mf_render_justified(const struct mf_font_s *font, - int16_t x0, int16_t y0, int16_t width, - mf_str text, uint16_t count, + gI16 x0, gI16 y0, gI16 width, + mf_str text, gU16 count, mf_character_callback_t callback, void *state) { @@ -255,15 +255,15 @@ void mf_render_justified(const struct mf_font_s *font, /* Returns true if the character is a justification point, i.e. expands * when the text is being justified. */ -static bool is_justify_space(uint16_t c) +static bool is_justify_space(gU16 c) { return c == ' ' || c == 0xA0; } /* Count the number of space characters in string */ -static uint16_t count_spaces(mf_str text, uint16_t count) +static gU16 count_spaces(mf_str text, gU16 count) { - uint16_t spaces = 0; + gU16 spaces = 0; while (count-- && *text) { if (is_justify_space(mf_getchar(&text))) @@ -273,13 +273,13 @@ static uint16_t count_spaces(mf_str text, uint16_t count) } void mf_render_justified(const struct mf_font_s *font, - int16_t x0, int16_t y0, int16_t width, - mf_str text, uint16_t count, + gI16 x0, gI16 y0, gI16 width, + mf_str text, gU16 count, mf_character_callback_t callback, void *state) { - int16_t string_width, adjustment; - uint16_t num_spaces; + gI16 string_width, adjustment; + gU16 num_spaces; mf_char last_char; count = strip_spaces(text, count, &last_char); @@ -296,7 +296,7 @@ void mf_render_justified(const struct mf_font_s *font, num_spaces = count_spaces(text, count); { - int16_t x, tmp; + gI16 x, tmp; mf_char c1 = 0, c2; x = x0 - font->baseline_x; diff --git a/src/gdisp/mcufont/mf_justify.h b/src/gdisp/mcufont/mf_justify.h index 3c7622fc..4e4eda9e 100644 --- a/src/gdisp/mcufont/mf_justify.h +++ b/src/gdisp/mcufont/mf_justify.h @@ -29,7 +29,7 @@ enum mf_align_t * state: Free state variable for use by the callback. * Returns the width of the character. */ -typedef uint8_t (*mf_character_callback_t) (int16_t x0, int16_t y0, +typedef gU8 (*mf_character_callback_t) (gI16 x0, gI16 y0, mf_char character, void *state); /* Get width of a string in pixels. @@ -39,8 +39,8 @@ typedef uint8_t (*mf_character_callback_t) (int16_t x0, int16_t y0, * count: Number of characters on the line or 0 to read until end of string. * kern: True to consider kerning (slower). */ -MF_EXTERN int16_t mf_get_string_width(const struct mf_font_s *font, - mf_str text, uint16_t count, bool kern); +MF_EXTERN gI16 mf_get_string_width(const struct mf_font_s *font, + mf_str text, gU16 count, bool kern); /* Render a single line of aligned text. * @@ -54,9 +54,9 @@ MF_EXTERN int16_t mf_get_string_width(const struct mf_font_s *font, * state: Free variable for use in the callback. */ MF_EXTERN void mf_render_aligned(const struct mf_font_s *font, - int16_t x0, int16_t y0, + gI16 x0, gI16 y0, enum mf_align_t align, - mf_str text, uint16_t count, + mf_str text, gU16 count, mf_character_callback_t callback, void *state); @@ -72,8 +72,8 @@ MF_EXTERN void mf_render_aligned(const struct mf_font_s *font, * state: Free variable for use in the callback. */ MF_EXTERN void mf_render_justified(const struct mf_font_s *font, - int16_t x0, int16_t y0, int16_t width, - mf_str text, uint16_t count, + gI16 x0, gI16 y0, gI16 width, + mf_str text, gU16 count, mf_character_callback_t callback, void *state); diff --git a/src/gdisp/mcufont/mf_kerning.c b/src/gdisp/mcufont/mf_kerning.c index 5a5aa65b..1e29b6e2 100644 --- a/src/gdisp/mcufont/mf_kerning.c +++ b/src/gdisp/mcufont/mf_kerning.c @@ -16,12 +16,12 @@ /* Structure for keeping track of the edge of the glyph as it is rendered. */ struct kerning_state_s { - uint8_t edgepos[MF_KERNING_ZONES]; - uint8_t zoneheight; + gU8 edgepos[MF_KERNING_ZONES]; + gU8 zoneheight; }; /* Pixel callback for analyzing the left edge of a glyph. */ -static void fit_leftedge(int16_t x, int16_t y, uint8_t count, uint8_t alpha, +static void fit_leftedge(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) { struct kerning_state_s *s = state; @@ -29,21 +29,21 @@ static void fit_leftedge(int16_t x, int16_t y, uint8_t count, uint8_t alpha, if (alpha > 7) { - uint8_t zone = y / s->zoneheight; + gU8 zone = y / s->zoneheight; if (x < s->edgepos[zone]) s->edgepos[zone] = x; } } /* Pixel callback for analyzing the right edge of a glyph. */ -static void fit_rightedge(int16_t x, int16_t y, uint8_t count, uint8_t alpha, +static void fit_rightedge(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) { struct kerning_state_s *s = state; if (alpha > 7) { - uint8_t zone = y / s->zoneheight; + gU8 zone = y / s->zoneheight; x += count - 1; if (x > s->edgepos[zone]) s->edgepos[zone] = x; @@ -65,16 +65,16 @@ static bool do_kerning(mf_char c) return true; } -//static int16_t min16(int16_t a, int16_t b) { return (a < b) ? a : b; } -static int16_t max16(int16_t a, int16_t b) { return (a > b) ? a : b; } -static int16_t avg16(int16_t a, int16_t b) { return (a + b) / 2; } +//static gI16 min16(gI16 a, gI16 b) { return (a < b) ? a : b; } +static gI16 max16(gI16 a, gI16 b) { return (a > b) ? a : b; } +static gI16 avg16(gI16 a, gI16 b) { return (a + b) / 2; } -int8_t mf_compute_kerning(const struct mf_font_s *font, +gI8 mf_compute_kerning(const struct mf_font_s *font, mf_char c1, mf_char c2) { struct kerning_state_s leftedge, rightedge; - uint8_t w1, w2, i, min_space; - int16_t normal_space, adjust, max_adjust; + gU8 w1, w2, i, min_space; + gI16 normal_space, adjust, max_adjust; if (font->flags & MF_FONT_FLAG_MONOSPACE) return 0; /* No kerning for monospace fonts */ @@ -102,7 +102,7 @@ int8_t mf_compute_kerning(const struct mf_font_s *font, min_space = 255; for (i = 0; i < MF_KERNING_ZONES; i++) { - uint8_t space; + gU8 space; if (leftedge.edgepos[i] == 255 || rightedge.edgepos[i] == 0) continue; /* Outside glyph area. */ diff --git a/src/gdisp/mcufont/mf_kerning.h b/src/gdisp/mcufont/mf_kerning.h index 844d99c3..c6c2dcc7 100644 --- a/src/gdisp/mcufont/mf_kerning.h +++ b/src/gdisp/mcufont/mf_kerning.h @@ -25,7 +25,7 @@ * Returns the offset to add to the x position for c2. */ #if MF_USE_KERNING -MF_EXTERN int8_t mf_compute_kerning(const struct mf_font_s *font, +MF_EXTERN gI8 mf_compute_kerning(const struct mf_font_s *font, mf_char c1, mf_char c2); #else #define mf_compute_kerning(font, c1, c2) 0 diff --git a/src/gdisp/mcufont/mf_rlefont.c b/src/gdisp/mcufont/mf_rlefont.c index db217425..1da265c3 100644 --- a/src/gdisp/mcufont/mf_rlefont.c +++ b/src/gdisp/mcufont/mf_rlefont.c @@ -35,8 +35,8 @@ * through the character ranges. If the character is not found, return * pointer to the default glyph. */ -static const uint8_t *find_glyph(const struct mf_rlefont_s *font, - uint16_t character) +static const gU8 *find_glyph(const struct mf_rlefont_s *font, + gU16 character) { unsigned i, index; const struct mf_rlefont_char_range_s *range; @@ -58,21 +58,21 @@ static const uint8_t *find_glyph(const struct mf_rlefont_s *font, * and also the bounds of the character. */ struct renderstate_r { - int16_t x_begin; - int16_t x_end; - int16_t x; - int16_t y; - int16_t y_end; + gI16 x_begin; + gI16 x_end; + gI16 x; + gI16 y; + gI16 y_end; mf_pixel_callback_t callback; void *state; }; /* Call the callback to write one pixel to screen, and advance to next * pixel position. */ -static void write_pixels(struct renderstate_r *rstate, uint16_t count, - uint8_t alpha) +static void write_pixels(struct renderstate_r *rstate, gU16 count, + gU8 alpha) { - uint8_t rowlen; + gU8 rowlen; /* Write row-by-row if the run spans multiple rows. */ while (rstate->x + count >= rstate->x_end) @@ -93,7 +93,7 @@ static void write_pixels(struct renderstate_r *rstate, uint16_t count, } /* Skip the given number of pixels (0 alpha) */ -static void skip_pixels(struct renderstate_r *rstate, uint16_t count) +static void skip_pixels(struct renderstate_r *rstate, gU16 count) { rstate->x += count; while (rstate->x >= rstate->x_end) @@ -106,15 +106,15 @@ static void skip_pixels(struct renderstate_r *rstate, uint16_t count) /* Decode and write out a RLE-encoded dictionary entry. */ static void write_rle_dictentry(const struct mf_rlefont_s *font, struct renderstate_r *rstate, - uint8_t index) + gU8 index) { - uint16_t offset = font->dictionary_offsets[index]; - uint16_t length = font->dictionary_offsets[index + 1] - offset; - uint16_t i; + gU16 offset = font->dictionary_offsets[index]; + gU16 length = font->dictionary_offsets[index + 1] - offset; + gU16 i; for (i = 0; i < length; i++) { - uint8_t code = font->dictionary_data[offset + i]; + gU8 code = font->dictionary_data[offset + i]; if ((code & RLE_CODEMASK) == RLE_ZEROS) { skip_pixels(rstate, code & RLE_VALMASK); @@ -129,7 +129,7 @@ static void write_rle_dictentry(const struct mf_rlefont_s *font, } else if ((code & RLE_CODEMASK) == RLE_SHADE) { - uint8_t count, alpha; + gU8 count, alpha; count = ((code & RLE_VALMASK) >> 4) + 1; alpha = ((code & RLE_VALMASK) & 0xF) * 0x11; write_pixels(rstate, count, alpha); @@ -138,7 +138,7 @@ static void write_rle_dictentry(const struct mf_rlefont_s *font, } /* Get bit count for the "fill entries" */ -static uint8_t fillentry_bitcount(uint8_t index) +static gU8 fillentry_bitcount(gU8 index) { if (index >= DICT_START2BIT) return 2; @@ -157,11 +157,11 @@ static uint8_t fillentry_bitcount(uint8_t index) /* Decode and write out a direct binary codeword */ static void write_bin_codeword(const struct mf_rlefont_s *font, struct renderstate_r *rstate, - uint8_t code) + gU8 code) { - uint8_t bitcount = fillentry_bitcount(code); - uint8_t byte = code - DICT_START7BIT; - uint8_t runlen = 0; + gU8 bitcount = fillentry_bitcount(code); + gU8 byte = code - DICT_START7BIT; + gU8 runlen = 0; (void) font; while (bitcount--) @@ -191,7 +191,7 @@ static void write_bin_codeword(const struct mf_rlefont_s *font, /* Decode and write out a reference codeword */ static void write_ref_codeword(const struct mf_rlefont_s *font, struct renderstate_r *rstate, - uint8_t code) + gU8 code) { if (code <= 15) { @@ -219,15 +219,15 @@ static void write_ref_codeword(const struct mf_rlefont_s *font, /* Decode and write out a reference encoded dictionary entry. */ static void write_ref_dictentry(const struct mf_rlefont_s *font, struct renderstate_r *rstate, - uint8_t index) + gU8 index) { - uint16_t offset = font->dictionary_offsets[index]; - uint16_t length = font->dictionary_offsets[index + 1] - offset; - uint16_t i; + gU16 offset = font->dictionary_offsets[index]; + gU16 length = font->dictionary_offsets[index + 1] - offset; + gU16 i; for (i = 0; i < length; i++) { - uint8_t code = font->dictionary_data[offset + i]; + gU8 code = font->dictionary_data[offset + i]; write_ref_codeword(font, rstate, code); } } @@ -235,7 +235,7 @@ static void write_ref_dictentry(const struct mf_rlefont_s *font, /* Decode and write out an arbitrary glyph codeword */ static void write_glyph_codeword(const struct mf_rlefont_s *font, struct renderstate_r *rstate, - uint8_t code) + gU8 code) { if (code >= DICT_START + font->rle_entry_count && code < DICT_START + font->dict_entry_count) @@ -249,14 +249,14 @@ static void write_glyph_codeword(const struct mf_rlefont_s *font, } -uint8_t mf_rlefont_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, +gU8 mf_rlefont_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state) { - const uint8_t *p; - uint8_t width; + const gU8 *p; + gU8 width; struct renderstate_r rstate; rstate.x_begin = x0; @@ -280,10 +280,10 @@ uint8_t mf_rlefont_render_character(const struct mf_font_s *font, return width; } -uint8_t mf_rlefont_character_width(const struct mf_font_s *font, - uint16_t character) +gU8 mf_rlefont_character_width(const struct mf_font_s *font, + gU16 character) { - const uint8_t *p; + const gU8 *p; p = find_glyph((struct mf_rlefont_s*)font, character); if (!p) return 0; diff --git a/src/gdisp/mcufont/mf_rlefont.h b/src/gdisp/mcufont/mf_rlefont.h index 8978f2a3..be21fe88 100644 --- a/src/gdisp/mcufont/mf_rlefont.h +++ b/src/gdisp/mcufont/mf_rlefont.h @@ -23,16 +23,16 @@ struct mf_rlefont_char_range_s { /* The number of the first character in this range. */ - uint16_t first_char; + gU16 first_char; /* The total count of characters in this range. */ - uint16_t char_count; + gU16 char_count; /* Lookup table with the start indices into glyph_data. */ - const uint16_t *glyph_offsets; + const gU16 *glyph_offsets; /* The encoded glyph data for glyphs in this range. */ - const uint8_t *glyph_data; + const gU8 *glyph_data; }; /* Structure for a single encoded font. */ @@ -41,26 +41,26 @@ struct mf_rlefont_s struct mf_font_s font; /* Version of the font definition used. */ - const uint8_t version; + const gU8 version; /* Big array of the data for all the dictionary entries. */ - const uint8_t *dictionary_data; + const gU8 *dictionary_data; /* Lookup table with the start indices into dictionary_data. * Contains N+1 entries, so that the length of the entry can * be determined by subtracting from the next offset. */ - const uint16_t *dictionary_offsets; + const gU16 *dictionary_offsets; /* Number of dictionary entries using the RLE encoding. * Entries starting at this index use the dictionary encoding. */ - const uint8_t rle_entry_count; + const gU8 rle_entry_count; /* Total number of dictionary entries. * Entries after this are nonexistent. */ - const uint8_t dict_entry_count; + const gU8 dict_entry_count; /* Number of discontinuous character ranges */ - const uint16_t char_range_count; + const gU16 char_range_count; /* Array of the character ranges */ const struct mf_rlefont_char_range_s *char_ranges; @@ -68,14 +68,14 @@ struct mf_rlefont_s #ifdef MF_RLEFONT_INTERNALS /* Internal functions, don't use these directly. */ -MF_EXTERN uint8_t mf_rlefont_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, +MF_EXTERN gU8 mf_rlefont_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state); -MF_EXTERN uint8_t mf_rlefont_character_width(const struct mf_font_s *font, - uint16_t character); +MF_EXTERN gU8 mf_rlefont_character_width(const struct mf_font_s *font, + gU16 character); #endif #endif diff --git a/src/gdisp/mcufont/mf_scaledfont.c b/src/gdisp/mcufont/mf_scaledfont.c index b3c70a7f..9e0903cc 100644 --- a/src/gdisp/mcufont/mf_scaledfont.c +++ b/src/gdisp/mcufont/mf_scaledfont.c @@ -13,17 +13,17 @@ struct scaled_renderstate { mf_pixel_callback_t orig_callback; void *orig_state; - uint8_t x_scale; - uint8_t y_scale; - int16_t x0; - int16_t y0; + gU8 x_scale; + gU8 y_scale; + gI16 x0; + gI16 y0; }; -static void scaled_pixel_callback(int16_t x, int16_t y, uint8_t count, - uint8_t alpha, void *state) +static void scaled_pixel_callback(gI16 x, gI16 y, gU8 count, + gU8 alpha, void *state) { struct scaled_renderstate *rstate = state; - uint8_t dy; + gU8 dy; count *= rstate->x_scale; x = rstate->x0 + x * rstate->x_scale; @@ -35,26 +35,26 @@ static void scaled_pixel_callback(int16_t x, int16_t y, uint8_t count, } } -uint8_t mf_scaled_character_width(const struct mf_font_s *font, - uint16_t character) +gU8 mf_scaled_character_width(const struct mf_font_s *font, + gU16 character) { struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font; - uint8_t basewidth; + gU8 basewidth; basewidth = sfont->basefont->character_width(sfont->basefont, character); return sfont->x_scale * basewidth; } -uint8_t mf_scaled_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, +gU8 mf_scaled_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state) { struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font; struct scaled_renderstate rstate; - uint8_t basewidth; + gU8 basewidth; rstate.orig_callback = callback; rstate.orig_state = state; @@ -71,7 +71,7 @@ uint8_t mf_scaled_render_character(const struct mf_font_s *font, void mf_scale_font(struct mf_scaledfont_s *newfont, const struct mf_font_s *basefont, - uint8_t x_scale, uint8_t y_scale) + gU8 x_scale, gU8 y_scale) { newfont->font = *basefont; newfont->basefont = basefont; diff --git a/src/gdisp/mcufont/mf_scaledfont.h b/src/gdisp/mcufont/mf_scaledfont.h index c82c2093..da9f47aa 100644 --- a/src/gdisp/mcufont/mf_scaledfont.h +++ b/src/gdisp/mcufont/mf_scaledfont.h @@ -19,24 +19,24 @@ struct mf_scaledfont_s struct mf_font_s font; const struct mf_font_s *basefont; - uint8_t x_scale; - uint8_t y_scale; + gU8 x_scale; + gU8 y_scale; }; MF_EXTERN void mf_scale_font(struct mf_scaledfont_s *newfont, const struct mf_font_s *basefont, - uint8_t x_scale, uint8_t y_scale); + gU8 x_scale, gU8 y_scale); #ifdef MF_SCALEDFONT_INTERNALS /* Internal functions, don't use these directly. */ -MF_EXTERN uint8_t mf_scaled_render_character(const struct mf_font_s *font, - int16_t x0, int16_t y0, - uint16_t character, +MF_EXTERN gU8 mf_scaled_render_character(const struct mf_font_s *font, + gI16 x0, gI16 y0, + gU16 character, mf_pixel_callback_t callback, void *state); -MF_EXTERN uint8_t mf_scaled_character_width(const struct mf_font_s *font, - uint16_t character); +MF_EXTERN gU8 mf_scaled_character_width(const struct mf_font_s *font, + gU16 character); #endif #endif diff --git a/src/gdisp/mcufont/mf_wordwrap.c b/src/gdisp/mcufont/mf_wordwrap.c index 06101b32..0b303ace 100644 --- a/src/gdisp/mcufont/mf_wordwrap.c +++ b/src/gdisp/mcufont/mf_wordwrap.c @@ -10,7 +10,7 @@ #ifndef MF_NO_COMPILE /* Returns true if the line can be broken at this character. */ -static bool is_wrap_space(uint16_t c) +static bool is_wrap_space(gU16 c) { return c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '-'; } @@ -20,9 +20,9 @@ static bool is_wrap_space(uint16_t c) /* Represents a single word and the whitespace after it. */ struct wordlen_s { - int16_t word; /* Length of the word in pixels. */ - int16_t space; /* Length of the whitespace in pixels. */ - uint16_t chars; /* Number of characters in word + space, combined. */ + gI16 word; /* Length of the word in pixels. */ + gI16 space; /* Length of the whitespace in pixels. */ + gU16 chars; /* Number of characters in word + space, combined. */ }; /* Take the next word from the string and compute its width. @@ -76,8 +76,8 @@ static bool get_wordlen(const struct mf_font_s *font, mf_str *text, struct linelen_s { mf_str start; /* Start of the text for line. */ - uint16_t chars; /* Total number of characters on the line. */ - int16_t width; /* Total length of all words + whitespace on the line in pixels. */ + gU16 chars; /* Total number of characters on the line. */ + gI16 width; /* Total length of all words + whitespace on the line in pixels. */ bool linebreak; /* True if line ends in a linebreak */ struct wordlen_s last_word; /* Last word on the line. */ struct wordlen_s last_word_2; /* Second to last word on the line. */ @@ -85,7 +85,7 @@ struct linelen_s /* Append word onto the line if it fits. If it would overflow, don't add and * return false. */ -static bool append_word(const struct mf_font_s *font, int16_t width, +static bool append_word(const struct mf_font_s *font, gI16 width, struct linelen_s *current, mf_str *text) { mf_str tmp = *text; @@ -111,12 +111,12 @@ static bool append_word(const struct mf_font_s *font, int16_t width, } /* Append a character to the line if it fits. */ -static bool append_char(const struct mf_font_s *font, int16_t width, +static bool append_char(const struct mf_font_s *font, gI16 width, struct linelen_s *current, mf_str *text) { mf_str tmp = *text; mf_char c; - uint16_t w; + gU16 w; c = mf_getchar(&tmp); w = mf_character_width(font, c); @@ -134,16 +134,16 @@ static bool append_char(const struct mf_font_s *font, int16_t width, } } -static int32_t sq16(int16_t x) { return (int32_t)x * x; } +static gI32 sq16(gI16 x) { return (gI32)x * x; } /* Try to balance the lines by potentially moving one word from the previous * line to the the current one. */ static void tune_lines(struct linelen_s *current, struct linelen_s *previous, - int16_t max_width) + gI16 max_width) { - int16_t curw1, prevw1; - int16_t curw2, prevw2; - int32_t delta1, delta2; + gI16 curw1, prevw1; + gI16 curw2, prevw2; + gI32 delta1, delta2; /* If the lines are rendered as is */ curw1 = current->width - current->last_word.space; @@ -160,7 +160,7 @@ static void tune_lines(struct linelen_s *current, struct linelen_s *previous, if (delta1 > delta2 && curw2 <= max_width) { /* Do the change. */ - uint16_t chars; + gU16 chars; chars = previous->last_word.chars; previous->chars -= chars; @@ -173,13 +173,13 @@ static void tune_lines(struct linelen_s *current, struct linelen_s *previous, } } -void mf_wordwrap(const struct mf_font_s *font, int16_t width, +void mf_wordwrap(const struct mf_font_s *font, gI16 width, mf_str text, mf_line_callback_t callback, void *state) { struct linelen_s current = { 0 }; struct linelen_s previous = { 0 }; bool full; - uint32_t giveUp = 2048; /* Do while-loop a maximum of x times */ + gU32 giveUp = 2048; /* Do while-loop a maximum of x times */ current.start = text; @@ -236,16 +236,16 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width, #else -void mf_wordwrap(const struct mf_font_s *font, int16_t width, +void mf_wordwrap(const struct mf_font_s *font, gI16 width, mf_str text, mf_line_callback_t callback, void *state) { mf_str linestart; /* Current line width and character count */ - int16_t lw_cur = 0, cc_cur = 0; + gI16 lw_cur = 0, cc_cur = 0; /* Previous wrap point */ - int16_t cc_prev; + gI16 cc_prev; mf_str ls_prev; linestart = text; @@ -258,7 +258,7 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width, while (*text) { mf_char c; - int16_t new_width; + gI16 new_width; mf_str tmp; tmp = text; diff --git a/src/gdisp/mcufont/mf_wordwrap.h b/src/gdisp/mcufont/mf_wordwrap.h index a1a051fa..91ac8cad 100644 --- a/src/gdisp/mcufont/mf_wordwrap.h +++ b/src/gdisp/mcufont/mf_wordwrap.h @@ -23,7 +23,7 @@ * * Returns: true to continue, false to stop after this line. */ -typedef bool (*mf_line_callback_t) (mf_str line, uint16_t count, +typedef bool (*mf_line_callback_t) (mf_str line, gU16 count, void *state); /* Word wrap a piece of text. Calls the callback function for each line. @@ -33,7 +33,7 @@ typedef bool (*mf_line_callback_t) (mf_str line, uint16_t count, * text: Pointer to the start of the text to process. * state: Free variable for caller to use (can be NULL). */ -MF_EXTERN void mf_wordwrap(const struct mf_font_s *font, int16_t width, +MF_EXTERN void mf_wordwrap(const struct mf_font_s *font, gI16 width, mf_str text, mf_line_callback_t callback, void *state); #endif diff --git a/src/gdriver/gdriver.c b/src/gdriver/gdriver.c index b9cd05a9..95a1e03e 100644 --- a/src/gdriver/gdriver.c +++ b/src/gdriver/gdriver.c @@ -95,7 +95,7 @@ void gdriverUnRegister(GDriver *driver) { gfxFree(driver); } -GDriver *gdriverGetInstance(uint16_t type, unsigned instance) { +GDriver *gdriverGetInstance(gU16 type, unsigned instance) { GDriver *pd; unsigned sinstance; @@ -111,7 +111,7 @@ GDriver *gdriverGetInstance(uint16_t type, unsigned instance) { return 0; } -unsigned gdriverInstanceCount(uint16_t type) { +unsigned gdriverInstanceCount(gU16 type) { GDriver *pd; unsigned sinstance; @@ -124,7 +124,7 @@ unsigned gdriverInstanceCount(uint16_t type) { return sinstance; } -GDriver *gdriverGetNext(uint16_t type, GDriver *driver) { +GDriver *gdriverGetNext(gU16 type, GDriver *driver) { driver = driver ? driver->driverchain : dhead; while(driver && driver->vmt->type != type) diff --git a/src/gdriver/gdriver.h b/src/gdriver/gdriver.h index 540e604e..2b3ef7da 100644 --- a/src/gdriver/gdriver.h +++ b/src/gdriver/gdriver.h @@ -64,9 +64,9 @@ typedef struct GDriver { * @brief All driver VMT's start with this structure. */ typedef struct GDriverVMT { - uint16_t type; // @< What type of driver this is - uint16_t flags; // @< Flags for the driver. Meaning is specific to each driver type. - uint32_t objsize; // @< How big the runtime driver structure is + gU16 type; // @< What type of driver this is + gU16 flags; // @< Flags for the driver. Meaning is specific to each driver type. + gU32 objsize; // @< How big the runtime driver structure is gBool (*init)(GDriver *driver, void *param, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns gTrue if OK. // driverinstance is the instance 0..n of this driver. // systeminstance is the instance 0..n of this type of device. @@ -120,7 +120,7 @@ extern "C" { * @param[in] type The type of driver to find * @param[in] instance The instance (0..n) to find */ - GDriver *gdriverGetInstance(uint16_t type, unsigned instance); + GDriver *gdriverGetInstance(gU16 type, unsigned instance); /** * @brief Get the count of instances of a type of device @@ -130,7 +130,7 @@ extern "C" { * * @param[in] type The type of driver to find */ - unsigned gdriverInstanceCount(uint16_t type); + unsigned gdriverInstanceCount(gU16 type); /** * @brief Get the instance number for a device @@ -147,7 +147,7 @@ extern "C" { * @param[in] type The type of driver to find * @param[in] driver The last driver returned or NULL to start again */ - GDriver *gdriverGetNext(uint16_t type, GDriver *driver); + GDriver *gdriverGetNext(gU16 type, GDriver *driver); #ifdef __cplusplus } diff --git a/src/gevent/gevent.c b/src/gevent/gevent.c index c092394b..472fb25c 100644 --- a/src/gevent/gevent.c +++ b/src/gevent/gevent.c @@ -68,7 +68,7 @@ void geventListenerInit(GListener *pl) { pl->flags = 0; } -gBool geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags) { +gBool geventAttachSource(GListener *pl, GSourceHandle gsh, gU32 flags) { GSourceListener *psl, *pslfree; // Safety first diff --git a/src/gevent/gevent.h b/src/gevent/gevent.h index dd5b86a4..4e8dacec 100644 --- a/src/gevent/gevent.h +++ b/src/gevent/gevent.h @@ -30,7 +30,7 @@ /* Type definitions */ /*===========================================================================*/ -typedef uint16_t GEventType; +typedef gU16 GEventType; #define GEVENT_NULL 0x0000 // Null Event - Do nothing #define GEVENT_EXIT 0x0001 // The listener is being forced to exit (someone is destroying the listener) @@ -56,7 +56,7 @@ typedef void (*GEventCallbackFn)(void *param, GEvent *pe); // The Listener Object typedef struct GListener { gfxSem waitqueue; // Private: Semaphore for the listener to wait on. - uint16_t flags; // Private: Flags for operation + gU16 flags; // Private: Flags for operation GEventCallbackFn callback; // Private: Call back Function void *param; // Private: Parameter for the callback function. GEvent event; // Public: The event object into which the event information is stored. @@ -69,8 +69,8 @@ typedef struct GSource_t GSource, *GSourceHandle; typedef struct GSourceListener_t { GListener *pListener; // The listener GSource *pSource; // The source - uint32_t listenflags; // The flags the listener passed when the source was assigned to it. - uint32_t srcflags; // For the source's exclusive use. Initialised as 0 for a new listener source assignment. + gU32 listenflags; // The flags the listener passed when the source was assigned to it. + gU32 srcflags; // For the source's exclusive use. Initialised as 0 for a new listener source assignment. } GSourceListener; /*===========================================================================*/ @@ -126,7 +126,7 @@ void geventListenerInit(GListener *pl); * * @return gTrue if succeeded, gFalse otherwise */ -gBool geventAttachSource(GListener *pl, GSourceHandle gsh, uint32_t flags); +gBool geventAttachSource(GListener *pl, GSourceHandle gsh, gU32 flags); /** * @brief Detach a source from a listener diff --git a/src/gfile/gfile.c b/src/gfile/gfile.c index d01c416d..720ab815 100644 --- a/src/gfile/gfile.c +++ b/src/gfile/gfile.c @@ -175,9 +175,9 @@ gBool gfileDelete(const char *fname) { return gFalse; } -long int gfileGetFilesize(const char *fname) { +gFileSize gfileGetFilesize(const char *fname) { const GFILEVMT * const *p; - long int res; + gFileSize res; #if GFILE_ALLOW_DEVICESPECIFIC if (fname[0] && fname[1] == '|') { @@ -185,7 +185,7 @@ long int gfileGetFilesize(const char *fname) { if (p[0]->prefix == fname[0]) return p[0]->filesize ? p[0]->filesize(fname+2) : -1; } - return -1; + return (gFileSize)-1; } #endif @@ -286,8 +286,8 @@ void gfileClose(GFILE *f) { f->flags = 0; } -size_t gfileRead(GFILE *f, void *buf, size_t len) { - size_t res; +gMemSize gfileRead(GFILE *f, void *buf, gMemSize len) { + gMemSize res; if (!f || (f->flags & (GFILEFLG_OPEN|GFILEFLG_READ)) != (GFILEFLG_OPEN|GFILEFLG_READ)) return 0; @@ -299,8 +299,8 @@ size_t gfileRead(GFILE *f, void *buf, size_t len) { return res; } -size_t gfileWrite(GFILE *f, const void *buf, size_t len) { - size_t res; +gMemSize gfileWrite(GFILE *f, const void *buf, gMemSize len) { + gMemSize res; if (!f || (f->flags & (GFILEFLG_OPEN|GFILEFLG_WRITE)) != (GFILEFLG_OPEN|GFILEFLG_WRITE)) return 0; @@ -312,13 +312,13 @@ size_t gfileWrite(GFILE *f, const void *buf, size_t len) { return res; } -long int gfileGetPos(GFILE *f) { +gFileSize gfileGetPos(GFILE *f) { if (!f || !(f->flags & GFILEFLG_OPEN)) return 0; return f->pos; } -gBool gfileSetPos(GFILE *f, long int pos) { +gBool gfileSetPos(GFILE *f, gFileSize pos) { if (!f || !(f->flags & GFILEFLG_OPEN)) return gFalse; if (!f->vmt->setpos || !f->vmt->setpos(f, pos)) @@ -327,7 +327,7 @@ gBool gfileSetPos(GFILE *f, long int pos) { return gTrue; } -long int gfileGetSize(GFILE *f) { +gFileSize gfileGetSize(GFILE *f) { if (!f || !(f->flags & GFILEFLG_OPEN)) return 0; if (!f->vmt->getsize) diff --git a/src/gfile/gfile.h b/src/gfile/gfile.h index 4ad3b302..5940a55b 100644 --- a/src/gfile/gfile.h +++ b/src/gfile/gfile.h @@ -70,11 +70,11 @@ gBool gfileDelete(const char *fname); * * @param[in] fname The file name * - * @return File size on success, -1 on error + * @return File size on success, (gFileSize)-1 on error * * @api */ -long int gfileGetFilesize(const char *fname); +gFileSize gfileGetFilesize(const char *fname); /** * @brief Rename file @@ -145,7 +145,7 @@ void gfileClose(GFILE *f); * * @api */ -size_t gfileRead(GFILE *f, void *buf, size_t len); +gMemSize gfileRead(GFILE *f, void *buf, gMemSize len); /** * @brief Write to file @@ -160,7 +160,7 @@ size_t gfileRead(GFILE *f, void *buf, size_t len); * * @api */ -size_t gfileWrite(GFILE *f, const void *buf, size_t len); +gMemSize gfileWrite(GFILE *f, const void *buf, gMemSize len); /** * @brief Get the current position of the read/write cursor @@ -171,7 +171,7 @@ size_t gfileWrite(GFILE *f, const void *buf, size_t len); * * @api */ -long int gfileGetPos(GFILE *f); +gFileSize gfileGetPos(GFILE *f); /** * @brief Set the position of the read/write cursor @@ -183,7 +183,7 @@ long int gfileGetPos(GFILE *f); * * @api */ -gBool gfileSetPos(GFILE *f, long int pos); +gBool gfileSetPos(GFILE *f, gFileSize pos); /** * @brief Get the size of file @@ -195,7 +195,7 @@ gBool gfileSetPos(GFILE *f, long int pos); * * @api */ -long int gfileGetSize(GFILE *f); +gFileSize gfileGetSize(GFILE *f); /** * @brief Check for EOF @@ -399,7 +399,7 @@ gBool gfileSync(GFILE *f); // Needed routines and definitions size_t gstdioRead(void * ptr, size_t size, size_t count, GFILE *f); size_t gstdioWrite(const void * ptr, size_t size, size_t count, GFILE *f); - int gstdioGetpos(GFILE *f, long int *pos); + int gstdioGetpos(GFILE *f, long *pos); int gstdioSeek(GFILE *f, size_t offset, int origin); #define SEEK_SET 0 #define SEEK_CUR 1 @@ -424,7 +424,7 @@ gBool gfileSync(GFILE *f); #define rename(o,n) (!gfileRename(o,n)) #define fflush(f) (0) #define ftell(f) gfileGetPos(f) - #define fpos_t long int + #define fpos_t gFileSize #define fgetpos(f,pos) gstdioGetpos(f,pos) #define fsetpos(f, pos) (!gfileSetPos(f, *pos)) #define rewind(f) gfileSetPos(f, 0); diff --git a/src/gfile/gfile_fatfs_diskio_chibios.c b/src/gfile/gfile_fatfs_diskio_chibios.c index 13c7403d..9b13ff5b 100644 --- a/src/gfile/gfile_fatfs_diskio_chibios.c +++ b/src/gfile/gfile_fatfs_diskio_chibios.c @@ -271,7 +271,7 @@ DRESULT disk_ioctl ( } #else DWORD get_fattime(void) { - return ((uint32_t)0 | (1 << 16)) | (1 << 21); /* wrong but valid time */ + return ((gU32)0 | (1 << 16)) | (1 << 21); /* wrong but valid time */ } #endif diff --git a/src/gfile/gfile_fatfs_wrapper.c b/src/gfile/gfile_fatfs_wrapper.c index 3099f508..4d846be6 100644 --- a/src/gfile/gfile_fatfs_wrapper.c +++ b/src/gfile/gfile_fatfs_wrapper.c @@ -68,7 +68,7 @@ /*------------------------------------------------------------------------*/ void *ff_memalloc(UINT size) { - return gfxAlloc( (size_t)size ); + return gfxAlloc( (gMemSize)size ); } /*------------------------------------------------------------------------*/ diff --git a/src/gfile/gfile_fs.h b/src/gfile/gfile_fs.h index a19c5fba..4675352d 100644 --- a/src/gfile/gfile_fs.h +++ b/src/gfile/gfile_fs.h @@ -16,7 +16,7 @@ struct GFILE { const struct GFILEVMT * vmt; - uint16_t flags; + gU16 flags; #define GFILEFLG_OPEN 0x0001 // File is open #define GFILEFLG_READ 0x0002 // Read the file #define GFILEFLG_WRITE 0x0004 // Write the file @@ -29,7 +29,7 @@ struct GFILE { #define GFILEFLG_MUSTNOTEXIST 0x0200 // On open file must not exist #define GFILEFLG_TRUNC 0x0400 // On open truncate the file void * obj; - long int pos; + gFileSize pos; }; struct gfileList { @@ -38,7 +38,7 @@ struct gfileList { }; typedef struct GFILEVMT { - uint8_t flags; + gU8 flags; #define GFSFLG_WRITEABLE 0x0001 #define GFSFLG_CASESENSITIVE 0x0002 #define GFSFLG_SEEKABLE 0x0004 @@ -48,14 +48,14 @@ typedef struct GFILEVMT { char prefix; gBool (*del) (const char *fname); gBool (*exists) (const char *fname); - long int (*filesize) (const char *fname); + gFileSize (*filesize) (const char *fname); gBool (*ren) (const char *oldname, const char *newname); gBool (*open) (GFILE *f, const char *fname); void (*close) (GFILE *f); int (*read) (GFILE *f, void *buf, int size); int (*write) (GFILE *f, const void *buf, int size); - gBool (*setpos) (GFILE *f, long int pos); - long int (*getsize) (GFILE *f); + gBool (*setpos) (GFILE *f, gFileSize pos); + gFileSize (*getsize) (GFILE *f); gBool (*eof) (GFILE *f); gBool (*mount) (const char *drive); gBool (*unmount) (const char *drive); diff --git a/src/gfile/gfile_fs_chibios.c b/src/gfile/gfile_fs_chibios.c index 65d259e9..d239bdd5 100644 --- a/src/gfile/gfile_fs_chibios.c +++ b/src/gfile/gfile_fs_chibios.c @@ -18,8 +18,8 @@ static void ChibiOSBFSClose(GFILE *f); static int ChibiOSBFSRead(GFILE *f, void *buf, int size); static int ChibiOSBFSWrite(GFILE *f, const void *buf, int size); -static gBool ChibiOSBFSSetpos(GFILE *f, long int pos); -static long int ChibiOSBFSGetsize(GFILE *f); +static gBool ChibiOSBFSSetpos(GFILE *f, gFileSize pos); +static gFileSize ChibiOSBFSGetsize(GFILE *f); static gBool ChibiOSBFSEof(GFILE *f); static const GFILEVMT FsCHIBIOSVMT = { @@ -52,11 +52,11 @@ static int ChibiOSBFSRead(GFILE *f, void *buf, int size) { static int ChibiOSBFSWrite(GFILE *f, const void *buf, int size) { return fileStreamWrite(((FileStream *)f->obj), (uint8_t *)buf, size); } -static gBool ChibiOSBFSSetpos(GFILE *f, long int pos) { +static gBool ChibiOSBFSSetpos(GFILE *f, gFileSize pos) { fileStreamSeek(((FileStream *)f->obj), pos); return gTrue; } -static long int ChibiOSBFSGetsize(GFILE *f) { return fileStreamGetSize(((FileStream *)f->obj)); } +static gFileSize ChibiOSBFSGetsize(GFILE *f) { return (gFileSize)fileStreamGetSize(((FileStream *)f->obj)); } static gBool ChibiOSBFSEof(GFILE *f) { return f->pos >= fileStreamGetSize(((FileStream *)f->obj)); } GFILE * gfileOpenChibiOSFileStream(void *FileStreamPtr, const char *mode) { diff --git a/src/gfile/gfile_fs_fatfs.c b/src/gfile/gfile_fs_fatfs.c index d787ba09..4aae8c9f 100644 --- a/src/gfile/gfile_fs_fatfs.c +++ b/src/gfile/gfile_fs_fatfs.c @@ -22,14 +22,14 @@ static gBool fatfsDel(const char* fname); static gBool fatfsExists(const char* fname); -static long int fatfsFileSize(const char* fname); +static gFileSize fatfsFileSize(const char* fname); static gBool fatfsRename(const char* oldname, const char* newname); static gBool fatfsOpen(GFILE* f, const char* fname); static void fatfsClose(GFILE* f); static int fatfsRead(GFILE* f, void* buf, int size); static int fatfsWrite(GFILE* f, const void* buf, int size); -static gBool fatfsSetPos(GFILE* f, long int pos); -static long int fatfsGetSize(GFILE* f); +static gBool fatfsSetPos(GFILE* f, gFileSize pos); +static gFileSize fatfsGetSize(GFILE* f); static gBool fatfsEOF(GFILE* f); static gBool fatfsMount(const char* drive); static gBool fatfsUnmount(const char* drive); @@ -118,7 +118,7 @@ static gBool fatfsExists(const char* fname) return gTrue; } -static long int fatfsFileSize(const char* fname) +static gFileSize fatfsFileSize(const char* fname) { FRESULT ferr; FILINFO fno; @@ -127,7 +127,7 @@ static long int fatfsFileSize(const char* fname) if (ferr != FR_OK) return 0; - return (long int)fno.fsize; + return (gFileSize)fno.fsize; } static gBool fatfsRename(const char* oldname, const char* newname) @@ -201,7 +201,7 @@ static int fatfsWrite(GFILE* f, const void* buf, int size) return wr; } -static gBool fatfsSetPos(GFILE* f, long int pos) +static gBool fatfsSetPos(GFILE* f, gFileSize pos) { FRESULT ferr; @@ -212,9 +212,9 @@ static gBool fatfsSetPos(GFILE* f, long int pos) return gTrue; } -static long int fatfsGetSize(GFILE* f) +static gFileSize fatfsGetSize(GFILE* f) { - return (long int)f_size( (FIL*)f->obj ); + return (gFileSize)f_size( (FIL*)f->obj ); } static gBool fatfsEOF(GFILE* f) diff --git a/src/gfile/gfile_fs_mem.c b/src/gfile/gfile_fs_mem.c index d87b8622..7aa0ce82 100644 --- a/src/gfile/gfile_fs_mem.c +++ b/src/gfile/gfile_fs_mem.c @@ -19,7 +19,7 @@ static int MEMRead(GFILE *f, void *buf, int size); static int MEMWrite(GFILE *f, const void *buf, int size); -static gBool MEMSetpos(GFILE *f, long int pos); +static gBool MEMSetpos(GFILE *f, gFileSize pos); static const GFILEVMT FsMemVMT = { GFSFLG_SEEKABLE|GFSFLG_WRITEABLE, // flags @@ -41,7 +41,7 @@ static int MEMWrite(GFILE *f, const void *buf, int size) { memcpy(((char *)f->obj)+f->pos, buf, size); return size; } -static gBool MEMSetpos(GFILE *f, long int pos) { +static gBool MEMSetpos(GFILE *f, gFileSize pos) { (void) f; (void) pos; return gTrue; diff --git a/src/gfile/gfile_fs_native.c b/src/gfile/gfile_fs_native.c index 8c12443b..39ebc960 100644 --- a/src/gfile/gfile_fs_native.c +++ b/src/gfile/gfile_fs_native.c @@ -24,14 +24,14 @@ static gBool NativeDel(const char *fname); static gBool NativeExists(const char *fname); -static long int NativeFilesize(const char *fname); +static gFileSize NativeFilesize(const char *fname); static gBool NativeRen(const char *oldname, const char *newname); static gBool NativeOpen(GFILE *f, const char *fname); static void NativeClose(GFILE *f); static int NativeRead(GFILE *f, void *buf, int size); static int NativeWrite(GFILE *f, const void *buf, int size); -static gBool NativeSetpos(GFILE *f, long int pos); -static long int NativeGetsize(GFILE *f); +static gBool NativeSetpos(GFILE *f, gFileSize pos); +static gFileSize NativeGetsize(GFILE *f); static gBool NativeEof(GFILE *f); #if GFILE_NEED_FILELISTS static gfileList *NativeFlOpen(const char *path, gBool dirs); @@ -78,7 +78,7 @@ void _gfileNativeAssignStdio(void) { gfileStdErr = &NativeStdErr; } -static void Native_flags2mode(char *buf, uint16_t flags) { +static void Native_flags2mode(char *buf, gU16 flags) { if (flags & GFILEFLG_MUSTEXIST) *buf = 'r'; else if (flags & GFILEFLG_APPEND) @@ -99,19 +99,19 @@ static gBool NativeDel(const char *fname) { return remove(fname) ? gFalse static void NativeClose(GFILE *f) { fclose((FILE *)f->obj); } static int NativeRead(GFILE *f, void *buf, int size) { return fread(buf, 1, size, (FILE *)f->obj); } static int NativeWrite(GFILE *f, const void *buf, int size) { return fwrite(buf, 1, size, (FILE *)f->obj); } -static gBool NativeSetpos(GFILE *f, long int pos) { return fseek((FILE *)f->obj, pos, SEEK_SET) ? gFalse : gTrue; } +static gBool NativeSetpos(GFILE *f, gFileSize pos) { return fseek((FILE *)f->obj, pos, SEEK_SET) ? gFalse : gTrue; } static gBool NativeEof(GFILE *f) { return feof((FILE *)f->obj) ? gTrue : gFalse; } static gBool NativeRen(const char *oldname, const char *newname) { return rename(oldname, newname) ? gFalse : gTrue; } static gBool NativeExists(const char *fname) { // We define access this way so we don't have to include which may - // (and does under windows) contain conflicting definitions for types such as uint16_t. + // (and does under windows) contain conflicting definitions for types such as gU16. extern int access(const char *pathname, int mode); return access(fname, 0) ? gFalse : gTrue; } -static long int NativeFilesize(const char *fname) { +static gFileSize NativeFilesize(const char *fname) { struct stat st; - if (stat(fname, &st)) return -1; - return st.st_size; + if (stat(fname, &st)) return (gFileSize)-1; + return (gFileSize)st.st_size; } static gBool NativeOpen(GFILE *f, const char *fname) { FILE *fd; @@ -123,10 +123,10 @@ static gBool NativeOpen(GFILE *f, const char *fname) { f->obj = (void *)fd; return gTrue; } -static long int NativeGetsize(GFILE *f) { +static gFileSize NativeGetsize(GFILE *f) { struct stat st; - if (fstat(fileno((FILE *)f->obj), &st)) return -1; - return st.st_size; + if (fstat(fileno((FILE *)f->obj), &st)) return (gFileSize)-1; + return (gFileSize)st.st_size; } #if GFILE_NEED_FILELISTS diff --git a/src/gfile/gfile_fs_petitfs.c b/src/gfile/gfile_fs_petitfs.c index a322a3b1..4fa51b31 100644 --- a/src/gfile/gfile_fs_petitfs.c +++ b/src/gfile/gfile_fs_petitfs.c @@ -19,7 +19,7 @@ static gBool petitfsExists(const char* fname); static gBool petitfsOpen(GFILE* f, const char* fname); static int petitfsRead(GFILE* f, void* buf, int size); -static gBool petitfsSetPos(GFILE* f, long int pos); +static gBool petitfsSetPos(GFILE* f, gFileSize pos); #if GFILE_NEED_FILELISTS && _FS_MINIMIZE <= 1 static gfileList *petitfsFlOpen(const char *path, gBool dirs); static const char *petitfsFlRead(gfileList *pfl); @@ -103,7 +103,7 @@ static int petitfsRead(GFILE* f, void* buf, int size) return br; } -static gBool petitfsSetPos(GFILE* f, long int pos) +static gBool petitfsSetPos(GFILE* f, gFileSize pos) { (void) f; return pf_lseek((DWORD)pos) == FR_OK; diff --git a/src/gfile/gfile_fs_rom.c b/src/gfile/gfile_fs_rom.c index 315f046e..56181086 100644 --- a/src/gfile/gfile_fs_rom.c +++ b/src/gfile/gfile_fs_rom.c @@ -24,11 +24,11 @@ #define ROMFS_CMP_UNCOMPRESSED 0 typedef struct ROMFS_DIRENTRY { - uint16_t ver; // Directory Entry Version - uint16_t cmp; // Compression format + gU16 ver; // Directory Entry Version + gU16 cmp; // Compression format const struct ROMFS_DIRENTRY * next; // The next entry const char * name; // The file name - long int size; // The file size + gFileSize size; // The file size const char * file; // The file data } ROMFS_DIRENTRY; @@ -43,12 +43,12 @@ typedef struct ROMFileList { static gBool ROMExists(const char *fname); -static long int ROMFilesize(const char *fname); +static gFileSize ROMFilesize(const char *fname); static gBool ROMOpen(GFILE *f, const char *fname); static void ROMClose(GFILE *f); static int ROMRead(GFILE *f, void *buf, int size); -static gBool ROMSetpos(GFILE *f, long int pos); -static long int ROMGetsize(GFILE *f); +static gBool ROMSetpos(GFILE *f, gFileSize pos); +static gFileSize ROMGetsize(GFILE *f); static gBool ROMEof(GFILE *f); #if GFILE_NEED_FILELISTS static gfileList *ROMFlOpen(const char *path, gBool dirs); @@ -84,11 +84,11 @@ static gBool ROMExists(const char *fname) return ROMFindFile(fname) != 0; } -static long int ROMFilesize(const char *fname) +static gFileSize ROMFilesize(const char *fname) { const ROMFS_DIRENTRY *p; - if (!(p = ROMFindFile(fname))) return -1; + if (!(p = ROMFindFile(fname))) return (gFileSize)-1; return p->size; } @@ -118,12 +118,12 @@ static int ROMRead(GFILE *f, void *buf, int size) return size; } -static gBool ROMSetpos(GFILE *f, long int pos) +static gBool ROMSetpos(GFILE *f, gFileSize pos) { return pos <= ((const ROMFS_DIRENTRY *)f->obj)->size; } -static long int ROMGetsize(GFILE *f) +static gFileSize ROMGetsize(GFILE *f) { return ((const ROMFS_DIRENTRY *)f->obj)->size; } diff --git a/src/gfile/gfile_stdio.c b/src/gfile/gfile_stdio.c index 1a045458..9cfc6b75 100644 --- a/src/gfile/gfile_stdio.c +++ b/src/gfile/gfile_stdio.c @@ -39,9 +39,9 @@ int gstdioSeek(GFILE *f, size_t offset, int origin) { return gfileSetPos(f, offset) ? 0 : -1; } -int gstdioGetpos(GFILE *f, long int *pos) { +int gstdioGetpos(GFILE *f, gFileSize *pos) { if (!(f->flags & GFILEFLG_OPEN)) - return -1; + return (gFileSize)-1; *pos = f->pos; return 0; } diff --git a/src/gfx_types.h b/src/gfx_types.h index 5bddffab..97e140a0 100644 --- a/src/gfx_types.h +++ b/src/gfx_types.h @@ -75,12 +75,19 @@ #define GFX_TYPE_64 GFXON /*#elif defined(__GNUC__) || defined(__GNUG__) - typedef __INT8_TYPE__ int8_t; - typedef __UINT8_TYPE__ uint8_t; - typedef __INT16_TYPE__ int16_t; - typedef __UINT16_TYPE__ uint16_t; - typedef __INT32_TYPE__ int32_t; - typedef __UINT32_TYPE__ uint32_t; + typedef __INT8_TYPE__ gI8; + typedef __UINT8_TYPE__ gU8; + typedef __INT16_TYPE__ gI16; + typedef __UINT16_TYPE__ gU16; + typedef __INT32_TYPE__ gI32; + typedef __UINT32_TYPE__ gU32; + #define GI8_C(v) v + #define GU8_C(v) v ## U + #define GI16_C(v) v + #define GU16_C(v) v ## U + #define GI32_C(v) v + #define GU32_C(v) v ## U + #define GFX_TYPE_64 GFXOFF */ #else #include @@ -139,8 +146,15 @@ #endif #endif +typedef void * gAny; typedef void * gPtr; typedef ptrdiff_t gPtrDiff; +#if GFX_MEM_LT64K + typedef gU16 gMemSize; +#else + typedef gU32 gMemSize; +#endif +typedef gI32 gFileSize; typedef gI8 gBool; #define gTrue (-1) #define gFalse (0) diff --git a/src/ginput/ginput_dial.c b/src/ginput/ginput_dial.c index 7763f209..375e10b1 100644 --- a/src/ginput/ginput_dial.c +++ b/src/ginput/ginput_dial.c @@ -21,13 +21,13 @@ static GTIMER_DECL(DialTimer); static struct DialStatus_t { - uint16_t sensitivity; - uint16_t lastvalue; - uint16_t max; + gU16 sensitivity; + gU16 lastvalue; + gU16 max; } DialStatus[GINPUT_DIAL_NUM_PORTS]; // The reading callback function -static void DialCallback(uint16_t instance, uint16_t rawvalue) { +static void DialCallback(gU16 instance, gU16 rawvalue) { struct DialStatus_t *pds; GSourceListener *psl; GEventDial *pe; @@ -37,7 +37,7 @@ static void DialCallback(uint16_t instance, uint16_t rawvalue) { /* Range scale - if needed */ if (pds->max != GINPUT_DIAL_MAX_VALUE) - rawvalue = (uint16_t)((uint32_t)rawvalue * pds->max / GINPUT_DIAL_MAX_VALUE); + rawvalue = (gU16)((gU32)rawvalue * pds->max / GINPUT_DIAL_MAX_VALUE); /* Forget about changes below our sensitivity threshold */ if (rawvalue >= pds->lastvalue) { @@ -62,7 +62,7 @@ static void DialCallback(uint16_t instance, uint16_t rawvalue) { } } -GSourceHandle ginputGetDial(uint16_t instance) { +GSourceHandle ginputGetDial(gU16 instance) { struct DialStatus_t *pds; if (instance >= GINPUT_DIAL_NUM_PORTS) @@ -87,21 +87,21 @@ GSourceHandle ginputGetDial(uint16_t instance) { return (GSourceHandle)(DialStatus+instance); } -void ginputResetDialRange(uint16_t instance) { +void ginputResetDialRange(gU16 instance) { if (instance >= GINPUT_DIAL_NUM_PORTS) return; ginputSetDialRange(instance, GINPUT_DIAL_MAX_VALUE); } -uint16_t ginputGetDialRange(uint16_t instance) { +gU16 ginputGetDialRange(gU16 instance) { if (instance >= GINPUT_DIAL_NUM_PORTS) return 0; return DialStatus[instance].max; } -void ginputSetDialRange(uint16_t instance, uint16_t max) { +void ginputSetDialRange(gU16 instance, gU16 max) { struct DialStatus_t *pds; if (instance >= GINPUT_DIAL_NUM_PORTS) @@ -111,8 +111,8 @@ void ginputSetDialRange(uint16_t instance, uint16_t max) { // Rescale the last value and the sensitivity if (max != pds->max) { - pds->lastvalue = (uint16_t)((uint32_t)pds->lastvalue * max / pds->max); - pds->sensitivity = (uint16_t)((uint32_t)pds->sensitivity * max / pds->max); + pds->lastvalue = (gU16)((gU32)pds->lastvalue * max / pds->max); + pds->sensitivity = (gU16)((gU32)pds->sensitivity * max / pds->max); pds->max = max; } } @@ -124,7 +124,7 @@ void ginputSetDialRange(uint16_t instance, uint16_t max) { * @param[in] instance The ID of the dial input instance * @param[in] diff The amount of level changes */ -void ginputSetDialSensitivity(uint16_t instance, uint16_t diff) { +void ginputSetDialSensitivity(gU16 instance, gU16 diff) { if (instance >= GINPUT_DIAL_NUM_PORTS) return; @@ -139,7 +139,7 @@ void ginputSetDialSensitivity(uint16_t instance, uint16_t diff) { * * @return Returns gFalse on an error (eg invalid instance) */ -gBool ginputGetDialStatus(uint16_t instance, GEventDial *pdial) { +gBool ginputGetDialStatus(gU16 instance, GEventDial *pdial) { if (instance >= GINPUT_DIAL_NUM_PORTS) return gFalse; pdial->type = GEVENT_DIAL; diff --git a/src/ginput/ginput_dial.h b/src/ginput/ginput_dial.h index faf246c3..93c59e3c 100644 --- a/src/ginput/ginput_dial.h +++ b/src/ginput/ginput_dial.h @@ -35,9 +35,9 @@ typedef struct GEventDial_t { GEventType type; // The type of this event (GEVENT_DIAL) - uint16_t instance; // The dial instance - uint16_t value; // The dial value - uint16_t maxvalue; // The maximum dial value + gU16 instance; // The dial instance + gU16 value; // The dial value + gU16 maxvalue; // The maximum dial value } GEventDial; /*===========================================================================*/ @@ -51,14 +51,14 @@ typedef struct GEventDial_t { * * @return The soure handle of the created dial instance */ -GSourceHandle ginputGetDial(uint16_t instance); +GSourceHandle ginputGetDial(gU16 instance); /** * @brief Reset the value back to the hardware default * * @param[in] instance The ID of the dial input instance */ -void ginputResetDialRange(uint16_t instance); +void ginputResetDialRange(gU16 instance); /** * @brief Get the maximum value @@ -68,7 +68,7 @@ void ginputResetDialRange(uint16_t instance); * * @return The maximum value */ -uint16_t ginputGetDialRange(uint16_t instance); +gU16 ginputGetDialRange(gU16 instance); /** * @brief Set the maximum value @@ -77,7 +77,7 @@ uint16_t ginputGetDialRange(uint16_t instance); * @param[in] instance The ID of the dial input instance * @param[in] max The maximum value to be set */ -void ginputSetDialRange(uint16_t instance, uint16_t max); +void ginputSetDialRange(gU16 instance, gU16 max); /** * @brief Set the level change required before a dial even is generated (threshold) @@ -86,7 +86,7 @@ void ginputSetDialRange(uint16_t instance, uint16_t max); * @param[in] instance The ID of the dial input instance * @param[in] diff The amount of level changes */ -void ginputSetDialSensitivity(uint16_t instance, uint16_t diff); +void ginputSetDialSensitivity(gU16 instance, gU16 diff); /** * @brief Get the current dial status @@ -96,7 +96,7 @@ void ginputSetDialSensitivity(uint16_t instance, uint16_t diff); * * @return Returns gFalse on an error (eg invalid instance) */ -gBool ginputGetDialStatus(uint16_t instance, GEventDial *pdial); +gBool ginputGetDialStatus(gU16 instance, GEventDial *pdial); #endif /* GINPUT_NEED_DIAL */ diff --git a/src/ginput/ginput_driver_dial.h b/src/ginput/ginput_driver_dial.h index 86d90c60..ca41e7d7 100644 --- a/src/ginput/ginput_driver_dial.h +++ b/src/ginput/ginput_driver_dial.h @@ -21,7 +21,7 @@ #include "ginput_lld_dial_config.h" -typedef void (*DialCallbackFn)(uint16_t instance, uint16_t rawvalue); +typedef void (*DialCallbackFn)(gU16 instance, gU16 rawvalue); /*===========================================================================*/ /* External declarations. */ diff --git a/src/ginput/ginput_driver_keyboard.h b/src/ginput/ginput_driver_keyboard.h index 0d107274..84c73b9b 100644 --- a/src/ginput/ginput_driver_keyboard.h +++ b/src/ginput/ginput_driver_keyboard.h @@ -24,15 +24,15 @@ typedef struct GKeyboard { GDriver d; // The driver overheads and vmt - uint16_t cntc; // The byte count in c - uint16_t cntsc; // The byte count in sc + gU16 cntc; // The byte count in c + gU16 cntsc; // The byte count in sc char c[8]; // The utf8 code for the current key char sc[8]; // The scancode for the current key - uint32_t keystate; // The keyboard state. - uint16_t flags; + gU32 keystate; // The keyboard state. + gU16 flags; #define GKEYBOARD_FLG_NEEDREAD 0x0001 - uint16_t laystate; // The layout state. - const uint8_t * pLayout; // The current keyboard layout + gU16 laystate; // The layout state. + const gU8 * pLayout; // The current keyboard layout // Other driver specific fields may follow. } GKeyboard; @@ -40,10 +40,10 @@ typedef struct GKeyboardVMT { GDriverVMT d; // Device flags are part of the general vmt #define GKEYBOARD_VFLG_NOPOLL 0x0001 // Do not poll this device - it is purely interrupt driven #define GKEYBOARD_VFLG_DYNAMICONLY 0x8000 // This keyboard driver should not be statically initialized eg Win32 - const uint8_t * defLayout; // The default keyboard layout + const gU8 * defLayout; // The default keyboard layout gBool (*init)(GKeyboard *m, unsigned driverinstance); // Required void (*deinit)(GKeyboard *m); // Optional - int (*getdata)(GKeyboard *k, uint8_t *pch, int sz); // Required. Get zero or more scancode bytes. Returns the number of scancode bytes returns + int (*getdata)(GKeyboard *k, gU8 *pch, int sz); // Required. Get zero or more scancode bytes. Returns the number of scancode bytes returns void (*putdata)(GKeyboard *k, char ch); // Optional. Send a single byte to the keyboard. } GKeyboardVMT; diff --git a/src/ginput/ginput_driver_mouse.h b/src/ginput/ginput_driver_mouse.h index 7a0eb7fc..48d0bc60 100644 --- a/src/ginput/ginput_driver_mouse.h +++ b/src/ginput/ginput_driver_mouse.h @@ -24,7 +24,7 @@ typedef struct GMouseReading { gCoord x, y, z; - uint16_t buttons; + gU16 buttons; } GMouseReading; #if !GINPUT_TOUCH_NOCALIBRATE @@ -41,7 +41,7 @@ typedef struct GMouseReading { typedef struct GMouse { GDriver d; // The driver overheads and vmt GMouseReading r; // The current position and state - uint16_t flags; // Flags + gU16 flags; // Flags #define GMOUSE_FLG_CLICK_TIMER 0x0001 // Currently timing a click #define GMOUSE_FLG_INDELTA 0x0002 // Currently in a up/down transition test #define GMOUSE_FLG_CLIP 0x0004 // Clip reading to the display @@ -88,8 +88,8 @@ typedef struct GMouseVMT { gBool (*init)(GMouse *m, unsigned driverinstance); // Required void (*deinit)(GMouse *m); // Optional gBool (*get)(GMouse *m, GMouseReading *prd); // Required - void (*calsave)(GMouse *m, const void *buf, size_t sz); // Optional - gBool (*calload)(GMouse *m, void *buf, size_t sz); // Optional + void (*calsave)(GMouse *m, const void *buf, gMemSize sz); // Optional + gBool (*calload)(GMouse *m, void *buf, gMemSize sz); // Optional } GMouseVMT; #define gmvmt(m) ((const GMouseVMT const *)((m)->d.vmt)) diff --git a/src/ginput/ginput_keyboard.c b/src/ginput/ginput_keyboard.c index e99be138..2ab84a11 100644 --- a/src/ginput/ginput_keyboard.c +++ b/src/ginput/ginput_keyboard.c @@ -90,7 +90,7 @@ static void SendKeyboardEvent(GKeyboard *k) { #define FLAG_INIT 0x02 #if GKEYBOARD_LAYOUT_OFF - static void microengine(GKeyboard *k, uint8_t code, uint8_t flags) { + static void microengine(GKeyboard *k, gU8 code, gU8 flags) { if (flags) return; @@ -101,10 +101,10 @@ static void SendKeyboardEvent(GKeyboard *k) { k->cntc = k->cntsc = 0; } #else - static void microengine(GKeyboard *k, uint8_t code, uint8_t flags) { - const uint8_t *pc; - const uint8_t *nrec; - uint8_t ver, diff, p1, p2; + static void microengine(GKeyboard *k, gU8 code, gU8 flags) { + const gU8 *pc; + const gU8 *nrec; + gU8 ver, diff, p1, p2; #if MICROCODE_DEBUG unsigned cnt; #endif @@ -446,7 +446,7 @@ static void SendKeyboardEvent(GKeyboard *k) { static void KeyboardPoll(void *param) { GKeyboard * k; - uint8_t scancodes[8]; + gU8 scancodes[8]; int sz, i; (void) param; diff --git a/src/ginput/ginput_keyboard.h b/src/ginput/ginput_keyboard.h index 275bc7f5..78878f37 100644 --- a/src/ginput/ginput_keyboard.h +++ b/src/ginput/ginput_keyboard.h @@ -30,7 +30,7 @@ typedef struct GEventKeyboard_t { GEventType type; // The type of this event (GEVENT_KEYBOARD) - uint16_t bytecount; // The number of bytes in c[]. Note this will only ever represent 0 or 1 characters. This is set to 0 for state transitions. + gU16 bytecount; // The number of bytes in c[]. Note this will only ever represent 0 or 1 characters. This is set to 0 for state transitions. char c[8]; // The utf8 code for the key or a special key code // Normal characters with special meaning. They are a maximum of 1 byte in length. #define GKEY_NULL 0 @@ -104,7 +104,7 @@ typedef struct GEventKeyboard_t { #define GKEY_LAYOUT_FIRST 0xC0 // Special characters the layout can return start here. #define GKEY_DRIVER_FIRST 0xE0 // Special characters the driver can return start here. - uint32_t keystate; // The keyboard state. + gU32 keystate; // The keyboard state. #define GKEYSTATE_KEYUP_BIT 0 #define GKEYSTATE_REPEAT_BIT 1 #define GKEYSTATE_SPECIAL_BIT 2 diff --git a/src/ginput/ginput_keyboard_microcode.c b/src/ginput/ginput_keyboard_microcode.c index 7f916437..ea907373 100644 --- a/src/ginput/ginput_keyboard_microcode.c +++ b/src/ginput/ginput_keyboard_microcode.c @@ -20,7 +20,7 @@ #error "Keyboard Layout SCANCODE2_US is not fully implemented yet" - uint8_t KeyboardLayout_ScancodeSet2_US[] = { + gU8 KeyboardLayout_ScancodeSet2_US[] = { KMC_HEADERSTART, KMC_HEADER_ID1, KMC_HEADER_ID2, KMC_HEADER_VER_1, KMC_RECORDSTART, 0x03, // Handle E0 codes (ignore for now assuming a single character) diff --git a/src/ginput/ginput_mouse.c b/src/ginput/ginput_mouse.c index 72818735..ac434f6e 100644 --- a/src/ginput/ginput_mouse.c +++ b/src/ginput/ginput_mouse.c @@ -245,15 +245,15 @@ static void GetMouseReading(GMouse *m) { #if !GINPUT_TOUCH_NOTOUCH { const GMouseJitter *pj; - uint32_t diff; + gU32 diff; // Are we in pen or finger mode pj = (m->flags & GMOUSE_FLG_FINGERMODE) ? &gmvmt(m)->finger_jitter : &gmvmt(m)->pen_jitter; // Is this just movement jitter if (pj->move > 0) { - diff = (uint32_t)(r.x - m->r.x) * (uint32_t)(r.x - m->r.x) + (uint32_t)(r.y - m->r.y) * (uint32_t)(r.y - m->r.y); - if (diff < (uint32_t)pj->move * (uint32_t)pj->move) { + diff = (gU32)(r.x - m->r.x) * (gU32)(r.x - m->r.x) + (gU32)(r.y - m->r.y) * (gU32)(r.y - m->r.y); + if (diff < (gU32)pj->move * (gU32)pj->move) { r.x = m->r.x; r.y = m->r.y; } @@ -261,8 +261,8 @@ static void GetMouseReading(GMouse *m) { // Check if the click has moved outside the click area and if so cancel the click if (pj->click > 0 && (m->flags & GMOUSE_FLG_CLICK_TIMER)) { - diff = (uint32_t)(r.x - m->clickpos.x) * (uint32_t)(r.x - m->clickpos.x) + (uint32_t)(r.y - m->clickpos.y) * (uint32_t)(r.y - m->clickpos.y); - if (diff > (uint32_t)pj->click * (uint32_t)pj->click) + diff = (gU32)(r.x - m->clickpos.x) * (gU32)(r.x - m->clickpos.x) + (gU32)(r.y - m->clickpos.y) * (gU32)(r.y - m->clickpos.y); + if (diff > (gU32)pj->click * (gU32)pj->click) m->flags &= ~GMOUSE_FLG_CLICK_TIMER; } } @@ -270,7 +270,7 @@ static void GetMouseReading(GMouse *m) { // Step 5 - Click, context-click and other meta event detection { - uint16_t upbtns, dnbtns; + gU16 upbtns, dnbtns; // Calculate button transitions dnbtns = r.buttons & ~m->r.buttons; @@ -461,11 +461,11 @@ static void MousePoll(void *param) { + c2 * ((float)points[0].x * (float)points[1].y - (float)points[1].x * (float)points[0].y)) / dx; } - static uint32_t CalibrateMouse(GMouse *m) { + static gU32 CalibrateMouse(GMouse *m) { gCoord w, h; gPoint cross[4]; // The locations of the test points on the display gPoint points[4]; // The x, y readings obtained from the mouse for each test point - uint32_t err; + gU32 err; #if GDISP_NEED_TEXT gFont font1, font2; #endif @@ -516,7 +516,7 @@ static void MousePoll(void *param) { // Loop through the calibration points for(i = 0; i < maxpoints; i++) { - int32_t px, py; + gI32 px, py; unsigned j; // Draw the current calibration point @@ -597,7 +597,7 @@ static void MousePoll(void *param) { // Is this accurate enough? err = (points[3].x - cross[3].x) * (points[3].x - cross[3].x) + (points[3].y - cross[3].y) * (points[3].y - cross[3].y); - if (err > (uint32_t)pj->calibrate * (uint32_t)pj->calibrate) { + if (err > (gU32)pj->calibrate * (gU32)pj->calibrate) { #if GDISP_NEED_TEXT // No - Display error and return gdispGFillStringBox(m->display, @@ -803,7 +803,7 @@ gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { #endif #if !GINPUT_TOUCH_NOCALIBRATE_GUI - uint32_t ginputCalibrateMouse(unsigned instance) { + gU32 ginputCalibrateMouse(unsigned instance) { GMouse *m; // Find the instance diff --git a/src/ginput/ginput_mouse.h b/src/ginput/ginput_mouse.h index 65c9243b..2e8f2f77 100644 --- a/src/ginput/ginput_mouse.h +++ b/src/ginput/ginput_mouse.h @@ -36,7 +36,7 @@ typedef struct GEventMouse_t { gCoord x, y, z; // The position of the mouse. // - For touch devices, Z is the current pressure if supported (values are device specific) // - For mice, Z is the 3rd dimension if supported (values are device specific) - uint16_t buttons; // A bit is set if the button is down or a meta event has occurred. + gU16 buttons; // A bit is set if the button is down or a meta event has occurred. #define GINPUT_MOUSE_BTN_MASK 0x000F // The "button is down" mask #define GINPUT_MOUSE_BTN_LEFT 0x0001 // The left mouse button is currently down #define GINPUT_MOUSE_BTN_RIGHT 0x0002 // The right mouse button is currently down @@ -145,7 +145,7 @@ gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse); * @return The calibration error squared if calibration fails, or 0 on success or if the driver dosen't need calibration. * @note An invalid instance will also return 0. */ -uint32_t ginputCalibrateMouse(unsigned instance); +gU32 ginputCalibrateMouse(unsigned instance); /** * @brief Load a set of mouse calibration data @@ -159,7 +159,7 @@ uint32_t ginputCalibrateMouse(unsigned instance); * called if GINPUT_TOUCH_USER_CALIBRATION_LOAD has been set to GFXON in the * users gfxconf.h file. */ -gBool LoadMouseCalibration(unsigned instance, void *data, size_t sz); +gBool LoadMouseCalibration(unsigned instance, void *data, gMemSize sz); /** * @brief Save a set of mouse calibration data @@ -173,7 +173,7 @@ gBool LoadMouseCalibration(unsigned instance, void *data, size_t sz); * called if GINPUT_TOUCH_USER_CALIBRATION_SAVE has been set to GFXON in the * users gfxconf.h file. */ -gBool SaveMouseCalibration(unsigned instance, const void *data, size_t sz); +gBool SaveMouseCalibration(unsigned instance, const void *data, gMemSize sz); #endif /* GINPUT_NEED_MOUSE */ diff --git a/src/ginput/ginput_toggle.c b/src/ginput/ginput_toggle.c index 09681d24..1040a6f8 100644 --- a/src/ginput/ginput_toggle.c +++ b/src/ginput/ginput_toggle.c @@ -24,7 +24,7 @@ static GTIMER_DECL(ToggleTimer); static struct GEventToggleStatus_t { - uint8_t status; + gU8 status; } ToggleStatus[GINPUT_TOGGLE_NUM_PORTS]; // Our polling function @@ -35,7 +35,7 @@ static void TogglePoll(void *param) { GSourceListener *psl; GEventToggle *pe; unsigned i, bits, mask; - uint8_t state; + gU8 state; // Loop while there are bits to get for(ptc = GInputToggleConfigTable, i=0; i < GINPUT_TOGGLE_NUM_PORTS; ptc++) { @@ -92,7 +92,7 @@ static void TogglePoll(void *param) { } /* Hardware Toggle/Switch/Button Functions */ -GSourceHandle ginputGetToggle(uint16_t instance) { +GSourceHandle ginputGetToggle(gU16 instance) { const GToggleConfig *ptc; if (instance >= GINPUT_TOGGLE_NUM_PORTS) @@ -110,7 +110,7 @@ GSourceHandle ginputGetToggle(uint16_t instance) { } // If invert is true, invert the on/off sense for the toggle -void ginputInvertToggle(uint16_t instance, gBool invert) { +void ginputInvertToggle(gU16 instance, gBool invert) { if (instance >= GINPUT_TOGGLE_NUM_PORTS) return; if (invert) { @@ -129,7 +129,7 @@ void ginputInvertToggle(uint16_t instance, gBool invert) { /* Get the current toggle status. * Returns gFalse on error (eg invalid instance) */ -gBool ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { +gBool ginputGetToggleStatus(gU16 instance, GEventToggle *ptoggle) { // Win32 threads don't seem to recognise priority and/or pre-emption // so we add a sleep here to prevent 100% polled applications from locking up. gfxSleepMilliseconds(1); diff --git a/src/ginput/ginput_toggle.h b/src/ginput/ginput_toggle.h index d8f76029..94699ced 100644 --- a/src/ginput/ginput_toggle.h +++ b/src/ginput/ginput_toggle.h @@ -47,7 +47,7 @@ typedef struct GEventToggle_t { GEventType type; // The type of this event (GEVENT_TOGGLE) - uint16_t instance; // The toggle instance + gU16 instance; // The toggle instance gBool on; // True if the toggle/button is on } GEventToggle; @@ -66,7 +66,7 @@ typedef struct GEventToggle_t { * * @return The source handle of the created instance */ -GSourceHandle ginputGetToggle(uint16_t instance); +GSourceHandle ginputGetToggle(gU16 instance); /** * @brief Can be used to invert the sense of a toggle @@ -74,7 +74,7 @@ GSourceHandle ginputGetToggle(uint16_t instance); * @param[in] instance The ID of the toggle input instance * @param[in] invert If gTrue, will be inverted */ -void ginputInvertToggle(uint16_t instance, gBool invert); +void ginputInvertToggle(gU16 instance, gBool invert); /** * @brief Get the current toggle status @@ -84,7 +84,7 @@ void ginputInvertToggle(uint16_t instance, gBool invert); * * @return Returns gFalse on an error (eg invalid instance) */ -gBool ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle); +gBool ginputGetToggleStatus(gU16 instance, GEventToggle *ptoggle); #endif /* GINPUT_NEED_TOGGLE */ diff --git a/src/gmisc/gmisc.h b/src/gmisc/gmisc.h index 411cbb02..2cfd04bf 100644 --- a/src/gmisc/gmisc.h +++ b/src/gmisc/gmisc.h @@ -57,7 +57,7 @@ typedef enum ArrayDataFormat_e { * @brief The type for a fixed point type. * @details The top 16 bits are the integer component, the bottom 16 bits are the real component. */ -typedef int32_t fixed; +typedef gI32 fixed; /** * @brief Macros to convert to and from a fixed point. @@ -112,20 +112,20 @@ typedef int32_t fixed; * * @api */ - void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, size_t cnt); + void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, gMemSize cnt); #if 0 - void gmiscArrayTranslate(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int trans); + void gmiscArrayTranslate(ArrayDataFormat fmt, void *src, void *dst, gMemSize cnt, int trans); - void gmiscArrayMultiply(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int mult); + void gmiscArrayMultiply(ArrayDataFormat fmt, void *src, void *dst, gMemSize cnt, int mult); - void gmiscArrayDivide(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int mdiv); + void gmiscArrayDivide(ArrayDataFormat fmt, void *src, void *dst, gMemSize cnt, int mdiv); - void gmiscArrayMultDiv(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int mult, int div); + void gmiscArrayMultDiv(ArrayDataFormat fmt, void *src, void *dst, gMemSize cnt, int mult, int div); - void gmiscArrayAdd(ArrayDataFormat fmt, void *src1, void *src2, void *dst, size_t cnt); + void gmiscArrayAdd(ArrayDataFormat fmt, void *src1, void *src2, void *dst, gMemSize cnt); - void gmiscArrayAddNoOverflow(ArrayDataFormat fmt, void *src1, void *src2, void *dst, size_t cnt); + void gmiscArrayAddNoOverflow(ArrayDataFormat fmt, void *src1, void *src2, void *dst, gMemSize cnt); #endif #endif diff --git a/src/gmisc/gmisc_arrayops.c b/src/gmisc/gmisc_arrayops.c index d159a58d..824ef35c 100644 --- a/src/gmisc/gmisc_arrayops.c +++ b/src/gmisc/gmisc_arrayops.c @@ -9,9 +9,9 @@ #if GFX_USE_GMISC && GMISC_NEED_ARRAYOPS -void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, size_t cnt) { - uint8_t *src8, *dst8; - uint16_t *src16, *dst16; +void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, gMemSize cnt) { + gU8 *src8, *dst8; + gU16 *src16, *dst16; dst8 = dst; dst16 = dst; diff --git a/src/gmisc/gmisc_hittest.c b/src/gmisc/gmisc_hittest.c index b3c21e26..826b3a78 100644 --- a/src/gmisc/gmisc_hittest.c +++ b/src/gmisc/gmisc_hittest.c @@ -66,8 +66,8 @@ static char _pointCrossingSegment(const gPoint *a, const gPoint *b, const gPoint gBool gmiscHittestPoly(const gPoint *pntarray, unsigned cnt, const gPoint *p) { unsigned i = 0; - uint8_t nbrIntersection = 0; - int8_t crossResult; + gU8 nbrIntersection = 0; + gI8 crossResult; // For each pair of points for (i = 0; i < cnt-1; i++) { diff --git a/src/gmisc/gmisc_trig.c b/src/gmisc/gmisc_trig.c index 7d18cf2e..451c408b 100644 --- a/src/gmisc/gmisc_trig.c +++ b/src/gmisc/gmisc_trig.c @@ -144,7 +144,7 @@ } #else float invsqrt(float n) { - int32_t i; + gI32 i; float x2; x2 = n * 0.5F; @@ -156,7 +156,7 @@ ((char *)&i)[2] = ((char *)&n)[1]; ((char *)&i)[3] = ((char *)&n)[0]; #else - i = *(int32_t *)&n; + i = *(gI32 *)&n; #endif // evil floating point bit level hacking diff --git a/src/gos/gos.h b/src/gos/gos.h index d01bc070..a41712ce 100644 --- a/src/gos/gos.h +++ b/src/gos/gos.h @@ -82,7 +82,7 @@ * Many platforms will round the size to ensure correct stack alignment. * Other platforms may entirely ignore the suggested size. */ - #define DECLARE_THREAD_STACK(name, sz) uint8_t name[sz]; + #define DECLARE_THREAD_STACK(name, sz) gU8 name[sz]; /* * @brief Return from a thread @@ -153,7 +153,7 @@ * * @api */ - void *gfxAlloc(size_t sz); + void *gfxAlloc(gMemSize sz); /** * @brief Re-allocate memory @@ -173,7 +173,7 @@ * * @api */ - void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz); + void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz); /** * @brief Free memory @@ -420,7 +420,7 @@ * * @api */ - gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); + gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); /** * @brief Wait for a thread to finish. diff --git a/src/gos/gos_arduino.c b/src/gos/gos_arduino.c index 09241a28..30e731f1 100644 --- a/src/gos/gos_arduino.c +++ b/src/gos/gos_arduino.c @@ -53,7 +53,7 @@ void _gosDeinit(void) *********************************************************/ void gfxHalt(const char *msg) { - volatile uint32_t dummy; + volatile gU32 dummy; (void) msg; while(1) @@ -61,7 +61,7 @@ void gfxHalt(const char *msg) { } void gfxExit(void) { - volatile uint32_t dummy; + volatile gU32 dummy; while(1) dummy++; diff --git a/src/gos/gos_chibios.c b/src/gos/gos_chibios.c index d393251a..be7cd935 100644 --- a/src/gos/gos_chibios.c +++ b/src/gos/gos_chibios.c @@ -64,7 +64,7 @@ void _gosDeinit(void) /* ToDo */ } -void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz) +void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz) { void *np; @@ -175,7 +175,7 @@ void gfxSemSignalI(gfxSem *psem) #endif } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { if (!stackarea) { if (!stacksz) stacksz = 256; diff --git a/src/gos/gos_chibios.h b/src/gos/gos_chibios.h index 497c6776..5dfcad07 100644 --- a/src/gos/gos_chibios.h +++ b/src/gos/gos_chibios.h @@ -101,7 +101,7 @@ typedef tprio_t gThreadpriority; #define gfxSystemUnlock() chSysUnlock() #define gfxMutexDestroy(pmutex) (void)pmutex #define gfxMutexEnter(pmutex) chMtxLock(pmutex) -void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz); +void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz); void gfxSleepMilliseconds(gDelay ms); void gfxSleepMicroseconds(gDelay ms); void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit); @@ -110,7 +110,7 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms); gBool gfxSemWaitI(gfxSem *psem); void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); #define gfxThreadWait(thread) chThdWait(thread) #define gfxThreadMe() chThdSelf() #define gfxThreadClose(thread) (void)thread diff --git a/src/gos/gos_cmsis.c b/src/gos/gos_cmsis.c index 2dcb0d19..4ab652e0 100644 --- a/src/gos/gos_cmsis.c +++ b/src/gos/gos_cmsis.c @@ -88,7 +88,7 @@ void gfxSemSignalI(gfxSem* psem) } } -gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param) +gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param) { osThreadDef_t def; diff --git a/src/gos/gos_cmsis.h b/src/gos/gos_cmsis.h index 17b8c295..3c1c8a73 100644 --- a/src/gos/gos_cmsis.h +++ b/src/gos/gos_cmsis.h @@ -27,9 +27,9 @@ #define gDelayNone 0 #define gDelayForever osWaitForever -typedef uint32_t gDelay; -typedef uint32_t gTicks; -typedef uint16_t gSemcount; +typedef gU32 gDelay; +typedef gU32 gTicks; +typedef gU16 gSemcount; typedef void gThreadreturn; typedef osPriority gThreadpriority; @@ -39,19 +39,19 @@ typedef osPriority gThreadpriority; #define gThreadpriorityHigh osPriorityHigh typedef struct gfxSem { - uint32_t semaphore[2]; + gU32 semaphore[2]; osSemaphoreId id; gSemcount available; } gfxSem; typedef struct gfxMutex { - uint32_t mutex[4]; + gU32 mutex[4]; osMutexId id; } gfxMutex; typedef osThreadId gThread; -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte +#define DECLARE_THREAD_STACK(name, sz) gU8 name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param) #define THREAD_RETURN(retval) @@ -79,7 +79,7 @@ gBool gfxSemWaitI(gfxSem* psem); void gfxSemSignal(gfxSem* psem); void gfxSemSignalI(gfxSem* psem); -gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param); +gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param); #define gfxYield() osThreadYield() #define gfxThreadMe() osThreadGetId() #define gfxThreadClose(thread) {} diff --git a/src/gos/gos_cmsis2.c b/src/gos/gos_cmsis2.c index b1dd1dd6..9bc5e112 100644 --- a/src/gos/gos_cmsis2.c +++ b/src/gos/gos_cmsis2.c @@ -76,7 +76,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms) return gFalse; } -gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param) +gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param) { osThreadAttr_t def; diff --git a/src/gos/gos_cmsis2.h b/src/gos/gos_cmsis2.h index fd702027..e45dd91f 100644 --- a/src/gos/gos_cmsis2.h +++ b/src/gos/gos_cmsis2.h @@ -27,9 +27,9 @@ #define gDelayNone 0 #define gDelayForever osWaitForever -typedef uint32_t gDelay; -typedef uint32_t gTicks; -typedef uint16_t gSemcount; +typedef gU32 gDelay; +typedef gU32 gTicks; +typedef gU16 gSemcount; typedef void gThreadreturn; typedef osPriority_t gThreadpriority; @@ -44,7 +44,7 @@ typedef osMutexId_t gfxMutex; typedef osThreadId_t gThread; -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte +#define DECLARE_THREAD_STACK(name, sz) gU8 name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param) #define THREAD_RETURN(retval) @@ -72,7 +72,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms); #define gfxSemSignal(psem) osSemaphoreRelease(*(psem)) #define gfxSemSignalI(psem) osSemaphoreRelease(*(psem)) -gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param); +gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param); #define gfxYield() osThreadYield() #define gfxThreadMe() osThreadGetId() #define gfxThreadClose(thread) {} diff --git a/src/gos/gos_ecos.c b/src/gos/gos_ecos.c index 1842acda..bbd4f87c 100644 --- a/src/gos/gos_ecos.c +++ b/src/gos/gos_ecos.c @@ -96,7 +96,7 @@ void gfxSemSignalI(gfxSem *psem) cyg_semaphore_post(&psem->sem); } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { gThread th; diff --git a/src/gos/gos_ecos.h b/src/gos/gos_ecos.h index e529e88e..7971be8d 100644 --- a/src/gos/gos_ecos.h +++ b/src/gos/gos_ecos.h @@ -77,7 +77,7 @@ gBool gfxSemWaitI(gfxSem *psem); void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); #define gfxThreadWait(thread) NOTIMPLEMENTED_YET #define gfxThreadMe() cyg_thread_self() #define gfxThreadClose(thread) (void)thread diff --git a/src/gos/gos_freertos.c b/src/gos/gos_freertos.c index fee852c9..7680cd4c 100644 --- a/src/gos/gos_freertos.c +++ b/src/gos/gos_freertos.c @@ -66,7 +66,7 @@ void _gosDeinit(void) #endif } -void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz) +void* gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz) { void *np; @@ -146,7 +146,7 @@ void gfxSemSignalI(gfxSem* psem) xSemaphoreGiveFromISR(*psem,&xHigherPriorityTaskWoken); } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { gThread task; (void) stackarea; diff --git a/src/gos/gos_freertos.h b/src/gos/gos_freertos.h index 1a2e6f99..37711b93 100644 --- a/src/gos/gos_freertos.h +++ b/src/gos/gos_freertos.h @@ -26,9 +26,9 @@ #define gDelayNone 0 #define gDelayForever ((gDelay)-1) -typedef uint32_t gDelay; +typedef gU32 gDelay; typedef portTickType gTicks; -typedef int32_t gSemcount; +typedef gI32 gSemcount; typedef void gThreadreturn; typedef portBASE_TYPE gThreadpriority; @@ -38,7 +38,7 @@ typedef portBASE_TYPE gThreadpriority; #define gThreadpriorityHigh configMAX_PRIORITIES-1 /* FreeRTOS will allocate the stack when creating the thread */ -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1] +#define DECLARE_THREAD_STACK(name, sz) gU8 name[1] #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param) #define THREAD_RETURN(retval) @@ -65,7 +65,7 @@ void gfxMutexInit(gfxMutex* s); #define gfxMutexEnter(pmutex) xSemaphoreTake(*(pmutex),portMAX_DELAY) #define gfxMutexExit(pmutex) xSemaphoreGive(*(pmutex)) -void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz); +void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz); void gfxSleepMilliseconds(gDelay ms); void gfxSleepMicroseconds(gDelay ms); @@ -75,7 +75,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms); gBool gfxSemWaitI(gfxSem* psem); void gfxSemSignal(gfxSem* psem); void gfxSemSignalI(gfxSem* psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); #define gfxThreadMe() xTaskGetCurrentTaskHandle() #if INCLUDE_eTaskGetState == 1 diff --git a/src/gos/gos_linux.c b/src/gos/gos_linux.c index b5754d86..5a098509 100644 --- a/src/gos/gos_linux.c +++ b/src/gos/gos_linux.c @@ -109,7 +109,7 @@ gTicks gfxSystemTicks(void) { return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { gThread th; (void) stackarea; (void) stacksz; diff --git a/src/gos/gos_linux.h b/src/gos/gos_linux.h index 583c0c0f..4f47cd4d 100644 --- a/src/gos/gos_linux.h +++ b/src/gos/gos_linux.h @@ -28,11 +28,11 @@ typedef void * gThreadreturn; typedef unsigned long gDelay; typedef pthread_t gThread; typedef int gThreadpriority; -typedef uint32_t gSemcount; +typedef gU32 gSemcount; typedef pthread_mutex_t gfxMutex; #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param) -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0]; +#define DECLARE_THREAD_STACK(name, sz) gU8 name[0]; #define THREAD_RETURN(retval) return retval #define gfxExit() exit(0) @@ -85,7 +85,7 @@ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit); void gfxSemDestroy(gfxSem *psem); gBool gfxSemWait(gfxSem *psem, gDelay ms); void gfxSemSignal(gfxSem *psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); gThreadreturn gfxThreadWait(gThread thread); #endif /* GFX_USE_OS_LINUX */ diff --git a/src/gos/gos_nios.c b/src/gos/gos_nios.c index 154be3d0..ba1126ea 100644 --- a/src/gos/gos_nios.c +++ b/src/gos/gos_nios.c @@ -35,7 +35,7 @@ void _gosDeinit(void) void gfxHalt(const char *msg) { - volatile uint32_t dummy; + volatile gU32 dummy; (void)msg; @@ -45,7 +45,7 @@ void gfxHalt(const char *msg) } void gfxExit(void) { - volatile uint32_t dummy; + volatile gU32 dummy; while(1) { dummy++; diff --git a/src/gos/gos_options.h b/src/gos/gos_options.h index e0187e6a..bdb2b139 100644 --- a/src/gos/gos_options.h +++ b/src/gos/gos_options.h @@ -260,6 +260,21 @@ #ifndef GFX_EMULATE_MALLOC #define GFX_EMULATE_MALLOC GFXOFF #endif + /** + * @brief Is the maximum memory allocation less than 64K + * @details Defaults to GFXOFF + * @note Many CPU's cannot allocate memory blocks larger than 64K. Note that this + * is not necessarily mean that a pointer is 16 bit but a 16 bit pointer + * will definitely impose this restriction. An example is the x86 processor + * running in "FAR" mode. Pointers are 32 bit but the maximum size memory block is 64K. + * @note Specifying this only leads to code and memory optimisations. uGFX should still work + * on these processors even if it is not set although obviously an attempted memory + * allocation larger than 64K will fail. + */ + #ifndef GFX_MEM_LT64K + #define GFX_MEM_LT64K GFXOFF + #endif + /** @} */ #endif /* _GOS_OPTIONS_H */ diff --git a/src/gos/gos_osx.c b/src/gos/gos_osx.c index 425e6345..b64d3d40 100644 --- a/src/gos/gos_osx.c +++ b/src/gos/gos_osx.c @@ -92,7 +92,7 @@ gTicks gfxSystemTicks(void) { return ts.tv_sec * 1000UL + ts.tv_nsec / 1000000; } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { gThread th; (void) stackarea; (void) stacksz; diff --git a/src/gos/gos_osx.h b/src/gos/gos_osx.h index 90316f2d..c81f84ae 100644 --- a/src/gos/gos_osx.h +++ b/src/gos/gos_osx.h @@ -19,11 +19,11 @@ typedef void * gThreadreturn; typedef unsigned long gDelay; typedef pthread_t gThread; typedef int gThreadpriority; -typedef uint32_t gSemcount; +typedef gU32 gSemcount; typedef pthread_mutex_t gfxMutex; #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param) -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0]; +#define DECLARE_THREAD_STACK(name, sz) gU8 name[0]; #define THREAD_RETURN(retval) return retval #define gfxExit() exit(0) @@ -69,7 +69,7 @@ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit); void gfxSemDestroy(gfxSem *psem); gBool gfxSemWait(gfxSem *psem, gDelay ms); void gfxSemSignal(gfxSem *psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); gThreadreturn gfxThreadWait(gThread thread); #endif /* GFX_USE_OS_OSX */ diff --git a/src/gos/gos_qt.cpp b/src/gos/gos_qt.cpp index 2e15fc0f..5a9c613a 100644 --- a/src/gos/gos_qt.cpp +++ b/src/gos/gos_qt.cpp @@ -64,7 +64,7 @@ void _gosDeinit(void) void gfxHalt(const char *msg) { - volatile uint32_t dummy; + volatile gU32 dummy; (void)msg; @@ -75,19 +75,19 @@ void gfxHalt(const char *msg) void gfxExit(void) { - volatile uint32_t dummy; + volatile gU32 dummy; while(1) { dummy++; } } -void* gfxAlloc(size_t sz) +void* gfxAlloc(gMemSize sz) { return malloc(sz); } -void* gfxRealloc(void* ptr, size_t oldsz, size_t newsz) +void* gfxRealloc(void* ptr, gMemSize oldsz, gMemSize newsz) { Q_UNUSED(oldsz) return realloc(ptr, newsz); @@ -185,7 +185,7 @@ void gfxSemSignalI(gfxSem *psem) static_cast(*psem)->release(1); } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { Q_UNUSED(stackarea) diff --git a/src/gos/gos_qt.h b/src/gos/gos_qt.h index 69a3c256..5e061228 100644 --- a/src/gos/gos_qt.h +++ b/src/gos/gos_qt.h @@ -11,7 +11,7 @@ #if GFX_USE_OS_QT #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param) -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0] +#define DECLARE_THREAD_STACK(name, sz) gU8 name[0] #define THREAD_RETURN(retval) return retval #define gDelayNone 0 @@ -35,8 +35,8 @@ void _gosDeinit(); void gfxHalt(const char* msg); void gfxExit(void); -void* gfxAlloc(size_t sz); -void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz); +void* gfxAlloc(gMemSize sz); +void* gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz); void gfxFree(void* ptr); void gfxYield(void); void gfxSleepMilliseconds(gDelay ms); @@ -55,7 +55,7 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms); gBool gfxSemWaitI(gfxSem *psem); void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); gThreadreturn gfxThreadWait(gThread thread); gThread gfxThreadMe(void); void gfxThreadClose(gThread thread); diff --git a/src/gos/gos_raw32.c b/src/gos/gos_raw32.c index 5351e7df..71c37865 100644 --- a/src/gos/gos_raw32.c +++ b/src/gos/gos_raw32.c @@ -87,7 +87,7 @@ void gfxHalt(const char *msg) { fprintf(stderr, "%s\n", msg); ExitProcess(1); #else - volatile uint32_t dummy; + volatile gU32 dummy; (void) msg; while(1) @@ -99,7 +99,7 @@ void gfxExit(void) { #if defined(WIN32) ExitProcess(0); #else - volatile uint32_t dummy; + volatile gU32 dummy; while(1) dummy++; diff --git a/src/gos/gos_rawrtos.c b/src/gos/gos_rawrtos.c index 32e19017..2f66bc06 100644 --- a/src/gos/gos_rawrtos.c +++ b/src/gos/gos_rawrtos.c @@ -75,7 +75,7 @@ gBool gfxSemWaitI(gfxSem* psem) return gFalse; } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { RAW_U16 ret; gThread taskobj; diff --git a/src/gos/gos_rawrtos.h b/src/gos/gos_rawrtos.h index ed42c404..51852fb7 100644 --- a/src/gos/gos_rawrtos.h +++ b/src/gos/gos_rawrtos.h @@ -7,10 +7,10 @@ #define gDelayNone (RAW_NO_WAIT) #define gDelayForever (RAW_WAIT_FOREVER) -typedef uint32_t gDelay; +typedef gU32 gDelay; typedef RAW_TICK_TYPE gTicks; -typedef int32_t gSemcount; -typedef uint32_t gThreadreturn; +typedef gI32 gSemcount; +typedef gU32 gThreadreturn; typedef RAW_U8 gThreadpriority; #define MAX_SEMAPHORE_COUNT RAW_SEMAPHORE_COUNT @@ -67,7 +67,7 @@ void gfxSleepMilliseconds(gDelay ms); void gfxSleepMicroseconds(gDelay us); gBool gfxSemWait(gfxSem* psem, gDelay ms); gBool gfxSemWaitI(gfxSem* psem); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); #endif diff --git a/src/gos/gos_win32.c b/src/gos/gos_win32.c index 88936ce8..54797c98 100644 --- a/src/gos/gos_win32.c +++ b/src/gos/gos_win32.c @@ -103,7 +103,7 @@ gSemcount gfxSemCounter(gfxSem *pSem) { } */ -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) { +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) { (void) stackarea; HANDLE thd; diff --git a/src/gos/gos_win32.h b/src/gos/gos_win32.h index f9ac10b4..1d74952f 100644 --- a/src/gos/gos_win32.h +++ b/src/gos/gos_win32.h @@ -32,7 +32,7 @@ typedef DWORD gThreadreturn; typedef int gThreadpriority; #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn (WINAPI fnName)(void *param) -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; +#define DECLARE_THREAD_STACK(name, sz) gU8 name[1]; #define THREAD_RETURN(retval) return retval #define gDelayNone 0 @@ -75,7 +75,7 @@ void gfxSleepMicroseconds(gDelay ms); gBool gfxSemWait(gfxSem *psem, gDelay ms); void gfxSystemLock(void); void gfxSystemUnlock(void); -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param); gThreadreturn gfxThreadWait(gThread thread); #endif /* GFX_USE_OS_WIN32 */ diff --git a/src/gos/gos_x_heap.c b/src/gos/gos_x_heap.c index 1a8f1061..d8f28a3a 100644 --- a/src/gos/gos_x_heap.c +++ b/src/gos/gos_x_heap.c @@ -17,11 +17,11 @@ void _gosHeapInit(void) { } - void *gfxAlloc(size_t sz) { + void *gfxAlloc(gMemSize sz) { return malloc(sz); } - void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz) { + void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz) { (void) oldsz; return realloc(ptr, newsz); } @@ -34,7 +34,7 @@ // Slot structure - user memory follows typedef struct memslot { - size_t sz; // Includes the size of this memslot. + gMemSize sz; // Includes the size of this memslot. } memslot; // Free Slot - immediately follows the memslot structure @@ -54,7 +54,7 @@ gfxAddHeapBlock(heap, GFX_OS_HEAP_SIZE); } - void gfxAddHeapBlock(void *ptr, size_t sz) { + void gfxAddHeapBlock(void *ptr, gMemSize sz) { if (sz < sizeof(memslot)+sizeof(freeslot)) return; @@ -62,7 +62,7 @@ gfxFree(Slot2Ptr((memslot *)ptr)); } - void *gfxAlloc(size_t sz) { + void *gfxAlloc(gMemSize sz) { register memslot *prev, *p, *pnew; if (!sz) return 0; @@ -94,7 +94,7 @@ return 0; } - void *gfxRealloc(void *ptr, size_t oldsz, size_t sz) { + void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize sz) { register memslot *prev, *p, *pfree; (void) oldsz; @@ -187,7 +187,7 @@ #include void* malloc(size_t size) { - return gfxAlloc(size); + return gfxAlloc((gMemSize)size); } void free(void *ptr) { gfxFree(ptr); diff --git a/src/gos/gos_x_heap.h b/src/gos/gos_x_heap.h index 205591ca..26b3e43b 100644 --- a/src/gos/gos_x_heap.h +++ b/src/gos/gos_x_heap.h @@ -25,11 +25,11 @@ * @pre GFX_OS_HEAP_SIZE != 0 and an operating system that uses the * internal ugfx heap allocator rather than its own allocator. */ - void gfxAddHeapBlock(void *ptr, size_t sz); + void gfxAddHeapBlock(void *ptr, gMemSize sz); #endif -void *gfxAlloc(size_t sz); -void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz); +void *gfxAlloc(gMemSize sz); +void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz); void gfxFree(void *ptr); #endif /* GOS_NEED_X_HEAP */ diff --git a/src/gos/gos_x_threads.c b/src/gos/gos_x_threads.c index a07a2feb..f9c57460 100644 --- a/src/gos/gos_x_threads.c +++ b/src/gos/gos_x_threads.c @@ -175,7 +175,7 @@ typedef struct thread { #define FLG_THD_MAIN 0x0002 #define FLG_THD_DEAD 0x0004 #define FLG_THD_WAIT 0x0008 - size_t size; // Size of the thread stack (including this structure) + gMemSize size; // Size of the thread stack (including this structure) gThreadreturn (*fn)(void *param); // Thread function void * param; // Parameter for the thread function void * cxt; // The current thread context. @@ -244,9 +244,9 @@ static thread mainthread; // The main thread context * * AUTO_DETECT_STACKFRAME GFXON/GFXOFF - GFXON to auto-detect stack frame structure * STACK_DIR_UP Macro/gBool - GFXON if the stack grows up instead of down - * MASK1 Macro/uint32_t - The 1st mask of jmp_buf elements that need relocation - * MASK2 Macro/uint32_t - The 2nd mask of jmp_buf elements that need relocation - * STACK_BASE Macro/size_t - The base of the stack frame relative to the local variables + * MASK1 Macro/gU32 - The 1st mask of jmp_buf elements that need relocation + * MASK2 Macro/gU32 - The 2nd mask of jmp_buf elements that need relocation + * STACK_BASE Macro/gMemSize - The base of the stack frame relative to the local variables * _gfxThreadsInit() Macro/Function - Initialise the scheduler * */ @@ -276,9 +276,9 @@ static thread mainthread; // The main thread context } saveloc; static gBool stackdirup; - static uint32_t jmpmask1; - static uint32_t jmpmask2; - static size_t stackbase; + static gU32 jmpmask1; + static gU32 jmpmask2; + static gMemSize stackbase; static saveloc *pframeinfo; // These two functions are not static to prevent the compiler removing them as functions @@ -293,10 +293,10 @@ static thread mainthread; // The main thread context pframeinfo--; } static void _gfxThreadsInit(void) { - uint32_t i; + gU32 i; char ** pout; char ** pin; - size_t diff; + gPtrDiff diff; char * framebase; saveloc tmpsaveloc[2]; @@ -320,7 +320,7 @@ static thread mainthread; // The main thread context framebase = pframeinfo[0].localptr; jmpmask1 = jmpmask2 = 0; for (i = 0; i < sizeof(jmp_buf)/sizeof(char *); i++, pout++, pin++) { - if ((size_t)(*pout - *pin) == diff) { + if ((gPtrDiff)(*pout - *pin) == diff) { if (i < 32) jmpmask1 |= 1 << i; else @@ -345,7 +345,7 @@ static thread mainthread; // The main thread context char ** s; char * nf; int diff; - uint32_t i; + gU32 i; // Copy the stack frame s = 0; @@ -508,7 +508,7 @@ void gfxThreadExit(gThreadreturn ret) { // We never get back here as we didn't re-queue ourselves } -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) { thread * t; thread * me; (void) prio; diff --git a/src/gos/gos_x_threads.h b/src/gos/gos_x_threads.h index 5b1b7260..175c1b94 100644 --- a/src/gos/gos_x_threads.h +++ b/src/gos/gos_x_threads.h @@ -24,14 +24,14 @@ #if GOS_NEED_X_THREADS -typedef uint32_t gDelay; -typedef uint32_t gTicks; +typedef gU32 gDelay; +typedef gU32 gTicks; typedef short gSemcount; typedef int gThreadreturn; typedef int gThreadpriority; #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param) -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[(sz) & ~3]; +#define DECLARE_THREAD_STACK(name, sz) gU8 name[(sz) & ~3]; #define THREAD_RETURN(retval) return retval #define gDelayNone 0 @@ -46,7 +46,7 @@ typedef struct { gSemcount limit; } gfxSem; -typedef uint32_t gfxMutex; +typedef gU32 gfxMutex; typedef void * gThread; // Required timing functions - supplied by the user or the operating system @@ -77,7 +77,7 @@ void gfxSemSignal(gfxSem *psem); void gfxSemSignalI(gfxSem *psem); // Threads -gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); +gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); #define gfxThreadClose(thread) gThreadreturn gfxThreadWait(gThread thread); gThread gfxThreadMe(void); diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c index 04aeb6dd..8bd1312f 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue.c @@ -430,7 +430,7 @@ void _gqueueDeinit(void) #endif #if GQUEUE_NEED_BUFFERS - gBool gfxBufferAlloc(unsigned num, size_t size) { + gBool gfxBufferAlloc(unsigned num, gMemSize size) { GDataBuffer *pd; if (num < 1) diff --git a/src/gqueue/gqueue.h b/src/gqueue/gqueue.h index 179f0822..a62f8775 100644 --- a/src/gqueue/gqueue.h +++ b/src/gqueue/gqueue.h @@ -77,8 +77,8 @@ typedef struct gfxQueueFSync { */ typedef struct GDataBuffer { gfxQueueGSyncItem next; // @< Used for queueing the buffers - size_t size; // @< The size of the buffer area following this structure (in bytes) - size_t len; // @< The length of the data in the buffer area (in bytes) + gMemSize size; // @< The size of the buffer area following this structure (in bytes) + gMemSize len; // @< The length of the data in the buffer area (in bytes) } GDataBuffer; /*===========================================================================*/ @@ -352,7 +352,7 @@ gBool gfxQueueFSyncIsInI(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem); * @api * @{ */ -gBool gfxBufferAlloc(unsigned num, size_t size); +gBool gfxBufferAlloc(unsigned num, gMemSize size); /** @} */ /** diff --git a/src/gtimer/gtimer.h b/src/gtimer/gtimer.h index a2b65cbc..e70d9443 100644 --- a/src/gtimer/gtimer.h +++ b/src/gtimer/gtimer.h @@ -54,7 +54,7 @@ typedef struct GTimer_t { void *param; gTicks when; gTicks period; - uint16_t flags; + gU16 flags; struct GTimer_t *next; struct GTimer_t *prev; } GTimer; diff --git a/src/gtrans/gtrans.c b/src/gtrans/gtrans.c index c2d41246..15630b20 100644 --- a/src/gtrans/gtrans.c +++ b/src/gtrans/gtrans.c @@ -26,7 +26,7 @@ void _gtransDeinit(void) const char* gtransString(const char* string) { // Find the index of the specified string in the base language table - size_t i = 0; + unsigned i = 0; while (1) { // Prevent overflow if (i >= _languageBase->numEntries) { diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 0e309ba1..b254fb96 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -84,7 +84,7 @@ void _gwinDeinit(void) // Internal routine for use by GWIN components only // Initialise a window creating it dynamically if required. -GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint32_t flags) { +GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, gU32 flags) { // Allocate the structure if necessary if (!pgw) { if (!(pgw = gfxAlloc(vmt->size))) @@ -324,13 +324,13 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s #endif #if GDISP_NEED_ARCSECTORS - void gwinDrawArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, uint8_t sectors) { + void gwinDrawArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, gU8 sectors) { if (!_gwinDrawStart(gh)) return; gdispGDrawArcSectors(gh->display, gh->x+x, gh->y+y, radius, sectors, gh->color); _gwinDrawEnd(gh); } - void gwinFillArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, uint8_t sectors) { + void gwinFillArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, gU8 sectors) { if (!_gwinDrawStart(gh)) return; gdispGFillArcSectors(gh->display, gh->x+x, gh->y+y, radius, sectors, gh->color); _gwinDrawEnd(gh); diff --git a/src/gwin/gwin.h b/src/gwin/gwin.h index ed48de11..b55cb381 100644 --- a/src/gwin/gwin.h +++ b/src/gwin/gwin.h @@ -50,7 +50,7 @@ typedef struct GWindowObject { gCoord height; /**< The height of this window */ gColor color; /**< The current foreground drawing color */ gColor bgcolor; /**< The current background drawing color */ - uint32_t flags; /**< Window flags (the meaning is private to the GWIN class) */ + gU32 flags; /**< Window flags (the meaning is private to the GWIN class) */ #if GDISP_NEED_TEXT gFont font; /**< The current font */ #endif @@ -830,7 +830,7 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s * * @api */ - void gwinDrawArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, uint8_t sectors); + void gwinDrawArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, gU8 sectors); /* * @brief Draw a filled selection of 45 degree arcs of a circle in the window. @@ -853,7 +853,7 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s * * @api */ - void gwinFillArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, uint8_t sectors); + void gwinFillArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, gU8 sectors); #endif /*------------------------------------------------- diff --git a/src/gwin/gwin_button.c b/src/gwin/gwin_button.c index 2b65856f..7d588e80 100644 --- a/src/gwin/gwin_button.c +++ b/src/gwin/gwin_button.c @@ -67,14 +67,14 @@ #if GINPUT_NEED_TOGGLE // A toggle off has occurred - static void ButtonToggleOff(GWidgetObject *gw, uint16_t role) { + static void ButtonToggleOff(GWidgetObject *gw, gU16 role) { (void) role; gw->g.flags &= ~GBUTTON_FLG_PRESSED; _gwinUpdate((GHandle)gw); } // A toggle on has occurred - static void ButtonToggleOn(GWidgetObject *gw, uint16_t role) { + static void ButtonToggleOn(GWidgetObject *gw, gU16 role) { (void) role; gw->g.flags |= GBUTTON_FLG_PRESSED; _gwinUpdate((GHandle)gw); @@ -82,12 +82,12 @@ _gwinSendEvent(&gw->g, GEVENT_GWIN_BUTTON); } - static void ButtonToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + static void ButtonToggleAssign(GWidgetObject *gw, gU16 role, gU16 instance) { (void) role; ((GButtonObject *)gw)->toggle = instance; } - static uint16_t ButtonToggleGet(GWidgetObject *gw, uint16_t role) { + static gU16 ButtonToggleGet(GWidgetObject *gw, gU16 role) { (void) role; return ((GButtonObject *)gw)->toggle; } diff --git a/src/gwin/gwin_button.h b/src/gwin/gwin_button.h index 4a80cdf7..ff6e0a22 100644 --- a/src/gwin/gwin_button.h +++ b/src/gwin/gwin_button.h @@ -54,7 +54,7 @@ typedef GEventGWin GEventGWinButton; typedef struct GButtonObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE - uint16_t toggle; + gU16 toggle; #endif } GButtonObject; diff --git a/src/gwin/gwin_checkbox.c b/src/gwin/gwin_checkbox.c index 3be66e6b..7d09bddf 100644 --- a/src/gwin/gwin_checkbox.c +++ b/src/gwin/gwin_checkbox.c @@ -69,19 +69,19 @@ static void SendCheckboxEvent(GWidgetObject *gw) { #endif #if GINPUT_NEED_TOGGLE - static void CheckboxToggleOn(GWidgetObject *gw, uint16_t role) { + static void CheckboxToggleOn(GWidgetObject *gw, gU16 role) { (void) role; gw->g.flags ^= GCHECKBOX_FLG_CHECKED; _gwinUpdate((GHandle)gw); SendCheckboxEvent(gw); } - static void CheckboxToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + static void CheckboxToggleAssign(GWidgetObject *gw, gU16 role, gU16 instance) { (void) role; ((GCheckboxObject *)gw)->toggle = instance; } - static uint16_t CheckboxToggleGet(GWidgetObject *gw, uint16_t role) { + static gU16 CheckboxToggleGet(GWidgetObject *gw, gU16 role) { (void) role; return ((GCheckboxObject *)gw)->toggle; } diff --git a/src/gwin/gwin_checkbox.h b/src/gwin/gwin_checkbox.h index e67ff3ab..2b7ef9e9 100644 --- a/src/gwin/gwin_checkbox.h +++ b/src/gwin/gwin_checkbox.h @@ -57,7 +57,7 @@ typedef struct GEventGWinCheckbox { typedef struct GCheckboxObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE - uint16_t toggle; + gU16 toggle; #endif } GCheckboxObject; diff --git a/src/gwin/gwin_class.h b/src/gwin/gwin_class.h index 6d66e3d7..05a4bbf4 100644 --- a/src/gwin/gwin_class.h +++ b/src/gwin/gwin_class.h @@ -54,7 +54,7 @@ */ typedef struct gwinVMT { const char * classname; /**< The GWIN classname (mandatory) */ - size_t size; /**< The size of the class object */ + gMemSize size; /**< The size of the class object */ void (*Destroy) (GWindowObject *gh); /**< The GWIN destroy function (optional) */ void (*Redraw) (GWindowObject *gh); /**< The GWIN redraw routine (optional) */ void (*AfterClear) (GWindowObject *gh); /**< The GWIN after-clear function (optional) */ @@ -66,7 +66,7 @@ typedef struct gwinVMT { /** * @brief An toggle/dial instance is not being used */ - #define GWIDGET_NO_INSTANCE ((uint16_t)-1) + #define GWIDGET_NO_INSTANCE ((gU16)-1) /** * @brief The source handle that widgets use when sending events @@ -99,19 +99,19 @@ typedef struct gwinVMT { #endif #if GINPUT_NEED_TOGGLE struct { - uint16_t toggleroles; /**< The roles supported for toggles (0->toggleroles-1) */ - void (*ToggleAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); /**< Assign a toggle to a role (optional) */ - uint16_t (*ToggleGet) (GWidgetObject *gw, uint16_t role); /**< Return the instance for a particular role (optional) */ - void (*ToggleOff) (GWidgetObject *gw, uint16_t role); /**< Process toggle off events (optional) */ - void (*ToggleOn) (GWidgetObject *gw, uint16_t role); /**< Process toggle on events (optional) */ + gU16 toggleroles; /**< The roles supported for toggles (0->toggleroles-1) */ + void (*ToggleAssign) (GWidgetObject *gw, gU16 role, gU16 instance); /**< Assign a toggle to a role (optional) */ + gU16 (*ToggleGet) (GWidgetObject *gw, gU16 role); /**< Return the instance for a particular role (optional) */ + void (*ToggleOff) (GWidgetObject *gw, gU16 role); /**< Process toggle off events (optional) */ + void (*ToggleOn) (GWidgetObject *gw, gU16 role); /**< Process toggle on events (optional) */ }; #endif #if GINPUT_NEED_DIAL struct { - uint16_t dialroles; /**< The roles supported for dials (0->dialroles-1) */ - void (*DialAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); /**< Test the role and save the dial instance handle (optional) */ - uint16_t (*DialGet) (GWidgetObject *gw, uint16_t role); /**< Return the instance for a particular role (optional) */ - void (*DialMove) (GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max); /**< Process dial move events (optional) */ + gU16 dialroles; /**< The roles supported for dials (0->dialroles-1) */ + void (*DialAssign) (GWidgetObject *gw, gU16 role, gU16 instance); /**< Test the role and save the dial instance handle (optional) */ + gU16 (*DialGet) (GWidgetObject *gw, gU16 role); /**< Return the instance for a particular role (optional) */ + void (*DialMove) (GWidgetObject *gw, gU16 role, gU16 value, gU16 max); /**< Process dial move events (optional) */ }; #endif } gwidgetVMT; @@ -185,7 +185,7 @@ typedef struct gwinVMT { * * @notapi */ -GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint32_t flags); +GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, gU32 flags); /** * @brief Redraw the window after a status change. diff --git a/src/gwin/gwin_console.c b/src/gwin/gwin_console.c index cf331e59..67593557 100644 --- a/src/gwin/gwin_console.c +++ b/src/gwin/gwin_console.c @@ -42,23 +42,23 @@ #define Stream2GWindow(ip) ((GHandle)(((char *)(ip)) - (size_t)(&(((GConsoleObject *)0)->stream)))) #if CH_KERNEL_MAJOR == 2 - static size_t GWinStreamWrite(void *ip, const uint8_t *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; } - static size_t GWinStreamRead(void *ip, uint8_t *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; } - static msg_t GWinStreamPut(void *ip, uint8_t b) { gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; } + static size_t GWinStreamWrite(void *ip, const gU8 *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; } + static size_t GWinStreamRead(void *ip, gU8 *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; } + static msg_t GWinStreamPut(void *ip, gU8 b) { gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; } static msg_t GWinStreamGet(void *ip) {(void)ip; return RDY_OK; } - static msg_t GWinStreamPutTimed(void *ip, uint8_t b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; } + static msg_t GWinStreamPutTimed(void *ip, gU8 b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; } static msg_t GWinStreamGetTimed(void *ip, systime_t timeout) { (void)ip; (void)timeout; return RDY_OK; } - static size_t GWinStreamWriteTimed(void *ip, const uint8_t *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; } - static size_t GWinStreamReadTimed(void *ip, uint8_t *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; } + static size_t GWinStreamWriteTimed(void *ip, const gU8 *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; } + static size_t GWinStreamReadTimed(void *ip, gU8 *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; } #elif CH_KERNEL_MAJOR == 3 - static size_t GWinStreamWrite(void *ip, const uint8_t *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return MSG_OK; } - static size_t GWinStreamRead(void *ip, uint8_t *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; } - static msg_t GWinStreamPut(void *ip, uint8_t b) { gwinPutChar(Stream2GWindow(ip), (char)b); return MSG_OK; } + static size_t GWinStreamWrite(void *ip, const gU8 *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return MSG_OK; } + static size_t GWinStreamRead(void *ip, gU8 *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; } + static msg_t GWinStreamPut(void *ip, gU8 b) { gwinPutChar(Stream2GWindow(ip), (char)b); return MSG_OK; } static msg_t GWinStreamGet(void *ip) {(void)ip; return MSG_OK; } - static msg_t GWinStreamPutTimed(void *ip, uint8_t b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return MSG_OK; } + static msg_t GWinStreamPutTimed(void *ip, gU8 b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return MSG_OK; } static msg_t GWinStreamGetTimed(void *ip, systime_t timeout) { (void)ip; (void)timeout; return MSG_OK; } - static size_t GWinStreamWriteTimed(void *ip, const uint8_t *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return MSG_OK; } - static size_t GWinStreamReadTimed(void *ip, uint8_t *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; } + static size_t GWinStreamWriteTimed(void *ip, const gU8 *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return MSG_OK; } + static size_t GWinStreamReadTimed(void *ip, gU8 *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; } #endif struct GConsoleWindowVMT_t { @@ -79,8 +79,8 @@ #if GWIN_CONSOLE_ESCSEQ // Convert escape sequences to attributes - static gBool ESCtoAttr(char c, uint8_t *pattr) { - uint8_t attr; + static gBool ESCtoAttr(char c, gU8 *pattr) { + gU8 attr; attr = pattr[0]; switch(c) { @@ -157,7 +157,7 @@ */ static void scrollBuffer(GConsoleObject *gcw) { char *p, *ep; - size_t dp; + gPtrDiff dp; // Only scroll if we need to if (!gcw->buffer || (gcw->g.flags & GCONSOLE_FLG_NOSTORE)) @@ -256,7 +256,7 @@ // Do we have enough space in the buffer if (gcw->bufpos >= gcw->bufsize) { char *p, *ep; - size_t dp; + gPtrDiff dp; /** * This should never really happen except if the user has changed the window @@ -433,7 +433,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p void gwinPutChar(GHandle gh, char c) { #define gcw ((GConsoleObject *)gh) - uint8_t width, fy; + gU8 width, fy; if (gh->vmt != &consoleVMT || !gh->font) return; @@ -625,7 +625,7 @@ void gwinPutString(GHandle gh, const char *str) { gwinPutChar(gh, *str++); } -void gwinPutCharArray(GHandle gh, const char *str, size_t n) { +void gwinPutCharArray(GHandle gh, const char *str, gMemSize n) { while(n--) gwinPutChar(gh, *str++); } diff --git a/src/gwin/gwin_console.h b/src/gwin/gwin_console.h index fdf77e67..437968e0 100644 --- a/src/gwin/gwin_console.h +++ b/src/gwin/gwin_console.h @@ -34,15 +34,15 @@ typedef struct GConsoleObject { gCoord cx, cy; // Cursor position #if GWIN_CONSOLE_ESCSEQ - uint8_t startattr; // ANSI-like escape sequences - uint8_t currattr; - uint16_t escstate; + gU8 startattr; // ANSI-like escape sequences + gU8 currattr; + gU16 escstate; #endif #if GWIN_CONSOLE_USE_HISTORY char * buffer; // buffer to store console content - size_t bufsize; // size of buffer - size_t bufpos; // the position of the next char + gMemSize bufsize; // size of buffer + gMemSize bufpos; // the position of the next char #endif #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM @@ -141,7 +141,7 @@ void gwinPutString(GHandle gh, const char *str); * * @api */ -void gwinPutCharArray(GHandle gh, const char *str, size_t n); +void gwinPutCharArray(GHandle gh, const char *str, gMemSize n); /** * @brief Print a formatted string at the cursor position in the window. It will wrap lines as required. diff --git a/src/gwin/gwin_container.c b/src/gwin/gwin_container.c index 7757ed5b..7f5f60bc 100644 --- a/src/gwin/gwin_container.c +++ b/src/gwin/gwin_container.c @@ -134,7 +134,7 @@ static const gcontainerVMT containerVMT = { 0, // A child has been deleted (optional) }; -GHandle gwinGContainerCreate(GDisplay *g, GContainerObject *gc, const GWidgetInit *pInit, uint32_t flags) { +GHandle gwinGContainerCreate(GDisplay *g, GContainerObject *gc, const GWidgetInit *pInit, gU32 flags) { if (!(gc = (GContainerObject *)_gcontainerCreate(g, gc, pInit, &containerVMT))) return 0; diff --git a/src/gwin/gwin_container.h b/src/gwin/gwin_container.h index 2ac7f605..3460e3b7 100644 --- a/src/gwin/gwin_container.h +++ b/src/gwin/gwin_container.h @@ -113,7 +113,7 @@ gCoord gwinGetInnerHeight(GHandle gh); * * @api */ -GHandle gwinGContainerCreate(GDisplay *g, GContainerObject *gw, const GWidgetInit *pInit, uint32_t flags); +GHandle gwinGContainerCreate(GDisplay *g, GContainerObject *gw, const GWidgetInit *pInit, gU32 flags); #define gwinContainerCreate(gc, pInit, flags) gwinGContainerCreate(GDISP, gc, pInit, flags) diff --git a/src/gwin/gwin_frame.c b/src/gwin/gwin_frame.c index 13998bda..402da514 100644 --- a/src/gwin/gwin_frame.c +++ b/src/gwin/gwin_frame.c @@ -208,7 +208,7 @@ static const gcontainerVMT frameVMT = { 0, // A child has been deleted (optional) }; -GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint32_t flags) { +GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, gU32 flags) { if (!(fo = (GFrameObject *)_gcontainerCreate(g, (GContainerObject *)fo, pInit, &frameVMT))) return 0; diff --git a/src/gwin/gwin_frame.h b/src/gwin/gwin_frame.h index 89efa4c6..df26008d 100644 --- a/src/gwin/gwin_frame.h +++ b/src/gwin/gwin_frame.h @@ -68,7 +68,7 @@ typedef GContainerObject GFrameObject; * * @api */ -GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint32_t flags); +GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, gU32 flags); #define gwinFrameCreate(fo, pInit, flags) gwinGFrameCreate(GDISP, fo, pInit, flags); /** diff --git a/src/gwin/gwin_graph.h b/src/gwin/gwin_graph.h index 71bee1b0..20def920 100644 --- a/src/gwin/gwin_graph.h +++ b/src/gwin/gwin_graph.h @@ -61,7 +61,7 @@ typedef struct GGraphStyle_t { GGraphLineStyle yaxis; GGraphGridStyle xgrid; GGraphGridStyle ygrid; - uint16_t flags; + gU16 flags; #define GWIN_GRAPH_STYLE_XAXIS_POSITIVE_ARROWS 0x0001 #define GWIN_GRAPH_STYLE_XAXIS_NEGATIVE_ARROWS 0x0002 #define GWIN_GRAPH_STYLE_YAXIS_POSITIVE_ARROWS 0x0004 diff --git a/src/gwin/gwin_keyboard.c b/src/gwin/gwin_keyboard.c index 88d97583..70257f36 100644 --- a/src/gwin/gwin_keyboard.c +++ b/src/gwin/gwin_keyboard.c @@ -17,12 +17,12 @@ #include "gwin_class.h" #include "gwin_keyboard_layout.h" -typedef uint8_t utf8; -typedef uint16_t utf16; -typedef uint32_t utf32; +typedef gU8 utf8; +typedef gU16 utf16; +typedef gU32 utf32; // A character code - note this is not UTF-32 but a representation of the UTF-8 code stream for a single character. -typedef uint32_t ucode; +typedef gU32 ucode; static GSourceHandle AllKeyboards; @@ -393,7 +393,7 @@ void gwinKeyboardDraw_Normal(GWidgetObject *gw, void *param) { const char *pcap; const utf8 *krow; gCoord x, y, cx, cy; - uint8_t rows, cols, row, col, kcols; + gU8 rows, cols, row, col, kcols; ucode key; fixed fx, fy; const GColorSet *pcol; diff --git a/src/gwin/gwin_keyboard.h b/src/gwin/gwin_keyboard.h index aec159ea..653ed218 100644 --- a/src/gwin/gwin_keyboard.h +++ b/src/gwin/gwin_keyboard.h @@ -59,9 +59,9 @@ typedef struct GKeyboardObject { const char **keyset; gCoord keyx, keyy; gCoord keycx, keycy; - uint8_t lastkeyrow, lastkeycol; - uint8_t keyrow, keycol; - uint32_t key; + gU8 lastkeyrow, lastkeycol; + gU8 keyrow, keycol; + gU32 key; } GKeyboardObject; /** diff --git a/src/gwin/gwin_keyboard_layout.h b/src/gwin/gwin_keyboard_layout.h index 9a2db343..b35bd139 100644 --- a/src/gwin/gwin_keyboard_layout.h +++ b/src/gwin/gwin_keyboard_layout.h @@ -52,11 +52,11 @@ typedef struct GVSpecialKey { const char const *keycap; // The caption on the key const char const *sendkey; // The key to send (NULL means none) - uint8_t flags; // Flags + gU8 flags; // Flags #define GVKEY_INVERT 0x01 // Invert the color #define GVKEY_SINGLESET 0x02 // Change set when this key is pressed but only for a single keystroke #define GVKEY_LOCKSET 0x04 // Change set when this key is pressed but stay there until the set is changed by the user - uint8_t newset; // The new set to change to + gU8 newset; // The new set to change to } GVSpecialKey; typedef const char **GVKeySet; // Array of Rows - Null indicates the end diff --git a/src/gwin/gwin_list.c b/src/gwin/gwin_list.c index 76e4da3a..82b5c106 100644 --- a/src/gwin/gwin_list.c +++ b/src/gwin/gwin_list.c @@ -179,7 +179,7 @@ static void sendListEvent(GWidgetObject *gw, int item) { #if GINPUT_NEED_TOGGLE // a toggle-on has occurred - static void ListToggleOn(GWidgetObject *gw, uint16_t role) { + static void ListToggleOn(GWidgetObject *gw, gU16 role) { const gfxQueueASyncItem * qi; const gfxQueueASyncItem * qix; int i; @@ -236,14 +236,14 @@ static void sendListEvent(GWidgetObject *gw, int item) { } } - static void ListToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + static void ListToggleAssign(GWidgetObject *gw, gU16 role, gU16 instance) { if (role) gw2obj->t_up = instance; else gw2obj->t_dn = instance; } - static uint16_t ListToggleGet(GWidgetObject *gw, uint16_t role) { + static gU16 ListToggleGet(GWidgetObject *gw, gU16 role) { return role ? gw2obj->t_up : gw2obj->t_dn; } #endif @@ -356,7 +356,7 @@ int gwinListAddItem(GHandle gh, const char* text, gBool useAlloc) { return -1; if (useAlloc) { - size_t len = strlen(text)+1; + gMemSize len = strlen(text)+1; if (!(newItem = gfxAlloc(sizeof(ListItem) + len))) return -1; @@ -409,7 +409,7 @@ void gwinListItemSetText(GHandle gh, int item, const char* text, gBool useAlloc) // create the new object if (useAlloc) { - size_t len = strlen(text)+1; + gMemSize len = strlen(text)+1; if (!(newItem = gfxAlloc(sizeof(ListItem) + len))) return; @@ -498,7 +498,7 @@ int gwinListGetSelected(GHandle gh) { return -1; } -void gwinListItemSetParam(GHandle gh, int item, uint16_t param) { +void gwinListItemSetParam(GHandle gh, int item, gU16 param) { const gfxQueueASyncItem * qi; int i; @@ -559,7 +559,7 @@ void gwinListItemDelete(GHandle gh, int item) { } } -uint16_t gwinListItemGetParam(GHandle gh, int item) { +gU16 gwinListItemGetParam(GHandle gh, int item) { const gfxQueueASyncItem * qi; int i; diff --git a/src/gwin/gwin_list.h b/src/gwin/gwin_list.h index 34c5e249..a8f915fe 100644 --- a/src/gwin/gwin_list.h +++ b/src/gwin/gwin_list.h @@ -57,8 +57,8 @@ typedef struct GListObject { gCoord last_mouse_y; #endif #if GINPUT_NEED_TOGGLE - uint16_t t_up; - uint16_t t_dn; + gU16 t_up; + gU16 t_dn; #endif int cnt; // Number of items currently in the list (quicker than counting each time) @@ -95,9 +95,9 @@ typedef enum scroll_t { scrollAlways, scrollAuto, scrollSmooth } scroll_t; typedef struct ListItem { gfxQueueASyncItem q_item; // This must be the first member in the struct - uint16_t flags; + gU16 flags; #define GLIST_FLG_SELECTED 0x0001 - uint16_t param; // A parameter the user can specify himself + gU16 param; // A parameter the user can specify himself const char* text; #if GWIN_NEED_LIST_IMAGES gdispImage* pimg; @@ -218,7 +218,7 @@ int gwinListFindText(GHandle gh, const char* text); * * @api */ -void gwinListItemSetParam(GHandle gh, int item, uint16_t param); +void gwinListItemSetParam(GHandle gh, int item, gU16 param); /** * @brief Get the custom parameter of an item with a given ID @@ -230,7 +230,7 @@ void gwinListItemSetParam(GHandle gh, int item, uint16_t param); * * @api */ -uint16_t gwinListItemGetParam(GHandle gh, int item); +gU16 gwinListItemGetParam(GHandle gh, int item); /** * @brief Delete all the items of the list diff --git a/src/gwin/gwin_radio.c b/src/gwin/gwin_radio.c index c1450611..c3d1564a 100644 --- a/src/gwin/gwin_radio.c +++ b/src/gwin/gwin_radio.c @@ -69,18 +69,18 @@ static void SendRadioEvent(GWidgetObject *gw) { #if GINPUT_NEED_TOGGLE // A toggle on has occurred - static void RadioToggleOn(GWidgetObject *gw, uint16_t role) { + static void RadioToggleOn(GWidgetObject *gw, gU16 role) { (void) role; gwinRadioPress((GHandle)gw); } - static void RadioToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + static void RadioToggleAssign(GWidgetObject *gw, gU16 role, gU16 instance) { (void) role; ((GRadioObject *)gw)->toggle = instance; } - static uint16_t RadioToggleGet(GWidgetObject *gw, uint16_t role) { + static gU16 RadioToggleGet(GWidgetObject *gw, gU16 role) { (void) role; return ((GRadioObject *)gw)->toggle; } @@ -127,7 +127,7 @@ static const gwidgetVMT radioVMT = { #endif }; -GHandle gwinGRadioCreate(GDisplay *g, GRadioObject *gw, const GWidgetInit *pInit, uint16_t group) { +GHandle gwinGRadioCreate(GDisplay *g, GRadioObject *gw, const GWidgetInit *pInit, gU16 group) { if (!(gw = (GRadioObject *)_gwidgetCreate(g, &gw->w, pInit, &radioVMT))) return 0; @@ -161,7 +161,7 @@ gBool gwinRadioIsPressed(GHandle gh) { return (gh->flags & GRADIO_FLG_PRESSED) ? gTrue : gFalse; } -GHandle gwinRadioGetActive(uint16_t group) { +GHandle gwinRadioGetActive(gU16 group) { GHandle gh; for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { diff --git a/src/gwin/gwin_radio.h b/src/gwin/gwin_radio.h index a3cb194d..05d2742f 100644 --- a/src/gwin/gwin_radio.h +++ b/src/gwin/gwin_radio.h @@ -42,7 +42,7 @@ typedef struct GEventGWinRadio { #if GWIN_WIDGET_TAGS WidgetTag tag; // The radio tag #endif - uint16_t group; // The group for this radio button + gU16 group; // The group for this radio button } GEventGWinRadio; /** @@ -60,9 +60,9 @@ typedef struct GEventGWinRadio { typedef struct GRadioObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE - uint16_t toggle; + gU16 toggle; #endif - uint16_t group; + gU16 group; } GRadioObject; /** @@ -88,7 +88,7 @@ typedef struct GRadioObject { * * @api */ -GHandle gwinGRadioCreate(GDisplay *g, GRadioObject *gb, const GWidgetInit *pInit, uint16_t group); +GHandle gwinGRadioCreate(GDisplay *g, GRadioObject *gb, const GWidgetInit *pInit, gU16 group); #define gwinRadioCreate(w, pInit, gr) gwinGRadioCreate(GDISP, w, pInit, gr) /** @@ -120,7 +120,7 @@ gBool gwinRadioIsPressed(GHandle gh); * * @api */ -GHandle gwinRadioGetActive(uint16_t group); +GHandle gwinRadioGetActive(gU16 group); /** * @defgroup Renderings_Radiobutton Renderings diff --git a/src/gwin/gwin_slider.c b/src/gwin/gwin_slider.c index a87ef9ed..22373027 100644 --- a/src/gwin/gwin_slider.c +++ b/src/gwin/gwin_slider.c @@ -42,7 +42,7 @@ static int SliderCalcPosFromDPos(GSliderObject *gsw) { } // Send the slider event -static void SendSliderEvent(GSliderObject *gsw, uint8_t action) { +static void SendSliderEvent(GSliderObject *gsw, gU8 action) { GSourceListener * psl; GEvent * pe; #define pse ((GEventGWinSlider *)pe) @@ -178,7 +178,7 @@ static void SliderResetDisplayPos(GSliderObject *gsw) { #if GINPUT_NEED_TOGGLE // A toggle on has occurred - static void SliderToggleOn(GWidgetObject *gw, uint16_t role) { + static void SliderToggleOn(GWidgetObject *gw, gU16 role) { #define gsw ((GSliderObject *)gw) if (role) { @@ -191,26 +191,26 @@ static void SliderResetDisplayPos(GSliderObject *gsw) { #undef gsw } - static void SliderToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + static void SliderToggleAssign(GWidgetObject *gw, gU16 role, gU16 instance) { if (role) ((GSliderObject *)gw)->t_up = instance; else ((GSliderObject *)gw)->t_dn = instance; } - static uint16_t SliderToggleGet(GWidgetObject *gw, uint16_t role) { + static gU16 SliderToggleGet(GWidgetObject *gw, gU16 role) { return role ? ((GSliderObject *)gw)->t_up : ((GSliderObject *)gw)->t_dn; } #endif #if GINPUT_NEED_DIAL // A dial move event - static void SliderDialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max) { + static void SliderDialMove(GWidgetObject *gw, gU16 role, gU16 value, gU16 max) { #define gsw ((GSliderObject *)gw) (void) role; // Set the new position - gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/max + gsw->min); + gsw->pos = (gU16)((gU32)value*(gsw->max-gsw->min)/max + gsw->min); SliderResetDisplayPos(gsw); _gwinUpdate(&gsw->w.g); @@ -220,12 +220,12 @@ static void SliderResetDisplayPos(GSliderObject *gsw) { #undef gsw } - static void SliderDialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + static void SliderDialAssign(GWidgetObject *gw, gU16 role, gU16 instance) { (void) role; ((GSliderObject *)gw)->dial = instance; } - static uint16_t SliderDialGet(GWidgetObject *gw, uint16_t role) { + static gU16 SliderDialGet(GWidgetObject *gw, gU16 role) { (void) role; return ((GSliderObject *)gw)->dial; } diff --git a/src/gwin/gwin_slider.h b/src/gwin/gwin_slider.h index 0b11385b..4eb9ed41 100644 --- a/src/gwin/gwin_slider.h +++ b/src/gwin/gwin_slider.h @@ -36,7 +36,7 @@ typedef struct GEventGWinSlider { #endif int position; - uint8_t action; + gU8 action; #define GSLIDER_EVENT_SET 4 /* Slider position is set. This is the only event returned by default */ #define GSLIDER_EVENT_CANCEL 3 /* Slider position changing has been cancelled */ #define GSLIDER_EVENT_START 2 /* Slider position has started changing */ @@ -57,11 +57,11 @@ typedef struct GEventGWinSlider { typedef struct GSliderObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE - uint16_t t_dn; - uint16_t t_up; + gU16 t_dn; + gU16 t_up; #endif #if GINPUT_NEED_DIAL - uint16_t dial; + gU16 dial; #endif gCoord dpos; int min; diff --git a/src/gwin/gwin_tabset.c b/src/gwin/gwin_tabset.c index abfd9823..80a5f10d 100644 --- a/src/gwin/gwin_tabset.c +++ b/src/gwin/gwin_tabset.c @@ -288,7 +288,7 @@ static const gcontainerVMT tabsetVMT = { 0, // A child has been deleted (optional) }; -GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, uint32_t flags) { +GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, gU32 flags) { if (!(fo = (GTabsetObject *)_gcontainerCreate(g, (GContainerObject *)fo, pInit, &tabsetVMT))) return 0; diff --git a/src/gwin/gwin_tabset.h b/src/gwin/gwin_tabset.h index d01f9d9a..f2bde48b 100644 --- a/src/gwin/gwin_tabset.h +++ b/src/gwin/gwin_tabset.h @@ -76,7 +76,7 @@ typedef struct GTabsetObject { * * @api */ -GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, uint32_t flags); +GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, gU32 flags); #define gwinTabsetCreate(fo, pInit, flags) gwinGTabsetCreate(GDISP, fo, pInit, flags); /** diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c index 853da0b7..3a2626d0 100644 --- a/src/gwin/gwin_textedit.c +++ b/src/gwin/gwin_textedit.c @@ -88,7 +88,7 @@ static gBool TextEditAddChars(GHandle gh, unsigned cnt) { // and do the comparation directly inside of that loop so we only iterate // the string once. static void TextEditMouseDown(GWidgetObject* gw, gCoord x, gCoord y) { - uint16_t i = 0; + gU16 i = 0; (void)y; @@ -118,7 +118,7 @@ static void TextEditMouseDown(GWidgetObject* gw, gCoord x, gCoord y) { // Is it a special key? if (pke->keystate & GKEYSTATE_SPECIAL) { // Arrow keys to move the cursor - gwinTextEditSendSpecialKey(&gw->g, (uint8_t)pke->c[0]); + gwinTextEditSendSpecialKey(&gw->g, (gU8)pke->c[0]); return; } @@ -167,7 +167,7 @@ static const gwidgetVMT texteditVMT = { #endif }; -GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit, size_t maxSize) +GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit, gMemSize maxSize) { // Create the underlying widget if (!(wt = (GTexteditObject*)_gwidgetCreate(g, &wt->w, pInit, &texteditVMT))) @@ -184,7 +184,7 @@ GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit } #if (GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) || GWIN_NEED_KEYBOARD - void gwinTextEditSendSpecialKey(GHandle gh, uint8_t key) { + void gwinTextEditSendSpecialKey(GHandle gh, gU8 key) { // Is it a valid handle? if (gh->vmt != (gwinVMT*)&texteditVMT) return; @@ -224,7 +224,7 @@ GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit return; // Normal key press - switch((uint8_t)key[0]) { + switch((gU8)key[0]) { case GKEY_BACKSPACE: // Backspace if (!gh2obj->cursorPos) @@ -246,7 +246,7 @@ GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit break; default: // Ignore any other control characters - if ((uint8_t)key[0] < GKEY_SPACE) + if ((gU8)key[0] < GKEY_SPACE) return; // Keep the edit length to less than the maximum diff --git a/src/gwin/gwin_textedit.h b/src/gwin/gwin_textedit.h index 496b6408..c32f98e0 100644 --- a/src/gwin/gwin_textedit.h +++ b/src/gwin/gwin_textedit.h @@ -36,8 +36,8 @@ typedef struct GTexteditObject { GWidgetObject w; char* textBuffer; - size_t maxSize; - uint16_t cursorPos; + gMemSize maxSize; + gU16 cursorPos; } GTexteditObject; /** @@ -56,7 +56,7 @@ typedef struct GTexteditObject { * @note If the initial text set is larger than maxSize then the text is truncated at maxSize characters. * @api */ -GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit, size_t maxSize); +GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit, gMemSize maxSize); #define gwinTexteditCreate(wt, pInit, maxSize) gwinGTexteditCreate(GDISP, wt, pInit, maxSize) /** @@ -67,7 +67,7 @@ GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit * @pre Requires GINPUT_NEED_KEYBOARD or GWIN_NEED_KEYBOARD to be on * @api */ -void gwinTextEditSendSpecialKey(GHandle gh, uint8_t key); +void gwinTextEditSendSpecialKey(GHandle gh, gU8 key); /** * @brief Send a normal utf8 character to the textedit diff --git a/src/gwin/gwin_widget.c b/src/gwin/gwin_widget.c index 8da2ebdd..94b9dd33 100644 --- a/src/gwin/gwin_widget.c +++ b/src/gwin/gwin_widget.c @@ -107,7 +107,7 @@ static void gwidgetEvent(void *param, GEvent *pe) { GHandle gh; #endif #if GINPUT_NEED_TOGGLE || GINPUT_NEED_DIAL - uint16_t role; + gU16 role; #endif #endif @@ -346,9 +346,9 @@ static void gwidgetEvent(void *param, GEvent *pe) { #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - static GHandle FindToggleUser(uint16_t instance) { + static GHandle FindToggleUser(gU16 instance) { GHandle gh; - uint16_t role; + gU16 role; for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { if (!(gh->flags & GWIN_FLG_WIDGET)) // check if it a widget @@ -364,9 +364,9 @@ static void gwidgetEvent(void *param, GEvent *pe) { #endif #if GFX_USE_GINPUT && GINPUT_NEED_DIAL - static GHandle FindDialUser(uint16_t instance) { + static GHandle FindDialUser(gU16 instance) { GHandle gh; - uint16_t role; + gU16 role; for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { if (!(gh->flags & GWIN_FLG_WIDGET)) // check if it a widget @@ -420,7 +420,7 @@ GHandle _gwidgetCreate(GDisplay *g, GWidgetObject *pgw, const GWidgetInit *pInit void _gwidgetDestroy(GHandle gh) { #if GFX_USE_GINPUT && (GINPUT_NEED_TOGGLE || GINPUT_NEED_DIAL) - uint16_t role, instance; + gU16 role, instance; #endif // Make the window is invisible so it is not eligible for focus @@ -635,7 +635,7 @@ gBool gwinAttachListener(GListener *pl) { } #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) { + gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(gU16 instance) { // This is now a NULL event because we automatically attach to all mice in the system. (void) instance; return gTrue; @@ -643,9 +643,9 @@ gBool gwinAttachListener(GListener *pl) { #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - gBool gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { + gBool gwinAttachToggle(GHandle gh, gU16 role, gU16 instance) { GSourceHandle gsh; - uint16_t oi; + gU16 oi; // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) @@ -676,8 +676,8 @@ gBool gwinAttachListener(GListener *pl) { return geventAttachSource(&gl, gsh, GLISTEN_TOGGLE_ON|GLISTEN_TOGGLE_OFF); } - gBool gwinDetachToggle(GHandle gh, uint16_t role) { - uint16_t oi; + gBool gwinDetachToggle(GHandle gh, gU16 role) { + gU16 oi; // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) @@ -701,9 +701,9 @@ gBool gwinAttachListener(GListener *pl) { #endif #if GFX_USE_GINPUT && GINPUT_NEED_DIAL - gBool gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { + gBool gwinAttachDial(GHandle gh, gU16 role, gU16 instance) { GSourceHandle gsh; - uint16_t oi; + gU16 oi; if (!(gh->flags & GWIN_FLG_WIDGET)) return gFalse; diff --git a/src/gwin/gwin_widget.h b/src/gwin/gwin_widget.h index 88943cc3..bd23de08 100644 --- a/src/gwin/gwin_widget.h +++ b/src/gwin/gwin_widget.h @@ -78,7 +78,7 @@ typedef void (*CustomWidgetDrawFunction)(struct GWidgetObject *gw, void *param); /** * @brief Defines a the type of a tag on a widget */ -typedef uint16_t WidgetTag; +typedef gU16 WidgetTag; /** * @brief The structure to initialise a widget. @@ -333,7 +333,7 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param); gBool gwinAttachListener(GListener *pl); #if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) || defined(__DOXYGEN__) - gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance); + gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(gU16 instance); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__) @@ -351,7 +351,7 @@ gBool gwinAttachListener(GListener *pl); * * @api */ - gBool gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance); + gBool gwinAttachToggle(GHandle gh, gU16 role, gU16 instance); /** * @brief Detach a toggle from a widget * @return gTrue on success @@ -365,7 +365,7 @@ gBool gwinAttachListener(GListener *pl); * * @api */ - gBool gwinDetachToggle(GHandle gh, uint16_t role); + gBool gwinDetachToggle(GHandle gh, gU16 role); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_DIAL) || defined(__DOXYGEN__) @@ -383,7 +383,7 @@ gBool gwinAttachListener(GListener *pl); * * @api */ - gBool gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance); + gBool gwinAttachDial(GHandle gh, gU16 role, gU16 instance); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) || GWIN_NEED_KEYBOARD || defined(__DOXYGEN__) diff --git a/src/gwin/gwin_wm.c b/src/gwin/gwin_wm.c index eea44cb9..458d1408 100644 --- a/src/gwin/gwin_wm.c +++ b/src/gwin/gwin_wm.c @@ -171,7 +171,7 @@ static gfxQueueASync _GWINList; static GTimer RedrawTimer; static void RedrawTimerFn(void *param); #endif -static volatile uint8_t RedrawPending; +static volatile gU8 RedrawPending; #define DOREDRAW_INVISIBLES 0x01 #define DOREDRAW_VISIBLES 0x02 #define DOREDRAW_FLASHRUNNING 0x04 @@ -748,7 +748,7 @@ static void WM_Delete(GHandle gh) { } static void WM_Redraw(GHandle gh) { - uint32_t flags; + gU32 flags; flags = gh->flags; gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW|GWIN_FLG_PARENTREVEAL); -- cgit v1.2.3