/* * Copyright (c) 2023, an unpublished work by CodeSecure, Inc. * ALL RIGHTS RESERVED * * Copyright (c) 2005-2023, an unpublished work by GrammaTech, Inc. * ALL RIGHTS RESERVED * * This software is furnished under a license and may be used and * copied only in accordance with the terms of such license and the * inclusion of the above copyright notice. This software or any * other copies thereof may not be provided or otherwise made * available to any other person. Title to and ownership of the * software is retained by CodeSecure, Inc. */ /* my_iterator.h * * contains declarations for an iterator */ #define MAXSIZE 100 typedef struct { int buf[MAXSIZE]; int used; int ptr; } it; /* makes a new iterator */ it *my_iterator_New(void); /* frees an iterator */ void my_iterator_Dispose(it *i); /* sets up the iterator */ void my_iterator_Init(it *i); /* sends iterator back to beginning of space */ void my_iterator_First(it *i); /* advances the iterator. Returns * 1 if advanced successfully, * 0 if nowhere to advance to */ int my_iterator_Next(it *i); /* checks that current iterator position * has a valid value */ int my_iterator_IsValid(it *i); /* gets value at current iterator position. Shouldn't * be done unless value at this position has been * checked with my_iterator_IsValid */ int my_iterator_GetVal(it *i); /* sets value at current iterator position to val. */ void my_iterator_SetVal(it *i, int val);