2009-05-11 14:15:00 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (c) 1999-2002, Darren Hiebert
|
2011-01-19 19:39:09 +00:00
|
|
|
* Copyright 2009-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2009-05-11 14:15:00 +00:00
|
|
|
*
|
|
|
|
* This source code is released for free distribution under the terms of the
|
|
|
|
* GNU General Public License.
|
|
|
|
*
|
|
|
|
* Defines external interface to scope nesting levels for tags.
|
|
|
|
*/
|
|
|
|
#ifndef _NESTLEVEL_H
|
|
|
|
#define _NESTLEVEL_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* INCLUDE FILES
|
|
|
|
*/
|
|
|
|
#include "general.h" /* must always come first */
|
|
|
|
|
|
|
|
#include "vstring.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DATA DECLARATIONS
|
|
|
|
*/
|
|
|
|
typedef struct NestingLevel NestingLevel;
|
|
|
|
typedef struct NestingLevels NestingLevels;
|
|
|
|
|
|
|
|
struct NestingLevel
|
|
|
|
{
|
|
|
|
int indentation;
|
|
|
|
vString *name;
|
2009-05-11 15:36:46 +00:00
|
|
|
int type;
|
2009-05-11 14:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NestingLevels
|
|
|
|
{
|
|
|
|
NestingLevel *levels;
|
2009-05-11 15:36:46 +00:00
|
|
|
int n; /* number of levels in use */
|
2009-05-11 14:15:00 +00:00
|
|
|
int allocated;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION PROTOTYPES
|
|
|
|
*/
|
2009-05-12 15:16:23 +00:00
|
|
|
extern NestingLevels *nestingLevelsNew(void);
|
|
|
|
extern void nestingLevelsFree(NestingLevels *nls);
|
2009-05-11 15:36:46 +00:00
|
|
|
extern void nestingLevelsPush(NestingLevels *nls,
|
|
|
|
const vString *name, int type);
|
|
|
|
extern void nestingLevelsPop(NestingLevels *nls);
|
|
|
|
extern NestingLevel *nestingLevelsGetCurrent(NestingLevels *nls);
|
2009-05-11 14:15:00 +00:00
|
|
|
|
|
|
|
#endif /* _NESTLEVEL_H */
|
|
|
|
|
|
|
|
/* vi:set tabstop=4 shiftwidth=4: */
|