Skip to content

Commit 4d21b21

Browse files
committed
FIX: fixing some of compilations issues like when compiling Rebol just as a library without the host part
1 parent 960d504 commit 4d21b21

File tree

9 files changed

+60
-46
lines changed

9 files changed

+60
-46
lines changed

make/msvc/Make-vs-project.r3

+15-10
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ EndGlobal
348348
<PreBuildEvent>
349349
<Command>prebuild64.bat</Command>
350350
</PreBuildEvent>
351+
<Manifest>
352+
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
353+
</Manifest>
351354
<PostBuildEvent>
352355
<Command>COPY /Y "$(TargetDir)$(ProjectName).exe" "$(ProjectDir)..\..\..\build\win-x64\$(ProjectName)_x64.exe"</Command>
353356
<Message>Copy resulted EXE</Message>
@@ -396,7 +399,7 @@ cd %~dp0
396399
pause}
397400

398401
rc-file: {
399-
IDI_APPICON ICON "../../r3.ico"
402+
101 ICON "../../r3.ico"
400403
401404
1 VERSIONINFO
402405
FILEVERSION 3,0,0,0
@@ -424,27 +427,29 @@ END
424427
STRINGTABLE
425428
BEGIN
426429
101 "Rebol 3 (Oldes branch)"
427-
END}
430+
END
431+
}
428432
]
429433

430434

435+
436+
431437
do %../../src/tools/file-base.r
432438

433-
forall core [change core join %../../../src/core/ core/1]
434-
forall os [change os join %../../../src/os/ os/1]
435-
forall os-win32 [change os-win32 join %../../../src/os/win32/ os-win32/1]
436-
core: head core
437-
os: head os
438-
os-win32: head os-win32
439+
forall core [change core join %../../../src/core/ core/1]
440+
forall os [change os join %../../../src/os/ os/1]
441+
forall os-win32 [change os-win32 join %../../../src/os/win32/ os-win32/1]
442+
forall os-win32g [change os-win32g join %../../../src/os/win32/ os-win32g/1]
439443

