lists.h #4

  • //
  • guest/
  • perforce_software/
  • jam/
  • src/
  • lists.h
  • View
  • Commits
  • Open Download .zip Download (2 KB)
/*
 * Copyright 1993, 1995 Christopher Seiwald.
 *
 * This file is part of Jam - see jam.c for Copyright information.
 */

/*
 * lists.h - the LIST structure and routines to manipulate them
 *
 * The whole of jam relies on lists of strings as a datatype.  This
 * module, in conjunction with newstr.c, handles these relatively
 * efficiently.
 *
 * Structures defined:
 *
 *	LIST - list of strings
 *	LOL - list of LISTs
 *
 * External routines:
 *
 *	list_append() - append a list onto another one, returning total
 *	list_new() - tack a string onto the end of a list of strings
 * 	list_copy() - copy a whole list of strings
 *	list_sublist() - copy a subset of a list of strings
 *	list_free() - free a list of strings
 *	list_print() - print a list of strings to stdout
 *	list_length() - return the number of items in the list
 *
 *	lol_init() - initialize a LOL (list of lists)
 *	lol_add() - append a LIST onto an LOL
 *	lol_free() - free the LOL and its LISTs
 *	lol_get() - return one of the LISTs in the LOL
 *	lol_print() - debug print LISTS separated by ":"
 *
 * 04/13/94 (seiwald) - added shorthand L0 for null list pointer
 * 08/23/94 (seiwald) - new list_append()
 */

/*
 * LIST - list of strings
 */

typedef struct _list LIST;

struct _list {
	LIST		*next;
	LIST		*tail;		/* only valid in head node */
	const char	*string;	/* private copy */
} ;

/*
 * LOL - list of LISTs
 */

typedef struct _lol LOL;

# define LOL_MAX 9

struct _lol {
	int	count;
	LIST	*list[ LOL_MAX ];
} ;

LIST *	list_append( LIST *l, LIST *nl );
LIST *	list_copy( LIST *l, LIST  *nl );
void	list_free( LIST *head );
LIST *	list_new( LIST *head, const char *string, int copy );
void	list_print( LIST *l );
int	list_length( LIST *l );
LIST *	list_sublist( LIST *l, int start, int count );

# define list_next( l ) ((l)->next)

# define L0 ((LIST *)0)

void	lol_add( LOL *lol, LIST *l );
void	lol_init( LOL *lol );
void	lol_free( LOL *lol );
LIST *	lol_get( LOL *lol, int i );
void	lol_print( LOL *lol );
# Change User Description Committed
#6 2501 rmg Nascent jam work for header scan caching: new list_printq()
for writing a list in a format suitable for being included
by the Jambase, and move logic around in headers() to make
room for eventual caching code.

No functional change.

=== computer:1666: Change 38623 by seiwald@play-seiwald on 2002/12/09 16:22:59
#5 2493 rmg Rewrite the past: update all jam's source with comments to
reflect changes since about 2.3, very early 2001.

Whitespace only change.

=== computer:1666: Change 37660 by seiwald@play-seiwald on 2002/11/06 22:41:35

Note: I regenerated jamgram.c on my linux 7.3 system prior to
the submit, since patch was so unhappy trying to lay down the
changes from Christopher's change. Presumably this is just due to
different yacc/bison/whatever particulars on the system where
Christopher made the changes originally. - rmg
#4 2491 rmg Some consting in jam to make it more compilable by C++ compilers.

No functional change.

=== computer:1666: Change 37433 by perforce@perforce on 2002/10/30 16:08:51

Recreational const-ing of jam, for compilers that don't allow
"string" to be passed as a non-const char *.

This included a few places where we were modifying what could
possibly have been read-only storage, oddly enough.

No functional change.

=== computer:1666: Change 37602 by seiwald@play-seiwald on 2002/11/04 17:25:40
#3 2489 rmg Jam tinkering: since all calls to list_new() must either newstr()
or copystr() the added string, instead just pass a flag and let
list_new() do the newstr/copystr.

No functional change.

=== computer:1666: Change 37164 by seiwald@spice on 2002/10/22 01:21:58
#2 486 Perforce staff Jam 2.3.
 See RELNOTES for a list of changes from 2.2.x.

Just about every source file was touched when jam got ANSI-fied.
#1 2 laura Add Jam/MR 2.2 source