added makefile and eclipse cdt project files
This commit is contained in:
parent
e5f80ed5d9
commit
7adbcbd8b6
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.2063448201">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.2063448201" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.2063448201" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
|
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.2063448201.1202991045" name="/" resourcePath="">
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.base.198603313" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base">
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1008203517" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
|
||||||
|
<builder id="cdt.managedbuild.target.gnu.builder.base.843414349" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.archiver.base.302168232" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1312703866" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.87826736" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.687205595" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.154508414" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.assembler.base.13897115" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="0.1886071166">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="cmdlineoptions-c.null.1936447817" name="cmdlineoptions-c"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
</cproject>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>cmdlineoptions-c</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
|
||||||
|
all: build lib static
|
||||||
|
|
||||||
|
build:
|
||||||
|
gcc -c cmdlineoptions.c
|
||||||
|
|
||||||
|
lib:
|
||||||
|
rm -f libcmdlineoptions.a
|
||||||
|
ar cq libcmdlineoptions.a cmdlineoptions.o
|
||||||
|
|
||||||
|
|
||||||
|
static:
|
||||||
|
rm -f cmdlineoptions-static.o libcmdlineoptions.so
|
||||||
|
gcc -c -fPIC -o cmdlineoptions-static.o cmdlineoptions.c
|
||||||
|
ld -G cmdlineoptions-static.o -o libcmdlineoptions.so
|
|
@ -1,33 +1,65 @@
|
||||||
#include "cmdlineoptions.h"
|
#include "cmdlineoptions.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
CmdOptions cmdoptions;
|
CmdOptions cmdoptions;
|
||||||
|
|
||||||
void CmdOptions_Init(){
|
void CmdOptions_Init() {
|
||||||
if (cmdoptions.init == 0) {
|
if (cmdoptions.init == 0) {
|
||||||
cmdoptions.init = 1;
|
cmdoptions.init = 1;
|
||||||
// do we have to init something?
|
// do we have to init something?
|
||||||
// add the help option
|
// add the help option
|
||||||
CmdOptions_Add("help","--help");
|
CmdOptions_Add("help", "--help");
|
||||||
CmdOptions_Add("help","-h");
|
CmdOptions_Add("help", "-h");
|
||||||
CmdOptions_Add("help","-?");
|
CmdOptions_Add("help", "-?");
|
||||||
CmdOptions_AddDescription("help","Display the help text.");
|
CmdOptions_AddDescription("help", "Display the help text.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdOptions_Parse(int argc, char** argv){
|
int CmdOptions_Create(char* name) {
|
||||||
|
if (CmdOptions_NodeGet(name) == 0) {
|
||||||
|
CONode* newnode = 0;
|
||||||
|
newnode = malloc(sizeof(CONode));
|
||||||
|
if (cmdoptions.options == 0) {
|
||||||
|
cmdoptions.options = newnode;
|
||||||
|
} else {
|
||||||
|
CONode* last = cmdoptions.options;
|
||||||
|
while (last->next != 0)
|
||||||
|
last = last->next;
|
||||||
|
last->next = newnode;
|
||||||
|
}
|
||||||
|
newnode->next = 0;
|
||||||
|
newnode->option = malloc(sizeof(Option));
|
||||||
|
newnode->option->name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CONode* CmdOptions_NodeGet(char* name) {
|
||||||
|
if (cmdoptions.options != 0) {
|
||||||
|
CONode* node = cmdoptions.options;
|
||||||
|
while (node != 0) {
|
||||||
|
if (strcmp(name, node->option->name) == 0) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CmdOptions_Parse(int argc, char** argv) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdOptions_Add(char* name, char* option){
|
int CmdOptions_Add(char* name, char* option) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdOptions_AddDefaultParameter(char* name, char* defaultparameter){
|
int CmdOptions_AddDefaultParameter(char* name, char* defaultparameter) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdOptions_AddPossibleParameter(char* name, char* possibleParameter){
|
int CmdOptions_AddPossibleParameter(char* name, char* possibleParameter) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,26 +67,26 @@ int CmdOptions_AddDescription(char* name, char* description) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CmdOptions_IsSet(char* name) {
|
int CmdOptions_IsSet(char* name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* CmdOptions_Get(char* name) {
|
char* CmdOptions_Get(char* name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdOptions_GetInt(char* name) {
|
int CmdOptions_GetInt(char* name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long CmdOptions_GetLong(char* name){
|
long CmdOptions_GetLong(char* name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double CmdOptions_GetDouble(char* name) {
|
double CmdOptions_GetDouble(char* name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdOptions_GetAll(char* name, char** values, unsigned int* count) {
|
int CmdOptions_GetAll(char* name, char** values, unsigned int* count) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef CMDLINEOPTIONS_H
|
#ifndef CMDLINEOPTIONS_H
|
||||||
#define CMDLINEOPTIONS_H
|
#define CMDLINEOPTIONS_H
|
||||||
|
|
||||||
struct Option {
|
typedef struct {
|
||||||
char* name; // the name of this option
|
char* name; // the name of this option
|
||||||
char** options; //dashed option name and alternatives
|
char** options; //dashed option name and alternatives
|
||||||
unsigned int optionscount; // count of option alternatives
|
unsigned int optionscount; // count of option alternatives
|
||||||
|
@ -13,19 +13,20 @@ struct Option {
|
||||||
|
|
||||||
char** values; // values
|
char** values; // values
|
||||||
unsigned int valuecount; // size of the values, if more than one...
|
unsigned int valuecount; // size of the values, if more than one...
|
||||||
bool set; // boolean if this option has been set
|
char set; // boolean if this option has been set
|
||||||
};
|
} Option;
|
||||||
|
|
||||||
struct CONode {
|
|
||||||
CONode* prev;
|
typedef struct _CONode {
|
||||||
CONode* next;
|
//CONode* prev;
|
||||||
|
struct _CONode* next;
|
||||||
Option* option;
|
Option* option;
|
||||||
};
|
} CONode;
|
||||||
|
|
||||||
struct CmdOptions {
|
typedef struct {
|
||||||
bool init;
|
char init;
|
||||||
CONode* options;
|
CONode* options;
|
||||||
};
|
} CmdOptions;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main structure
|
* Main structure
|
||||||
|
@ -62,7 +63,7 @@ int CmdOptions_AddDescription(char* name, char* description);
|
||||||
/**
|
/**
|
||||||
* Check if the option specified by name is set.
|
* Check if the option specified by name is set.
|
||||||
*/
|
*/
|
||||||
bool CmdOptions_IsSet(char* name);
|
int CmdOptions_IsSet(char* name);
|
||||||
/**
|
/**
|
||||||
* Get first parameter of the option specified by name.
|
* Get first parameter of the option specified by name.
|
||||||
*/
|
*/
|
||||||
|
@ -85,5 +86,7 @@ double CmdOptions_GetDouble(char* name);
|
||||||
*/
|
*/
|
||||||
int CmdOptions_GetAll(char* name, char** values, unsigned int* count);
|
int CmdOptions_GetAll(char* name, char** values, unsigned int* count);
|
||||||
|
|
||||||
|
int CmdOptions_Create(char* name);
|
||||||
|
CONode* CmdOptions_NodeGet(char* name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue