]> OCCT Git - occt-wok.git/commitdiff
Initial revision
authorcas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
committercas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
src/IDLFront/FILES [new file with mode: 0755]
src/IDLFront/IDL.lex [new file with mode: 0755]
src/IDLFront/IDL.yacc [new file with mode: 0755]
src/IDLFront/IDLFront.cxx [new file with mode: 0755]
src/IDLFront/IDLFront_CMPLRS.edl [new file with mode: 0755]
src/IDLFront/idl_rules.h [new file with mode: 0755]

diff --git a/src/IDLFront/FILES b/src/IDLFront/FILES
new file mode 100755 (executable)
index 0000000..8a79e82
--- /dev/null
@@ -0,0 +1,5 @@
+IDL.lex
+IDL.yacc
+IDLFront.cxx
+idl_rules.h
+IDLFront_CMPLRS.edl
diff --git a/src/IDLFront/IDL.lex b/src/IDLFront/IDL.lex
new file mode 100755 (executable)
index 0000000..fcb0730
--- /dev/null
@@ -0,0 +1,339 @@
+
+%{
+
+/*
+ * idl.ll - Lexical scanner for IDL 1.1
+ */
+#define yylval IDLlval
+#include <IDL.tab.h>
+#include <string.h>
+
+static char    idl_escape_reader(char *);
+static double  idl_atof(char *);
+static long    idl_atoi(char *, long);
+static void    idl_parse_line_and_file(char *);
+static void    idl_store_pragma(char *);
+
+/* static char *yytext = (char *) yytext; */
+#define yyinput() input()
+
+int IDLlineno;
+%}
+
+%%
+
+module         return MODULE;
+raises         return RAISES;
+readonly       return READONLY;
+attribute      return ATTRIBUTE;
+exception      return EXCEPTION;
+context                return CONTEXT;
+interface      return INTERFACE;
+const          return CONST;
+typedef                return TYPEDEF;
+struct         return STRUCT;
+enum           return ENUM;
+string         return STRING;
+wstring_t      return WSTRING;
+sequence       return SEQUENCE;
+union          return UNION;
+switch         return SWITCH;
+case           return CASE;
+default                return DEFAULT;
+float          return FLOAT;
+double         return DOUBLE;
+long           return LONG;
+short          return SHORT;
+unsigned       return UNSIGNED;
+char           return CHAR;
+wchar_t                return WCHAR;
+boolean                return BOOLEAN;
+octet          return OCTET;
+void           return VOID;
+
+TRUE           return TRUETOK;
+FALSE          return FALSETOK;
+
+inout          return INOUT;
+in             return IN;
+out            return OUT;
+oneway         return ONEWAY;
+
+\<\<           return LEFT_SHIFT;
+\>\>           return RIGHT_SHIFT;
+\:\:           {
+  /*yylval.strval = "::";    */
+                 return SCOPE_DELIMITOR;
+               }
+
+[a-zA-Z][a-zA-Z0-9_]*  {
+  strcpy(yylval.str, yytext);
+  return IDENTIFIER;
+}
+
+-?[0-9]+"."[0-9]*([eE][+-]?[0-9]+)?[lLfF]?      {
+  yylval.dval = idl_atof(yytext);
+                  return FLOATING_PT_LITERAL;
+                }
+-?[0-9]+[eE][+-]?[0-9]+[lLfF]?  {
+  yylval.dval = idl_atof(yytext);
+                  return FLOATING_PT_LITERAL;
+                }
+
+-?[1-9][0-9]*  {
+  yylval.ival = idl_atoi(yytext, 10);
+                 return INTEGER_LITERAL;
+               }
+-?0[xX][a-fA-F0-9]+ {
+  yylval.ival = idl_atoi(yytext, 16);
+                 return INTEGER_LITERAL;
+               }
+-?0[0-7]*      {
+  yylval.ival = idl_atoi(yytext, 8);
+  return INTEGER_LITERAL;
+               }
+
+"\""[^\"]*"\"" {
+  /*yytext[strlen(yytext)-1] = '\0';
+                 yylval.sval = new String(yytext + 1);*/
+                 return STRING_LITERAL;
+               }
+"'"."'"                {
+  yylval.cval = yytext[1];
+                 return CHARACTER_LITERAL;
+               }
+"'"\\([0-7]{1,3})"'"   {
+  /* octal character constant */
+  yylval.cval = idl_escape_reader(yytext + 1);
+  return CHARACTER_LITERAL;
+}
+"'"\\."'"      {
+  yylval.cval = idl_escape_reader(yytext + 1);
+                 return CHARACTER_LITERAL;
+               }
+^#[ \t]*pragma[ \t].*\n        {/* remember pragma */
+  IDLlineno++;
+  /*idl_store_pragma(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*include[ \t].*\n       {/* remember includes */
+  IDLlineno++;
+  /*idl_store_pragma(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*ifndef[ \t].*\n        {
+  IDLlineno++;
+  /*idl_store_pragma(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*define[ \t].*\n        {
+  IDLlineno++;
+  /*idl_store_pragma(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*endif.*\n      {
+  IDLlineno++;
+  /*idl_store_pragma(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*[0-9]*" ""\""[^\"]*"\""" "[0-9]*\n             {
+  /*idl_parse_line_and_file(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*[0-9]*" ""\""[^\"]*"\""\n                      {
+  /*idl_parse_line_and_file(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*[0-9]*\n       {
+  /* idl_parse_line_and_file(yytext);*/
+  return POSTPROCESSOR;
+}
+^#[ \t]*ident.*\n      {
+                 /* ignore cpp ident */
+                 IDLlineno++;
+                 return POSTPROCESSOR;
+               }
+\/\/.*\n       {
+                 /* ignore comments */
+                 IDLlineno++;
+               }
+"/*"           {
+                 for(;;) {
+                   char c = yyinput();
+                   if (c == '*') {
+                     char next = yyinput();
+                     if (next == '/')
+                       break;
+                     else
+                       unput(c);
+                     if (c == '\n') 
+                       IDLlineno++;
+                   }
+                 }
+               }
+[ \t]*         ;
+\n             {
+                 IDLlineno++;
+               }
+.              return yytext[0];
+
+%%
+       /* subroutines */
+
+/*
+ * idl_atoi - Convert a string of digits into an integer according to base b
+ */
+static long
+idl_atoi(char *s, long b)
+{
+       long    r = 0;
+       long    negative = 0;
+
+       if (*s == '-') {
+         negative = 1;
+         s++;
+       }
+       if (b == 8 && *s == '0')
+         s++;
+       else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))
+         s += 2;
+
+       for (; *s; s++)
+         if (*s <= '9' && *s >= '0')
+           r = (r * b) + (*s - '0');
+         else if (b > 10 && *s <= 'f' && *s >= 'a')
+           r = (r * b) + (*s - 'a' + 10);
+         else if (b > 10 && *s <= 'F' && *s >= 'A')
+           r = (r * b) + (*s - 'A' + 10);
+         else
+           break;
+
+       if (negative)
+         r *= -1;
+
+       return r;
+}
+
+/*
+ * Convert a string to a float; atof doesn't seem to work, always.
+ */
+static double
+idl_atof(char *s)
+{
+       char    *h = s;
+       double  d = 0.0;
+       double  f = 0.0;
+       double  e, k;
+       long    neg = 0, negexp = 0;
+
+       if (*s == '-') {
+         neg = 1;
+         s++;
+       }
+       while (*s >= '0' && *s <= '9') {
+               d = (d * 10) + *s - '0';
+               s++;
+       }
+       if (*s == '.') {
+               s++;
+               e = 10;
+               while (*s >= '0' && *s <= '9') {
+                       d += (*s - '0') / (e * 1.0);
+                       e *= 10;
+                       s++;
+               }
+       }
+       if (*s == 'e' || *s == 'E') {
+               s++;
+               if (*s == '-') {
+                       negexp = 1;
+                       s++;
+               } else if (*s == '+')
+                       s++;
+               e = 0;
+               while (*s >= '0' && *s <= '9') {
+                       e = (e * 10) + *s - '0';
+                       s++;
+               }
+               if (e > 0) {
+                       for (k = 1; e > 0; k *= 10, e--);
+                       if (negexp)
+                               d /= k;
+                       else
+                               d *= k;
+               }
+       }
+
+       if (neg) d *= -1.0;
+
+       return d;
+}      
+
+/*
+ * Convert (some) escaped characters into their ascii values
+ */
+static char
+idl_escape_reader(
+    char *str
+)
+{
+  int i;
+  char save;
+  char out;
+
+    if (str[0] != '\\') {
+       return str[0];
+    }
+
+    switch (str[1]) {
+      case 'n':
+       return '\n';
+      case 't':
+       return '\t';
+      case 'v':
+       return '\v';
+      case 'b':
+       return '\b';
+      case 'r':
+       return '\r';
+      case 'f':
+       return '\f';
+      case 'a':
+       return '\a';
+      case '\\':
+       return '\\';
+      case '\?':
+       return '?';
+      case '\'':
+       return '\'';
+      case '"':
+       return '"';
+      case 'x':
+       {
+           
+           for (i = 2; str[i] != '\0' && isxdigit(str[i]); i++) {
+               continue;
+           }
+           save = str[i];
+           str[i] = '\0';
+           out = (char)idl_atoi(&str[2], 16);
+           str[i] = save;
+           return out;
+       }
+       break;
+      default:
+       if (str[1] >= '0' && str[1] <= '7') {
+           for (i = 1; str[i] >= '0' && str[i] <= '7'; i++) {
+               continue;
+           }
+           save = str[i];
+           str[i] = '\0';
+           out = (char)idl_atoi(&str[1], 8);
+           str[i] = save;
+           return out;
+       } else {
+         return str[1] - 'a';
+       }
+       break;
+    }
+}
diff --git a/src/IDLFront/IDL.yacc b/src/IDLFront/IDL.yacc
new file mode 100755 (executable)
index 0000000..3103fb7
--- /dev/null
@@ -0,0 +1,615 @@
+/*
+ * idl.yy - YACC grammar for IDL 1.1
+ */
+
+/* Declarations */
+
+%{
+#include <stdio.h>
+#define yyv IDLv
+#if (defined(apollo) || defined(hpux)) && defined(__cplusplus)
+extern "C" int IDLwrap();
+#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus)
+
+%}
+
+/*
+ * Declare the type of values in the grammar
+ */
+
+/*
+ * Token types: These are returned by the lexer
+ */
+
+/*
+%token <strval>        IDENTIFIER
+*/
+
+%token         <str> IDENTIFIER
+
+%token         CONST
+%token         MODULE
+%token         INTERFACE
+%token         TYPEDEF
+%token         LONG
+%token         SHORT
+%token         UNSIGNED
+%token         DOUBLE
+%token         FLOAT
+%token         CHAR
+%token         WCHAR
+%token         OCTET
+%token         BOOLEAN
+%token         ANY
+%token         STRUCT
+%token         UNION
+%token         SWITCH
+%token         ENUM
+%token         SEQUENCE
+%token         STRING
+%token         WSTRING
+%token         EXCEPTION
+%token         CASE
+%token         DEFAULT
+%token         READONLY
+%token         ATTRIBUTE
+%token         ONEWAY
+%token         IDEMPOTENT
+%token         VOID
+%token         IN
+%token         OUT
+%token         INOUT
+%token         RAISES
+%token         CONTEXT
+%token                 POSTPROCESSOR
+%token INTEGER_LITERAL
+%token STRING_LITERAL
+%token CHARACTER_LITERAL
+%token FLOATING_PT_LITERAL
+
+/*
+%token <ival>  INTEGER_LITERAL
+%token <sval>  STRING_LITERAL
+%token <cval>  CHARACTER_LITERAL
+%token <dval>  FLOATING_PT_LITERAL
+*/
+
+%token         TRUETOK
+%token         FALSETOK
+
+/*
+%token <strval>        SCOPE_DELIMITOR
+*/
+
+%token         SCOPE_DELIMITOR
+%token LEFT_SHIFT
+%token RIGHT_SHIFT
+
+/*
+ * These are production names:
+
+%type <dcval>  type_spec simple_type_spec constructed_type_spec
+%type <dcval>  template_type_spec sequence_type_spec string_type_spec
+%type <dcval>  struct_type enum_type switch_type_spec union_type
+%type <dcval>  array_declarator op_type_spec seq_head wstring_type_spec
+
+%type <idlist> scoped_name
+%type <slval>  opt_context at_least_one_string_literal
+%type <slval>  string_literals
+
+%type <nlval>  at_least_one_scoped_name scoped_names inheritance_spec
+%type <nlval>  opt_raises
+
+%type <elval>  at_least_one_array_dim array_dims
+
+%type <llval>  at_least_one_case_label case_labels
+
+%type <dlval>  at_least_one_declarator declarators
+
+%type <ihval>  interface_header
+
+%type <exval>  expression const_expr or_expr xor_expr and_expr shift_expr
+%type <exval>  add_expr mult_expr unary_expr primary_expr literal
+%type <exval>  positive_int_expr array_dim
+
+%type <ulval>  case_label
+
+%type <ffval>  element_spec
+
+%type <etval>  const_type integer_type char_type boolean_type
+%type <etval>  floating_pt_type any_type signed_int
+%type <etval>  unsigned_int base_type_spec octet_type
+
+%type <dival>  direction
+
+%type <ofval>  opt_op_attribute
+
+%type <deval>  declarator simple_declarator complex_declarator
+
+%type <bval>   opt_readonly
+
+%type <idval>  interface_decl id
+*/
+%union {
+ char str[256];
+ double dval;
+ int ival;
+ char cval;
+}
+
+%%
+
+/*
+ * Production starts here
+ */
+start :        definitions ;
+
+definitions
+       : definition definitions
+       | /* empty */
+       ;
+
+definition
+       : POSTPROCESSOR
+       | type_dcl
+         ';'
+       | const_dcl
+         ';'
+       | exception
+         ';'
+       | interface_def
+         ';'
+       | module
+         ';'
+       | error
+       ';'
+       {
+         yyerrok;
+        }
+       ;
+
+module : MODULE IDENTIFIER '{' definitions  '}'  ;
+
+interface_def
+       : interface
+       | forward
+       ;
+
+interface :
+       interface_header { IDL_InterfaceDefinitionBegin(); } '{' exports '}' { IDL_InterfaceDefinitionEnd(); }
+       ;
+
+interface_decl:
+        INTERFACE id { IDL_InterfaceDeclaration(); }
+       ;
+
+interface_header :
+       interface_decl inheritance_spec
+       ;
+
+inheritance_spec
+       : ':'
+         at_least_one_scoped_name
+       | /* EMPTY */
+       ;
+
+exports
+       : exports export
+       | /* EMPTY */
+       ;
+
+export
+       : type_dcl ';'
+       | const_dcl ';'
+       | exception ';'
+       | attribute ';'
+       | operation ';'
+       | error ';'
+       ;
+
+at_least_one_scoped_name :
+       scoped_name scoped_names
+       ;
+
+scoped_names
+       : scoped_names ','  scoped_name
+       | /* EMPTY */
+       ;
+
+scoped_name
+       : id
+       | SCOPE_DELIMITOR
+         id
+       | scoped_name
+         SCOPE_DELIMITOR
+         id
+       ;
+
+id: IDENTIFIER { IDL_SetIdentifier($1); }
+        ;
+
+forward :
+       interface_decl
+       ;
+
+const_dcl :
+       CONST const_type id '=' expression
+       ;
+
+const_type
+       : integer_type
+       | char_type
+       | octet_type
+       | boolean_type
+       | floating_pt_type
+       | string_type_spec
+       | wstring_type_spec
+       | scoped_name
+       ;
+
+expression : const_expr        ;
+
+const_expr : or_expr ;
+
+or_expr : xor_expr
+       | or_expr '|' xor_expr
+       ;
+
+xor_expr
+       : and_expr
+       | xor_expr '^' and_expr
+       ;
+
+and_expr
+       : shift_expr
+       | and_expr '&' shift_expr
+       ;
+
+shift_expr
+       : add_expr
+       | shift_expr LEFT_SHIFT add_expr
+       | shift_expr RIGHT_SHIFT add_expr
+       ;
+
+add_expr
+       : mult_expr
+       | add_expr '+' mult_expr
+       | add_expr '-' mult_expr
+       ;
+
+mult_expr
+       : unary_expr
+       | mult_expr '*' unary_expr
+       | mult_expr '/' unary_expr
+       | mult_expr '%' unary_expr
+       ;
+
+unary_expr
+       : primary_expr
+       | '+' primary_expr
+       | '-' primary_expr
+       | '~' primary_expr
+       ;
+
+primary_expr
+       : scoped_name
+       | literal
+       | '(' const_expr ')'
+       ;
+
+literal
+       : INTEGER_LITERAL
+       | STRING_LITERAL
+       | CHARACTER_LITERAL
+       | FLOATING_PT_LITERAL
+       | TRUETOK
+       | FALSETOK
+       ;
+
+positive_int_expr :
+       const_expr
+       ;
+
+type_dcl
+       : TYPEDEF type_declarator
+       | struct_type
+       | union_type
+       | enum_type
+       ;
+
+type_declarator :
+       type_spec at_least_one_declarator
+       ;
+
+type_spec
+       : simple_type_spec
+       | constructed_type_spec
+       ;
+
+simple_type_spec
+       : base_type_spec
+       | template_type_spec
+       | scoped_name
+       ;
+
+base_type_spec
+       : integer_type
+       | floating_pt_type
+       | char_type
+       | boolean_type
+       | octet_type
+       | any_type
+       ;
+
+template_type_spec
+       : sequence_type_spec
+       | string_type_spec
+       | wstring_type_spec
+       ;
+
+constructed_type_spec
+       : struct_type
+       | union_type
+       | enum_type
+       ;
+
+at_least_one_declarator :
+       declarator declarators
+       ;
+declarators
+       : declarators  ',' declarator
+       | /* EMPTY */
+       ;
+
+declarator
+       : simple_declarator
+       | complex_declarator
+       ;
+
+simple_declarator :
+       id
+       ;
+
+complex_declarator :
+       array_declarator
+       ;
+
+integer_type
+       : signed_int
+       | unsigned_int
+       ;
+
+signed_int
+       : LONG
+       | LONG LONG
+       | SHORT
+       ;
+
+unsigned_int
+       : UNSIGNED LONG
+       | UNSIGNED LONG LONG
+       | UNSIGNED SHORT
+       ;
+
+floating_pt_type
+       : DOUBLE
+       | FLOAT
+       | LONG DOUBLE
+       ;
+
+char_type
+       : CHAR
+       | WCHAR
+       ;
+
+octet_type
+       : OCTET
+       ;
+
+boolean_type
+       : BOOLEAN
+       ;
+
+any_type
+       : ANY
+       ;
+
+struct_type :
+       STRUCT id '{' at_least_one_member '}'
+       ;
+
+at_least_one_member : member members ;
+
+members
+       : members member
+       | /* EMPTY */
+       ;
+
+member :
+       type_spec at_least_one_declarator
+       ';'
+       | error
+       ';'
+       ;
+
+union_type :
+       UNION id SWITCH '(' switch_type_spec ')' '{' at_least_one_case_branch '}'
+       ;
+
+switch_type_spec :
+       integer_type
+       | char_type
+       | octet_type
+       | boolean_type
+       | enum_type
+       | scoped_name
+       ;
+
+at_least_one_case_branch : case_branch case_branches ;
+
+case_branches
+       : case_branches case_branch
+       | /* empty */
+       ;
+
+case_branch :
+       at_least_one_case_label element_spec ';'
+       | error
+       ';'
+       ;
+
+at_least_one_case_label :
+       case_label case_labels
+       ;
+
+case_labels
+       : case_labels case_label
+       | /* EMPTY */
+       ;
+
+case_label
+       : DEFAULT ':'
+       | CASE const_expr ':'
+       ;
+
+element_spec :
+       type_spec declarator
+       ;
+
+enum_type :
+       ENUM id '{' at_least_one_enumerator '}'
+       ;
+
+at_least_one_enumerator : enumerator enumerators ;
+
+enumerators
+       : enumerators ',' enumerator
+       | /* EMPTY */
+       ;
+
+enumerator :
+       IDENTIFIER { IDL_SetIdentifier($1); }
+       ;
+
+sequence_type_spec
+        : seq_head ',' positive_int_expr '>'
+       | seq_head '>'
+       ;
+
+seq_head:
+       SEQUENCE '<' simple_type_spec
+       ;
+
+string_type_spec
+       : string_head  '<' positive_int_expr '>'
+       | string_head
+       ;
+
+string_head:
+       STRING
+       ;
+
+wstring_type_spec
+       : wstring_head  '<' positive_int_expr '>'
+       | wstring_head
+       ;
+
+wstring_head:
+       WSTRING
+       ;
+
+array_declarator :
+       id at_least_one_array_dim
+       ;
+
+at_least_one_array_dim :
+       array_dim array_dims
+       ;
+
+array_dims
+       : array_dims array_dim
+       | /* EMPTY */
+       ;
+
+array_dim :
+       '[' positive_int_expr ']'
+       ;
+
+attribute:
+       opt_readonly ATTRIBUTE simple_type_spec at_least_one_declarator
+       ;
+
+opt_readonly
+       : READONLY
+       | /* EMPTY */
+       ;
+
+exception :
+       EXCEPTION id '{' members '}'
+       ;
+
+operation :
+       opt_op_attribute op_type_spec IDENTIFIER parameter_list opt_raises opt_context
+       ;
+
+opt_op_attribute
+       : ONEWAY
+       | IDEMPOTENT
+       | /* EMPTY */
+       ;
+
+op_type_spec
+       : simple_type_spec
+       | VOID
+       ;
+
+parameter_list
+       : '('  ')'
+       | '(' at_least_one_parameter ')'
+       ;
+
+at_least_one_parameter : parameter parameters ;
+
+parameters
+       : parameters  ','  parameter
+       | /* EMPTY */
+       ;
+
+parameter :
+       direction simple_type_spec declarator
+       ;
+
+direction
+       : IN
+       | OUT
+       | INOUT
+       ;
+
+opt_raises
+       : RAISES  '('  at_least_one_scoped_name  ')'
+       | /* EMPTY */
+       ;
+
+opt_context
+       : CONTEXT  '('  at_least_one_string_literal ')'
+       | /* EMPTY */
+       ;
+
+at_least_one_string_literal :
+       STRING_LITERAL string_literals
+       ;
+
+string_literals
+       : string_literals ',' STRING_LITERAL
+       | /* EMPTY */
+       ;
+
+%%
+/* programs */
+
+int IDLwrap()
+{
+  return 1;
+}
+
diff --git a/src/IDLFront/IDLFront.cxx b/src/IDLFront/IDLFront.cxx
new file mode 100755 (executable)
index 0000000..35dcd7b
--- /dev/null
@@ -0,0 +1,186 @@
+#include <string.h>
+#include <stdio.h>
+// Standard includes
+//
+#include <Standard_ErrorHandler.hxx>
+#include <MS_TraductionError.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <MS_MetaSchema.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <idl_rules.h>
+
+extern "C" {
+void IDLrestart(FILE*);
+}
+// lex variable
+//      line number
+//   
+#ifndef WNT
+extern int IDLlineno;
+#else
+extern "C" int IDLlineno;
+#endif  // WNT
+   
+#ifndef WNT
+extern FILE             *IDLin;
+#else
+extern "C" FILE             *IDLin;
+#endif  // WNT
+extern "C" IDLparse();
+
+
+// BEGIN Variables
+//
+static char *YY_fileName="";      
+static int   YY_nb_error;
+static int   YY_nb_warning;
+
+static Handle(TCollection_HAsciiString) IDLFileName;
+
+Handle(TColStd_HSequenceOfHAsciiString) ListOfGlobalUsed;
+Handle(TColStd_HSequenceOfHAsciiString) ListOfTypeUsed;
+Handle(TColStd_HSequenceOfHAsciiString) ListOfInst;
+Handle(TColStd_HSequenceOfHAsciiString) ListOfGen;
+Handle(MS_MetaSchema)           theMetaSchema;
+
+IDLGlobal _IDLGlobal;
+
+// END variables
+
+// BEGIN Traductor (call from yacc)
+//
+
+extern "C" {
+ void IDLerror(char* text)
+  {
+   extern int IDLlineno;
+  
+   // The unix like error declaration 
+   //
+   if (text == NULL) {
+     ErrorMsg << "IDL" << "\"" << IDLFileName->ToCString() << "\"" <<  ", line " << IDLlineno << ": syntax error..." << endm;
+     MS_TraductionError::Raise("Syntax error");
+   }
+   else {
+     ErrorMsg << "IDL" << "\"" << IDLFileName->ToCString() << "\"" <<  ", line " << IDLlineno << ": " << text << endm;
+     YY_nb_error++;
+   }
+ }
+
+  int IDLTranslate(const Handle(MS_MetaSchema)&             aMetaSchema, 
+                  const Handle(TCollection_HAsciiString)&  aFileName,
+                  const Handle(TColStd_HSequenceOfHAsciiString)& aGlobalList,
+                  const Handle(TColStd_HSequenceOfHAsciiString)& aTypeList,
+                  const Handle(TColStd_HSequenceOfHAsciiString)& anInstList,
+                  const Handle(TColStd_HSequenceOfHAsciiString)& anGenList);
+
+}
+
+void IDL_InterfaceDeclaration() 
+{
+  strcpy(_IDLGlobal.interfacename,_IDLGlobal.idname);
+#ifdef DEB
+  cout << "Declaration : identifier -> interface : " << _IDLGlobal.interfacename << endl;
+#endif
+}
+
+void IDL_SetIdentifier(char *idname)
+{
+  strcpy(_IDLGlobal.idname,idname);
+#ifdef DEB
+  cout << "Declaration : identifier : " << _IDLGlobal.idname << endl;
+#endif
+}
+
+void IDL_InterfaceDefinitionBegin()
+{
+  _IDLGlobal.traductorstate = IDL_INTERFACEDECL;
+
+  ListOfGlobalUsed->Append(new TCollection_HAsciiString(_IDLGlobal.interfacename));
+#ifdef DEB
+  cout << "Declaration : BEGIN interface : " << _IDLGlobal.interfacename << endl;
+#endif
+}
+
+void IDL_InterfaceDefinitionEnd()
+{
+  _IDLGlobal.traductorstate = IDL_INTERFACEDECL;
+#ifdef DEB
+  cout << "Declaration : END interface : " << _IDLGlobal.interfacename << endl;
+#endif
+} 
+//
+// END Traductor
+
+void IDL_Main()
+{
+  YY_nb_error = 0;
+  IDLparse();
+} 
+
+int TraductionMain(char *FileName)
+{
+
+  IDLin = fopen(FileName,"r");
+
+
+
+  if (IDLin == NULL) {
+    ErrorMsg << "IDL" << " File not found : " << FileName << endm;
+    MS_TraductionError::Raise("File not found.");
+  }
+
+  IDLrestart(IDLin);
+  // Boot file
+  //
+  IDL_Main();
+
+  fclose(IDLin);
+
+  if (YY_nb_error > 0) {
+    ErrorMsg << "IDL" << YY_nb_error << " errors." << endm;
+  } 
+  
+  if (YY_nb_warning > 0) {
+    WarningMsg << "IDL" << YY_nb_warning << " warnings." << endm;
+  }
+
+  return YY_nb_error;
+}
+
+
+int IDLTranslate(const Handle(MS_MetaSchema)&             aMetaSchema, 
+                const Handle(TCollection_HAsciiString)&  aFileName,
+                const Handle(TColStd_HSequenceOfHAsciiString)& aGlobalList,
+                const Handle(TColStd_HSequenceOfHAsciiString)& aTypeList,
+                const Handle(TColStd_HSequenceOfHAsciiString)& anInstList,
+                const Handle(TColStd_HSequenceOfHAsciiString)& anGenList) 
+{
+  Standard_Integer  ErrorLevel = 0;
+
+  theMetaSchema    = aMetaSchema;
+  ListOfGlobalUsed = aGlobalList;
+  ListOfTypeUsed   = aTypeList;
+  ListOfInst       = anInstList;
+  ListOfGen        = anGenList;
+
+  if (!aFileName.IsNull()) {
+    IDLlineno = 1;
+    IDLFileName = aFileName;
+    
+    try {
+      ErrorLevel = TraductionMain(aFileName->ToCString());
+    }
+    catch(Standard_Failure) {
+      fclose(IDLin);
+      ErrorLevel = 1;
+    }
+  }
+  else {
+    ErrorLevel = 1;
+  }
+
+  return ErrorLevel;
+}
diff --git a/src/IDLFront/IDLFront_CMPLRS.edl b/src/IDLFront/IDLFront_CMPLRS.edl
new file mode 100755 (executable)
index 0000000..3e648db
--- /dev/null
@@ -0,0 +1,5 @@
+@if (%Station == "hp") then
+
+@string %CMPLRS_C_Options += " -Ae ";
+
+@endif;
diff --git a/src/IDLFront/idl_rules.h b/src/IDLFront/idl_rules.h
new file mode 100755 (executable)
index 0000000..5c8e096
--- /dev/null
@@ -0,0 +1,15 @@
+enum IDL_State { IDL_NONE,IDL_INTERFACEDECL};
+
+struct IDLGlobal {
+  char       idname[256];
+  char       interfacename[256];
+  IDL_State  traductorstate;
+};
+
+extern "C" {
+void IDL_SetIdentifier(char *); 
+void IDL_InterfaceDeclaration();
+void IDL_InterfaceDefinitionBegin();
+void IDL_InterfaceDefinitionEnd();
+};
+