congdm / Patchouli-Compiler

An Oberon-07 compiler for Intel 64 (AMD64) architecture
65 stars 9 forks source link

Too many exported types #10

Open r-k-o opened 7 years ago

r-k-o commented 7 years ago

the compiler quits on winapi

with

Compile winapi.mod file pos 401631: Too many exported types

adding some more exports brings: file pos 524287: No :

congdm commented 7 years ago

That means there are over 1024 export types in your module. If you want more, just change the const MaxExpTypes in Base module of the compiler, however, I don't recommend doing so because compiling time may be high.

r-k-o commented 7 years ago

i did: MaxExpTypes* = 16384;

i did not help. i can compile a few lines more but it will bring up "file pos xxxxxxx: No :". maybe there is an other place that has to changed too. so i changed MaxRecTypes* = 16384 - but that did not help either.

r-k-o commented 7 years ago

doubled the 2 constants again and now i get:

file pos 524287: param section?

and position being in line "CharToOemBuffW*: PROCEDURE(lpszSrc: PtrWSTR; lpszDst: PtrSTR; cchDstLength: INTEGER): BOOL;"

position at "PtrSTR" which is

PtrSTR* = INTEGER;

after trippling the constants values the error persists

congdm commented 7 years ago

This is due to Parser module, not Base, so could you attach the source code?

r-k-o commented 7 years ago

WinApi.mod.txt

congdm commented 7 years ago

Ah, I remember that I also limit the size of input source code, just change the buffer array in Scanner module. Also the size of code array in Generator too.

congdm commented 7 years ago

And why don't you break the WinAPI module into smaller modules, because not every program will use all of Win32 API, and the interface cost will be large.

r-k-o commented 7 years ago

yes, i should split, but for learning that stuff i thought it would be easier going this way first.

r-k-o commented 7 years ago

i know i am pestering you, but now i have a different error. i user the version before the "New Mark and Sweep algorithm". i compile the winapi, where i commented out huge portions. i compile the wintest and start the exe. a messagebox pops up showing "Error code: 8; Source pos 700104". this position is the end of file? WinApi.mod.txt wintest.mod.txt

congdm commented 7 years ago

No problem at all =) Error Code 8 means this module cannot find RTL.DLL You should add the pragma (*$RTL-*) to both WinApi.mod and Wintest.mod, because they didn't need Oberon Run Time Library. For example, check Oberon07.Rtl.mod in my compiler, that module run on bare Win32.

r-k-o commented 7 years ago

thanx for the help and also for the new integers.

stepchuks9 commented 7 years ago

How can I start using the compiler on my windows

congdm commented 7 years ago

@stepchuks9 To start using it, just create your sourcefile in test folder, for example MyModule.mod, edit the Buildfile in test folder to add your module into it, and run the buildtest.bat

See the examples in test folder!

stepchuks9 commented 7 years ago

thanks

stepchuks9 commented 7 years ago

How do I write an array of strings. VAR a: ARRAY 10 OF ARRAY 12 OF CHAR; gives me a 2-dimensional array of char. Is there a way to get something simpler than VAR a: ARRAY 10 OF RECORD b: ARRAY 12 OF CHAR END;

congdm commented 7 years ago

@stepchuks9 I believe VAR a: ARRAY 10 OF ARRAY 12 OF CHAR also counted as array of strings, for example, this code:

VAR a: ARRAY 10 OF ARRAY 12 OF CHAR;

PROCEDURE ReadString(VAR str: ARRAY OF CHAR);
BEGIN (* do something *)
END ReadString;

BEGIN
   ReadString(a[0])
END Module.

works.

stepchuks9 commented 7 years ago

Thanks again.