Coder Social home page Coder Social logo

lib_parse_enum's Introduction

Lib to parse the string names of enums in c. This is util to take the enum names as string to be used on c code.

Example:

typedef enum{
  NAME1 = 0,
  NAME2,
  NAME3 = 10,
  NAME4,
}test_e;

The lib_parse_enum return a list with the strings on defined enum order.

char **test_list = lib_parse_enum("test_e", "path of the file .c or .h")

test_list[0] : Return the string "NAME1"

test_list[1] : Return the string "NAME2"

test_list[3] : Return the string ""

test_list[10] : Return the string "Name3"

test_list[11] : Return the string "Name4"

To run the example:

  1. Create a build directory:

    mkdir build
  2. Change to the newly created directory:

    cd build
  3. Configure CMake:

    cmake ..
  4. Build the project:

    make
  5. Run the test_parse_enum:

    ./test_parse_enum

lib_parse_enum's People

Contributors

filipecarvalhedo avatar

Watchers

 avatar

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.