Code Monkey home page Code Monkey logo

dfm-toolkit's Introduction

Logo DFM Toolkit

The DFM Toolkit is a collection of tools to process DFM files produced by Embarcadero's RAD Studio.

The DFM Toolkit consists of

  • DFM Image Export

    A Tool that exports image data from a given DFM File

  • DFM Formatter

    A Tool to normalize the formatting of a DFM File

  • DFM Find

    A Tool to search for certain parameters, names or types in a DFM File

  • DFM Tokens

    A Tool to tokenize a DFM File. Tokens are returns as a JSON Array.

  • libdfm

    The core library to parse and process DFM files

Because of a lack of any sort of documentation or specification the syntax and semantic is mostly guessed based on examples found online. A DFM file is tokenized using the the automata described here and the tokens are passed using the context-free grammar described here.

Goal

Goal of this projects is to provide Delphi developers easy to use tools to work with .dfm files in a way currently not or not easily possible with tools provided by Embarcadero.

This includes but is not limited to:

  • Formatting .dfm files
  • Extracting data from .dfm files (e.g. images, configurations)
  • Search in .dfm files (e.g. for images, configurations, certain values/types)
  • Editing .dfm files (e.g. removing attributes, replacing images)

Compiling

Note: Because of a dependency to the ::iconv() function a build on/for Windows might not be easy

# Build Release
git clone https://github.com/Dadie/dfm-toolkit.git
cd dfm-toolkit
mkdir .build-release
cd .build-release
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
# Build Debug
git clone https://github.com/Dadie/dfm-toolkit.git
cd dfm-toolkit
mkdir .build-debug
cd .build-debug
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build .

Requirements/Dependencies

The DFM Toolkit requires a C++ compiler supporting at least C++20 e.g. clang 11 and uses CMake.

While the libdfm has no further dependencies, the applications depend also on docopt.cpp and some on nlohmann::json.

For the usage of each application in the toolkit see the USAGE string in the $app.main.cpp or call the application with the --help argument.

Tests

This projects uses ctest for automated testing. Call ctest --help for more information in the CMake Build directory.

# Build Debug
git clone https://github.com/Dadie/dfm-toolkit.git
cd dfm-toolkit
mkdir .build-debug
cd .build-debug
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build .

# Run ctests
for proj in "../projects/"* 
do
  if [[ -d $proj ]]; then
    ctest --test-dir "projects/$(basename $proj)/"
  fi
done

Note of caution

Tools are provided as is. APIs may (or rather will likely) change. Please either have backups of your .dfm files or use a CVS to make sure no data is lost.

Contribution

Unless stated otherwise any contribution is assumed to be under the same license as the DFM Toolkit. Contributions are always welcome, aspecially obscure (but verified valid) examples of .dfm files.

License

See LICENSE

dfm-toolkit's People

Contributors

dadie avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

atkins126

dfm-toolkit's Issues

[libdfm] Support expressions in the abstract syntax tree

Currently expressions are mostly ignored and simply stored as a list of tokens in the abstract syntax tree. Instead the expression (e.g. 1+2+3+4 or 'abc'#50'def') should be parsed so they could be (partially) evaluated if requested.

[libdfm] Support lexer weeding configuration

Currently the weeder for the tokens while having a configuration it's not available for users of the library. Each possible likely configuration should be tested to make sure a valid parse tree can be generated from the more or less weeded tokens.

It could be as simple as adding another argument to dfm::lexer::weed().

Argument was added to the function dfm::lexer::weed() but tests are still missing.

[libdfm] Separate declaration and definition of member functions of template types

To make template types more readable the declaration and definition of member functions should be separated.

Before

template<typename A>
struct B {
    RetTypeC MemberFnD(ParamE e){ /* Do Stuff */ return {}; }
    RetTypeC MemberFnF(ParamE e){ /* Do Stuff */ return {}; }
    RetTypeC MemberFnG(ParamE e){ /* Do Stuff */ return {}; }
    RetTypeC MemberFnH(ParamE e){ /* Do Stuff */ return {}; }
};

After

template<typename A>
struct B {
    RetTypeC MemberFnD(ParamE e);
    RetTypeC MemberFnF(ParamE e);
    RetTypeC MemberFnG(ParamE e);
    RetTypeC MemberFnH(ParamE e);
};

template<typename A>
RetTypeC B<A>::MemberFnD(ParamE e){ /* Do Stuff */ return {}; }

template<typename A>
RetTypeC B<A>::MemberFnF(ParamE e){ /* Do Stuff */ return {}; }

template<typename A>
RetTypeC B<A>::MemberFnG(ParamE e){ /* Do Stuff */ return {}; }

template<typename A>
RetTypeC B<A>::MemberFnH(ParamE e){ /* Do Stuff */ return {}; }

[libdfm] Support parse tree weeding configuration

Currently the weeder for the parse tree while having a configuration it's not available for users of the library. Each possible configuration should be tested to make sure a valid ast can be generated from the more or less weeded parse tree.

It could be as simple as adding another argument to dfm::pt::weed().

[dfm-image-export] DFM Examples (TImage)

Example files for TImage objects are needed.

For each example file the following information should be provided:

  1. expected output image(s)
  2. RAD Studio Version which which they were created (e.g. RAD Studio XE)

Using this information a test should be defined.

[libdfm] Support AST formatted configuration

Currently aside from padding no configuration is available for the formatted dfm output of the ast.

The following options should be available:

  • Column limit (n, default:120)
  • Use tabs (yes, no, default: no)
  • Tab width (n, default: 8)
  • Indent width (n, default: 2)
  • Empty inline objects in one line (yes, no, default: no)
  • Binary string column limit (n, default: 64)
  • Escape non ASCII characters (yes, no, default: yes)
  • Space before trailing comment (yes, no, default: yes)
  • Reflow comments (yes, no, default: no)
  • Break before braces (yes, no, default: no)
  • Break before comma (yes, no, default: no)
  • Break after braces (yes, no, default: yes)
  • Break after comma (yes, no, default: no)
  • Align assigns (left, right, none, default: none)
  • Newline (cr, lf, crlf, preserve, default: preserve)

[dfm-image-export] DFM Examples (TImageList)

Example files for TImageList objects are needed.

For each example file the following information should be provided:

  1. expected output image(s)
  2. RAD Studio Version which which they were created (e.g. RAD Studio XE)

Using this information a test should be defined.

[libdfm] Support building for/on Microsoft Windows

libdfm should be able to be compiled on Windows and for Windows.

I haven't yet tried to compile the library on or for Windows but it's likely that at least because of the used function ::iconv() some changes are required to support building for/on Windows.

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.