Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parseur pour fichier sous titre olfactifs Scentys
- Loading branch information
ARO17
committed
Apr 12, 2013
1 parent
f61cc12
commit 74f584d
Showing
45 changed files
with
5,605 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
v.0.10 : | ||
- Parseur de fichier sous-titre Scentys. | ||
- Format du fichier : | ||
- [hh:[mm:]]ss = fragId, groupId | ||
- [hh:[mm:]]ss -> fragId, groupId | ||
- [hh:[mm:]]ss -> FfragId, GgroupId | ||
- [hh:[mm:]]ss -> FfragId GgroupId | ||
|
||
v.0.20 : | ||
- Ajout d'un temps pour stopper la fragrance. | ||
- Format du fichier : | ||
- [hh:[mm:]]ss - [hh:[mm:]]ss = fragId, groupId | ||
|
||
v.0.30 : | ||
- Modification du format de fichier sts : | ||
- [[hh:]mm:]ss -> [[hh:]mm:]ss = fragId, groupId | ||
- Lorsqu'un champ n'est pas renseigné (heure ou minute) | ||
on lui attribut la valeur 0 au lieu de la valeur -1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CFLAGS = -Wall | ||
LDFLAGS = -lfl -ly | ||
|
||
all: sts_parser.y.h main.o sts_parser.l.o sts_parser.y.o | ||
gcc ${CFLAGS} -o sts_parser main.o sts_parser.y.o sts_parser.l.o ${LDFLAGS} | ||
clean: | ||
rm -f *.o | ||
rm -f sts_parser.l.c sts_parser.y.c sts_parser.y.h | ||
rm -f sts_parser | ||
|
||
sts_parser.l.o: sts_parser.l.c | ||
gcc -c ${CFLAGS} sts_parser.l.c | ||
|
||
sts_parser.y.o: sts_parser.y.c | ||
gcc -c ${CFLAGS} sts_parser.y.c | ||
|
||
sts_parser.l.c: sts_parser.lex | ||
flex --yylineno sts_parser.lex ; mv -f lex.yy.c sts_parser.l.c | ||
|
||
sts_parser.y.c: sts_parser.y | ||
bison -y -d sts_parser.y ; mv -f y.tab.c sts_parser.y.c; mv -f y.tab.h sts_parser.y.h | ||
|
||
sts_parser.y.h: sts_parser.y | ||
bison -y -d sts_parser.y ; mv -f y.tab.c sts_parser.y.c; mv -f y.tab.h sts_parser.y.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
12:21:00 -> F2 G4 | ||
12:21:00 -> F6 G8 | ||
10 = F2 | ||
1:00 -> -2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
23:00 = F8 G4 | ||
-è | ||
*%+°@ | ||
#rjrjrjrjr | ||
2=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
12:30=2 | ||
13:40=2,3 | ||
12->F1 G2 | ||
1:23:45 = F2,G4 | ||
34 -> G2 f3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "sts_parser.h" | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
Commands_array *cmd_array = NULL; | ||
int i; | ||
|
||
if (argc != 2) { | ||
fprintf(stderr, "usage: %s filename\n", argv[0]); | ||
exit(1); | ||
} | ||
else | ||
cmd_array = loadSubtitleFile(argv[1]); | ||
|
||
if (cmd_array) | ||
{ | ||
for (i = 0; i < cmd_array->used; i++) { | ||
printf ("Command %d: Play fragrance %d of group %d at %d hour, %d minute(s) and %d seconde(s)\n", | ||
i, | ||
cmd_array->cmd_line[i].fragrance, | ||
cmd_array->cmd_line[i].group, | ||
cmd_array->cmd_line[i].hour, | ||
cmd_array->cmd_line[i].minute, | ||
cmd_array->cmd_line[i].seconde); | ||
} | ||
} | ||
|
||
exit(0); | ||
} |
21 changes: 21 additions & 0 deletions
21
c_programming/lex_yacc/sts_file_parser/v.0.10/scentys_subtitle.sts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
F1 | ||
00:00:03 = 1,2 | ||
00:00:12 = 0,2 | ||
|
||
# un com | ||
00:00:00 = 1,2 # un autre | ||
00:00:00 = 1 | ||
00:00 = 1 | ||
00 = 1 | ||
|
||
;00:00:00 : 1 - 2 | ||
;00:00:00 : 1 | ||
;00:00 : 1 | ||
;00 : 1 | ||
|
||
;00:00:00 : F1 G2 | ||
;00:00:00 : F1 - G2 | ||
;00:00:00 : F1 | ||
;00:00:00 : playFragrance(1) | ||
;00:00 : F1 | ||
;00 : F1 |
27 changes: 27 additions & 0 deletions
27
c_programming/lex_yacc/sts_file_parser/v.0.10/sts_parser.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
typedef struct | ||
{ | ||
int hour; | ||
int minute; | ||
int seconde; | ||
int fragrance; | ||
int group; | ||
} | ||
Command_line; | ||
|
||
typedef struct | ||
{ | ||
Command_line *cmd_line; | ||
size_t used; /* items number */ | ||
size_t size; /* total size allocated */ | ||
} | ||
Commands_array; | ||
|
||
int initArray(Commands_array *cmd_array, size_t initialSize); | ||
|
||
int insertElement(Commands_array *cmd_array, Command_line *element); | ||
|
||
void freeArray(Commands_array *cmd_array); | ||
|
||
void initCommandLine(Command_line *cmd_line); | ||
|
||
Commands_array *loadSubtitleFile(char *subtitle_file_name); |
36 changes: 36 additions & 0 deletions
36
c_programming/lex_yacc/sts_file_parser/v.0.10/sts_parser.lex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
%option nounput | ||
|
||
%{ | ||
|
||
#include "sts_parser.y.h" | ||
|
||
%} | ||
|
||
|
||
blank [ \t]+ | ||
digit [0-9] | ||
number {digit}+ | ||
|
||
|
||
%% | ||
|
||
{blank} ; /* Do nothing */ | ||
[A-Z] ; | ||
[a-z] ; | ||
#.*$ ; | ||
|
||
{number} { yylval.integer = atoi(yytext); return(NUMBER); } | ||
[Ff]{number} { yylval.string = yytext; return(FRAG); } | ||
[Gg]{number} { yylval.string = yytext; return(GROUP); } | ||
":" { return(COLON); } | ||
"," { return(COMMA); } | ||
"=" { return(ASSIGN); } | ||
"->" { return(ASSIGN); } | ||
"\n" { return(EOL); } | ||
"\r" { return(EOL); } | ||
"\r\n" { return(EOL); } | ||
<<EOF>> { return 0 ; } | ||
. ; | ||
|
||
|
||
%% |
Oops, something went wrong.