Menu

css support for Win32

Tochinski
2007-08-16
2013-05-15
  • Tochinski

    Tochinski - 2007-08-16

    Hello,

    With little modifications, I added css support for Win32
    Modifications are:

    Add
    css_lex.c
    css_syntax.c
    parser.c
    parser_pp.cc

    to htmlcxx.vcproj project

    -------------------------------
    css_lex.c

    Replace
    #include <unistd.h>

    with

    #ifdef WIN32
    #pragma warning (disable: 4996)
    #include <stdlib.h>
    #include <io.h>
    #define isatty _isatty
    #else
    #include <unistd.h>
    #endif

    -------------------------------
    css_syntax.c

    After
    #include <string.h>

    add

    #ifdef WIN32
    #pragma warning (disable: 4996)
    #include <stdlib.h>
    #endif
    -------------------------------
    parser_pp.cc

    After
    #include "parser_pp.h"

    add

    #ifdef WIN32
    #define DEFAULT_CSS "\&quot;default.css\&quot;"
    #endif
    -------------------------------
    htmlcxx.cc

    Remove

    #ifdef WIN32
    if(parse_css)
    {
    cerr << "Css parsing not supported in win32" << endl;
    return 1;
    }
    return 0;
    #else

    and remove closing
    #endif
    at the end of the file
    -------------------------------

    May be I missed something. I did check it with VC.NET 2005 Pro, it works fine.
    Overall, nice lightweight library. Thanks, guys.

    Leonid Tochinski
    ChattenAssociates, Inc.
    ltochinski AT chattenassociates DOT com

     
    • Tochinski

      Tochinski - 2007-08-17

      I extended WinCE support as well.

      Add
      css_lex.c
      css_syntax.c
      parser.c
      parser_pp.cc

      to htmlcxx.vcproj project

      -------------------------------
      css_lex.c

      Replace 
      #include <unistd.h>

      with

      #if defined(WIN32) || defined(UNDER_CE)
      #pragma warning (disable: 4996)
      #include <stdlib.h>
      #ifdef WIN32
        #include <io.h>
        #define isatty _isatty 
      #else
        #define strdup _strdup
        #define YY_NEVER_INTERACTIVE 1
      #endif
      #else
      #include <unistd.h>
      #endif

      -------------------------------
      css_syntax.c

      After 
      #include <string.h>

      add

      #if defined(WIN32) || defined(UNDER_CE)
      #pragma warning (disable: 4996)
      #include <stdlib.h>
      #ifdef UNDER_CE
        #define strdup _strdup
      #endif
      #endif

      -------------------------------
      parser_pp.cc

      After
      #include "parser_pp.h"

      add

      #if defined(WIN32) || defined (UNDER_CE)
      #define DEFAULT_CSS "\&quot;default.css\&quot;"
      #endif

      -------------------------------
      html\ci_string.h
      html\debug.h
      html\PaecerSax.tcc
      html\wincstring.h
      wingetopt.c

      replace all
      #ifdef WIN32
      with
      #if defined(WIN32) || defined (UNDER_CE)

      -------------------------------
      wingetopt.h

      replace
      #ifndef WIN32
      with
      #if !defined(WIN32) && !defined(UNDER_CE)
      -------------------------------
      htmlcxx.cc

      1. replace
      #ifndef WIN32
      with
      #if !defined(WIN32) && !defined(UNDER_CE)

      2. after
      #define VERSION "0.6"
      add
      #ifdef UNDER_CE
        #define main _tmain
      #endif

      3. replace
      ifstream file(argv[optind]);
      with
      #ifdef UNDER_CE
        wchar_t* warg1 = (wchar_t*)argv[1], *p = warg1;
        char arg1[256];
        while (*p != 0 && p-warg1 < sizeof(arg1)-1)
            arg1[p-warg1] = (char)*p++;
        arg1[p-warg1] = 0;   
              ifstream file(arg1);
      #else
        ifstream file(argv[optind]);
      #endif

      4. remove

      #ifdef WIN32
      if(parse_css)
      {
      cerr << "Css parsing not supported in win32" << endl;
      return 1;
      }
      return 0;
      #else

      5. and remove closing
      #endif
      at the end of the file
      -------------------------------

      I've tested code on WinXP and on WinCE (phyCORE-XScale/PXA270 SBC).

      Leonid Tochinski
      ChattenAssociates, Inc.
      ltochinski AT chattenassociates DOT com

       
  • stephane

    stephane - 2010-02-03

    thanx guy i only needed a part of all these to work but usefull indeed.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.