Giter VIP home page Giter VIP logo

dust's Introduction

WELCOME TO DFC
==============
Learn DFC In Three Chapters...
* Chapter One:    What Is DFC?
* Chapter Two:    Getting Start
* Chapter Three:  Introduction Of Modules

1 What Is DFC?
   DFC is a short for Dust, Farm, and Crop. It provides a develop flow for C/C++ project.  In a nutshell, Dust is source code of platform, Farm is a platform, Crop is a running environment.  First, Dust is a integration of modules, such as communication module, log module, error manage module, debug outside module, and so on. User can add a new module to insert into Dust.  It can generate a platform named Farm easily via executing a script in Dust.  Farm provides some simple interfaces for user to add its own business code. Farm use 'cmake' to generate executable files. This can let user avoid writing complex makefiles and pay their attention to kernel code.  It can pack all executable files, config files, tools scripts into a published media named crop_x.y.z.tar.gz.  This compression package can pass to maintenance personnel. Crop unpacked will be a complete running environment.
   DFC use a globally-unique config file: dfc.conf, which contains config infomation of every submodule. dust, farm and crop use dfc.conf as its config file.
   Dust and Farm use 'build.sh' in respective build directory to generate executable file and lower platform.
   General catalogue of DFC:
   [root@localhost dust]# tree -L 2
   .
   |-- README
   |-- build
   |   `-- build.sh                 //compile dust, publish farm, and so on,Input './build.sh help' to get more help infomation.
   |-- moduleComm                   //submodule -- communication
   |-- moduleErr                    //submodule -- error manage
   |-- moduleLg                     //submodule -- communication with outside
   |-- moduleLog                    //submodule -- log
   |-- moduleMem                    //submodule -- memory leak check
   |-- moduleTools                  //submodule -- tools
   |-- script                       //contains useful script
   |-- unity                        //test assistant tool for TDD
   `-- platform                     
       |-- dfc.conf                 //globally-unique config file
       |-- main.c                   //dust platform main module
       |-- main.h                   //dust platform main module
       |-- userapp.c                //demo
       |-- userapp.h                //demo
       |-- crop_README              //README of crop
       |-- crop_install.sh          //setup script of crop
       |-- dust2farm.sh             //package dust to farm, called by build.sh
       |-- farm2crop.sh             //package farm to crop, called by farm_build.sh
       |-- farm_README              //README of farm
       |-- farm_build.sh            //compile script of farm
       |-- farm_CMakeLists.txt      //cmake config file of farm
       `-- farm_src_CMakeLists.txt  //cmake config file of farm

   More complete develop process like following:
   (Dust developer)
         dust_1.0.0 --> ./build.sh dust --> dfc(test demo) --> develop finished! --> ./build.sh farm --> farm_1.0.0.tar.gz
   (Farm developer)
         farm_1.0.0.tar.gz --> farm_1.0.0 --> ./build.sh farm --> dfc(test demo) --> develop finished! --> ./build.sh crop --> crop_1.0.0.tar.gz 
   (Operational people)
         crop_1.0.0.tar.gz --> crop_1.0.0 --> ./install.sh --> a complete running environment.

2 Getting Start
2.1 Use Dust
2.1.1 hello world!
   a. modify line 23 in'dust/platform/userapp.c' as:
         const char* appVersion     = "hello world!";

   b. cd dust/build/ && ./build.sh

   c. [root@localhost build]# ./dfc -v
         gcc: 4.1.2 20080704 (Red Hat 4.1.2-48)
         module: app,    version: hello world!,    compile: Feb 21 2013 22:15:12
         module: comm,   version: 1.0.0,         compile: Feb 21 2013 22:10:00
         module: log,    version: 1.0.0,         compile: Feb 21 2013 22:10:00
         module: lg,     version: 1.0.0,         compile: Feb 21 2013 22:10:00

   d. ok, we modified version as 'hello world!', and we got a show by dfc.

2.1.2 add a new submodule
   TO BE ADDED ...

2.1.3 test your new submodule
   TO BE ADDED ...


2.2 Use Farm
   See dust/platform/farm_README.

2.3 Use Crop
   See dust/platfrom/crop_README.

3 Introduction Of Modules
   Every introduction of modules will be found in the header file of module. Try "cat logModule/logModule.h" for example.




欢迎使用DFC
===========
通过三个章节了解DFC:
1、什么是DFC?
2、开始使用
3、模块介绍

1  什么是DFC?
   DFC是Dust、Farm和Crop的缩写,为C/C++项目提供了一个开发流。概括地说,Dust是平台源码,Farm是开发平台,Crop是运行环境。首先,Dust是一个基础模块的集合,如通信模块、日志模块、错误管理模块、与外部通讯模块等,用户可以很方便的集成新的模块到Dust中。通过执行Dust中的脚本,可以很方便的生成一个名为Farm的开发平台。Farm提供了简单的接口让用户增加自己的业务代码,通过执行Farm中的脚本,可以生成可执行程序,并将可执行程序、配置文件、辅助工具等打包为发布介质Crop。解压后的Crop将是一个完整的运行环境。
   DFC使用一个全局唯一的配置文件dfc.conf,包含各个子模块的配置信息,dust、farm和crop均使用该配置文件。
   dust和farm均使用各自build目录下的build.sh脚本完成可执行文件及下游平台的生成。

   DFC大体的目录结构:
   [root@localhost dust]# tree -L 2
   .
   |-- README
   |-- build
   |   `-- build.sh                 //编译dust、发布farm等,输入./build.sh help可得到较为详尽的帮助信息
   |-- moduleComm                   //子模块--通信
   |-- moduleErr                    //子模块--错误管理
   |-- moduleLg                     //子模块--与外部通讯
   |-- moduleLog                    //子模块--日志
   |-- moduleMem                    //子模块--内存泄漏查找
   |-- moduleTools                  //子模块--常用工具库
   |-- script                       //包含各种有用的脚本
   |-- unity                        //测试驱动开发的测试辅助工具
   `-- platform                     
       |-- dfc.conf                 //DFC平台唯一的配置文件
       |-- main.c                   //dust平台总模块--源文件
       |-- main.h                   //dust平台总模块--头文件
       |-- userapp.c                //demo--源文件
       |-- userapp.h                //demo--头文件
       |-- crop_README              //crop的README
       |-- crop_install.sh          //crop的安装脚本
       |-- dust2farm.sh             //dust到farm的打包脚本,由build.sh调用
       |-- farm2crop.sh             //farm到crop的打包脚本,由farm_build.sh调用
       |-- farm_README              //farm的README
       |-- farm_build.sh            //farm的编译脚本
       |-- farm_CMakeLists.txt      //farm的cmake总配置文件
       `-- farm_src_CMakeLists.txt  //farm的cmake用户配置文件

   一个较为完整的开发过程如下:
   (Dust开发者)
         dust_1.0.0 --> ./build.sh dust --> dfc(测试demo) --> 开发完成 --> ./build.sh farm --> farm_1.0.0.tar.gz
   (Farm开发者)
         farm_1.0.0.tar.gz --> farm_1.0.0 --> ./build.sh farm --> dfc(测试demo) --> 开发完成 --> ./build.sh crop --> crop_1.0.0.tar.gz 
   (运维人员)
         crop_1.0.0.tar.gz --> crop_1.0.0 --> ./install.sh --> 完整的运行环境

