Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

  1. #ifndef __stack_h_
  2. #define __stack_h_
  3. /*
  4. ** Copyright 1994, Silicon Graphics, Inc.
  5. ** All Rights Reserved.
  6. **
  7. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  8. ** the contents of this file may not be disclosed to third parties, copied or
  9. ** duplicated in any form, in whole or in part, without the prior written
  10. ** permission of Silicon Graphics, Inc.
  11. **
  12. ** RESTRICTED RIGHTS LEGEND:
  13. ** Use, duplication or disclosure by the Government is subject to restrictions
  14. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  15. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  16. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  17. ** rights reserved under the Copyright Laws of the United States.
  18. **
  19. ** Author: Eric Veach, July 1994.
  20. */
  21. typedef struct Stack Stack;
  22. struct Stack {
  23. int size;
  24. int max;
  25. void **data;
  26. };
  27. Stack *__gl_StackNew( void );
  28. void __gl_StackGrow( Stack *s );
  29. void __gl_StackFree( Stack *s );
  30. #define StackNew() __gl_StackNew()
  31. #define StackFree(s) __gl_StackFree( s )
  32. #define StackSize(s) ((s)->size)
  33. #define StackPush(s,d) { if ((s)->size >= (s)->max) __gl_StackGrow( s ); \
  34. (s)->data[((s)->size)++] = (d); }
  35. #define StackPop(s) ((s)->data[--((s)->size)])
  36. #define StackTop(s) ((s)->data[(s)->size - 1])
  37. #define StackNth(s,n) ((s)->data[(s)->size - (n) - 1])
  38. #endif