Skip to content

Commit f6dd5d4

Browse files
committed
Add WIP Metadata system
This is going to be used for automatic documentation systems. By keeping the documentation in the code, Cakelisp can be somewhat self-documenting.
1 parent e123b33 commit f6dd5d4

16 files changed

+467
-5
lines changed

Bootstrap.cake

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"ModuleManager.cpp"
1919
"Logging.cpp"
2020
"Build.cpp"
21+
"Metadata.cpp"
2122
"Main.cpp")
2223

2324
(add-build-options "-DUNIX" "-Wall" "-Werror" "-std=c++11")

Bootstrap_MSVC.cake

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"ModuleManager.cpp"
1919
"Logging.cpp"
2020
"Build.cpp"
21+
"Metadata.cpp"
2122
"Main.cpp")
2223

2324
(add-build-options "/nologo" "/DWINDOWS" "/DCAKELISP_EXPORTING" "/EHsc"

Build.bat

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CL.exe src/Tokenizer.cpp ^
3939
src/ModuleManager.cpp ^
4040
src/Logging.cpp ^
4141
src/Build.cpp ^
42+
src/Metadata.cpp ^
4243
src/Main.cpp ^
4344
/EHsc /MP /DWINDOWS /DCAKELISP_EXPORTING ^
4445
/Fe"bin\cakelisp_bootstrap" /Zi /Fd"bin\cakelisp_bootstrap.pdb" /DEBUG:FASTLINK

Build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ else
2929
src/ModuleManager.cpp \
3030
src/Logging.cpp \
3131
src/Build.cpp \
32+
src/Metadata.cpp \
3233
src/Main.cpp \
3334
-DUNIX || exit $?
3435
# Need -ldl for dynamic loading, --export-dynamic to let compile-time functions resolve to

BuildAndRunTests.sh

+2
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
# Make sure Cakelisp is up to date
44
. ./Build.sh || exit $?
55

6+
./bin/cakelisp --list-built-ins-details || exit $?
7+
68
./bin/cakelisp runtime/Config_Linux.cake test/RunTests.cake || exit $?

Build_RunTests.bat

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CL.exe src/Tokenizer.cpp ^
3939
src/ModuleManager.cpp ^
4040
src/Logging.cpp ^
4141
src/Build.cpp ^
42+
src/Metadata.cpp ^
4243
src/Main.cpp ^
4344
/EHsc /MP /DWINDOWS /DCAKELISP_EXPORTING ^
4445
/Fe"bin\cakelisp_bootstrap" /Zi /Fd"bin\cakelisp_bootstrap.pdb" /DEBUG:FASTLINK

Build_SimpleMacros.bat

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CL.exe src/Tokenizer.cpp ^
3939
src/ModuleManager.cpp ^
4040
src/Logging.cpp ^
4141
src/Build.cpp ^
42+
src/Metadata.cpp ^
4243
src/Main.cpp ^
4344
/EHsc /MP /DWINDOWS /DCAKELISP_EXPORTING ^
4445
/Fe"bin\cakelisp_bootstrap" /Zi /Fd"bin\cakelisp_bootstrap.pdb" /DEBUG:FASTLINK

CrossCompile_Windows.cake

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"ModuleManager.cpp"
1919
"Logging.cpp"
2020
"Build.cpp"
21+
"Metadata.cpp"
2122
"Main.cpp")
2223

2324
(add-build-options "-DWINDOWS" "-DMINGW" "-DCAKELISP_EXPORTING")

VisualStudio/Cakelisp/Cakelisp.vcxproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
<ClCompile Include="..\..\src\Generators.cpp" />
158158
<ClCompile Include="..\..\src\Logging.cpp" />
159159
<ClCompile Include="..\..\src\Main.cpp" />
160+
<ClCompile Include="..\..\src\Metadata.cpp" />
160161
<ClCompile Include="..\..\src\ModuleManager.cpp" />
161162
<ClCompile Include="..\..\src\OutputPreambles.cpp" />
162163
<ClCompile Include="..\..\src\RunProcess.cpp" />
@@ -170,4 +171,4 @@
170171
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
171172
<ImportGroup Label="ExtensionTargets">
172173
</ImportGroup>
173-
</Project>
174+
</Project>

VisualStudio/Cakelisp/Cakelisp.vcxproj.filters

