"/* This file is part of GNU epsilon, a functional language implementation\n"
"\n"
"Copyright (C) 2003 Luca Saiu\n"
"\n"
"GNU epsilon is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published\n"
"by the Free Software Foundation; either version 2, or (at your\n"
"option) any later version.\n"
"\n"
"GNU epsilon is distributed in the hope that it will be useful, but\n"
"WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
"General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with epsilon; see the file COPYING.  If not, write to the\n"
"Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n"
"Boston, MA 02111-1307, USA. */\n"
"\n"
"\n"
"/* Code for the s_mkba_i instruction */\n"
"\n"
"word_t* array;\n"
"\n"
"/* Allocate array: */\n"
"ASSIGN_CREATE_ARRAY(array, (integer_t)PARAMETER_1 + 1);\n"
"\n"
"array[0] = PARAMETER_1; /* Store length in the first element */\n"
"\n"
"/* Store the other elements, if they exist: */\n"
"if((integer_t)PARAMETER_1 == 0){\n"
"  /* Pop nothing, push the newly-created array: */\n"
"  PUSH_OBJECT(array);\n"
"}\n"
"else if((integer_t)PARAMETER_1 == 1){\n"
"  /* One-element array: no need to look at the stack */\n"
"  array[1] = top;\n"
"  top = (word_t) array;\n"
"}\n"
"else{\n"
"  /* The array will have more than one element */\n"
"  integer_t i;\n"
"  \n"
"  /* Copy the element from top: */\n"
"  array[(integer_t)PARAMETER_1] = top;\n"
"  \n"
"  /* Copy all elements from stack: */\n"
"  for(i = 1; i <= (integer_t)PARAMETER_1 - 1; i++)\n"
"    array[i] = stack[undertop_stack_pointer + i - (integer_t)PARAMETER_1 + 1];\n"
"  \n"
"  /* Set top to the array and remove the other elements from the stack: */\n"
"  top = (word_t) array;\n"
"  undertop_stack_pointer -= ((integer_t)PARAMETER_1 - 1);\n"
"}\n"
""
