/* list.h
   Function declarations for routines in list.c */

     /*---------------------------------------------------------------*/
     /* Xgopher        version 1.1     20 April 1991                  */
     /*                version 1.0     04 March 1991                  */
     /* X window system client for the University of Minnesota        */
     /*                                Internet Gopher System.        */
     /* Allan Tuchman, University of Illinois at Urbana-Champaign     */
     /*                Computing Services Office                      */
     /* Copyright 1992 by                                             */
     /*           the Board of Trustees of the University of Illinois */
     /* Permission is granted to freely copy and redistribute this    */
     /* software with the copyright notice intact.                    */
     /*---------------------------------------------------------------*/

#include "globals.h"

gopherItemP newItem(
);

gopherItemP copyItem(
#ifdef PROTO
	gopherItemP
#endif
);

void initItemList(
#ifdef PROTO
	gopherItemListP
#endif
);

void freeItem(
#ifdef PROTO
	gopherItemP
#endif
);

void freeItemList(
#ifdef PROTO
	gopherItemListP
#endif
);

BOOLEAN emptyItemList(
#ifdef PROTO
#endif
);

int itemListLength(
#ifdef PROTO
	gopherItemListP
#endif
);

gopherDirP firstMark(
#ifdef PROTO
#endif
);

void appendItem(
#ifdef PROTO
	gopherItemListP,
	gopherItemP
#endif
);

void pushItem(
#ifdef PROTO
	gopherItemListP,
	gopherItemP
#endif
);

void popItem(
#ifdef PROTO
	gopherItemListP
#endif
);

void removeItemN(
#ifdef PROTO
	gopherItemListP,
	int 
#endif
);

gopherItemP getCurrentItemN(
#ifdef PROTO
	int 
#endif
);

static void allocGopherItem(
#ifdef PROTO
        int
#endif
);

static void freeItems(
#ifdef PROTO
        gopherItemP
#endif
);

static int freeListLength(
#ifdef PROTO
#endif
);

#ifdef DEBUG
void printItemList(
#ifdef PROTO
	gopherItemListP,	/* list */
	char *			/* label */
#endif
);

#endif

/* ---------------------------------------------------------------------- */

int markListLength(
#ifdef PROTO
#endif
);

void pushDir(
#ifdef PROTO
	gopherDirP
#endif
);

void popDir(
);

BOOLEAN anyMarks(
);

gopherDirP getMarkN(
#ifdef PROTO
	int
#endif
);

gopherDirP getCurrentDirectory(
);

char * getCurrentDirIndex(
);

gopherDirP getParentDirectory(
);

BOOLEAN atRoot(
);

void markDir(
);

void goToDir(
#ifdef PROTO
	gopherDirP
#endif
);

void appendDir(
#ifdef PROTO
	gopherDirListP,
	gopherDirP
#endif
);

void removeDir(
#ifdef PROTO
	gopherDirListP,
	gopherDirP
#endif
);

gopherDirP removeDirN(
#ifdef PROTO
	gopherDirListP,
	int
#endif
);

BOOLEAN dirInList(
#ifdef PROTO
	gopherDirListP,
	gopherDirP
#endif
);

void unmarkDir(
#ifdef PROTO
	gopherDirP
#endif
);

void unmarkDirN(
#ifdef PROTO
	int
#endif
);

void unmarkAllDirs(
#ifdef PROTO

#endif
);

void freeDir(
#ifdef PROTO
	gopherDirP
#endif
);

void freeDirPath(
#ifdef PROTO
	gopherDirP
#endif
);

gopherDirP newDir(
#ifdef PROTO
	
#endif
);

/* for internal use */

static void setActiveDirPath(
#ifdef PROTO
        gopherDirP      dir
#endif
);

static void clearActiveDirPath(
#ifdef PROTO
        gopherDirP      dir
#endif
);

static void freeDirs(
#ifdef PROTO
        gopherDirP      dir
#endif
);

static void allocGopherDir(
#ifdef PROTO
        int
#endif
);

static void freeDirContents(
#ifdef PROTO
        gopherDirP
#endif
);

static void checkTree(
#ifdef PROTO
	gopherDirP
#endif
);

#ifdef DEBUG

void printDirTree(
#ifdef PROTO
	gopherDirP,
	char *
#endif
);

void printDir(
#ifdef PROTO
	gopherDirP,
	char *
#endif
);

#endif
