Browse Source

Some small cleanup

GeneralDependencyResolver
Macoy Madson 1 month ago
parent
commit
992170fbb0
3 changed files with 21 additions and 18 deletions
  1. +16
    -13
      runtime/TextAdventure.cake
  2. +1
    -2
      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))

+ 1
- 2
src/Evaluator.cpp View File

@@ -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