disable all debug logging, cut potential gm release

This commit is contained in:
camh 2022-02-25 14:17:46 -08:00
parent ee85a728a7
commit 34e352056d
3 changed files with 12 additions and 57 deletions

View File

@ -12,7 +12,7 @@
IOParam outgoingSerialPortReference; IOParam outgoingSerialPortReference;
IOParam incomingSerialPortReference; IOParam incomingSerialPortReference;
// #define PRINT_ERRORS 1 // #define PRINT_ERRORS 1
#define DEBUGGING 1 // #define DEBUGGING 1
#define MAX_ATTEMPTS 10 #define MAX_ATTEMPTS 10
#define RECEIVE_WINDOW_SIZE 32767 // receive in up to 32kb chunks #define RECEIVE_WINDOW_SIZE 32767 // receive in up to 32kb chunks
#define MAX_RECEIVE_SIZE 32767 // matching RECEIVE_WINDOW_SIZE for now #define MAX_RECEIVE_SIZE 32767 // matching RECEIVE_WINDOW_SIZE for now

View File

@ -25,7 +25,7 @@
// #define MAC_APP_DEBUGGING // #define MAC_APP_DEBUGGING
// #define PROFILING 1 // #define PROFILING 1
#define DEBUG_FUNCTION_CALLS // #define DEBUG_FUNCTION_CALLS
#ifdef PROFILING #ifdef PROFILING
OSErr writeSerialPortProfile(const char* str) OSErr writeSerialPortProfile(const char* str)

View File

