Index: /trunk/idl-compiler/Makefile
===================================================================
--- /trunk/idl-compiler/Makefile	(revision 259)
+++ /trunk/idl-compiler/Makefile	(revision 259)
@@ -0,0 +1,77 @@
+#
+# Makefile for the NOM IDL compiler.
+#
+include ./../make.inc
+
+
+OBJDIR		=	./../../../o
+BINDIR		=	./../../../bin
+DOCDIR		=	./../../../docs
+CDIR		=	./c
+
+
+PARSERDIR	=	./parser_c
+
+CFLAGS		=	-Zmt -Zcrtdll -D__OS2__ -D__ST_MT_ERRNO__ -c -Wall
+
+CLASSINC	=	./class_h
+INCDIR		=	./include
+
+INC		= 	./include -I $(NOMPATH)/include
+			
+
+# Define objects to build
+
+
+PGOBJECTS	=	$(OBJDIR)/nom-idl-compiler.o \
+			$(OBJDIR)/token.o \
+			$(OBJDIR)/typespec_parser.o \
+			$(OBJDIR)/method_parser.o \
+			$(OBJDIR)/instancevar_parser.o \
+			$(OBJDIR)/interface_parser.o \
+			$(OBJDIR)/classversion_parser.o \
+			$(OBJDIR)/printdata.o
+
+
+#$(CLASSINC)/wpnativetypes.ih \
+
+
+.PRECIOUS:	$(CDIR)/%.c
+
+.PHONY:		dox
+
+all:	$(BINDIR)/nom-idl-compiler.exe
+
+$(BINDIR)/nom-idl-compiler.exe:	$(OBJDIR)/o.dep $(PGOBJECTS)
+	@echo "[33;1;mLinking "$@"...[0;m"
+	$(CC)  -o $@ $(PGOBJECTS) $(LIBS)
+	@echo "[32;1;mDone linking "$@"...[0;m"
+
+
+###################################
+#
+#    Rules for compiling
+#
+###################################
+
+
+$(OBJDIR)/%.o:	$(CDIR)/%.c
+	$(CC) -I $(INC) $(CFLAGS)  -o$@ $<
+
+$(OBJDIR)/%.o:	$(PARSERDIR)/%.c
+	$(CC) -I $(INC) $(CFLAGS)  -o$@ $<
+
+
+# Create the directories for temp files
+$(OBJDIR)/o.dep:
+	mkdir -p $(OBJDIR)
+	echo > $(OBJDIR)/o.dep
+	mkdir -p $(BINDIR)
+	mkdir -p $(DOCDIR)
+
+dox:
+	cd ./dox && doxygen desktop.dox
+
+clean:
+	-cd $(OBJDIR) && rm -f *.o
+	-cd $(BINDIR) && rm -f *.dll
Index: /trunk/idl-compiler/c/Makefile
===================================================================
--- /trunk/idl-compiler/c/Makefile	(revision 259)
+++ /trunk/idl-compiler/c/Makefile	(revision 259)
@@ -0,0 +1,2 @@
+all:
+	@cd .. && make
Index: /trunk/idl-compiler/c/nom-idl-compiler.c
===================================================================
--- /trunk/idl-compiler/c/nom-idl-compiler.c	(revision 259)
+++ /trunk/idl-compiler/c/nom-idl-compiler.c	(revision 259)
@@ -0,0 +1,310 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#define INCL_DOSPROCESS
+#define INCL_DOS
+#define INCL_DOSPROFILE
+#define INCL_DOSERRORS
+
+#include <os2.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <io.h>
+#include <fcntl.h>
+#include <sys\stat.h>
+
+#include <glib.h> 
+#include <glib/gprintf.h>
+
+#include "nom.h"
+#include "nomtk.h"
+
+#include "parser.h"
+
+/* The pointer array holding the interfaces we found */
+GPtrArray* pInterfaceArray;
+
+/* Symbols defined for our IDL language.
+   Keep this in synch with the defined enums! */
+const SYMBOL idlSymbols[]={
+  {"interface", IDL_SYMBOL_INTERFACE, KIND_UNKNOWN}, /* 71 */
+  {"NOMCLASSVERSION", IDL_SYMBOL_CLSVERSION, KIND_UNKNOWN},
+  {"NOMINSTANCEVAR", IDL_SYMBOL_INSTANCEVAR, KIND_UNKNOWN},
+  {"NOMOVERRIDE", IDL_SYMBOL_OVERRIDE, KIND_UNKNOWN},
+  {"gulong", IDL_SYMBOL_GULONG, KIND_TYPESPEC},
+  {"gint", IDL_SYMBOL_GINT, KIND_TYPESPEC},
+  {"gpointer", IDL_SYMBOL_GPOINTER, KIND_TYPESPEC},
+  {"gboolean", IDL_SYMBOL_GBOOLEAN, KIND_TYPESPEC},
+  {"in", IDL_SYMBOL_IN, KIND_DIRECTION},
+  {"out", IDL_SYMBOL_OUT, KIND_DIRECTION},
+  {"inout", IDL_SYMBOL_INOUT, KIND_DIRECTION},
+  {"define", IDL_SYMBOL_DEFINE, KIND_UNKNOWN},
+  {"ifdef", IDL_SYMBOL_IFDEF, KIND_UNKNOWN},
+  {"endif", IDL_SYMBOL_ENDIF, KIND_UNKNOWN},
+  {NULL, 0, KIND_UNKNOWN}
+},*pSymbols=idlSymbols;
+
+GScanner *gScanner;
+GTokenType curToken=G_TOKEN_EOF;
+PINTERFACE pCurInterface=NULL;
+
+/* Holding info about current token. Referenced by gScanner. */
+SYMBOLINFO curSymbol;
+
+
+
+
+/*
+  Parse the class version. Note that the identifier is the current symbol..
+
+  OM:= IDL_SYMBOL_OVERRIDE '(' IDENT ')' ';'
+ */
+void parseOverrideMethod(void)
+{
+  GTokenValue value;
+  POVERMETHOD pOMethod=g_malloc0(sizeof(OVERMETHOD));
+
+  if(!matchNext('('))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            '(',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMOVERRIDE()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+
+  if(!matchNext(G_TOKEN_IDENTIFIER))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            G_TOKEN_IDENTIFIER,
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMOVERRIDE()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  value=gScanner->value;
+  pOMethod->chrName=g_strdup(value.v_identifier);
+
+  if(!matchNext(')'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ')',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMOVERRIDE()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  if(!matchNext(';'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ';',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMOVERRIDE()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  g_ptr_array_add(pCurInterface->pOverrideArray, (gpointer) pOMethod);
+}
+
+gchar* getTypeSpecStringFromCurToken(void)
+{
+  GTokenValue value;
+
+  if(G_TOKEN_IDENTIFIER==curToken)
+    return g_strdup(value.v_identifier);
+  else
+    {
+      /* It's one of our symbols. */
+      PSYMBOLINFO psi;
+
+      if(curToken<=G_TOKEN_LAST)
+        g_scanner_unexp_token(gScanner,
+                              G_TOKEN_SYMBOL,
+                              NULL,
+                              NULL,
+                              NULL,
+                              "Error in NOMINSTANCEVAR()",
+                              TRUE); /* is_error */
+
+      psi=(PSYMBOLINFO)gScanner->user_data;
+      return psi->pSymbols[curToken-G_TOKEN_LAST-1].chrSymbolName;
+    }
+}
+
+
+
+
+
+
+/*
+  Main entry point. This function is called from the EMX wrapper. Be aware that gtk_init()
+  is already called in the wrapper.
+ */
+int main(int argc, char **argv)
+{
+  int a;
+  int fd;
+  
+  int idScope=0;
+
+  if(argc<2)
+    return 1;
+
+  for(a=0; a<argc; a++)
+    {
+      g_message("arg %d: %s", a, argv[a]);
+    }
+
+  fd=open(argv[1], O_RDONLY);
+  
+  if(-1==fd)
+    {
+      g_message("Can't open input file %s", argv[1]);
+      exit(1);
+    }
+  
+  g_printf("\n");
+
+  gScanner=g_scanner_new(NULL);
+  gScanner->user_data=(gpointer)&curSymbol;
+  curSymbol.pSymbols=idlSymbols;
+
+  pInterfaceArray=g_ptr_array_new();
+
+  g_scanner_input_file(gScanner, fd);
+  /* No single line comments */
+  gScanner->config->skip_comment_single=FALSE;
+  gScanner->config->cpair_comment_single="";
+  gScanner->input_name=IDL_COMPILER_STRING;
+
+  g_scanner_set_scope(gScanner, idScope);
+  /* Load our own symbols into the scanner. We use the defualt scope for now. */
+  while(pSymbols->chrSymbolName)
+    {
+      g_scanner_scope_add_symbol(gScanner, idScope, pSymbols->chrSymbolName, GINT_TO_POINTER(pSymbols->uiSymbolToken));
+      pSymbols++;
+    }
+  gScanner->config->symbol_2_token=TRUE;
+
+  while(g_scanner_peek_next_token(gScanner) != G_TOKEN_EOF) {
+    /* get the next token */
+    GTokenType token;
+    curToken=g_scanner_get_next_token(gScanner);
+    token=curToken;
+    GTokenValue value=gScanner->value;
+    
+    switch(curToken)
+      {
+      case IDL_SYMBOL_INTERFACE:
+        parseInterface(token);
+        break;
+      case G_TOKEN_IDENTIFIER:
+        g_message("Token: %d (G_TOKEN_IDENTIFIER)\t\t%s", token, value.v_identifier);
+        break;
+      case G_TOKEN_STRING:
+        g_message("Token: %d (G_TOKEN_STRING)\t\t\t%s", token, value.v_string);
+        break;
+      case G_TOKEN_LEFT_PAREN:
+        g_message("Token: %d (G_TOKEN_LEFT_PAREN)\t\t(", token);
+        break;
+      case G_TOKEN_RIGHT_PAREN:
+        g_message("Token: %d (G_TOKEN_RIGHT_PAREN)\t\t)", token);
+        break;
+      case ':':
+        g_message("Token: %d (colon)\t\t:", token);
+        break;
+      case ';':
+        g_message("Token: %d (semicolon)\t\t\t;", token);
+        break;
+      case '#':
+        g_message("Token: %d (hash)\t\t\t#", token);
+        break;
+      case '/':
+        g_message("Token: %d (slash)\t\t\t/ %s", token, value.v_comment);
+        break;
+      case G_TOKEN_COMMA:
+        g_message("Token: %d (G_TOKEN_COMMA)\t\t\t,", token);
+        break;
+      case G_TOKEN_INT:
+        g_message("Token: %d (G_TOKEN_INT)\t\t\t%ld", token, value.v_int);
+        break;
+      case IDL_SYMBOL_DEFINE:
+        g_message("Token: %d (IDL_SYMBOL_DEFINE)\t\t\t", token);
+        break;
+      case IDL_SYMBOL_IFDEF:
+        g_message("Token: %d (IDL_SYMBOL_IFDEF)\t\t\t", token);
+        break;
+      case IDL_SYMBOL_ENDIF:
+        g_message("Token: %d (IDL_SYMBOL_ENDIF)\t\t\t", token);
+        break;
+      default:
+        g_message("Token: %d (---)\t\t\t%c (LINE %d)", token, token, g_scanner_cur_line(gScanner));
+        break;
+      }
+  }
+  if(pCurInterface)
+    printInterface();
+
+  g_scanner_destroy(gScanner);
+  close(fd);
+
+  return 0;
+}
+
+#if 0
+  /* We are a folder somwhere in the chain */
+  nomRetval=WPFileSystem_wpQueryFileName((WPFileSystem*)wpParent, bFullPath, NULLHANDLE);
+
+  nomRetval=wpParent.wpQueryFileName(bFullPath, NULLHANDLE);
+
+  nomPath=NOMPathNew();
+  nomPath= (PNOMPath) NOMPath_assignCString(nomPath, _pszFullPath, ev);
+
+  return (PNOMPath)NOMPath_appendPath(nomRetval, nomPath, NULLHANDLE);
+
+#endif
Index: /trunk/idl-compiler/c/printdata.c
===================================================================
--- /trunk/idl-compiler/c/printdata.c	(revision 259)
+++ /trunk/idl-compiler/c/printdata.c	(revision 259)
@@ -0,0 +1,156 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#include <os2.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <io.h>
+#include <fcntl.h>
+#include <sys\stat.h>
+
+#include <gtk/gtk.h> 
+#include <glib/gprintf.h>
+
+#include "nom.h"
+#include "nomtk.h"
+
+#include "parser.h"
+
+/* The pointer array holding the interfaces we found */
+extern GPtrArray* pInterfaceArray;
+
+static void printOverridenMethods(GPtrArray *pArray)
+{
+  int a;
+
+  for(a=0;a<pArray->len;a++)
+    {
+      POVERMETHOD pom=(POVERMETHOD)g_ptr_array_index(pArray, a);
+      g_printf("\t\tName:\t\t%s\n", pom->chrName);
+    }
+}
+
+static void printInstanceVars(GPtrArray *pArray)
+{
+  int a;
+
+  for(a=0;a<pArray->len;a++)
+    {
+      int b;
+      PMETHODPARAM piv=(PMETHODPARAM)g_ptr_array_index(pArray, a);
+      g_printf("\t\tType:\t\t%s", piv->chrType);
+      for(b=0;b<piv->uiStar;b++)
+        g_printf("*");
+      g_printf("\n\t\tName:\t\t%s\n\n", piv->chrName);
+    }
+}
+
+
+static void printMethodParams(GPtrArray *pArray)
+{
+  int a;
+  
+  for(a=0;a<pArray->len;a++)
+    {
+      int b;
+      PMETHODPARAM pm=(PMETHODPARAM)g_ptr_array_index(pArray, a);
+      switch(pm->uiDirection)
+        {
+        case PARM_DIRECTION_IN:
+          g_printf("\t\t\tDirection:\t%s\n", "in");
+          break;
+        case PARM_DIRECTION_OUT:
+          g_printf("\t\t\tDirection:\t%s\n", "out");
+          break;
+        case PARM_DIRECTION_INOUT:
+          g_printf("\t\t\tDirection:\t%s\n", "inout");
+          break;
+        default:
+          break;
+        }
+      g_printf("\t\t\tType:\t\t%s", pm->chrType);
+      for(b=0;b<pm->uiStar;b++)
+        g_printf("*");
+      g_printf("\n\t\t\tName:\t\t%s\n", pm->chrName);      
+    }
+}
+
+
+static void printMethods(GPtrArray *pArray)
+{
+  int a;
+
+  for(a=0;a<pArray->len;a++)
+    {
+      int b;
+      PMETHOD pm=(PMETHOD)g_ptr_array_index(pArray, a);
+      g_printf("\t\tReturn type:\t%s", pm->mpReturn.chrType);
+      for(b=0;b<pm->mpReturn.uiStar;b++)
+        g_printf("*");
+      g_printf("\n\t\tName:\t\t%s\n", pm->chrName);
+      if(pm->pParamArray->len)
+        {
+          g_printf("\t\tNum parameters:\t%d\n", pm->pParamArray->len);
+          printMethodParams(pm->pParamArray);
+        }
+      else
+        g_printf("\t\t(No parameters)\n\n");
+    }
+}
+
+void printInterface(void)
+{
+  int a;
+
+  for(a=0;a<pInterfaceArray->len;a++)
+    {
+      PINTERFACE pif=g_ptr_array_index(pInterfaceArray, a);
+      g_printf("Found Interface:\n");  
+      g_printf("\tName:\t\t%s\n", pif->chrName);
+      g_printf("\tMajor:\t\t%ld\n", pif->ulMajor);
+      g_printf("\tMinor:\t\t%ld\n", pif->ulMinor);
+      g_printf("\tForward decl.:\t%s\n", (pif->fIsForwardDeclaration ? "Yes" : "No"));
+      
+      /* Print instance vars */
+      g_printf("\tInstance vars:\t%d\n", pif->pInstanceVarArray->len);
+      printInstanceVars(pif->pInstanceVarArray);
+      /* Print methods */
+      g_printf("\tNew methods:\t%d\n", pif->pMethodArray->len);
+      printMethods(pif->pMethodArray);
+      /* Print overriden methods */
+      g_printf("\tOverriden methods:\t%d\n", pif->pOverrideArray->len);
+      printOverridenMethods(pif->pOverrideArray);
+    }
+}
Index: /trunk/idl-compiler/c/token.c
===================================================================
--- /trunk/idl-compiler/c/token.c	(revision 259)
+++ /trunk/idl-compiler/c/token.c	(revision 259)
@@ -0,0 +1,206 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+
+#include <os2.h>
+#include <gtk/gtk.h> 
+#include "nom.h"
+
+#include "parser.h"
+
+extern GScanner *gScanner;
+extern GTokenType curToken;
+
+/*
+  We need this information during parsing to decide if an identifier
+  is e.g. a typespec or just a var name.
+ */
+void setSymbolInfo(GTokenType token)
+{
+  PSYMBOLINFO psi;
+
+  psi=(PSYMBOLINFO)gScanner->user_data;
+
+  switch(token)
+    {
+    case G_TOKEN_IDENTIFIER:
+      /* Here we have to check identifiers if they are for example types, e.g. int */
+      break;
+    default:
+      psi->uiCurSymbolKind=KIND_UNKNOWN;
+      break;
+    }
+  if(token>G_TOKEN_LAST)
+    {
+      psi->uiCurSymbolKind=psi->pSymbols[token-G_TOKEN_LAST-1].uiKind;
+    }
+}
+
+guint queryCurTokensKind(void)
+{
+  PSYMBOLINFO psi;
+
+  psi=(PSYMBOLINFO)gScanner->user_data;
+  return psi->uiCurSymbolKind;
+}
+
+static guint getKindFromTokenType(GTokenType token)
+{
+  if(token>G_TOKEN_LAST)
+    {
+      PSYMBOLINFO psi;
+      
+      psi=(PSYMBOLINFO)gScanner->user_data;
+      return psi->pSymbols[token-G_TOKEN_LAST-1].uiKind;
+    }
+  switch(token)
+    {
+    case G_TOKEN_IDENTIFIER:
+      {
+        /* Compare strings here. Yes, that's slow... */
+        break;
+      }
+    default:
+      break;
+    }
+
+  return KIND_UNKNOWN;
+}
+
+guint queryNextTokensKind(void)
+{
+  return getKindFromTokenType(gScanner->next_token);
+}
+
+
+/* Well, the name says all... */
+void getNextToken(void)
+{
+  curToken = g_scanner_get_next_token(gScanner);
+  setSymbolInfo(curToken);
+}
+
+gboolean matchNextKind(guint uiKind)
+{
+  GTokenType token;
+
+  token=g_scanner_peek_next_token(gScanner);
+  if(uiKind==getKindFromTokenType(token))
+    {
+      getNextToken();
+      return TRUE;
+    }
+  return FALSE;
+}
+
+/* Well, the name says all... */
+gboolean matchCur(GTokenType token)
+{
+  if(token==curToken)
+    {
+      return TRUE;
+    }
+  return FALSE;
+}
+
+/* Well, the name says all...
+
+   Note that this function advances to the next token if the
+   tokens match.
+*/
+gboolean matchNext(GTokenType token)
+{
+  if(token==g_scanner_peek_next_token(gScanner))
+    {
+      getNextToken();
+      return TRUE;
+    }
+  return FALSE;
+}
+
+/*
+  Print current token info.
+ */
+void printToken(GTokenType token)
+{
+  GTokenValue value=gScanner->value;
+
+  switch(token)
+    {
+    case IDL_SYMBOL_INTERFACE:
+      g_message("Token: %d (IDL_SYMBOL_INTERFACE)\tParsing...", token);
+      break;
+    case G_TOKEN_IDENTIFIER:
+      g_message("Token: %d (G_TOKEN_IDENTIFIER)\t\t%s", token, value.v_identifier);
+      break;
+    case G_TOKEN_STRING:
+      g_message("Token: %d (G_TOKEN_STRING)\t\t\t%s", token, value.v_string);
+      break;
+    case G_TOKEN_LEFT_PAREN:
+      g_message("Token: %d (G_TOKEN_LEFT_PAREN)\t\t(", token);
+      break;
+    case G_TOKEN_RIGHT_PAREN:
+      g_message("Token: %d (G_TOKEN_RIGHT_PAREN)\t\t)", token);
+      break;
+    case ':':
+      g_message("Token: %d (colon)\t\t:", token);
+      break;
+    case ';':
+      g_message("Token: %d (semicolon)\t\t\t; (LINE %d)", token, g_scanner_cur_line(gScanner));
+      break;
+    case '#':
+      g_message("Token: %d (hash)\t\t\t#", token);
+      break;
+    case '/':
+      g_message("Token: %d (slash)\t\t\t/ %s", token, value.v_comment);
+      break;
+    case G_TOKEN_COMMA:
+      g_message("Token: %d (G_TOKEN_COMMA)\t\t\t,", token);
+      break;
+    case G_TOKEN_INT:
+      g_message("Token: %d (G_TOKEN_INT)\t\t\t%ld", token, value.v_int);
+      break;
+    case IDL_SYMBOL_DEFINE:
+      g_message("Token: %d (IDL_SYMBOL_DEFINE)\t\t\t", token);
+      break;
+    case IDL_SYMBOL_IFDEF:
+      g_message("Token: %d (IDL_SYMBOL_IFDEF)\t\t\t", token);
+      break;
+    case IDL_SYMBOL_ENDIF:
+      g_message("Token: %d (IDL_SYMBOL_ENDIF)\t\t\t", token);
+      break;
+    default:
+      g_message("Token: %d (---)\t\t\t (LINE %d)", token, g_scanner_cur_line(gScanner));
+      break;
+    }
+}
Index: /trunk/idl-compiler/include/Makefile
===================================================================
--- /trunk/idl-compiler/include/Makefile	(revision 259)
+++ /trunk/idl-compiler/include/Makefile	(revision 259)
@@ -0,0 +1,2 @@
+all:
+	@cd .. && make
Index: /trunk/idl-compiler/include/parser.h
===================================================================
--- /trunk/idl-compiler/include/parser.h	(revision 259)
+++ /trunk/idl-compiler/include/parser.h	(revision 259)
@@ -0,0 +1,148 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2005-2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+
+/* in token.c */
+void getNextToken(void);
+gboolean matchCur(GTokenType token);
+gboolean matchNext(GTokenType token);
+guint queryCurTokensKind(void);
+void printToken(GTokenType token);
+gboolean matchNextKind(guint uiKind);
+
+/* In printdata.c */
+void printInterface(void);
+
+
+#define IDL_COMPILER_STRING "IDL compiler" /* Used inside warnings and errors */
+
+/* Holding an overriden method */
+typedef struct
+{
+  gchar* chrName;    /* Name of this instance variable */
+}OVERMETHOD, *POVERMETHOD;
+
+#define PARM_DIRECTION_IN     1
+#define PARM_DIRECTION_OUT    2
+#define PARM_DIRECTION_INOUT  3
+/* Holding a method parameter */
+typedef struct
+{
+  guint  uiDirection;   /* in|out|inout */
+  gchar* chrType;       /* Type e.g. gulong or GtkWidget */
+  guint  uiStar;        /* incremented for each '*'      */
+  gchar* chrName;
+}METHODPARAM, *PMETHODPARAM;
+
+/* Holding a method */
+typedef struct
+{
+  gchar* chrRetType;    /* Type e.g. gulong or GtkWidget */
+  gchar* chrName;
+  METHODPARAM mpReturn; /* We don't use all fields of this struct */
+  GPtrArray *pParamArray;
+}METHOD, *PMETHOD;
+
+/* Struct holding all the info of a defined or declared interface */
+typedef struct
+{
+  gchar* chrName;    /* Name of this interface   */
+  gchar *chrParent;  /* Name of parent interface */
+  gulong ulMajor;    /* Class version            */
+  gulong ulMinor;    /* Class version            */
+  gboolean fIsForwardDeclaration;
+  GPtrArray *pMethodArray;
+  GPtrArray *pOverrideArray;
+  GPtrArray *pInstanceVarArray;
+}INTERFACE,*PINTERFACE;
+
+/* Info about a symbol */
+typedef struct
+{
+  gchar* chrSymbolName;
+  guint  uiSymbolToken;
+  guint  uiKind;
+}SYMBOL, *PSYMBOL;
+
+/* Such a struct can be found in GScanner->user_data */
+typedef struct
+{
+  const SYMBOL    *pSymbols;     /* List of our introduced symbols */
+  guint     uiCurSymbolKind;
+}SYMBOLINFO,*PSYMBOLINFO; 
+
+/* Symbols defined for our IDL language.
+   Keep these enums in sync with the order of the idlSymbols struct! */
+enum 
+{
+  IDL_SYMBOL_INTERFACE=G_TOKEN_LAST+1,
+  IDL_SYMBOL_CLSVERSION,
+  IDL_SYMBOL_INSTANCEVAR,
+  IDL_SYMBOL_OVERRIDE,
+  /* Some GLib types */
+  IDL_SYMBOL_GULONG,           /* 275 */
+  IDL_SYMBOL_GINT,
+  IDL_SYMBOL_GPOINTER,
+  IDL_SYMBOL_GBOOLEAN,
+  /* Direction of method parameters */
+  IDL_SYMBOL_IN,
+  IDL_SYMBOL_OUT,
+  IDL_SYMBOL_INOUT,
+  /* Preprocessor stuff (not yet supported by the compiler) */
+  IDL_SYMBOL_DEFINE,
+  IDL_SYMBOL_IFDEF,
+  IDL_SYMBOL_ENDIF
+};
+
+/* Specifies the kind of a token we read. For example we must
+   know if a read in indentifier is a type specification when
+   parsing method parameters. */
+enum
+{
+  KIND_UNKNOWN =1,
+  KIND_IDENTIFIER,
+  KIND_TYPESPEC,    /* That's something like 'gint', 'gulong'... */
+  KIND_DIRECTION    /* in, out, inout */
+};
+
+
+void parseTypeSpec(PMETHODPARAM pMethodParam);
+void parseMethod(void);
+void parseInstanceVar(void);
+void parseInterface(GTokenType token);
+void parseClassVersion(void);
+
+void parseClassVersion(void);
+void parseOverrideMethod(void);
+
+
Index: /trunk/idl-compiler/parser_c/Makefile
===================================================================
--- /trunk/idl-compiler/parser_c/Makefile	(revision 259)
+++ /trunk/idl-compiler/parser_c/Makefile	(revision 259)
@@ -0,0 +1,2 @@
+all:
+	@cd .. && make
Index: /trunk/idl-compiler/parser_c/classversion_parser.c
===================================================================
--- /trunk/idl-compiler/parser_c/classversion_parser.c	(revision 259)
+++ /trunk/idl-compiler/parser_c/classversion_parser.c	(revision 259)
@@ -0,0 +1,130 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#include <os2.h>
+#include <stdlib.h>
+
+#include <glib.h> 
+#include "parser.h"
+
+extern GScanner *gScanner;
+extern PINTERFACE pCurInterface;
+/*
+  Parse the class version. Note that the identifier is the current symbol..
+
+  CV:= IDL_SYMBOL_CLSVERSION '(' NUM ',' NUM ')' ';'
+ */
+void parseClassVersion(void)
+{
+  GTokenValue value;
+
+  if(!matchNext('('))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            '(',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMCLASSVERSION()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+
+  if(!matchNext(G_TOKEN_INT))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            G_TOKEN_INT,
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMCLASSVERSION()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  value=gScanner->value;
+  pCurInterface->ulMajor=value.v_int;
+
+  if(!matchNext(','))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ',',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMCLASSVERSION()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  if(!matchNext(G_TOKEN_INT))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            G_TOKEN_INT,
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMCLASSVERSION()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  value=gScanner->value;
+  pCurInterface->ulMinor=value.v_int;
+
+  if(!matchNext(')'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ')',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMCLASSVERSION()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  if(!matchNext(';'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ';',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMCLASSVERSION()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+}
Index: /trunk/idl-compiler/parser_c/instancevar_parser.c
===================================================================
--- /trunk/idl-compiler/parser_c/instancevar_parser.c	(revision 259)
+++ /trunk/idl-compiler/parser_c/instancevar_parser.c	(revision 259)
@@ -0,0 +1,129 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#include <os2.h>
+#include <stdlib.h>
+
+#include <glib.h> 
+#include "parser.h"
+
+extern GScanner *gScanner;
+extern PINTERFACE pCurInterface;
+
+/*
+  Parse an instance variable. Note that the current symbol is the identifier NOMINSTANCEVAR.
+
+  IV:= IDL_SYMBOL_INSTANCEVAR '(' TS  IDENT ')' ';'
+ */
+void parseInstanceVar(void)
+{
+  GTokenValue value;
+  PMETHODPARAM pInstanceVar=g_malloc0(sizeof(METHODPARAM));;
+
+  if(!matchNext('('))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            '(',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMINSTANCEVAR()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+
+    /* Typespec */
+    if(matchNextKind(KIND_TYPESPEC)){ /* Be aware that we don't compare types here */
+      parseTypeSpec(pInstanceVar);
+    }
+    else
+      {
+        getNextToken(); /* Make sure error references the correct token */
+        g_scanner_unexp_token(gScanner,
+                              G_TOKEN_IDENTIFIER,
+                              NULL,
+                              NULL,
+                              NULL,
+                              "Type specification error in NOMINSTANCEVAR().",
+                              TRUE); /* is_error */
+        exit(1);
+      }
+
+  if(!matchNext(G_TOKEN_IDENTIFIER))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            G_TOKEN_IDENTIFIER,
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMINSTANCEVAR()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  value=gScanner->value;
+  pInstanceVar->chrName=g_strdup(value.v_identifier);
+  //g_message("-->%s", pInstanceVar->chrName);
+
+  if(!matchNext(')'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ')',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMINSTANCEVAR()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  if(!matchNext(';'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ';',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in NOMINSTANCEVAR()",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  if(!pCurInterface)
+    {
+      g_message("Error: no interface for some reason");
+    }
+
+  g_ptr_array_add(pCurInterface->pInstanceVarArray , (gpointer) pInstanceVar);
+}
Index: /trunk/idl-compiler/parser_c/interface_parser.c
===================================================================
--- /trunk/idl-compiler/parser_c/interface_parser.c	(revision 259)
+++ /trunk/idl-compiler/parser_c/interface_parser.c	(revision 259)
@@ -0,0 +1,155 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#include <os2.h>
+#include <stdlib.h>
+
+#include <glib.h> 
+#include "parser.h"
+
+extern GScanner *gScanner;
+extern GTokenType curToken;
+extern PINTERFACE pCurInterface;
+/* The pointer array holding the interfaces we found */
+extern GPtrArray* pInterfaceArray;
+
+
+static PINTERFACE createInterfaceStruct()
+{
+  PINTERFACE pInterface;
+
+  pInterface=(PINTERFACE)g_malloc0(sizeof(INTERFACE));
+  pInterface->pInstanceVarArray=g_ptr_array_new();
+  pInterface->pMethodArray=g_ptr_array_new();
+  pInterface->pOverrideArray=g_ptr_array_new();
+
+  return pInterface;
+}
+
+/*
+  Function to parse the body of an interface declaration.
+
+  IB:= CV                                             // NOMCLASSVERSION()
+     | IV                                             // NOMINSTANCEVAR()
+     |  M                                             // Method
+     | OV                                             // Overriden method
+ */
+void parseIFaceBody(void)
+{
+  /* Current token is '{' */
+
+  do{
+    //g_printf("%d: ", __LINE__);
+    //printToken(curToken);
+    if(matchNext(IDL_SYMBOL_CLSVERSION))
+      parseClassVersion();
+    if(matchNext(IDL_SYMBOL_OVERRIDE))
+      parseOverrideMethod();
+    else if(matchNext(IDL_SYMBOL_INSTANCEVAR))
+      parseInstanceVar();
+    else if(matchNextKind(KIND_TYPESPEC)) /* Be aware that we don't compare types here */
+      {
+        parseMethod();
+      }
+    else
+      {
+        //g_message("Line %d Error in'interface' deklaration %d", g_scanner_cur_line(gScanner),
+        //        g_scanner_peek_next_token(gScanner));
+        //g_printf("%d: ", __LINE__);
+        //printToken(curToken);
+        /* Unknown token, skip it. */
+        getNextToken();
+        //exit(1);
+      }
+    }while(g_scanner_peek_next_token(gScanner)!='}');
+}
+
+
+/*
+  I:= IDL_SYMBOL_INTERFACE G_TOKEN_INDENTIFIER
+ */
+static void parseIFace(GTokenType token)
+{
+  if(!matchNext(G_TOKEN_IDENTIFIER))
+    {
+      g_scanner_unexp_token(gScanner,
+                            G_TOKEN_IDENTIFIER,
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Keyword 'interface' must be followed by an identifier",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  /* Save interface info */
+  GTokenValue value=gScanner->value;
+  pCurInterface=createInterfaceStruct();
+  pCurInterface->chrName=g_strdup(value.v_identifier);
+}
+
+/*
+  Parse an interface declaration. The current token is the 'interface' keyword.
+
+  interface:= I ';'                       // Forward declaration
+            | I '{' IB '}'
+            | I ':' G_TOKEN_INDENTIFIER '{' ID '}'
+
+ 
+ */
+void parseInterface(GTokenType token)
+{
+  parseIFace(token);
+  getNextToken();
+  switch(curToken)
+    {
+    case ';':
+      if(pCurInterface)
+        {
+          pCurInterface->fIsForwardDeclaration=TRUE;
+          g_ptr_array_add(pInterfaceArray, (gpointer) pCurInterface);
+          pCurInterface=NULL;
+        }
+      break;
+    case ':':
+      g_message("Line %d: Defining subclasses interfaces not supported yet",  g_scanner_cur_line(gScanner));
+      exit(0);
+    case '{':
+      parseIFaceBody();
+      g_ptr_array_add(pInterfaceArray, (gpointer) pCurInterface);
+      break;
+    default:
+      g_message("Line %d: Error in interface declaration",  g_scanner_cur_line(gScanner));
+      exit(0);
+      break;
+    }
+}
Index: /trunk/idl-compiler/parser_c/method_parser.c
===================================================================
--- /trunk/idl-compiler/parser_c/method_parser.c	(revision 259)
+++ /trunk/idl-compiler/parser_c/method_parser.c	(revision 259)
@@ -0,0 +1,235 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#include <os2.h>
+#include <stdlib.h>
+
+#include <glib.h> 
+#include "parser.h"
+
+extern GScanner *gScanner;
+extern GTokenType curToken;
+extern PINTERFACE pCurInterface;
+
+static PMETHOD createMethodStruct()
+{
+  PMETHOD pMethod=g_malloc0(sizeof(METHOD));
+
+  pMethod->pParamArray=g_ptr_array_new();
+
+  return pMethod;
+}
+
+/*
+  Parse one or more method parameters. Note that the check for '(' and ')' is
+  done in the calling function.
+
+  MPARAMS:= DIRECTION TS G_TOKEN_IDENTIFIER
+          | MPARAMS ',' MPARAMS 
+ */
+static void parseMethodParams(PMETHOD pMethod)
+{
+  GTokenValue value;
+  PMETHODPARAM pParam;
+
+  do{ 
+    pParam=g_malloc0(sizeof(METHODPARAM));
+
+    /* Direction */
+    if(!matchNextKind(KIND_DIRECTION)) /* Be aware that we don't compare types here */
+      {
+        getNextToken(); /* Make sure error references the correct token */
+        g_scanner_unexp_token(gScanner,
+                              G_TOKEN_IDENTIFIER,
+                              NULL,
+                              NULL,
+                              NULL,
+                              "Error in method declaration, direction (in|out|inout) is not specified.",
+                              TRUE); /* is_error */
+        exit(1);
+      }
+
+    switch(curToken)
+      {
+      case IDL_SYMBOL_IN:
+        pParam->uiDirection=PARM_DIRECTION_IN;
+        break;
+      case IDL_SYMBOL_OUT:
+        pParam->uiDirection=PARM_DIRECTION_OUT;
+        break;
+      case IDL_SYMBOL_INOUT:
+        pParam->uiDirection=PARM_DIRECTION_INOUT;
+        break;
+      default:
+        break;
+      }
+
+    /* Typespec */
+    if(matchNextKind(KIND_TYPESPEC)) /* Be aware that we don't compare types here */
+      parseTypeSpec(pParam);
+    else
+      {
+        getNextToken(); /* Make sure error references the correct token */
+        g_scanner_unexp_token(gScanner,
+                              G_TOKEN_IDENTIFIER,
+                              NULL,
+                              NULL,
+                              NULL,
+                              "Error in method declaration, Unknown type specification.",
+                              TRUE); /* is_error */
+        exit(1);
+      }
+
+    //pParam->chrType=getTypeSpecStringFromCurToken();
+
+    if(!matchNext(G_TOKEN_IDENTIFIER))
+      {
+        getNextToken(); /* Make sure error references the correct token */
+        g_scanner_unexp_token(gScanner,
+                              G_TOKEN_IDENTIFIER,
+                              NULL,
+                              NULL,
+                              NULL,
+                              "Error in method declaration, parameter name is wrong.",
+                              TRUE); /* is_error */
+        exit(1);
+      }
+    value=gScanner->value;
+    pParam->chrName=g_strdup(value.v_identifier);
+
+    g_ptr_array_add(pMethod->pParamArray , (gpointer) pParam);
+  }while(matchNext(','));
+}
+
+
+/*
+  Current token is the typespec.
+
+  TS:= TYPE_SPEC              //typespec, see elsewhere
+    |  TYPE_SPEC '*'
+
+  M:= TS G_TOKEN_IDENTIFIER '(' ')' ';'        // method
+    | TS G_TOKEN_IDENTIFIER '(' MPARMS ')' ';' // method
+ */
+void parseMethod(void)
+{
+  GTokenValue value;
+  PMETHOD pMethod=createMethodStruct();
+
+  //g_printf("%d: ", __LINE__);
+  //printToken(curToken);
+
+  /* Do type spec */
+  parseTypeSpec(&pMethod->mpReturn);
+
+  /* Method name */
+  if(!matchNext(G_TOKEN_IDENTIFIER))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      printToken(curToken);
+      g_scanner_unexp_token(gScanner,
+                            G_TOKEN_IDENTIFIER,
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in method declaration",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+  value=gScanner->value;
+  pMethod->chrName=g_strdup(value.v_identifier);
+
+  /* Handle parameters  if any */
+  if(!matchNext('('))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            '(',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in method declaration",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+
+  /* No parameters */
+  if(matchNext(')'))
+    {
+      if(!matchNext(';'))
+        {
+          getNextToken(); /* Make sure error references the correct token */
+          g_scanner_unexp_token(gScanner,
+                                ';',
+                                NULL,
+                                NULL,
+                                NULL,
+                                "Missing semicolon.",
+                                TRUE); /* is_error */
+          exit(1);
+        }
+      g_ptr_array_add( pCurInterface->pMethodArray, (gpointer) pMethod);
+      return;
+    }
+
+  /* This parses all the parameters */
+  parseMethodParams(pMethod);
+
+  if(!matchNext(')'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ')',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in method declaration",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+
+  if(!matchNext(';'))
+    {
+      getNextToken(); /* Make sure error references the correct token */
+      g_scanner_unexp_token(gScanner,
+                            ';',
+                            NULL,
+                            NULL,
+                            NULL,
+                            "Error in method declaration, Missing semicolon",
+                            TRUE); /* is_error */
+      exit(1);
+    }
+
+  g_ptr_array_add( pCurInterface->pMethodArray, (gpointer) pMethod);
+}
Index: /trunk/idl-compiler/parser_c/typespec_parser.c
===================================================================
--- /trunk/idl-compiler/parser_c/typespec_parser.c	(revision 259)
+++ /trunk/idl-compiler/parser_c/typespec_parser.c	(revision 259)
@@ -0,0 +1,60 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: CDDL 1.0/LGPL 2.1
+*
+* The contents of this file are subject to the COMMON DEVELOPMENT AND
+* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
+* this file except in compliance with the License. You may obtain a copy of
+* the License at http://www.sun.com/cddl/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is "NOM" Netlabs Object Model
+*
+* The Initial Developer of the Original Code is
+* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
+* Portions created by the Initial Developer are Copyright (C) 2007
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
+* case the provisions of the LGPL are applicable instead of those above. If
+* you wish to allow use of your version of this file only under the terms of
+* the LGPL, and not to allow others to use your version of this file under
+* the terms of the CDDL, indicate your decision by deleting the provisions
+* above and replace them with the notice and other provisions required by the
+* LGPL. If you do not delete the provisions above, a recipient may use your
+* version of this file under the terms of any one of the CDDL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+#include <os2.h>
+
+#include <glib.h> 
+#include "parser.h"
+
+extern gchar* getTypeSpecStringFromCurToken(void);
+
+/*
+  Parse a typespec e.g. 'gulong' or 'gulong*'.
+
+  Current token is the typespec.
+
+  TS:= TYPE_SPEC
+    |  TYPE_SPEC '*'
+*/
+void parseTypeSpec(PMETHODPARAM pMethodParam)
+{
+  /* Return type  */
+  pMethodParam->chrType=getTypeSpecStringFromCurToken();
+
+  /* Do we return a pointer (check for '*') */
+  while(matchNext('*'))
+    pMethodParam->uiStar++;
+}
+
+
+
Index: /trunk/make.inc
===================================================================
--- /trunk/make.inc	(revision 259)
+++ /trunk/make.inc	(revision 259)
@@ -0,0 +1,32 @@
+#
+# Includes for desktop makefiles
+#
+
+CC		=	gcc
+
+GCCFLAGSDLL	=	-Zmtd -Zdll -D__OS2__ -D__ST_MT_ERRNO__ -c -Wall 
+GCCLDFLAGSDLL	=	-Zmt  -Zdll
+
+GCCFLAGS	=	-Zmt -Zcrtdll -D__OS2__ -D__ST_MT_ERRNO__ -c -Wall
+#GCCFLAGS	=		-E -P
+
+GCCLDFLAGS	=	-Zmt -Zcrtdll -Zdll
+
+LIBS		=	-lgtk-x11-2.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0
+
+
+VERSION		=	0_0_1
+VERSION_STRING  =	0.0.1
+AUTHOR_STRING	=	"(C) Chris Wohlgemuth 2003-2007"
+
+# Put version in environment for REXX skripts
+export	DESKTOPVERSION	=	$(VERSION_STRING)
+export	AUTHORSTRING	=	$(AUTHOR_STRING)
+
+
+IDLCOMP		=	L:\svn-sources\nom\trunk\ORBit2-2.14.0\src\idl-compiler\.libs\orbit-idl-2.exe
+
+NOMPATH		=	L:/svn-sources/nom/trunk/nom
+GUITKPATH	=	L:/svn-sources/desktop/trunk/gui
+FOUNDATIONPATH	=	L:/svn-sources/desktop/trunk/foundation
+DESKTOPPATH	=	L:/svn-sources/desktop/trunk/desktop
