En cours

Parse input file with specific (simple) format and generate output file

Hi,

I need a simple command line application (developed in C/C++ with Visual Studio) that accepts one or more input files

and generate an output file after parsing. Please, do not use external libraries like Boost.

The command line should be something like:

[url removed, login to view] /inputfiles file1 file2 file3 /outputfile out_file

The input files has a specific format. Example:

----------------

// This is a comment. Comments are allowed with "//"

// This is the structure of a "Test block". There can be multiple "Test Block"

// in an input file

[test operation1 mode1,2]

{

Platforms

{

PLATFORM1, PLATFORM2

}

PreExecute

{

VAR1=0

VAR2=0x1000

MULTI_VAR= RR, TG, !GG

InitializeRestVars

}

Execute

{

operation 1_1, 10

operation 1_2, 30

operation x_x

}

PostExecute

{

VAR1=0x10

VAR2=0x30

MULTI_VAR = RR, !TA

}

}

// Here there might be more "Test block" as the one above

// ....

// .....

-----------------

The generated output for the above test file should be the following. Please

notice that I have put here comments (//) for better understanding for you.

Those comments are not generated, of course.

--------

// Observe how "test operation1 mode1,2" is converted, basically spaces and commas

// are replaced with "_"

DWORD test_operation1_mode1_2_Platforms[] = {PLATFORM1, PLATFORM2, 0};

// This is how "PreExecute" block is transformed

void test_operation1_mode1_2_PreExecute(void)

{

// Notice how we add "Set" to all entries

// Notice also that "=X" is converted as (X)

SetVAR1(0);

SetVAR2(0x1000);

// Notice how asignation with commas are converted

SetMULTI_VAR(RR);

SetMULTI_VAR(TG);

// Notice that when "!" appears we put "UnSet"

UnSetMULTI_VAR(GG)

}

// This is how "Execute" block is transformed. Basically, we just copy line

// by line as it appers

char *test_operation1_mode1_2_Execute[] = {"operation 1_1, 10", "operation 1_2, 30", "operation x_x", NULL};

// This is how PostExecute is transformed. Quite similar to "PreExecute"

void test_operation1_mode1_2_PostExecute(void)

{

// Same as "PreExecute" but we put "Check" instead of "Set"

CheckVAR1(0x10);

CheckVAR2(0x30);

CheckMULTI_VAR(RR);

// Notice that when "!" appears we put "UnCheck"

UnCheckMULTI_VAR(TA)

}

// Finally we generate the following for the above "Test Block"

TEST_BLOCK test_operation1_mode1_2 =

{

"test operation1 mode1,2",

test_operation1_mode1_2_Platforms,

test_operation1_mode1_2_PreExecute,

test_operation1_mode1_2_Execute,

test_operation1_mode1_2_PostExecute

};

// If we have parsed other "Test Block" like the one above. We generate its output

// here like the above "Test Block". Example:

// DWORD test_block2_Platforms[] = {xxxxxxx};

// void test_block2_PreExecute(void)

// .....

// ...

// Finally we generate the following for all "Test Block" that have been

// parsed. Imagine that we have parsed other "Test Block" (test_block2, test_block3)

// So the output should be like

ALL_TESTS AllTests[] =

{

test_operation1_mode1_2,

test_block2,

test_block3,

NULL

};

Compétences : Programmation C, Programmation C++

Voir plus : simple calculator input file, fibonacci input file output

Concernant l'employeur :
( 62 commentaires ) Jerez de la Frontera, Spain

N° du projet : #13090788

Décerné à :

vano101

Hello. Looks like I have completed something similar in the past.

31 $ USD en 1 jour
(1285 Commentaires)
7.4

4 freelance ont fait une offre moyenne de 90 $ pour ce travail

amariitism

Hello We are highly motivated young technocrats from India. We are approachable, you can come to us if you have a struggle, we are happy to help. Team TiponTongue

200 $ USD en 5 jours
(21 Commentaires)
4.9
50 $ USD en 3 jours
(65 Commentaires)
5.1
yemelitc

Hello, Ok I can do your project. I have excellent experience which allows me to be very fit for this project. Especially I had designed and developed my own parsing algorithm, which you can find at the link: * http Plus

80 $ USD en 0 jours
(9 Commentaires)
3.7