Initial commit

This commit is contained in:
Luke Street
2026-03-03 23:04:25 -07:00
commit e9f5847bb9
15 changed files with 6077 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
name: Build
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install MinGW-w64
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-i686
- name: Build
run: make
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: mwccwrap
path: |
mwccwrap.exe
PluginLib2.dll
PluginLib3.dll
ASINTPPC.DLL
+4
View File
@@ -0,0 +1,4 @@
*.exe
*.dll
*.DLL
*.o
+21
View File
@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2026 Luke Street (encounter)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+33
View File
@@ -0,0 +1,33 @@
CC = i686-w64-mingw32-gcc
CFLAGS = -Wall -O2 -std=c99
LDFLAGS = -lversion
all: PluginLib2.dll PluginLib3.dll ASINTPPC.DLL mwccwrap.exe
PluginLib2.dll: pluginlib.c pluginlib2.def cw_types.h host_ctx.h
$(CC) $(CFLAGS) -shared -o $@ pluginlib.c pluginlib2.def -DPLUGINLIB_VER=2 -Wl,--kill-at,--enable-stdcall-fixup
PluginLib3.dll: pluginlib.c pluginlib3.def cw_types.h host_ctx.h
$(CC) $(CFLAGS) -shared -o $@ pluginlib.c pluginlib3.def -DPLUGINLIB_VER=3 -Wl,--kill-at,--enable-stdcall-fixup
# PluginLib5.dll: pluginlib.c pluginlib5.def cw_types.h host_ctx.h
# $(CC) $(CFLAGS) -shared -o $@ pluginlib.c pluginlib5.def -DPLUGINLIB_VER=5 -Wl,--kill-at,--enable-stdcall-fixup
ASINTPPC.DLL: asintppc.c asintppc.def
$(CC) $(CFLAGS) -shared -o $@ asintppc.c asintppc.def -Wl,--kill-at,--enable-stdcall-fixup
mwccwrap.exe: mwccwrap.c cw_types.h host_ctx.h
$(CC) $(CFLAGS) -o $@ mwccwrap.c $(LDFLAGS)
# Quick test - try to compile a minimal C file
test: all test.c
wibo ./mwccwrap.exe -v -o test.o test.c
# Test with just initialization (no compile)
test-init: all
wibo ./mwccwrap.exe -v test.c || true
clean:
rm -f PluginLib2.dll PluginLib3.dll ASINTPPC.DLL mwccwrap.exe test.o
.PHONY: all test test-init clean
+74
View File
@@ -0,0 +1,74 @@
# mwccwrap
Command-line wrapper for CodeWarrior compiler plugin DLLs.
## Background
CodeWarrior for PlayStation shipped its C/C++ compiler only as an IDE plugin
DLL (`cc_mips.dll`) — no standalone `mwcc` command-line executable was ever
provided for the PS1 target. Later CW MIPS targets (PS2, PSP) did ship CLI
tools (`mwccps2.exe`, etc.), but PS1 never got one. A similar gap exists for
CW Wii 1.2, where the only available installer is truncated and missing
`mwcceppc.exe`, while `ppc_eabi.dll` is intact.
**mwccwrap** fills this gap. It builds a Win32 CLI host (`mwccwrap.exe`) that
loads a CW compiler DLL and drives it through the CW plugin lifecycle, plus
replacement DLLs that implement the API callbacks the compiler DLL imports.
This makes it possible to use these compilers from the command line and
from build systems, enabling decompilation projects and other workflows
that need reproducible builds with the original compiler.
For usage on Linux or macOS, use [wibo](https://github.com/decompals/wibo) (a
lightweight Win32 userspace emulator) or Wine.
## Supported compilers
| Platform | DLL | Versions |
|----------|-----|----------|
| PlayStation | `cc_mips.dll` | CW PS R3, R4, R4.1, R5, R5.2 |
| GameCube | `ppc_eabi.dll` | CW GC 1.1 through 2.7 |
## Building
Requires an `i686-w64-mingw32-gcc` cross-compiler (MinGW-w64).
```sh
make # builds mwccwrap.exe and shim DLLs
make clean # remove build artifacts
```
### Build outputs
| File | Description |
|------|-------------|
| `mwccwrap.exe` | CLI host executable |
| `PluginLib2.dll` | CW API shim for 1997-era DLLs |
| `PluginLib3.dll` | CW API shim for 1998-2005-era DLLs |
| `ASINTPPC.DLL` | Mac OS Toolbox API shim |
## Usage
```sh
# Basic compilation (requires cc_mips.dll or ppc_eabi.dll in cwd)
wibo ./mwccwrap.exe -o output.o input.c
# Specify compiler DLL explicitly
wibo ./mwccwrap.exe -dll /path/to/cc_mips.dll -o output.o input.c
# Common flags
wibo ./mwccwrap.exe -O2 -sym on -lang c -I include/ -D MY_DEFINE -o output.o input.c
# See all options
wibo ./mwccwrap.exe -help
```
### Runtime requirements
A compiler DLL must be available either:
- In the current working directory (`cc_mips.dll` or `ppc_eabi.dll`), or
- Passed explicitly via `-dll <path>`
## License
This project is licensed under the MIT License. See `LICENSE` for details.
+376
View File
@@ -0,0 +1,376 @@
/*
* asintppc.c - Lightweight ASINTPPC.DLL shim
*/
#include <windows.h>
#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cw_types.h"
enum {
kNoErr = 0,
kMemFullErr = -108,
kFnfErr = -43,
kEofErr = -39,
kParamErr = -50,
kOpWrErr = -49
};
static SInt16 g_mem_error = kNoErr;
static FILE* g_open_files[256];
static SInt16 g_next_refnum = 16;
static int g_verbose = 0;
#define ASILOG(fmt, ...) do { if (g_verbose) { fprintf(stderr, "[ASINTPPC] " fmt "\n", ##__VA_ARGS__); fflush(stderr); } } while(0)
static void pstr_to_cstr(const UInt8* pstr, char* out, size_t out_size) {
size_t len;
if (!out || out_size == 0) return;
out[0] = '\0';
if (!pstr) return;
len = pstr[0];
if (len + 1 > out_size) len = out_size - 1;
if (len > 0) memcpy(out, pstr + 1, len);
out[len] = '\0';
}
static void cstr_to_pstr(const char* cstr, UInt8* out) {
size_t len = 0;
if (!out) return;
if (cstr) len = strlen(cstr);
if (len > 255) len = 255;
out[0] = (UInt8)len;
if (len > 0) memcpy(out + 1, cstr, len);
}
static SInt16 alloc_refnum(FILE* f) {
for (int i = 0; i < 256; i++) {
SInt16 ref = (SInt16)((g_next_refnum + i) & 0xFF);
if (ref == 0) continue;
if (!g_open_files[(unsigned char)ref]) {
g_open_files[(unsigned char)ref] = f;
g_next_refnum = (SInt16)(ref + 1);
return ref;
}
}
return 0;
}
static FILE* lookup_refnum(SInt16 refnum) {
return g_open_files[(unsigned char)refnum];
}
static void close_refnum(SInt16 refnum) {
g_open_files[(unsigned char)refnum] = NULL;
}
/*
* EqualString - Mac Toolbox Pascal string comparison
*
* caseSensitive: if 0, compare case-insensitively
* diacSensitive: ignored in this shim
*/
int __stdcall EqualString(const UInt8* str1, const UInt8* str2,
int caseSensitive, int diacSensitive)
{
UInt8 len1, len2;
ASILOG("EqualString");
(void)diacSensitive;
if (!str1 || !str2) return 0;
len1 = str1[0];
len2 = str2[0];
if (len1 != len2) return 0;
for (UInt8 i = 1; i <= len1; i++) {
UInt8 c1 = str1[i];
UInt8 c2 = str2[i];
if (!caseSensitive) {
c1 = (UInt8)tolower(c1);
c2 = (UInt8)tolower(c2);
}
if (c1 != c2) return 0;
}
return 1;
}
void __stdcall ASI_CopyPtoC(const UInt8* pstr, char* cstr) {
ASILOG("ASI_CopyPtoC");
if (!cstr) return;
if (!pstr) {
cstr[0] = '\0';
return;
}
pstr_to_cstr(pstr, cstr, 1024);
}
SInt16 __stdcall CharacterByteType(const char* text, SInt32 offset, SInt32 script) {
ASILOG("CharacterByteType");
(void)script;
if (!text || offset < 0) return 0;
/* Treat all bytes as single-byte characters in this shim. */
return 1;
}
void __stdcall GetIndString(UInt8* out, SInt16 list_id, SInt16 index) {
ASILOG("GetIndString(list=%d,index=%d)", (int)list_id, (int)index);
(void)list_id;
(void)index;
if (!out) return;
out[0] = 0;
}
HandleStructure* __stdcall NewHandle(SInt32 size) {
HandleStructure* h;
size_t alloc_size;
ASILOG("NewHandle(size=%d)", (int)size);
if (size < 0) size = 0;
h = (HandleStructure*)calloc(1, sizeof(HandleStructure));
if (!h) {
g_mem_error = kMemFullErr;
return NULL;
}
alloc_size = (size > 0) ? (size_t)size : 1u;
h->hand.addr = calloc(1, alloc_size);
if (!h->hand.addr) {
free(h);
g_mem_error = kMemFullErr;
return NULL;
}
h->addr = (char*)h->hand.addr;
h->hand.used = (UInt32)size;
h->hand.size = (UInt32)alloc_size;
g_mem_error = kNoErr;
return h;
}
HandleStructure* __stdcall TempNewHandle(SInt32 size, SInt16* result) {
ASILOG("TempNewHandle(size=%d)", (int)size);
HandleStructure* h = NewHandle(size);
if (result) *result = h ? kNoErr : g_mem_error;
return h;
}
void __stdcall DisposeHandle(HandleStructure* h) {
ASILOG("DisposeHandle");
if (!h) return;
free(h->hand.addr);
free(h);
g_mem_error = kNoErr;
}
SInt16 __stdcall SetHandleSize(HandleStructure* h, SInt32 new_size) {
ASILOG("SetHandleSize(size=%d)", (int)new_size);
void* new_data;
size_t alloc_size;
if (!h || new_size < 0) {
g_mem_error = kParamErr;
return g_mem_error;
}
alloc_size = (new_size > 0) ? (size_t)new_size : 1u;
new_data = realloc(h->hand.addr, alloc_size);
if (!new_data) {
g_mem_error = kMemFullErr;
return g_mem_error;
}
h->hand.addr = new_data;
h->addr = (char*)new_data;
h->hand.used = (UInt32)new_size;
h->hand.size = (UInt32)alloc_size;
g_mem_error = kNoErr;
return kNoErr;
}
SInt16 __stdcall MemError(void) {
ASILOG("MemError -> %d", (int)g_mem_error);
return g_mem_error;
}
UInt32 __stdcall TickCount(void) {
ASILOG("TickCount");
return (UInt32)GetTickCount();
}
SInt16 __stdcall HDelete(SInt16 vRefNum, SInt32 dirID, const UInt8* name) {
char path[MAX_PATH];
ASILOG("HDelete");
(void)vRefNum;
(void)dirID;
pstr_to_cstr(name, path, sizeof(path));
if (!path[0]) return kParamErr;
return (remove(path) == 0) ? kNoErr : kFnfErr;
}
SInt16 __stdcall HCreate(SInt16 vRefNum, SInt32 dirID, const UInt8* name, UInt32 creator, UInt32 fileType) {
FILE* f;
char path[MAX_PATH];
ASILOG("HCreate");
(void)vRefNum;
(void)dirID;
(void)creator;
(void)fileType;
pstr_to_cstr(name, path, sizeof(path));
if (!path[0]) return kParamErr;
f = fopen(path, "wb");
if (!f) return kOpWrErr;
fclose(f);
return kNoErr;
}
SInt16 __stdcall HOpen(SInt16 vRefNum, SInt32 dirID, const UInt8* name, SInt16 permission, SInt16* refNum) {
FILE* f = NULL;
SInt16 ref;
char path[MAX_PATH];
ASILOG("HOpen");
(void)vRefNum;
(void)dirID;
pstr_to_cstr(name, path, sizeof(path));
if (!path[0] || !refNum) return kParamErr;
if (permission == 1) f = fopen(path, "rb");
if (!f) f = fopen(path, "r+b");
if (!f) f = fopen(path, "rb");
if (!f) return kFnfErr;
ref = alloc_refnum(f);
if (ref == 0) {
fclose(f);
return kMemFullErr;
}
*refNum = ref;
return kNoErr;
}
SInt16 __stdcall HGetFInfo(SInt16 vRefNum, SInt32 dirID, const UInt8* name, void* fileInfo) {
char path[MAX_PATH];
FILE* f;
ASILOG("HGetFInfo");
(void)vRefNum;
(void)dirID;
pstr_to_cstr(name, path, sizeof(path));
if (!path[0]) return kParamErr;
f = fopen(path, "rb");
if (!f) return kFnfErr;
fclose(f);
if (fileInfo) memset(fileInfo, 0, 64);
return kNoErr;
}
SInt16 __stdcall GetEOF(SInt16 refNum, SInt32* eofPos) {
ASILOG("GetEOF(ref=%d)", (int)refNum);
long pos;
long end;
FILE* f = lookup_refnum(refNum);
if (!f || !eofPos) return kParamErr;
pos = ftell(f);
if (fseek(f, 0, SEEK_END) != 0) return kParamErr;
end = ftell(f);
fseek(f, pos, SEEK_SET);
*eofPos = (SInt32)end;
return kNoErr;
}
SInt16 __stdcall GetFPos(SInt16 refNum, SInt32* position) {
ASILOG("GetFPos(ref=%d)", (int)refNum);
long pos;
FILE* f = lookup_refnum(refNum);
if (!f || !position) return kParamErr;
pos = ftell(f);
*position = (SInt32)pos;
return kNoErr;
}
SInt16 __stdcall SetFPos(SInt16 refNum, SInt16 posMode, SInt32 offset) {
ASILOG("SetFPos(ref=%d,mode=%d,off=%d)", (int)refNum, (int)posMode, (int)offset);
int whence = SEEK_SET;
FILE* f = lookup_refnum(refNum);
if (!f) return kParamErr;
if (posMode == 2) whence = SEEK_CUR;
else if (posMode == 3) whence = SEEK_END;
if (fseek(f, (long)offset, whence) != 0) return kParamErr;
return kNoErr;
}
SInt16 __stdcall FSRead(SInt16 refNum, SInt32* count, void* buffer) {
ASILOG("FSRead(ref=%d,count=%d)", (int)refNum, (int)(count ? *count : -1));
size_t got;
FILE* f = lookup_refnum(refNum);
if (!f || !count || !buffer || *count < 0) return kParamErr;
got = fread(buffer, 1, (size_t)*count, f);
*count = (SInt32)got;
if (got == 0 && feof(f)) return kEofErr;
return kNoErr;
}
SInt16 __stdcall FSWrite(SInt16 refNum, SInt32* count, const void* buffer) {
ASILOG("FSWrite(ref=%d,count=%d)", (int)refNum, (int)(count ? *count : -1));
size_t put;
FILE* f = lookup_refnum(refNum);
if (!f || !count || !buffer || *count < 0) return kParamErr;
put = fwrite(buffer, 1, (size_t)*count, f);
*count = (SInt32)put;
return (put > 0 || *count == 0) ? kNoErr : kOpWrErr;
}
SInt16 __stdcall FSClose(SInt16 refNum) {
ASILOG("FSClose(ref=%d)", (int)refNum);
FILE* f = lookup_refnum(refNum);
if (!f) return kParamErr;
fclose(f);
close_refnum(refNum);
return kNoErr;
}
SInt16 __stdcall FSMakeFSSpec(SInt16 vRefNum, SInt32 dirID, const UInt8* name, FSSpec* outSpec) {
ASILOG("FSMakeFSSpec");
if (!outSpec) return kParamErr;
memset(outSpec, 0, 0x120);
outSpec->vRefNum = vRefNum;
outSpec->parID = dirID;
if (name) {
size_t n = name[0];
if (n > 255) n = 255;
outSpec->name[0] = (UInt8)n;
if (n > 0) memcpy(outSpec->name + 1, name + 1, n);
}
return kNoErr;
}
SInt16 __stdcall PBGetCatInfoSync(void* pb) {
ASILOG("PBGetCatInfoSync");
if (pb) memset(pb, 0, 128);
return kNoErr;
}
SInt16 __stdcall GetVInfo(SInt16 drvNum, UInt8* volumeName, SInt16* vRefNum, SInt32* freeBytes) {
ASILOG("GetVInfo");
(void)drvNum;
if (volumeName) cstr_to_pstr("", volumeName);
if (vRefNum) *vRefNum = 0;
if (freeBytes) *freeBytes = 0;
return kNoErr;
}
SInt16 __stdcall PBHGetFInfoSync(void* pb) {
ASILOG("PBHGetFInfoSync");
if (pb) memset(pb, 0, 128);
return kNoErr;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
(void)hinstDLL;
(void)fdwReason;
(void)lpReserved;
if (fdwReason == DLL_PROCESS_ATTACH) {
g_verbose = (getenv("MWCC_ASI_VERBOSE") != NULL);
}
return TRUE;
}
+26
View File
@@ -0,0 +1,26 @@
LIBRARY ASINTPPC
EXPORTS
ASI_CopyPtoC @92
DisposeHandle @250
GetIndString @302
NewHandle @383
SetHandleSize @473
TickCount @521
FSClose @578
FSWrite @580
MemError @586
EqualString @602
GetVInfo @609
FSRead @647
GetEOF @654
GetFPos @656
SetFPos @728
HGetFInfo @768
TempNewHandle @769
FSMakeFSSpec @955
HCreate @1064
HDelete @1066
HOpen @1067
PBGetCatInfoSync @2237
PBHGetFInfoSync @2267
CharacterByteType @6028
+460
View File
@@ -0,0 +1,460 @@
/*
* cw_types.h - CodeWarrior Plugin API types for Win32
*
* Reconstructed from the MWCC decomp SDK headers, adapted for Win32 target.
* This is the minimal set needed by the mwccwrap host and PluginLib3 shim.
*/
#ifndef CW_TYPES_H
#define CW_TYPES_H
#include <windows.h>
#include <stdint.h>
#ifndef PLUGINLIB_VER
#define PLUGINLIB_VER 3
#endif
#define _STRINGIFY(s) #s
#define STRINGIFY(s) _STRINGIFY(s)
/* Basic types matching CW SDK */
typedef int32_t SInt32;
typedef int16_t SInt16;
typedef uint32_t UInt32;
typedef uint16_t UInt16;
typedef uint8_t UInt8;
typedef unsigned char Boolean;
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
/* CWResult is the error/status result returned by all IDE API routines */
typedef SInt32 CWResult;
/* Four-character code */
typedef SInt32 CWFourCharType;
#define CWFOURCHAR(a, b, c, d) \
(((CWFourCharType) ((a) & 0xff) << 24) \
| ((CWFourCharType) ((b) & 0xff) << 16) \
| ((CWFourCharType) ((c) & 0xff) << 8) \
| ((CWFourCharType) ((d) & 0xff)))
typedef UInt32 CWDataType;
/* Mac-style FSSpec with Pascal name */
#pragma pack(push, 2)
typedef struct FSSpec {
SInt16 vRefNum;
SInt32 parID;
UInt8 name[256];
} FSSpec;
#pragma pack(pop)
typedef struct OSHandle {
void* addr;
UInt32 used;
UInt32 size;
} OSHandle;
typedef struct HandleStructure {
char* addr; /* Mac Handle-compatible first field */
OSHandle hand;
} HandleStructure;
#if PLUGINLIB_VER < 3
typedef FSSpec CWFileSpec;
#else
typedef struct CWFileSpec {
char path[MAX_PATH];
} CWFileSpec;
#endif
typedef char CWFileName[65];
typedef FILETIME CWFileTime;
typedef DWORD CWOSResult;
/* Calling conventions */
#define CW_CALLBACK CWResult __stdcall
/* Memory handle - opaque pointer */
typedef struct CWMemHandlePrivateStruct* CWMemHandle;
/* Plugin context - pointer to private context struct */
typedef struct CWPluginPrivateContext* CWPluginContext;
/* Error codes */
enum {
cwNoErr = 0,
cwErrUserCanceled,
cwErrRequestFailed,
cwErrInvalidParameter,
cwErrInvalidCallback,
cwErrInvalidMPCallback,
cwErrOSError,
cwErrOutOfMemory,
cwErrFileNotFound,
cwErrUnknownFile,
cwErrSilent,
cwErrCantSetAttribute,
cwErrStringBufferOverflow,
cwErrDirectoryNotFound,
cwErrLastCommonError = 512,
cwErrUnknownSegment,
cwErrSBMNotFound,
cwErrObjectFileNotStored,
cwErrLicenseCheckFailed,
cwErrFileSpecNotSpecified,
cwErrFileSpecInvalid,
cwErrLastCompilerLinkerError = 1024
};
/* Request codes */
enum {
reqInitialize = -2,
reqTerminate = -1,
reqIdle = -100,
reqAbout = -101,
reqPrefsChange = -102
};
/* Compiler request codes */
enum {
reqCompile = 0,
reqMakeParse,
reqCompDisassemble,
reqCheckSyntax,
reqPreprocessForDebugger
};
/* Dependency types */
typedef enum CWDependencyType {
cwNoDependency,
cwNormalDependency,
cwInterfaceDependency
} CWDependencyType;
/* File data types */
enum {
cwFileTypeUnknown,
cwFileTypeText,
cwFileTypePrecompiledHeader
};
/* Message types */
enum {
messagetypeInfo,
messagetypeWarning,
messagetypeError
};
/* Target CPU/OS constants */
enum {
targetCPU68K = CWFOURCHAR('6','8','k',' '),
targetCPUPowerPC = CWFOURCHAR('p','p','c',' '),
targetCPUi80x86 = CWFOURCHAR('8','0','8','6'),
targetCPUMips = CWFOURCHAR('m','i','p','s'),
targetCPUNECv800 = CWFOURCHAR('v','8','0','0'),
targetCPUEmbeddedPowerPC = CWFOURCHAR('e','P','P','C'),
targetCPUARM = CWFOURCHAR('a','r','m',' '),
targetCPUSparc = CWFOURCHAR('s','p','r','c'),
targetCPUIA64 = CWFOURCHAR('I','A','6','4'),
targetCPUAny = CWFOURCHAR('*','*','*','*'),
targetCPUMCORE = CWFOURCHAR('m','c','o','r'),
targetCPU_Intent = CWFOURCHAR('n','t','n','t')
};
enum {
targetOSMacintosh = CWFOURCHAR('m','a','c',' '),
targetOSWindows = CWFOURCHAR('w','i','n','t'),
targetOSNetware = CWFOURCHAR('n','l','m',' '),
targetOSMagicCap = CWFOURCHAR('m','c','a','p'),
targetOSOS9 = CWFOURCHAR('o','s','9',' '),
targetOSEmbeddedABI = CWFOURCHAR('E','A','B','I'),
targetOSJava = CWFOURCHAR('j','a','v','a'), /* java (no VM specification) */
targetOSJavaMS = CWFOURCHAR('j','v','m','s'), /* Microsoft VM */
targetOSJavaSun = CWFOURCHAR('j','v','s','n'), /* Sun VM */
targetOSJavaMRJ = CWFOURCHAR('j','v','m','r'), /* MRJ VM */
targetOSJavaMW = CWFOURCHAR('j','v','m','w'), /* Metrowerks VM */
targetOSPalm = CWFOURCHAR('p','a','l','m'),
targetOSGTD5 = CWFOURCHAR('g','t','d','5'),
targetOSSolaris = CWFOURCHAR('s','l','r','s'),
targetOSLinux = CWFOURCHAR('l','n','u','x'),
targetOSAny = CWFOURCHAR('*','*','*','*'),
targetOS_Intent = CWFOURCHAR('n','t','n','t')
};
/* Linkage types */
enum {
exelinkageFlat,
exelinkageSegmented,
exelinkageOverlay1
};
/* Output types */
enum {
linkOutputNone,
linkOutputFile,
linkOutputDirectory
};
/*
* CW SDK structs use mac68k alignment (Metrowerks) or 2-byte packing (MSVC).
*/
#pragma pack(push, 2)
/* Message reference */
typedef struct CWMessageRef {
CWFileSpec sourcefile;
SInt32 linenumber;
short tokenoffset;
short tokenlength;
SInt32 selectionoffset;
SInt32 selectionlength;
} CWMessageRef;
/* File info returned by CWFindAndLoadFile */
typedef struct CWFileInfo {
Boolean fullsearch;
char dependencyType;
SInt32 isdependentoffile;
Boolean suppressload;
Boolean padding;
const char* filedata;
SInt32 filedatalength;
short filedatatype;
short fileID;
CWFileSpec filespec;
Boolean alreadyincluded;
Boolean recordbrowseinfo;
} CWFileInfo;
/* Browse options */
typedef struct CWBrowseOptions {
Boolean recordClasses;
Boolean recordEnums;
Boolean recordMacros;
Boolean recordTypedefs;
Boolean recordConstants;
Boolean recordTemplates;
Boolean recordUndefinedFunctions;
SInt32 reserved1;
SInt32 reserved2;
} CWBrowseOptions;
/* Object data for StoreObjectData */
typedef struct CWDependencyInfo {
SInt32 fileIndex;
CWFileSpec fileSpec;
short fileSpecAccessType;
short dependencyType;
} CWDependencyInfo;
typedef struct CWObjectData {
CWMemHandle objectdata;
CWMemHandle browsedata;
SInt32 reserved1;
SInt32 codesize;
SInt32 udatasize;
SInt32 idatasize;
SInt32 compiledlines;
Boolean interfaceChanged;
SInt32 reserved2;
void* compilecontext;
CWDependencyInfo* dependencies;
short dependencyCount;
CWFileSpec* objectfile;
} CWObjectData;
/* Legacy target info (API <= 9 era) */
typedef struct CWTargetInfoV7 {
CWFileSpec outfile;
CWFileSpec symfile;
short linkType;
Boolean canRun;
Boolean canDebug;
Boolean useRunHelperApp;
char reserved1;
CWDataType debuggerCreator;
CWDataType runHelperCreator;
SInt32 reserved2[2];
} CWTargetInfoV7;
/* Target info - Win32 version */
typedef struct CWTargetInfo {
short outputType;
CWFileSpec outfile;
CWFileSpec symfile;
CWFileSpec runfile;
short linkType;
Boolean canRun;
Boolean canDebug;
CWDataType targetCPU;
CWDataType targetOS;
// Boolean runHelperIsRegKey;
// Boolean debugHelperIsRegKey;
// char args[512];
// char runHelperName[512];
// Boolean runHelperRequiresURL;
// char reserved2;
// char debugHelperName[512];
// CWFileSpec linkAgainstFile;
} CWTargetInfo;
/* Project file info */
typedef struct CWProjectFileInfo {
CWFileSpec filespec;
CWFileTime moddate;
short segment;
Boolean hasobjectcode;
Boolean hasresources;
Boolean isresourcefile;
Boolean weakimport;
Boolean initbefore;
Boolean gendebug;
CWFileTime objmoddate;
CWFileName dropinname;
short fileID;
Boolean recordbrowseinfo;
Boolean reserved;
Boolean hasunitdata;
Boolean mergeintooutput;
UInt32 unitdatadependencytag;
} CWProjectFileInfo;
/* Segment info */
typedef struct CWProjectSegmentInfo {
char name[32];
short attributes;
} CWProjectSegmentInfo;
/* New text document */
typedef struct CWNewTextDocumentInfo {
const char* documentname;
CWMemHandle text;
Boolean markDirty;
} CWNewTextDocumentInfo;
/* IDE info */
typedef struct CWIDEInfo {
unsigned short majorVersion;
unsigned short minorVersion;
unsigned short bugFixVersion;
unsigned short buildVersion;
unsigned short dropinAPIVersion;
} CWIDEInfo;
/* Access path info */
typedef enum CWAccessPathType {
cwSystemPath,
cwUserPath
} CWAccessPathType;
typedef struct CWAccessPathInfo {
CWFileSpec pathSpec;
Boolean recursive;
SInt32 subdirectoryCount;
} CWAccessPathInfo;
typedef struct CWAccessPathListInfo {
SInt32 systemPathCount;
SInt32 userPathCount;
Boolean alwaysSearchUserPaths;
Boolean convertPaths;
} CWAccessPathListInfo;
/* Relative path */
typedef struct CWRelativePath {
short version;
unsigned char pathType;
unsigned char pathFormat;
char userDefinedTree[256];
char pathString[512];
} CWRelativePath;
/* New project entry */
typedef struct CWNewProjectEntryInfo {
SInt32 position;
SInt32 segment;
SInt32 overlayGroup;
SInt32 overlay;
const char* groupPath;
Boolean mergeintooutput;
Boolean weakimport;
Boolean initbefore;
} CWNewProjectEntryInfo;
/* Overlay info */
typedef struct CWAddr64 {
SInt32 lo;
SInt32 hi;
} CWAddr64;
typedef struct CWOverlay1GroupInfo {
char name[256];
CWAddr64 address;
SInt32 numoverlays;
} CWOverlay1GroupInfo;
typedef struct CWOverlay1Info {
char name[256];
SInt32 numfiles;
} CWOverlay1Info;
typedef struct CWOverlay1FileInfo {
SInt32 whichfile;
} CWOverlay1FileInfo;
/* Framework info */
typedef struct CWFrameworkInfo {
CWFileSpec fileSpec;
char version[256];
} CWFrameworkInfo;
/* Drop-in flags */
typedef struct DropInFlags {
short rsrcversion;
CWDataType dropintype;
unsigned short earliestCompatibleAPIVersion;
UInt32 dropinflags;
CWDataType edit_language;
unsigned short newestAPIVersion;
} DropInFlags;
/* Panel list */
typedef struct CWPanelList {
short version;
short count;
const char** names;
} CWPanelList;
/* Compiler mapping */
typedef unsigned long CompilerMappingFlags;
typedef struct CWExtensionMapping {
CWDataType type;
char extension[32];
CompilerMappingFlags flags;
} CWExtensionMapping;
typedef struct CWExtMapList {
short version;
short nMappings;
CWExtensionMapping* mappings;
} CWExtMapList;
/* Target list */
typedef struct CWTargetList {
short version;
short cpuCount;
CWDataType* cpus;
short osCount;
CWDataType* oss;
} CWTargetList;
#pragma pack(pop)
#endif /* CW_TYPES_H */
+427
View File
@@ -0,0 +1,427 @@
/*
* host_ctx.h - Host context structures for mwccwrap
*
* This defines the CWPluginPrivateContext layout that the DLL expects,
* plus our host-side state.
*/
#ifndef HOST_CTX_H
#define HOST_CTX_H
#include "cw_types.h"
/*
* Memory handle implementation.
* CWMemHandle is a pointer to one of these.
*/
typedef struct CWMemHandlePrivateStruct {
void* data;
SInt32 size;
int locked;
} CWMemHandleImpl;
/*
* Access path entry
*/
typedef struct HostAccessPath {
char path[MAX_PATH];
Boolean recursive;
} HostAccessPath;
enum {
hostIncludeSearchProj = 0,
hostIncludeSearchSource = 1,
hostIncludeSearchExplicit = 2,
hostIncludeSearchInclude = 3
};
typedef struct HostFileRecord {
short fileID;
Boolean isSystem;
char path[MAX_PATH];
} HostFileRecord;
typedef struct HostIncludeRecord {
char path[MAX_PATH];
} HostIncludeRecord;
/* ============================================================
* Preference panel structs
*
* These match the binary layout the DLL reads via
* CWSecretGetNamedPreferences(). Adapted from the MWCC decomp
* pref_structs.h (CW Pro era). We use #pragma pack(1) to match
* the Win32 packing the DLL was compiled with.
* ============================================================ */
#pragma pack(push, 1)
/*
* "C/C++ Compiler" panel (332 bytes)
*/
typedef struct PFrontEndC {
SInt16 version; /* 0x00: current = 0x12 (18) */
Boolean cplusplus; /* 0x02 */
Boolean checkprotos; /* 0x03 */
Boolean arm; /* 0x04 */
Boolean trigraphs; /* 0x05 */
Boolean onlystdkeywords; /* 0x06 */
Boolean enumsalwaysint; /* 0x07 */
Boolean mpwpointerstyle; /* 0x08 */
unsigned char oldprefixname[32];/* 0x09: legacy, superseded by newprefixname in v10+ */
Boolean ansistrict; /* 0x29 */
Boolean mpwcnewline; /* 0x2A */
Boolean wchar_type; /* 0x2B */
Boolean enableexceptions; /* 0x2C */
Boolean dontreusestrings; /* 0x2D */
Boolean poolstrings; /* 0x2E */
Boolean dontinline; /* 0x2F */
Boolean useRTTI; /* 0x30 */
Boolean multibyteaware; /* 0x31 */
Boolean unsignedchars; /* 0x32 */
Boolean autoinline; /* 0x33 */
Boolean booltruefalse; /* 0x34 */
Boolean direct_to_som; /* 0x35 */
Boolean som_env_check; /* 0x36 */
Boolean alwaysinline; /* 0x37 */
SInt16 inlinelevel; /* 0x38 */
Boolean ecplusplus; /* 0x3A */
Boolean objective_c; /* 0x3B */
Boolean defer_codegen; /* 0x3C */
/* --- fields below are ignored by PS1 DLLs (they copy <= 62 bytes) --- */
Boolean templateparser; /* 0x3D */
Boolean c99; /* 0x3E */
Boolean bottomupinline; /* 0x3F */
unsigned char prefixname[256]; /* 0x40: Pascal string (byte 0 = length) */
UInt8 old_version; /* 0x140 */
Boolean warned_missing_cpp_panel;/* 0x141 */
Boolean gcc_extensions; /* 0x142 */
Boolean instance_manager; /* 0x143 */
UInt8 ipa_mode; /* 0x144 */
UInt8 reserved_145[7]; /* 0x145 */
} PFrontEndC;
/*
* "C/C++ Warnings" panel (34 bytes)
*/
typedef struct PWarningC {
SInt16 version; /* 0x00 */
Boolean warn_illpragma; /* 0x02 */
Boolean warn_emptydecl; /* 0x03 */
Boolean warn_possunwant; /* 0x04 */
Boolean warn_unusedvar; /* 0x05 */
Boolean warn_unusedarg; /* 0x06 */
Boolean warn_extracomma; /* 0x07 */
Boolean pedantic; /* 0x08 */
Boolean warningerrors; /* 0x09 */
Boolean warn_hidevirtual; /* 0x0A */
Boolean warn_implicitconv; /* 0x0B */
Boolean warn_notinlined; /* 0x0C */
Boolean warn_structclass; /* 0x0D */
Boolean warn_missingreturn; /* 0x0E */
Boolean warn_no_side_effect; /* 0x0F */
Boolean warn_resultnotused; /* 0x10 */
Boolean warn_padding; /* 0x11 */
Boolean warn_impl_i2f_conv; /* 0x12 */
Boolean warn_impl_f2i_conv; /* 0x13 */
Boolean warn_impl_s2u_conv; /* 0x14 */
Boolean warn_illtokenpasting; /* 0x15 */
Boolean warn_filenamecaps; /* 0x16 */
Boolean warn_filenamecapssystem; /* 0x17 */
Boolean warn_undefmacro; /* 0x18 */
Boolean warn_ptrintconv; /* 0x19 */
UInt8 reserved_1A[8]; /* 0x1A-0x21 */
} PWarningC;
/*
* "Global Optimizer" / "PS Global Optimizer" / "EPPC Global Optimizer"
* panel (12 bytes)
*/
typedef struct PGlobalOptimizer {
SInt16 version; /* 0x00 */
UInt8 optimizationlevel; /* 0x02: 0=off, 1-4=levels */
UInt8 optfor; /* 0x03: 0=default, 1=speed, 2=space */
UInt8 reserved[8]; /* 0x04-0x0B */
} PGlobalOptimizer;
/*
* "PPC EABI CodeGen" panel (58 bytes)
*/
typedef struct PPCEABICodeGen {
SInt16 version; /* 0x00 */
char structalignment; /* 0x02 */
UInt8 readonlystrings; /* 0x03 */
UInt8 pooldata; /* 0x04 */
UInt8 filler_05; /* 0x05 */
UInt8 profiler; /* 0x06 */
UInt8 filler_07; /* 0x07 */
UInt8 peephole; /* 0x08 */
UInt8 filler_09; /* 0x09 */
char filler_0A; /* 0x0A */
char scheduling; /* 0x0B */
UInt8 filler_0C; /* 0x0C */
UInt8 commonsect; /* 0x0D */
char floatingpoint; /* 0x0E */
UInt8 use_lmw_stmw; /* 0x0F */
SInt16 processor; /* 0x10 */
char function_align; /* 0x12 */
UInt8 fpcontract; /* 0x13 */
UInt8 altivec; /* 0x14 */
UInt8 vrsave; /* 0x15 */
UInt8 use_e500_fp; /* 0x16 */
UInt8 use_isel; /* 0x17 */
UInt8 use_fsel; /* 0x18 */
UInt8 volatileasm; /* 0x19 */
UInt8 strictfp; /* 0x1A */
UInt8 genfsel; /* 0x1B */
char processorname[16]; /* 0x1C */
UInt8 orderedfpcmp; /* 0x2C */
UInt8 altivec_move_block; /* 0x2D */
UInt8 linkerpoolstrings; /* 0x2E */
UInt8 poolconst; /* 0x2F */
UInt8 vectors; /* 0x30 */
UInt8 gen_vle; /* 0x31 */
UInt8 use_e500v2_fp; /* 0x32 */
UInt8 ppc_asm_to_vle; /* 0x33 */
UInt8 reserved_34[5]; /* 0x34-0x38 */
UInt8 reserved_39; /* 0x39 */
} PPCEABICodeGen;
/* static_assert: sizeof == 58 (0x3A) */
/*
* "PPC EABI Linker" panel (124 bytes)
*/
typedef struct PPCEABILinker {
SInt16 version; /* 0x00 */
UInt8 linksym; /* 0x02 */
UInt8 symfullpath; /* 0x03 */
UInt8 linkmap; /* 0x04 */
UInt8 nolinkwarnings; /* 0x05 */
UInt8 genSrecFile; /* 0x06 */
UInt8 linkunused; /* 0x07 */
UInt8 use_lcf; /* 0x08 */
UInt8 use_codeaddr; /* 0x09 */
UInt8 use_dataaddr; /* 0x0A */
UInt8 use_sdataaddr; /* 0x0B */
UInt8 use_sdata2addr; /* 0x0C */
UInt8 use_stackaddr; /* 0x0D */
UInt8 use_heapaddr; /* 0x0E */
UInt8 genROMimage; /* 0x0F */
UInt32 codeaddr; /* 0x10 */
UInt32 dataaddr; /* 0x14 */
UInt32 smalldataaddr; /* 0x18 */
UInt32 smalldata2addr; /* 0x1C */
UInt32 stackaddr; /* 0x20 */
UInt32 rambuffer; /* 0x24 */
UInt32 romimage_addr; /* 0x28 */
SInt16 srecLength; /* 0x2C */
UInt8 srecEOL; /* 0x2E */
UInt8 pad; /* 0x2F */
char mainname[64]; /* 0x30 */
UInt32 heapaddr; /* 0x70 */
UInt8 linkmode; /* 0x74 */
UInt8 listdwarf; /* 0x75 */
UInt8 listclosure; /* 0x76 */
UInt8 sortSrec; /* 0x77 */
UInt8 gen_bin_file; /* 0x78 */
UInt8 reserved2[3]; /* 0x79-0x7B */
} PPCEABILinker;
/* static_assert: sizeof == 124 (0x7C) */
/*
* "PPC EABI Project" panel (580 bytes)
*/
typedef struct PPCEABIProject {
SInt16 version; /* 0x00 */
SInt16 projtype; /* 0x02 */
char old_outfile[32]; /* 0x04 */
UInt32 heapsize; /* 0x24 */
UInt32 stacksize; /* 0x28 */
UInt8 bigendian; /* 0x2C */
UInt8 pad; /* 0x2D */
SInt16 datathreshold; /* 0x2E */
SInt16 sdata2threshold; /* 0x30 */
SInt16 codeModel; /* 0x32 */
UInt8 filler1; /* 0x34 */
UInt8 filler2; /* 0x35 */
UInt8 filler3; /* 0x36 */
UInt8 disable_extensions; /* 0x37 */
UInt8 deadstrip_partiallink; /* 0x38 */
UInt8 final_partiallink; /* 0x39 */
UInt8 resolved_partiallink; /* 0x3A */
char long_outfile[256]; /* 0x3B */
UInt8 abi_type; /* 0x13B */
UInt8 dwarf_version; /* 0x13C */
UInt8 tune_relocations; /* 0x13D */
UInt8 reserved_13E; /* 0x13E */
UInt8 reserved_13F[4]; /* 0x13F-0x142 */
char interpreter[256]; /* 0x143 */
} PPCEABIProject;
/* static_assert: sizeof == 580 (0x244) */
/*
* "C/C++ Preprocessor" panel (32790 bytes)
*/
typedef struct PPreprocessor {
SInt16 version; /* 0x00: current = 4 */
UInt8 emit_line; /* 0x02 */
UInt8 emit_fullpath; /* 0x03 */
UInt8 keep_comments; /* 0x04 */
UInt8 unused1; /* 0x05 */
UInt8 pch_uses_prefix_text; /* 0x06 */
UInt8 emit_pragmas; /* 0x07 */
UInt8 keep_whitespace; /* 0x08 */
UInt8 emit_file; /* 0x09 */
UInt8 multibyte_encoding; /* 0x0A */
UInt8 reserved_0B[11]; /* 0x0B-0x15 */
char prefix_text[32768]; /* 0x16-0x8015 */
} PPreprocessor;
/* static_assert: sizeof == 32790 (0x8016) */
/* ============================================================
* MIPS preference panel structs
* ============================================================ */
/* "MIPS CodeGen" panel (20 bytes) */
typedef struct PMIPSCodeGen {
SInt16 version; /* 0x00: ignored by DLL */
UInt8 structalignment; /* 0x02: struct alignment (bulk-copied, not individually read) */
UInt8 tracebacktables; /* 0x03: traceback tables (bulk-copied, not individually read) */
SInt16 processor; /* 0x04: processor type (overridden to 0x1000 for PSX in init) */
SInt16 fpuType; /* 0x06: FPU type: 0=none, 1=single, 2=double, 3=all */
SInt16 isaLevel; /* 0x08: MIPS ISA level (I/II/III/IV) */
UInt8 multibyteAware; /* 0x0A: multibyte string handling */
UInt8 peephole; /* 0x0B: peephole optimization enable */
UInt8 reserved_0C; /* 0x0C: unused */
UInt8 useIntrinsics; /* 0x0D: inline intrinsics for strcpy/memcpy/etc */
UInt8 reserved_0E; /* 0x0E: unused */
UInt8 reserved_0F; /* 0x0F: unused */
UInt32 reserved_10; /* 0x10: stored but never read */
} PMIPSCodeGen;
/* "MIPS Linker Panel" (340 bytes) */
typedef struct PMIPSLinker {
SInt16 version; /* 0x00 */
UInt8 reserved_02; /* 0x02 */
UInt8 reserved_03; /* 0x03 */
UInt8 reserved_04; /* 0x04 */
UInt8 genOutput; /* 0x05: controls linker output behavior */
UInt8 reserved_06[334]; /* 0x06..0x153 */
} PMIPSLinker;
/* "MIPS Project" (60 bytes) */
typedef struct PMIPSProject {
SInt16 version; /* 0x00 */
UInt8 reserved_02; /* 0x02 */
UInt8 reserved_03; /* 0x03 */
SInt16 projectSetting; /* 0x04: project-level setting */
UInt8 reserved_06[54]; /* 0x06..0x3B */
} PMIPSProject;
#pragma pack(pop)
/* Maximum size of the accumulated define/pragma text buffer */
#define DEFINE_TEXT_MAX (64 * 1024)
/* Virtual prefix file name used for command-line defines/pragmas */
#define CMDLINE_DEFINES_VFILE "(command-line defines)"
/*
* CWPluginPrivateContext - the context structure passed to the DLL.
*
* The DLL does not read this struct directly, so we store our host state here.
*/
typedef struct CWPluginPrivateContext {
SInt32 request;
SInt32 apiVersion;
SInt32 numFiles;
SInt32 whichFile;
/* Source file */
char sourceFile[MAX_PATH];
char* sourceText;
SInt32 sourceTextSize;
/* Output */
char outputFile[MAX_PATH];
void* objectData;
SInt32 objectDataSize;
CWObjectData storedObject;
int objectStored;
/* Include paths */
HostAccessPath* userPaths;
SInt32 userPathCount;
HostAccessPath* systemPaths;
SInt32 systemPathCount;
/* Include search behavior */
SInt16 includeSearchMode; /* hostIncludeSearch* */
Boolean noSysPath; /* -nosyspath */
Boolean useDefaultIncludes; /* -stdinc / -defaults */
Boolean searchPaths; /* -search */
Boolean gccIncludes; /* -gccincludes set */
Boolean usedDashIMinus; /* -I- seen */
/*
* Typed preference structs.
*/
PFrontEndC prefsFrontEnd;
PWarningC prefsWarnings;
PGlobalOptimizer prefsOptimizer;
/* MIPS-specific panels */
PMIPSCodeGen prefsMIPSCodeGen;
PMIPSLinker prefsMIPSLinker;
PMIPSProject prefsMIPSProject;
UInt8 prefsMIPSCodeGenPanel[sizeof(PMIPSCodeGen)];
UInt8 prefsMIPSLinkerPanel[sizeof(PMIPSLinker)];
Boolean prefsMIPSCodeGenR4Compat;
/* PPC EABI-specific panels */
PPCEABICodeGen prefsPPCCodeGen;
PPCEABILinker prefsPPCLinker;
PPCEABIProject prefsPPCProject;
PPreprocessor prefsPreprocessor;
/* Define/pragma text exposed as a virtual prefix file */
char* defineText; /* accumulated #define/#undef/#pragma/#include lines */
SInt32 defineTextLen;
/* Flags from command line */
int preprocess; /* -E flag */
int preprocessOnly; /* -P flag (preprocess to file, no line markers) */
int disassemble; /* -dis / -disassemble / -S */
int disassembleToFile; /* -S */
int debugInfo; /* -g flag */
int verbose; /* -v flag */
int noWarnings; /* -w off */
int warningsAreErrors; /* -w err / -Werror */
int maxErrors; /* -maxerrors N (0=unlimited) */
int maxWarnings; /* -maxwarnings N (0=unlimited) */
int msgStyle; /* 0=std, 1=gcc, 2=parseable */
int noFail; /* -nofail (continue after per-file failures) */
int forceIncludeOnce; /* -once / -notonce host-side compatibility */
int dependencyMode; /* 0=off, 1=deps-only (-M/-MM/-make), 2=deps+compile (-MD/-MMD) */
int depsOnlyUserFiles; /* -MM / -MMD */
char dependencyOutputFile[MAX_PATH]; /* -o makefile path for deps-only mode */
/* Error tracking */
int numErrors;
int numWarnings;
/* File ID counter for includes */
short nextFileID;
HostFileRecord* fileRecords;
SInt32 fileRecordCount;
SInt32 fileRecordCap;
char lastIncludeDir[MAX_PATH];
HostIncludeRecord* includeRecords;
SInt32 includeRecordCount;
SInt32 includeRecordCap;
/* Preprocessed output text */
char* preprocessedText;
SInt32 preprocessedTextSize;
} CWPluginPrivateContext;
#endif /* HOST_CTX_H */
+2532
View File
File diff suppressed because it is too large Load Diff
+1882
View File
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
LIBRARY PluginLib2
EXPORTS
; Custom exports for mwccwrap
MWCC_InitStringTable
; CW Plugin Core (8000-8034)
CWGetPluginRequest @8000
CWDonePluginRequest @8001
CWGetAPIVersion @8002
CWGetProjectFile @8005
CWGetProjectFileCount @8007
CWFindAndLoadFile @8009
CWGetFileText @8010
CWReleaseFileText @8011
CWReportMessage @8017
CWSetModDate @8024
CWCreateNewTextDocument @8026
CWAllocMemHandle @8029
CWFreeMemHandle @8030
CWLockMemHandle @8033
CWUnlockMemHandle @8034
; CW Compiler-Specific (9000-9033)
CWSecretAttachHandle @9000
CWIsPrecompiling @9003
CWIsAutoPrecompiling @9004
CWIsPreprocessing @9005
CWIsGeneratingDebugInfo @9006
CWIsCachingPrecompiledHeaders @9007
CWGetBrowseOptions @9008
CWGetMainFileNumber @9012
CWGetMainFileID @9013
CWGetMainFileSpec @9014
CWGetMainFileText @9015
CWCachePrecompiledHeader @9016
CWLoadObjectData @9017
CWStoreObjectData @9019
CWDisplayLines @9020
CWGetPrecompiledHeaderSpec @9023
CWSecretGetNamedPreferences @9033
+93
View File
@@ -0,0 +1,93 @@
LIBRARY PluginLib3
EXPORTS
; Custom exports for mwccwrap
MWCC_InitStringTable
; COS Handle Management (2000-2007)
COS_NewHandle @2000
COS_NewOSHandle @2001
COS_FreeHandle @2002
COS_ResizeHandle @2003
COS_LockHandle @2005
COS_LockHandleHi @2006
COS_UnlockHandle @2007
; COS File I/O (2101-2113)
COS_FileNew @2101
COS_FileOpen @2102
COS_FileGetType @2103
COS_FileGetSize @2104
COS_FileRead @2105
COS_FileWrite @2106
COS_FileGetPos @2107
COS_FileSetPos @2108
COS_FileClose @2109
COS_FileSetFSSpec @2110
COS_FileGetFSSpecInfo @2112
COS_FileGetPathName @2113
; COS Utility (2201-2205)
COS_GetTicks @2201
COS_GetString @2203
COS_IsMultiByte @2205
; CW Plugin Core (8000-8034)
CWGetPluginRequest @8000
CWDonePluginRequest @8001
CWGetAPIVersion @8002
CWGetProjectFile @8005
CWGetOutputFileDirectory @8006
CWGetProjectFileCount @8007
CWGetFileInfo @8008
CWFindAndLoadFile @8009
CWGetFileText @8010
CWReleaseFileText @8011
CWGetOverlay1GroupsCount @8013
CWGetOverlay1GroupInfo @8014
CWGetOverlay1Info @8015
CWGetOverlay1FileInfo @8016
CWReportMessage @8017
CWAlert @8018
CWShowStatus @8019
CWUserBreak @8020
CWGetNamedPreferences @8021
CWSetModDate @8024
CWCreateNewTextDocument @8026
CWAllocateMemory @8027
CWFreeMemory @8028
CWAllocMemHandle @8029
CWFreeMemHandle @8030
CWGetMemHandleSize @8031
CWResizeMemHandle @8032
CWLockMemHandle @8033
CWUnlockMemHandle @8034
; CW Licensing (8037-8038, R5+)
CWCheckoutLicense @8037
CWCheckinLicense @8038
; CW Compiler-Specific (9000-9034)
CWSecretAttachHandle @9000
; CWSecretDetachHandle @9001
CWSecretPeekHandle @9002
CWIsPrecompiling @9003
CWIsAutoPrecompiling @9004
CWIsPreprocessing @9005
CWIsGeneratingDebugInfo @9006
CWIsCachingPrecompiledHeaders @9007
CWGetBrowseOptions @9008
CWGetBuildSequenceNumber @9009
CWGetTargetInfo @9010
CWSetTargetInfo @9011
CWGetMainFileNumber @9012
CWGetMainFileID @9013
CWGetMainFileSpec @9014
CWGetMainFileText @9015
CWCachePrecompiledHeader @9016
CWLoadObjectData @9017
CWFreeObjectData @9018
CWStoreObjectData @9019
CWDisplayLines @9020
CWGetPrecompiledHeaderSpec @9023
CWSecretGetNamedPreferences @9033
CWGetTargetName @9034
+54
View File
@@ -0,0 +1,54 @@
LIBRARY PluginLib5
EXPORTS
CWAllocMemHandle @55
CWAllocateMemory @56
CWCachePrecompiledHeader @59
CWCheckinLicense @60
CWCheckoutLicense @61
CWCreateNewTextDocument @64
CWDisplayLines @65
CWDonePluginRequest @67
CWFindAndLoadFile @70
CWFindLogicalDirectory @71
CWFreeMemHandle @72
CWFreeMemory @73
CWFreeObjectData @74
CWGetAPIVersion @75
CWGetBrowseOptions @82
CWGetCompilerQuery @92
CWGetFileInfo @98
CWGetFileText @99
CWGetMainFileID @109
CWGetMainFileNumber @110
CWGetMainFileSpec @111
CWGetMainFileText @112
CWGetMemHandleSize @113
CWGetNamedPreferences @116
CWGetPluginData @124
CWGetPluginRequest @125
CWGetPrecompiledHeaderSpec @126
CWGetProjectFile @127
CWGetProjectFileCount @128
CWGetSuggestedObjectFileSpec @136
CWGetTargetInfo @138
CWGetTargetName @139
CWIsAutoPrecompiling @146
CWIsCachingPrecompiledHeaders @147
CWIsCheckingSyntax @148
CWIsGeneratingDebugInfo @150
CWIsPrecompiling @151
CWIsPreprocessing @152
CWIsUsingSourceRelativeIncludes @154
CWLoadObjectData @155
CWLockMemHandle @156
CWOpenFileInEditor @158
CWReleaseFileText @232
CWReportMessage @235
CWResizeMemHandle @236
CWSetFileDirty @242
CWSetModDate @247
CWShowStatus @257
CWStoreObjectData @258
CWStorePluginData @259
CWUnlockMemHandle @263
CWUserBreak @264
+25
View File
@@ -0,0 +1,25 @@
/* More complex test for mwccwrap */
static int global_counter = 0;
int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n - 1);
}
void increment(void) {
global_counter++;
}
int get_counter(void) {
return global_counter;
}
int sum_array(int *arr, int count) {
int total = 0;
int i;
for (i = 0; i < count; i++) {
total += arr[i];
}
return total;
}