Giter Site home page Giter Site logo

chiefgokhlayeh / autofff Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 3.0 306 KB

Auto-generate FFF fake definitions for C API header files

License: MIT License

Python 87.82% Makefile 7.45% C 1.30% C++ 2.36% Dockerfile 1.07%
fff c automation header-parser python python-3-6 fake-functions tdd test-driven-development

autofff's People

Contributors

chiefgokhlayeh avatar dependabot[bot] avatar pre-commit-ci[bot] avatar sangmo-kang avatar sebirdman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

autofff's Issues

pip download error

Hi Andreas,

seems like the pip install does not work as expected:

python -m pip install autofff
Collecting autofff
  Using cached https://files.pythonhosted.org/packages/fa/93/699704c1a277bd51e6f9c0577fa6ed585ec674f72a6533aa6ff61675ec9f/autofff-0.3-py3-none-any.whl
Collecting overrides>=1.9 (from autofff)
  Downloading https://files.pythonhosted.org/packages/de/55/3100c6d14c1ed177492fcf8f07c4a7d2d6c996c0a7fc6a9a0a41308e7eec/overrides-1.9.tar.gz
Collecting validator>=2.0.6 (from autofff)
  Using cached https://files.pythonhosted.org/packages/09/42/00e6244cdc62bbef3dcdfdbe8232e6960fcca2e7a501f0d74e5c6258b06e/validator-2.0.6.tar.gz
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/yanc/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
    Couldn't find index page for 'yanc' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
    No local packages or download links found for yanc==0.2.4
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "C:\Users\fsc6lr\AppData\Local\Temp\pip-build-r9e4eyy_\validator\setup.py", line 21, in <module>
        , 'yanc==0.2.4'
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\distutils\core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\setuptools\dist.py", line 268, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\setuptools\dist.py", line 313, in fetch_build_eggs
        replace_conflicting=True,
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\pkg_resources\__init__.py", line 836, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\pkg_resources\__init__.py", line 1081, in best_match
        return self.obtain(req, installer)
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\pkg_resources\__init__.py", line 1093, in obtain
        return installer(requirement)
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\setuptools\dist.py", line 380, in fetch_build_egg
        return cmd.easy_install(req)
      File "C:\CDDK_Example\Tools\Python\v3.4.4-1.1.0\lib\site-packages\setuptools\command\easy_install.py", line 623, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('yanc==0.2.4')

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\fsc6lr\AppData\Local\Temp\pip-build-r9e4eyy_\validator

It also does not work with a manual installation "python -m pip install ."

I tried with anaconda3 with python 3.6 and a standalone python with python 3.4, both are not working...

Hope you can fix it ;P

Passing Defines during generation

Hello,

First off, thanks so much for this! this is a fantastic project!

I'm running into an issue with some includes where generation fails becuase something is not defined.

for example. from list.h in FreeRTOS:

#ifndef INC_FREERTOS_H
	#error FreeRTOS.h must be included before list.h
#endif

Is there any way i can pass defines into the generator?

Implement clang-based scanner

As discussed in #3 (comment), explore possibilities of using libclang's C API. Fortunately, libclang provides Python bindings for their C API.

Experimenting with it demonstrated, that libclang provides deeper lexical fidelity when parsing a C source/header file (i.e. it provides preprocessor tokens before they're expanded). Perhaps this can be used to more effectively work around __asm__(...)-statements, which make direct inclusion of that particular file impossible.

Outdated README

I think the instructions in the README regarding how to use autofff as a python package are no longer correct. You mention you can do the following:

import autofff

import os.path

targetHeader = input("Enter the path of the header you would like to scan: ")
outputHeader = input("Enter the path of the target header file which shall be generated: ")
fakes = './autofff/dependencies/pycparser/utils/fake_libc_include'

scnr = autofff.GCCScanner(targetHeader, fakes) # Create GCC code scanner

However, I don't think this works after this commit: 4ba015b. When you no longer do from scanner import * in the __init__.py file, you can't just use autofff.GCCScanner() after doing an import autofff.

I'm no python expert, but I was able to get the following to work:

from autofff import scanner

targetHeader = input("Enter the path of the header you would like to scan: ")
outputHeader = input("Enter the path of the target header file which shall be generated: ")
fakes = './autofff/dependencies/pycparser/utils/fake_libc_include'

scnr = autofff.scanner.GCCScanner(targetHeader, fakes) # Create GCC code scanner

Perhaps there is a better way to do it. All I know is what is listed in the README didn't work for me

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.