Exemple #1
0
void emu_options::update_cached_options()
{
	m_coin_impulse = int_value(OPTION_COIN_IMPULSE);
	m_joystick_contradictory = bool_value(OPTION_JOYSTICK_CONTRADICTORY);
	m_sleep = bool_value(OPTION_SLEEP);
	m_refresh_speed = bool_value(OPTION_REFRESHSPEED);
}
Exemple #2
0
void emu_options::update_cached_options()
{
	m_coin_impulse = int_value(OPTION_COIN_IMPULSE);
	m_joystick_contradictory = bool_value(OPTION_JOYSTICK_CONTRADICTORY);
	m_sleep = bool_value(OPTION_SLEEP);
	m_refresh_speed = bool_value(OPTION_REFRESHSPEED);

	auto ui_option_string = value(OPTION_UI);
	if (!strcmp(ui_option_string, "simple"))
		m_ui = UI_SIMPLE;
	else
		m_ui = UI_CABINET;
}
/*
 * call-seq: LocalMemCache.drop(*args)
 *
 * Deletes a memory pool.  If the :force option is set, locked semaphores are
 * removed as well.
 *
 * WARNING: Do only call this method with the :force option if you are sure
 * that you really want to remove this memory pool and no more processes are
 * still using it.
 *
 * If you delete a pool and other processes still have handles open on it, the
 * status of these handles becomes undefined.  There's no way for a process to
 * know when a handle is not valid anymore, so only delete a memory pool if
 * you are sure that all handles are closed.
 *
 * valid options for drop are 
 * [:namespace] 
 * [:filename] 
 * [:force] 
 *
 * The memory pool must be specified by either setting the :filename or
 * :namespace option.  The default for :force is false.
 */
static VALUE LocalMemCache__drop(VALUE klass, VALUE o) {
  lmc_check_dict(o);
  lmc_error_t e;
  if (!local_memcache_drop_namespace(
      rstring_ptr_null(rb_hash_aref(o, lmc_rb_sym_namespace)), 
      rstring_ptr_null(rb_hash_aref(o, lmc_rb_sym_filename)),
      bool_value(rb_hash_aref(o, lmc_rb_sym_force)), &e)) {
    rb_lmc_raise_exception(&e); 
  }
  return Qnil;
}
/*
 * call-seq: Cache.drop(*args)
 *
 * Deletes a memory pool.  If the :force option is set, locked semaphores are
 * removed as well.
 *
 * WARNING: Do only call this method with the :force option if you are sure
 * that you really want to remove this memory pool and no more processes are
 * still using it.
 *
 * If you delete a pool and other processes still have handles open on it, the
 * status of these handles becomes undefined.  There's no way for a process to
 * know when a handle is not valid anymore, so only delete a memory pool if
 * you are sure that all handles are closed.
 *
 * valid options for drop are
 * [:namespace]
 * [:filename]
 * [:force]
 *
 * The memory pool must be specified by either setting the :filename or
 * :namespace option.  The default for :force is false.
 */
