Ignore:
Timestamp:
Apr 9, 2008, 10:22:08 PM (17 years ago)
Author:
cinc
Message:

Portability patches for Windows, Linux, Darwin by Bird.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/idl-compiler/c/nom-idl-compiler.c

    r310 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #define INCL_DOSPROCESS
    35 #define INCL_DOS
    36 #define INCL_DOSPROFILE
    37 #define INCL_DOSERRORS
    38 
    39 #include <os2.h>
     34#ifdef __OS2__
     35# define INCL_DOSPROCESS
     36# define INCL_DOS
     37# define INCL_DOSPROFILE
     38# define INCL_DOSERRORS
     39# include <os2.h>
     40#endif /* __OS2__ */
     41
    4042#include <stdio.h>
    4143#include <stdlib.h>
    4244#include <string.h>
    4345
    44 #include <io.h>
     46#ifdef HAVE_IO_H
     47# include <io.h>
     48#endif
     49#ifdef HAVE_UNISTD_H
     50# include <unistd.h>
     51#endif
    4552#include <fcntl.h>
    46 #include <sys\stat.h>
    47 
    48 #include <glib.h> 
     53#include <sys/stat.h>
     54
     55#include <glib.h>
    4956#include <glib/gprintf.h>
    5057
     
    6067
    6168/* Command line options */
    62 static GOptionEntry gOptionEntries[] = 
     69static GOptionEntry gOptionEntries[] =
    6370{
    6471  {"directory", 'd', 0, G_OPTION_ARG_FILENAME, &chrOutputDir, "Output directory", NULL},
     
    361368   This is the root parse function. Here starts the fun. When a token is found in the
    362369   input stream which matches one of the known token types the respective parsing function
    363    is called for further processing. In case of an error the parsing function in question 
     370   is called for further processing. In case of an error the parsing function in question
    364371   prints an error which describes the problem and exits the application.
    365372
     
    370377  while(g_scanner_peek_next_token(gScanner) != G_TOKEN_EOF) {
    371378    GTokenType token;
     379    GTokenValue value;
    372380
    373381    g_scanner_get_next_token(gScanner);
    374382    token=gScanner->token;
    375     GTokenValue value=gScanner->value;
    376    
     383    value=gScanner->value;
     384
    377385    switch(token)
    378386      {
     
    468476filename\n\n");
    469477
    470   /* This prints the standard option help to screen. */ 
     478  /* This prints the standard option help to screen. */
    471479  g_option_context_parse (gContext, &argc2, &argv2, &gError);
    472480}
     
    494502void funcMsgHandler(GScanner *gScanner, gchar *message, gboolean error)
    495503{
    496   g_printf("%s:%d: error: %s (%d %d)\n", parseInfo.chrCurrentSourceFile,
     504  g_printf("%s:%d: error: %s (%d %d)\n",
     505           parseInfo.chrCurrentSourceFile ? parseInfo.chrCurrentSourceFile : "<null>", /* glib doesn't check for NULL like printf. */
    497506           g_scanner_cur_line(gScanner)-parseInfo.uiLineCorrection, message,
    498507           g_scanner_cur_line(gScanner), parseInfo.uiLineCorrection);
     
    554563    }
    555564#endif
    556  
     565
    557566  /*** Create output path name ****/
    558567  if(g_path_is_absolute(chrOutputDir))
     
    572581  else
    573582    fd=open(argv[1], O_RDONLY);
    574  
     583
    575584  if(-1==fd)
    576585    {
     
    600609  while(pSymbols->chrSymbolName)
    601610    {
    602 #warning !!! Create a copy here so it is the same as with new symbols added later.
     611#ifndef _MSC_VER
     612# warning !!! Create a copy here so it is the same as with new symbols added later.
     613#endif
    603614      g_scanner_scope_add_symbol(gScanner, ID_SCOPE, pSymbols->chrSymbolName,
    604615                                 pSymbols);
Note: See TracChangeset for help on using the changeset viewer.