|
|
1.1 ! root 1: /* tree_struct.c - Tree Structure utility routines */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/dsap/common/RCS/tree_struct.c,v 7.1 90/03/15 11:17:42 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/dsap/common/RCS/tree_struct.c,v 7.1 90/03/15 11:17:42 mrose Exp $ ! 9: * ! 10: * ! 11: * $Log: tree_struct.c,v $ ! 12: * Revision 7.1 90/03/15 11:17:42 mrose ! 13: * quipu-sync ! 14: * ! 15: * Revision 7.0 89/11/23 21:44:39 mrose ! 16: * Release 6.0 ! 17: * ! 18: */ ! 19: ! 20: /* ! 21: * NOTICE ! 22: * ! 23: * Acquisition, use, and distribution of this module and related ! 24: * materials are subject to the restrictions of a license agreement. ! 25: * Consult the Preface in the User's Manual for the full terms of ! 26: * this agreement. ! 27: * ! 28: */ ! 29: ! 30: ! 31: /* LINTLIBRARY */ ! 32: ! 33: #include "quipu/util.h" ! 34: #include "quipu/entry.h" ! 35: ! 36: extern int oidformat; ! 37: ! 38: /* ARGSUSED */ ! 39: static tree_struct_free (ptr) ! 40: struct tree_struct * ptr; ! 41: { ! 42: /* don't free objectclass - in static table */ ! 43: ; ! 44: } ! 45: ! 46: ! 47: static struct tree_struct * tree_struct_cpy (a) ! 48: struct tree_struct * a; ! 49: { ! 50: struct tree_struct * result; ! 51: ! 52: result = tree_struct_alloc (); ! 53: result->tree_object = a->tree_object; ! 54: return (result); ! 55: } ! 56: ! 57: static tree_struct_cmp (a,b) ! 58: struct tree_struct * a, *b; ! 59: { ! 60: if (a == NULLTREE) ! 61: return (b==NULLTREE ? 0 : -1 ); ! 62: ! 63: if (b == NULLTREE) ! 64: return (1); ! 65: ! 66: return ( objclass_cmp(a->tree_object,b->tree_object)); ! 67: } ! 68: ! 69: ! 70: /* ARGSUSED */ ! 71: static tree_struct_print (ps,tree,format) ! 72: register PS ps; ! 73: struct tree_struct * tree; ! 74: int format; ! 75: { ! 76: ps_printf (ps,"%s",oc2name(tree->tree_object,oidformat)); ! 77: } ! 78: ! 79: ! 80: static struct tree_struct * str2schema (str) ! 81: char * str; ! 82: { ! 83: struct tree_struct * ts; ! 84: objectclass * str2oc(); ! 85: ! 86: ts = tree_struct_alloc (); ! 87: if ((ts->tree_object = str2oc(str)) == NULLOBJECTCLASS) { ! 88: parse_error ("invalid oid in schema '%s'",str); ! 89: free ((char *) ts); ! 90: return (NULLTREE); ! 91: } ! 92: return (ts); ! 93: } ! 94: ! 95: static PE ts_enc (ts) ! 96: struct tree_struct * ts; ! 97: { ! 98: PE ret_pe; ! 99: ! 100: (void) encode_Quipu_TreeStructureSyntax(&ret_pe,0,0,NULLCP,ts); ! 101: ! 102: return (ret_pe); ! 103: } ! 104: ! 105: static struct tree_struct * ts_dec (pe) ! 106: PE pe; ! 107: { ! 108: struct tree_struct * ts; ! 109: ! 110: if (decode_Quipu_TreeStructureSyntax(pe,1,NULLIP,NULLVP,&ts) == NOTOK) ! 111: return (struct tree_struct *)NULL; ! 112: ! 113: return (ts); ! 114: } ! 115: ! 116: schema_syntax () ! 117: { ! 118: (void) add_attribute_syntax ("schema", ! 119: (IFP) ts_enc, (IFP) ts_dec, ! 120: (IFP) str2schema, tree_struct_print, ! 121: (IFP) tree_struct_cpy, tree_struct_cmp, ! 122: tree_struct_free, NULLCP, ! 123: NULLIFP, FALSE ); ! 124: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.