Coder Social home page Coder Social logo

c2obx's Introduction

This is a tool to transpile a C header file (with includes) to a corresponding Oberon+ definition module.

It already works well with the SDL2 headers (with only minimal modifications), but consider the tool work-in-progress.

Note that since it is undecidable, whether a C pointer is indeed a pointer to the given object or in fact a pointer to an array of such objects, and Oberon+ only supports pointers to structured types, all *basic_type are converted to CPOINTER TO CARRAY of basic_type (i.e. *[]), but *structured_type are translated to Oberon+ CPOINTER TO structured_type (i.e. *). The special case of **type which is used to get a pointer out of a procedure is handled by *[]*type for structured types and void, and *[] for basic types.

Pending:

  • process comments (line and block)
  • consider #DEFINE constants
  • use original type names for basic types (instead of plain C basic types)

c2obx's People

Contributors

rochus-keller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

c2obx's Issues

What is the purpose of -1 within an static quint32 array context for the function bool is_ident1(quint32 c).

Hi, I try to compile your code but get errors for the functionis_ident1(...) and is_ident2(...) .
I can see that -1 is some kind of end of marker in the range array used by in_rage(...) but -1 is not an quint32.
I cannot oversee side effect but is 0x00000 an option?

Tokenizer.cpp: In function ‘bool is_ident1(quint32)’:
Tokenizer.cpp:196:5: error: narrowing conversion of ‘-1’ from ‘int’ to ‘quint32 {aka unsigned int}’ inside { } [-Wnarrowing]
     };

and

Tokenizer.cpp: In function ‘bool is_ident2(quint32)’:
Tokenizer.cpp:207:5: error: narrowing conversion of ‘-1’ from ‘int’ to ‘quint32 {aka unsigned int}’ inside { } [-Wnarrowing]
     };

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.