Esempio n. 1
0
File: env.c Progetto: berkus/moto
void
moto_emitCFunctions(MotoEnv *env, StringBuffer *out) {
    Enumeration* e;

    buf_puts(out, "/* BEGIN GENERATED FUNCTION DEFINITIONS */\n\n");
    e = htab_getKeys(env->fdefs);
    while (enum_hasNext(e)) {
        MotoFunction *f = (MotoFunction *)enum_next(e);
        buf_puts(out, mfn_cprototype(f));
        buf_puts(out, "{\n");
        buf_puts(out,(char*)htab_get(env->fdefs,f));
        buf_puts(out, "}\n\n");
    }
    buf_puts(out, "/* END GENERATED FUNCTION DEFINITIONS */\n\n");

    buf_puts(out, "/* BEGIN GENERATED ANONYMOUS FUNCTION DEFINITIONS */\n\n");
    e = htab_getKeys(env->adefs);
    while (enum_hasNext(e)) {
        MotoFunction *f = (MotoFunction *)enum_next(e);
        buf_puts(out, mfn_cprototype(f));
        buf_puts(out, "{\n");
        buf_puts(out,(char*)htab_get(env->adefs,f));
        buf_puts(out, "}\n\n");
    }
    buf_puts(out, "/* END GENERATED ANONYMOUS FUNCTION DEFINITIONS */\n\n");
}
Esempio n. 2
0
bool
htab_contains(htab *ht, void *key) {
   if (htab_get(ht, key) != NULL) {
      return true;
   }

   return false;
}