From b417a6431e89ea4f57d48c1ca169c5cc3cc7a4cd Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 8 Jul 2015 11:28:30 +0200 Subject: Debugging; word sizes (Int -> pointer); fix CleanStrings --- Linux_C_12/Clean.h | 2 +- Linux_C_12/cCrossCallWindows_121.c | 65 ++++++++++++++++++-------------------- Linux_C_12/cCrossCall_121.c | 21 ++++++------ Linux_C_12/cCrossCall_121.h | 6 ++-- Linux_C_12/util_121.c | 17 +++++++--- 5 files changed, 58 insertions(+), 53 deletions(-) (limited to 'Linux_C_12') diff --git a/Linux_C_12/Clean.h b/Linux_C_12/Clean.h index d92e1a0..26513a0 100644 --- a/Linux_C_12/Clean.h +++ b/Linux_C_12/Clean.h @@ -15,7 +15,7 @@ typedef struct clean_string *CleanString; #define CleanStringLength(clean_string) (*(unsigned int *)(clean_string)) /* CleanStringCharacters(clean_string) returns a pointer to the characters of the clean_string */ -#define CleanStringCharacters(clean_string) ((char*)(1+(unsigned int *)(clean_string))) +#define CleanStringCharacters(clean_string) ((char*)(1+(unsigned int *)(clean_string))+4) /* CleanStringSizeInts(string_length) return size of CleanString in integers */ #define CleanStringSizeInts(string_length) (1+(((unsigned int)(string_length)+3)>>2)) diff --git a/Linux_C_12/cCrossCallWindows_121.c b/Linux_C_12/cCrossCallWindows_121.c index c0b2a22..88f70e0 100644 --- a/Linux_C_12/cCrossCallWindows_121.c +++ b/Linux_C_12/cCrossCallWindows_121.c @@ -802,46 +802,40 @@ void EvalCcRqSETWINDOWTITLE (CrossCallInfo *pcci) /* hwnd, textptr no result. gchar *title = (gchar *) pcci->p2; printf("EvalCcRqSETWINDOWTITLE\n"); + printf("Requested title (%p): %s\n", title, title); window = GTK_WIDGET(pcci->p1); if (GTK_IS_WINDOW(window)) { + printf("Setting for window.\n"); gtk_window_set_title(GTK_WINDOW(window), title); } + else if (GTK_IS_LABEL(window)) + { + printf("Setting for label.\n"); + gtk_label_set_text(GTK_LABEL(window), title); + } + else if (GTK_IS_BUTTON(window)) + { + printf("Setting for button.\n"); + title = createMnemonicString(title); + gtk_button_set_label(GTK_BUTTON(window), title); + rfree(title); + } + else if (GTK_IS_ENTRY(window)) + { + printf("Setting for entry.\n"); + gtk_entry_set_text(GTK_ENTRY(window), title); + } + else if (GTK_IS_TEXT_VIEW(window)) + { + printf("Setting for text view.\n"); + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window)); + gtk_text_buffer_set_text (buffer, title, strlen(title)); + } else - { - if (GTK_IS_LABEL(window)) - { - gtk_label_set_text(GTK_LABEL(window), title); - } - else - { - if (GTK_IS_BUTTON(window)) - { - title = createMnemonicString(title); - gtk_button_set_label(GTK_BUTTON(window), title); - rfree(title); - } - else - { - if (GTK_IS_ENTRY(window)) - { - gtk_entry_set_text(GTK_ENTRY(window), title); - } - else - { - if (GTK_IS_TEXT_VIEW(window)) - { - GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window)); - gtk_text_buffer_set_text (buffer, title, strlen(title)); - } - else - { - printf("EvalCcRqSETWINDOWTITLE -> unknown widget type"); - } - } - } - } - } + { + printf("EvalCcRqSETWINDOWTITLE -> unknown widget type\n"); + } MakeReturn0Cci (pcci); } @@ -1425,6 +1419,7 @@ void EvalCcRqCREATEDIALOG (CrossCallInfo *pcci) // textptr,parentptr,behindPtr; gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), fixed, TRUE, TRUE, 0); gtk_widget_show(fixed); + rprintf("Sending dialog to clean: %p / %p\n", dialog, (int64_t) dialog); SendMessage1ToClean (CcWmINITDIALOG, (int64_t) dialog); x = gCci.p1; @@ -2167,7 +2162,7 @@ void EvalCcRqSHOWCONTROL (CrossCallInfo *pcci) // hwnd, bool; no result. printf("EvalCcRqSHOWCONTROL\n"); control = GTK_WIDGET(pcci->p1); - printf("Control: %ld\n", control); + printf("Control: %p; show: 0x%x\n", control, pcci->p2); if (control) { diff --git a/Linux_C_12/cCrossCall_121.c b/Linux_C_12/cCrossCall_121.c index 22a0ae7..83b1fa4 100644 --- a/Linux_C_12/cCrossCall_121.c +++ b/Linux_C_12/cCrossCall_121.c @@ -32,6 +32,7 @@ #include #include #include +#include char** global_argv; int global_argc = 0; @@ -290,15 +291,15 @@ OS WinKillOsThread (OS os) return os; } /*WinKillOsThread*/ -#undef PRINTCROSSCALLS +#define PRINTCROSSCALLS -void WinKickOsThread (int imess, - int ip1, int ip2, int ip3, - int ip4, int ip5, int ip6, +void WinKickOsThread (int64_t imess, + int64_t ip1, int64_t ip2, int64_t ip3, + int64_t ip4, int64_t ip5, int64_t ip6, OS ios, - int *omess, - int *op1, int *op2, int *op3, - int *op4, int *op5, int *op6, + int64_t *omess, + int64_t *op1, int64_t *op2, int64_t *op3, + int64_t *op4, int64_t *op5, int64_t *op6, OS *oos ) { @@ -337,9 +338,9 @@ void WinKickOsThread (int imess, *op5 = gCci.p5; *op6 = gCci.p6; *oos = ios; - /* printf("Data: %d, %d, %d, %d, %d, %d, %d", + printf("Data: %p, %p, %p, %p, %p, %p, %p\n", gCci.p1, gCci.p2, gCci.p3, gCci.p4, - gCci.p5, gCci.p6, ios); */ + gCci.p5, gCci.p6, ios); } else { @@ -447,7 +448,7 @@ void KickCleanThread (CrossCallInfo * pcci) #endif } /* KickCleanThread */ -void SendMessageToClean (int mess, int p1, int p2, int p3, int p4, int p5, int p6) +void SendMessageToClean (int64_t mess, int64_t p1, int64_t p2, int64_t p3, int64_t p4, int64_t p5, int64_t p6) { /* printf("SendMessageToClean -- Message: %d\n", mess); */ gCci.mess = mess; diff --git a/Linux_C_12/cCrossCall_121.h b/Linux_C_12/cCrossCall_121.h index 2111d22..fbd6f93 100644 --- a/Linux_C_12/cCrossCall_121.h +++ b/Linux_C_12/cCrossCall_121.h @@ -49,11 +49,11 @@ extern int CheckVirtualKeyCode (int keycode); extern void HandleCleanRequest( CrossCallInfo *pcci ); extern OS WinStartOsThread (OS); extern OS WinKillOsThread (OS); -extern void WinKickOsThread (int,int,int,int,int,int,int,OS,int*,int*,int*, - int*,int*,int*,int*,OS*); +extern void WinKickOsThread (int64_t,int64_t,int64_t,int64_t,int64_t,int64_t,int64_t,OS, + int64_t*,int64_t*,int64_t*,int64_t*,int64_t*,int64_t*,int64_t*,OS*); extern void KickCleanThread( CrossCallInfo *pcci ); -extern void SendMessageToClean( int mess, int p1,int p2,int p3, int p4,int p5,int p6 ); +extern void SendMessageToClean( int64_t mess, int64_t p1,int64_t p2,int64_t p3, int64_t p4,int64_t p5,int64_t p6 ); /* Shorthands for SendMessageToClean: */ #define SendMessage0ToClean(mess) SendMessageToClean((mess), 0,0,0,0,0,0) diff --git a/Linux_C_12/util_121.c b/Linux_C_12/util_121.c index f0a3de7..544cff6 100644 --- a/Linux_C_12/util_121.c +++ b/Linux_C_12/util_121.c @@ -9,6 +9,7 @@ Generally applicable utility routines. ********************************************************************************************/ #include "util_121.h" +#include "Clean.h" #include #include #include @@ -206,14 +207,22 @@ void WinGetCStringAndFree (PSTR cs, OS ios, CLEAN_STRING * cls, OS * oos) void WinMakeCString (CLEAN_STRING s, OS ios, PSTR * cs, OS * oos) { + char* chars = rmalloc(CleanStringLength(s) + 1); rprintf("(MCS: \""); - *cs = (char *) rmalloc ((s->length) + 1); + *cs = (char*) rmalloc (CleanStringLength(s) + 1 + sizeof(int)); - rsncopy (*cs, s->characters, s->length); - (*cs)[s->length] = 0; + rprintf("length: %d\n", CleanStringLength(s)); + + int i; + for (i = 0; i < CleanStringLength(s); i++) + chars[i] = CleanStringCharacters(s)[i]; + chars[i] = 0; + + rsncopy (*cs, chars, CleanStringLength(s) + 1); + (*cs)[CleanStringLength(s) + 1] = CleanStringLength(s); *oos = ios; - rprintf("\"%s)\n",*cs); + rprintf("\"%s)\n",chars); } /* WinMakeCString */ -- cgit v1.2.3