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:   19-Jun-2017 04:30:01
  Branch: rpm-5_4                          Handle: 2017061902300100

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

  Log:
    - rpmeio: WIP.

  Summary:
    Revision    Changes     Path
    1.1.2.7     +64 -59     rpm/rpmio/teio.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/teio.c
  ============================================================================
  $ cvs diff -u -r1.1.2.6 -r1.1.2.7 teio.c
  --- rpm/rpmio/teio.c  19 Jun 2017 01:23:44 -0000      1.1.2.6
  +++ rpm/rpmio/teio.c  19 Jun 2017 02:30:01 -0000      1.1.2.7
  @@ -1278,31 +1278,49 @@
       int nargs = argvCount(wrap->argtypes);
   (void)nargs;
   
  -    char *msg;
  +    char *xstr;
  +    char * fmt;
  +    char * msg;
       if (fp == NULL)  fp = stderr;
   
  -    msg = rpmMCExpand(wrap->mc,
  -             "items: %{@items:, }\n",
  -             "argtypes: %{@argtypes:, }\n",
  -             "argnames: %{@argnames:, }\n",
  +    xstr = rpmMCExpand(wrap->mc, "%{?Subtype}", NULL);
  +  if (xstr && *xstr) {
  +    fmt = rpmMCExpand(wrap->mc,
  +             "%{sed",
  +    " -e s/[^,]*\\\\*[^,]*/%p/g",
  +    " -e s/[^,]*\\\\][^,]*/%p/g",
  +    " -e s/[^,]*enum\\\\s[^,]*,/0x%x/g",
  +    " -e s/[^,]*void//g",
  +    " -e 
s/[^,]*(caddr_t|timer_t|cap_user_data_t|cap_user_header_t|eio_wd|eio_req)/%p/g"
  +    " -e s/[^,]*off64_t/0x%llx/g", 
  +    " -e s/[^,]*nfds_t/%lu/g",
  +    " -e s/[^,]*off_t/0x%lx/g",
  +    " -e s/[^,]*aio_context_t/0x%lx/g",
  +    " -e s/[^,]*(mqd_t|key_serial_t|key_t|dev_t|socklen_t|clockid_t)/0x%x/g",
  +    " -e s/[^,]*(uid_t|gid_t|pid_t|id_t)/%u/g",
  +    " -e s/[^,]*mode_t/0%o/g",
  +    " -e s/[^,]*ssize_t/%zd/g",
  +    " -e s/[^,]*size_t/%zu/g",
  +    " -e s/[^,]*double/%f/g",
  +    " -e s/[^,]*struct\\\\s(timeval|timespec)/%f/g",
  +
  +    " -e s/[^,]*(u64|uint64_t|unsigned\\\\slong\\\\slong)/%lu/g",
  +    " -e s/[^,]*(i64|int64_t|long\\\\slong)/%ld/g",
  +    " -e s/[^,]*(unsigned\\\\slong)/%lu/g",
  +    " -e s/[^,]*(long)/%ld/g",
  +    " -e s/[^,]*(u32|u16|u8|uint32_t|uint16_t|uint8_t|unsigned)/%u/g",
  +    " -e s/[^,]*(i32|i16|i8|int32_t|int16_t|int8_t|int)/%d/g",
  +             ":", xstr, "}",
                NULL);
  -fprintf(fp, "%s", msg);
  -    msg = _free(msg);
  +if (fmt && *fmt)
  +addMacro(wrap->mc, "Subtypefmt", NULL, fmt, 0);
  +    fmt = _free(fmt);
  +  }
  +    xstr = _free(xstr);
   
  -    char * str =
  -#ifdef       DYING
  -     "int,"
  -     "unsigned,"
  -     "long,"
  -     "unsigned long,"
  -     "long long,"
  -     "unsigned long long,"
  -#endif
  -     "%{@argtypes:,}";
  -    char *xstr = rpmMCExpand(wrap->mc, str, NULL);
  -    msg = rpmMCExpand(wrap->mc,
  -             "XXX\t|", str, "| ==> ",
  -             "|%{sed",
  +    xstr = rpmMCExpand(wrap->mc, "%{@argtypes:,}", NULL);
  +    fmt = rpmMCExpand(wrap->mc,
  +             "%{sed",
       " -e s/[^,]*\\\\*[^,]*/%p/g",
       " -e s/[^,]*\\\\][^,]*/%p/g",
       " -e s/[^,]*enum\\\\s[^,]*,/0x%x/g",
  @@ -1326,48 +1344,27 @@
       " -e s/[^,]*(long)/%ld/g",
       " -e s/[^,]*(u32|u16|u8|uint32_t|uint16_t|uint8_t|unsigned)/%u/g",
       " -e s/[^,]*(i32|i16|i8|int32_t|int16_t|int8_t|int)/%d/g",
  -             ":", xstr, "}|\n",
  +             ":", xstr, "}",
                NULL);
  +addMacro(wrap->mc, "argsfmt", NULL, fmt, 0);
       xstr = _free(xstr);
  -fprintf(fp, "%s", msg);
  -    msg = _free(msg);
  +    fmt = _free(fmt);
   
  -#ifdef       NOTYET
  -    for (int i = 0; i < nargs; i++) {
  -     const char * argtype = wrap->argtypes[i];
  -     const char * argname = wrap->argnames[i];
  -(void)argname;
  -
  -     msg = rpmMCExpand(wrap->mc, "\t|", argtype, "| ==> ",
  -             "|%{sed",
  -    " -e s/.*\\\\*/%p/",
  -    " -e s/.*\\\\]/%p/",
  -    " -e s/.*enum.*/0x%x/",
  -    " -e s/^void$//",
  -    " -e 
s/^(caddr_t|timer_t|cap_user_data_t|cap_user_header_t|eio_wd|eio_req)$/%p/"
  -    " -e s/^(unsigned.long.long.int|unsigned.long.long|uint64_t|u64)$/%llu/",
  -    " -e s/^(long.long|long.long.int|int64_t)$/%lld/",
  -    " -e s/^off64_t$/0x%llx/", 
  -    " -e s/^(long|long.int)$/%ld/",
  -    " -e s/^(unsigned.long|unsigned.long.int)$/%lu/",
  -    " -e s/^nfds_t$/%lu/",
  -    " -e s/^off_t$/0x%lx/",
  -    " -e s/^aio_context_t$/0x%lx/",
  -    " -e s/^(int|int32_t)$/%d/",
  -    " -e s/^(unsigned|uint32_t|uid_t|gid_t|pid_t|id_t)$/%u/",
  -    " -e s/^(mqd_t|key_serial_t|key_t|dev_t|socklen_t|clockid_t)$/0x%x/",
  -    " -e s/^mode_t$/0%o/",
  -    " -e s/^ssize_t$/%zd/",
  -    " -e s/^size_t$/%zu/",
  -    " -e s/^double$/%f/",
  -    " -e s/^struct.(timeval|timespec)$/%f/",
  -             " :", argtype, "}|",
  +    msg = rpmMCExpand(wrap->mc,
  +#ifdef       DYING
  +             "   items: %{@items:, }\n",
  +             "argtypes: %{@argtypes:, }\n",
  +             "argnames: %{@argnames:, }\n",
  +#endif       /* DYING */
  +             "**  init: %{subtype} %{Subname}(%{arglist}) {\n",
  +             "** enter:     %{?Subtype:%{subtype} rc;}\n",
  +             "**  call:     %{?Subtype:rc = }%{subname}(%{@argnames:, });\n",
  +             "**  spew: SPEW(\"<-- %s(%{argsfmt})%{?Subtype: rc 
%{Subtypefmt}}\\n\", __FUNCTION__, %{@argnames:, }%{?Subtype:, rc});\n",
  +             "**  exit:     %{?Subtype:return rc;}\n",
  +             "**  fini: }\n",
                NULL);
  -fprintf(fp, "%s\n", msg);
  -     msg = _free(msg);
  -
  -    }
  -#endif       /* NOTYET */
  +fprintf(fp, "%s", msg);
  +    msg = _free(msg);
   }
   
   static int spewEIO(ARGV_t av, int ac)
  @@ -1408,8 +1405,16 @@
        char * subname = t;
   wrap->subname = xstrdup(subname);
   addMacro(wrap->mc, "subname", NULL, wrap->subname, 0);
  +char savec = *wrap->subname;
  +*wrap->subname = toupper(*wrap->subname);
  +addMacro(wrap->mc, "Subname", NULL, wrap->subname, 0);
  +*wrap->subname = savec;
  +
   wrap->subtype = xstrdup(subtype);
   addMacro(wrap->mc, "subtype", NULL, wrap->subtype, 0);
  +if (strcmp(wrap->subtype, "void")) {
  +addMacro(wrap->mc, "Subtype", NULL, wrap->subtype, 0);
  +}
   
        ARGV_t items = NULL;
        xx = argvSplit(&items, arglist, ",");
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to