Bonsoir a tous ou Bonne nuit ,
Voila après avoir réussi la récupération des sources depuis mon .dsp ( pour ceux qui me suivent ^^)
J'ai deux nouvelle problématique sur lequel je sèche , une que je suppose simple mais ça m'énerve de bloqué sur quelque chose qui parait bénin !
La première :
J'ai mon code qui a été conçue pour récupérer les sources dans un fichier projet visual donc .dsp , jusque la pas de soucis , sauf que j'aimerai séparé la récupération de . h et de .c, je m'explique et comme un schéma vaut mieux qu'un long discours je cours sur paint :
J'ai pensé alors a un tableau de pointeur
Voila le code (qui ne fonctionne pas) surement du au tableau de pointeur mal exploité :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 #include "appli.h" void Receive_Dsp() { FILE* fichier = NULL; char mot[256]; char *motc[256]={""}; char *moth[256]={""}; int i,k=0,j=0; fichier = fopen(NomFichier,"r" ); if (fichier == NULL) Fin("erreur du fopen"); while (fscanf(fichier,"%s",mot) != EOF) { printf("%s\n", mot); // test debug if(strncmp(mot,"SOURCE=",7)==0) { puts("BINGO voila le mot demander!!!!"); // test debug getch(); j=0; for (i=9, j=0 ; mot[i]!= '\0' ; i++,j++) { strcpy(motc[k], mot+9); // copy du mot trouver dans un deuxieme buffer! k++; } system("CLS"); puts(motc[k]); getch(); } } fclose(fichier); }
Appli.h
Fin.c
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 /****************************************************************** Mes includes ******/ #include <stdio.h> #include <windows.h> #include <conio.h> /****************************************************************** Mes structure *****/ /****************************************************************** Mes defines *******/ #define NomFichier "recupsrc.dsp" #define NomMakefile "AvoidObstacle.tmk" /****************************************************************** Mes definitions ***/ //void lecture(char nomFichier, char fichier); void Fin (char *); void Receive_Dsp(); void Write_Tmk();
Dans le main il y a juste l'appel de la première fonction.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 #include "appli.h" void Fin(char *pMsg) { puts(pMsg); getch(); exit(0); }
Pourquoi tout ça , pourquoi je m'embête autant , et c'est la ou viens ma deuxième problématique !
Le makefile
Voici le make , il est dans mon proje de le reprendre a la societé qui me fournit le robot de mon projet,
Il est certes quelque peut modifier pour que cela soit de 1 plus structuré et de 2 pour mes besoin.
Ce que je voudrait faire et de reprendre le bloc rouge et de faire un recopie en dessous , je m'explique,
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171 #################################################################### # Makefile for TM V.3.20A # COPYRIGHT(C) 1998(1998-2003) # RENESAS TECHNOLOGY CORPORATION ALL RIGHTS RESERVED # AND # RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED # # Notice : Don't edit. # Date : 2004 11(November) 13(Saturday) PM.05.18 # Project : AvoidObstacle #################################################################### DELETE = @-del LNLIST = $(PROJECT).cmd LMC = LMC30 CC = NC30 AR = LB30 UTL = utl30 AS = AS30 LIBFILE = $(PROJECT).lib WLIB = C:\wany\maeva2004\Oxygen\pekeev1\microcontroler\native\libs #a modif OUTDIR = . MKDIR = @-mkdir $(SRCDIR) = C:\Pekee\PekeeV1-microcontroler\TurnAround\build-native\src # a modif WINCLUDE = C:\wany\maeva2004\Oxygen\pekeev1\microcontroler\native\includes # a modif ABSFILE = $(PROJECT).x30 ODINCMD = $(OUTDIR) LN = LN30 TARGET = $(ABSFILE) ECHO = @-echo MKFILE = $(PROJECT).tmk PROJECT = AvoidObstacle TYPE = @-type LFLAGS = -MS -LD $(WLIB) -L libdriveraccu -L libdriverimpact -L libdrivertemperature -L libdriveropp -L libdriverlight -L libDriverIR -L libdrivermotor -L libdriverserial -L libdriverled -L libdriverbuzzer -L kal -L hal -L $(LIB30)\nc30lib -G -O $(OUTDIR)\$(TARGET) UTLFLAGS = CFLAGS = -c -I$(WINCLUDE) -I$(WINCLUDE)\kal0 -dir $(OUTDIR) -finfo LMCFLAGS = -L LIBFLAGS = -C AFLAGS = -LM -finfo -O$(OUTDIR) .SUFFIXES: .a30 .r30 .c .x30 .lib .PHONY: all all: \ $(OUTDIR)\$(TARGET) .PHONY: clean clean: $(DELETE) $(OUTDIR)\$(TARGET) $(DELETE) $(ODINCMD)\$(LNLIST) $(DELETE) $(OUTDIR)\ncrt0.r30 $(DELETE) $(OUTDIR)\main.r30 $(DELETE) $(OUTDIR)\reflex.r30 $(DELETE) $(OUTDIR)\wos.r30 $(ODINCMD)\$(LNLIST): \ .\$(MKFILE) $(ECHO)\$(MRLFLAGS) $(LFLAGS) > $(ODINCMD)\$(LNLIST) $(ECHO)\$(OUTDIR)\ncrt0.r30 >> $(ODINCMD)\$(LNLIST) $(ECHO)\$(OUTDIR)\main.r30 >> $(ODINCMD)\$(LNLIST) $(ECHO)\$(OUTDIR)\reflex.r30 >> $(ODINCMD)\$(LNLIST) $(ECHO)\$(OUTDIR)\wos.r30 >> $(ODINCMD)\$(LNLIST) $(OUTDIR)\$(TARGET): \ $(ODINCMD)\$(LNLIST) \ $(OUTDIR)\ncrt0.r30 \ $(OUTDIR)\main.r30 \ $(OUTDIR)\reflex.r30 \ $(OUTDIR)\wos.r30 $(LN) @$(ODINCMD)\$(LNLIST) lmc30 -ID#00000000000000 $(PROJECT) $(OUTDIR)\main.r30: \ $(SRCDIR)\main.c \ $(SRCDIR)\wos.h \ $(SRCDIR)\Reflex.h \ $(WINCLUDE)\KAL.h \ $(WINCLUDE)\Types.h \ $(WINCLUDE)\ErrorCodes.h \ $(WINCLUDE)\Hal.h \ $(WINCLUDE)\libdriverLED.h \ $(WINCLUDE)\libDriverLEDMessages.h \ $(WINCLUDE)\DriverCommon.h \ $(WINCLUDE)\libdriverSERIAL.h \ $(WINCLUDE)\libDriverSerialMessages.h \ $(WINCLUDE)\libdriverIR.h \ $(WINCLUDE)\libDriverIRMessages.h \ $(WINCLUDE)\libdriverMOTOR.h \ $(WINCLUDE)\libDriverMOTORMessages.h \ $(WINCLUDE)\libdriverOPP.h \ $(WINCLUDE)\libDriverOPPMessages.h \ $(WINCLUDE)\libdriverIMPACT.h \ $(WINCLUDE)\libDriverIMPACTMessages.h \ $(WINCLUDE)\libdriverTEMPERATURE.h \ $(WINCLUDE)\libDriverTemperatureMessages.h \ $(WINCLUDE)\libdriverLIGHT.h \ $(WINCLUDE)\libDriverLIGHTMessages.h \ $(WINCLUDE)\libdriverBUZZER.h \ $(WINCLUDE)\libDriverBUZZERMessages.h \ $(WINCLUDE)\libdriverACCU.h \ $(WINCLUDE)\libDriverAccuMessages.h $(CC) $(MRCFLAGS) $(CFLAGS) $(SRCDIR)\main.c $(OUTDIR)\ncrt0.r30: \ $(WLIB)\ncrt0.a30 \ $(WLIB)\sect30.inc $(AS) $(MRAFLAGS) $(AFLAGS) $(WLIB)\ncrt0.a30 $(OUTDIR)\reflex.r30: \ $(SRCDIR)\reflex.c \ $(SRCDIR)\Reflex.h \ $(SRCDIR)\wos.h \ $(WINCLUDE)\KAL.h \ $(WINCLUDE)\Types.h \ $(WINCLUDE)\ErrorCodes.h \ $(WINCLUDE)\Hal.h \ $(WINCLUDE)\libdriverLED.h \ $(WINCLUDE)\libDriverLEDMessages.h \ $(WINCLUDE)\DriverCommon.h \ $(WINCLUDE)\libdriverSERIAL.h \ $(WINCLUDE)\libDriverSerialMessages.h \ $(WINCLUDE)\libdriverIR.h \ $(WINCLUDE)\libDriverIRMessages.h \ $(WINCLUDE)\libdriverMOTOR.h \ $(WINCLUDE)\libDriverMOTORMessages.h \ $(WINCLUDE)\libdriverOPP.h \ $(WINCLUDE)\libDriverOPPMessages.h \ $(WINCLUDE)\libdriverIMPACT.h \ $(WINCLUDE)\libDriverIMPACTMessages.h \ $(WINCLUDE)\libdriverTEMPERATURE.h \ $(WINCLUDE)\libDriverTemperatureMessages.h \ $(WINCLUDE)\libdriverLIGHT.h \ $(WINCLUDE)\libDriverLIGHTMessages.h \ $(WINCLUDE)\libdriverBUZZER.h \ $(WINCLUDE)\libDriverBUZZERMessages.h \ $(WINCLUDE)\libdriverACCU.h \ $(WINCLUDE)\libDriverAccuMessages.h \ $(WINCLUDE)\VirtualDeviceHALBios.h $(CC) $(MRCFLAGS) $(CFLAGS) $(SRCDIR)\reflex.c #flag1 $(OUTDIR)\wos.r30: \ $(SRCDIR)\wos.c \ $(SRCDIR)\wos.h \ $(WINCLUDE)\KAL.h \ $(WINCLUDE)\Types.h \ $(WINCLUDE)\ErrorCodes.h \ $(WINCLUDE)\Hal.h \ $(WINCLUDE)\libdriverLED.h \ $(WINCLUDE)\libDriverLEDMessages.h \ $(WINCLUDE)\DriverCommon.h \ $(WINCLUDE)\libdriverSERIAL.h \ $(WINCLUDE)\libDriverSerialMessages.h \ $(WINCLUDE)\libdriverIR.h \ $(WINCLUDE)\libDriverIRMessages.h \ $(WINCLUDE)\libdriverMOTOR.h \ $(WINCLUDE)\libDriverMOTORMessages.h \ $(WINCLUDE)\libdriverOPP.h \ $(WINCLUDE)\libDriverOPPMessages.h \ $(WINCLUDE)\libdriverIMPACT.h \ $(WINCLUDE)\libDriverIMPACTMessages.h \ $(WINCLUDE)\libdriverTEMPERATURE.h \ $(WINCLUDE)\libDriverTemperatureMessages.h \ $(WINCLUDE)\libdriverLIGHT.h \ $(WINCLUDE)\libDriverLIGHTMessages.h \ $(WINCLUDE)\libdriverBUZZER.h \ $(WINCLUDE)\libDriverBUZZERMessages.h \ $(WINCLUDE)\libdriverACCU.h \ $(WINCLUDE)\libDriverAccuMessages.h $(CC) $(MRCFLAGS) $(CFLAGS) $(SRCDIR)\wos.c #flag2 #################################################################### # End of makefile for TM V.3.20A # COPYRIGHT(C) 1998(1998-2003) # RENESAS TECHNOLOGY CORPORATION ALL RIGHTS RESERVED # AND # RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED ####################################################################
Je scan le .dsp , je vois que le monsieur a fait une nouvelle source "toto.c"
Bas je voudrait rajouter a la suite du makefile le bloc suivant :
sauf que dans les dépendance il faut que je rajoute les .h du monsieur, donc dans un premier temps je me prend pas la tête je les mais tous a chaque fois même si la source ne l'inclue pas !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 $(OUTDIR)\toto.r30: \ $(SRCDIR)\toto.c \ $(WINCLUDE)\KAL.h \ $(WINCLUDE)\Types.h \ $(WINCLUDE)\ErrorCodes.h \ $(WINCLUDE)\Hal.h \ $(WINCLUDE)\libdriverLED.h \ $(WINCLUDE)\libDriverLEDMessages.h \ $(WINCLUDE)\DriverCommon.h \ $(WINCLUDE)\libdriverSERIAL.h \ $(WINCLUDE)\libDriverSerialMessages.h \ $(WINCLUDE)\libdriverIR.h \ $(WINCLUDE)\libDriverIRMessages.h \ $(WINCLUDE)\libdriverMOTOR.h \ $(WINCLUDE)\libDriverMOTORMessages.h \ $(WINCLUDE)\libdriverOPP.h \ $(WINCLUDE)\libDriverOPPMessages.h \ $(WINCLUDE)\libdriverIMPACT.h \ $(WINCLUDE)\libDriverIMPACTMessages.h \ $(WINCLUDE)\libdriverTEMPERATURE.h \ $(WINCLUDE)\libDriverTemperatureMessages.h \ $(WINCLUDE)\libdriverLIGHT.h \ $(WINCLUDE)\libDriverLIGHTMessages.h \ $(WINCLUDE)\libdriverBUZZER.h \ $(WINCLUDE)\libDriverBUZZERMessages.h \ $(WINCLUDE)\libdriverACCU.h \ $(WINCLUDE)\libDriverAccuMessages.h \ $(WINCLUDE)\VirtualDeviceHALBios.h $(CC) $(MRCFLAGS) $(CFLAGS) $(SRCDIR)\toto.c
D'où le faites que je veuille faire deux buffer différent, un pour les .c et un pour les .h .
Deux questions :
-Pensez vous que c'est une bonne idée, sinon comment devrais-je m'y prendre ?
-Si vous avez pas compris je peux essayer de détaillé plus ?
Je suis preneur de tout conseil !
Je remercie tout ce qui sont arrivé a ce stade de lecture ^^ , mais comprenez pour moi c'est pas facile de l'expliquer par écrit -_-
Sur ceux bonne nuit et merci beaucoup de m'aider .
Partager