|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 4277 (0x10b5) Types: TextFile Names: »syn_policy.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« └─⟦e5a54fb17⟧ └─⟦this⟧ »pp-5.0/Chans/dirlist/syn_policy.c«
/* syn_policy.c: */ # ifndef lint static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Chans/dirlist/RCS/syn_policy.c,v 5.0 90/09/20 15:46:17 pp Exp Locker: pp $"; # endif /* * $Header: /cs/research/pp/hubris/pp-beta/Chans/dirlist/RCS/syn_policy.c,v 5.0 90/09/20 15:46:17 pp Exp Locker: pp $ * * $Log: syn_policy.c,v $ * Revision 5.0 90/09/20 15:46:17 pp * rcsforce : 5.0 public release * */ #include "dlist.h" #include <isode/cmd_srch.h> static CMD_TABLE expand_table [] = { "FALSE", FALSE, "TRUE", TRUE, 0, -1, }; static CMD_TABLE convert_table [] = { "ORIGINAL", DP_ORIGINAL, "FALSE", DP_FALSE, "TRUE", DP_TRUE, 0, -1, }; static CMD_TABLE priority_table [] = { "ORIGINAL", DP_ORIGINAL, "LOW", DP_LOW, "NORMAL", DP_NORMAL, "HIGH", DP_HIGH, 0, -1, }; static dl_policy_free (ptr) struct dl_policy * ptr; { free ((char *) ptr); } static struct dl_policy * dl_policy_cpy (a) struct dl_policy * a; { struct dl_policy * result; result = (struct dl_policy *) smalloc (sizeof (struct dl_policy)); *result = *a; /* struct copy */ return (result); } static dl_policy_cmp (a,b) struct dl_policy * a; struct dl_policy * b; { if (a == (struct dl_policy *) NULL) if (b == (struct dl_policy *) NULL) return (0); else return (-1); if (b == (struct dl_policy *) NULL) return 1; if (a->dp_expand != b->dp_expand) return ( a->dp_expand > b->dp_expand ? 1 : -1); if (a->dp_priority != b->dp_priority) return ( a->dp_priority > b->dp_priority ? 1 : -1); if (a->dp_convert != b->dp_convert) return ( a->dp_convert > b->dp_convert ? 1 : -1); return (0); } static dl_policy_print (ps,p,format) register PS ps; struct dl_policy* p; int format; { if (format == READOUT) ps_print (ps,"Expansion: "); ps_printf (ps,"%s",rcmd_srch(p->dp_expand,expand_table)); if (format == READOUT) ps_print (ps,", Conversion: "); else ps_print (ps,"$"); ps_printf (ps,"%s",rcmd_srch(p->dp_convert,convert_table)); if (format == READOUT) ps_print (ps,", Priority: "); else ps_print (ps,"$"); ps_printf (ps,"%s",rcmd_srch(p->dp_priority,priority_table)); } static struct dl_policy* str2dl_policy (str) char * str; { struct dl_policy * result; char * ptr; char * mark = NULLCP; char * prtparse (); if ( (ptr=index (str,'$')) == NULLCP) { parse_error ("seperator missing in dl_policy '%s'",str); return ((struct dl_policy *) NULL); } result = (struct dl_policy *) smalloc (sizeof (struct dl_policy)); *ptr--= 0; if (isspace (*ptr)) { *ptr = 0; mark = ptr; } ptr++; if (*str == 0) result->dp_expand = TRUE; else if ((result->dp_expand = cmd_srch(str,expand_table)) == -1) { parse_error ("%s unrecognised",str); return ((struct dl_policy *) NULL); } *ptr++ = '$'; if (mark != NULLCP) *mark = ' '; str = SkipSpace(ptr); if ( (ptr=index (str,'$')) == NULLCP) { parse_error ("2nd seperator missing in dl_policy '%s'",str); return ((struct dl_policy *) NULL); } *ptr--= 0; if (isspace (*ptr)) { *ptr = 0; mark = ptr; } else mark = NULLCP; ptr++; if (*str == 0) result->dp_convert = DP_ORIGINAL; else if ((result->dp_convert = cmd_srch(str,convert_table)) == -1) { parse_error ("%s unrecognised (2)",str); return ((struct dl_policy *) NULL); } *ptr++ = '$'; if (mark != NULLCP) *mark = ' '; ptr = SkipSpace (ptr); if (*ptr == 0) result->dp_priority = DP_LOW; else if ((result->dp_priority = cmd_srch(ptr,priority_table)) == -1) { parse_error ("%s unrecognised (3)",ptr); return ((struct dl_policy *) NULL); } return (result); } static PE dl_policy_enc (m) struct dl_policy * m; { PE ret_pe; (void) encode_DL_DlPolicy (&ret_pe,0,0,NULLCP,m); return (ret_pe); } static struct dl_policy * dl_policy_dec (pe) PE pe; { struct dl_policy * m; m = (struct dl_policy *) smalloc (sizeof (struct dl_policy)); if (decode_DL_DlPolicy (pe,1,NULLIP,NULLVP,m) == NOTOK) { free ((char *)m); return ((struct dl_policy *) NULL); } return (m); } policy_syntax () { (void) add_attribute_syntax ("DlPolicy", (IFP) dl_policy_enc, (IFP) dl_policy_dec, (IFP) str2dl_policy, dl_policy_print, (IFP) dl_policy_cpy, dl_policy_cmp, dl_policy_free, NULLCP, NULLIFP, TRUE); }