444+
probe core
440445
vs/Sources: compose/only [
441446
"Source Core Files" (core)
442-
"Source Host Files" (append os os-win32)
447+
"Source Host Files" (union union os os-win32 os-win32g)
443448
]
444449
vs/IncludePath-x86:
445450
vs/IncludePath-x64: "..\..\..\src\include;"
446451
vs/PreprocessorDefinitions-x86: {TO_WIN32;REB_CORE;REB_EXE;ENDIAN_LITTLE;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;USE_LZMA;}
447-
vs/PreprocessorDefinitions-x64: {TO_WIN32_X64;__LLP64__;REB_CORE;REB_EXE;ENDIAN_LITTLE;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;USE_LZMA;}
452+
vs/PreprocessorDefinitions-x64: {UNICODE;_UNICODE;ENDIAN_LITTLE;_CRT_SECURE_NO_WARNINGS;USE_MIDI_DEVICE;USE_PNG_CODEC;USE_JPG_CODEC;USE_LZMA;REB_EXE;TEST_EXTENSIONS;_DEBUG;NO_COMPOSITOR;TO_WIN32_X64;__LLP64__;_FILE_OFFSET_BITS=64;}
448453
vs/Prebuild-x86: {
449454
set REBOL=..\..\prebuild\r3-make-win.exe
450455
set T=../../../src/tools

src/core/n-data.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,9 @@ static int Do_Ordinal(REBVAL *ds, REBINT n)
10651065
//gob = (VAL_EVENT_TYPE(val) == EVT_DROP_FILE) ? Gob_Root : VAL_EVENT_SER(val);
10661066
if (GET_FLAG(VAL_EVENT_FLAGS(val), EVF_HAS_DATA)) {
10671067
CLR_FLAG(VAL_EVENT_FLAGS(val), EVF_HAS_DATA);
1068-
gob = Gob_Root;
1068+
#ifdef TO_WINDOWS
1069+
gob = OS_Get_Gob_Root();
1070+
#endif
10691071
} else {
10701072
gob = VAL_EVENT_SER(val);
10711073
}

src/include/reb-config.h

+4
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ These are now obsolete (as of A107) and should be removed:
168168
#define TO_ANY_LINUX
169169
#endif
170170

171+
#ifdef TO_LINUX_MIPS
172+
#define TO_ANY_LINUX
173+
#endif
174+
171175
#ifdef TO_ANY_LINUX
172176
#undef USE_MIDI_DEVICE // Not implemented!
173177
#endif

src/mezz/view-funcs.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ view: func [
9898
][
9999
unhandle-events self
100100
unview event/window
101-
quit
101+
;quit
102102
]
103103
;show event/window
104104
none ; we handled it

src/os/win32/dev-midi.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void CALLBACK MidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, DW
181181
Midi_Push_Buffer(midi_port.inp_buffer, dwParam2);
182182
evt.type = EVT_READ;
183183
evt.data = dwParam1;
184-
RL_UPDATE_EVENT(&evt);
184+
RL_Update_Event(&evt);
185185
break;
186186
#ifdef DEBUG_MIDI
187187
case MIM_LONGDATA:
@@ -368,8 +368,8 @@ static void PrintMidiDevices()
368368
}
369369
}
370370
if (device_in) {
371-
midi_port->inp_buffer = RL_MAKE_STRING(MIDI_BUF_SIZE-1, FALSE); // allocate input binary ...
372-
RL_PROTECT_GC(midi_port->inp_buffer, TRUE); // ... and prevent it from GC
371+
midi_port->inp_buffer = RL_Make_String(MIDI_BUF_SIZE-1, FALSE); // allocate input binary ...
372+
RL_Protect_GC(midi_port->inp_buffer, TRUE); // ... and prevent it from GC
373373
midi_port->inp_buffer->size = MIDI_BUF_SIZE; // ... and init it for use as circular buffer
374374
midi_port->inp_buffer->rest = 0; // rest is used as readers TAIL
375375
}
@@ -392,7 +392,7 @@ static void PrintMidiDevices()
392392
midiInClose(midi_port->inp_device);
393393
midi_port->inp_device = NULL;
394394
}
395-
if (midi_port->inp_buffer) RL_PROTECT_GC(midi_port->inp_buffer, FALSE);
395+
if (midi_port->inp_buffer) RL_Protect_GC(midi_port->inp_buffer, FALSE);
396396
if (midi_port->out_device) {
397397
midiOutClose(midi_port->out_device);
398398
midi_port->out_device = NULL;
@@ -494,18 +494,18 @@ static void PrintMidiDevices()
494494
nMidiDeviceNum = midiInGetNumDevs();
495495
for (i = 0; i < nMidiDeviceNum; ++i) {
496496
midiInGetDevCaps(i, &capsInp, sizeof(MIDIINCAPS));
497-
arg.series = RL_ENCODE_UTF8_STRING(capsInp.szPname, wcslen(capsInp.szPname), TRUE, FALSE);
497+
arg.series = RL_Encode_UTF8_String(capsInp.szPname, wcslen(capsInp.szPname), TRUE, FALSE);
498498
arg.index = 0;
499-
RL_SET_VALUE(VAL_SERIES(val), i, arg, RXT_STRING);
499+
RL_Set_Value(VAL_SERIES(val), i, arg, RXT_STRING);
500500
}
501501
//output devices block
502502
val = FRM_VALUES((REBSER*)req->data) + 2;
503503
nMidiDeviceNum = midiOutGetNumDevs();
504504
for (i = 0; i < nMidiDeviceNum; ++i) {
505505
midiOutGetDevCaps(i, &capsOut, sizeof(MIDIOUTCAPS));
506-
arg.series = RL_ENCODE_UTF8_STRING(capsOut.szPname, wcslen(capsOut.szPname), TRUE, FALSE);
506+
arg.series = RL_Encode_UTF8_String(capsOut.szPname, wcslen(capsOut.szPname), TRUE, FALSE);
507507
arg.index = 0;
508-
RL_SET_VALUE(VAL_SERIES(val), i, arg, RXT_STRING);
508+
RL_Set_Value(VAL_SERIES(val), i, arg, RXT_STRING);
509509
}
510510
return DR_DONE;
511511
}

src/os/win32/host-compositor.c

+2-18
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#endif
5151
#include "reb-host.h"
5252
#include "host-lib.h"
53+
#include "host-compositor.h"
5354

5455
//***** Externs *****
5556

@@ -61,23 +62,6 @@
6162

6263
static REBXYF Zero_Pair = {0, 0};
6364

