Changeset 3026


Ignore:
Timestamp:
Apr 7, 2007, 3:05:56 PM (18 years ago)
Author:
bird
Message:

Make an attempt at converting common ilink/link386 options to wlink lingo to make migration smoother.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/emxomf/emxomfld.c

    r3005 r3026  
    152152   the defaults of emxbind. */
    153153static long stack_size = 1024;
     154/* Indicates that we've seen -Zstack. */
     155static int stack_size_flag = 0;
    154156
    155157/* The name of the linker to use.  By default, ilink is used.  This
     
    15081510         "    lib<name>.lib, <name>.lib, <name>.dll, lib<name>_s.lib, <name>_s.lib.\n"
    15091511         " -Zdll-search:\n"
    1510          "    Enables dlls as valid libraries from shared linking. (default disabled)\n", 
     1512         "    Enables dlls as valid libraries from shared linking. (default disabled)\n",
    15111513         stderr);
    15121514  fputs (" -Zsym:"
    1513          "    Invoke mapsym.cmd on the mapfile to produce a .sym file. Requires -Zmap.\n" 
     1515         "    Invoke mapsym.cmd on the mapfile to produce a .sym file. Requires -Zmap.\n"
    15141516         "\n", stderr);
    15151517  fputs ("Environment variables:\n"
     
    17381740          if (errno != 0 || *t != 0 || t == optarg)
    17391741            return 1;
     1742          stack_size_flag = 1;
    17401743          break;
    17411744
     
    20522055  else /* wlink */
    20532056    {
     2057      unsigned uPMType = 0;
     2058
    20542059      open_response_file ();
    20552060
     2061      /* convert common ilink/link386 command line arguments. */
     2062
     2063      for (pcur = options; pcur; pcur = pcur->next)
     2064        {
     2065          size_t cchOpt;
     2066          const char *pszVal;
     2067          size_t cchVal;
     2068
     2069          if (pcur->name [0] != '-' && pcur->name [0] != '/')
     2070            continue;
     2071          if (strchr (&pcur->name[1], '='))
     2072            continue;
     2073          pszVal = strchr (&pcur->name[1], ':');
     2074          cchOpt = pszVal ? pszVal - &pcur->name[1] : strlen (&pcur->name[1]);
     2075          if (pszVal && pszVal[1])
     2076            cchVal = strlen (++pszVal);
     2077          else
     2078            pszVal = NULL, cchVal = 0;
     2079#define MAX(a,b) ((a) <= (b) ? (a) : (b))
     2080          if (!strnicmp (&pcur->name[1], "PMtype", cchOpt)
     2081           && cchVal)
     2082            {
     2083              if (!strnicmp (pszVal, "PM", cchVal))
     2084                uPMType = _MD_WINDOWAPI;
     2085              else if (!strnicmp (pszVal, "VIO", cchVal))
     2086                uPMType = _MD_WINDOWCOMPAT;
     2087              else if (!strnicmp (pszVal, "NOVIO", MAX (cchVal, 3)))
     2088                uPMType = _MD_NOTWINDOWCOMPAT;
     2089              else
     2090                continue;
     2091            }
     2092          else if (!strnicmp (&pcur->name[1], "PDD", MAX (cchOpt, 3)))
     2093            uPMType = _MD_PHYSICAL;
     2094          else if (!strnicmp (&pcur->name[1], "VDD", MAX (cchOpt, 3)))
     2095            uPMType = _MD_VIRTUAL;
     2096          else if (!strnicmp (&pcur->name[1], "STACK", MAX (cchOpt, 2))
     2097                && cchVal && !stack_size_flag)
     2098            {
     2099              errno = 0;
     2100              stack_size = strtol (pszVal, &t, 0);
     2101              if (errno || *t)
     2102                {
     2103                  fprintf(stderr, "emxomfld: Number conversion failed: '%s'\n", pcur->name);
     2104                  return 1;
     2105                }
     2106              stack_size = (stack_size + 0xfff) / 1024;
     2107            }
     2108          /* ignore these */
     2109          else if (!strnicmp (&pcur->name[1], "PACKCODE", MAX (cchOpt, 5))
     2110                || !strnicmp (&pcur->name[1], "NOPACKCODE", MAX (cchOpt, 3))
     2111                || !strnicmp (&pcur->name[1], "EXEPACK", MAX (cchOpt, 1))
     2112                || !strnicmp (&pcur->name[1], "NOEXEPACK", MAX (cchOpt, 5))
     2113                || !strnicmp (&pcur->name[1], "DBGPACK", MAX (cchOpt, 2))
     2114                || !strnicmp (&pcur->name[1], "NODBGPACK", MAX (cchOpt, 4))
     2115                )
     2116            fprintf(stderr, "emxomfld: warning: ignoring ilink option '%s'\n", pcur->name);
     2117          else
     2118            continue;
     2119          pcur->name = NULL;
     2120#undef MAX
     2121        }
     2122
    20562123      /* figure out what format options we're gonna use */
    20572124
    20582125      if (!def_fname && !dll_flag)
    2059         fprintf (response_file, "FORMAT OS2 LX PMCompatible\n");
     2126        {
     2127          switch (uPMType)
     2128            {
     2129              case 0:
     2130              case _MD_WINDOWCOMPAT:
     2131              default:
     2132                fprintf (response_file, "FORMAT OS2 LX PMCompatible\n");
     2133                break;
     2134              case _MD_WINDOWAPI:
     2135                fprintf (response_file, "FORMAT OS2 LX PM\n");
     2136                break;
     2137              case _MD_NOTWINDOWCOMPAT:
     2138                fprintf (response_file, "FORMAT OS2 LX FULLscreen\n");
     2139                break;
     2140              case _MD_PHYSICAL:
     2141                dll_flag = TRUE;
     2142                fprintf (response_file, "FORMAT OS2 LX PHYSdevice\n");
     2143                break;
     2144              case _MD_VIRTUAL:
     2145                dll_flag = TRUE;
     2146                fprintf (response_file, "FORMAT OS2 LX VIRTdevice\n");
     2147                break;
     2148            }
     2149        }
    20602150      else if (!def_fname && dll_flag)
    20612151        fprintf (response_file, "FORMAT OS2 LX DLL INITINSTANCE TERMINSTANCE\n");
     
    21062196            {
    21072197              if (token == _MD_NAME)
     2198                {
     2199                  /* (ignores uPMType and uses the .def-file) */
    21082200                  token = _md_next_token (pMd);
    2109               if (token == _MD_quote || token == _MD_word)
    2110                   token = _md_next_token (pMd);
     2201                  if (token == _MD_quote || token == _MD_word)
     2202                    token = _md_next_token (pMd);
     2203                }
     2204              else
     2205                token = uPMType;
    21112206              switch (token)
    21122207                {
     
    21652260
    21662261      for (pcur = options; pcur; pcur = pcur->next)
    2167         fprintf (response_file, "%s\n", pcur->name);
     2262        if (pcur->name)
     2263          fprintf (response_file, "%s\n", pcur->name);
    21682264
    21692265      /* Put the object file names onto the command line. */
Note: See TracChangeset for help on using the changeset viewer.