* elf64-ppc.c: Don't include elf/ppc.h.
[deliverable/binutils-gdb.git] / binutils / resrc.c
index a9b3ba8f0b4250d8124f6d95be17f3418bdf4108..cced3f20113a7b23a9bdf28e2d7bb8acae32dfca 100644 (file)
@@ -1,5 +1,5 @@
 /* resrc.c -- read and write Windows rc files.
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GNU Binutils.
@@ -70,7 +70,7 @@
 #ifndef STDOUT_FILENO
 #define STDOUT_FILENO 1
 #endif
+
 #if defined (_WIN32) && ! defined (__CYGWIN__)
 #define popen _popen
 #define pclose _pclose
@@ -193,38 +193,38 @@ run_cmd (cmd, redir)
 
   /* Count the args.  */
   i = 0;
-  
+
   for (s = cmd; *s; s++)
     if (*s == ' ')
       i++;
-  
+
   i++;
   argv = alloca (sizeof (char *) * (i + 3));
   i = 0;
   s = cmd;
-  
+
   while (1)
     {
       while (*s == ' ' && *s != 0)
        s++;
-      
+
       if (*s == 0)
        break;
-      
+
       in_quote = (*s == '\'' || *s == '"');
       sep = (in_quote) ? *s++ : ' ';
       argv[i++] = s;
-      
+
       while (*s != sep && *s != 0)
        s++;
-      
+
       if (*s == 0)
        break;
-      
+
       *s++ = 0;
-      
+
       if (in_quote)
-        s++;
+       s++;
     }
   argv[i++] = NULL;
 
@@ -237,8 +237,8 @@ run_cmd (cmd, redir)
   /* Open temporary output file.  */
   redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, 0666);
   if (redir_handle == -1)
-    fatal (_("can't open temporary file `%s': %s"), redir, 
-           strerror (errno));
+    fatal (_("can't open temporary file `%s': %s"), redir,
+          strerror (errno));
 
   /* Duplicate the stdout file handle so it can be restored later.  */
   stdout_save = dup (STDOUT_FILENO);
@@ -265,7 +265,7 @@ run_cmd (cmd, redir)
 
   retcode = 0;
   pid = pwait (pid, &wait_status, 0);
-  
+
   if (pid == -1)
     {
       fatal (_("wait: %s"), strerror (errno));
@@ -280,14 +280,14 @@ run_cmd (cmd, redir)
     {
       if (WEXITSTATUS (wait_status) != 0)
        {
-         fatal (_("%s exited with status %d"), cmd, 
+         fatal (_("%s exited with status %d"), cmd,
                 WEXITSTATUS (wait_status));
          retcode = 1;
        }
     }
   else
     retcode = 1;
-  
+
   return retcode;
 }
 
@@ -309,11 +309,11 @@ open_input_stream (cmd)
 
       cpp_pipe = fopen (cpp_temp_file, FOPEN_RT);;
       if (cpp_pipe == NULL)
-        fatal (_("can't open temporary file `%s': %s"), 
+       fatal (_("can't open temporary file `%s': %s"),
               cpp_temp_file, strerror (errno));
-      
+
       if (verbose)
-       fprintf (stderr, 
+       fprintf (stderr,
                 _("Using temporary file `%s' to read preprocessor output\n"),
                 cpp_temp_file);
     }
@@ -321,7 +321,7 @@ open_input_stream (cmd)
     {
       cpp_pipe = popen (cmd, FOPEN_RT);
       if (cpp_pipe == NULL)
-        fatal (_("can't popen `%s': %s"), cmd, strerror (errno));
+       fatal (_("can't popen `%s': %s"), cmd, strerror (errno));
       if (verbose)
        fprintf (stderr, _("Using popen to read preprocessor output\n"));
     }
@@ -472,7 +472,7 @@ read_rc_file (filename, preprocessor, preprocargs, language, use_temp_file)
        }
 
     }
-  
+
   free (cmd);
 
   rc_filename = xstrdup (filename);
