root / UFindRec.pas
Historique | Voir | Annoter | Télécharger (12,453 ko)
1 | 3 | avalancogn | unit UFindRec;
|
---|---|---|---|
2 | |||
3 | interface
|
||
4 | |||
5 | function FindNumMatiere(Nom: string): integer; |
||
6 | function FindNomMatiere(Num: integer): string; |
||
7 | function FindIdxMatiere(Nom: string): integer; |
||
8 | function FindNumAliment(Nom: string): integer; |
||
9 | function FindNomAliment(Num: integer): string; |
||
10 | function FindIdxAliment(Nom: string): integer; |
||
11 | function FindNumSeqAliT(Nom: string): integer; |
||
12 | function FindNomSeqAliT(Num: integer): string; |
||
13 | function FindIdxSeqAliT(Nom: string): integer; |
||
14 | function FindNumRationT(Nom: string): integer; |
||
15 | function FindNomRationT(Num: integer): string; |
||
16 | function FindIdxRationT(Nom: string): integer; |
||
17 | function FindNumLogeT(Nom: string): integer; |
||
18 | function FindNomLogeT(Num: integer): string; |
||
19 | function FindIdxLogeT(Nom: string): integer; |
||
20 | function FindNumProfilT(Nom: string): integer; |
||
21 | function FindNomProfilT(Num: integer): string; |
||
22 | function FindIdxProfilT(Nom: string): integer; |
||
23 | function FindNumSimulT(Nom: string): integer; |
||
24 | function FindNomSimulT(Num: integer): string; |
||
25 | function FindIdxSimulT(Nom: string): integer; |
||
26 | function FindNumSeqAliP(Nom: string): integer; |
||
27 | function FindNomSeqAliP(Num: integer): string; |
||
28 | function FindIdxSeqAliP(Nom: string): integer; |
||
29 | function FindNumRationP(Nom: string): integer; |
||
30 | function FindNomRationP(Num: integer): string; |
||
31 | function FindIdxRationP(Nom: string): integer; |
||
32 | function FindNumProfilP(Nom: string): integer; |
||
33 | function FindNomProfilP(Num: integer): string; |
||
34 | function FindIdxProfilP(Nom: string): integer; |
||
35 | function FindNumSimulP(Nom: string): integer; |
||
36 | function FindNomSimulP(Num: integer): string; |
||
37 | function FindIdxSimulP(Nom: string): integer; |
||
38 | |||
39 | implementation
|
||
40 | |||
41 | uses
|
||
42 | gnugettext, UVariables; |
||
43 | |||
44 | // Renvoie le num?ro de la mati?re premi?re ? partir de son nom
|
||
45 | function FindNumMatiere(Nom: string): integer; |
||
46 | var
|
||
47 | i: integer; |
||
48 | ok: boolean; |
||
49 | begin
|
||
50 | i := -1;
|
||
51 | repeat
|
||
52 | Inc(i); |
||
53 | PMatiere := ListMatiere[i]; |
||
54 | if PMatiere.Num > 0 then // Mati?re premi?re utilisateur |
||
55 | ok := PMatiere.Nom = Nom |
||
56 | else // Mati?re premi?re INRA-AFZ (traduction) |
||
57 | ok := dgettext('InraAfz', PMatiere.Nom) = Nom;
|
||
58 | until ok;
|
||
59 | Result := PMatiere.Num; |
||
60 | end;
|
||
61 | |||
62 | // Renvoie le nom de la mati?re premi?re ? partir de son num?ro
|
||
63 | function FindNomMatiere(Num: integer): string; |
||
64 | var
|
||
65 | i: integer; |
||
66 | begin
|
||
67 | i := -1;
|
||
68 | repeat
|
||
69 | Inc(i); |
||
70 | PMatiere := ListMatiere[i]; |
||
71 | until PMatiere.Num = Num;
|
||
72 | if Num > 0 then // Mati?re premi?re utilisateur |
||
73 | Result := PMatiere.Nom |
||
74 | else // Mati?re premi?re INRA-AFZ (traduction) |
||
75 | Result := dgettext('InraAfz', PMatiere.Nom);
|
||
76 | end;
|
||
77 | |||
78 | // Renvoie l'index de la mati?re premi?re ? partir de son nom
|
||
79 | function FindIdxMatiere(Nom: string): integer; |
||
80 | var
|
||
81 | i: integer; |
||
82 | ok: boolean; |
||
83 | begin
|
||
84 | ok := True; |
||
85 | i := 0;
|
||
86 | while ok and (i < ListMatiere.Count) do |
||
87 | begin
|
||
88 | PMatiere := ListMatiere[i]; |
||
89 | if PMatiere.Num > 0 then // Mati?re premi?re utilisateur |
||
90 | if PMatiere.Nom = Nom then |
||
91 | ok := False |
||
92 | else
|
||
93 | Inc(i) |
||
94 | else // Mati?re premi?re INRA-AFZ (traduction) |
||
95 | if dgettext('InraAfz', PMatiere.Nom) = Nom then |
||
96 | ok := False |
||
97 | else
|
||
98 | Inc(i); |
||
99 | end;
|
||
100 | if ok then |
||
101 | Result := -1
|
||
102 | else
|
||
103 | Result := i; |
||
104 | end;
|
||
105 | |||
106 | // Renvoie le num?ro de l'aliment ? partir de son nom
|
||
107 | function FindNumAliment(Nom: string): integer; |
||
108 | var
|
||
109 | i: integer; |
||
110 | begin
|
||
111 | i := -1;
|
||
112 | repeat
|
||
113 | Inc(i); |
||
114 | PAliment := ListAliment[i]; |
||
115 | until PAliment.Nom = Nom;
|
||
116 | Result := PAliment.Num; |
||
117 | end;
|
||
118 | |||
119 | // Renvoie le nom de l'aliment ? partir de son num?ro
|
||
120 | function FindNomAliment(Num: integer): string; |
||
121 | var
|
||
122 | i: integer; |
||
123 | begin
|
||
124 | i := -1;
|
||
125 | repeat
|
||
126 | Inc(i); |
||
127 | PAliment := ListAliment[i]; |
||
128 | until PAliment.Num = Num;
|
||
129 | Result := PAliment.Nom; |
||
130 | end;
|
||
131 | |||
132 | // Renvoie l'index de l'aliment ? partir de son nom
|
||
133 | function FindIdxAliment(Nom: string): integer; |
||
134 | var
|
||
135 | i: integer; |
||
136 | ok: boolean; |
||
137 | begin
|
||
138 | ok := True; |
||
139 | i := 0;
|
||
140 | while ok and (i < ListAliment.Count) do |
||
141 | begin
|
||
142 | PAliment := ListAliment[i]; |
||
143 | if PAliment.Nom = Nom then |
||
144 | ok := False |
||
145 | else
|
||
146 | Inc(i); |
||
147 | end;
|
||
148 | if ok then |
||
149 | Result := -1
|
||
150 | else
|
||
151 | Result := i; |
||
152 | end;
|
||
153 | |||
154 | // Renvoie le num?ro de la s?quence alimentaire truie ? partir de son nom
|
||
155 | function FindNumSeqAliT(Nom: string): integer; |
||
156 | var
|
||
157 | i: integer; |
||
158 | begin
|
||
159 | i := -1;
|
||
160 | repeat
|
||
161 | Inc(i); |
||
162 | PSeqAliT := ListSeqAliT[i]; |
||
163 | until PSeqAliT.Nom = Nom;
|
||
164 | Result := PSeqAliT.Num; |
||
165 | end;
|
||
166 | |||
167 | // Renvoie le nom de la s?quence alimentaire truie ? partir de son num?ro
|
||
168 | function FindNomSeqAliT(Num: integer): string; |
||
169 | var
|
||
170 | i: integer; |
||
171 | begin
|
||
172 | i := -1;
|
||
173 | repeat
|
||
174 | Inc(i); |
||
175 | PSeqAliT := ListSeqAliT[i]; |
||
176 | until PSeqAliT.Num = Num;
|
||
177 | Result := PSeqAliT.Nom; |
||
178 | end;
|
||
179 | |||
180 | // Renvoie l'index de la s?quence alimentaire truie ? partir de son nom
|
||
181 | function FindIdxSeqAliT(Nom: string): integer; |
||
182 | var
|
||
183 | i: integer; |
||
184 | ok: boolean; |
||
185 | begin
|
||
186 | ok := True; |
||
187 | i := 0;
|
||
188 | while ok and (i < ListSeqAliT.Count) do |
||
189 | begin
|
||
190 | PSeqAliT := ListSeqAliT[i]; |
||
191 | if PSeqAliT.Nom = Nom then |
||
192 | ok := False |
||
193 | else
|
||
194 | Inc(i); |
||
195 | end;
|
||
196 | if ok then |
||
197 | Result := -1
|
||
198 | else
|
||
199 | Result := i; |
||
200 | end;
|
||
201 | |||
202 | // Renvoie le num?ro du plan de rationnement truie ? partir de son nom
|
||
203 | function FindNumRationT(Nom: string): integer; |
||
204 | var
|
||
205 | i: integer; |
||
206 | begin
|
||
207 | i := -1;
|
||
208 | repeat
|
||
209 | Inc(i); |
||
210 | PRationT := ListRationT[i]; |
||
211 | until PRationT.Nom = Nom;
|
||
212 | Result := PRationT.Num; |
||
213 | end;
|
||
214 | |||
215 | // Renvoie le nom du plan de rationnement truie ? partir de son num?ro
|
||
216 | function FindNomRationT(Num: integer): string; |
||
217 | var
|
||
218 | i: integer; |
||
219 | begin
|
||
220 | i := -1;
|
||
221 | repeat
|
||
222 | Inc(i); |
||
223 | PRationT := ListRationT[i]; |
||
224 | until PRationT.Num = Num;
|
||
225 | Result := PRationT.Nom; |
||
226 | end;
|
||
227 | |||
228 | // Renvoie l'index du plan de rationnement truie ? partir de son nom
|
||
229 | function FindIdxRationT(Nom: string): integer; |
||
230 | var
|
||
231 | i: integer; |
||
232 | ok: boolean; |
||
233 | begin
|
||
234 | ok := True; |
||
235 | i := 0;
|
||
236 | while ok and (i < ListRationT.Count) do |
||
237 | begin
|
||
238 | PRationT := ListRationT[i]; |
||
239 | if PRationT.Nom = Nom then |
||
240 | ok := False |
||
241 | else
|
||
242 | Inc(i); |
||
243 | end;
|
||
244 | if ok then |
||
245 | Result := -1
|
||
246 | else
|
||
247 | Result := i; |
||
248 | end;
|
||
249 | |||
250 | // Renvoie le num?ro du logement truie ? partir de son nom
|
||
251 | function FindNumLogeT(Nom: string): integer; |
||
252 | var
|
||
253 | i: integer; |
||
254 | begin
|
||
255 | i := -1;
|
||
256 | repeat
|
||
257 | Inc(i); |
||
258 | PLogeT := ListLogeT[i]; |
||
259 | until PLogeT.Nom = Nom;
|
||
260 | Result := PLogeT.Num; |
||
261 | end;
|
||
262 | |||
263 | // Renvoie le nom du logement truie ? partir de son num?ro
|
||
264 | function FindNomLogeT(Num: integer): string; |
||
265 | var
|
||
266 | i: integer; |
||
267 | begin
|
||
268 | i := -1;
|
||
269 | repeat
|
||
270 | Inc(i); |
||
271 | PLogeT := ListLogeT[i]; |
||
272 | until PLogeT.Num = Num;
|
||
273 | Result := PLogeT.Nom; |
||
274 | end;
|
||
275 | |||
276 | // Renvoie l'index de lu logement truie ? partir de son nom
|
||
277 | function FindIdxLogeT(Nom: string): integer; |
||
278 | var
|
||
279 | i: integer; |
||
280 | ok: boolean; |
||
281 | begin
|
||
282 | ok := True; |
||
283 | i := 0;
|
||
284 | while ok and (i < ListLogeT.Count) do |
||
285 | begin
|
||
286 | PLogeT := ListLogeT[i]; |
||
287 | if PLogeT.Nom = Nom then |
||
288 | ok := False |
||
289 | else
|
||
290 | Inc(i); |
||
291 | end;
|
||
292 | if ok then |
||
293 | Result := -1
|
||
294 | else
|
||
295 | Result := i; |
||
296 | end;
|
||
297 | |||
298 | // Renvoie le num?ro du profil truie ? partir de son nom
|
||
299 | function FindNumProfilT(Nom: string): integer; |
||
300 | var
|
||
301 | i: integer; |
||
302 | begin
|
||
303 | i := -1;
|
||
304 | repeat
|
||
305 | Inc(i); |
||
306 | PProfilT := ListProfilT[i]; |
||
307 | until PProfilT.Nom = Nom;
|
||
308 | Result := PProfilT.Num; |
||
309 | end;
|
||
310 | |||
311 | // Renvoie le nom du profil truie ? partir de son num?ro
|
||
312 | function FindNomProfilT(Num: integer): string; |
||
313 | var
|
||
314 | i: integer; |
||
315 | begin
|
||
316 | i := -1;
|
||
317 | repeat
|
||
318 | Inc(i); |
||
319 | PProfilT := ListProfilT[i]; |
||
320 | until PProfilT.Num = Num;
|
||
321 | Result := PProfilT.Nom; |
||
322 | end;
|
||
323 | |||
324 | // Renvoie l'index du profil truie ? partir de son nom
|
||
325 | function FindIdxProfilT(Nom: string): integer; |
||
326 | var
|
||
327 | i: integer; |
||
328 | ok: boolean; |
||
329 | begin
|
||
330 | ok := True; |
||
331 | i := 0;
|
||
332 | while ok and (i < ListProfilT.Count) do |
||
333 | begin
|
||
334 | PProfilT := ListProfilT[i]; |
||
335 | if PProfilT.Nom = Nom then |
||
336 | ok := False |
||
337 | else
|
||
338 | Inc(i); |
||
339 | end;
|
||
340 | if ok then |
||
341 | Result := -1
|
||
342 | else
|
||
343 | Result := i; |
||
344 | end;
|
||
345 | |||
346 | // Renvoie le num?ro de la simulation truie ? partir de son nom
|
||
347 | function FindNumSimulT(Nom: string): integer; |
||
348 | var
|
||
349 | i: integer; |
||
350 | begin
|
||
351 | i := -1;
|
||
352 | repeat
|
||
353 | Inc(i); |
||
354 | PSimulT := ListSimulT[i]; |
||
355 | until PSimulT.Nom = Nom;
|
||
356 | Result := PSimulT.Num; |
||
357 | end;
|
||
358 | |||
359 | // Renvoie le nom de la simulation truie ? partir de son num?ro
|
||
360 | function FindNomSimulT(Num: integer): string; |
||
361 | var
|
||
362 | i: integer; |
||
363 | begin
|
||
364 | i := -1;
|
||
365 | repeat
|
||
366 | Inc(i); |
||
367 | PSimulT := ListSimulT[i]; |
||
368 | until PSimulT.Num = Num;
|
||
369 | Result := PSimulT.Nom; |
||
370 | end;
|
||
371 | |||
372 | // Renvoie l'index de la simulation truie ? partir de son nom
|
||
373 | function FindIdxSimulT(Nom: string): integer; |
||
374 | var
|
||
375 | i: integer; |
||
376 | ok: boolean; |
||
377 | begin
|
||
378 | ok := True; |
||
379 | i := 0;
|
||
380 | while ok and (i < ListSimulT.Count) do |
||
381 | begin
|
||
382 | PSimulT := ListSimulT[i]; |
||
383 | if PSimulT.Nom = Nom then |
||
384 | ok := False |
||
385 | else
|
||
386 | Inc(i); |
||
387 | end;
|
||
388 | if ok then |
||
389 | Result := -1
|
||
390 | else
|
||
391 | Result := i; |
||
392 | end;
|
||
393 | |||
394 | // Renvoie le num?ro de la s?quence alimentaire porc ? partir de son nom
|
||
395 | function FindNumSeqAliP(Nom: string): integer; |
||
396 | var
|
||
397 | i: integer; |
||
398 | begin
|
||
399 | i := -1;
|
||
400 | repeat
|
||
401 | Inc(i); |
||
402 | PSeqAliP := ListSeqAliP[i]; |
||
403 | until PSeqAliP.Nom = Nom;
|
||
404 | Result := PSeqAliP.Num; |
||
405 | end;
|
||
406 | |||
407 | // Renvoie le nom de la s?quence alimentaire porc ? partir de son num?ro
|
||
408 | function FindNomSeqAliP(Num: integer): string; |
||
409 | var
|
||
410 | i: integer; |
||
411 | begin
|
||
412 | i := -1;
|
||
413 | repeat
|
||
414 | Inc(i); |
||
415 | PSeqAliP := ListSeqAliP[i]; |
||
416 | until PSeqAliP.Num = Num;
|
||
417 | Result := PSeqAliP.Nom; |
||
418 | end;
|
||
419 | |||
420 | // Renvoie l'index de la s?quence alimentaire porc ? partir de son nom
|
||
421 | function FindIdxSeqAliP(Nom: string): integer; |
||
422 | var
|
||
423 | i: integer; |
||
424 | ok: boolean; |
||
425 | begin
|
||
426 | ok := True; |
||
427 | i := 0;
|
||
428 | while ok and (i < ListSeqAliP.Count) do |
||
429 | begin
|
||
430 | PSeqAliP := ListSeqAliP[i]; |
||
431 | if PSeqAliP.Nom = Nom then |
||
432 | ok := False |
||
433 | else
|
||
434 | Inc(i); |
||
435 | end;
|
||
436 | if ok then |
||
437 | Result := -1
|
||
438 | else
|
||
439 | Result := i; |
||
440 | end;
|
||
441 | |||
442 | // Renvoie le num?ro du plan de rationnement porc ? partir de son nom
|
||
443 | function FindNumRationP(Nom: string): integer; |
||
444 | var
|
||
445 | i: integer; |
||
446 | begin
|
||
447 | i := -1;
|
||
448 | repeat
|
||
449 | Inc(i); |
||
450 | PRationP := ListRationP[i]; |
||
451 | until PRationP.Nom = Nom;
|
||
452 | Result := PRationP.Num; |
||
453 | end;
|
||
454 | |||
455 | // Renvoie le nom du plan de rationnement porc ? partir de son num?ro
|
||
456 | function FindNomRationP(Num: integer): string; |
||
457 | var
|
||
458 | i: integer; |
||
459 | begin
|
||
460 | i := -1;
|
||
461 | repeat
|
||
462 | Inc(i); |
||
463 | PRationP := ListRationP[i]; |
||
464 | until PRationP.Num = Num;
|
||
465 | Result := PRationP.Nom; |
||
466 | end;
|
||
467 | |||
468 | // Renvoie l'index du plan de rationnement porc ? partir de son nom
|
||
469 | function FindIdxRationP(Nom: string): integer; |
||
470 | var
|
||
471 | i: integer; |
||
472 | ok: boolean; |
||
473 | begin
|
||
474 | ok := True; |
||
475 | i := 0;
|
||
476 | while ok and (i < ListRationP.Count) do |
||
477 | begin
|
||
478 | PRationP := ListRationP[i]; |
||
479 | if PRationP.Nom = Nom then |
||
480 | ok := False |
||
481 | else
|
||
482 | Inc(i); |
||
483 | end;
|
||
484 | if ok then |
||
485 | Result := -1
|
||
486 | else
|
||
487 | Result := i; |
||
488 | end;
|
||
489 | |||
490 | // Renvoie le num?ro du profil porc ? partir de son nom
|
||
491 | function FindNumProfilP(Nom: string): integer; |
||
492 | var
|
||
493 | i: integer; |
||
494 | begin
|
||
495 | i := -1;
|
||
496 | repeat
|
||
497 | Inc(i); |
||
498 | PProfilP := ListProfilP[i]; |
||
499 | until PProfilP.Nom = Nom;
|
||
500 | Result := PProfilP.Num; |
||
501 | end;
|
||
502 | |||
503 | // Renvoie le nom du profil porc ? partir de son num?ro
|
||
504 | function FindNomProfilP(Num: integer): string; |
||
505 | var
|
||
506 | i: integer; |
||
507 | begin
|
||
508 | i := -1;
|
||
509 | repeat
|
||
510 | Inc(i); |
||
511 | PProfilP := ListProfilP[i]; |
||
512 | until PProfilP.Num = Num;
|
||
513 | Result := PProfilP.Nom; |
||
514 | end;
|
||
515 | |||
516 | // Renvoie l'index du profil porc ? partir de son nom
|
||
517 | function FindIdxProfilP(Nom: string): integer; |
||
518 | var
|
||
519 | i: integer; |
||
520 | ok: boolean; |
||
521 | begin
|
||
522 | ok := True; |
||
523 | i := 0;
|
||
524 | while ok and (i < ListProfilP.Count) do |
||
525 | begin
|
||
526 | PProfilP := ListProfilP[i]; |
||
527 | if PProfilP.Nom = Nom then |
||
528 | ok := False |
||
529 | else
|
||
530 | Inc(i); |
||
531 | end;
|
||
532 | if ok then |
||
533 | Result := -1
|
||
534 | else
|
||
535 | Result := i; |
||
536 | end;
|
||
537 | |||
538 | // Renvoie le num?ro de la simulation porc ? partir de son nom
|
||
539 | function FindNumSimulP(Nom: string): integer; |
||
540 | var
|
||
541 | i: integer; |
||
542 | begin
|
||
543 | i := -1;
|
||
544 | repeat
|
||
545 | Inc(i); |
||
546 | PSimulP := ListSimulP[i]; |
||
547 | until PSimulP.Nom = Nom;
|
||
548 | Result := PSimulP.Num; |
||
549 | end;
|
||
550 | |||
551 | // Renvoie le nom de la simulation porc ? partir de son num?ro
|
||
552 | function FindNomSimulP(Num: integer): string; |
||
553 | var
|
||
554 | i: integer; |
||
555 | begin
|
||
556 | i := -1;
|
||
557 | repeat
|
||
558 | Inc(i); |
||
559 | PSimulP := ListSimulP[i]; |
||
560 | until PSimulP.Num = Num;
|
||
561 | Result := PSimulP.Nom; |
||
562 | end;
|
||
563 | |||
564 | // Renvoie l'index de la simulation porc ? partir de son nom
|
||
565 | function FindIdxSimulP(Nom: string): integer; |
||
566 | var
|
||
567 | i: integer; |
||
568 | ok: boolean; |
||
569 | begin
|
||
570 | ok := True; |
||
571 | i := 0;
|
||
572 | while ok and (i < ListSimulP.Count) do |
||
573 | begin
|
||
574 | PSimulP := ListSimulP[i]; |
||
575 | if PSimulP.Nom = Nom then |
||
576 | ok := False |
||
577 | else
|
||
578 | Inc(i); |
||
579 | end;
|
||
580 | if ok then |
||
581 | Result := -1
|
||
582 | else
|
||
583 | Result := i; |
||
584 | end;
|
||
585 | |||
586 | end. |