static mrb_value Cache__drop(mrb_state *mrb, mrb_value self)
{
  mrb_value o;
  mrb_get_args(mrb, "o", &o);
  lmc_check_dict(mrb, o);
  lmc_error_t e;
  if (!local_memcache_drop_namespace(rstring_ptr_null(mrb_hash_get(mrb, o, lmc_rb_sym_namespace(mrb))),
                                     rstring_ptr_null(mrb_hash_get(mrb, o, lmc_rb_sym_filename(mrb))),
                                     bool_value(mrb_hash_get(mrb, o, lmc_rb_sym_force(mrb))), &e)) {
    rb_lmc_raise_exception(mrb, &e);
  }
  return mrb_nil_value();
}
Exemple #5
0
void display(LISP_OBJ_PTR objp) {
  switch (objp->form) {
  case INT_FORM:
    fprintf(out_stream, "%d", int_value(objp));
    break;
  case FLOAT_FORM:
    fprintf(out_stream, "%g", float_value(objp));
    break;
  case CHAR_FORM:
    fprintf(out_stream, "%c", char_value(objp));
    break;
  case STRING_FORM:
    fprintf(out_stream, "%s", string_value(objp));
    break;
  case SYMBOL_FORM:
    fprintf(out_stream, "%s", symbol_value(objp));
    break;
  case PROCEDURE_FORM:
    fprintf(out_stream, "<PROCEDURE>");
    break;
  case BOOLEAN_FORM:
    fprintf(out_stream, "#%c", bool_value(objp) ? 't' : 'f');
    break;
  case CONS_FORM:
    fprintf(out_stream, "(");
    while (TRUE) {
      print_lispobj(car(objp));
      objp = cdr(objp);
      if (objp == nil_ptr)
        break;
      if (!(is_pair(objp))) {
        printf(" . ");
        print_lispobj(objp);
        break;
      }
      fprintf(out_stream, " ");
    }
    fprintf(out_stream, ")");
    break;
  case NO_FORM:
    fprintf(out_stream, "no form, boss");
    break;
  default:
    fprintf(out_stream, "dunno that form %d", form(objp));
  }
}
Exemple #6
0
Value is_even(Value i)
{
    return bool_value(i.i % 2 == 0);
}
Exemple #7
0
static bool assign_xml_value_to_protobuf_field(const std::string &value, xmltype xtype, ::google::protobuf::Message* msg, const ::google::protobuf::FieldDescriptor* field)
{
	if (xtype==duration)
		return assign_xml_duration_value_to_protobuf_field(value,msg,field);
		
	// handle xmltype 'automatic'
	const ::google::protobuf::Reflection* reflection = msg->GetReflection();
	switch (field->cpp_type()) {
		case ::google::protobuf::FieldDescriptor::CPPTYPE_INT32: {
			long longval;
			if (long_value(value,longval))
				reflection->SetInt32(msg, field, longval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_INT64: {
			long longval;
			if (long_value(value,longval))
				reflection->SetInt64(msg, field, longval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_UINT32: {
			unsigned long ulongval;
			if (ulong_value(value,ulongval))
				reflection->SetUInt32(msg, field, ulongval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_UINT64: {
			unsigned long ulongval;
			if (ulong_value(value,ulongval))
				reflection->SetUInt64(msg, field, ulongval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE: {
			double doubleval;
			if (double_value(value,doubleval))
				reflection->SetDouble(msg, field, doubleval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_FLOAT: {
			double floatval;
			if (float_value(value,floatval))
				reflection->SetFloat(msg, field, floatval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_BOOL: {
			bool boolval;
			if (bool_value(value,boolval))
				reflection->SetBool(msg, field, boolval);
			else
				printf("ERROR:\n");
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_ENUM: {
			const ::google::protobuf::EnumDescriptor *enu = field->enum_type();
			const ::google::protobuf::EnumValueDescriptor *enuval =  enu->FindValueByName(value);
			if (!enuval) {
				printf("ERROR: '%s' not a valid value for %s !\n",value.c_str(),enu->name().c_str());
			} else {
				//printf("SUCCESS: '%s' is a valid value for %s !\n",value.c_str(),enu->name().c_str());
				reflection->SetEnum(msg, field, enuval);
			}
			break;
		}
		case ::google::protobuf::FieldDescriptor::CPPTYPE_STRING:
			reflection->SetString(msg, field, value);
			break;
		case ::google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE:
			printf("ERROR: element should not contain text data but we got '%s' !\n",value.c_str());
			return false;
		default:
			printf("ERROR: Unsupported field type '%d' !\n", field->cpp_type());
			return false;
	}
	return true;
}
Exemple #8
0
static svn_error_t *
entries_dump(const char *dir_path, svn_wc_adm_access_t *related, apr_pool_t *pool)
{
  svn_wc_adm_access_t *adm_access = NULL;
  apr_hash_t *entries;
  apr_hash_index_t *hi;
  svn_boolean_t locked;
  svn_error_t *err;
  svn_wc_context_t *wc_ctx = NULL;
  const char *dir_abspath;

  err = svn_wc_adm_open3(&adm_access, related, dir_path, FALSE, 0,
                         NULL, NULL, pool);
  if (!err)
    {
      SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL,
                                             svn_wc__adm_get_db(adm_access),
                                             pool));
      SVN_ERR(svn_dirent_get_absolute(&dir_abspath, dir_path, pool));

      SVN_ERR(svn_wc_locked2(NULL, &locked, wc_ctx, dir_abspath, pool));
      SVN_ERR(svn_wc_entries_read(&entries, adm_access, TRUE, pool));
    }
  else if (err && err->apr_err == SVN_ERR_WC_LOCKED
           && related
           && ! strcmp(dir_path, svn_wc_adm_access_path(related)))
    {
      /* Common caller error: Can't open a baton when there is one. */
      svn_error_clear(err);

      SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL,
                                             svn_wc__adm_get_db(related),
                                             pool));
      SVN_ERR(svn_dirent_get_absolute(&dir_abspath, dir_path, pool));

      SVN_ERR(svn_wc_locked2(NULL, &locked, wc_ctx, dir_abspath, pool));
      SVN_ERR(svn_wc_entries_read(&entries, related, TRUE, pool));
    }
  else
    {
      const char *lockfile_path;
      svn_node_kind_t kind;

      /* ### Should svn_wc_adm_open3 be returning UPGRADE_REQUIRED? */
      if (err->apr_err != SVN_ERR_WC_NOT_DIRECTORY)
        return err;
      svn_error_clear(err);
      adm_access = NULL;
      SVN_ERR(svn_dirent_get_absolute(&dir_abspath, dir_path, pool));
      SVN_ERR(svn_wc__read_entries_old(&entries, dir_abspath, pool, pool));
      lockfile_path = svn_dirent_join_many(pool, dir_path,
                                           svn_wc_get_adm_dir(pool),
                                           "lock", SVN_VA_NULL);
      SVN_ERR(svn_io_check_path(lockfile_path, &kind, pool));
      locked = (kind == svn_node_file);
    }

  for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
    {
      const char *key = apr_hash_this_key(hi);
      const svn_wc_entry_t *entry = apr_hash_this_val(hi);

      SVN_ERR_ASSERT(strcmp(key, entry->name) == 0);

      printf("e = Entry()\n");
      str_value("name", entry->name);
      int_value("revision", entry->revision);
      str_value("url", entry->url);
      str_value("repos", entry->repos);
      str_value("uuid", entry->uuid);
      int_value("kind", entry->kind);
      int_value("schedule", entry->schedule);
      bool_value("copied", entry->copied);
      bool_value("deleted", entry->deleted);
      bool_value("absent", entry->absent);
      bool_value("incomplete", entry->incomplete);
      str_value("copyfrom_url", entry->copyfrom_url);
      int_value("copyfrom_rev", entry->copyfrom_rev);
      str_value("conflict_old", entry->conflict_old);
      str_value("conflict_new", entry->conflict_new);
      str_value("conflict_wrk", entry->conflict_wrk);
      str_value("prejfile", entry->prejfile);
      /* skip: text_time */
      /* skip: prop_time */
      /* skip: checksum */
      int_value("cmt_rev", entry->cmt_rev);
      /* skip: cmt_date */
      str_value("cmt_author", entry->cmt_author);
      str_value("lock_token", entry->lock_token);
      str_value("lock_owner", entry->lock_owner);
      str_value("lock_comment", entry->lock_comment);
      /* skip: lock_creation_date */
      /* skip: has_props */
      /* skip: has_prop_mods */
      /* skip: cachable_props */
      /* skip: present_props */
      str_value("changelist", entry->changelist);
      /* skip: working_size */
      /* skip: keep_local */
      int_value("depth", entry->depth);
      /* skip: tree_conflict_data */
      bool_value("file_external", entry->file_external_path != NULL);
      /* skip: file_external_peg_rev */
      /* skip: file_external_rev */
      bool_value("locked", locked && *entry->name == '\0');
      printf("entries['%s'] = e\n", (const char *)key);
    }

  if (wc_ctx)
    SVN_ERR(svn_wc_context_destroy(wc_ctx));

  if (adm_access)
    SVN_ERR(svn_wc_adm_close2(adm_access, pool));

  return SVN_NO_ERROR;
}
Exemple #9
0
CS_IMPLEMENT_APPLICATION

int main (int argc, char *argv[])
{
  iObjectRegistry* objreg = csInitializer::CreateEnvironment (argc, argv);
  if (! objreg)
  {
    csFPrintf (stderr, "Failed to create environment!\n");
    return 1;
  }

  bool ok = csInitializer::RequestPlugins (objreg,
    CS_REQUEST_REPORTER,
    CS_REQUEST_REPORTERLISTENER,
    CS_REQUEST_PLUGIN ("crystalspace.script.perl5", iScript),
    CS_REQUEST_END);
  if (! ok)
  {
    csFPrintf (stderr, "Failed to load plugins!\n");
    return 2;
  }

  if (csCommandLineHelper::CheckHelp (objreg))
  {
    csCommandLineHelper::Help (objreg);
    return 0;
  }

  {
    csRef<iScript> script = csQueryRegistry<iScript> (objreg);
    if (! script)
    {
      csFPrintf (stderr, "Failed to find perl5 plugin!\n");
      return 3;
    }

    ok = script->LoadModule ("cspace");
    //ok = script->LoadModule ("scripts/perl5", "cspace.pm");
    if (! ok)
    {
      csFPrintf (stderr, "Failed to load perl5 cspace module!\n");
      return 4;
    }

    csInitializer::OpenApplication (objreg);

    //====================================================================//
    csPrintf ("Testing RValue/Store/Retrieve:\n");

    int test_int = 3;
    float test_float = 3.0;
    double test_double = 3.0;
    bool test_bool = true;
    const char *test_str = "hello";

    csPrintf ("  Int: ");
    csRef<iScriptValue> int_value (script->RValue (test_int));
    ok = script->Store("i", int_value);
    int_value.AttachNew (script->Retrieve ("i"));
    csPrintf ("%d == %d\n", test_int, int_value->GetInt ());

    csPrintf ("  Float: ");
    csRef<iScriptValue> float_value (script->RValue (test_float));
    ok = script->Store("f", float_value);
    float_value.AttachNew (script->Retrieve ("f"));
    csPrintf ("%f == %f\n", test_float, float_value->GetFloat ());

    csPrintf ("  Double: ");
    csRef<iScriptValue> double_value (script->RValue (test_double));
    ok = script->Store("d", double_value);
    double_value.AttachNew (script->Retrieve ("d"));
    csPrintf ("%lf == %lf\n", test_double, double_value->GetDouble ());

    csPrintf ("  String: ");
    csRef<iScriptValue> str_value (script->RValue (test_str));
    ok = script->Store("s", str_value);
    str_value.AttachNew (script->Retrieve ("s"));
    csPrintf ("%s == %s\n", test_str, str_value->GetString ()->GetData ());

    csPrintf ("  Bool: ");
    csRef<iScriptValue> bool_value (script->RValue (test_bool));
    ok = script->Store("b", bool_value);
    bool_value.AttachNew (script->Retrieve ("b"));
    csPrintf ("%s == %s\n\n", test_bool ? "true" : "false",
			      bool_value->GetBool () ? "true" : "false");

    //====================================================================//
    csPrintf ("Testing Remove:\n");

    ok = script->Remove ("i") && script->Remove ("f") && script->Remove ("d")
      && script->Remove ("s") && script->Remove ("b");
    csPrintf ("  %s\n", ok ? "ok" : "failed");

    int_value.AttachNew (script->Retrieve ("i"));
    csPrintf ("  %s\n", int_value.IsValid () ? "failed" : "ok");

    //====================================================================//
    csPrintf ("Testing New(csVector3):\n");

    csRef<iScriptObject> obj (script->New ("csVector3"));
    csPrintf ("  %s\n", obj.IsValid () ? "ok" : "failed");

    //====================================================================//
    csPrintf ("Testing GetClass/IsA:\n");

    csRef<iString> classname (obj->GetClass ());
    csPrintf ("  %s\n", classname->GetData ());

    csPrintf ("  %s\n", obj->IsA ("csVector3") ? "ok" : "failed");

    //====================================================================//
    csPrintf ("Testing Set/Get:\n");

    csPrintf ("  %f == ", float_value->GetFloat ());

    ok = obj->Set ("x", float_value);
    float_value.AttachNew (obj->Get ("x"));

    csPrintf ("%f\n", float_value->GetFloat ());

    //====================================================================//
    csPrintf ("Testing Call(csVector3::Set):\n");

    csRefArray<iScriptValue> args;
    args.Push (float_value);

    csRef<iScriptValue> ret (obj->Call ("Set", args));
    csPrintf ("  %f\n", float_value->GetFloat ());

    //====================================================================//
    csPrintf ("Testing Call(csVector3::Norm):\n");

    ret.AttachNew (obj->Call ("Norm"));
    csPrintf ("  %f\n", ret->GetFloat ());

    //====================================================================//
    csPrintf ("Testing GetPointer:\n");

    csVector3 &vector = * (csVector3 *) obj->GetPointer ();

    vector.Normalize ();

    csPrintf ("  %f %f %f\n", vector[0], vector[1], vector[2]);
    csPrintf ("  ok\n");

    csPrintf ("All Done!\n");
  }

  csInitializer::DestroyApplication (objreg);
  return 0;
}
void print_ast(struct ast* node) {
  if (node != NULL) {
    switch(node->node_type) {
      case N_NIL : {
                              printf("nil");
                              break;
      };
      case N_BOOL : {
                              if (bool_value(node) == 1) {
                                printf("true");  
                              } else {
                                printf("false");  
                              };
                              break;
      };
      case N_INTEGER : {
                              printf("%d", int_value(node));
                              break;
      };
      case N_DOUBLE  : {
                              printf("%f", double_value(node));
                              break;
      };
      case N_STRING_1: {
                              printf("%s", string_value(node));
                              break;
      };
      case N_STRING_2: {
                              printf("%s", string_value(node));
                              break;
      };
      case N_IDENTIFIER : {
                              struct identifier_node* i = (struct identifier_node*)node;
                              printf("%s", i->name);
                              break;
      };
      case N_OBJECT : {
                              struct object_node* o = (struct object_node*)node;
                              printf("Class: %s\n", o->class_ptr->name);
                              printf("Inst Vars:\n");
                              print_sym_list(o->sym_list);
                              break;
      };
      case N_OP_EQUAL : {
                              print_ast(node->left);
                              printf(" = ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_PLUS_EQ : {
                              print_ast(node->left);
                              printf(" += ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_MINUS_EQ : {
                              print_ast(node->left);
                              printf(" -= ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_MUL_EQ : {
                              print_ast(node->left);
                              printf(" *= ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_DIV_EQ : {
                              print_ast(node->left);
                              printf(" /= ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_MODULO_EQ : {
                              print_ast(node->left);
                              printf(" mod= ");
                              print_ast(node->right);
                              break;
      };
      case N_ARG_LIST : {
                              struct list_node* l = (struct list_node*)node;
                              print_list(l); 
                              break;
      };
      case N_OP_MUL : {
                              print_ast(node->left);
                              printf(" * ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_DIV : {
                              print_ast(node->left);
                              printf(" / ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_MODULO : {
                              print_ast(node->left);
                              printf(" mod ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_PLUS : { 
                              print_ast(node->left);
                              printf(" + ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_MINUS : {
                              print_ast(node->left);
                              printf(" - ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_GT : {
                              print_ast(node->left);
                              printf(" > ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_GT_EQ : {
                              print_ast(node->left);
                              printf(" >= ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_LE : {
                              print_ast(node->left);
                              printf(" < ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_LE_EQ : {
                              print_ast(node->left);
                              printf(" <= ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_EQ : {
                              print_ast(node->left);
                              printf(" == ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_EQ_EQ : {
                              print_ast(node->left);
                              printf(" === ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_INEQ : {
                              print_ast(node->left);
                              printf(" <=> ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_NEG : {
                              print_ast(node->left);
                              printf(" != ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_AND : {
                              print_ast(node->left);
                              printf(" && ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_CMP_OR : {
                              print_ast(node->left);
                              printf(" || ");
                              print_ast(node->right);
                              break;
      };
      case N_OP_PLUS_UN : {
                              printf("+");
                              print_ast(node->left);
                              break;
      };
      case N_OP_MINUS_UN : {
                              printf("+");
                              print_ast(node->left);
                              break;
      };
      case N_OP_NOT : {
                              printf("+");
                              print_ast(node->left);
                              break;
      };
      case N_STMT_LIST : {
                              print_ast(node->right);
                              print_ast(node->left);
                              break;
      };
      case N_FUNCTION : {
                              struct function_node* f = (struct function_node*)node;
                              printf("def %s", f->name); // def function name
                              print_list(f->args); // function parameters
                              print_ast(f->stmts); // comp_statements
                              printf("end");
                              break;
      };
      case N_RETURN : {
                              printf("return ");
                              print_ast(node->left); // expression
                              printf("\n");
                              break;
      };
      case N_WHILE : {
                              printf("while ");
                              print_ast(node->left); // expression
                              printf("\n");
                              print_ast(node->right); // comp_statements
                              printf("\nend");
                              break;
      };
      case N_CLASS : {
                              struct class_node* c = (struct class_node*)node;
                              printf("class %s\n", c->name); // class name
                              print_list(c->stmts); // comp_statements
                              printf("end");
                              break;
      };
      case N_METHOD_CALL_2 : { 
                              struct method_call_node* m = (struct method_call_node*) node;
                              printf("%s ", m->method_name);
                              print_list(m->args);
                              break;
      };
      default : {
                              printf("%i\n", node->node_type);
                              printf("ERROR: when printing %c.\n", node->node_type);
      };
    };
  };
};
struct ast* rputs(struct ast* a){

  if (a->node_type == N_METHOD_CALL_0 || a->node_type == N_METHOD_CALL_1 || a->node_type == N_METHOD_CALL_2) {
    struct method_call_node* m = (struct method_call_node*)a;
    struct list_node* arg_node = m->args;

    // caso especial: puts() sin parámetros imprime salto de línea
    if (arg_node == NULL) {
      printf("\n");

    // comportamiento normal
    } else {  
      while(arg_node != NULL){
        struct ast* evaluated = eval_ast(arg_node->arg);
        rputs(evaluated);
        arg_node = arg_node->next;
      };
    };

  } else if (a->node_type == N_ARRAY) {
    int arr_size = array_tree_size(a->left);
    struct ast* result[arr_size];
    struct ast* ptr = a->left;
    int i;
    for (i = 0; i < arr_size; i++) {
      result[i] = ptr;
      ptr = ptr->right;
    };

    ptr = result[arr_size-1];
    for (i = arr_size-1; i >= 0; i--) {
      rputs(eval_ast(result[i]));
    };

  } else if (a->node_type == N_ARRAY_CONTENT) {
    rputs(eval_ast(a->left));

  } else if (a->node_type == N_STRING_1) {
    printf("%s\n", string_value(a));

  } else if (a->node_type == N_STRING_2) {

    char * str = malloc(sizeof( strlen(string_value(a)) ));
    strcpy(str, string_value(a));
    str = build_end_of_lines(str);
    printf("%s\n", str);

  } else if (a->node_type == N_INTEGER) {
    printf("%d\n", int_value(a));

  } else if (a->node_type == N_DOUBLE) {
    double d = double_value(a);
    if ( d - floor(d) == 0.0 ) {
      printf( "%g.0\n", d );
    } else {
      printf( "%g\n", d );
    };

  } else if (a->node_type == N_BOOL) {
    printf("%s\n", bool_value(a) ? "true" : "false");

  } else if (a->node_type == N_NIL) {
    printf("\n");

  } else if (a->node_type == N_OBJECT) {
    struct object_node * object = (struct object_node *) a;
    printf("<#%s:%p>\n", object->class_ptr->name, (void *)object);

  } else {
    printf("Puts doesn't support %s type, sorry :D\n", type_name(a->node_type));
  };
  return new_nil_node();
};