RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   18-Jun-2017 11:44:14
  Branch: rpm-5_4                          Handle: 2017061809441400

  Modified files:           (Branch: rpm-5_4)
    rpm/rpmio               teio.c

  Log:
    - rpmeio: WIP.

  Summary:
    Revision    Changes     Path
    1.1.2.5     +97 -48     rpm/rpmio/teio.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/teio.c
  ============================================================================
  $ cvs diff -u -r1.1.2.4 -r1.1.2.5 teio.c
  --- rpm/rpmio/teio.c  18 Jun 2017 04:49:08 -0000      1.1.2.4
  +++ rpm/rpmio/teio.c  18 Jun 2017 09:44:14 -0000      1.1.2.5
  @@ -999,69 +999,118 @@
       }
   }
   
  -static void wrapAnalyze(rpmwrap wrap)
  +static void wrapAnalyze(rpmwrap wrap, FILE *fp)
   {
  +    char *te = wrap->b;
  +
  +    if (fp == NULL)  fp = stderr;
  +    te += sprintf(te, "    case EIO_%s:\n", wrap->subname);
       for (int i = 0; wrap->argtypes[i]; i++) {
        const char * argtype = wrap->argtypes[i];
        const char * argname = wrap->argnames[i];
   
  +     if (!strncmp(argtype, "const ", sizeof("const ")-1))
  +         argtype += sizeof("const ")-1;
  +
        if (!strcmp(argtype, "void")
  -      || !strcmp(argtype, "..."))
  +      || !strcmp(argtype, "...")
  +     ) {
            /* do nothing */;
  -     else if (strchr(argtype, '*')
  -           || strstr(argtype, "caddr_t")
  -           || strstr(argtype, "timer_t")
  -           || !strcmp(argtype, "eio_wd")
  -           || strstr(argtype, "cap_user_data_t")
  -           || strstr(argtype, "cap_user_header_t"))
  +     } else
  +     if (strchr(argtype, '*')
  +      || strstr(argtype, "caddr_t")
  +      || strstr(argtype, "timer_t")
  +      || !strcmp(argtype, "eio_wd")
  +      || strstr(argtype, "cap_user_data_t")
  +      || strstr(argtype, "cap_user_header_t")
  +     ) {
            wrap->nptrs++;
  -     else if (!strcmp(argtype, "int") && strstr(argname, "[2]"))
  -         wrap->nints += 2;
  -     else if (!strcmp(argtype, "int")
  -           || !strcmp(argtype, "unsigned")
  -           || !strcmp(argtype, "unsigned int")
  -           || !strcmp(argtype, "uint32_t")
  -           || !strcmp(argtype, "uid_t")
  -           || !strcmp(argtype, "gid_t")
  -           || !strcmp(argtype, "pid_t")
  -           || !strcmp(argtype, "id_t")
  -           || !strcmp(argtype, "mode_t")
  -           || !strcmp(argtype, "mqd_t")
  -           || !strcmp(argtype, "key_serial_t")
  -           || !strcmp(argtype, "key_t")
  -           || !strcmp(argtype, "dev_t")
  -           || !strcmp(argtype, "socklen_t")
  -           || !strcmp(argtype, "clockid_t")
  -           || strstr(argtype, "enum "))
  +         te += sprintf(te, "\treq->ptr%u = va_arg(ap, %s);\n", wrap->nptrs, 
argtype);
  +     } else
  +     if (!strcmp(argtype, "int") && strstr(argname, "[2]"))
  +     {
            wrap->nints++;
  -     else if (!strcmp(argtype, "off_t"))
  +         te += sprintf(te, "\treq->int%u = va_arg(ap, %s);\n", wrap->nints, 
argtype);
  +         wrap->nints++;
  +         te += sprintf(te, "\treq->int%u = va_arg(ap, %s);\n", wrap->nints, 
argtype);
  +     } else
  +     if (!strcmp(argtype, "int")
  +      || !strcmp(argtype, "unsigned")
  +      || !strcmp(argtype, "unsigned int")
  +      || !strcmp(argtype, "uint32_t")
  +      || !strcmp(argtype, "uid_t")
  +      || !strcmp(argtype, "gid_t")
  +      || !strcmp(argtype, "pid_t")
  +      || !strcmp(argtype, "id_t")
  +      || !strcmp(argtype, "mode_t")
  +      || !strcmp(argtype, "mqd_t")
  +      || !strcmp(argtype, "key_serial_t")
  +      || !strcmp(argtype, "key_t")
  +      || !strcmp(argtype, "dev_t")
  +      || !strcmp(argtype, "socklen_t")
  +      || !strcmp(argtype, "clockid_t")
  +      || strstr(argtype, "enum ")
  +     ) {
  +         wrap->nints++;
  +         te += sprintf(te, "\treq->int%u = va_arg(ap, %s);\n", wrap->nints, 
argtype);
  +     } else
  +     if (!strcmp(argtype, "off_t")
  +     ) {
            wrap->noffs++;
  -     else if (!strcmp(argtype, "size_t"))
  +         te += sprintf(te, "\treq->off%u = va_arg(ap, %s);\n", wrap->noffs, 
argtype);
  +     } else
  +     if (!strcmp(argtype, "size_t")
  +     ) {
            wrap->nsizes++;
  -     else if (!strcmp(argtype, "double"))
  +         te += sprintf(te, "\treq->size%u = va_arg(ap, %s);\n", 
wrap->nsizes, argtype);
  +     } else
  +     if (!strcmp(argtype, "double")
  +     ) {
  +         wrap->ndoubles++;
  +         te += sprintf(te, "\treq->nav%u = va_arg(ap, %s);\n", 
wrap->ndoubles, argtype);
  +     } else
  +     if ((strstr(argtype, "struct timeval") && strstr(argname, "[2]"))
  +      || (strstr(argtype, "struct timespec") && strstr(argname, "[2]"))
  +     ) {
            wrap->ndoubles++;
  -     else if ((strstr(argtype, "struct timeval") && strstr(argname, "[2]"))
  -           || (strstr(argtype, "struct timespec") && strstr(argname, "[2]")))
  -         wrap->ndoubles += 2;
  -     else if (!strcmp(argtype, "struct timeval")
  -           || !strcmp(argtype, "struct timespec"))
  -         wrap->ndoubles += 1;
  -     else if (!strcmp(argtype, "long")
  -           || !strcmp(argtype, "long int")
  -           || !strcmp(argtype, "unsigned long")
  -           || !strcmp(argtype, "unsigned long int")
  -           || !strcmp(argtype, "nfds_t")
  -           || !strcmp(argtype, "aio_context_t"))
  +         te += sprintf(te, "\treq->nav%u = va_arg(ap, %s);\n", 
wrap->ndoubles, argtype);
  +         wrap->ndoubles++;
  +         te += sprintf(te, "\treq->nav%u = va_arg(ap, %s);\n", 
wrap->ndoubles, argtype);
  +     } else
  +     if (!strcmp(argtype, "struct timeval")
  +      || !strcmp(argtype, "struct timespec")
  +     ) {
  +         wrap->ndoubles++;
  +         te += sprintf(te, "\treq->nav%u = va_arg(ap, %s);\n", 
wrap->ndoubles, argtype);
  +     } else
  +     if (!strcmp(argtype, "long")
  +      || !strcmp(argtype, "long int")
  +      || !strcmp(argtype, "unsigned long")
  +      || !strcmp(argtype, "unsigned long int")
  +      || !strcmp(argtype, "nfds_t")
  +      || !strcmp(argtype, "aio_context_t")
  +     ) {
            wrap->nlongs++;
  -     else if (!strcmp(argtype, "long long")
  -           || !strcmp(argtype, "unsigned long long")
  -           || !strcmp(argtype, "off64_t")
  -           || !strcmp(argtype, "uint64_t")
  -           || !strcmp(argtype, "u64"))
  +         te += sprintf(te, "\treq->long%u = va_arg(ap, %s);\n", 
wrap->nlongs, argtype);
  +     } else
  +     if (!strcmp(argtype, "long long")
  +      || !strcmp(argtype, "unsigned long long")
  +      || !strcmp(argtype, "off64_t")
  +      || !strcmp(argtype, "uint64_t")
  +      || !strcmp(argtype, "u64")
  +     ) {
            wrap->nlonglongs++;
  -     else
  +         te += sprintf(te, "\treq->longlong%u = va_arg(ap, %s);\n", 
wrap->nlonglongs, argtype);
  +     } else
  +     {
            wrap->nother++;
  +     }
       }
  +    te += sprintf(te, "\tbreak;\n");
  +    *te = '\0';
  +
  +fprintf(fp, "%s", wrap->b);
  +
   }
   
   static const char *wrapArgFormat(rpmwrap wrap, const char * argtype)
  @@ -1300,7 +1349,7 @@
        items = argvFree(items);
        proto = _free(proto);
   
  -wrapAnalyze(wrap);
  +wrapAnalyze(wrap, NULL);
   wrapDump(__FUNCTION__, wrap, NULL);
   wrapPrint(wrap, NULL);
   wrapFree(wrap);
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to