update copyright dates
[deliverable/binutils-gdb.git] / binutils / defparse.y
index 1cb6360961533dc19df76a443324888d432ccc1d..6493c12e0fe5893f6dd88ebcb0762f3b157385c2 100644 (file)
@@ -1,25 +1,28 @@
 %{ /* defparse.y - parser for .def files */
 
-/*   Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Binutils.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
+/* Copyright 1995, 1997, 1998, 1999, 2001, 2004, 2005, 2007
+   Free Software Foundation, Inc.
+   
+   This file is part of GNU Binutils.
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "sysdep.h"
 #include "bfd.h"
-#include "bucomm.h"
+#include "libiberty.h"
 #include "dlltool.h"
 %}
 
@@ -28,12 +31,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
   int number;
 };
 
-%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
-%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT
-%token READ WRITE EXECUTE SHARED NONAME
+%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATA
+%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANT
+%token READ WRITE EXECUTE SHARED NONSHARED NONAME PRIVATE
+%token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL
 %token <id> ID
 %token <number> NUMBER
-%type  <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
+%type  <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE
 %type  <number> attr attr_list opt_number
 %type  <id> opt_name opt_equal_name 
 
@@ -45,7 +49,7 @@ start: start command
 
 command: 
                NAME opt_name opt_base { def_name ($2, $3); }
-       |       LIBRARY opt_name opt_base { def_library ($2, $3); }
+       |       LIBRARY opt_name opt_base option_list { def_library ($2, $3); }
        |       EXPORTS explist 
        |       DESCRIPTION ID { def_description ($2);}
        |       STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
@@ -61,13 +65,12 @@ command:
 
 explist:
                /* EMPTY */
-       |       expline
        |       explist expline
        ;
 
 expline:
-               ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
-                       { def_exports ($1, $2, $3, $4, $5, $6);}
+               ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE
+                       { def_exports ($1, $2, $3, $4, $5, $6, $7);}
        ;
 implist:       
                implist impline
@@ -108,10 +111,13 @@ opt_number: ',' NUMBER { $$=$2;}
        ;
        
 attr:
-               READ { $$ = 1;}
-       |       WRITE { $$ = 2;}        
-       |       EXECUTE { $$=4;}
-       |       SHARED { $$=8;}
+               READ { $$ = 1; }
+       |       WRITE { $$ = 2; }
+       |       EXECUTE { $$ = 4; }
+       |       SHARED { $$ = 8; }
+       |       NONSHARED { $$ = 0; }
+       |       SINGLE { $$ = 0; }
+       |       MULTIPLE { $$ = 0; }
        ;
 
 opt_CONSTANT:
@@ -129,6 +135,11 @@ opt_DATA:
        |            { $$ = 0; }
        ;
 
+opt_PRIVATE:
+               PRIVATE { $$ = 1; }
+       |               { $$ = 0; }
+       ;
+
 opt_name: ID           { $$ =$1; }
        | ID '.' ID     
          { 
@@ -146,6 +157,12 @@ opt_ordinal:
 
 opt_equal_name:
           '=' ID       { $$ = $2; }
+       | '=' ID '.' ID 
+         { 
+           char *name = xmalloc (strlen ($2) + 1 + strlen ($4) + 1);
+           sprintf (name, "%s.%s", $2, $4);
+           $$ = name;
+         }
         |              { $$ =  0; }                     
        ;
 
@@ -153,5 +170,14 @@ opt_base: BASE     '=' NUMBER      { $$= $3;}
        |       { $$=-1;}
        ;
 
-       
+option_list:
+               /* empty */
+       |       option_list opt_comma option
+       ;
 
+option:
+               INITINSTANCE
+       |       INITGLOBAL
+       |       TERMINSTANCE
+       |       TERMGLOBAL
+       ;
This page took 0.024552 seconds and 4 git commands to generate.