home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume28 / m0 / part01 / o_string.c < prev    next >
C/C++ Source or Header  |  1994-06-05  |  1KB  |  47 lines

  1. /*
  2.     o_string.c
  3. */
  4. /*  Copyright (c) 1994 Christian F. Tschudin. All rights reserved.
  5.  
  6.     Distributed under the terms of the GNU General Public License
  7.     version 2 of june 1991 as published by the Free Software
  8.     Foundation, Inc.
  9.  
  10.              This file is part of M0.
  11.  
  12. M0 is distributed in the hope that it will be useful, but WITHOUT ANY
  13. WARRANTY.  No author or distributor accepts responsibility to anyone for
  14. the consequences of using it or for whether it serves any particular
  15. purpose or works at all, unless he says so in writing.  Refer to the GNU
  16. General Public License for full details. 
  17.  
  18. Everyone is granted permission to copy, modify and redistribute M0, but
  19. only under the conditions described in the GNU General Public License. 
  20. A copy of this license is supposed to have been given to you along with
  21. M0 so you can know your rights and responsibilities.  It should be in a
  22. file named LICENSE.  Among other things, the copyright notice and this
  23. notice must be preserved on all copies.  */
  24.  
  25. #include "l_proto.h"
  26. #include "o_proto.h"
  27.  
  28.  
  29. retcode
  30. o_string()
  31. {
  32.     eindex s;
  33.  
  34.     load_1_arg(ei, ep);
  35.  
  36.     if (eptype(ep) != T_INT)
  37.         return ERR_TYPE_CHECK;
  38.     if (ep->V.i < 0)
  39.         return ERR_RANGE_CHECK;
  40.     s = new_string(current, ep->V.i);
  41.     if (!s)
  42.         return ERR_IMPLEMENTATION_LIMIT;
  43.     decrefp(current, ei, ep);
  44.     current->os[current->osp-1] = s;
  45.     return OK;
  46. }
  47.