+4-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
</ClCompile>
104104
<ClCompile Include="..\..\src\Logging.cpp">
105105
<Filter>Source Files</Filter>
106+
</ClCompile>
107+
<ClCompile Include="..\..\src\Metadata.cpp">
108+
<Filter>Source Files</Filter>
106109
</ClCompile>
107110
<ClCompile Include="..\..\src\Main.cpp">
108111
<Filter>Source Files</Filter>
@@ -132,4 +135,4 @@
132135
<ItemGroup>
133136
<None Include="..\..\src\Jamfile" />
134137
</ItemGroup>
135-
</Project>
138+
</Project>

doc/Cakelisp.org

+1
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ If ~global~ is specified instead, all modules and build dependencies would inclu
432432
"ModuleManager.cpp"
433433
"Logging.cpp"
434434
"Build.cpp"
435+
"Metadata.cpp"
435436
"Main.cpp")
436437
#+END_SRC
437438

src/Generators.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2910,8 +2910,8 @@ bool CStatementGenerator(EvaluatorEnvironment& environment, const EvaluatorConte
29102910
{"bit->>", bitwiseRightShift, ArraySize(bitwiseRightShift)},
29112911
{"=", relationalEquality, ArraySize(relationalEquality)},
29122912
{"!=", relationalNotEqual, ArraySize(relationalNotEqual)},
2913-
{"eq", relationalEquality, ArraySize(relationalEquality)},
2914-
{"neq", relationalNotEqual, ArraySize(relationalNotEqual)},
2913+
// {"eq", relationalEquality, ArraySize(relationalEquality)},
2914+
// {"neq", relationalNotEqual, ArraySize(relationalNotEqual)},
29152915
{"<=", relationalLessThanEqual, ArraySize(relationalLessThanEqual)},
29162916
{">=", relationalGreaterThanEqual, ArraySize(relationalGreaterThanEqual)},
29172917
{"<", relationalLessThan, ArraySize(relationalLessThan)},
@@ -3085,7 +3085,7 @@ void importFundamentalGenerators(EvaluatorEnvironment& environment)
30853085
// Bitwise
30863086
"bit-or", "bit-and", "bit-xor", "bit-ones-complement", "bit-<<", "bit->>",
30873087
// Relational
3088-
"=", "!=", "eq", "neq", "<=", ">=", "<", ">",
3088+
"=", "!=", /*"eq", "neq",*/ "<=", ">=", "<", ">",
30893089
// Arithmetic
30903090
"+", "-", "*", "/", "%", "mod", "++", "--", "incr", "decr"};
30913091
for (size_t i = 0; i < ArraySize(cStatementKeywords); ++i)

src/Main.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include <vector>
55

66
#include "FileUtilities.hpp"
7+
#include "Generators.hpp"
78
#include "Logging.hpp"
9+
#include "Metadata.hpp"
810
#include "ModuleManager.hpp"
911
#include "RunProcess.hpp"
1012
#include "Utilities.hpp"
@@ -55,6 +57,7 @@ int main(int numArguments, char* arguments[])
5557
bool executeOutput = false;
5658
bool skipBuild = false;
5759
bool listBuiltInGeneratorsThenQuit = false;
60+
bool listBuiltInGeneratorMetadataThenQuit = false;
5861
bool waitForDebugger = false;
5962

6063
const CommandLineOption options[] = {
@@ -70,6 +73,8 @@ int main(int numArguments, char* arguments[])
7073
{"--list-built-ins", &listBuiltInGeneratorsThenQuit,
7174
"List all built-in compile-time procedures, then exit. This list contains every procedure "
7275
"you can possibly call, until you import more or define your own"},
76+
{"--list-built-ins-details", &listBuiltInGeneratorMetadataThenQuit,
77+
"List all built-in compile-time procedures and a brief explanation of each, then exit."},
7378
{"--wait-for-debugger", &waitForDebugger,
7479
"Wait for a debugger to be attached before starting loading and evaluation"},
7580
// Logging
@@ -181,6 +186,15 @@ int main(int numArguments, char* arguments[])
181186
Log("attached\n");
182187
}
183188

189+
if (listBuiltInGeneratorMetadataThenQuit)
190+
{
191+
EvaluatorEnvironment environment;
192+
importFundamentalGenerators(environment);
193+
printBuiltInGeneratorMetadata(&environment);
194+
195+
return 0;
196+
}
197+
184198
if (listBuiltInGeneratorsThenQuit)
185199
{
186200
listBuiltInGenerators();

0 commit comments

Comments
 (0)