@ -28,7 +28,7 @@
#define ENABLED_DOUBLE_BUFFERING #define ENABLED_DOUBLE_BUFFERING
#define COMMAND_CACHING #define COMMAND_CACHING
#include "nuklear.h" #include "nuklear.h"
#define NK_QUICKDRAW_GRAPHICS_DEBUGGING // #define NK_QUICKDRAW_GRAPHICS_DEBUGGING
// #define DRAW_BLIT_LOCATION // #define DRAW_BLIT_LOCATION
Boolean lastInputWasBackspace; Boolean lastInputWasBackspace;
@ -495,12 +495,14 @@ void updateBounds(int top, int bottom, int left, int right) {
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: runDrawCommand"); writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: runDrawCommand");
#endif #endif
char x[255]; #ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
sprintf(x, "cmd: %d", cmd->type); char x[255];
writeSerialPortDebug(boutRefNum, x); sprintf(x, "cmd: %d", cmd->type);
char y[255]; writeSerialPortDebug(boutRefNum, x);
sprintf(y, "lastCmd: %d", lastCmd->type); char y[255];
writeSerialPortDebug(boutRefNum, y); sprintf(y, "lastCmd: %d", lastCmd->type);
writeSerialPortDebug(boutRefNum, y);
#endif
switch (cmd->type) { switch (cmd->type) {
@ -562,7 +564,6 @@ void updateBounds(int top, int bottom, int left, int right) {
// http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-102.html#MARKER-9-372 // http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-102.html#MARKER-9-372
// http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-103.html#HEADING103-0 // http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-103.html#HEADING103-0
const struct nk_command_rect *r = (const struct nk_command_rect *)cmd; const struct nk_command_rect *r = (const struct nk_command_rect *)cmd;
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT2");
#ifdef COMMAND_CACHING #ifdef COMMAND_CACHING
@ -575,26 +576,21 @@ void updateBounds(int top, int bottom, int left, int right) {
break; break;
} }
#endif #endif
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT3");
ForeColor(r->color); ForeColor(r->color);
PenSize(r->line_thickness, r->line_thickness); PenSize(r->line_thickness, r->line_thickness);
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT4");
Rect quickDrawRectangle; Rect quickDrawRectangle;
quickDrawRectangle.top = r->y; quickDrawRectangle.top = r->y;
quickDrawRectangle.left = r->x; quickDrawRectangle.left = r->x;
quickDrawRectangle.bottom = r->y + r->h; quickDrawRectangle.bottom = r->y + r->h;
quickDrawRectangle.right = r->x + r->w; quickDrawRectangle.right = r->x + r->w;
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT5");
#ifdef ENABLED_DOUBLE_BUFFERING #ifdef ENABLED_DOUBLE_BUFFERING
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right); updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
#endif #endif
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT6");
FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding); FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding);
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT7 (done)");
} }
break; break;
@ -606,10 +602,8 @@ void updateBounds(int top, int bottom, int left, int right) {
#endif #endif
const struct nk_command_rect_filled *r = (const struct nk_command_rect_filled *)cmd; const struct nk_command_rect_filled *r = (const struct nk_command_rect_filled *)cmd;
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED1");
if (r->allowCache == false) { if (r->allowCache == false) {
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED2");
Rect quickDrawRectangle; Rect quickDrawRectangle;
quickDrawRectangle.top = r->y; quickDrawRectangle.top = r->y;
@ -617,17 +611,14 @@ void updateBounds(int top, int bottom, int left, int right) {
quickDrawRectangle.bottom = r->y + r->h; quickDrawRectangle.bottom = r->y + r->h;
quickDrawRectangle.right = r->x + r->w; quickDrawRectangle.right = r->x + r->w;
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED3");
#ifdef ENABLED_DOUBLE_BUFFERING #ifdef ENABLED_DOUBLE_BUFFERING
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right); updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
#endif #endif
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED4");
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &qd.white); FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &qd.white);
break; break;
} }
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED5");
#ifdef COMMAND_CACHING #ifdef COMMAND_CACHING
if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect_filled)) == 0) { if (!lastInputWasBackspace && cmd->type == lastCmd->type && memcmp(r, lastCmd, sizeof(struct nk_command_rect_filled)) == 0) {
@ -640,7 +631,6 @@ void updateBounds(int top, int bottom, int left, int right) {
} }
#endif #endif
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED6");
// TODO: to support coloring the lines, we need to map from qd Pattern types to integer colors // TODO: to support coloring the lines, we need to map from qd Pattern types to integer colors
// color = nk_color_to_quickdraw_bw_color(r->color); // color = nk_color_to_quickdraw_bw_color(r->color);
// ForeColor(color); // ForeColor(color);
@ -654,18 +644,12 @@ void updateBounds(int top, int bottom, int left, int right) {
quickDrawRectangle.bottom = r->y + r->h; quickDrawRectangle.bottom = r->y + r->h;
quickDrawRectangle.right = r->x + r->w; quickDrawRectangle.right = r->x + r->w;
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED7");
#ifdef ENABLED_DOUBLE_BUFFERING #ifdef ENABLED_DOUBLE_BUFFERING
updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right); updateBounds(quickDrawRectangle.top, quickDrawRectangle.bottom, quickDrawRectangle.left, quickDrawRectangle.right);
#endif #endif
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED8");
FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &r->color); FillRoundRect(&quickDrawRectangle, r->rounding, r->rounding, &r->color);
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED9");
FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding); // http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-105.html#HEADING105-0 FrameRoundRect(&quickDrawRectangle, r->rounding, r->rounding); // http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/QuickDraw/QuickDraw-105.html#HEADING105-0
writeSerialPortDebug(boutRefNum, "NK_COMMAND_RECT_FILLED10 (done)");
} }
break; break;
@ -1104,30 +1088,7 @@ void updateBounds(int top, int bottom, int left, int right) {
} }
#ifdef COMMAND_CACHING #ifdef COMMAND_CACHING
int lastCalls = 0;
int currentCalls;
const struct nk_command *lastCmd; const struct nk_command *lastCmd;
Boolean VALID_COMMANDS[18] = {
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true
};
#endif #endif
NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) { NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
@ -1136,10 +1097,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_render"); writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_render");
#endif #endif
#ifdef COMMAND_CACHING
currentCalls = 1;
#endif
#ifdef PROFILING #ifdef PROFILING
PROFILE_START("IN nk_quickdraw_render"); PROFILE_START("IN nk_quickdraw_render");
#endif #endif
@ -1195,7 +1152,7 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: get next cached command"); writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: get next cached command");
#endif #endif
if (currentCalls < lastCalls && lastCmd && VALID_COMMANDS[lastCmd->type]) { if (lastCmd && lastCmd->next) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING #ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: inside conditional"); writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: inside conditional");
@ -1207,7 +1164,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
#ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING #ifdef NK_QUICKDRAW_GRAPHICS_DEBUGGING
writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: done getting lastCmd"); writeSerialPortDebug(boutRefNum, "COMMAND_CACHING: done getting lastCmd");
#endif #endif
currentCalls++;
#endif #endif
} }
@ -1228,7 +1184,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
#endif #endif
#ifdef COMMAND_CACHING #ifdef COMMAND_CACHING
lastCalls = currentCalls;
lastInputWasBackspace = false; lastInputWasBackspace = false;
#endif #endif