create new debugging option DEBUG_FUNCTION_CALLS to assist in finding memory address errors on physical mac, cut new debug release

This commit is contained in:
camh 2022-02-08 23:58:25 -08:00
parent 112cf38856
commit 5a45998195
8 changed files with 181 additions and 6 deletions

View File

@ -6,7 +6,7 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set (CMAKE_C_FLAGS "-O3 -Wuninitialized -Wmaybe-uninitialized -mcpu=68000 -mtune=68000 -m68000 -Wall") set (CMAKE_C_FLAGS "-Ofast -Wuninitialized -Wmaybe-uninitialized -mcpu=68000 -mtune=68000 -m68000 -Wall")
add_application(MessagesForMacintosh add_application(MessagesForMacintosh
SerialHelper.c SerialHelper.c

View File

@ -21,8 +21,11 @@ int call_counter = 0;
// from: https://stackoverflow.com/questions/29847915/implementing-strtok-whose-delimiter-has-more-than-one-character // from: https://stackoverflow.com/questions/29847915/implementing-strtok-whose-delimiter-has-more-than-one-character
// basically multichar delimter strtok // basically multichar delimter strtok
char *strtokm(char *str, const char *delim) char *strtokm(char *str, const char *delim) {
{
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: strtokm");
#endif
static char *tok; static char *tok;
static char *next; static char *next;
char *m; char *m;
@ -71,6 +74,10 @@ http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/Devic
// TODO: handle all OSErr - they are all unhandled at the moment // TODO: handle all OSErr - they are all unhandled at the moment
void setupPBControlForSerialPort(short serialPortShort) { void setupPBControlForSerialPort(short serialPortShort) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: setupPBControlForSerialPort");
#endif
CntrlParam cb; CntrlParam cb;
cb.ioCRefNum = serialPortShort; // TODO: this is always 0 - does it matter? should we hard code 0 here? research cb.ioCRefNum = serialPortShort; // TODO: this is always 0 - does it matter? should we hard code 0 here? research
cb.csCode = 8; // TODO: need to look up and document what csCode = 8 means cb.csCode = 8; // TODO: need to look up and document what csCode = 8 means
@ -93,6 +100,10 @@ void setupPBControlForSerialPort(short serialPortShort) {
void setupSerialPort(const char *name) { void setupSerialPort(const char *name) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: setupSerialPort");
#endif
#define MODEM_PORT_OUT "\p.AOut" #define MODEM_PORT_OUT "\p.AOut"
#define MODEM_PORT_IN "\p.AIn" #define MODEM_PORT_IN "\p.AIn"
#define PRINTER_PORT_OUT "\p.BOut" #define PRINTER_PORT_OUT "\p.BOut"
@ -162,6 +173,10 @@ void setupSerialPort(const char *name) {
void wait(float timeInSeconds) { void wait(float timeInSeconds) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: wait");
#endif
// from "Inside Macintosh: Macintosh Toolbox Essentials" pg 2-112 // from "Inside Macintosh: Macintosh Toolbox Essentials" pg 2-112
// You can use the TickCount function to get the current number of ticks (a tick is // You can use the TickCount function to get the current number of ticks (a tick is
// approximately 1/60 of a second) since the system last started up. // approximately 1/60 of a second) since the system last started up.
@ -200,6 +215,10 @@ const int MAX_RECIEVE_LOOP_ITERATIONS = 1000;
// void because this function re-assigns respo // void because this function re-assigns respo
void readSerialPort(char* output) { void readSerialPort(char* output) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: readSerialPort");
#endif
if (DEBUGGING) { if (DEBUGGING) {
printf("readSerialPort\n"); printf("readSerialPort\n");
@ -325,6 +344,10 @@ void readSerialPort(char* output) {
OSErr writeSerialPort(const char* stringToWrite) { OSErr writeSerialPort(const char* stringToWrite) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: writeSerialPort");
#endif
if (DEBUGGING) { if (DEBUGGING) {
@ -357,6 +380,10 @@ OSErr writeSerialPort(const char* stringToWrite) {
} }
void setupCoprocessor(char *applicationId, const char *serialDeviceName) { void setupCoprocessor(char *applicationId, const char *serialDeviceName) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: setupCoprocessor");
#endif
strcpy(application_id, applicationId); strcpy(application_id, applicationId);
@ -367,6 +394,10 @@ void setupCoprocessor(char *applicationId, const char *serialDeviceName) {
OSErr closeSerialPort() { OSErr closeSerialPort() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: closeSerialPort");
#endif
OSErr err = MacCloseDriver(outgoingSerialPortReference.ioRefNum); OSErr err = MacCloseDriver(outgoingSerialPortReference.ioRefNum);
if (PRINT_ERRORS) { if (PRINT_ERRORS) {
@ -381,6 +412,10 @@ OSErr closeSerialPort() {
// return time is char but this is only for error messages - final param is output variable that will be re-assigned within this function // return time is char but this is only for error messages - final param is output variable that will be re-assigned within this function
char* _getReturnValueFromResponse(char* response, char* application_id, char* call_counter, char* operation, char* output) { char* _getReturnValueFromResponse(char* response, char* application_id, char* call_counter, char* operation, char* output) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: _getReturnValueFromResponse");
#endif
if (DEBUGGING) { if (DEBUGGING) {
@ -483,6 +518,10 @@ char* _getReturnValueFromResponse(char* response, char* application_id, char* ca
} }
void writeToCoprocessor(char* operation, char* operand) { void writeToCoprocessor(char* operation, char* operand) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: writeToCoprocessor");
#endif
if (DEBUGGING) { if (DEBUGGING) {
@ -516,6 +555,10 @@ void writeToCoprocessor(char* operation, char* operand) {
// must be called after writeToCoprocessor and before other writeToCoprocessor // must be called after writeToCoprocessor and before other writeToCoprocessor
// operations because we depend on the location of call_counter // operations because we depend on the location of call_counter
void getReturnValueFromResponse(char *response, char *operation, char *output) { void getReturnValueFromResponse(char *response, char *operation, char *output) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getReturnValueFromResponse");
#endif
if (DEBUGGING) { if (DEBUGGING) {
@ -539,6 +582,10 @@ void getReturnValueFromResponse(char *response, char *operation, char *output) {
// TODO: these should all bubble up and return legible errors // TODO: these should all bubble up and return legible errors
void sendProgramToCoprocessor(char* program, char *output) { void sendProgramToCoprocessor(char* program, char *output) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: sendProgramToCoprocessor");
#endif
if (DEBUGGING) { if (DEBUGGING) {
printf("sendProgramToCoprocessor\n"); printf("sendProgramToCoprocessor\n");
@ -560,6 +607,10 @@ void sendProgramToCoprocessor(char* program, char *output) {
// TODO: this is a function we would want to expose in a library // TODO: this is a function we would want to expose in a library
void callFunctionOnCoprocessor(char* functionName, char* parameters, char* output) { void callFunctionOnCoprocessor(char* functionName, char* parameters, char* output) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: callFunctionOnCoprocessor");
#endif
if (DEBUGGING) { if (DEBUGGING) {
@ -594,6 +645,10 @@ void callFunctionOnCoprocessor(char* functionName, char* parameters, char* outpu
// TODO: this is a function we would want to expose in a library // TODO: this is a function we would want to expose in a library
void callEvalOnCoprocessor(char* toEval, char* output) { void callEvalOnCoprocessor(char* toEval, char* output) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: callEvalOnCoprocessor");
#endif
if (DEBUGGING) { if (DEBUGGING) {

Binary file not shown.

Binary file not shown.

View File

@ -24,7 +24,8 @@
#include "mac_main.h" #include "mac_main.h"
// #define MAC_APP_DEBUGGING // #define MAC_APP_DEBUGGING
//#define PROFILING 1 // #define PROFILING 1
#define DEBUG_FUNCTION_CALLS
#ifdef PROFILING #ifdef PROFILING
OSErr writeSerialPortProfile(const char* str) OSErr writeSerialPortProfile(const char* str)
@ -318,6 +319,18 @@ void EventLoop(struct nk_context *ctx)
// only re-render if there is an event, prevents screen flickering, speeds up app // only re-render if there is an event, prevents screen flickering, speeds up app
if (beganInput || firstOrMouseMove || forceRedraw) { if (beganInput || firstOrMouseMove || forceRedraw) {
if (beganInput) {
writeSerialPortDebug(boutRefNum, "beganInput");
}
if (beganInput) {
writeSerialPortDebug(boutRefNum, "beganInput");
}
if (forceRedraw) {
writeSerialPortDebug(boutRefNum, "forceRedraw");
}
#ifdef PROFILING #ifdef PROFILING
PROFILE_START("nk_input_end"); PROFILE_START("nk_input_end");
#endif #endif
@ -383,6 +396,9 @@ void EventLoop(struct nk_context *ctx)
the appropriate routines. */ the appropriate routines. */
void DoEvent(EventRecord *event, struct nk_context *ctx) { void DoEvent(EventRecord *event, struct nk_context *ctx) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: DoEvent");
#endif
short part; short part;
WindowPtr window; WindowPtr window;

View File

@ -7713,6 +7713,9 @@ nk_draw_text(struct nk_command_buffer *b, struct nk_rect r,
NK_API void NK_API void
nk_input_begin(struct nk_context *ctx) nk_input_begin(struct nk_context *ctx)
{ {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_input_begin");
#endif
short i; short i;
struct nk_input *in; struct nk_input *in;
// NK_ASSERT(ctx); // NK_ASSERT(ctx);
@ -7733,6 +7736,9 @@ nk_input_begin(struct nk_context *ctx)
NK_API void NK_API void
nk_input_end(struct nk_context *ctx) nk_input_end(struct nk_context *ctx)
{ {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_input_end");
#endif
struct nk_input *in; struct nk_input *in;
// NK_ASSERT(ctx); // NK_ASSERT(ctx);
if (!ctx) return; if (!ctx) return;
@ -9967,12 +9973,18 @@ NK_API nk_bool
nk_begin(struct nk_context *ctx, const char *title, nk_begin(struct nk_context *ctx, const char *title,
struct nk_rect bounds, nk_flags flags) struct nk_rect bounds, nk_flags flags)
{ {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_begin");
#endif
return nk_begin_titled(ctx, title, title, bounds, flags); return nk_begin_titled(ctx, title, title, bounds, flags);
} }
NK_API nk_bool NK_API nk_bool
nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, nk_begin_titled(struct nk_context *ctx, const char *name, const char *title,
struct nk_rect bounds, nk_flags flags) struct nk_rect bounds, nk_flags flags)
{ {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_begin_titled");
#endif
struct nk_window *win; struct nk_window *win;
struct nk_style *style; struct nk_style *style;
nk_hash name_hash; nk_hash name_hash;
@ -10132,6 +10144,10 @@ nk_begin_titled(struct nk_context *ctx, const char *name, const char *title,
NK_API void NK_API void
nk_end(struct nk_context *ctx) nk_end(struct nk_context *ctx)
{ {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_end");
#endif
struct nk_panel *layout; struct nk_panel *layout;
// NK_ASSERT(ctx); // NK_ASSERT(ctx);
// NK_ASSERT(ctx->current && "if this triggers you forgot to call `nk_begin`"); // NK_ASSERT(ctx->current && "if this triggers you forgot to call `nk_begin`");

View File

@ -21,6 +21,10 @@
// based on https://github.com/jwerle/strsplit.c -- cleaned up and modified to use strtokm rather than strtok // based on https://github.com/jwerle/strsplit.c -- cleaned up and modified to use strtokm rather than strtok
int strsplit (const char *str, char *parts[], const char *delimiter) { int strsplit (const char *str, char *parts[], const char *delimiter) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: strsplit");
#endif
char *pch; char *pch;
int i = 0; int i = 0;
char *copy = NULL; char *copy = NULL;
@ -80,6 +84,10 @@ int strsplit (const char *str, char *parts[], const char *delimiter) {
} }
void aFailed(char *file, int line) { void aFailed(char *file, int line) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: aFailed");
#endif
MoveTo(10, 10); MoveTo(10, 10);
char textoutput[255]; char textoutput[255];
@ -135,6 +143,10 @@ void refreshNuklearApp(Boolean blankInput);
void getMessagesFromjsFunctionResponse() { void getMessagesFromjsFunctionResponse() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getMessagesFromjsFunctionResponse");
#endif
for (int i = 0; i < MAX_CHAT_MESSAGES; i++) { for (int i = 0; i < MAX_CHAT_MESSAGES; i++) {
memset(&activeChatMessages[i], '\0', 2048); memset(&activeChatMessages[i], '\0', 2048);
@ -158,6 +170,10 @@ void getMessagesFromjsFunctionResponse() {
// function to send messages in chat // function to send messages in chat
void sendMessage() { void sendMessage() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: sendMessage");
#endif
writeSerialPortDebug(boutRefNum, "sendMessage!"); writeSerialPortDebug(boutRefNum, "sendMessage!");
char output[2048]; char output[2048];
@ -181,6 +197,10 @@ void sendMessage() {
// interval is set by the event loop in mac_main // interval is set by the event loop in mac_main
void getChats() { void getChats() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getChats");
#endif
writeSerialPortDebug(boutRefNum, "getChats!"); writeSerialPortDebug(boutRefNum, "getChats!");
callFunctionOnCoprocessor("getChats", "", jsFunctionResponse); callFunctionOnCoprocessor("getChats", "", jsFunctionResponse);
@ -198,6 +218,10 @@ void getChats() {
void sendIPAddressToCoprocessor() { void sendIPAddressToCoprocessor() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: sendIPAddressToCoprocessor");
#endif
writeSerialPortDebug(boutRefNum, "sendIPAddressToCoprocessor!"); writeSerialPortDebug(boutRefNum, "sendIPAddressToCoprocessor!");
char output[2048]; char output[2048];
@ -217,6 +241,10 @@ void sendIPAddressToCoprocessor() {
// figure out pagination?? button on the top that says "get previous chats"? // figure out pagination?? button on the top that says "get previous chats"?
void getMessages(char *thread, int page) { void getMessages(char *thread, int page) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getMessages");
#endif
writeSerialPortDebug(boutRefNum, "getMessages!"); writeSerialPortDebug(boutRefNum, "getMessages!");
char output[68]; char output[68];
@ -234,11 +262,19 @@ void getMessages(char *thread, int page) {
// from https://stackoverflow.com/a/4770992 // from https://stackoverflow.com/a/4770992
Boolean prefix(const char *pre, const char *str) { Boolean prefix(const char *pre, const char *str) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: prefix");
#endif
return strncmp(pre, str, strlen(pre)) == 0; return strncmp(pre, str, strlen(pre)) == 0;
} }
void getChatCounts() { void getChatCounts() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getChatCounts");
#endif
writeSerialPortDebug(boutRefNum, "getChatCounts!"); writeSerialPortDebug(boutRefNum, "getChatCounts!");
callFunctionOnCoprocessor("getChatCounts", "", chatCountFunctionResponse); callFunctionOnCoprocessor("getChatCounts", "", chatCountFunctionResponse);
@ -392,6 +428,10 @@ void getChatCounts() {
void getHasNewMessagesInChat(char *thread) { void getHasNewMessagesInChat(char *thread) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: getHasNewMessagesInChat");
#endif
writeSerialPortDebug(boutRefNum, "getHasNewMessagesInChat!"); writeSerialPortDebug(boutRefNum, "getHasNewMessagesInChat!");
char output[68]; char output[68];
@ -421,6 +461,10 @@ Boolean chatWindowCollision;
Boolean messageWindowCollision; Boolean messageWindowCollision;
Boolean checkCollision(struct nk_rect window) { Boolean checkCollision(struct nk_rect window) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: checkCollision");
#endif
// writeSerialPortDebug(boutRefNum, "checkCollision!"); // writeSerialPortDebug(boutRefNum, "checkCollision!");
// Boolean testout = (window.x < mouse_x && // Boolean testout = (window.x < mouse_x &&
@ -442,6 +486,10 @@ Boolean checkCollision(struct nk_rect window) {
// UI setup and event handling goes here // UI setup and event handling goes here
static void nuklearApp(struct nk_context *ctx) { static void nuklearApp(struct nk_context *ctx) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nuklearApp");
#endif
// prompt the user for the graphql instance // prompt the user for the graphql instance
if (!coprocessorLoaded) { if (!coprocessorLoaded) {
@ -476,10 +524,10 @@ static void nuklearApp(struct nk_context *ctx) {
{ {
nk_layout_row_push(ctx, WINDOW_WIDTH / 2 - 100); nk_layout_row_push(ctx, WINDOW_WIDTH / 2 - 100);
nk_edit_string(ctx, NK_EDIT_SIMPLE, ip_input_buffer, &ip_input_buffer_len, 255, nk_filter_default); short ip_edit_return_value = nk_edit_string(ctx, NK_EDIT_ALWAYS_INSERT_MODE|NK_EDIT_GOTO_END_ON_ACTIVATE, ip_input_buffer, &ip_input_buffer_len, 255, nk_filter_default);
nk_layout_row_push(ctx, 55); nk_layout_row_push(ctx, 55);
if (nk_button_label(ctx, "save")) { if (nk_button_label(ctx, "save") || ip_edit_return_value == 17) {
ipAddressSet = 1; ipAddressSet = 1;
forceRedraw = 2; forceRedraw = 2;
@ -491,6 +539,12 @@ static void nuklearApp(struct nk_context *ctx) {
nk_end(ctx); nk_end(ctx);
} }
// eliminate the initially-set force-redraw
if (forceRedraw) {
forceRedraw--;
}
return; return;
} }
@ -608,6 +662,8 @@ static void nuklearApp(struct nk_context *ctx) {
{ {
nk_layout_row_push(ctx, 312); nk_layout_row_push(ctx, 312);
nk_edit_focus(ctx, NK_EDIT_ALWAYS_INSERT_MODE);
short edit_return_value = nk_edit_string(ctx, NK_EDIT_FIELD|NK_EDIT_SIG_ENTER, box_input_buffer, &box_input_len, 2048, nk_filter_default); short edit_return_value = nk_edit_string(ctx, NK_EDIT_FIELD|NK_EDIT_SIG_ENTER, box_input_buffer, &box_input_len, 2048, nk_filter_default);
// this is the enter key, obviously // this is the enter key, obviously
@ -648,6 +704,10 @@ static void nuklearApp(struct nk_context *ctx) {
void refreshNuklearApp(Boolean blankInput) { void refreshNuklearApp(Boolean blankInput) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: refreshNuklearApp");
#endif
nk_input_begin(ctx); nk_input_begin(ctx);
if (blankInput) { if (blankInput) {
@ -664,6 +724,10 @@ void refreshNuklearApp(Boolean blankInput) {
struct nk_context* initializeNuklearApp() { struct nk_context* initializeNuklearApp() {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: initializeNuklearApp");
#endif
sprintf(activeChat, "no active chat"); sprintf(activeChat, "no active chat");
memset(&chatCountFunctionResponse, '\0', 32767); memset(&chatCountFunctionResponse, '\0', 32767);
memset(&previousChatCountFunctionResponse, '\0', 32767); memset(&previousChatCountFunctionResponse, '\0', 32767);

View File

@ -393,6 +393,11 @@ short widthFor12ptFont[128] = {
// doing this in a "fast" way by using a precomputed table for a 12pt font // doing this in a "fast" way by using a precomputed table for a 12pt font
static short nk_quickdraw_font_get_text_width(nk_handle handle, short height, const char *text, short len) { static short nk_quickdraw_font_get_text_width(nk_handle handle, short height, const char *text, short len) {
// this is going to produce a lot of logging and not a lot of value:
// #ifdef DEBUG_FUNCTION_CALLS
// writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_font_get_text_width");
// #endif
if (!text || len == 0) { if (!text || len == 0) {
return 0; return 0;
@ -410,6 +415,10 @@ static short nk_quickdraw_font_get_text_width(nk_handle handle, short height, co
static int _get_text_width(const char *text, int len) { static int _get_text_width(const char *text, int len) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: _get_text_width");
#endif
if (!text || len == 0) { if (!text || len == 0) {
return 0; return 0;
@ -449,6 +458,10 @@ int mostRight = WINDOW_WIDTH;
void updateBounds(int top, int bottom, int left, int right) { void updateBounds(int top, int bottom, int left, int right) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: updateBounds");
#endif
if (left < mostLeft) { if (left < mostLeft) {
mostLeft = left; mostLeft = left;
@ -475,6 +488,9 @@ void updateBounds(int top, int bottom, int left, int right) {
#else #else
void runDrawCommand(const struct nk_command *cmd) { void runDrawCommand(const struct nk_command *cmd) {
#endif #endif
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: runDrawCommand");
#endif
switch (cmd->type) { switch (cmd->type) {
@ -1063,6 +1079,10 @@ int currentCalls;
NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) { NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_render");
#endif
currentCalls = 1; currentCalls = 1;
#ifdef PROFILING #ifdef PROFILING
@ -1177,6 +1197,10 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
} }
NK_API int nk_quickdraw_handle_event(EventRecord *event, struct nk_context *nuklear_context) { NK_API int nk_quickdraw_handle_event(EventRecord *event, struct nk_context *nuklear_context) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: nk_quickdraw_handle_event");
#endif
// see: inside macintosh: toolbox essentials 2-4 // see: inside macintosh: toolbox essentials 2-4
// and inside macintosh toolbox essentials 2-79 // and inside macintosh toolbox essentials 2-79