@@ -481,9 +481,10 @@ read_rc_file (filename, preprocessor, preprocargs, language, use_temp_file)
     rcparse_set_language (language);
   yyin = cpp_pipe;
   yyparse ();
+  rcparse_discard_strings ();
 
   close_input_stream ();
-  
+
   if (fontdirs != NULL)
     define_fontdirs ();
 
@@ -506,7 +507,7 @@ close_input_stream ()
       if (cpp_temp_file != NULL)
        {
          int errno_save = errno;
-         
+
          unlink (cpp_temp_file);
          errno = errno_save;
          free (cpp_temp_file);
@@ -817,8 +818,8 @@ define_dialog (id, resinfo, dialog)
    merely allocates and fills in a structure.  */
 
 struct dialog_control *
-define_control (text, id, x, y, width, height, class, style, exstyle)
-     const char *text;
+define_control (iid, id, x, y, width, height, class, style, exstyle)
+     const struct res_id iid;
      unsigned long id;
      unsigned long x;
      unsigned long y;
@@ -841,9 +842,7 @@ define_control (text, id, x, y, width, height, class, style, exstyle)
   n->height = height;
   n->class.named = 0;
   n->class.u.id = class;
-  if (text == NULL)
-    text = "";
-  res_string_to_id (&n->text, text);
+  n->text = iid;
   n->data = NULL;
   n->help = 0;
 
@@ -863,9 +862,12 @@ define_icon_control (iid, id, x, y, style, exstyle, help, data, ex)
      struct dialog_ex *ex;
 {
   struct dialog_control *n;
+  struct res_id tid;
+
   if (style == 0)
     style = SS_ICON | WS_CHILD | WS_VISIBLE;
-  n = define_control (0, id, x, y, 0, 0, CTL_STATIC, style, exstyle);
+  res_string_to_id (&tid, "");
+  n = define_control (tid, id, x, y, 0, 0, CTL_STATIC, style, exstyle);
   n->text = iid;
   if (help && !ex)
     rcparse_warning (_("help ID requires DIALOGEX"));
@@ -1592,7 +1594,8 @@ write_rc_directory (e, rd, type, name, language, level)
              && (re->id.u.id & 0xffff) == re->id.u.id)
            {
              fprintf (e, "LANGUAGE %lu, %lu\n",
-                      re->id.u.id & 0xff, (re->id.u.id >> 8) & 0xff);
+                      re->id.u.id & ((1 << SUBLANG_SHIFT) - 1),
+                      (re->id.u.id >> SUBLANG_SHIFT) & 0xff);
              *language = re->id.u.id;
            }
          break;
@@ -1697,7 +1700,7 @@ write_rc_subdir (e, re, type, name, language, level)
       fprintf (e, "// Level %d: ", level);
       res_id_print (e, re->id, 1);
       fprintf (e, "\n");
-    }          
+    }
 
   write_rc_directory (e, re->u.dir, type, name, language, level + 1);
 }
@@ -2086,8 +2089,11 @@ write_rc_dialog (e, dialog)
       unicode_print (e, dialog->font, -1);
       fprintf (e, "\"");
       if (dialog->ex != NULL
-         && (dialog->ex->weight != 0 || dialog->ex->italic != 0))
-       fprintf (e, ", %d, %d", dialog->ex->weight, dialog->ex->italic);
+         && (dialog->ex->weight != 0
+             || dialog->ex->italic != 0
+             || dialog->ex->charset != 1))
+       fprintf (e, ", %d, %d, %d",
+                dialog->ex->weight, dialog->ex->italic, dialog->ex->charset);
       fprintf (e, "\n");
     }
 
@@ -2162,7 +2168,7 @@ write_rc_dialog_control (e, control)
     fprintf (e, "%s", ci->name);
   else
     fprintf (e, "CONTROL");
-  
+
   if (control->text.named || control->text.u.id != 0)
     {
       fprintf (e, " ");
This page took 0.026827 seconds and 4 git commands to generate.