home *** CD-ROM | disk | FTP | other *** search
- /*
-
- POLYTOPE OBJECT INCLUDE FILE v1.0b - arrayget include file
- Copyright (C) 1997 Thomas Willhalm
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
- */
-
- /*
- Get vector from array of vectors strored as string
-
- Usage:
- PRE: <array> is string with comma-separated list of vectors
- with no additional blanks
- PRE: <array> contains at least <array_pos> vectors
- POST: <float_vector> contains vector at <array_pos> position
- SIDE: <__cur_pos>, <__old_pos>, <__x>, <__y>, <string_vector>
- <_cur_pos>, <_old_pos>, <_count>, <_end>
- altered
- */
-
- // checking
- #ifndef (array)
- #error "\narray undefined in arrayget.inc\n"
- #end
- #ifndef (array_pos)
- #error "\narray_pos undefined in arrayget.inc\n"
- #end
-
- // find first <
- #declare _cur_pos=2
- #while (strcmp(substr(array,_cur_pos,1),"<"))
- #declare _cur_pos = _cur_pos+1
- #end
-
- #if (array_pos=1)
- #declare _old_pos = 1
- #else
- // find < no <array_pos>
- #declare _count = -1
- #declare _cur_pos = 0
- #while (_count<array_pos)
- #declare _old_pos = _cur_pos
- #declare _end = 1
- #while (_end)
- #declare _cur_pos = _cur_pos+1
- #if (_cur_pos>strlen(array))
- #declare _end = 0
- #declare _cur_pos = strlen(array)+2
- #else
- #if (!strcmp(substr(array,_cur_pos,1),"<"))
- #declare _end = 0
- #end
- #end
- #end
- #declare _count = _count+1
- #end
- #end
-
- #declare string_vector = substr(array,_old_pos,_cur_pos-_old_pos-1)
- #include "vectorval.inc"
-