* Makefile.in (LIBCOMMON): Define.
[deliverable/binutils-gdb.git] / binutils / nlmheader.y
index 2b78b893e10c07260bd2c39852c2b40cbbda2aaf..248bec3a503b4f8801e76b5ef385c55c6de00d78 100644 (file)
@@ -29,7 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <stdio.h>
 #include <ctype.h>
-#include <bfd.h>
+#include "bfd.h"
 #include "sysdep.h"
 #include "bucomm.h"
 #include "nlm/common.h"
@@ -55,6 +55,8 @@ boolean debug_info;
 char *exit_procedure;
 /* Exported symbols (EXPORT).  */
 struct string_list *export_symbols;
+/* List of files from INPUT.  */
+struct string_list *input_files;
 /* Map file name (MAP, FULLMAP).  */
 char *map_file;
 /* Whether a full map has been requested (FULLMAP).  */
@@ -67,6 +69,8 @@ struct string_list *import_symbols;
 char *message_file;
 /* Autoload module list (MODULE).  */
 struct string_list *modules;
+/* File named by OUTPUT.  */
+char *output_file;
 /* File named by SHARELIB.  */
 char *sharelib_file;
 /* Start procedure name (START).  */
@@ -126,7 +130,7 @@ static char *xstrdup PARAMS ((const char *));
 %token <string> QUOTED_STRING
 
 /* Typed non-terminals.  */
-%type <list> symbol_list_opt symbol_list module_list
+%type <list> symbol_list_opt symbol_list string_list
 %type <string> symbol
 
 %%
@@ -192,6 +196,12 @@ command:
            free ($2);
            free ($3);
            free ($4);
+           if (version_hdr->month < 1 || version_hdr->month > 12)
+             nlmheader_warn ("illegal month", -1);
+           if (version_hdr->day < 1 || version_hdr->day > 31)
+             nlmheader_warn ("illegal day", -1);
+           if (version_hdr->year < 1900 || version_hdr->year > 3000)
+             nlmheader_warn ("illegal year", -1);
          }
        | DEBUG
          {
@@ -235,6 +245,11 @@ command:
            fixed_hdr->flags &=~ nlmlex_get_number ($2);
            free ($2);
          }
+       | FULLMAP
+         {
+           map_file = "";
+           full_map = true;
+         }
        | FULLMAP STRING
          {
            map_file = $2;
@@ -252,10 +267,13 @@ command:
          {
            import_symbols = string_list_append (import_symbols, $3);
          }
-       | INPUT STRING
+       | INPUT string_list
          {
-           nlmheader_warn ("INPUT not supported", -1);
-           free ($2);
+           input_files = string_list_append (input_files, $2);
+         }
+       | MAP
+         {
+           map_file = "";
          }
        | MAP STRING
          {
@@ -265,7 +283,7 @@ command:
          {
            message_file = $2;
          }
-       | MODULE module_list
+       | MODULE string_list
          {
            modules = string_list_append (modules, $2);
          }
@@ -279,8 +297,10 @@ command:
          }
        | OUTPUT STRING
          {
-           nlmheader_warn ("OUTPUT not supported", -1);
-           free ($2);
+           if (output_file == NULL)
+             output_file = $2;
+           else
+             nlmheader_warn ("ignoring duplicate OUTPUT statement", -1);
          }
        | PSEUDOPREEMPTION
          {
@@ -341,7 +361,7 @@ command:
              }
            var_hdr->threadNameLength = len;
            strncpy (var_hdr->threadName, $2, len);
-           var_hdr->screenName[NLM_MAX_THREAD_NAME_LENGTH] = '\0';
+           var_hdr->threadName[len] = '\0';
            free ($2);
          }
        | TYPE STRING
@@ -460,14 +480,14 @@ symbol:
          }
        ;
 
-/* A list of modules.  */
+/* A list of strings.  */
 
-module_list:
+string_list:
          /* May be empty.  */
          {
            $$ = NULL;
          }
-       | STRING module_list
+       | STRING string_list
          {
            $$ = string_list_cons ($1, $2);
          }
This page took 0.023838 seconds and 4 git commands to generate.