--- a/pas2CTutorial.wiki Fri Oct 11 20:45:02 2019 +0100
+++ b/pas2CTutorial.wiki Fri Oct 11 21:00:37 2019 +0100
@@ -1,9 +1,41 @@
#labels Phase-Implementation
-==Automatic==
+==Introduction==
+Pas2C is an alternative way to build the engine. It is disabled by default.
+
+Pas2C is intended to be used when building the engine natively (e.g. with !FreePascal) fails for some reason. However, Pas2C does have some limitations and you should try to first build Hedgewars normally before attempting a Pas2C build.
+
+Pas2C is our hand-written Pascal-to-C-compiler. It works by converting all Pascal code to C, and then compiling the C code.
+
+==Limitations==
+
+The Pas2C build currently doesn't support the video recorder. A warning will be printed if you try to build a Pas2C build with video recorder support anyway.
+
+== Building ==
+===Caveats===
+Note! In version 1.0.0, if your `LOCALE` is set to `C`, building will fail with an error like this:
+
+```
+Preprocessing 'uSound.pas'... pas2c: /builddir/build/BUILD/hedgewars-src-1.0.0/hedgewars/uSound.pas: hGetContents: invalid argument (invalid byte sequence)
+```
+
+This is because Wuzzy accidentally added unicode characters in the Pascal source code, something which Pas2C doesn't like.
+
+If you have this problem, run this shell script in the root of the source directory before building:
+
+```
+for file in hedgewars/uSound.pas hedgewars/uStats.pas; do
+ iconv -f utf-8 -t ascii//TRANSLIT $file -o $file.tmp;
+ mv $file.tmp $file;
+done
+```
+
+This will be fixed in the next version.
+
+===Automatic===
Configure with `cmake -DBUILD_ENGINE_C=1` and then run `make`.
-==Manual run==
+===Manual run===
Run from the `tools` folder
{{{
@@ -17,10 +49,12 @@
Use `clang` to compile, `gcc` compatibility is not yet achieved. We are curious to hear about `icc` and `msvc` (not that we expect anything...)
==Development==
-There are some special file that you need to know
+There are some special files that you need to know:
- * project_files/hwc/rtl/fpcrtl.h - contains definitions of external functions defined inside custom pascal units (eg SDLh.pas);
- * hedgewars/pas2cSystem.pas - contains definitions of external functions defined outside our own pascal units (eg png and gl units, bundled with freepascal);
- * hedgewars/pas2cRedo.pas - contains definitions of internal fpc units (provided by the 'rtl') which get a fpcrtl_ prefix.
+ * `project_files/hwc/rtl/fpcrtl.h` - contains definitions of external functions defined inside custom pascal units (e.g. `SDLh.pas`);
+ * `hedgewars/pas2cSystem.pas` - contains definitions of external functions defined outside our own pascal units (e.g. png and gl units, bundled with !FreePascal);
+ * `hedgewars/pas2cRedo.pas` - contains definitions of internal fpc units (provided by the `rtl`) which get a `fpcrtl_` prefix.
-If you need to hide portions of code from pas2c just wrap it with `${IFNDEF PAS2C}...{$ENDIF}`
\ No newline at end of file
+If you need to hide portions of code from Pas2C just wrap it with `${IFNDEF PAS2C}...{$ENDIF}`.
+
+To ensure compability with Pas2C, you also must obey the rules stated here: [PascalSyntax]
\ No newline at end of file