2 Commits

Author SHA1 Message Date
  Macoy Madson b70ca47484 Small format change 1 month ago
  Macoy Madson 992170fbb0 Some small cleanup 1 month ago
3 changed files with 22 additions and 19 deletions
Split View
  1. +16
    -13
      runtime/TextAdventure.cake
  2. +2
    -3
      src/Evaluator.cpp
  3. +4
    -3
      src/Main.cpp

+ 16
- 13
runtime/TextAdventure.cake View File

@@ -54,18 +54,21 @@
(printf "> ")
(set input (getchar))

(when (= input 'r')
(return true))
(when (= input 'h')
(print-help))
(when (call (in std isdigit) input)
(var room-request int (atoi (addr input)))
(var num-rooms int (on-call (path current-room > connected-rooms) size))
(unless (and num-rooms (< room-request num-rooms))
(printf "I don't know where that is. There are %d rooms\n" num-rooms)
(continue))
(printf "Going to room %d\n" room-request)
(set current-room (addr (at room-request
(path current-room > connected-rooms))))))
(cond
((= input 'r')
(return true))
((= input 'h')
(print-help))
((call (in std isdigit) input)
(var room-request int (atoi (addr input)))
(var num-rooms int (on-call (path current-room > connected-rooms) size))
(unless (and num-rooms (< room-request num-rooms))
(printf "I don't know where that is. There are %d rooms\n" num-rooms)
(continue))
(printf "Going to room %d\n" room-request)
(set current-room (addr (at room-request
(path current-room > connected-rooms)))))
(true
(print-help))))

(return false))

+ 2
- 3
src/Evaluator.cpp View File

@@ -764,7 +764,7 @@ int BuildEvaluateReferences(EvaluatorEnvironment& environment, int& numErrorsOut

// TODO: Get arguments all the way from the top
// If not null terminated, the call will fail
const char* arguments[] = {fileToExec, "-g", "-c", sourceOutputName, "-o",
const char* arguments[] = {fileToExec, "-g", "-c", sourceOutputName, "-o",
buildObjectName, headerInclude, "-fPIC", nullptr};
RunProcessArguments compileArguments = {};
compileArguments.fileToExecute = fileToExec;
@@ -975,8 +975,7 @@ bool EvaluateResolveReferences(EvaluatorEnvironment& environment)
if (isCompileTimeObject(definition.type))
{
// TODO: Add ready-build runtime function check
if (!findMacro(environment, definition.name->contents.c_str()) &&
!findGenerator(environment, definition.name->contents.c_str()))
if (!isCompileTimeCodeLoaded(environment, definition))
{
// TODO: Add note for who required the object
ErrorAtToken(*definition.name, "Failed to build required object");


+ 4
- 3
src/Main.cpp View File

@@ -17,9 +17,10 @@ struct CommandLineOption
void printHelp(const CommandLineOption* options, int numOptions)
{
const char* helpString =
"OVERVIEW: Cakelisp transpiler\n\n"
"Cakelisp is a transpiler which generates C/C++ from a Lisp dialect.\n"
"Created by Macoy Madson <macoy@macoy.me>.\nhttps://macoy.me/code/macoy/cakelisp\n\n"
"OVERVIEW: Cakelisp\n\n"
"Cakelisp is a transpiler/compiler which generates C/C++ from a Lisp dialect.\n\n"
"Created by Macoy Madson <macoy@macoy.me>.\nhttps://macoy.me/code/macoy/cakelisp\n"
"Copyright (c) 2020 Macoy Madson.\n\n"
"USAGE: cakelisp [options] <input .cake files>\nAll options must precede .cake files.\n\n"
"OPTIONS:\n";
printf("%s", helpString);


Loading…
Cancel
Save