DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T a

⟦c3c469c78⟧ TextFile

    Length: 1486 (0x5ce)
    Types: TextFile
    Names: »ap_s2t.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/addr/ap_s2t.c« 

TextFile

/* ap_s2t.c: convert a string into an address tree */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/addr/RCS/ap_s2t.c,v 5.0 90/09/20 16:04:08 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/addr/RCS/ap_s2t.c,v 5.0 90/09/20 16:04:08 pp Exp Locker: pp $
 *
 * $Log:	ap_s2t.c,v $
 * Revision 5.0  90/09/20  16:04:08  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"
#include "ap.h"


static char *ap_str_ptr;




/* ---------------------  Static  Routines  ------------------------------- */



static int get_a_char()        /* -- get next character from string -- */
{

	if (*ap_str_ptr == '\0')
		/* -- end of the string -- */
		return (-1);

	return (*ap_str_ptr++);
}




/* ---------------------  Begin  Routines  -------------------------------- */



/* -- parse a string into an address tree -- */

AP_ptr ap_s2t (thestr)
char            *thestr;
{
	int     got_one;
	AP_ptr  thetree;


	PP_DBG (("Lib/addr/ap_s2t (%s)", thestr));

	ap_str_ptr = thestr;

	if ((thetree = ap_pinit (get_a_char)) == BADAP)
		return( NULLAP);

	ap_clear();

	got_one = 0;

	for (;;)
		switch (ap_1adr()) {
		case NOTOK:
			ap_sqdelete (thetree, NULLAP);
			ap_free (thetree);
			return (NULLAP);

		case OK:
			/* -- more to process -- */
			got_one++;
			continue;

		case DONE:
			if (got_one != 1){
				ap_sqdelete(thetree, NULLAP);
				ap_free(thetree);
				thetree = BADAP;
			}
			return (thetree);
		}
}