Annotation of 43BSDReno/contrib/isode-beta/pepy/salary.py, revision 1.1.1.1

1.1       root        1: SalaryDefs DEFINITIONS ::=
                      2: 
                      3: %{
                      4: #include <stdio.h>
                      5: 
                      6: #define PEPYPARM struct salary_record *
                      7: 
                      8: 
                      9: static char *myname = "salary";
                     10: 
                     11: static struct salary_record {
                     12:     char   *name;
                     13:     int     salary;
                     14: }                           salary;
                     15: 
                     16: 
                     17: void   adios ();
                     18: 
                     19: /*  */
                     20: 
                     21: /* ARGSUSED */
                     22: 
                     23: main (argc, argv, envp)
                     24: int     argc;
                     25: char  **argv,
                     26:       **envp;
                     27: {
                     28:     PE     pe;
                     29: 
                     30:     myname = argv[0];
                     31: 
                     32:     if (argc != 3)
                     33:        adios (NULLCP, "usage: %s name salary", myname);
                     34:     salary.name = argv[1];
                     35:     salary.salary = atoi (argv[2]);
                     36: 
                     37:     if (build_SalaryDefs_Salary (&pe, 1, NULL, NULLCP, &salary) == NOTOK)
                     38:        adios (NULLCP, "encoder fails");
                     39: 
                     40:     salary.name = NULL;
                     41:     salary.salary = 0;
                     42: 
                     43:     if (unbuild_SalaryDefs_Salary (pe, 1, NULLIP, NULLVP, &salary) == NOTOK)
                     44:        adios (NULLCP, "decoder fails");
                     45: 
                     46:     exit (0);                  /* NOTREACHED */
                     47: }
                     48: %}
                     49: 
                     50: BEGIN
                     51: 
                     52: SECTIONS build unbuild none
                     53: 
                     54: Salary ::=
                     55:        SEQUENCE {
                     56:            name
                     57:                PrintableString [[s parm -> name]]
                     58:                %{ printf("name %s ", parm -> name); %},
                     59: 
                     60:            salary
                     61:                TheSalary [[i parm -> salary ]]
                     62:                %{ printf("salary %d\n", parm -> salary); %}
                     63:        }
                     64: 
                     65: TheSalary ::=
                     66:        INTEGER
                     67: 
                     68: END
                     69: 
                     70: %{
                     71: 
                     72: /*    ERRORS */
                     73: 
                     74: #include <varargs.h>
                     75: 
                     76: 
                     77: #ifndef        lint
                     78: void   _advise ();
                     79: 
                     80: 
                     81: static void  adios (va_alist)
                     82: va_dcl
                     83: {
                     84:     va_list ap;
                     85: 
                     86:     va_start (ap);
                     87: 
                     88:     _advise (ap);
                     89: 
                     90:     va_end (ap);
                     91: 
                     92:     _exit (1);
                     93: }
                     94: #else
                     95: /* VARARGS */
                     96: 
                     97: static void  adios (what, fmt)
                     98: char   *what,
                     99:        *fmt;
                    100: {
                    101:     adios (what, fmt);
                    102: }
                    103: #endif
                    104: 
                    105: 
                    106: #ifndef        lint
                    107: static void  advise (va_alist)
                    108: va_dcl
                    109: {
                    110:     va_list ap;
                    111: 
                    112:     va_start (ap);
                    113: 
                    114:     _advise (ap);
                    115: 
                    116:     va_end (ap);
                    117: }
                    118: 
                    119: 
                    120: static void  _advise (ap)
                    121: va_list        ap;
                    122: {
                    123:     char    buffer[BUFSIZ];
                    124: 
                    125:     asprintf (buffer, ap);
                    126: 
                    127:     (void) fflush (stdout);
                    128: 
                    129:     fprintf (stderr, "%s: ", myname);
                    130:     (void) fputs (buffer, stderr);
                    131:     (void) fputc ('\n', stderr);
                    132: 
                    133:     (void) fflush (stderr);
                    134: }
                    135: #else
                    136: /* VARARGS */
                    137: 
                    138: static void  advise (what, fmt)
                    139: char   *what,
                    140:        *fmt;
                    141: {
                    142:     advise (what, fmt);
                    143: }
                    144: #endif
                    145: 
                    146: %}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.