Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e838540

Browse files
First MCS_* functions refactoring step finished - engine is broken for now
1 parent 33711de commit e838540

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6846
-4066
lines changed

engine/engine.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,7 @@
15441544
A04643F60BAAA63A0030A830 /* w32theme.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = w32theme.cpp; path = src/w32theme.cpp; sourceTree = "<group>"; };
15451545
A71F80530F4F178C003012FD /* Standalone.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Standalone.icns; path = rsrc/Standalone.icns; sourceTree = "<group>"; };
15461546
A71F80610F4F17F9003012FD /* StandaloneDoc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = StandaloneDoc.icns; path = rsrc/StandaloneDoc.icns; sourceTree = "<group>"; };
1547+
BEF2C0EF17BA493A00E96459 /* socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = socket.h; path = src/socket.h; sourceTree = "<group>"; };
15471548
BEFE81D317B2B32800C9D14F /* dskmac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dskmac.cpp; path = src/dskmac.cpp; sourceTree = "<group>"; };
15481549
E8189EB515D17E8000194F25 /* exec-logic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "exec-logic.cpp"; path = "src/exec-logic.cpp"; sourceTree = "<group>"; };
15491550
E864B41F15BDAB3F00F5361C /* legacy_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = legacy_spec.cpp; path = src/legacy_spec.cpp; sourceTree = "<group>"; };
@@ -2734,6 +2735,7 @@
27342735
4D587E3E0B8096FD00200116 /* mcstring.cpp */,
27352736
4D587E060B8096E600200116 /* mcstring.h */,
27362737
4DB98625130C09D6008A03DC /* mcutility.cpp */,
2738+
BEF2C0EF17BA493A00E96459 /* socket.h */,
27372739
4D587DD80B8096E600200116 /* mcutility.h */,
27382740
4DAB7D270FF3A0100009F91E /* md5.cpp */,
27392741
4DFECEFF13CEE55B00288995 /* md5.h */,
@@ -3980,6 +3982,7 @@
39803982
"$(inherited)",
39813983
MODE_DEVELOPMENT,
39823984
);
3985+
GCC_VERSION = 4.2;
39833986
PRODUCT_NAME = "kernel-development";
39843987
};
39853988
name = Debug;
@@ -3991,6 +3994,7 @@
39913994
"$(inherited)",
39923995
MODE_DEVELOPMENT,
39933996
);
3997+
GCC_VERSION = 4.2;
39943998
PRODUCT_NAME = "kernel-development";
39953999
};
39964000
name = Release;