64-
typedef struct rebol_compositor_ctx {
65-
REBYTE *wind_buffer;
66-
REBXYI wind_size;
67-
REBGOB *wind_gob;
68-
REBGOB *root_gob;
69-
HDC wind_DC;
70-
HBITMAP back_buffer;
71-
HDC back_DC;
72-
HRGN win_clip;
73-
HRGN new_clip;
74-
HRGN old_clip;
75-
REBXYF abs_offset;
76-
HBRUSH brush_DC;
77-
BITMAPINFO bmpInfo;
78-
} REBCMP;
79-
80-
8165
/***********************************************************************
8266
**
8367
*/ void* OS_Create_Compositor(REBGOB* rootGob, REBGOB* gob)
@@ -195,7 +179,7 @@ typedef struct rebol_compositor_ctx {
195179
//make the new buffer actual
196180
ctx->back_buffer = new_buffer;
197181
ctx->back_DC = new_DC;
198-
ctx->wind_buffer = new_bytes;
182+
//ctx->wind_buffer = new_bytes;
199183

200184
//set window clip region
201185
// SetRectRgn(ctx->win_clip, 0, 0, w, h);

src/os/win32/host-window.c

+18-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
#include "reb-host.h"
5151
#include "host-lib.h"
52+
#include "host-compositor.h"
5253

5354
#define INCLUDE_EXT_DATA
5455
#include "host-ext-window.h"
@@ -96,6 +97,8 @@ static REBOOL Custom_Cursor = FALSE;
9697

9798
static u32* window_ext_words;
9899

100+
RL_LIB *RL; // Link back to reb-lib from embedded extensions
101+
99102
//***** Globals *****//
100103

101104
REBGOB *Gob_Root; // Top level GOB (the screen)
@@ -212,6 +215,19 @@ REBINT window_scale;
212215
return 0;
213216
}
214217

218+
/***********************************************************************
219+
**
220+
*/ REBGOB* OS_Get_Gob_Root()
221+
/*
222+
** Return gob root.
223+
** Needed to map-event when event does not hold gob, but just data and
224+
** compiled as a standalone library (without host part)
225+
**
226+
***********************************************************************/
227+
{
228+
return Gob_Root;
229+
}
230+
215231
/***********************************************************************
216232
**
217233
*/ void OS_Free_Window(REBGOB *gob)
@@ -880,7 +896,7 @@ REBINT window_scale;
880896
{
881897

882898
REBD32 x, y;
883-
u32 w = RL_FIND_WORD(window_ext_words, RXA_WORD(frm, 1));
899+
u32 w = RL_Find_Word(window_ext_words, RXA_WORD(frm, 1));
884900

885901
if (RXA_TYPE(frm, 5) == RXT_INTEGER) {
886902
display = RXA_INT32(frm, 5);
@@ -985,7 +1001,7 @@ REBINT window_scale;
9851001
break;
9861002

9871003
case CMD_WINDOW_INIT_WORDS:
988-
window_ext_words = RL_MAP_WORDS(RXA_SERIES(frm, 1));
1004+
window_ext_words = RL_Map_Words(RXA_SERIES(frm, 1));
9891005
break;
9901006

9911007
case CMD_WINDOW_CURSOR:

src/tools/file-base.r

+8-5
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ os: [
139139
host-stdio.c
140140
dev-net.c
141141
dev-dns.c
142+
143+
host-ext-test.c
142144
]
143145

144146
os-win32: [
@@ -148,15 +150,16 @@ os-win32: [
148150
dev-event.c
149151
dev-clipboard.c
150152
dev-midi.c
151-
]
152153

153-
os-win32g: [
154-
host-graphics.c
155154
host-event.c
156155
host-window.c
157156
host-compositor.c
158-
host-draw.c
159-
host-text.c
157+
]
158+
159+
os-win32g: [
160+
;host-graphics.c
161+
;host-draw.c
162+
;host-text.c
160163
]
161164

162165
os-posix: [

src/tools/systems.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ linker-flags: [
7373
LLOG: "-llog" ; on Android, link with liblog.so
7474
ARC: "-arch i386" ; x86 32 bit architecture (OSX)
7575
M32: "-m32" ; use 32-bit memory model (Linux x64)
76-
W32: "-lwsock32 -lcomdlg32"
76+
W32: "-lwsock32 -lcomdlg32 -lgdi32 -lwinmm"
7777
WIN: "-mwindows" ; build as Windows GUI binary
7878
CON: "-mconsole" ; build as Windows Console binary
7979
S4M: "-Wl,--stack=4194300"

0 commit comments

Comments
 (0)