A bit of cleanup and warning-hushing.
This commit is contained in:
parent
ac04fa1a96
commit
2fb6643326
|
@ -37,12 +37,14 @@ Object fetchFromEnvironment(const char* name, struct Environment* env)
|
|||
}
|
||||
|
||||
for (int i = 0; i < env->capacity; i++) {
|
||||
if (env->strings[i] == NULL) { printd("Try %d (NULL)\n", i);
|
||||
if (env->strings[i] == NULL) {
|
||||
printd("Try %d (NULL)\n", i);
|
||||
break;
|
||||
}
|
||||
|
||||
printd("Try %d (%s)\n", i, env->strings[i]);
|
||||
if (strcmp(name, env->strings[i]) == 0) { printd("Returning!\n");
|
||||
if (strcmp(name, env->strings[i]) == 0) {
|
||||
printd("Returning!\n");
|
||||
return cloneObject(env->objects[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -680,7 +680,7 @@ inline Object numberObject(int num)
|
|||
inline Object boolObject(int b)
|
||||
{
|
||||
Object o = newObject(TYPE_BOOL);
|
||||
o.number = !!b;
|
||||
o.number = b != 0;
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifdef DEBUG
|
||||
#define printd(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define printd(...) ;
|
||||
#define printd(...) do { } while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "tokens.h"
|
||||
#include "plfunc.h"
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#define fnn(_name, _docs, ...) \
|
||||
static const char * const _name ## Doc = _docs; \
|
||||
static const char * const _name ## Tests[] = {__VA_ARGS__}; \
|
||||
__attribute__((unused)) static const char * const _name ## Tests[] = {__VA_ARGS__}; \
|
||||
_Static_assert(array_length(_name ## Tests) % 2 == 0, "Array of test strings must have exactly one expected result for each test."); \
|
||||
Object _name(Object* params, int length, struct Environment* env)
|
||||
|
||||
|
@ -53,8 +53,6 @@ Object parseEval(const char* input, struct Environment* env);
|
|||
|
||||
Object evalList(const Object* obj, struct Environment* env);
|
||||
|
||||
void copySlice(char* dest, struct Slice* src);
|
||||
|
||||
Object evalLambdaArgs(const Object* arg_forms, struct Environment* env);
|
||||
|
||||
Object listEvalLambda(Object* lambda, const Object* remaining, int evalLength,
|
||||
|
|
27
src/pebcom.c
27
src/pebcom.c
|
@ -2,33 +2,6 @@
|
|||
|
||||
#include <pebble.h>
|
||||
|
||||
struct tm* getTime()
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
return localtime(&t);
|
||||
}
|
||||
|
||||
Object getSeconds(Object o1, Object o2, struct Environment* env)
|
||||
{
|
||||
return numberObject(getTime()->tm_sec);
|
||||
}
|
||||
|
||||
Object getMinutes(Object o1, Object o2, struct Environment* env)
|
||||
{
|
||||
return numberObject(getTime()->tm_min);
|
||||
}
|
||||
|
||||
Object getHours(Object o1, Object o2, struct Environment* env)
|
||||
{
|
||||
return numberObject(getTime()->tm_hour);
|
||||
}
|
||||
|
||||
Object getTwelveHours(Object o1, Object o2, struct Environment* env)
|
||||
{
|
||||
int hour = (getTime()->tm_hour % 12) ?: 12;
|
||||
return numberObject(hour);
|
||||
}
|
||||
|
||||
Object doVibe(Object patternList, Object o2, struct Environment* env)
|
||||
{
|
||||
int length = listLength(&patternList);
|
||||
|
|
Loading…
Reference in New Issue