engine/src/capsule.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static bool MCCapsuleReadBuckets(MCCapsuleRef self, void *p_buffer, uint32_t p_b
393393
return false;
394394

395395
// Read the data we require.
396-
if (MCS_read(t_buffer, 1, t_amount_read, self -> buckets -> data_file) == IO_ERROR)
396+
if (MCS_readfixed(t_buffer, 1, t_amount_read, self -> buckets -> data_file) == IO_ERROR)
397397
return false;
398398

399399
// If the amount we require isn't available, its an error.
@@ -788,7 +788,10 @@ bool MCCapsuleProcess(MCCapsuleRef self)
788788
{
789789
// If we haven't got all the data, then we have all data buffered
790790
// so can use a regular variety fake stream.
791-
t_stream = MCS_fakeopen(MCString((char *)(self -> output_buffer + t_header_size), t_length));
791+
MCAutoDataRef t_data;
792+
793+
t_success = MCDataCreateWithBytes(self -> output_buffer + t_header_size, t_length, &t_data);
794+
t_stream = MCS_fakeopen(*t_data);
792795
}
793796
else
794797
{

engine/src/chunk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ Exec_stat MCChunk::getobj(MCExecPoint &ep, MCObject *&objptr,
944944
uint4 offset;
945945
if (MCU_offset(SIGNATURE, ep.getsvalue(), offset) && (ep . getsvalue() . getlength() > 8 && strncmp(ep . getsvalue() . getstring(), "REVO", 4) == 0))
946946
{
947-
IO_handle stream = MCS_fakeopen(ep.getsvalue());
947+
IO_handle stream = MCS_fakeopen((MCDataRef)ep.getvalueref());
948948
if (MCdispatcher->readfile(NULL, NULL, stream, sptr) != IO_NORMAL)
949949
{
950950
MCS_close(stream);

engine/src/cmdss.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ MCStack *MCGo::findstack(MCExecPoint &ep, Chunk_term etype, MCCard *&cptr, bool
525525
uint4 offset;
526526
if (MCU_offset(SIGNATURE, ep.getsvalue(), offset) || (ep . getsvalue() . getlength() > 8 && strncmp(ep . getsvalue() . getstring(), "REVO", 4) == 0))
527527
{
528-
IO_handle stream = MCS_fakeopen(ep.getsvalue());
528+
IO_handle stream = MCS_fakeopen((MCDataRef)ep.getvalueref());
529529
if (MCdispatcher->readfile(NULL, NULL, stream, sptr) != IO_NORMAL)
530530
{
531531
MCS_close(stream);

engine/src/customprinter.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,37 +2009,35 @@ Exec_stat MCCustomPrinterCreate(const char *p_destination, const char *p_filenam
20092009
{
20102010
MCSysModuleHandle t_module;
20112011
#if defined(_WINDOWS)
2012-
t_module = MCS_loadmodule("revpdfprinter.dll");
2012+
t_module = MCS_loadmodule(MCSTR("revpdfprinter.dll"));
20132013
#elif defined(_MACOSX)
2014-
char *t_module_path;
2014+
MCAutoStringRef t_module_path;
20152015

2016-
t_module_path = nil;
2017-
MCCStringFormat(t_module_path, "%s/../revpdfprinter.bundle", MCcmd);
2018-
t_module = MCS_loadmodule(t_module_path);
2019-
MCCStringFree(t_module_path);
2016+
/* UNCHECKED */ MCStringCreateMutable(0, &t_module_path);
2017+
/* UNCHECKED */ MCStringFormat(&t_module_path, "%s/../revpdfprinter.bundle", MCcmd);
2018+
t_module = MCS_loadmodule(*t_module_path);
20202019

20212020
if (t_module == nil)
20222021
{
2023-
t_module_path = nil;
2024-
MCCStringFormat(t_module_path, "%s/../../../../revpdfprinter.bundle", MCcmd);
2025-
t_module = MCS_loadmodule(t_module_path);
2026-
MCCStringFree(t_module_path);
2022+
MCStringFormat(&t_module_path, "%s/../../../../revpdfprinter.bundle", MCcmd);
2023+
t_module = MCS_loadmodule(*t_module_path);
20272024
}
20282025
#elif defined(_LINUX)
20292026
const char *t_engine_dir_end;
20302027
t_engine_dir_end = strrchr(MCcmd, '/');
2031-
char *t_module_path;
2032-
t_module_path = nil;
2033-
MCCStringFormat(t_module_path, "%.*s/revpdfprinter.so", t_engine_dir_end - MCcmd, MCcmd);
2034-
t_module = MCS_loadmodule(t_module_path);
2028+
MCAutoStringRef t_module_path;
2029+
2030+
/* UNCHECKED */ MCStringCreateMutable(0, &t_module_path);
2031+
/* UNCHECKED */ MCStringFormat(&t_module_path, "%.*s/revpdfprinter.so", t_engine_dir_end - MCcmd, MCcmd);
2032+
t_module = MCS_loadmodule(*t_module_path);
20352033
MCCStringFree(t_module_path);
20362034
#elif defined(TARGET_SUBPLATFORM_IPHONE)
20372035
const char *t_engine_dir_end;
20382036
t_engine_dir_end = strrchr(MCcmd, '/');
2039-
char *t_module_path;
2040-
t_module_path = nil;
2041-
MCCStringFormat(t_module_path, "%.*s/revpdfprinter.dylib", t_engine_dir_end - MCcmd, MCcmd);
2042-
t_module = MCS_loadmodule(t_module_path);
2037+
MCAutoStringRef t_module_path;
2038+
/* UNCHECKED */ MCStringCreateMutable(0, &t_module_path);
2039+
/* UNCHECKED */ MCStringFormat(&t_module_path, "%.*s/revpdfprinter.dylib", t_engine_dir_end - MCcmd, MCcmd);
2040+
t_module = MCS_loadmodule(*t_module_path);
20432041
MCCStringFree(t_module_path);
20442042
#elif defined(_SERVER)
20452043
t_module = nil;

0 commit comments

Comments
 (0)