"/* This file is part of GNU epsilon, a functional language implementation\n"
"\n"
"Copyright (C) 2003 Luca Saiu\n"
"Copyright (C) 2003 Matteo Golfarini\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_pshf instruction */\n"
"word_t* new_environment;\n"
"integer_t i;\n"
"\n"
"/* Allocate new environment:*/\n"
"ASSIGN_MY_MALLOC(new_environment, ((integer_t)PARAMETER_1) + 1);\n"
"\n"
"/* Create the s-link: */\n"
"new_environment[0] = environment;\n"
"\n"
"/* Fill with non-top operands: */\n"
"for(i = 0; i < (integer_t)PARAMETER_1 - 1; i++)\n"
"  new_environment[i + 1] = stack[undertop_stack_pointer + i - (integer_t)PARAMETER_1 + 2];\n"
"\n"
"/* Fill with top operand, if top is an operand; else copy top to the stack,\n"
"   so that we don\'t lose it: */\n"
"if((integer_t)PARAMETER_1 != (integer_t)0)\n"
"  new_environment[(integer_t)PARAMETER_1] = top;\n"
"else\n"
"  stack[undertop_stack_pointer + 1] = top;\n"
"\n"
"/* Enlarge stack if needed:\n"
"                (2003-07-29, positron: this is *never* needed) */\n"
"/*\n"
"int stack_size1 = stack_size;\n"
"ENLARGE_STACK(undertop_stack_pointer + instructions_no);\n"
"if(stack_size != stack_size1){\n"
"  fprintf(stderr, \"--------------------------------------------------------\\n\");\n"
"  fprintf(stderr, \"SP is       %i\\n\", undertop_stack_pointer + 1);\n"
"  fprintf(stderr, \"old size is %i\\n\", stack_size1 + 1);\n"
"  fprintf(stderr, \"new size is %i\\n\", stack_size + 1);\n"
"  fprintf(stderr, \"s_pshf: We seem to really need ENLARGE_STACK() in s_pshf\\n\");\n"
"  fprintf(stderr, \"--------------------------------------------------------\\n\");\n"
"}\n"
"*/\n"
"\n"
"/* Delete all operands, and replace them with old_env and old_FP: */\n"
"undertop_stack_pointer -= ((integer_t)PARAMETER_1 - 2);\n"
"stack[undertop_stack_pointer] = environment;\n"
"top = (word_t)frame_pointer;\n"
"\n"
"/* Update env and FP: */\n"
"environment = new_environment;\n"
"frame_pointer = undertop_stack_pointer;\n"
""