2  开始使用
2.1 Dust的使用
2.1.1 hello world!
   a. 修改dust/platform/userapp.c的23行为:
         const char* appVersion     = "hello world!";

   b. 进入dust/build/,执行./build.sh

   c. 再执行./dfc -v,即可获得如下内容:
         [root@localhost build]# ./dfc -v
         gcc: 4.1.2 20080704 (Red Hat 4.1.2-48)
         module: app,    version: hello world!,    compile: Feb 21 2013 22:15:12
         module: comm,   version: 1.0.0,         compile: Feb 21 2013 22:10:00
         module: log,    version: 1.0.0,         compile: Feb 21 2013 22:10:00
         module: lg,     version: 1.0.0,         compile: Feb 21 2013 22:10:00

   d. 好了,我们在修改了业务代码中的版本号为hello world!,并在最终的可执行文件中得到显示。今后,如果要测试你新加或已有的子模块代码,可以在userapp.c/h中进行修改。

2.1.2 增加一个新的子模块
   待补充...

2.1.3 测试你的新模块
   待补充...

2.2 Farm的使用
   参见 dust/platform/farm_README.

2.3 Crop的使用
   参见 dust/platform/crop_README.

3  模块介绍
   每个模块的介绍及使用均可以在模块的头文件里找到。你可以试一下"cat moduleLog/moduleLog.h"这个命令。

dust's People

Contributors

bbdlg avatar

Watchers

 avatar  avatar  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.