trainsched-commit Mailing List for Train Scheduler for Palm Pilot
Brought to you by:
philm
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(19) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: Philippe M. <ph...@us...> - 2009-05-17 15:29:27
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32682 Modified Files: README Log Message: update README for 1.0 release Index: README =================================================================== RCS file: /cvsroot/trainsched/trainsched/README,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README 15 May 2004 18:30:48 -0000 1.5 --- README 17 May 2009 15:29:24 -0000 1.6 *************** *** 12,30 **** More info at http://trainsched.sourceforge.net ! COMPILING NOTES ! =============== ! You need to uncompress the palmresize source code in a palmresize subdirectory. ! You can get it from http://palmresize.sourceforge.net. ! ! You should get the Sony SDK and the Handera SDK. ! The Handera SDK is no longer available on their website, I got it from the ! non-free section in the source code of of PalmBible+ at ! http://palmbibleplus.sf.net ! The Sony SDK needs to be patched, there is a perl script to do it at ! http://yakko.cs.wmich.edu/~rattles/development/pda/ ! ! Verify that all the .h files in the Sony and Handera SDK are Unix text files ! and not DOS text files when compiling under Linux. Philippe Marzouk ph...@us... --- 12,38 ---- More info at http://trainsched.sourceforge.net ! What's New in version 1.0 ? ! * merge changes from Steve Martin ! - Merge changes from Damien Carbury to support an annotations column ! - Issues Resolved: ! Fixed Memory leak from Select table (Memory allocated in LoadSelTable was not always freed when form closed. ! Fixed Form life-cycle issues (Emulator reported re-initialisation of forms). ! Event Handling Cleanup ! Main form table cleanup if new Timetable selected. ! Fixed scrollbars on both forms. ! - Enhancements Made: ! Alternate background colours used on table rows (Coour Models). ! Page Up / Page Down buttons implemented on Select Timetable Form. ! Minor GUI improvements (e.g. use of "Timetable" instead of "Database") ! - Code organisation ! Organize functions in several files ! * Remove DIA support for the moment + Authors: Philippe Marzouk ph...@us... + + Steve Martin + sma...@us... + + with contributions from Damien Carbury for the initial support for abbreviations. |
|
From: Philippe M. <ph...@us...> - 2009-05-17 15:24:23
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32079 Modified Files: Makefile README Added Files: CheltGlos94.csv Log Message: add example file with abbreviations update Makefile update README for 1.0 release Index: README =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 14 Apr 2002 15:29:21 -0000 1.4 --- README 17 May 2009 15:24:16 -0000 1.5 *************** *** 5,8 **** --- 5,13 ---- It is covered by the GNU Public License Version 2 or above + What's New? + Version 1.0 brings support for a new CSV format allowing to add abbreviations + and accompanying notes. + Compatibility with the old format without abbreviations is retained. + Usage: csv2trainschedpdb <source> <dest> <PDB Name> *************** *** 11,24 **** file and PDB Name is the name you'll see on you Palm. ! example : csv2trainschedpdb breteche.csv breteche.pdb "Paris-St Nom la Breteche" ! To compile : ! - under Linux : type 'make' - under Windows, it was tested under Cygwin, so you need cygwin installed to compile it out of the box. ! An example CSV is included, it is called breteche.csv. Philippe Marzouk ph...@us... --- 16,35 ---- file and PDB Name is the name you'll see on you Palm. ! example: csv2trainschedpdb breteche.csv breteche.pdb "Paris-St Nom la Breteche" ! To compile: ! - under Linux: type 'make' - under Windows, it was tested under Cygwin, so you need cygwin installed to compile it out of the box. ! Two example CSV files are included: ! - breteche.csv without abbreviations ! - CheltGlos94.csv with abbreviations + Authors: Philippe Marzouk ph...@us... + + Steve Martin + sma...@us... Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 16 May 2009 08:07:45 -0000 1.5 --- Makefile 17 May 2009 15:24:16 -0000 1.6 *************** *** 5,9 **** CC=gcc ! CFLAGS=-g -Wall COPT=-g -Wall --- 5,12 ---- CC=gcc ! # for Linux ! #CFLAGS=-g -Wall ! # for Windows and Cygwin ! CFLAGS=-g -Wall -mno-cygwin COPT=-g -Wall *************** *** 29,38 **** rm -rf $(PROGRAM)-src-$(VERS) mkdir $(PROGRAM)-src-$(VERS) ! cp -a $(SOURCES) csvformat.txt breteche.csv Makefile LICENSE README $(PROGRAM)-src-$(VERS) zip -r9 ../$(PROGRAM)-src-$(VERS).zip $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) ! cp -a $(PROGRAM).exe csvformat.txt breteche.csv breteche.pdb LICENSE README $(PROGRAM)-win-$(VERS) zip -r9 ../$(PROGRAM)-win-$(VERS).zip $(PROGRAM)-win-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) --- 32,41 ---- rm -rf $(PROGRAM)-src-$(VERS) mkdir $(PROGRAM)-src-$(VERS) ! cp -a $(SOURCES) csvformat.txt breteche.csv CheltGlos94.csv Makefile LICENSE README $(PROGRAM)-src-$(VERS) zip -r9 ../$(PROGRAM)-src-$(VERS).zip $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) ! cp -a $(PROGRAM).exe csvformat.txt breteche.csv breteche.pdb CheltGlos94.csv LICENSE README $(PROGRAM)-win-$(VERS) zip -r9 ../$(PROGRAM)-win-$(VERS).zip $(PROGRAM)-win-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) *************** *** 42,51 **** rm -rf $(PROGRAM)-src-$(VERS) mkdir $(PROGRAM)-src-$(VERS) ! cp -a $(SOURCES) csvformat.txt breteche.csv Makefile LICENSE README $(PROGRAM)-src-$(VERS) tar cvzf ../$(PROGRAM)-src-$(VERS).tar.gz $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-linux-$(VERS) mkdir $(PROGRAM)-linux-$(VERS) ! cp -a $(PROGRAM) csvformat.txt breteche.csv breteche.pdb LICENSE README $(PROGRAM)-linux-$(VERS) tar cvzf ../$(PROGRAM)-linux-$(VERS).tar.gz $(PROGRAM)-linux-$(VERS) rm -rf $(PROGRAM)-linux-$(VERS) --- 45,54 ---- rm -rf $(PROGRAM)-src-$(VERS) mkdir $(PROGRAM)-src-$(VERS) ! cp -a $(SOURCES) csvformat.txt breteche.csv CheltGlos94.csv Makefile LICENSE README $(PROGRAM)-src-$(VERS) tar cvzf ../$(PROGRAM)-src-$(VERS).tar.gz $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-linux-$(VERS) mkdir $(PROGRAM)-linux-$(VERS) ! cp -a $(PROGRAM) csvformat.txt breteche.csv breteche.pdb CheltGlos94.csv LICENSE README $(PROGRAM)-linux-$(VERS) tar cvzf ../$(PROGRAM)-linux-$(VERS).tar.gz $(PROGRAM)-linux-$(VERS) rm -rf $(PROGRAM)-linux-$(VERS) --- NEW FILE: CheltGlos94.csv --- Cheltenham Promenade GCHQ Benhall Glos Rd Churchdown Hare&Hnds Longlevens Elmbr. Rd Gloucester Mkt Pde Mon-Fri Saturday Sunday 7 75 107 139 190 222 NLF * ** Non Low-floor Bus Every 10 Mins Every 20 Mins Intermediate stops are not listed in this timetable.||A frequent service operates during the main daytime period, Monday to Saturday; extra journeys may operate and times may vary.||Reduced service on Good Friday. Sunday service on Bank Holiday Mondays. Please enquire about arrangements for the Christmas - New Year Period.||Please call us on 0871 200 22 33. 06:05 0 06:11 0 06:18 0 06:22 0 06:30 0 06:20 0 06:26 0 06:33 0 06:37 0 06:45 0 06:25 0 06:31 0 06:38 0 06:43 0 06:55 0 06:35 0 06:41 0 06:48 0 06:53 0 07:05 0 06:45 0 06:51 0 06:58 0 07:03 0 07:15 0 06:52 0 06:59 0 07:07 0 07:12 0 07:25 0 07:00 0 07:08 0 07:18 0 07:25 0 07:35 0 07:08 0 07:16 0 07:24 0 07:33 0 07:45 0 07:15 0 07:24 0 07:34 0 07:44 0 07:55 0 07:22 0 07:30 0 07:40 0 07:50 0 08:05 0 07:30 0 07:39 0 07:51 0 08:01 0 08:15 0 07:35 0 07:44 0 07:56 0 08:07 0 08:25 0 07:40 0 07:49 0 08:02 0 08:15 0 08:35 0 07:50 0 07:59 0 08:12 0 08:25 0 08:45 0 08:00 0 08:09 0 08:22 0 08:35 0 08:55 0 08:15 0 08:24 0 08:37 0 08:50 0 09:10 0 08:35 0 08:44 0 08:56 0 09:06 0 09:20 0 08:50 0 08:59 0 09:09 0 09:19 0 09:30 0 09:00 0 09:08 0 09:18 0 09:25 0 09:35 0 09:10 0 09:18 0 09:28 0 09:35 0 09:45 0 09:20 0 09:28 0 09:38 0 09:45 0 09:55 0 09:30 0 09:38 0 09:48 0 09:55 0 10:05 0 09:40 0 09:48 0 09:58 0 10:05 0 10:15 0 ##:50 2 ##:59 2 ##:09 2 ##:19 2 ##:30 2 ##:00 2 ##:08 2 ##:18 2 ##:25 2 ##:35 2 ##:10 2 ##:18 2 ##:28 2 ##:35 2 ##:45 2 ##:20 2 ##:28 2 ##:38 2 ##:45 2 ##:55 2 ##:30 2 ##:38 2 ##:48 2 ##:55 2 ##:05 2 ##:40 2 ##:48 2 ##:58 2 ##:05 2 ##:15 2 13:50 0 13:58 0 14:08 0 14:15 0 14:25 0 14:00 0 14:08 0 14:18 0 14:25 0 14:35 0 14:10 0 14:18 0 14:28 0 14:35 0 14:45 0 14:20 0 14:28 0 14:38 0 14:45 0 14:55 0 14:30 0 14:38 0 14:48 0 14:55 0 15:05 0 14:40 0 14:49 0 14:59 0 15:09 0 15:20 0 14:50 0 14:59 0 15:09 0 15:19 0 15:30 0 15:00 0 15:09 0 15:19 0 15:29 0 15:40 0 15:05 0 15:14 0 15:24 0 15:33 0 15:45 0 15:10 0 15:19 0 15:31 0 15:41 0 15:55 0 15:20 0 15:29 0 15:41 0 15:51 0 16:05 0 15:30 0 15:39 0 15:51 0 16:01 0 16:15 0 15:40 0 15:49 0 16:01 0 16:11 0 16:25 0 15:55 0 16:04 0 16:16 0 16:26 0 16:40 0 16:10 0 16:19 0 16:29 0 16:39 0 16:50 0 16:20 0 16:29 0 16:39 0 16:49 0 17:00 0 16:30 0 16:39 0 16:49 0 16:59 0 17:10 0 16:40 0 16:49 0 16:59 0 17:09 0 17:20 0 16:50 0 16:59 0 17:09 0 17:19 0 17:30 0 17:00 0 17:09 0 17:19 0 17:29 0 17:40 0 17:10 0 17:19 0 17:29 0 17:39 0 17:50 0 17:20 0 17:29 0 17:39 0 17:49 0 18:00 0 17:30 0 17:39 0 17:49 0 17:59 0 18:10 0 17:40 0 17:49 0 17:59 0 18:09 0 18:20 0 17:50 0 17:59 0 18:09 0 18:19 0 18:30 0 18:00 0 18:08 0 18:18 0 18:25 0 18:35 0 18:20 0 18:26 0 18:33 0 18:38 0 18:50 0 18:40 0 18:46 0 18:53 0 18:58 0 19:10 0 19:00 0 19:06 0 19:13 0 19:18 0 19:30 0 19:20 0 19:26 0 19:33 0 19:38 0 19:50 0 19:40 0 19:46 0 19:53 0 19:58 0 20:10 0 20:00 0 20:06 0 20:13 0 20:18 0 20:30 0 20:20 0 20:26 0 20:33 0 20:38 0 20:50 0 20:40 0 20:46 0 20:53 0 20:58 0 21:10 0 21:00 0 21:06 0 21:13 0 21:18 0 21:30 0 21:30 0 21:36 0 21:43 0 21:47 0 21:55 0 22:00 0 22:06 0 22:13 0 22:17 0 22:25 0 22:30 0 22:36 0 22:43 0 22:47 0 22:55 0 23:00 0 23:06 0 23:13 0 23:17 0 23:25 0 06:35 0 06:41 0 06:48 0 06:52 0 07:00 0 06:50 0 06:56 0 07:03 0 07:08 0 07:20 0 07:10 0 07:16 0 07:23 0 07:28 0 07:40 0 07:30 0 07:36 0 07:43 0 07:48 0 08:00 0 07:40 0 07:47 0 07:55 0 08:00 0 08:13 0 07:50 0 07:57 0 08:05 0 08:10 0 08:22 0 ##:00 2 ##:07 2 ##:15 2 ##:20 2 ##:32 2 ##:10 2 ##:17 2 ##:25 2 ##:30 2 ##:42 2 ##:20 2 ##:27 2 ##:35 2 ##:40 2 ##:52 2 ##:30 2 ##:37 2 ##:45 2 ##:50 2 ##:02 2 ##:40 2 ##:47 2 ##:55 2 ##:00 2 ##:12 2 ##:50 2 ##:57 2 ##:05 2 ##:10 2 ##:22 2 17:00 0 17:07 0 17:15 0 17:20 0 17:32 0 17:10 0 17:17 0 17:25 0 17:30 0 17:42 0 17:20 0 17:27 0 17:35 0 17:40 0 17:52 0 17:30 0 17:37 0 17:45 0 17:50 0 18:02 0 17:45 0 17:52 0 18:00 0 18:05 0 18:17 0 18:00 0 18:07 0 18:15 0 18:20 0 18:32 0 18:20 0 18:27 0 18:35 0 18:40 0 18:52 0 18:40 0 18:46 0 18:53 0 18:58 0 19:10 0 19:00 0 19:06 0 19:13 0 19:18 0 19:30 0 19:20 0 19:26 0 19:33 0 19:38 0 19:50 0 19:40 0 19:46 0 19:53 0 19:58 0 20:10 0 20:00 0 20:06 0 20:13 0 20:18 0 20:30 0 20:20 0 20:26 0 20:33 0 20:38 0 20:50 0 20:40 0 20:46 0 20:53 0 20:58 0 21:10 0 21:00 0 21:06 0 21:13 0 21:18 0 21:30 0 21:30 0 21:36 0 21:43 0 21:47 0 21:55 0 22:00 0 22:06 0 22:13 0 22:17 0 22:25 0 22:30 0 22:36 0 22:43 0 22:47 0 22:55 0 23:00 0 23:06 0 23:13 0 23:17 0 23:25 0 23:30 0 23:36 0 23:43 0 23:47 0 23:55 0 07:30 0 07:36 0 07:43 0 07:47 0 07:55 0 08:30 0 08:36 0 08:43 0 08:47 0 08:55 0 09:30 0 09:36 0 09:43 0 09:47 0 09:55 0 10:00 0 10:06 0 10:13 0 10:17 0 10:25 0 10:20 0 10:26 0 10:33 0 10:38 0 10:50 0 10:40 0 10:46 0 10:53 0 10:58 0 11:10 0 11:00 0 11:06 0 11:13 0 11:18 0 11:30 0 11:20 0 11:26 0 11:33 0 11:38 0 11:50 0 11:40 0 11:46 0 11:53 0 11:58 0 12:10 0 12:00 0 12:06 0 12:13 0 12:18 0 12:30 0 12:20 0 12:26 0 12:33 0 12:38 0 12:50 0 12:40 0 12:46 0 12:53 0 12:58 0 13:10 0 13:00 0 13:06 0 13:13 0 13:18 0 13:30 0 13:20 0 13:26 0 13:33 0 13:38 0 13:50 0 13:40 0 13:46 0 13:53 0 13:58 0 14:10 0 14:00 0 14:06 0 14:13 0 14:18 0 14:30 0 14:20 0 14:26 0 14:33 0 14:38 0 14:50 0 14:40 0 14:46 0 14:53 0 14:58 0 15:10 0 15:00 0 15:06 0 15:13 0 15:18 0 15:30 0 15:20 0 15:26 0 15:33 0 15:38 0 15:50 0 15:40 0 15:46 0 15:53 0 15:58 0 16:10 0 16:00 0 16:06 0 16:13 0 16:18 0 16:30 0 16:20 0 16:26 0 16:33 0 16:38 0 16:50 0 16:40 0 16:46 0 16:53 0 16:58 0 17:10 0 17:00 0 17:06 0 17:13 0 17:18 0 17:30 0 17:20 0 17:26 0 17:33 0 17:38 0 17:50 0 17:40 0 17:46 0 17:53 0 17:58 0 18:10 0 18:00 0 18:06 0 18:13 0 18:18 0 18:30 0 19:00 0 19:06 0 19:13 0 19:17 0 19:25 0 20:00 0 20:06 0 20:13 0 20:17 0 20:25 0 21:00 0 21:06 0 21:13 0 21:17 0 21:25 0 22:00 0 22:06 0 22:13 0 22:17 0 22:25 0 06:07 1 06:12 1 06:17 1 06:25 1 06:37 1 06:22 1 06:27 1 06:32 1 06:40 1 06:52 1 06:40 0 06:45 0 06:50 0 06:58 0 07:10 0 06:55 0 07:00 0 07:05 0 07:13 0 07:25 0 07:00 0 07:07 0 07:13 0 07:22 0 07:35 0 07:08 0 07:15 0 07:23 0 07:34 0 07:45 0 07:15 0 07:22 0 07:32 0 07:43 0 07:55 0 07:25 0 07:32 0 07:42 0 07:53 0 08:10 0 07:35 0 07:42 0 07:52 0 08:03 0 08:20 0 07:40 0 07:47 0 07:57 0 08:08 0 08:35 0 07:50 0 07:57 0 08:07 0 08:18 0 08:45 0 08:00 0 08:07 0 08:17 0 08:28 0 08:55 0 08:10 0 08:17 0 08:27 0 08:38 0 09:00 0 08:20 0 08:27 0 08:37 0 08:48 0 09:10 0 08:35 0 08:42 0 08:52 0 09:03 0 09:15 0 08:48 0 08:55 0 09:03 0 09:14 0 09:25 0 08:58 0 09:05 0 09:13 0 09:24 0 09:35 0 09:10 0 09:17 0 09:23 0 09:32 0 09:45 0 ##:10 2 ##:17 2 ##:23 2 ##:32 2 ##:45 2 ##:20 2 ##:27 2 ##:33 2 ##:42 2 ##:55 2 ##:30 2 ##:37 2 ##:43 2 ##:52 2 ##:05 2 ##:40 2 ##:47 2 ##:53 2 ##:02 2 ##:15 2 ##:50 2 ##:57 2 ##:03 2 ##:12 2 ##:25 2 ##:00 2 ##:07 2 ##:13 2 ##:22 2 ##:35 2 15:10 0 15:17 0 15:23 0 15:32 0 15:45 0 15:25 0 15:32 0 15:42 0 15:53 0 16:05 0 ##:35 2 ##:42 2 ##:52 2 ##:03 2 ##:15 2 ##:45 2 ##:52 2 ##:02 2 ##:13 2 ##:25 2 ##:55 2 ##:02 2 ##:12 2 ##:23 2 ##:35 2 ##:05 2 ##:12 2 ##:22 2 ##:33 2 ##:45 2 ##:15 2 ##:22 2 ##:32 2 ##:43 2 ##:55 2 ##:25 2 ##:32 2 ##:42 2 ##:53 2 ##:05 2 17:35 0 17:42 0 17:52 0 18:03 0 18:15 0 17:45 0 17:52 0 18:02 0 18:13 0 18:25 0 18:00 0 18:07 0 18:13 0 18:22 0 18:35 0 18:10 0 18:17 0 18:23 0 18:32 0 18:45 0 18:25 0 18:30 0 18:35 0 18:43 0 18:55 0 18:40 0 18:45 0 18:50 0 18:58 0 19:10 0 19:00 0 19:05 0 19:10 0 19:18 0 19:30 0 19:20 0 19:25 0 19:30 0 19:38 0 19:50 0 19:40 0 19:45 0 19:50 0 19:58 0 20:10 0 20:00 0 20:05 0 20:10 0 20:18 0 20:30 0 20:20 0 20:25 0 20:30 0 20:38 0 20:50 0 20:40 0 20:45 0 20:50 0 20:58 0 21:10 0 21:00 0 21:05 0 21:10 0 21:18 0 21:30 0 21:20 0 21:25 0 21:30 0 21:38 0 21:50 0 21:40 0 21:45 0 21:50 0 21:58 0 22:10 0 22:00 0 22:05 0 22:09 0 22:15 0 22:25 0 22:30 0 22:35 0 22:39 0 22:45 0 22:55 0 23:00 0 23:05 0 23:09 0 23:15 0 23:25 0 23:30 0 23:35 0 23:39 0 23:45 0 23:55 0 06:40 0 06:45 0 06:49 0 06:55 0 07:05 0 07:05 0 07:10 0 07:15 0 07:23 0 07:35 0 07:25 0 07:30 0 07:35 0 07:43 0 07:55 0 07:45 0 07:50 0 07:55 0 08:03 0 08:15 0 08:05 0 08:10 0 08:15 0 08:23 0 08:35 0 08:20 0 08:26 0 08:32 0 08:40 0 08:52 0 ##:30 2 ##:36 2 ##:42 2 ##:50 2 ##:02 2 ##:40 2 ##:46 2 ##:52 2 ##:00 2 ##:12 2 ##:50 2 ##:56 2 ##:02 2 ##:10 2 ##:22 2 ##:00 2 ##:06 2 ##:12 2 ##:20 2 ##:32 2 ##:10 2 ##:16 2 ##:22 2 ##:30 2 ##:42 2 ##:20 2 ##:26 2 ##:32 2 ##:40 2 ##:52 2 17:30 0 17:36 0 17:42 0 17:50 0 18:02 0 17:40 0 17:46 0 17:52 0 18:00 0 18:12 0 17:50 0 17:56 0 18:02 0 18:10 0 18:22 0 18:00 0 18:06 0 18:12 0 18:20 0 18:32 0 18:10 0 18:16 0 18:22 0 18:30 0 18:42 0 18:25 0 18:30 0 18:35 0 18:43 0 18:55 0 18:40 0 18:45 0 18:50 0 18:58 0 19:10 0 19:00 0 19:05 0 19:10 0 19:18 0 19:30 0 19:20 0 19:25 0 19:30 0 19:38 0 19:50 0 19:40 0 19:45 0 19:50 0 19:58 0 20:10 0 20:00 0 20:05 0 20:10 0 20:18 0 20:30 0 20:20 0 20:25 0 20:30 0 20:38 0 20:50 0 20:40 0 20:45 0 20:50 0 20:58 0 21:10 0 21:00 0 21:05 0 21:09 0 21:15 0 21:25 0 21:20 0 21:25 0 21:30 0 21:38 0 21:50 0 21:40 0 21:45 0 21:50 0 21:58 0 22:10 0 22:00 0 22:05 0 22:09 0 22:15 0 22:25 0 22:30 0 22:35 0 22:39 0 22:45 0 22:55 0 23:00 0 23:05 0 23:09 0 23:15 0 23:25 0 23:30 0 23:35 0 23:39 0 23:45 0 23:55 0 08:00 0 08:05 0 08:09 0 08:15 0 08:25 0 09:00 0 09:05 0 09:09 0 09:15 0 09:25 0 10:00 0 10:05 0 10:09 0 10:15 0 10:25 0 10:30 0 10:35 0 10:39 0 10:45 0 10:55 0 11:00 0 11:05 0 11:10 0 11:18 0 11:30 0 ##:20 3 ##:25 3 ##:30 3 ##:38 3 ##:50 3 ##:40 3 ##:45 3 ##:50 3 ##:58 3 ##:10 3 ##:00 3 ##:05 3 ##:10 3 ##:18 3 ##:30 3 17:40 0 17:45 0 17:50 0 17:58 0 18:10 0 18:00 0 18:05 0 18:10 0 18:18 0 18:30 0 18:20 0 18:25 0 18:30 0 18:38 0 18:50 0 18:40 0 18:45 0 18:50 0 18:58 0 19:10 0 19:30 0 19:35 0 19:39 0 19:45 0 19:55 0 20:30 0 20:35 0 20:39 0 20:45 0 20:55 0 21:30 0 21:35 0 21:39 0 21:45 0 21:55 0 22:30 0 22:35 0 22:39 0 22:45 0 22:55 0 |
|
From: Philippe M. <ph...@us...> - 2009-05-17 15:23:26
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32016 Modified Files: csv2trainschedpdb.c Log Message: Remove some french language Index: csv2trainschedpdb.c =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csv2trainschedpdb.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** csv2trainschedpdb.c 16 May 2009 08:07:45 -0000 1.8 --- csv2trainschedpdb.c 17 May 2009 15:23:14 -0000 1.9 *************** *** 31,35 **** #define NBMAXGARES 30 /* Max number of stations */ ! #define LGMAXNOMGARE 20 /* Max length of a station name */ #define AFFMAX 10 /* Max number of rows in the main table */ #define CREATORID "TRSC" --- 31,35 ---- #define NBMAXGARES 30 /* Max number of stations */ ! #define MAXSTATIONNAMELENGTH 20 /* Max length of a station name */ #define AFFMAX 10 /* Max number of rows in the main table */ #define CREATORID "TRSC" *************** *** 43,47 **** typedef struct station { ! char nom[LGMAXNOMGARE+1]; } station; --- 43,47 ---- typedef struct station { ! char nom[MAXSTATIONNAMELENGTH+1]; } station; *************** *** 83,88 **** { FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0, datawtn=0; ! char temp[LGMAXNOMGARE+1]={0}; int cur_record; long cur_record_pos=0; --- 83,88 ---- { FILE *fd, *pdbfd; ! int c=1, nbstations=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0, datawtn=0; ! char temp[MAXSTATIONNAMELENGTH+1]={0}; int cur_record; long cur_record_pos=0; *************** *** 96,100 **** fd = fopen(argv[1],"r"); if (fd == NULL) { ! printf("Erreur d'ouverture du fichier %s\n",argv[1]); exit(-1); } --- 96,100 ---- fd = fopen(argv[1],"r"); if (fd == NULL) { ! printf("Error opening file %s\n",argv[1]); exit(-1); } *************** *** 114,118 **** pdbfd = fopen(argv[2],"wb"); if (pdbfd == NULL) { ! printf("Erreur de création du fichier %s\n",argv[1]); exit(-1); } --- 114,118 ---- pdbfd = fopen(argv[2],"wb"); if (pdbfd == NULL) { ! printf("Error creating file %s\n",argv[1]); exit(-1); } *************** *** 189,193 **** if(c == '\t') ! nbgares++; if (c != '\n') { fwrite(&c,1,1,pdbfd); --- 189,193 ---- if(c == '\t') ! nbstations++; if (c != '\n') { fwrite(&c,1,1,pdbfd); *************** *** 197,202 **** } } ! nbgares++; ! printf("I found %i stations\n",nbgares); /* Write record info in record List */ --- 197,202 ---- } } ! nbstations++; ! printf("I found %i stations\n",nbstations); /* Write record info in record List */ *************** *** 274,278 **** } } ! if (datawtn) nabbrev++; // Only if we wrote at lease /something/. printf("%i abbreviations found\n",nabbrev); --- 274,278 ---- } } ! if (datawtn) nabbrev++; // Only if we wrote at least /something/. printf("%i abbreviations found\n",nabbrev); *************** *** 296,300 **** } } ! if (datawtn) nabdef++; // Only if we wrote at lease /something/. if (nabbrev != nabdef) { --- 296,300 ---- } } ! if (datawtn) nabdef++; // Only if we wrote at least /something/. if (nabbrev != nabdef) { |
|
From: Philippe M. <ph...@us...> - 2009-05-17 14:58:13
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29768 Modified Files: Makefile Log Message: update to the packaging targets Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 14 May 2009 19:50:55 -0000 1.11 --- Makefile 17 May 2009 14:58:05 -0000 1.12 *************** *** 3,7 **** VERS=1.0 ! SDK_LOCATION = "C:/Program Files/Palm OS Developer Suite/sdk-5r4/" PROGRAM=trainsched --- 3,8 ---- VERS=1.0 ! #SDK_LOCATION = "C:/Program Files/Palm OS Developer Suite/sdk-5r4/" ! SDK_LOCATION = /usr/local/share/palmdev/sdk-5r3 PROGRAM=trainsched *************** *** 12,16 **** BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall LFLAGS=-g --- 13,17 ---- BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r3 -Wall LFLAGS=-g *************** *** 45,53 **** dist-win: clean all rm -f ../$(PROGRAM)-src-$(VERS).zip ../trainsched-$(VERS).zip ! rm -rf $(PROGRAM)-$(VERS) ! mkdir $(PROGRAM)-$(VERS) ! cp -a trainsched.[ch] *.rcp *.bmp breteche.pdb Makefile LICENSE README TODO $(PROGRAM)-$(VERS) ! zip -r9 ../$(PROGRAM)-src-$(VERS).zip $(PROGRAM)-$(VERS) ! rm -rf $(PROGRAM)-src$(VERS) rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) --- 46,54 ---- dist-win: clean all rm -f ../$(PROGRAM)-src-$(VERS).zip ../trainsched-$(VERS).zip ! rm -rf $(PROGRAM)-src-$(VERS) ! mkdir $(PROGRAM)-src-$(VERS) ! cp -a *.[ch] *.rcp *.bmp breteche.pdb Makefile LICENSE README TODO $(PROGRAM)-src-$(VERS) ! zip -r9 ../$(PROGRAM)-src-$(VERS).zip $(PROGRAM)-src-$(VERS) ! rm -rf $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) *************** *** 58,71 **** dist: clean all rm -f ../$(PROGRAM)-src-$(VERS).tar.gz ../$(PROGRAM)-$(VERS).tar.gz - rm -rf $(PROGRAM)-$(VERS) - mkdir $(PROGRAM)-$(VERS) - cp -a trainsched.[ch] *.rcp *.bmp breteche.pdb Makefile LICENSE README TODO $(PROGRAM)-$(VERS) - tar cvzf ../$(PROGRAM)-src-$(VERS).tar.gz $(PROGRAM)-$(VERS) - rm -rf $(PROGRAM)-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) mkdir $(PROGRAM)-src-$(VERS) ! cp -a trainsched.prc breteche.pdb LICENSE README TODO $(PROGRAM)-src-$(VERS) ! tar cvzf ../$(PROGRAM)-$(VERS).tar.gz $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) --- 59,72 ---- dist: clean all rm -f ../$(PROGRAM)-src-$(VERS).tar.gz ../$(PROGRAM)-$(VERS).tar.gz rm -rf $(PROGRAM)-src-$(VERS) mkdir $(PROGRAM)-src-$(VERS) ! cp -a *.[ch] *.rcp *.bmp breteche.pdb Makefile LICENSE README TODO $(PROGRAM)-src-$(VERS) ! tar cvzf ../$(PROGRAM)-src-$(VERS).tar.gz $(PROGRAM)-src-$(VERS) rm -rf $(PROGRAM)-src-$(VERS) + rm -rf $(PROGRAM)-$(VERS) + mkdir $(PROGRAM)-$(VERS) + cp -a trainsched.prc breteche.pdb LICENSE README TODO $(PROGRAM)-$(VERS) + tar cvzf ../$(PROGRAM)-$(VERS).tar.gz $(PROGRAM)-$(VERS) + rm -rf $(PROGRAM)-$(VERS) |
|
From: Steve M. <sma...@us...> - 2009-05-16 08:07:49
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18585 Modified Files: .cvsignore Makefile csv2trainschedpdb.c csvformat.txt Log Message: Merge from PDB_VER2 branch. Index: .cvsignore =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 14 Apr 2002 15:23:49 -0000 1.1 --- .cvsignore 16 May 2009 08:07:45 -0000 1.2 *************** *** 1 **** --- 1,2 ---- *.pdb + csv2trainschedpdb.exe \ No newline at end of file Index: csvformat.txt =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csvformat.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** csvformat.txt 22 Jun 2001 18:53:21 -0000 1.1.1.1 --- csvformat.txt 16 May 2009 08:07:45 -0000 1.2 *************** *** 1,23 **** All line endings are Unix style (LF only) ! There are no " Fields are separated by tabs ! The file MUST NOT have an empty line at the end - First line: Station names separated by Tab ! The max length of a station name is 20 characters by default. - Second line: Days ! The max length of a day is 9 characters by default. ! - Third line ! Fields: - Line number in csv for 1st Day, 1st Direction ! - Line number in csv for 2nd Day, 1st Direction ! - Line number in csv for 3rd Day, 1st Direction ! - Line number in csv for 1st Day, 2nd Direction ! ... ! - Data ! times are of the form 00:00 in 24 hour format ! there must be at least 1 dash ('-') if no stop. ! ie: 00:00 00:15 00:20 01:40 ----- 15:50 --- 1,57 ---- All line endings are Unix style (LF only) ! There are no quote (" or ') character. Fields are separated by tabs ! The file MUST NOT have any empty lines at the end, but the last line MUST end with a LF. - First line: Station names separated by Tab ! The max length of a station name is 20 characters. ! - Second line: Days ! The max length of a day is 9 characters. ! ! - Third line: ! Starting row for timetable entries for each day and direction, each line number ! is separated by a Tab: ! Line number in csv for 1st Day, 1st Direction ! Line number in csv for 2nd Day, 1st Direction ! Line number in csv for 3rd Day, 1st Direction ! Line number in csv for 1st Day, 2nd Direction ! ... ! ! - Fourth line: ! Abbreviations separated by a Tab. ! The max length of an abbreviation is 5 characters. ! This line may be blank if the timetable does not use any abbreviations. ! ! - Fifth line: ! Abbreviation definitions separated by a Tab. ! The max length of an abbreviation definition is 23 characters. There should ! be the same number of abbreviation definitions as there are abbreviations. ! ! - Sixth line: ! Timetable notes. Any special notes from the service operator. '|' characters ! may be included to indicate line breaks. This line may be blank if there are ! no additional notes. ! ! - Seventh line onwards: ! Timetable data is of the form: ! <time>tab<abbreviation>tab<time>tab<abbreviation> ! There must be as many times as there are station names. Abbreviation is zero ! for none or the number of defined abbreviation on line 4 (starting a 1) If ! line 4 is blank then no abbreviation values are to be entered, ! i.e. <time>tab<time>tab<time>... ! ! Times are of the form 00:00 in 24 hour format. ! ! There must be at least 1 dash ('-') and no colon (':') if no stop. ! ! A '#' character may be used as a wildcard for hours where the times apply to every hour. ! ! e.g.: ! With Abbreviations: ! 00:00 0 00:15 0 00:20 1 01:40 1 ----- 0 15:50 ! Without Abbreviations: 00:00 00:15 00:20 01:40 ----- 15:50 Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 3 Apr 2003 13:54:35 -0000 1.4 --- Makefile 16 May 2009 08:07:45 -0000 1.5 *************** *** 2,6 **** # ! VERS=0.3 CC=gcc --- 2,6 ---- # ! VERS=1.0 CC=gcc *************** *** 34,38 **** rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) ! cp -a $(PROGRAM).exe cygwin1.dll csvformat.txt breteche.csv breteche.pdb LICENSE README $(PROGRAM)-win-$(VERS) zip -r9 ../$(PROGRAM)-win-$(VERS).zip $(PROGRAM)-win-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) --- 34,38 ---- rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) ! cp -a $(PROGRAM).exe csvformat.txt breteche.csv breteche.pdb LICENSE README $(PROGRAM)-win-$(VERS) zip -r9 ../$(PROGRAM)-win-$(VERS).zip $(PROGRAM)-win-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) Index: csv2trainschedpdb.c =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csv2trainschedpdb.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** csv2trainschedpdb.c 30 Mar 2007 10:10:22 -0000 1.7 --- csv2trainschedpdb.c 16 May 2009 08:07:45 -0000 1.8 *************** *** 35,40 **** #define CREATORID "TRSC" #define DBTYPE "DATA" ! #define FATTRIBS "\x0\x0" /* 0x0020 = RO | backup | OK to overwrite */ ! #define VERSION "\x1\x0" /* 0.1 */ #define TIME_CONSTANT 2082844800 --- 35,41 ---- #define CREATORID "TRSC" #define DBTYPE "DATA" ! #define FATTRIBS "\x0\x0" /* 0x0020 = RO | backup | OK to overwrite */ ! #define VERSION_1_0 "\x1\x0" /* 1.0 Original Trainsched format. */ ! #define VERSION_2_0 "\x2\x0" /* 2.0 Enhanced Trainsched format */ #define TIME_CONSTANT 2082844800 *************** *** 42,46 **** typedef struct station { ! char nom[LGMAXNOMGARE+1]; } station; --- 43,47 ---- typedef struct station { ! char nom[LGMAXNOMGARE+1]; } station; *************** *** 54,333 **** * record number */ - int writerecordinfo(FILE *pdbfd, unsigned int record_num, long pos) { ! char temp[4]={0}; ! int i; ! long saved_pos=0; ! /* store current pos in pdb file */ ! saved_pos = ftell(pdbfd); ! /* write record info */ ! fseek(pdbfd,(record_num-1)*8 + end_header_pos,SEEK_SET); ! i = pos; ! // printf("record: %i %i\n",record_num,i); ! temp[0]= i >> 24 ; ! temp[1]= i >> 16; ! temp[2]= i >> 8; ! temp[3]= i & 0xFFFFFF; ! fwrite(temp,4,1,pdbfd); ! /* go back to saved position */ ! fseek(pdbfd,saved_pos,SEEK_SET); ! return 0; } int main(int argc, char *argv[]) { ! FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nbdir=0, notrain=0; ! char temp[LGMAXNOMGARE+1]={0}; ! int cur_record; ! long cur_record_pos=0; ! if (argc != 4) { ! printf("usage : %s <source> <dest> <PDB Name>\n",argv[0]); ! exit(0); ! } ! /* open source file */ ! fd = fopen(argv[1],"r"); ! if (fd == NULL) { ! printf("Erreur d'ouverture du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* create destination file */ ! /* the b mode is necessary for Cygwin and harmless for Posix systems */ ! pdbfd = fopen(argv[2],"wb"); ! if (pdbfd == NULL) { ! printf("Erreur de création du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* header */ ! /*PDB Name Max 32 chars , \0 terminated */ ! fwrite(argv[3],1,strlen(argv[3]),pdbfd); ! for(i=0;i<(32-strlen(argv[3]));i++) ! fwrite("\x0",1,1,pdbfd); ! /* File attribs */ ! fwrite(FATTRIBS,2,1,pdbfd); ! /* Version */ ! fwrite(VERSION,2,1,pdbfd); ! /* creation date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* Modification date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* last Backup date */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Modification number */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* AppInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* SortInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Database Type */ ! fwrite(DBTYPE,4,1,pdbfd); ! /* Creator ID */ ! fwrite(CREATORID,4,1,pdbfd); ! /* Unique ID Seed */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Next record List ID */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Number of records to go here */ ! fwrite("\x0\x0",2,1,pdbfd); ! end_header_pos=ftell(pdbfd); ! /* count number of records in source file */ ! while ((c = fgetc(fd)) != EOF) { ! if (c == '\n') ! num_records++; ! } ! printf("There are %i lines (records)\n",num_records); ! /* save it in PDB Header */ ! /* write number of records in header */ ! fseek(pdbfd,end_header_pos-2,SEEK_SET); ! temp[0] = num_records >> 8; ! temp[1] = num_records & 0xFF; ! fwrite(temp,2,1,pdbfd); ! /* leave room for records info */ ! for (i=0;i<num_records;i++) ! fwrite("\x0\x0\x0\x0\x0\x0\x0\x0",8,1,pdbfd); ! rewind(fd); ! cur_record=1; ! cur_record_pos=ftell(pdbfd); ! /* read Station Names on 1st line */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbgares++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbgares++; ! printf("I found %i stations\n",nbgares); ! /* Write record info in record List */ ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read Day List */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbdays++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdays++; ! printf("%i days found\n",nbdays); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* Read line offset for the various days and directions schedules */ ! i=0; ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0]=j >> 8; ! temp[1]=j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! i=0; ! nbdir++; ! } ! if (c != '\n') { ! temp[i++]=c; ! } else { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdir++; ! printf("%i time tables found\n",nbdir); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* Let's go for the real thing */ ! i=0; ! notrain=0; ! for(;;) { ! c=fgetc(fd); ! /* we write time as int */ ! if ((c != '\t') && (c != '\n')) { ! if (c != ':') ! temp[i++]=c; ! } else if (c == '\t') { ! temp[i]='\0'; ! for(j=0;j<i;j++) { ! if (temp[j]=='-') { ! notrain=1; ! fwrite("\xFF\xFF",2,1,pdbfd); ! memset(temp,0,sizeof(temp)); ! break; ! } ! } ! if (notrain==0) { ! j = atoi(temp); ! memset(temp,0,4); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! fflush(pdbfd); ! memset(temp,0,sizeof(temp)); ! } ! notrain=0; ! i=0; ! } ! if ((c == '\n') || (c == EOF)) { ! temp[i]='\0'; ! for(j=0;j<i;j++) { ! if (temp[j]=='-') { ! notrain=1; ! fwrite("\xFF\xFF",2,1,pdbfd); ! memset(temp,0,sizeof(temp)); ! break; ! } ! } ! if (notrain==0) { ! j = atoi(temp); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! memset(temp,0,sizeof(temp)); ! } ! notrain=0; ! i=0; ! if (c != EOF) { ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } else { ! break; ! } ! } ! } ! fflush(pdbfd); ! fclose(pdbfd); ! fclose(fd); ! return 0; } --- 55,407 ---- * record number */ int writerecordinfo(FILE *pdbfd, unsigned int record_num, long pos) { ! char temp[4]={0}; ! int i; ! long saved_pos=0; ! /* store current pos in pdb file */ ! saved_pos = ftell(pdbfd); ! /* write record info */ ! fseek(pdbfd,(record_num-1)*8 + end_header_pos,SEEK_SET); ! i = pos; ! // printf("record: %i %i\n",record_num,i); ! temp[0]= i >> 24 ; ! temp[1]= i >> 16; ! temp[2]= i >> 8; ! temp[3]= i & 0xFFFFFF; ! fwrite(temp,4,1,pdbfd); ! /* go back to saved position */ ! fseek(pdbfd,saved_pos,SEEK_SET); ! return 0; } int main(int argc, char *argv[]) { + FILE *fd, *pdbfd; + int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0, datawtn=0; + char temp[LGMAXNOMGARE+1]={0}; + int cur_record; + long cur_record_pos=0; ! if (argc != 4) { ! printf("usage : %s <source> <dest> <PDB Name>\n",argv[0]); ! exit(0); ! } ! /* open source file */ ! fd = fopen(argv[1],"r"); ! if (fd == NULL) { ! printf("Erreur d'ouverture du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* count number of records in source file */ ! while ((c = fgetc(fd)) != EOF) { ! if ((num_records < 5) && c == ':') ! num_colon++; // Colons (i.e times) in the first 5 records indicates that this is a version 1.0 PDB. ! if (c == '\n') ! num_records++; ! } ! printf("There are %i lines (records)\n",num_records); ! /* create destination file */ ! /* the b mode is necessary for Cygwin and harmless for Posix systems */ ! pdbfd = fopen(argv[2],"wb"); ! if (pdbfd == NULL) { ! printf("Erreur de création du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* header */ ! /*PDB Name Max 32 chars , \0 terminated */ ! fwrite(argv[3],1,strlen(argv[3]),pdbfd); ! for(i=0;i<(32-strlen(argv[3]));i++) ! fwrite("\x0",1,1,pdbfd); ! /* File attribs */ ! fwrite(FATTRIBS,2,1,pdbfd); ! /* Version */ ! if (num_colon > 3) { ! printf("Writing a Version 1.0 PDB file.\n"); ! fwrite(VERSION_1_0,2,1,pdbfd); ! } else { ! printf("Writing a Version 2.0 PDB file.\n"); ! fwrite(VERSION_2_0,2,1,pdbfd); ! } ! /* creation date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* Modification date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* last Backup date */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Modification number */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* AppInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* SortInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Database Type */ ! fwrite(DBTYPE,4,1,pdbfd); ! /* Creator ID */ ! fwrite(CREATORID,4,1,pdbfd); ! /* Unique ID Seed */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Next record List ID */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Number of records to go here */ ! temp[0] = num_records >> 8; ! temp[1] = num_records & 0xFF; ! fwrite(temp,2,1,pdbfd); ! end_header_pos=ftell(pdbfd); ! /* leave room for records info */ ! for (i=0;i<num_records;i++) ! fwrite("\x0\x0\x0\x0\x0\x0\x0\x0",8,1,pdbfd); ! rewind(fd); ! cur_record=1; ! cur_record_pos=ftell(pdbfd); ! /* read Station Names on 1st line */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbgares++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbgares++; ! printf("I found %i stations\n",nbgares); ! /* Write record info in record List */ ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read Day List */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbdays++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdays++; ! printf("%i days found\n",nbdays); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* Read line offset for the various days and directions schedules */ ! i=0; ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0]=j >> 8; ! temp[1]=j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! i=0; ! nbdir++; ! } ! if (c != '\n') { ! temp[i++]=c; ! } else { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdir++; ! printf("%i time tables found\n",nbdir); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! if (num_colon < 4) { // Only for 2.0 Version PDB files. ! /* read Abbreviations List */ ! datawtn = 0; ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nabbrev++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! datawtn = 1; ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! if (datawtn) nabbrev++; // Only if we wrote at lease /something/. ! printf("%i abbreviations found\n",nabbrev); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read Abbreviations Definitions */ ! datawtn = 0; ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nabdef++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! datawtn = 1; ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! if (datawtn) nabdef++; // Only if we wrote at lease /something/. ! if (nabbrev != nabdef) ! { ! printf("WARNING: I found %i abbreviations, but %i abbreviation definitions.\n", nabbrev, nabdef); ! } ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read timetable notes.*/ ! for(;;) { ! c = fgetc(fd); ! if(c == '|') ! fwrite("\n",1,1,pdbfd); ! else if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } ! /* Write the timetable records. */ ! i=0; ! if (num_colon > 3) { ! // Version 1.0 PDB ! for(;;) { ! c=fgetc(fd); ! if (c == EOF) break; ! /* we write time as a single 16bit int */ ! if ((c != '\t') && (c != '\n') && (c != ':')) temp[i++]=c; ! if ((c == '\t') || (c == '\n')) { ! temp[i]='\0'; ! if (temp[0]=='-') { ! fwrite("\xFF\xFF",2,1,pdbfd); ! } else { ! j = atoi(temp); ! memset(temp,0,4); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! } ! fflush(pdbfd); ! memset(temp,0,sizeof(temp)); ! i=0; ! } ! if (c == '\n') { ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } ! } ! } ! else ! { ! // Version 2.0 PDB ! for(;;) { ! c=fgetc(fd); ! if (c == EOF) break; ! ! /* we write time and abbreviation as three 8 bit ints (hours, minutes & abbrev) */ ! if ((c != '\t') && (c != '\n') && (c != ':')) temp[i++]=c; ! else { ! temp[i]='\0'; ! ! if (temp[0]=='-') { ! fwrite("\xFF\xFF",2,1,pdbfd); // Hours and Minutes ! } else if (temp[0]=='#') { ! fwrite("\xFE",1,1,pdbfd); ! } else { ! j = atoi(temp); ! temp[0] = j & 0xFF; ! fwrite(temp,1,1,pdbfd); ! } ! ! // If no defined abbreviations, write a blank ! if ((c != ':') && (nabbrev == 0)) { ! fwrite("\x0",1,1,pdbfd); ! } ! ! fflush(pdbfd); ! memset(temp,0,sizeof(temp)); ! i=0; ! } ! ! if (c == '\n') { ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } ! } ! } ! fflush(pdbfd); ! fclose(pdbfd); ! fclose(fd); ! ! return 0; } |
|
From: Steve M. <sma...@us...> - 2009-05-16 08:05:11
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18300 Modified Files: trainsched.rcp Log Message: Update version no. to 1.0. Index: trainsched.rcp =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.rcp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** trainsched.rcp 12 May 2009 17:02:48 -0000 1.16 --- trainsched.rcp 16 May 2009 08:05:07 -0000 1.17 *************** *** 20,24 **** #include "trainsched.h" ! VERSION ID 1 "0.6.0 beta" --- 20,24 ---- #include "trainsched.h" ! VERSION ID 1 "1.0" *************** *** 115,119 **** LABEL "Released under the GNU GPL" AUTOID AT (8 PrevTop+16) FONT 1 ! LABEL "version 0.6 beta" AUTOID AT (8 PrevTop+12) FONT 1 BUTTON "Ok" ID aboutFormOkButton AT (100 138 36 AUTO) --- 115,119 ---- LABEL "Released under the GNU GPL" AUTOID AT (8 PrevTop+16) FONT 1 ! LABEL "version 1.0" AUTOID AT (8 PrevTop+12) FONT 1 BUTTON "Ok" ID aboutFormOkButton AT (100 138 36 AUTO) |
|
From: Steve M. <sma...@us...> - 2009-05-14 19:51:06
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22903 Modified Files: Makefile Log Message: Update version no. to 1.0. Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile 12 May 2009 17:02:48 -0000 1.10 --- Makefile 14 May 2009 19:50:55 -0000 1.11 *************** *** 2,6 **** # Macros ! VERS=0.5pre2 SDK_LOCATION = "C:/Program Files/Palm OS Developer Suite/sdk-5r4/" --- 2,6 ---- # Macros ! VERS=1.0 SDK_LOCATION = "C:/Program Files/Palm OS Developer Suite/sdk-5r4/" |
|
From: Steve M. <sma...@us...> - 2009-05-14 19:50:22
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22840 Modified Files: abbrevform.c notesform.c selectform.c Log Message: Address compiler warnings for PalmOSGlue functions. Index: abbrevform.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/abbrevform.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** abbrevform.c 12 May 2009 17:02:48 -0000 1.2 --- abbrevform.c 14 May 2009 19:50:11 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- */ #include <PalmOS.h> + #include <TxtGlue.h> #include "trainsched.h" Index: notesform.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/notesform.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** notesform.c 12 May 2009 17:02:48 -0000 1.2 --- notesform.c 14 May 2009 19:50:11 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- */ #include <PalmOS.h> + #include <TxtGlue.h> #include <Window.h> Index: selectform.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/selectform.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** selectform.c 12 May 2009 17:02:48 -0000 1.3 --- selectform.c 14 May 2009 19:50:11 -0000 1.4 *************** *** 18,21 **** --- 18,22 ---- */ #include <PalmOS.h> + #include <TxtGlue.h> #include "trainsched.h" |
|
From: Steve M. <sma...@us...> - 2009-05-14 19:49:27
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22659 Modified Files: .cvsignore Log Message: Exclude pdb files from CVS. Index: .cvsignore =================================================================== RCS file: /cvsroot/trainsched/trainsched/.cvsignore,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .cvsignore 26 Apr 2009 08:01:04 -0000 1.5 --- .cvsignore 14 May 2009 19:49:16 -0000 1.6 *************** *** 9,11 **** .cdtproject .project ! auto-generated.mk \ No newline at end of file --- 9,12 ---- .cdtproject .project ! auto-generated.mk ! breteche.pdb \ No newline at end of file |
|
From: Steve M. <sma...@us...> - 2009-05-14 19:48:31
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22562 Modified Files: Tag: PDB_VER2 Makefile Log Message: Update version no. to 1.0. Remove "cygwim1.dll" dependency. Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/Makefile,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** Makefile 3 Apr 2003 13:54:35 -0000 1.4 --- Makefile 14 May 2009 19:48:11 -0000 1.4.2.1 *************** *** 2,6 **** # ! VERS=0.3 CC=gcc --- 2,6 ---- # ! VERS=1.0 CC=gcc *************** *** 34,38 **** rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) ! cp -a $(PROGRAM).exe cygwin1.dll csvformat.txt breteche.csv breteche.pdb LICENSE README $(PROGRAM)-win-$(VERS) zip -r9 ../$(PROGRAM)-win-$(VERS).zip $(PROGRAM)-win-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) --- 34,38 ---- rm -rf $(PROGRAM)-win-$(VERS) mkdir $(PROGRAM)-win-$(VERS) ! cp -a $(PROGRAM).exe csvformat.txt breteche.csv breteche.pdb LICENSE README $(PROGRAM)-win-$(VERS) zip -r9 ../$(PROGRAM)-win-$(VERS).zip $(PROGRAM)-win-$(VERS) rm -rf $(PROGRAM)-win-$(VERS) |
|
From: Steve M. <sma...@us...> - 2009-05-11 19:53:40
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15245 Modified Files: Tag: PDB_VER2 trainsched.c trainsched.h trainsched.rcp Log Message: Fix overwrite issue on Form Title when timetable name changed. Use String resources for Popup Selections when no value selected. Index: trainsched.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.h,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -C2 -d -r1.11.2.1 -r1.11.2.2 *** trainsched.h 2 May 2009 16:21:08 -0000 1.11.2.1 --- trainsched.h 11 May 2009 19:53:30 -0000 1.11.2.2 *************** *** 75,78 **** --- 75,83 ---- #define NOT_IMPL 1304 + /* String Resources */ + #define fromPopup 9901 + #define toPopup 9902 + #define dayPopup 9903 + /* Constants */ #define SHOWMAX 10 Index: trainsched.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.c,v retrieving revision 1.25.2.2 retrieving revision 1.25.2.3 diff -C2 -d -r1.25.2.2 -r1.25.2.3 *** trainsched.c 4 May 2009 17:28:36 -0000 1.25.2.2 --- trainsched.c 11 May 2009 19:53:30 -0000 1.25.2.3 *************** *** 18,21 **** --- 18,22 ---- */ #include <PalmOS.h> + #include <TxtGlue.h> #include "trainsched.h" *************** *** 56,59 **** --- 57,63 ---- UInt8 Day = NOSELECTION; UInt32 RomVersion; + static char FromPopup[16]={0}; + static char ToPopup[16]={0}; + static char DayPopup[16]={0}; Boolean bUse3Cols = false; /* Whether to use Annotation column. */ *************** *** 439,442 **** --- 443,448 ---- void LoadMainForm(FormPtr pForm) { + MemHandle resH; + char *resP; ListPtr popupDays,popupToStations,popupFromStations; *************** *** 456,462 **** } else { // No current selection, so display prompt. CtlSetLabel(FrmGetObjectPtr(pForm, FrmGetObjectIndex( pForm, resFromTrigger )), ! "Depart"); } --- 462,477 ---- } else { // No current selection, so display prompt. + resH = DmGetResource(strRsc, fromPopup); + if (resH) { + resP = MemHandleLock(resH); + if (resP) { + StrCopy(FromPopup, resP); + MemHandleUnlock(resH); + } + DmReleaseResource(resH); + } CtlSetLabel(FrmGetObjectPtr(pForm, FrmGetObjectIndex( pForm, resFromTrigger )), ! FromPopup); } *************** *** 469,475 **** } else { // No current selection, so display prompt. CtlSetLabel(FrmGetObjectPtr( pForm, FrmGetObjectIndex( pForm, resToTrigger )), ! "Arrive"); } --- 484,499 ---- } else { // No current selection, so display prompt. + resH = DmGetResource(strRsc, toPopup); + if (resH) { + resP = MemHandleLock(resH); + if (resP) { + StrCopy(ToPopup, resP); + MemHandleUnlock(resH); + } + DmReleaseResource(resH); + } CtlSetLabel(FrmGetObjectPtr( pForm, FrmGetObjectIndex( pForm, resToTrigger )), ! ToPopup); } *************** *** 485,491 **** } else { // No current selection, so display prompt. CtlSetLabel(FrmGetObjectPtr( pForm, FrmGetObjectIndex(pForm, resDayTrigger)), ! "Day"); } } --- 509,524 ---- } else { // No current selection, so display prompt. + resH = DmGetResource(strRsc, dayPopup); + if (resH) { + resP = MemHandleLock(resH); + if (resP) { + StrCopy(DayPopup, resP); + MemHandleUnlock(resH); + } + DmReleaseResource(resH); + } CtlSetLabel(FrmGetObjectPtr( pForm, FrmGetObjectIndex(pForm, resDayTrigger)), ! DayPopup); } } *************** *** 796,799 **** --- 829,833 ---- void SetFormLabel(FormPtr pForm) { + RectangleType clearTC, curBounds; UInt32 seconds=0; DateTimePtr dateTimeP; *************** *** 801,807 **** --- 835,850 ---- char *asctime; + // Clear the previous form name. MemSet(FormTitle, 32, 0); if (pForm==NULL) return; + // Clear the previous displayed title (PalmOS doesn't seem to do this properly). + WinPushDrawState(); + WinGetBounds(FrmGetWindowHandle(pForm), &curBounds); + RctSetRectangle(&clearTC, 0, 0, curBounds.extent.x, 13); + WinSetForeColor(UIColorGetTableEntryIndex(UIFormFrame)); + WinDrawRectangle(&clearTC, 0); + WinPopDrawState(); + seconds = TimGetSeconds(); dateTimeP = MemPtrNew(sizeof(DateTimeType)); Index: trainsched.rcp =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.rcp,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -C2 -d -r1.15.2.1 -r1.15.2.2 *** trainsched.rcp 2 May 2009 16:21:08 -0000 1.15.2.1 --- trainsched.rcp 11 May 2009 19:53:30 -0000 1.15.2.2 *************** *** 30,33 **** --- 30,38 ---- BITMAP aboutBitmap "trainsched.bmp" COMPRESS + /* Strings */ + STRING ID fromPopup "From" + STRING ID toPopup "To" + STRING ID dayPopup "Day" + /* Main Form */ FORM ID resFormMain AT ( 0 0 160 160 ) |
|
From: Steve M. <sma...@us...> - 2009-05-05 19:20:51
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23437 Modified Files: Tag: PDB_VER2 timetable.c Log Message: Fix: New abbreviations scheme to work with timetable PDB 1.0 ABBR file. Index: timetable.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/timetable.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** timetable.c 4 May 2009 17:21:43 -0000 1.2.2.2 --- timetable.c 5 May 2009 19:20:34 -0000 1.2.2.3 *************** *** 114,119 **** /* * Get the Abbreviations. This function sets the global variable Abbreviations. ! * For version 0.1 PDB files this is either from a defined database, or default ! * values if the database does not exist. For a 0.2 PDB file then it is from * within the PDB itself. */ --- 114,119 ---- /* * Get the Abbreviations. This function sets the global variable Abbreviations. ! * For version 1.0 PDB files this is either from a defined 'ABBR' PDB, or default ! * values if the database does not exist. For a 2.0 PDB file then it is from * within the PDB itself. */ *************** *** 141,172 **** { hAbbrevRec = DmQueryRecord(hAbbrevDb, 0); ! // StrCopy(szAbbreviations, MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! /* Convert '|' to '\n'. */ ! // strLen = StrLen(szAbbreviations); ! // for (i=0; i<strLen; i++) ! // if (szAbbreviations[i] == '|') szAbbreviations[i] = '\n'; ! nNumRecords = DmNumRecords(hAbbrevDb); /* Read in the abbreviations. */ ! for (i=1; i<=MAX_ABBREVIATIONS; i++) { /* Default to an empty string. */ ! StrCopy(Abbreviations[i], ""); ! /* Ensure index is in range because some releases will */ ! /* display fatal error message if DmQueryRecords() called */ ! /* an out-of-range record number. */ ! if (i <= nNumRecords) { hAbbrevRec = DmQueryRecord(hAbbrevDb, i); if (hAbbrevRec != NULL) { ! StrCopy(Abbreviations[i], MemHandleLock(hAbbrevRec)); MemHandleUnlock(hAbbrevRec); } } } ! numabbrev = i; } } --- 141,185 ---- { hAbbrevRec = DmQueryRecord(hAbbrevDb, 0); ! if (hAbbrevRec) { ! recordP = MemHandleLock(hAbbrevRec); ! if (recordP) { ! strPos = 0; ! recPos = 0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '|') { ! AbbrevDeffs[numabbrev][strPos]='\0'; ! numabbrev++; ! strPos=0; ! } else { ! AbbrevDeffs[numabbrev][strPos]=recordP[recPos]; ! if (strPos < ABDEFLENGTH-1) strPos++; // Don't overrun. ! } ! recPos++; ! } ! AbbrevDeffs[numabbrev][strPos]='\0'; ! numabbrev++; ! // release lock on record. ! MemHandleUnlock(hAbbrevRec); ! } ! } ! nNumRecords = DmNumRecords(hAbbrevDb); /* Read in the abbreviations. */ ! for (i=1; i<nNumRecords; i++) { /* Default to an empty string. */ ! StrCopy(Abbreviations[i-1], ""); ! if (i-1 < MAX_ABBREVIATIONS) { hAbbrevRec = DmQueryRecord(hAbbrevDb, i); if (hAbbrevRec != NULL) { ! StrNCopy(Abbreviations[i-1], MemHandleLock(hAbbrevRec), ABBREVLENGTH-1); MemHandleUnlock(hAbbrevRec); } } } ! numabbrev = i-1; } } |
|
From: Steve M. <sma...@us...> - 2009-05-04 17:28:44
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12728 Modified Files: Tag: PDB_VER2 selectform.c trainsched.c Log Message: Fix bug: PageUp / PageDown not working on all 5-way navigation rocker buttons. Remove debug code (HostTrace). Index: trainsched.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.c,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -C2 -d -r1.25.2.1 -r1.25.2.2 *** trainsched.c 2 May 2009 16:21:08 -0000 1.25.2.1 --- trainsched.c 4 May 2009 17:28:36 -0000 1.25.2.2 *************** *** 87,91 **** } ! static Err StartApplication() { RGBColorType customColors[2]; --- 87,91 ---- } ! static Err StartApplication() { RGBColorType customColors[2]; *************** *** 161,166 **** DmDatabaseInfo(CardNo,pdbid,DBName,NULL,&dbVersion,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL); - HostTraceOutputTL(0, "Version of current PDB: %hu", dbVersion); - FrmGotoForm(resFormMain); } else { --- 161,164 ---- *************** *** 182,186 **** } ! static void StopApplication() { prefType prefs; --- 180,184 ---- } ! static void StopApplication() { prefType prefs; *************** *** 202,209 **** } ! Boolean MainFormEventHandler(EventPtr event) { Boolean handled = false; Int16 val, min, max, page; switch (event->eType) { --- 200,208 ---- } ! Boolean MainFormEventHandler(EventPtr event) { Boolean handled = false; Int16 val, min, max, page; + WChar c; switch (event->eType) { *************** *** 256,260 **** } break; ! case sclRepeatEvent: ScrollValue = event->data.sclRepeat.newValue; --- 255,259 ---- } break; ! case sclRepeatEvent: ScrollValue = event->data.sclRepeat.newValue; *************** *** 263,274 **** case keyDownEvent: ! /* Make the physical up/down button scroll the list */ ! if (event->data.keyDown.modifiers & commandKeyMask) { /* physical key */ ! if (event->data.keyDown.chr == chrPageUp) { ! SclGetScrollBar(FrmGetObjectPtr(gpForm, FrmGetObjectIndex(gpForm, resTableScrollBar)), &val, &min, &max, &page); if ( val >= min ) { ! if ((val - min) < page) ScrollValue -= val - min; else --- 262,273 ---- case keyDownEvent: ! c = event->data.keyDown.chr; ! if (TxtGlueCharIsVirtual(event->data.keyDown.modifiers, c)) { ! if ((c == vchrPageUp) || (c == vchrRockerUp)) { ! SclGetScrollBar(FrmGetObjectPtr(gpForm, FrmGetObjectIndex(gpForm, resTableScrollBar)), &val, &min, &max, &page); if ( val >= min ) { ! if ((val - min) < page) ScrollValue -= val - min; else *************** *** 277,281 **** } handled = true; ! } else if (event->data.keyDown.chr == chrPageDown) { SclGetScrollBar(FrmGetObjectPtr(gpForm, FrmGetObjectIndex(gpForm, resTableScrollBar)), --- 276,280 ---- } handled = true; ! } else if ((c == vchrPageDown) || (c == vchrRockerDown)) { SclGetScrollBar(FrmGetObjectPtr(gpForm, FrmGetObjectIndex(gpForm, resTableScrollBar)), *************** *** 292,296 **** } break; ! case ctlSelectEvent: { Int16 temp = 0; --- 291,295 ---- } break; ! case ctlSelectEvent: { Int16 temp = 0; *************** *** 300,304 **** FromStation = temp; LoadMainForm(gpForm); ! LoadMainFormTable(gpForm); handled=true; } else if (event->data.ctlSelect.controlID == resNotesBtn) { --- 299,303 ---- FromStation = temp; LoadMainForm(gpForm); ! LoadMainFormTable(gpForm); handled=true; } else if (event->data.ctlSelect.controlID == resNotesBtn) { *************** *** 316,323 **** } ! static Boolean ApplicationEventHandler(EventPtr event) { Boolean handled = false; ! switch (event->eType) { case frmLoadEvent: { --- 315,322 ---- } ! static Boolean ApplicationEventHandler(EventPtr event) { Boolean handled = false; ! switch (event->eType) { case frmLoadEvent: { *************** *** 366,370 **** } ! static void EventLoop() { EventType event; --- 365,369 ---- } ! static void EventLoop() { EventType event; *************** *** 384,392 **** } ! UInt32 PilotMain(UInt16 launchCode, MemPtr cmdPBP, UInt16 launchFlags) { Err err = 0; ! ! HostTraceInit(); if (launchCode == sysAppLaunchCmdNormalLaunch) { if ((err = StartApplication()) == 0) { --- 383,390 ---- } ! UInt32 PilotMain(UInt16 launchCode, MemPtr cmdPBP, UInt16 launchFlags) { Err err = 0; ! if (launchCode == sysAppLaunchCmdNormalLaunch) { if ((err = StartApplication()) == 0) { *************** *** 395,399 **** } } - HostTraceClose(); return err; } --- 393,396 ---- *************** *** 513,517 **** for (i=0; i<numRows;i++) { TblSetItemStyle(tableP, i, FROMCOL, customTableItem); ! TblSetItemStyle(tableP, i, TOCOL, customTableItem); TblSetItemInt(tableP,i,FROMCOL, -1 ); TblSetItemInt(tableP,i,TOCOL, -1 ); --- 510,514 ---- for (i=0; i<numRows;i++) { TblSetItemStyle(tableP, i, FROMCOL, customTableItem); ! TblSetItemStyle(tableP, i, TOCOL, customTableItem); TblSetItemInt(tableP,i,FROMCOL, -1 ); TblSetItemInt(tableP,i,TOCOL, -1 ); *************** *** 571,582 **** // Nothing displayed yet, so no scrolling required. ! SclSetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, ! resTableScrollBar )), 0, /* current value */ 0, /* min */ 0, /* max */ 1 ); /* page size */ ! return; } --- 568,579 ---- // Nothing displayed yet, so no scrolling required. ! SclSetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, ! resTableScrollBar )), 0, /* current value */ 0, /* min */ 0, /* max */ 1 ); /* page size */ ! return; } *************** *** 586,590 **** toStn = numstations - ToStation - 1; fromStn = numstations - FromStation - 1; ! if (Day != (numdays-1)) maxoffset = OffsetList[Day+numdays+1] - 1; else --- 583,587 ---- toStn = numstations - ToStation - 1; fromStn = numstations - FromStation - 1; ! if (Day != (numdays-1)) maxoffset = OffsetList[Day+numdays+1] - 1; else *************** *** 609,613 **** ScrollMax++; } ! ScrollMax = ScrollMax-(numRows); // We always want to fill the screen if possible. if (ScrollMax < 0) --- 606,610 ---- ScrollMax++; } ! ScrollMax = ScrollMax-(numRows); // We always want to fill the screen if possible. if (ScrollMax < 0) *************** *** 636,640 **** if(frTime != -1) n++; TblSetItemInt(tableP, i, FROMCOL, frTime); ! toTime = getTime(pdbfd, k, toStn); if(toTime != -1) n++; --- 633,637 ---- if(frTime != -1) n++; TblSetItemInt(tableP, i, FROMCOL, frTime); ! toTime = getTime(pdbfd, k, toStn); if(toTime != -1) n++; *************** *** 646,650 **** TblSetItemInt(tableP, i, INFOCOL, getAbbrev(pdbfd, k, toStn)); } ! // The train must stop at both station to be shown. if (n==2) { --- 643,647 ---- TblSetItemInt(tableP, i, INFOCOL, getAbbrev(pdbfd, k, toStn)); } ! // The train must stop at both station to be shown. if (n==2) { *************** *** 663,667 **** i++; } ! k++; } --- 660,664 ---- i++; } ! k++; } *************** *** 683,689 **** /* Update the scroll bar */ ! SclSetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, ! resTableScrollBar )), ScrollValue, /* current value */ 0, /* min */ --- 680,686 ---- /* Update the scroll bar */ ! SclSetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, ! resTableScrollBar )), ScrollValue, /* current value */ 0, /* min */ *************** *** 711,715 **** StrCopy(str, Abbreviations[data-1]); else ! StrCopy(str, ""); } else --- 708,712 ---- StrCopy(str, Abbreviations[data-1]); else ! StrCopy(str, ""); } else *************** *** 742,746 **** } /* Erase previous label */ ! rect = *bounds; WinEraseRectangle( &rect, 0 ); --- 739,743 ---- } /* Erase previous label */ ! rect = *bounds; WinEraseRectangle( &rect, 0 ); Index: selectform.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/selectform.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** selectform.c 2 May 2009 16:21:08 -0000 1.2.2.1 --- selectform.c 4 May 2009 17:28:36 -0000 1.2.2.2 *************** *** 44,47 **** --- 44,48 ---- TablePtr tableP; Int16 rowP, columnP; + WChar c; dbrowType *data; MemHandle TextH; *************** *** 155,162 **** break; } ! break; case keyDownEvent: ! if (event->data.keyDown.modifiers & commandKeyMask) { /* physical key */ ! if (event->data.keyDown.chr == chrPageUp) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), --- 156,164 ---- break; } ! break; case keyDownEvent: ! c = event->data.keyDown.chr; ! if (TxtGlueCharIsVirtual(event->data.keyDown.modifiers, c)) { ! if ((c == vchrPageUp) || (c == vchrRockerUp)) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), *************** *** 170,174 **** } handled = true; ! } else if (event->data.keyDown.chr == chrPageDown) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), --- 172,176 ---- } handled = true; ! } else if ((c == vchrPageDown) || (c == vchrRockerDown)) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), |
|
From: Steve M. <sma...@us...> - 2009-05-04 17:25:01
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12370 Added Files: Tag: PDB_VER2 abbrevform.c abbrevform.h notesform.c notesform.h Log Message: New forms for Abbreviations and Notes display. --- NEW FILE: notesform.h --- /* notesform.h - display train schedule on Palm Pilot * (C) 2009 Steve Martin <sma...@us...> */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Function Prototypes. Boolean notesFormEventHandler(EventPtr event); void LoadNotes(FormPtr pForm, Boolean Update); //void InitAbbrevTable(FormPtr pForm); --- NEW FILE: abbrevform.h --- /* abbrevform.h - display train schedule on Palm Pilot * (C) 2009 Steve Martin <sma...@us...> */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Table columns #define ABBREVCOL 0 #define DEFFNCOL 1 // Function Prototypes. Boolean abbrevFormEventHandler(EventPtr event); void LoadAbbrevTable(FormPtr pForm, Boolean Update); void InitAbbrevTable(FormPtr pForm); --- NEW FILE: notesform.c --- /* notesform.c - display train schedule on Palm Pilot * (C) 2009 Steve Martin <sma...@us...> */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <PalmOS.h> #include <Window.h> #include "trainsched.h" #include "timetable.h" #include "notesform.h" // Global Variables Int16 fieldHeight=0; // External veriables extern char Notes[NOTESLENGTH]; Boolean notesFormEventHandler(EventPtr event) { Boolean handled = false; FormPtr pForm = FrmGetActiveForm(); UInt16 scrollLines; WinDirectionType direction; Int16 val, min, max, page; WChar c; switch (event->eType) { case frmOpenEvent: LoadNotes(pForm, false); FrmDrawForm(pForm); handled = true; break; case ctlSelectEvent: switch (event->data.ctlSelect.controlID) { case notesFrmOKButton: FrmReturnToForm(0); handled = true; break; default: break; } break; case sclRepeatEvent: if (event->data.sclRepeat.newValue > event->data.sclRepeat.value) { scrollLines = event->data.sclRepeat.newValue - event->data.sclRepeat.value; direction = winDown; } else { scrollLines = event->data.sclRepeat.value - event->data.sclRepeat.newValue; direction = winUp; } FldScrollField(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,notesField)), scrollLines, direction); break; case keyDownEvent: c = event->data.keyDown.chr; if (TxtGlueCharIsVirtual(event->data.keyDown.modifiers, c)) { if ((c == vchrPageUp) || (c == vchrRockerUp)) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, notesFieldScrollBar)), &val, &min, &max, &page); if ( val >= min ) { if ((val - min) < page) { scrollLines = val - min; val = min; } else { scrollLines = page; val -= page; } direction = winUp; handled = true; } } else if ((c == vchrPageDown) || (c == vchrRockerDown)) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, notesFieldScrollBar)), &val, &min, &max, &page); if (val < max) { if ((max - val) < page) { scrollLines = max - val; val = max; } else { scrollLines = page; val += page; } direction = winDown; handled = true; } } if (handled) { FldScrollField(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,notesField)), scrollLines, direction); SclSetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, notesFieldScrollBar)), val, 0, max, fieldHeight); } } break; default: break; } return handled; } /* Populates and draw abbrevForm table * Update : false if this is the first call, true for a refresh (scrolling...) */ void LoadNotes(FormPtr pForm, Boolean Update) { FieldPtr fieldP; Int16 scrollPos=0, textHeight=0, scrollMax=0; fieldP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,notesField)); FldSetTextPtr(fieldP, Notes); FldRecalculateField(fieldP, true); FldGetScrollValues(fieldP, &scrollPos, &textHeight, &fieldHeight); if (textHeight > fieldHeight) scrollMax = textHeight - fieldHeight; else if (scrollPos) scrollMax = scrollPos; else scrollMax = 0; SclSetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, notesFieldScrollBar)), scrollPos, 0, scrollMax, fieldHeight); } --- NEW FILE: abbrevform.c --- /* abbrevform.c - display train schedule on Palm Pilot * (C) 2009 Steve Martin <sma...@us...> */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <PalmOS.h> #include "trainsched.h" #include "timetable.h" #include "abbrevform.h" // Global Variables Int16 ScrollAbbrevValue=0; // External veriables extern UInt16 numabbrev; extern char Abbreviations[MAX_ABBREVIATIONS][ABBREVLENGTH]; extern char AbbrevDeffs[MAX_ABBREVIATIONS][ABDEFLENGTH]; Boolean abbrevFormEventHandler(EventPtr event) { Boolean handled = false; FormPtr pForm = FrmGetActiveForm(); Int16 val, min, max, page; RectangleType r; TablePtr tableP; WChar c; switch (event->eType) { case frmOpenEvent: InitAbbrevTable(pForm); // Fall through to the frmUpdateEvent. case frmUpdateEvent: FrmDrawForm(pForm); LoadAbbrevTable(pForm, false); /* Draw the outline of the table */ tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,abbrevFrmTable)); TblGetBounds(tableP, &r); WinDrawRectangleFrame( simpleFrame, &r ); handled = true; break; case sclRepeatEvent: ScrollAbbrevValue = event->data.sclRepeat.newValue; LoadAbbrevTable(pForm, false); break; case ctlSelectEvent: switch (event->data.ctlSelect.controlID) { case abbrevFrmOKButton: FrmReturnToForm(0); handled = true; break; default: break; } break; case keyDownEvent: c = event->data.keyDown.chr; if (TxtGlueCharIsVirtual(event->data.keyDown.modifiers, c)) { if ((c == vchrPageUp) || (c == vchrRockerUp)) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, abbrevFrmTableScrollBar)), &val, &min, &max, &page); if ( val >= min ) { if ((val - min) < page) ScrollAbbrevValue -= (val - min); else ScrollAbbrevValue -= page; LoadAbbrevTable(pForm, false); } handled = true; } else if ((c == vchrPageDown) || (c == vchrRockerDown)) { SclGetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, abbrevFrmTableScrollBar)), &val, &min, &max, &page); if (val < max) { if ((max - val) < page) ScrollAbbrevValue += (max - val); else ScrollAbbrevValue += page; LoadAbbrevTable(pForm, false); } handled = true; } } break; default: break; } return handled; } /* Draws items in Abbreviation table */ void AbbrevTableDrawItem(void *table, Int16 row, Int16 column, RectanglePtr bounds) { TablePtr tableP = (TablePtr)table; char str[ABDEFLENGTH]; UInt16 data; // Abbreviation number. data = TblGetItemInt(tableP, row, column); if (column == ABBREVCOL) { StrCopy(str, Abbreviations[data]); FntSetFont(stdFont); WinDrawChars(str, StrLen(str), bounds->topLeft.x+2, bounds->topLeft.y); } else { StrCopy(str, AbbrevDeffs[data]); FntSetFont(stdFont); WinDrawChars(str, StrLen(str), bounds->topLeft.x+2, bounds->topLeft.y); } } /* Initialize The abbrevForm Table */ void InitAbbrevTable(FormPtr pForm) { TablePtr tableP; Int32 i; UInt16 numRows=0; tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,abbrevFrmTable)); numRows = TblGetNumberOfRows(tableP); /* Setup the rows of the table */ for(i=0; i<numRows; i++) { TblSetItemStyle(tableP, i, ABBREVCOL, customTableItem); TblSetItemStyle(tableP, i, DEFFNCOL, customTableItem); TblSetRowUsable(tableP, i, false); TblSetRowSelectable(tableP, i, false); } /* Make sure the columns are usable - so they draw */ TblSetColumnUsable(tableP, ABBREVCOL, true); TblSetColumnUsable(tableP, DEFFNCOL, true); TblHasScrollBar(tableP, true); /* Set our custom table item draw callback */ TblSetCustomDrawProcedure(tableP, ABBREVCOL, AbbrevTableDrawItem); TblSetCustomDrawProcedure(tableP, DEFFNCOL, AbbrevTableDrawItem); } /* Populates and draw abbrevForm table * Update : false if this is the first call, true for a refresh (scrolling...) */ void LoadAbbrevTable(FormPtr pForm, Boolean Update) { TablePtr tableP; Int16 i=0, oldscrollvalue=0; UInt16 numRows=0; tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,abbrevFrmTable)); numRows = TblGetNumberOfRows(tableP); oldscrollvalue = ScrollAbbrevValue; /* avoid scrolling too much */ if ((numabbrev - ScrollAbbrevValue) < numRows) { if (numabbrev > numRows) { ScrollAbbrevValue = numabbrev-numRows; } else { ScrollAbbrevValue = 0; } } for (i=0; i<numRows; i++) { if ((i+ScrollAbbrevValue)<numabbrev) { TblSetItemInt(tableP, i, ABBREVCOL, i+ScrollAbbrevValue); TblSetItemInt(tableP, i, DEFFNCOL, i+ScrollAbbrevValue); TblSetRowUsable(tableP, i, true); } else { TblSetRowUsable(tableP, i, false); } } SclSetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, abbrevFrmTableScrollBar)), ScrollAbbrevValue, /* current value */ 0, /* min */ numabbrev > numRows ? numabbrev-numRows : 0, /*max*/ numRows-1 ); /* page size */ TblEraseTable(tableP); TblDrawTable(tableP); } |
|
From: Steve M. <sma...@us...> - 2009-05-04 17:21:51
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12040 Modified Files: Tag: PDB_VER2 timetable.c Log Message: Fix bug when exactly one abbreviation defined. Index: timetable.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/timetable.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** timetable.c 2 May 2009 16:21:08 -0000 1.2.2.1 --- timetable.c 4 May 2009 17:21:43 -0000 1.2.2.2 *************** *** 251,259 **** } AbbrevDeffs[numabbrev][strPos]='\0'; ! numabbrev++; // release lock on record. MemHandleUnlock(hAbbrevRec); ! if (numabbrev > 1) { abbrevDefined = true; } --- 251,259 ---- } AbbrevDeffs[numabbrev][strPos]='\0'; ! if (recPos > 0) numabbrev++; // Count the last one too. // release lock on record. MemHandleUnlock(hAbbrevRec); ! if (numabbrev > 0) { abbrevDefined = true; } |
|
From: Steve M. <sma...@us...> - 2009-05-04 17:19:48
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11765 Modified Files: Tag: PDB_VER2 Makefile Log Message: Add PalmOSGlue library dependency. Remove debug symbol generation. Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.7.2.2 retrieving revision 1.7.2.3 diff -C2 -d -r1.7.2.2 -r1.7.2.3 *** Makefile 2 May 2009 16:21:08 -0000 1.7.2.2 --- Makefile 4 May 2009 17:19:44 -0000 1.7.2.3 *************** *** 3,6 **** --- 3,7 ---- VERS=0.5pre2 + SDK_LOCATION = "C:/Program Files/Palm OS Developer Suite/sdk-5r4/" PROGRAM=trainsched *************** *** 11,15 **** BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall -O0 -g LFLAGS=-g --- 12,16 ---- BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall LFLAGS=-g *************** *** 18,22 **** PRC=$(PROGRAM).prc RESOURCES=$(PROGRAM).rcp ! #### --- 19,23 ---- PRC=$(PROGRAM).prc RESOURCES=$(PROGRAM).rcp ! LIBS=${SDK_LOCATION}/lib/m68k-palmos-coff/libPalmOSGlue.a #### *************** *** 29,33 **** $(PROGRAM): $(OBJS) ! $(CC) -o $(PROGRAM) $(OBJS) $(LFLAGS) $(OBJRES) $(PROGRAM) --- 30,34 ---- $(PROGRAM): $(OBJS) ! $(CC) -o $(PROGRAM) $(OBJS) $(LIBS) $(LFLAGS) $(OBJRES) $(PROGRAM) |
|
From: Steve M. <sma...@us...> - 2009-05-04 17:18:21
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11551 Modified Files: Tag: PDB_VER2 csv2trainschedpdb.c Log Message: Fix bug: Bad PDB generated when exactly one abbreviation defined. Index: csv2trainschedpdb.c =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csv2trainschedpdb.c,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** csv2trainschedpdb.c 2 May 2009 16:18:13 -0000 1.7.2.1 --- csv2trainschedpdb.c 4 May 2009 17:18:12 -0000 1.7.2.2 *************** *** 55,59 **** * record number */ - int writerecordinfo(FILE *pdbfd, unsigned int record_num, long pos) { --- 55,58 ---- *************** *** 84,88 **** { FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0; char temp[LGMAXNOMGARE+1]={0}; int cur_record; --- 83,87 ---- { FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0, datawtn=0; char temp[LGMAXNOMGARE+1]={0}; int cur_record; *************** *** 262,265 **** --- 261,265 ---- if (num_colon < 4) { // Only for 2.0 Version PDB files. /* read Abbreviations List */ + datawtn = 0; for(;;) { c = fgetc(fd); *************** *** 268,271 **** --- 268,272 ---- if (c != '\n') { fwrite(&c,1,1,pdbfd); + datawtn = 1; } else { fwrite("\x0",1,1,pdbfd); *************** *** 273,277 **** } } ! nabbrev++; printf("%i abbreviations found\n",nabbrev); --- 274,278 ---- } } ! if (datawtn) nabbrev++; // Only if we wrote at lease /something/. printf("%i abbreviations found\n",nabbrev); *************** *** 282,285 **** --- 283,287 ---- /* read Abbreviations Definitions */ + datawtn = 0; for(;;) { c = fgetc(fd); *************** *** 288,291 **** --- 290,294 ---- if (c != '\n') { fwrite(&c,1,1,pdbfd); + datawtn = 1; } else { fwrite("\x0",1,1,pdbfd); *************** *** 293,297 **** } } ! nabdef++; if (nabbrev != nabdef) { --- 296,300 ---- } } ! if (datawtn) nabdef++; // Only if we wrote at lease /something/. if (nabbrev != nabdef) { *************** *** 381,385 **** // If no defined abbreviations, write a blank ! if ((c != ':') && (nabbrev == 1)) { fwrite("\x0",1,1,pdbfd); } --- 384,388 ---- // If no defined abbreviations, write a blank ! if ((c != ':') && (nabbrev == 0)) { fwrite("\x0",1,1,pdbfd); } |
|
From: Steve M. <sma...@us...> - 2009-05-02 16:21:16
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18942 Modified Files: Tag: PDB_VER2 Makefile selectform.c selectform.h timetable.c timetable.h trainsched.c trainsched.h trainsched.rcp Log Message: First Beta of updates for PDB Version 2 files (PDB Version 1 files are still supported). Index: selectform.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/selectform.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** selectform.h 26 Apr 2009 08:06:50 -0000 1.2 --- selectform.h 2 May 2009 16:21:08 -0000 1.2.2.1 *************** *** 23,28 **** --- 23,32 ---- LocalID pdbid; UInt16 CardNo; + UInt16 Version; } dbrowType; + // Table columns + #define SELECTCOL 0 + // Function Prototypes. Boolean selectFormEventHandler(EventPtr event); Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** Makefile 26 Apr 2009 08:14:56 -0000 1.7.2.1 --- Makefile 2 May 2009 16:21:08 -0000 1.7.2.2 *************** *** 2,6 **** # Macros ! VERS=0.4 PROGRAM=trainsched --- 2,6 ---- # Macros ! VERS=0.5pre2 PROGRAM=trainsched *************** *** 11,19 **** BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall -g LFLAGS=-g ! SOURCES=selectform.c timetable.c trainsched.c ! OBJS=selectform.o timetable.o trainsched.o PRC=$(PROGRAM).prc RESOURCES=$(PROGRAM).rcp --- 11,19 ---- BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall -O0 -g LFLAGS=-g ! SOURCES=selectform.c abbrevform.c notesform.ctimetable.c trainsched.c ! OBJS=selectform.o abbrevform.o notesform.o timetable.o trainsched.o PRC=$(PROGRAM).prc RESOURCES=$(PROGRAM).rcp Index: selectform.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/selectform.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** selectform.c 26 Apr 2009 08:06:50 -0000 1.2 --- selectform.c 2 May 2009 16:21:08 -0000 1.2.2.1 *************** *** 33,36 **** --- 33,37 ---- extern LocalID pdbid; extern UInt16 CardNo; + extern UInt16 dbVersion; extern char DBName[dmDBNameLength]; *************** *** 84,87 **** --- 85,89 ---- pdbid = data->pdbid; CardNo = data->CardNo; + dbVersion = data->Version; MemMove (DBName,data->DBName,dmDBNameLength); } *************** *** 253,257 **** Boolean newSearch = true; DmSearchStateType searchState; ! UInt16 CardNo; LocalID dbID; char name[dmDBNameLength]; --- 255,259 ---- Boolean newSearch = true; DmSearchStateType searchState; ! UInt16 CardNo, version; LocalID dbID; char name[dmDBNameLength]; *************** *** 279,283 **** if (selpdbcount > 0) { pdbarrayH = MemHandleNew(selpdbcount * sizeof(dbrowType)); ! pdbarrayP=MemHandleLock(pdbarrayH); newSearch = true; --- 281,285 ---- if (selpdbcount > 0) { pdbarrayH = MemHandleNew(selpdbcount * sizeof(dbrowType)); ! pdbarrayP = MemHandleLock(pdbarrayH); newSearch = true; *************** *** 288,292 **** newSearch=false; ! DmDatabaseInfo(CardNo, dbID, name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); --- 290,294 ---- newSearch=false; ! DmDatabaseInfo(CardNo, dbID, name, NULL, &version, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); *************** *** 294,298 **** pdbarrayP[selpdbcount].CardNo = CardNo; pdbarrayP[selpdbcount].pdbid = dbID; ! selpdbcount++; } --- 296,300 ---- pdbarrayP[selpdbcount].CardNo = CardNo; pdbarrayP[selpdbcount].pdbid = dbID; ! pdbarrayP[selpdbcount].Version = version; selpdbcount++; } *************** *** 334,338 **** oldscrollvalue, /* current value */ 0, /* min */ ! selpdbcount >= numRows ? selpdbcount-numRows+1 : 0, /*max*/ numRows-1 ); /* page size */ --- 336,340 ---- oldscrollvalue, /* current value */ 0, /* min */ ! selpdbcount >= numRows ? selpdbcount-numRows : 0, /*max*/ numRows-1 ); /* page size */ Index: trainsched.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.h,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** trainsched.h 26 Apr 2009 08:06:50 -0000 1.11 --- trainsched.h 2 May 2009 16:21:08 -0000 1.11.2.1 *************** *** 34,37 **** --- 34,38 ---- #define resReverseBtn 1009 #define resTimeTable3c 1010 + #define resNotesBtn 1011 /* Menu */ *************** *** 46,50 **** #define aboutBitmap 1102 ! /* Database selection dialog */ #define selectForm 1200 #define selectFrmTable 1201 --- 47,51 ---- #define aboutBitmap 1102 ! /* Timetable selection dialog */ #define selectForm 1200 #define selectFrmTable 1201 *************** *** 55,61 **** #define selectFrmCancel 1206 /* Alert Dialog */ #define alertDialog1 1300 - #define alertAbbreviations 1306 #define NO_PDB 1301 #define NO_SELECTION 1302 --- 56,73 ---- #define selectFrmCancel 1206 + /* Abbreviations dialog */ + #define abbrevForm 1400 + #define abbrevFrmTable 1401 + #define abbrevFrmTableScrollBar 1402 + #define abbrevFrmOKButton 1403 + + /* Abbreviations dialog */ + #define notesForm 1500 + #define notesField 1501 + #define notesFieldScrollBar 1502 + #define notesFrmOKButton 1503 + /* Alert Dialog */ #define alertDialog1 1300 #define NO_PDB 1301 #define NO_SELECTION 1302 *************** *** 69,73 **** #define TOCOL 1 #define INFOCOL 2 - #define SELECTCOL 0 #define PREFAPPVERSION 2 --- 81,84 ---- Index: timetable.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/timetable.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** timetable.h 26 Apr 2009 08:06:50 -0000 1.2 --- timetable.h 2 May 2009 16:21:08 -0000 1.2.2.1 *************** *** 20,30 **** #define DAYRECORD 1 #define OFFSETRECORD 2 #define STATIONMAXNUM 30 #define STATIONMAXLENGTH 20 #define DAYMAXLENGTH 9 #define MAX_ABBREVIATIONS 40 ! #define ABBR_PDB 'ABBR' // Function prototypes --- 20,40 ---- #define DAYRECORD 1 #define OFFSETRECORD 2 + // The next three records are only in version 0.2 PDB onwards. + #define ABBREVRECORD 3 // Shorthand abbreviations / symbols. + #define ABDEFRECORD 4 // Expanded abbreviation definitions. + #define NOTESRECORD 5 // Notes specific to this timetable. #define STATIONMAXNUM 30 #define STATIONMAXLENGTH 20 #define DAYMAXLENGTH 9 + #define ABBREVLENGTH 6 + #define ABDEFLENGTH 24 #define MAX_ABBREVIATIONS 40 + #define NOTESLENGTH 512 ! #define ABBR_PDB 'ABBR' // Only relevant to version 0.1 of PDB. ! ! #define VERSION_1_0 0x0100 // Original PDB Version. ! #define VERSION_2_0 0x0200 // Updated PDB Version that may include abbreviations. // Function prototypes *************** *** 32,38 **** Boolean getAbbreviationsDefined(); UInt16 getNumberOfRecords(); ! void getAbbreviations(); Int16 getDays(DmOpenRef pdbfd); Int16 getOffsets(DmOpenRef pdbfd); Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station); ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum); --- 42,49 ---- Boolean getAbbreviationsDefined(); UInt16 getNumberOfRecords(); ! void getAbbreviations(DmOpenRef pdbfd); Int16 getDays(DmOpenRef pdbfd); Int16 getOffsets(DmOpenRef pdbfd); Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station); ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum, Int8 station); ! Boolean getNotesDefined(DmOpenRef pdbfd); Index: trainsched.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.c,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -C2 -d -r1.25 -r1.25.2.1 *** trainsched.c 26 Apr 2009 08:06:50 -0000 1.25 --- trainsched.c 2 May 2009 16:21:08 -0000 1.25.2.1 *************** *** 22,25 **** --- 22,27 ---- #include "timetable.h" #include "selectform.h" + #include "abbrevform.h" + #include "notesform.h" /* To store program preferences */ *************** *** 34,37 **** --- 36,42 ---- } prefType; + /* External veriables */ + extern UInt16 dbVersion; /* Version of currently open timetable DB. */ + /* Global variables */ LocalID pdbid=0; *************** *** 45,49 **** char DayNames[7][DAYMAXLENGTH+1]={{0},{0}}; UInt16 OffsetList[14]={0}; /* Max 7 days and 2 directions */ ! UInt16 numstations=0,numdays=0; Int16 ScrollValue=0; UInt8 FromStation = NOSELECTION; --- 50,54 ---- char DayNames[7][DAYMAXLENGTH+1]={{0},{0}}; UInt16 OffsetList[14]={0}; /* Max 7 days and 2 directions */ ! UInt16 numstations=0, numdays=0, numabbrev=0; Int16 ScrollValue=0; UInt8 FromStation = NOSELECTION; *************** *** 54,59 **** Boolean bUse3Cols = false; /* Whether to use Annotation column. */ UInt16 nIDofTable = resTimeTable; /* Which table to use 2 or 3 column one. */ ! char Abbreviations[MAX_ABBREVIATIONS][10]={{0},{0}}; /* Store abbreviations. */ ! Char szAbbreviations[300]; /* --- 59,65 ---- Boolean bUse3Cols = false; /* Whether to use Annotation column. */ UInt16 nIDofTable = resTimeTable; /* Which table to use 2 or 3 column one. */ ! char Abbreviations[MAX_ABBREVIATIONS][ABBREVLENGTH]={{0},{0}}; /* Store abbreviations. */ ! char AbbrevDeffs[MAX_ABBREVIATIONS][ABDEFLENGTH]={{0},{0}}; /* Store abbreviation deffs. */ ! char Notes[NOTESLENGTH]={0}; /* Store timetable notes. */ /* *************** *** 139,143 **** --- 145,153 ---- if (pdbid != 0) + { + DmDatabaseInfo(CardNo,pdbid,DBName,NULL,&dbVersion,NULL,NULL,NULL, + NULL,NULL,NULL,NULL,NULL); FrmGotoForm(resFormMain); + } } *************** *** 149,154 **** PDBTYPE, CREATORID, false, &CardNo, &pdbid)) { ! DmDatabaseInfo(CardNo,pdbid,DBName,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL); FrmGotoForm(resFormMain); --- 159,165 ---- PDBTYPE, CREATORID, false, &CardNo, &pdbid)) { ! DmDatabaseInfo(CardNo,pdbid,DBName,NULL,&dbVersion,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL); + HostTraceOutputTL(0, "Version of current PDB: %hu", dbVersion); FrmGotoForm(resFormMain); *************** *** 291,294 **** --- 302,308 ---- LoadMainFormTable(gpForm); handled=true; + } else if (event->data.ctlSelect.controlID == resNotesBtn) { + FrmPopupForm(notesForm); + handled = true; } } *************** *** 319,322 **** --- 333,345 ---- FrmSetEventHandler(pForm, (FormEventHandlerPtr)selectFormEventHandler); handled = true; + break; + case abbrevForm: + FrmSetEventHandler(pForm, (FormEventHandlerPtr)abbrevFormEventHandler); + handled = true; + break; + case notesForm: + FrmSetEventHandler(pForm, (FormEventHandlerPtr)notesFormEventHandler); + handled = true; + break; default: break; *************** *** 365,368 **** --- 388,392 ---- Err err = 0; + HostTraceInit(); if (launchCode == sysAppLaunchCmdNormalLaunch) { if ((err = StartApplication()) == 0) { *************** *** 371,374 **** --- 395,399 ---- } } + HostTraceClose(); return err; } *************** *** 382,385 **** --- 407,411 ---- status = getStationNames(pdbfd); + getAbbreviations(pdbfd); if (getAbbreviationsDefined()) *************** *** 387,391 **** bUse3Cols = true; nIDofTable = resTimeTable3c; /* Use 3 column table. */ - getAbbreviations(); } else --- 413,416 ---- *************** *** 405,408 **** --- 430,439 ---- status = getOffsets(pdbfd); + // Only show the notes button if there are timetable notes defined. + if (getNotesDefined(pdbfd)) + FrmShowObject(gpForm, FrmGetObjectIndex(gpForm, resNotesBtn)); + else + FrmHideObject(gpForm, FrmGetObjectIndex(gpForm, resNotesBtn)); + DmCloseDatabase(pdbfd); } *************** *** 446,450 **** } - popupDays=FrmGetObjectPtr(gpForm,(FrmGetObjectIndex (pForm,resDayList))); LstSetListChoices(popupDays,DayList,numdays); --- 477,480 ---- *************** *** 614,618 **** if (bUse3Cols) { ! TblSetItemInt(tableP, i, INFOCOL, getAbbrev(pdbfd, k)); } --- 644,648 ---- if (bUse3Cols) { ! TblSetItemInt(tableP, i, INFOCOL, getAbbrev(pdbfd, k, toStn)); } *************** *** 644,648 **** for (i=1; i<numRows; i++) { ! if (TblGetItemInt(tableP, i-1, FROMCOL) >= 0) { rowheight=TblGetRowHeight(tableP,i); --- 674,678 ---- for (i=1; i<numRows; i++) { ! if (TblGetItemInt(tableP, i-1, FROMCOL) != -1) { rowheight=TblGetRowHeight(tableP,i); *************** *** 667,676 **** { TablePtr tableP = (TablePtr)table; ! UInt16 data; char str[6]={0}; RectangleType rect; ! UInt8 Hour,Minute; char temp[8]={0}; - Int32 i; data = TblGetItemInt(tableP,row,column); --- 697,705 ---- { TablePtr tableP = (TablePtr)table; ! Int16 data; char str[6]={0}; RectangleType rect; ! Int8 Hour,Minute; char temp[8]={0}; data = TblGetItemInt(tableP,row,column); *************** *** 679,684 **** if ((bUse3Cols) && (column==INFOCOL)) { ! if (data && (data < MAX_ABBREVIATIONS)) ! StrCopy(str, Abbreviations[data]); else StrCopy(str, ""); --- 708,713 ---- if ((bUse3Cols) && (column==INFOCOL)) { ! if (data && (data <= numabbrev)) ! StrCopy(str, Abbreviations[data-1]); else StrCopy(str, ""); *************** *** 686,716 **** else { ! if(data==-1) { ! /* no data was found */ StrPrintF(str," "); - } else if (data==65535) { /* No train */ - StrPrintF(str," -- "); } else { ! ! StrIToA(temp, data); ! ! if (StrLen(temp) < 3) { /* train is between 00:00 and 00:09 */ ! // Hour = 0; ! // Minute = temp[0]; ! // } else if (StrLen(temp) == 2) { /* train is between 00:10 and 00:59 */ ! Hour = 0; ! Minute = StrAToI(temp); } else { ! i = StrLen(temp); ! Minute = (StrAToI(&temp[i-2])); ! ! temp[i-2] = '\0'; ! Hour = StrAToI(temp); } - - /* Maybe I should use TimeToAscii for that */ - if (Hour < 10) StrCat(str, "0"); - StrIToA(temp, Hour); - StrCat(str, temp); StrCat(str,":"); StrIToA(temp, Minute); --- 715,731 ---- else { ! Hour = data >> 8; ! Minute = data & 0xFF; ! if (Hour == -1) { ! /* no data was found or no train. */ StrPrintF(str," "); } else { ! if (Hour == -2) { /* Wildcard */ ! StrPrintF(str,"#"); } else { ! if (Hour < 10) StrCat(str, "0"); ! StrIToA(temp, Hour); ! StrCat(str, temp); } StrCat(str,":"); StrIToA(temp, Minute); *************** *** 769,773 **** case MainOptionsAbbreviations: ! FrmCustomAlert( alertAbbreviations, szAbbreviations, "", "" ); handled = true; break; --- 784,788 ---- case MainOptionsAbbreviations: ! FrmPopupForm(abbrevForm); handled = true; break; *************** *** 797,801 **** len = StrLen(DBName); ! if(len>31) len = 31; /* bad hack */ StrNCopy(FormTitle,DBName,len); --- 812,816 ---- len = StrLen(DBName); ! if(len>26) len = 26; /* bad hack, allow room for time. */ StrNCopy(FormTitle,DBName,len); Index: trainsched.rcp =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.rcp,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** trainsched.rcp 26 Apr 2009 08:07:21 -0000 1.15 --- trainsched.rcp 2 May 2009 16:21:08 -0000 1.15.2.1 *************** *** 20,24 **** #include "trainsched.h" ! VERSION ID 1 "0.5.0" --- 20,24 ---- #include "trainsched.h" ! VERSION ID 1 "0.6.0 beta" *************** *** 74,79 **** USABLE ! ! BUTTON "Reverse" ID resReverseBtn AT (100 18 AUTO AUTO) END --- 74,79 ---- USABLE ! BUTTON "Reverse" ID resReverseBtn AT (64 18 AUTO AUTO) ! BUTTON "Notes" ID resNotesBtn AT (PREVRIGHT+8 18 AUTO AUTO) END *************** *** 110,114 **** LABEL "Released under the GNU GPL" AUTOID AT (8 PrevTop+16) FONT 1 ! LABEL "version 0.5.0pre2" AUTOID AT (8 PrevTop+12) FONT 1 BUTTON "Ok" ID aboutFormOkButton AT (100 138 36 AUTO) --- 110,114 ---- LABEL "Released under the GNU GPL" AUTOID AT (8 PrevTop+16) FONT 1 ! LABEL "version 0.6 beta" AUTOID AT (8 PrevTop+12) FONT 1 BUTTON "Ok" ID aboutFormOkButton AT (100 138 36 AUTO) *************** *** 134,137 **** --- 134,165 ---- END + /* Abbreviations Dialog box */ + FORM ID abbrevForm AT (2 2 156 156) USABLE MODAL + BEGIN + TITLE "Abbreviations" + + TABLE ID abbrevFrmTable AT (2 14 144 121) + ROWS 11 COLUMNS 2 COLUMNWIDTHS 40 104 + + SCROLLBAR ID abbrevFrmTableScrollBar AT (PREVRIGHT+2 PREVTOP 7 PREVHEIGHT) + USABLE + + BUTTON "Ok" ID abbrevFrmOKButton AT (100 PREVTOP+125 40 AUTO) USABLE + END + + /* Notes Dialog box */ + FORM ID notesForm AT (2 2 156 156) USABLE MODAL + BEGIN + TITLE "Timetable Notes" + + FIELD ID notesField AT (2 14 144 121) + NONEDITABLE MULTIPLELINES HASSCROLLBAR + + SCROLLBAR ID notesFieldScrollBar AT (PREVRIGHT+2 PREVTOP 7 PREVHEIGHT) + USABLE + + BUTTON "Ok" ID notesFrmOKButton AT (100 PREVTOP+125 40 AUTO) USABLE + END + ALERT ID alertDialog1 WARNING *************** *** 142,153 **** END - ALERT ID alertAbbreviations - INFORMATION - BEGIN - TITLE "Abbreviations" - MESSAGE "^1" - BUTTONS "OK" - END - STRING ID NO_PDB "No timetables found, please install one first (see http://trainsched.sf.net)." STRING ID NO_SELECTION "You must select a timetable first." --- 170,173 ---- Index: timetable.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/timetable.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** timetable.c 26 Apr 2009 08:06:50 -0000 1.2 --- timetable.c 2 May 2009 16:21:08 -0000 1.2.2.1 *************** *** 25,33 **** extern char DayNames[7][DAYMAXLENGTH+1]; extern UInt16 OffsetList[14]; ! extern UInt16 numstations,numdays; ! extern char Abbreviations[MAX_ABBREVIATIONS][10]; ! extern char szAbbreviations[300]; UInt16 NumRecords=0; Boolean abbrevDefined; --- 25,35 ---- extern char DayNames[7][DAYMAXLENGTH+1]; extern UInt16 OffsetList[14]; ! extern UInt16 numstations, numdays, numabbrev; ! extern char Abbreviations[MAX_ABBREVIATIONS][ABBREVLENGTH]; ! extern char AbbrevDeffs[MAX_ABBREVIATIONS][ABDEFLENGTH]; ! extern char Notes[NOTESLENGTH]; UInt16 NumRecords=0; + UInt16 dbVersion; Boolean abbrevDefined; *************** *** 42,47 **** char *recordP; MemHandle rec_mh; ! UInt16 recPos; ! UInt16 strPos; Int16 result = false; --- 44,48 ---- char *recordP; MemHandle rec_mh; ! UInt16 recPos, strPos; Int16 result = false; *************** *** 82,86 **** // Special case if last Station name is DUMMY, it is the abbreviations column. if (StrNCompare("DUMMY", StationNames[numstations-1], 5) == 0) { ! abbrevDefined=true; numstations--; } --- 83,87 ---- // Special case if last Station name is DUMMY, it is the abbreviations column. if (StrNCompare("DUMMY", StationNames[numstations-1], 5) == 0) { ! abbrevDefined=true; // For 0.1 PDBs this is the only way to know. numstations--; } *************** *** 112,183 **** /* ! * Get the Abbreviations. This function sets the global variable Abbreviations ! * either from a defined database, or default values if the database does not exist. */ ! void getAbbreviations() { DmOpenRef hAbbrevDb; DmSearchStateType searchState; ! UInt16 nNumRecords, uCardNum; ! Int16 i, strLen; LocalID lID; MemHandle hAbbrevRec; ! uCardNum = 0; ! // See if there is an Abbreviations Database. ! if (0 == DmGetNextDatabaseByTypeCreator(true, &searchState, ABBR_PDB, CREATORID, false, &uCardNum, &lID)) { ! // Yes, load the defined Abbreviations from it. ! hAbbrevDb = DmOpenDatabase(uCardNum, lID, dmModeReadOnly); ! if (hAbbrevDb != 0) { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, 0); ! StrCopy(szAbbreviations, MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! /* Convert '|' to '\n'. */ ! strLen = StrLen(szAbbreviations); ! for (i=0; i<strLen; i++) ! if (szAbbreviations[i] == '|') szAbbreviations[i] = '\n'; ! ! nNumRecords = DmNumRecords(hAbbrevDb); ! /* Read in the abbreviations. */ ! for (i=1; i<=MAX_ABBREVIATIONS; i++) { ! /* Default to an empty string. */ ! StrCopy(Abbreviations[i], ""); ! ! /* Ensure index is in range because some releases will */ ! /* display fatal error message if DmQueryRecords() called */ ! /* an out-of-range record number. */ ! if (i <= nNumRecords) { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, i); ! if (hAbbrevRec != NULL) { ! StrCopy(Abbreviations[i], MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); } } } } } ! else { ! // No Abbreviations DB, use default values. ! StrCopy( szAbbreviations, "EWD = Mon to Sat\nM-F = Monday to Friday\nT-F = Tuesday to Friday\nMO/WO/FO/SO = Mon/Wed/Fri/Sat only\nWX/FX = Except Wed/Fri\nFSX = Fri/Sat excluded\nFSO = Fri/Sat only\nM-TH = Mon to Thurs" ); ! for (i=1; i<=MAX_ABBREVIATIONS; i++) StrCopy(Abbreviations[i], ""); ! StrCopy(Abbreviations[1], "EWD"); ! StrCopy(Abbreviations[2], "M-F"); ! StrCopy(Abbreviations[3], "FO"); ! StrCopy(Abbreviations[4], "SO"); ! StrCopy(Abbreviations[5], "T-F"); ! StrCopy(Abbreviations[6], "MO"); ! StrCopy(Abbreviations[7], "WO"); ! StrCopy(Abbreviations[8], "WX"); ! StrCopy(Abbreviations[9], "FX"); ! StrCopy(Abbreviations[10], "FSX"); ! StrCopy(Abbreviations[11], "FSO"); ! StrCopy(Abbreviations[12], "M-TH"); } } --- 113,263 ---- /* ! * Get the Abbreviations. This function sets the global variable Abbreviations. ! * For version 0.1 PDB files this is either from a defined database, or default ! * values if the database does not exist. For a 0.2 PDB file then it is from ! * within the PDB itself. */ ! void getAbbreviations(DmOpenRef pdbfd) { DmOpenRef hAbbrevDb; DmSearchStateType searchState; ! UInt16 nNumRecords, uCardNum=0; ! UInt16 recPos, strPos; ! Int16 i; LocalID lID; MemHandle hAbbrevRec; ! char *recordP; ! numabbrev = 0; ! ! if (dbVersion == VERSION_1_0) { ! // See if there is an Abbreviations Database. ! if (0 == DmGetNextDatabaseByTypeCreator(true, &searchState, ABBR_PDB, CREATORID, false, &uCardNum, &lID)) { ! // Yes, load the defined Abbreviations from it. ! hAbbrevDb = DmOpenDatabase(uCardNum, lID, dmModeReadOnly); ! if (hAbbrevDb != 0) { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, 0); ! // StrCopy(szAbbreviations, MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! /* Convert '|' to '\n'. */ ! // strLen = StrLen(szAbbreviations); ! // for (i=0; i<strLen; i++) ! // if (szAbbreviations[i] == '|') szAbbreviations[i] = '\n'; ! ! nNumRecords = DmNumRecords(hAbbrevDb); ! /* Read in the abbreviations. */ ! for (i=1; i<=MAX_ABBREVIATIONS; i++) { ! /* Default to an empty string. */ ! StrCopy(Abbreviations[i], ""); ! ! /* Ensure index is in range because some releases will */ ! /* display fatal error message if DmQueryRecords() called */ ! /* an out-of-range record number. */ ! if (i <= nNumRecords) { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, i); ! if (hAbbrevRec != NULL) ! { ! StrCopy(Abbreviations[i], MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! } } } + numabbrev = i; } } + else + { + // No Abbreviations DB, use default values. + StrCopy(Abbreviations[0], "EWD"); + StrCopy(Abbreviations[1], "M-F"); + StrCopy(Abbreviations[2], "FO"); + StrCopy(Abbreviations[3], "SO"); + StrCopy(Abbreviations[4], "T-F"); + StrCopy(Abbreviations[5], "MO"); + StrCopy(Abbreviations[6], "WO"); + StrCopy(Abbreviations[7], "WX"); + StrCopy(Abbreviations[8], "FX"); + StrCopy(Abbreviations[9], "FSX"); + StrCopy(Abbreviations[10], "FSO"); + StrCopy(Abbreviations[11], "M-TH"); + StrCopy(AbbrevDeffs[0], "Mon to Sat"); + StrCopy(AbbrevDeffs[1], "Monday to Friday"); + StrCopy(AbbrevDeffs[2], "Friday Only"); + StrCopy(AbbrevDeffs[3], "Saturday Only"); + StrCopy(AbbrevDeffs[4], "Tuesday to Friday"); + StrCopy(AbbrevDeffs[5], "Monday Only"); + StrCopy(AbbrevDeffs[6], "Wednesday Only"); + StrCopy(AbbrevDeffs[7], "Except for Wed"); + StrCopy(AbbrevDeffs[8], "Except for Fri"); + StrCopy(AbbrevDeffs[9], "Except for Fri & Sat"); + StrCopy(AbbrevDeffs[10], "Fri & Sat Only"); + StrCopy(AbbrevDeffs[11], "Monday to Thurs"); + numabbrev = 12; + } } ! if (dbVersion == VERSION_2_0) { ! // This version of PDB files has an abbreviations record) ! // Get number of records in database. ! if (NumRecords > ABDEFRECORD) // Since we will load both records. ! { ! // populate Abbreviations from database. ! hAbbrevRec = DmQueryRecord(pdbfd, ABBREVRECORD); ! if (hAbbrevRec) ! { ! recordP = MemHandleLock(hAbbrevRec); ! recPos = 0; ! strPos = 0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '\t') { ! Abbreviations[numabbrev][strPos]='\0'; ! numabbrev++; ! strPos=0; ! } else { ! Abbreviations[numabbrev][strPos]=recordP[recPos]; ! strPos++; ! } ! recPos++; ! } ! Abbreviations[numabbrev][strPos]='\0'; ! numabbrev++; ! // release lock on record. ! MemHandleUnlock(hAbbrevRec); ! } ! // populate Abbreviation Deffs from database. ! hAbbrevRec = DmQueryRecord(pdbfd, ABDEFRECORD); ! if (hAbbrevRec) ! { ! recordP = MemHandleLock(hAbbrevRec); ! recPos = 0; ! strPos = 0; ! numabbrev = 0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '\t') { ! AbbrevDeffs[numabbrev][strPos]='\0'; ! numabbrev++; ! strPos=0; ! } else { ! AbbrevDeffs[numabbrev][strPos]=recordP[recPos]; ! strPos++; ! } ! recPos++; ! } ! AbbrevDeffs[numabbrev][strPos]='\0'; ! numabbrev++; ! ! // release lock on record. ! MemHandleUnlock(hAbbrevRec); ! if (numabbrev > 1) { ! abbrevDefined = true; ! } ! } ! } } } *************** *** 272,276 **** /* * Get the time for a given timetable entry and station. Returns time as a ! * signed number (e.g. 07:45 = 745). -1 indicates no time for given station. */ Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station) --- 352,358 ---- /* * Get the time for a given timetable entry and station. Returns time as a ! * signed 16 bit value where the high byte is the hours and the low byte is ! * the minutes. If the high byte is -1 it indicates no time for given station, ! * if the high byte is -2 it indicates 'each hour'. */ Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station) *************** *** 279,282 **** --- 361,366 ---- char *recordP; Int16 time = -1; + Int8 hours = 0; + Int8 mins = 0; rec_mh = DmQueryRecord(pdbfd, recNum); *************** *** 284,288 **** { recordP = MemHandleLock(rec_mh); ! time = (recordP[(station*2)+1] & 0xFF) | (recordP[station*2] << 8); MemHandleUnlock(rec_mh); } --- 368,384 ---- { recordP = MemHandleLock(rec_mh); ! if (dbVersion == VERSION_1_0) ! { ! time = (recordP[(station*2)+1] & 0xFF) | (recordP[station*2] << 8); ! if (time != -1) { ! mins = time % 100; ! hours = time / 100; ! time = (hours << 8) + mins; ! } ! } ! else ! { ! time = (recordP[(station*3)+1] & 0xFF) | (recordP[station*3] << 8); ! } MemHandleUnlock(rec_mh); } *************** *** 294,298 **** * 0 if the database does not support abbreviations. */ ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum) { MemHandle rec_mh; --- 390,394 ---- * 0 if the database does not support abbreviations. */ ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum, Int8 station) { MemHandle rec_mh; *************** *** 306,313 **** { recordP = MemHandleLock(rec_mh); ! abbrev = (recordP[(numstations*2)+1] & 0xFF) | (recordP[numstations*2] << 8); MemHandleUnlock(rec_mh); } } return abbrev; ! } \ No newline at end of file --- 402,447 ---- { recordP = MemHandleLock(rec_mh); ! if (dbVersion == VERSION_1_0) ! abbrev = (recordP[(numstations*2)+1] & 0xFF) | (recordP[numstations*2] << 8); ! else ! abbrev = recordP[(station*3)+2]; MemHandleUnlock(rec_mh); } } return abbrev; ! } ! ! /* ! * Determines whether or not the current database contains timetable notes. ! * This will only be valid after the StationNames have been retrieved for the ! * first time. ! * Returns true if timetable notes are present. ! */ ! Boolean getNotesDefined(DmOpenRef pdbfd) ! { ! MemHandle rec_mh; ! char *recordP; ! ! if (dbVersion == VERSION_1_0) ! return false; ! ! // Otherwise read in the notes. ! if (NumRecords > NOTESRECORD) ! { ! // populate StationNames from database. ! rec_mh = DmQueryRecord(pdbfd,NOTESRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! StrNCopy(Notes, recordP, NOTESLENGTH-1); ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! } ! } ! ! if (StrLen(Notes) > 0) ! return true; ! ! return false; ! } |
|
From: Steve M. <sma...@us...> - 2009-05-02 16:18:18
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18411 Modified Files: Tag: PDB_VER2 csv2trainschedpdb.c csvformat.txt Log Message: Updated to create Version 2 PDB files (NB: Version 1 PDB files will still be generated for older style CSV files). Index: csvformat.txt =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csvformat.txt,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1 *** csvformat.txt 22 Jun 2001 18:53:21 -0000 1.1.1.1 --- csvformat.txt 2 May 2009 16:18:13 -0000 1.1.1.1.2.1 *************** *** 1,23 **** All line endings are Unix style (LF only) ! There are no " Fields are separated by tabs ! The file MUST NOT have an empty line at the end - First line: Station names separated by Tab ! The max length of a station name is 20 characters by default. - Second line: Days ! The max length of a day is 9 characters by default. ! - Third line ! Fields: - Line number in csv for 1st Day, 1st Direction ! - Line number in csv for 2nd Day, 1st Direction ! - Line number in csv for 3rd Day, 1st Direction ! - Line number in csv for 1st Day, 2nd Direction ! ... ! - Data ! times are of the form 00:00 in 24 hour format ! there must be at least 1 dash ('-') if no stop. ! ie: 00:00 00:15 00:20 01:40 ----- 15:50 --- 1,57 ---- All line endings are Unix style (LF only) ! There are no quote (" or ') character. Fields are separated by tabs ! The file MUST NOT have any empty lines at the end, but the last line MUST end with a LF. - First line: Station names separated by Tab ! The max length of a station name is 20 characters. ! - Second line: Days ! The max length of a day is 9 characters. ! ! - Third line: ! Starting row for timetable entries for each day and direction, each line number ! is separated by a Tab: ! Line number in csv for 1st Day, 1st Direction ! Line number in csv for 2nd Day, 1st Direction ! Line number in csv for 3rd Day, 1st Direction ! Line number in csv for 1st Day, 2nd Direction ! ... ! ! - Fourth line: ! Abbreviations separated by a Tab. ! The max length of an abbreviation is 5 characters. ! This line may be blank if the timetable does not use any abbreviations. ! ! - Fifth line: ! Abbreviation definitions separated by a Tab. ! The max length of an abbreviation definition is 23 characters. There should ! be the same number of abbreviation definitions as there are abbreviations. ! ! - Sixth line: ! Timetable notes. Any special notes from the service operator. '|' characters ! may be included to indicate line breaks. This line may be blank if there are ! no additional notes. ! ! - Seventh line onwards: ! Timetable data is of the form: ! <time>tab<abbreviation>tab<time>tab<abbreviation> ! There must be as many times as there are station names. Abbreviation is zero ! for none or the number of defined abbreviation on line 4 (starting a 1) If ! line 4 is blank then no abbreviation values are to be entered, ! i.e. <time>tab<time>tab<time>... ! ! Times are of the form 00:00 in 24 hour format. ! ! There must be at least 1 dash ('-') and no colon (':') if no stop. ! ! A '#' character may be used as a wildcard for hours where the times apply to every hour. ! ! e.g.: ! With Abbreviations: ! 00:00 0 00:15 0 00:20 1 01:40 1 ----- 0 15:50 ! Without Abbreviations: 00:00 00:15 00:20 01:40 ----- 15:50 Index: csv2trainschedpdb.c =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csv2trainschedpdb.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** csv2trainschedpdb.c 30 Mar 2007 10:10:22 -0000 1.7 --- csv2trainschedpdb.c 2 May 2009 16:18:13 -0000 1.7.2.1 *************** *** 35,40 **** #define CREATORID "TRSC" #define DBTYPE "DATA" ! #define FATTRIBS "\x0\x0" /* 0x0020 = RO | backup | OK to overwrite */ ! #define VERSION "\x1\x0" /* 0.1 */ #define TIME_CONSTANT 2082844800 --- 35,41 ---- #define CREATORID "TRSC" #define DBTYPE "DATA" ! #define FATTRIBS "\x0\x0" /* 0x0020 = RO | backup | OK to overwrite */ ! #define VERSION_1_0 "\x1\x0" /* 1.0 Original Trainsched format. */ ! #define VERSION_2_0 "\x2\x0" /* 2.0 Enhanced Trainsched format */ #define TIME_CONSTANT 2082844800 *************** *** 42,46 **** typedef struct station { ! char nom[LGMAXNOMGARE+1]; } station; --- 43,47 ---- typedef struct station { ! char nom[LGMAXNOMGARE+1]; } station; *************** *** 57,333 **** int writerecordinfo(FILE *pdbfd, unsigned int record_num, long pos) { ! char temp[4]={0}; ! int i; ! long saved_pos=0; ! /* store current pos in pdb file */ ! saved_pos = ftell(pdbfd); ! /* write record info */ ! fseek(pdbfd,(record_num-1)*8 + end_header_pos,SEEK_SET); ! i = pos; ! // printf("record: %i %i\n",record_num,i); ! temp[0]= i >> 24 ; ! temp[1]= i >> 16; ! temp[2]= i >> 8; ! temp[3]= i & 0xFFFFFF; ! fwrite(temp,4,1,pdbfd); ! /* go back to saved position */ ! fseek(pdbfd,saved_pos,SEEK_SET); ! return 0; } int main(int argc, char *argv[]) { ! FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nbdir=0, notrain=0; ! char temp[LGMAXNOMGARE+1]={0}; ! int cur_record; ! long cur_record_pos=0; ! if (argc != 4) { ! printf("usage : %s <source> <dest> <PDB Name>\n",argv[0]); ! exit(0); ! } ! /* open source file */ ! fd = fopen(argv[1],"r"); ! if (fd == NULL) { ! printf("Erreur d'ouverture du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* create destination file */ ! /* the b mode is necessary for Cygwin and harmless for Posix systems */ ! pdbfd = fopen(argv[2],"wb"); ! if (pdbfd == NULL) { ! printf("Erreur de création du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* header */ ! /*PDB Name Max 32 chars , \0 terminated */ ! fwrite(argv[3],1,strlen(argv[3]),pdbfd); ! for(i=0;i<(32-strlen(argv[3]));i++) ! fwrite("\x0",1,1,pdbfd); ! /* File attribs */ ! fwrite(FATTRIBS,2,1,pdbfd); ! /* Version */ ! fwrite(VERSION,2,1,pdbfd); ! /* creation date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* Modification date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* last Backup date */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Modification number */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* AppInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* SortInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Database Type */ ! fwrite(DBTYPE,4,1,pdbfd); ! /* Creator ID */ ! fwrite(CREATORID,4,1,pdbfd); ! /* Unique ID Seed */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Next record List ID */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Number of records to go here */ ! fwrite("\x0\x0",2,1,pdbfd); ! end_header_pos=ftell(pdbfd); ! /* count number of records in source file */ ! while ((c = fgetc(fd)) != EOF) { ! if (c == '\n') ! num_records++; ! } ! printf("There are %i lines (records)\n",num_records); ! /* save it in PDB Header */ ! /* write number of records in header */ ! fseek(pdbfd,end_header_pos-2,SEEK_SET); ! temp[0] = num_records >> 8; ! temp[1] = num_records & 0xFF; ! fwrite(temp,2,1,pdbfd); ! /* leave room for records info */ ! for (i=0;i<num_records;i++) ! fwrite("\x0\x0\x0\x0\x0\x0\x0\x0",8,1,pdbfd); ! rewind(fd); ! cur_record=1; ! cur_record_pos=ftell(pdbfd); ! /* read Station Names on 1st line */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbgares++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbgares++; ! printf("I found %i stations\n",nbgares); ! /* Write record info in record List */ ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read Day List */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbdays++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdays++; ! printf("%i days found\n",nbdays); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* Read line offset for the various days and directions schedules */ ! i=0; ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0]=j >> 8; ! temp[1]=j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! i=0; ! nbdir++; ! } ! if (c != '\n') { ! temp[i++]=c; ! } else { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdir++; ! printf("%i time tables found\n",nbdir); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* Let's go for the real thing */ ! i=0; ! notrain=0; ! for(;;) { ! c=fgetc(fd); ! /* we write time as int */ ! if ((c != '\t') && (c != '\n')) { ! if (c != ':') ! temp[i++]=c; ! } else if (c == '\t') { ! temp[i]='\0'; ! for(j=0;j<i;j++) { ! if (temp[j]=='-') { ! notrain=1; ! fwrite("\xFF\xFF",2,1,pdbfd); ! memset(temp,0,sizeof(temp)); ! break; ! } ! } ! if (notrain==0) { ! j = atoi(temp); ! memset(temp,0,4); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! fflush(pdbfd); ! memset(temp,0,sizeof(temp)); ! } ! notrain=0; ! i=0; ! } ! if ((c == '\n') || (c == EOF)) { ! temp[i]='\0'; ! for(j=0;j<i;j++) { ! if (temp[j]=='-') { ! notrain=1; ! fwrite("\xFF\xFF",2,1,pdbfd); ! memset(temp,0,sizeof(temp)); ! break; ! } ! } ! if (notrain==0) { ! j = atoi(temp); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! memset(temp,0,sizeof(temp)); ! } ! notrain=0; ! i=0; ! if (c != EOF) { ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } else { ! break; ! } ! } ! } ! fflush(pdbfd); ! fclose(pdbfd); ! fclose(fd); ! return 0; } --- 58,404 ---- int writerecordinfo(FILE *pdbfd, unsigned int record_num, long pos) { ! char temp[4]={0}; ! int i; ! long saved_pos=0; ! /* store current pos in pdb file */ ! saved_pos = ftell(pdbfd); ! /* write record info */ ! fseek(pdbfd,(record_num-1)*8 + end_header_pos,SEEK_SET); ! i = pos; ! // printf("record: %i %i\n",record_num,i); ! temp[0]= i >> 24 ; ! temp[1]= i >> 16; ! temp[2]= i >> 8; ! temp[3]= i & 0xFFFFFF; ! fwrite(temp,4,1,pdbfd); ! /* go back to saved position */ ! fseek(pdbfd,saved_pos,SEEK_SET); ! return 0; } int main(int argc, char *argv[]) { + FILE *fd, *pdbfd; + int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0; + char temp[LGMAXNOMGARE+1]={0}; + int cur_record; + long cur_record_pos=0; ! if (argc != 4) { ! printf("usage : %s <source> <dest> <PDB Name>\n",argv[0]); ! exit(0); ! } ! /* open source file */ ! fd = fopen(argv[1],"r"); ! if (fd == NULL) { ! printf("Erreur d'ouverture du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* count number of records in source file */ ! while ((c = fgetc(fd)) != EOF) { ! if ((num_records < 5) && c == ':') ! num_colon++; // Colons (i.e times) in the first 5 records indicates that this is a version 1.0 PDB. ! if (c == '\n') ! num_records++; ! } ! printf("There are %i lines (records)\n",num_records); ! /* create destination file */ ! /* the b mode is necessary for Cygwin and harmless for Posix systems */ ! pdbfd = fopen(argv[2],"wb"); ! if (pdbfd == NULL) { ! printf("Erreur de création du fichier %s\n",argv[1]); ! exit(-1); ! } ! /* header */ ! /*PDB Name Max 32 chars , \0 terminated */ ! fwrite(argv[3],1,strlen(argv[3]),pdbfd); ! for(i=0;i<(32-strlen(argv[3]));i++) ! fwrite("\x0",1,1,pdbfd); ! /* File attribs */ ! fwrite(FATTRIBS,2,1,pdbfd); ! /* Version */ ! if (num_colon > 3) { ! printf("Writing a Version 1.0 PDB file.\n"); ! fwrite(VERSION_1_0,2,1,pdbfd); ! } else { ! printf("Writing a Version 2.0 PDB file.\n"); ! fwrite(VERSION_2_0,2,1,pdbfd); ! } ! /* creation date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* Modification date FIXME */ ! fwrite("\xB7\x2D\xB1\x9A",4,1,pdbfd); ! /* last Backup date */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Modification number */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* AppInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* SortInfo Area */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Database Type */ ! fwrite(DBTYPE,4,1,pdbfd); ! /* Creator ID */ ! fwrite(CREATORID,4,1,pdbfd); ! /* Unique ID Seed */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Next record List ID */ ! fwrite("\x0\x0\x0\x0",4,1,pdbfd); ! /* Number of records to go here */ ! temp[0] = num_records >> 8; ! temp[1] = num_records & 0xFF; ! fwrite(temp,2,1,pdbfd); ! end_header_pos=ftell(pdbfd); ! /* leave room for records info */ ! for (i=0;i<num_records;i++) ! fwrite("\x0\x0\x0\x0\x0\x0\x0\x0",8,1,pdbfd); ! rewind(fd); ! cur_record=1; ! cur_record_pos=ftell(pdbfd); ! /* read Station Names on 1st line */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbgares++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbgares++; ! printf("I found %i stations\n",nbgares); ! /* Write record info in record List */ ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read Day List */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nbdays++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdays++; ! printf("%i days found\n",nbdays); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* Read line offset for the various days and directions schedules */ ! i=0; ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0]=j >> 8; ! temp[1]=j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! i=0; ! nbdir++; ! } ! if (c != '\n') { ! temp[i++]=c; ! } else { ! temp[i]='\0'; ! j = atoi(temp); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nbdir++; ! printf("%i time tables found\n",nbdir); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! if (num_colon < 4) { // Only for 2.0 Version PDB files. ! /* read Abbreviations List */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nabbrev++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nabbrev++; ! printf("%i abbreviations found\n",nabbrev); ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read Abbreviations Definitions */ ! for(;;) { ! c = fgetc(fd); ! if(c == '\t') ! nabdef++; ! if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! nabdef++; ! if (nabbrev != nabdef) ! { ! printf("WARNING: I found %i abbreviations, but %i abbreviation definitions.\n", nabbrev, nabdef); ! } ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! /* read timetable notes.*/ ! for(;;) { ! c = fgetc(fd); ! if(c == '|') ! fwrite("\n",1,1,pdbfd); ! else if (c != '\n') { ! fwrite(&c,1,1,pdbfd); ! } else { ! fwrite("\x0",1,1,pdbfd); ! break; ! } ! } ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } ! /* Write the timetable records. */ ! i=0; ! if (num_colon > 3) { ! // Version 1.0 PDB ! for(;;) { ! c=fgetc(fd); ! if (c == EOF) break; ! /* we write time as a single 16bit int */ ! if ((c != '\t') && (c != '\n') && (c != ':')) temp[i++]=c; ! if ((c == '\t') || (c == '\n')) { ! temp[i]='\0'; ! if (temp[0]=='-') { ! fwrite("\xFF\xFF",2,1,pdbfd); ! } else { ! j = atoi(temp); ! memset(temp,0,4); ! temp[0] = j >> 8; ! temp[1] = j & 0xFF; ! fwrite(temp,2,1,pdbfd); ! } ! fflush(pdbfd); ! memset(temp,0,sizeof(temp)); ! i=0; ! } ! if (c == '\n') { ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } ! } ! } ! else ! { ! // Version 2.0 PDB ! for(;;) { ! c=fgetc(fd); ! if (c == EOF) break; ! ! /* we write time and abbreviation as three 8 bit ints (hours, minutes & abbrev) */ ! if ((c != '\t') && (c != '\n') && (c != ':')) temp[i++]=c; ! else { ! temp[i]='\0'; ! ! if (temp[0]=='-') { ! fwrite("\xFF\xFF",2,1,pdbfd); // Hours and Minutes ! } else if (temp[0]=='#') { ! fwrite("\xFE",1,1,pdbfd); ! } else { ! j = atoi(temp); ! temp[0] = j & 0xFF; ! fwrite(temp,1,1,pdbfd); ! } ! ! // If no defined abbreviations, write a blank ! if ((c != ':') && (nabbrev == 1)) { ! fwrite("\x0",1,1,pdbfd); ! } ! ! fflush(pdbfd); ! memset(temp,0,sizeof(temp)); ! i=0; ! } ! ! if (c == '\n') { ! writerecordinfo(pdbfd, cur_record, cur_record_pos); ! cur_record_pos=ftell(pdbfd); ! cur_record++; ! } ! } ! } ! fflush(pdbfd); ! fclose(pdbfd); ! fclose(fd); ! ! return 0; } |
|
From: Steve M. <sma...@us...> - 2009-04-26 08:33:46
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3044 Modified Files: Tag: PDB_VER2 .cvsignore Log Message: Exclude comiled executable from repository. Index: .cvsignore =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/.cvsignore,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** .cvsignore 14 Apr 2002 15:23:49 -0000 1.1 --- .cvsignore 26 Apr 2009 08:33:42 -0000 1.1.2.1 *************** *** 1 **** --- 1,2 ---- *.pdb + csv2trainschedpdb.exe \ No newline at end of file |
|
From: Steve M. <sma...@us...> - 2009-04-26 08:27:29
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2482 Modified Files: Makefile Log Message: Undo of commit to wrong branch. Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 26 Apr 2009 08:11:11 -0000 1.8 --- Makefile 26 Apr 2009 08:27:24 -0000 1.9 *************** *** 2,9 **** # Macros ! VERS=0.4 PROGRAM=trainsched CC=m68k-palmos-gcc PILRC=pilrc OBJRES=m68k-palmos-obj-res --- 2,10 ---- # Macros ! VERS=0.5pre2 PROGRAM=trainsched CC=m68k-palmos-gcc + CPP=cpp PILRC=pilrc OBJRES=m68k-palmos-obj-res *************** *** 11,17 **** BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall -g LFLAGS=-g SOURCES=selectform.c timetable.c trainsched.c OBJS=selectform.o timetable.o trainsched.o --- 12,25 ---- BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r3 -Wall -g LFLAGS=-g + #INCLUDE=-Ipalmresize -I. + #DEFINES=-DSUPPORT_DIA -DSUPPORT_DIA_SONY -DSUPPORT_DIA_HANDERA + + #SONY=-I/usr/local/share/palmdev/sony-sdk/Libraries -I/usr/local/share/palmdev/sony-sdk/System -I/usr/local/share/palmdev/sony-sdk + #HANDERA=-I/usr/local/share/palmdev/Handera + #SOURCES=trainsched.c palmresize/resize.c palmresize/DIA.c + #OBJS=trainsched.o palmresize/resize.o palmresize/DIA.o SOURCES=selectform.c timetable.c trainsched.c OBJS=selectform.o timetable.o trainsched.o *************** *** 19,22 **** --- 27,32 ---- RESOURCES=$(PROGRAM).rcp + #INCLUDE += $(SONY) $(HANDERA) + #### *************** *** 25,28 **** --- 35,41 ---- all: $(PRC) + .c.o: + $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c $< -o $@ + $(PRC): $(PROGRAM) bin.res $(BUILDPRC) $(PRC) $(ICONTEXT) $(APID) *.bin *.grc *************** *** 32,36 **** $(OBJRES) $(PROGRAM) ! bin.res: $(RESOURCES) trainsched.h trainsched.bmp $(PILRC) $(RESOURCES) touch bin.res --- 45,54 ---- $(OBJRES) $(PROGRAM) ! bin.res.dia: $(RESOURCES) trainsched.h trainsched.bmp ! sed 's/\\$$/@backslash@/' $(RESOURCES) | $(CPP) | perl doaddition.pl > $(PROGRAM)-done.rcp && \ ! $(PILRC) $(PROGRAM)-done.rcp ! touch bin.res ! ! bin.res: $(RESOURCES) trainsched.h trainsched.bmp $(PILRC) $(RESOURCES) touch bin.res *************** *** 40,44 **** clean: ! rm -f *.bin *.grc *.o bin.res tags $(PRC) $(PROGRAM) dist-win: clean all --- 58,62 ---- clean: ! rm -f *.bin *.grc *.o palmresize/*.o bin.res tags $(PRC) $(PROGRAM) dist-win: clean all *************** *** 68,76 **** rm -rf $(PROGRAM)-src-$(VERS) ! #### ! # Dependency targets ! ! trainsched.o: trainsched.c trainsched.h ! --- 86,96 ---- rm -rf $(PROGRAM)-src-$(VERS) + depends: + makedepend $(SOURCES) >/dev/null 2>&1 + # + # Dependency information generated by "make depends" + # + # DO NOT DELETE ! trainsched.o: trainsched.h |
|
From: Steve M. <sma...@us...> - 2009-04-26 08:15:08
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1285 Modified Files: Tag: PDB_VER2 Makefile Log Message: PalmOS 5r4, No DIA dependency for this branch. Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** Makefile 25 Apr 2009 16:14:10 -0000 1.7 --- Makefile 26 Apr 2009 08:14:56 -0000 1.7.2.1 *************** *** 2,10 **** # Macros ! VERS=0.5pre2 PROGRAM=trainsched CC=m68k-palmos-gcc - CPP=cpp PILRC=pilrc OBJRES=m68k-palmos-obj-res --- 2,9 ---- # Macros ! VERS=0.4 PROGRAM=trainsched CC=m68k-palmos-gcc PILRC=pilrc OBJRES=m68k-palmos-obj-res *************** *** 12,25 **** BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r3 -Wall -g LFLAGS=-g - #INCLUDE=-Ipalmresize -I. - #DEFINES=-DSUPPORT_DIA -DSUPPORT_DIA_SONY -DSUPPORT_DIA_HANDERA - - #SONY=-I/usr/local/share/palmdev/sony-sdk/Libraries -I/usr/local/share/palmdev/sony-sdk/System -I/usr/local/share/palmdev/sony-sdk - #HANDERA=-I/usr/local/share/palmdev/Handera - #SOURCES=trainsched.c palmresize/resize.c palmresize/DIA.c - #OBJS=trainsched.o palmresize/resize.o palmresize/DIA.o SOURCES=selectform.c timetable.c trainsched.c OBJS=selectform.o timetable.o trainsched.o --- 11,17 ---- BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall -g LFLAGS=-g SOURCES=selectform.c timetable.c trainsched.c OBJS=selectform.o timetable.o trainsched.o *************** *** 27,32 **** RESOURCES=$(PROGRAM).rcp - #INCLUDE += $(SONY) $(HANDERA) - #### --- 19,22 ---- *************** *** 35,41 **** all: $(PRC) - .c.o: - $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c $< -o $@ - $(PRC): $(PROGRAM) bin.res $(BUILDPRC) $(PRC) $(ICONTEXT) $(APID) *.bin *.grc --- 25,28 ---- *************** *** 45,54 **** $(OBJRES) $(PROGRAM) ! bin.res.dia: $(RESOURCES) trainsched.h trainsched.bmp ! sed 's/\\$$/@backslash@/' $(RESOURCES) | $(CPP) | perl doaddition.pl > $(PROGRAM)-done.rcp && \ ! $(PILRC) $(PROGRAM)-done.rcp ! touch bin.res ! ! bin.res: $(RESOURCES) trainsched.h trainsched.bmp $(PILRC) $(RESOURCES) touch bin.res --- 32,36 ---- $(OBJRES) $(PROGRAM) ! bin.res: $(RESOURCES) trainsched.h trainsched.bmp $(PILRC) $(RESOURCES) touch bin.res *************** *** 58,62 **** clean: ! rm -f *.bin *.grc *.o palmresize/*.o bin.res tags $(PRC) $(PROGRAM) dist-win: clean all --- 40,44 ---- clean: ! rm -f *.bin *.grc *.o bin.res tags $(PRC) $(PROGRAM) dist-win: clean all *************** *** 86,96 **** rm -rf $(PROGRAM)-src-$(VERS) - depends: - makedepend $(SOURCES) >/dev/null 2>&1 - # - # Dependency information generated by "make depends" - # - # DO NOT DELETE ! trainsched.o: trainsched.h --- 68,76 ---- rm -rf $(PROGRAM)-src-$(VERS) ! #### ! # Dependency targets ! ! trainsched.o: trainsched.c trainsched.h ! |
|
From: Steve M. <sma...@us...> - 2009-04-26 08:11:14
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv937 Modified Files: Makefile Log Message: PalmOS 5r4, No DIA dependency for this branch. Index: Makefile =================================================================== RCS file: /cvsroot/trainsched/trainsched/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 25 Apr 2009 16:14:10 -0000 1.7 --- Makefile 26 Apr 2009 08:11:11 -0000 1.8 *************** *** 2,10 **** # Macros ! VERS=0.5pre2 PROGRAM=trainsched CC=m68k-palmos-gcc - CPP=cpp PILRC=pilrc OBJRES=m68k-palmos-obj-res --- 2,9 ---- # Macros ! VERS=0.4 PROGRAM=trainsched CC=m68k-palmos-gcc PILRC=pilrc OBJRES=m68k-palmos-obj-res *************** *** 12,25 **** BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r3 -Wall -g LFLAGS=-g - #INCLUDE=-Ipalmresize -I. - #DEFINES=-DSUPPORT_DIA -DSUPPORT_DIA_SONY -DSUPPORT_DIA_HANDERA - - #SONY=-I/usr/local/share/palmdev/sony-sdk/Libraries -I/usr/local/share/palmdev/sony-sdk/System -I/usr/local/share/palmdev/sony-sdk - #HANDERA=-I/usr/local/share/palmdev/Handera - #SOURCES=trainsched.c palmresize/resize.c palmresize/DIA.c - #OBJS=trainsched.o palmresize/resize.o palmresize/DIA.o SOURCES=selectform.c timetable.c trainsched.c OBJS=selectform.o timetable.o trainsched.o --- 11,17 ---- BUILDPRC=build-prc APID=TRSC ! CFLAGS=-palmos5r4 -Wall -g LFLAGS=-g SOURCES=selectform.c timetable.c trainsched.c OBJS=selectform.o timetable.o trainsched.o *************** *** 27,32 **** RESOURCES=$(PROGRAM).rcp - #INCLUDE += $(SONY) $(HANDERA) - #### --- 19,22 ---- *************** *** 35,41 **** all: $(PRC) - .c.o: - $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c $< -o $@ - $(PRC): $(PROGRAM) bin.res $(BUILDPRC) $(PRC) $(ICONTEXT) $(APID) *.bin *.grc --- 25,28 ---- *************** *** 45,54 **** $(OBJRES) $(PROGRAM) ! bin.res.dia: $(RESOURCES) trainsched.h trainsched.bmp ! sed 's/\\$$/@backslash@/' $(RESOURCES) | $(CPP) | perl doaddition.pl > $(PROGRAM)-done.rcp && \ ! $(PILRC) $(PROGRAM)-done.rcp ! touch bin.res ! ! bin.res: $(RESOURCES) trainsched.h trainsched.bmp $(PILRC) $(RESOURCES) touch bin.res --- 32,36 ---- $(OBJRES) $(PROGRAM) ! bin.res: $(RESOURCES) trainsched.h trainsched.bmp $(PILRC) $(RESOURCES) touch bin.res *************** *** 58,62 **** clean: ! rm -f *.bin *.grc *.o palmresize/*.o bin.res tags $(PRC) $(PROGRAM) dist-win: clean all --- 40,44 ---- clean: ! rm -f *.bin *.grc *.o bin.res tags $(PRC) $(PROGRAM) dist-win: clean all *************** *** 86,96 **** rm -rf $(PROGRAM)-src-$(VERS) - depends: - makedepend $(SOURCES) >/dev/null 2>&1 - # - # Dependency information generated by "make depends" - # - # DO NOT DELETE ! trainsched.o: trainsched.h --- 68,76 ---- rm -rf $(PROGRAM)-src-$(VERS) ! #### ! # Dependency targets ! ! trainsched.o: trainsched.c trainsched.h ! |
|
From: Steve M. <sma...@us...> - 2009-04-26 08:07:24
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv503 Modified Files: trainsched.rcp Log Message: Fixed cosmetic issue with table column widths. Index: trainsched.rcp =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.rcp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** trainsched.rcp 25 Apr 2009 16:14:10 -0000 1.14 --- trainsched.rcp 26 Apr 2009 08:07:21 -0000 1.15 *************** *** 1,156 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! #include "trainsched.h" ! ! VERSION ID 1 "0.5.0" ! ! ! /* Icons for launching the software */ ! ICON "trainsched.bmp" ! SMALLICON "minitrainsched.bmp" ! ! /* Bitmap for the About dialog box */ ! BITMAP aboutBitmap "trainsched.bmp" COMPRESS ! ! /* Main Form */ ! FORM ID resFormMain AT ( 0 0 160 160 ) ! menuid MainFormMenuBar ! FRAME /* Was NOFRAME */ ! USABLE ! BEGIN ! TITLE "Train time " ! ! POPUPTRIGGER "Day" ID resDayTrigger ! AT (0 15 AUTO AUTO) LEFTANCHOR ! ! LIST "" ID resDayList AT (PREVLEFT PREVTOP+2 45 0) ! NONUSABLE VISIBLEITEMS 3 ! ! POPUPLIST ID resDayTrigger resDayList ! ! ! POPUPTRIGGER "From" ID resFromTrigger ! AT (0 33 AUTO AUTO) LEFTANCHOR ! ! LIST "" ID resFromList ! AT (PREVLEFT PREVTOP+2 60 0) ! NONUSABLE VISIBLEITEMS 10 ! ! POPUPLIST ID resFromTrigger resFromList ! ! POPUPTRIGGER "To" ID resToTrigger ! AT (80 33 AUTO AUTO) LEFTANCHOR ! ! LIST "" ! ID resToList ! AT (PREVLEFT PREVTOP+2 60 0) ! NONUSABLE VISIBLEITEMS 10 ! ! POPUPLIST ID resToTrigger resToList ! ! TABLE ID resTimeTable AT (2 PREVTOP+14 146 110) ! ROWS 10 COLUMNS 2 COLUMNWIDTHS 70 70 ! TABLE ID resTimeTable3c AT (2 PREVTOP 146 110) ! ROWS 10 COLUMNS 3 COLUMNWIDTHS 55 55 36 ! ! SCROLLBAR ID resTableScrollBar AT (PREVRIGHT+2 PREVTOP 7 PREVHEIGHT) ! USABLE ! ! ! BUTTON "Reverse" ID resReverseBtn AT (100 18 AUTO AUTO) ! END ! ! /* Main Menu */ ! MENU ID MainFormMenuBar ! BEGIN ! PULLDOWN "Options" ! BEGIN ! MENUITEM "Timetable..." ID MainOptionsSelectCmd "S" ! MENUITEM "Abbreviations..." ID MainOptionsAbbreviations "B" ! MENUITEM SEPARATOR ! MENUITEM "About..." ID MainOptionsAboutCmd "A" ! END ! END ! ! /* About Dialog Box */ ! FORM ID aboutForm AT (2 2 156 156) MODAL ! BEGIN ! TITLE "About TrainSched" ! ! LABEL "http://trainsched.sf.net" AUTOID AT (4 PrevTop+11) ! ! LABEL "ph...@us..." AUTOID AT (4 PrevTop+11) FONT 1 ! LABEL "TrainSched" AUTOID AT (90 PrevTop+20) ! ! FORMBITMAP AT (98 PrevTop+15) BITMAP aboutBitmap ! ! LABEL "© 2001-2009" AUTOID AT (16 PrevTop-15) ! LABEL "Philippe Marzouk" AUTOID AT (16 PrevTop+12) ! LABEL "All rights reserved" AUTOID AT (16 PrevTop+12) ! LABEL "Enhancements by:" AUTOID AT (4 PrevTop+16) ! LABEL "Damien Carbery (2004-2005)" AUTOID AT (16 PrevTop+12) ! LABEL "Steve Martin (2009)" AUTOID AT (16 PrevTop+12) ! ! LABEL "Released under the GNU GPL" AUTOID AT (8 PrevTop+16) FONT 1 ! LABEL "version 0.5.0pre2" AUTOID AT (8 PrevTop+12) FONT 1 ! ! BUTTON "Ok" ID aboutFormOkButton AT (100 138 36 AUTO) ! END ! ! /* File selection Dialog box */ ! FORM ID selectForm AT (2 2 156 156) USABLE MODAL ! BEGIN ! TITLE "Timetable Selection" ! ! LABEL "Select Timetable:" AUTOID AT (4 14) ! ! TABLE ID selectFrmTable AT (2 PREVTOP+11 144 88) ! ROWS 8 COLUMNS 1 COLUMNWIDTHS 140 ! ! SCROLLBAR ID selectFrmTableScrollBar AT (PREVRIGHT+2 PREVTOP 7 PREVHEIGHT) ! USABLE ! ! BUTTON "Beam" ID selectFrmBeamButton AT (10 PREVTOP+93 40 AUTO) USABLE ! BUTTON "Delete" ID selectFrmDeleteButton AT (110 PREVTOP 40 AUTO) USABLE ! BUTTON "Ok" ID selectFrmOKButton AT (30 PREVTOP+20 40 AUTO) USABLE ! BUTTON "Cancel" ID selectFrmCancel AT (90 PREVTOP 40 AUTO) USABLE ! END ! ! ALERT ID alertDialog1 ! WARNING ! BEGIN ! TITLE "Error!" ! MESSAGE "^1" ! BUTTONS "Ok" ! END ! ! ALERT ID alertAbbreviations ! INFORMATION ! BEGIN ! TITLE "Abbreviations" ! MESSAGE "^1" ! BUTTONS "OK" ! END ! ! STRING ID NO_PDB "No timetables found, please install one first (see http://trainsched.sf.net)." ! STRING ID NO_SELECTION "You must select a timetable first." ! STRING ID NO_DELETE "You cannot delete the current timetable." ! STRING ID NOT_IMPL "Function not yet implemented." ! --- 1,156 ---- ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! #include "trainsched.h" ! ! VERSION ID 1 "0.5.0" ! ! ! /* Icons for launching the software */ ! ICON "trainsched.bmp" ! SMALLICON "minitrainsched.bmp" ! ! /* Bitmap for the About dialog box */ ! BITMAP aboutBitmap "trainsched.bmp" COMPRESS ! ! /* Main Form */ ! FORM ID resFormMain AT ( 0 0 160 160 ) ! menuid MainFormMenuBar ! FRAME /* Was NOFRAME */ ! USABLE ! BEGIN ! TITLE "Train time " ! ! POPUPTRIGGER "Day" ID resDayTrigger ! AT (0 15 AUTO AUTO) LEFTANCHOR ! ! LIST "" ID resDayList AT (PREVLEFT PREVTOP+2 45 0) ! NONUSABLE VISIBLEITEMS 3 ! ! POPUPLIST ID resDayTrigger resDayList ! ! ! POPUPTRIGGER "From" ID resFromTrigger ! AT (0 33 AUTO AUTO) LEFTANCHOR ! ! LIST "" ID resFromList ! AT (PREVLEFT PREVTOP+2 60 0) ! NONUSABLE VISIBLEITEMS 10 ! ! POPUPLIST ID resFromTrigger resFromList ! ! POPUPTRIGGER "To" ID resToTrigger ! AT (80 33 AUTO AUTO) LEFTANCHOR ! ! LIST "" ! ID resToList ! AT (PREVLEFT PREVTOP+2 60 0) ! NONUSABLE VISIBLEITEMS 10 ! ! POPUPLIST ID resToTrigger resToList ! ! TABLE ID resTimeTable AT (2 PREVTOP+14 146 110) ! ROWS 10 COLUMNS 2 COLUMNWIDTHS 73 73 ! TABLE ID resTimeTable3c AT (2 PREVTOP 146 110) ! ROWS 10 COLUMNS 3 COLUMNWIDTHS 55 55 36 ! ! SCROLLBAR ID resTableScrollBar AT (PREVRIGHT+2 PREVTOP 7 PREVHEIGHT) ! USABLE ! ! ! BUTTON "Reverse" ID resReverseBtn AT (100 18 AUTO AUTO) ! END ! ! /* Main Menu */ ! MENU ID MainFormMenuBar ! BEGIN ! PULLDOWN "Options" ! BEGIN ! MENUITEM "Timetable..." ID MainOptionsSelectCmd "S" ! MENUITEM "Abbreviations..." ID MainOptionsAbbreviations "B" ! MENUITEM SEPARATOR ! MENUITEM "About..." ID MainOptionsAboutCmd "A" ! END ! END ! ! /* About Dialog Box */ ! FORM ID aboutForm AT (2 2 156 156) MODAL ! BEGIN ! TITLE "About TrainSched" ! ! LABEL "http://trainsched.sf.net" AUTOID AT (4 PrevTop+11) ! ! LABEL "ph...@us..." AUTOID AT (4 PrevTop+11) FONT 1 ! LABEL "TrainSched" AUTOID AT (90 PrevTop+20) ! ! FORMBITMAP AT (98 PrevTop+15) BITMAP aboutBitmap ! ! LABEL "© 2001-2009" AUTOID AT (16 PrevTop-15) ! LABEL "Philippe Marzouk" AUTOID AT (16 PrevTop+12) ! LABEL "All rights reserved" AUTOID AT (16 PrevTop+12) ! LABEL "Enhancements by:" AUTOID AT (4 PrevTop+16) ! LABEL "Damien Carbery (2004-2005)" AUTOID AT (16 PrevTop+12) ! LABEL "Steve Martin (2009)" AUTOID AT (16 PrevTop+12) ! ! LABEL "Released under the GNU GPL" AUTOID AT (8 PrevTop+16) FONT 1 ! LABEL "version 0.5.0pre2" AUTOID AT (8 PrevTop+12) FONT 1 ! ! BUTTON "Ok" ID aboutFormOkButton AT (100 138 36 AUTO) ! END ! ! /* File selection Dialog box */ ! FORM ID selectForm AT (2 2 156 156) USABLE MODAL ! BEGIN ! TITLE "Timetable Selection" ! ! LABEL "Select Timetable:" AUTOID AT (4 14) ! ! TABLE ID selectFrmTable AT (2 PREVTOP+11 144 88) ! ROWS 8 COLUMNS 1 COLUMNWIDTHS 144 ! ! SCROLLBAR ID selectFrmTableScrollBar AT (PREVRIGHT+2 PREVTOP 7 PREVHEIGHT) ! USABLE ! ! BUTTON "Beam" ID selectFrmBeamButton AT (10 PREVTOP+93 40 AUTO) USABLE ! BUTTON "Delete" ID selectFrmDeleteButton AT (110 PREVTOP 40 AUTO) USABLE ! BUTTON "Ok" ID selectFrmOKButton AT (30 PREVTOP+20 40 AUTO) USABLE ! BUTTON "Cancel" ID selectFrmCancel AT (90 PREVTOP 40 AUTO) USABLE ! END ! ! ALERT ID alertDialog1 ! WARNING ! BEGIN ! TITLE "Error!" ! MESSAGE "^1" ! BUTTONS "Ok" ! END ! ! ALERT ID alertAbbreviations ! INFORMATION ! BEGIN ! TITLE "Abbreviations" ! MESSAGE "^1" ! BUTTONS "OK" ! END ! ! STRING ID NO_PDB "No timetables found, please install one first (see http://trainsched.sf.net)." ! STRING ID NO_SELECTION "You must select a timetable first." ! STRING ID NO_DELETE "You cannot delete the current timetable." ! STRING ID NOT_IMPL "Function not yet implemented." ! |
|
From: Steve M. <sma...@us...> - 2009-04-26 08:06:56
|
Update of /cvsroot/trainsched/trainsched In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv452 Modified Files: selectform.c selectform.h timetable.c timetable.h trainsched.c trainsched.h Log Message: Restored newline characters to Unix style. Index: selectform.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/selectform.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** selectform.h 25 Apr 2009 16:14:10 -0000 1.1 --- selectform.h 26 Apr 2009 08:06:50 -0000 1.2 *************** *** 1,31 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /* to store Databases info */ ! typedef struct { ! char DBName[dmDBNameLength]; ! LocalID pdbid; ! UInt16 CardNo; ! } dbrowType; ! ! // Function Prototypes. ! Boolean selectFormEventHandler(EventPtr event); ! void LoadSelTable(FormPtr pForm, Boolean Update); ! void InitSelTable(FormPtr pForm); ! Err WriteDBData(const void *dataP, UInt32 *sizeP, void *userDataP); --- 1,31 ---- ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /* to store Databases info */ ! typedef struct { ! char DBName[dmDBNameLength]; ! LocalID pdbid; ! UInt16 CardNo; ! } dbrowType; ! ! // Function Prototypes. ! Boolean selectFormEventHandler(EventPtr event); ! void LoadSelTable(FormPtr pForm, Boolean Update); ! void InitSelTable(FormPtr pForm); ! Err WriteDBData(const void *dataP, UInt32 *sizeP, void *userDataP); Index: selectform.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/selectform.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** selectform.c 25 Apr 2009 16:14:10 -0000 1.1 --- selectform.c 26 Apr 2009 08:06:50 -0000 1.2 *************** *** 1,350 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! #include <PalmOS.h> ! ! #include "trainsched.h" ! #include "selectform.h" ! ! // from trainsched.c ! void ResetPrefs(); ! ! // Global Variables ! Int16 ScrollSelectValue=0; ! MemHandle pdbarrayH=NULL; ! Int16 selpdbcount=0; ! ! // External veriables ! extern LocalID pdbid; ! extern UInt16 CardNo; ! extern char DBName[dmDBNameLength]; ! ! Boolean selectFormEventHandler(EventPtr event) ! { ! Boolean handled = false; ! FormPtr pForm = FrmGetActiveForm(); ! Int16 val, min, max, page; ! RectangleType r; ! TablePtr tableP; ! Int16 rowP, columnP; ! dbrowType *data; ! MemHandle TextH; ! ExgSocketType exgSocket; ! Err err = 0; ! ! switch (event->eType) { ! case frmOpenEvent: ! InitSelTable(pForm); ! // Fall through to the frmUpdateEvent. ! case frmUpdateEvent: ! FrmDrawForm(pForm); ! LoadSelTable(pForm, false); ! /* Draw the outline of the table */ ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! TblGetBounds(tableP, &r); ! WinDrawRectangleFrame( simpleFrame, &r ); ! handled = true; ! break; ! case sclRepeatEvent: ! ScrollSelectValue = event->data.sclRepeat.newValue; ! LoadSelTable(pForm, false); ! break; ! case ctlSelectEvent: ! switch (event->data.ctlSelect.controlID) { ! case selectFrmCancel: ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! FrmReturnToForm(0); ! handled = true; ! break; ! case selectFrmOKButton: ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! ! if (true == TblGetSelection(tableP, &rowP, &columnP)) { ! data = TblGetItemPtr (tableP, rowP, columnP); ! if (data) { ! ResetPrefs(); ! pdbid = data->pdbid; ! CardNo = data->CardNo; ! MemMove (DBName,data->DBName,dmDBNameLength); ! } ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! FrmUpdateForm(resFormMain, 0); ! FrmReturnToForm(0); ! } else { ! TextH = DmGetResource(strRsc, NO_SELECTION); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! } ! handled = true; ! break; ! case selectFrmBeamButton: ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! ! if (true == TblGetSelection(tableP, &rowP, &columnP)) { ! data = TblGetItemPtr (tableP, rowP, columnP); ! if (data) { ! MemSet(&exgSocket, sizeof(exgSocket),0); ! exgSocket.description = data->DBName; ! exgSocket.name = "trainsched.pdb"; ! ! err = ExgPut(&exgSocket); ! if (!err) { ! err = ExgDBWrite(WriteDBData, &exgSocket, data->DBName, data->pdbid, data->CardNo); ! err = ExgDisconnect(&exgSocket, err); ! } ! } ! } else { ! TextH = DmGetResource(strRsc, NO_SELECTION); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! } ! handled = true; ! break; ! case selectFrmDeleteButton: ! tableP = FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm,selectFrmTable)); ! if (true == TblGetSelection(tableP, &rowP, &columnP)) { ! data = TblGetItemPtr (tableP, rowP, columnP); ! if (data) { ! if ((pdbid == data->pdbid) && (CardNo == data->CardNo)) { ! TextH = DmGetResource(strRsc, NO_DELETE); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! } else { ! /* FIXME error handling on delete */ ! DmDeleteDatabase (data->CardNo, data->pdbid); ! LoadSelTable(pForm, false); ! } ! } ! } else { ! TextH = DmGetResource(strRsc, NO_SELECTION); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! TblUnhighlightSelection(tableP); ! } ! handled = true; ! break; ! default: ! break; ! } ! break; ! case keyDownEvent: ! if (event->data.keyDown.modifiers & commandKeyMask) { /* physical key */ ! if (event->data.keyDown.chr == chrPageUp) { ! SclGetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), ! &val, &min, &max, &page); ! if ( val >= min ) { ! if ((val - min) < page) ! ScrollSelectValue -= val - min; ! else ! ScrollSelectValue -= page; ! LoadSelTable(pForm, false); ! } ! handled = true; ! } else if (event->data.keyDown.chr == chrPageDown) { ! SclGetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), ! &val, &min, &max, &page); ! if (val < max) { ! if ((max - val) < page) ! ScrollSelectValue += max - val; ! else ! ScrollSelectValue += page; ! LoadSelTable(pForm, false); ! } ! handled = true; ! } ! } ! break; ! case appStopEvent: ! // Just to make sure we free memory (NB: don't mark as handled). ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! default: ! break; ! } ! return handled; ! } ! ! /* Draws items in selection table */ ! void SelTableDrawItem(void * table, Int16 row, Int16 column, ! RectanglePtr bounds ) ! { ! TablePtr tableP = (TablePtr)table; ! char str[dmDBNameLength]={0}; ! RectangleType rect; ! dbrowType *data; ! ! /* Erase previous label */ ! rect = *bounds; ! rect.topLeft.x += 1; ! rect.topLeft.y += 1; ! rect.extent.y -= 1; ! WinEraseRectangle( &rect, 0 ); ! ! data = TblGetItemPtr(tableP,row,column); ! ! if (data) StrCopy (str, data->DBName); ! ! /* Draw new label */ ! FntSetFont(stdFont); ! WinDrawChars(str, StrLen(str), bounds->topLeft.x+2, bounds->topLeft.y); ! } ! ! /* Initialize The selectForm Table */ ! void InitSelTable(FormPtr pForm) ! { ! TablePtr tableP; ! Int32 i; ! UInt16 numRows=0; ! ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! numRows = TblGetNumberOfRows(tableP); ! ! /* Setup the rows of the table */ ! for(i=0; i<numRows;i++) { ! TblSetItemStyle( tableP, i, SELECTCOL, customTableItem ); ! } ! ! /* Make sure the columns are usable - so they draw */ ! TblSetColumnUsable( tableP, SELECTCOL, true ); ! TblHasScrollBar( tableP, true ); ! ! /* Set our custom table item draw callback */ ! TblSetCustomDrawProcedure( tableP, SELECTCOL, SelTableDrawItem ); ! } ! ! /* Populates and draw selectForm table ! * Update : false if this is the first call, true for a refresh (scrolling...) ! */ ! void LoadSelTable(FormPtr pForm, Boolean Update) ! { ! TablePtr tableP; ! Int16 i=0, j=0, oldscrollvalue=0; ! UInt16 numRows=0; ! Boolean newSearch = true; ! DmSearchStateType searchState; ! UInt16 CardNo; ! LocalID dbID; ! char name[dmDBNameLength]; ! dbrowType *pdbarrayP = NULL; ! ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! numRows = TblGetNumberOfRows(tableP); ! ! oldscrollvalue = ScrollSelectValue; ! ! if (Update == false) { ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! ! /* let's count how many databases we have in memory */ ! while (0 == DmGetNextDatabaseByTypeCreator(newSearch, &searchState, ! PDBTYPE, CREATORID, ! false, &CardNo, &dbID)) { ! selpdbcount++; ! newSearch=false; ! } ! ! if (selpdbcount > 0) { ! pdbarrayH = MemHandleNew(selpdbcount * sizeof(dbrowType)); ! pdbarrayP=MemHandleLock(pdbarrayH); ! ! newSearch = true; ! selpdbcount=0; ! while (0 == DmGetNextDatabaseByTypeCreator(newSearch, &searchState, ! PDBTYPE, CREATORID, ! false, &CardNo, &dbID)) { ! newSearch=false; ! ! DmDatabaseInfo(CardNo, dbID, name, NULL, NULL, NULL, NULL, NULL, ! NULL, NULL, NULL, NULL, NULL); ! ! MemMove(pdbarrayP[selpdbcount].DBName, name, dmDBNameLength); ! pdbarrayP[selpdbcount].CardNo = CardNo; ! pdbarrayP[selpdbcount].pdbid = dbID; ! ! selpdbcount++; ! } ! } ! } else { ! pdbarrayP=MemHandleLock(pdbarrayH); ! } ! ! /* avoid scrolling too much */ ! if ((selpdbcount - ScrollSelectValue) < numRows) { ! if (selpdbcount > numRows) { ! ScrollSelectValue = selpdbcount-numRows; ! } else { ! ScrollSelectValue = 0; ! } ! } ! ! i=j=0; ! while ((i < selpdbcount) && (j < numRows)) { ! if ((i < ScrollSelectValue) || (i > (ScrollSelectValue+numRows))) { ! pdbarrayP++; ! } else { ! TblSetItemPtr(tableP,j,SELECTCOL,(dbrowType*)pdbarrayP++); ! TblSetRowUsable(tableP, j, true); ! j++; ! } ! i++; ! } ! ! if (j < numRows) { ! while (j < numRows) { ! TblSetRowUsable(tableP, j, false); ! j++; ! } ! } ! ! SclSetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, ! selectFrmTableScrollBar)), ! oldscrollvalue, /* current value */ ! 0, /* min */ ! selpdbcount >= numRows ? selpdbcount-numRows+1 : 0, /*max*/ ! numRows-1 ); /* page size */ ! ! TblEraseTable(tableP); ! TblDrawTable(tableP); ! } ! ! /* Callback to ExgDBWrite for beaming */ ! Err WriteDBData(const void *dataP, UInt32 *sizeP, void *userDataP) ! { ! Err err; ! ! *sizeP = ExgSend((ExgSocketPtr)userDataP, (void*)dataP, *sizeP, &err); ! return err; ! } --- 1,350 ---- ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! #include <PalmOS.h> ! ! #include "trainsched.h" ! #include "selectform.h" ! ! // from trainsched.c ! void ResetPrefs(); ! ! // Global Variables ! Int16 ScrollSelectValue=0; ! MemHandle pdbarrayH=NULL; ! Int16 selpdbcount=0; ! ! // External veriables ! extern LocalID pdbid; ! extern UInt16 CardNo; ! extern char DBName[dmDBNameLength]; ! ! Boolean selectFormEventHandler(EventPtr event) ! { ! Boolean handled = false; ! FormPtr pForm = FrmGetActiveForm(); ! Int16 val, min, max, page; ! RectangleType r; ! TablePtr tableP; ! Int16 rowP, columnP; ! dbrowType *data; ! MemHandle TextH; ! ExgSocketType exgSocket; ! Err err = 0; ! ! switch (event->eType) { ! case frmOpenEvent: ! InitSelTable(pForm); ! // Fall through to the frmUpdateEvent. ! case frmUpdateEvent: ! FrmDrawForm(pForm); ! LoadSelTable(pForm, false); ! /* Draw the outline of the table */ ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! TblGetBounds(tableP, &r); ! WinDrawRectangleFrame( simpleFrame, &r ); ! handled = true; ! break; ! case sclRepeatEvent: ! ScrollSelectValue = event->data.sclRepeat.newValue; ! LoadSelTable(pForm, false); ! break; ! case ctlSelectEvent: ! switch (event->data.ctlSelect.controlID) { ! case selectFrmCancel: ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! FrmReturnToForm(0); ! handled = true; ! break; ! case selectFrmOKButton: ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! ! if (true == TblGetSelection(tableP, &rowP, &columnP)) { ! data = TblGetItemPtr (tableP, rowP, columnP); ! if (data) { ! ResetPrefs(); ! pdbid = data->pdbid; ! CardNo = data->CardNo; ! MemMove (DBName,data->DBName,dmDBNameLength); ! } ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! FrmUpdateForm(resFormMain, 0); ! FrmReturnToForm(0); ! } else { ! TextH = DmGetResource(strRsc, NO_SELECTION); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! } ! handled = true; ! break; ! case selectFrmBeamButton: ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! ! if (true == TblGetSelection(tableP, &rowP, &columnP)) { ! data = TblGetItemPtr (tableP, rowP, columnP); ! if (data) { ! MemSet(&exgSocket, sizeof(exgSocket),0); ! exgSocket.description = data->DBName; ! exgSocket.name = "trainsched.pdb"; ! ! err = ExgPut(&exgSocket); ! if (!err) { ! err = ExgDBWrite(WriteDBData, &exgSocket, data->DBName, data->pdbid, data->CardNo); ! err = ExgDisconnect(&exgSocket, err); ! } ! } ! } else { ! TextH = DmGetResource(strRsc, NO_SELECTION); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! } ! handled = true; ! break; ! case selectFrmDeleteButton: ! tableP = FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm,selectFrmTable)); ! if (true == TblGetSelection(tableP, &rowP, &columnP)) { ! data = TblGetItemPtr (tableP, rowP, columnP); ! if (data) { ! if ((pdbid == data->pdbid) && (CardNo == data->CardNo)) { ! TextH = DmGetResource(strRsc, NO_DELETE); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! } else { ! /* FIXME error handling on delete */ ! DmDeleteDatabase (data->CardNo, data->pdbid); ! LoadSelTable(pForm, false); ! } ! } ! } else { ! TextH = DmGetResource(strRsc, NO_SELECTION); ! FrmCustomAlert(alertDialog1, (char*) MemHandleLock(TextH), " ", " "); ! MemHandleUnlock(TextH); ! DmReleaseResource(TextH); ! TblUnhighlightSelection(tableP); ! } ! handled = true; ! break; ! default: ! break; ! } ! break; ! case keyDownEvent: ! if (event->data.keyDown.modifiers & commandKeyMask) { /* physical key */ ! if (event->data.keyDown.chr == chrPageUp) { ! SclGetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), ! &val, &min, &max, &page); ! if ( val >= min ) { ! if ((val - min) < page) ! ScrollSelectValue -= val - min; ! else ! ScrollSelectValue -= page; ! LoadSelTable(pForm, false); ! } ! handled = true; ! } else if (event->data.keyDown.chr == chrPageDown) { ! SclGetScrollBar(FrmGetObjectPtr(pForm, ! FrmGetObjectIndex(pForm, selectFrmTableScrollBar)), ! &val, &min, &max, &page); ! if (val < max) { ! if ((max - val) < page) ! ScrollSelectValue += max - val; ! else ! ScrollSelectValue += page; ! LoadSelTable(pForm, false); ! } ! handled = true; ! } ! } ! break; ! case appStopEvent: ! // Just to make sure we free memory (NB: don't mark as handled). ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! default: ! break; ! } ! return handled; ! } ! ! /* Draws items in selection table */ ! void SelTableDrawItem(void * table, Int16 row, Int16 column, ! RectanglePtr bounds ) ! { ! TablePtr tableP = (TablePtr)table; ! char str[dmDBNameLength]={0}; ! RectangleType rect; ! dbrowType *data; ! ! /* Erase previous label */ ! rect = *bounds; ! rect.topLeft.x += 1; ! rect.topLeft.y += 1; ! rect.extent.y -= 1; ! WinEraseRectangle( &rect, 0 ); ! ! data = TblGetItemPtr(tableP,row,column); ! ! if (data) StrCopy (str, data->DBName); ! ! /* Draw new label */ ! FntSetFont(stdFont); ! WinDrawChars(str, StrLen(str), bounds->topLeft.x+2, bounds->topLeft.y); ! } ! ! /* Initialize The selectForm Table */ ! void InitSelTable(FormPtr pForm) ! { ! TablePtr tableP; ! Int32 i; ! UInt16 numRows=0; ! ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! numRows = TblGetNumberOfRows(tableP); ! ! /* Setup the rows of the table */ ! for(i=0; i<numRows;i++) { ! TblSetItemStyle( tableP, i, SELECTCOL, customTableItem ); ! } ! ! /* Make sure the columns are usable - so they draw */ ! TblSetColumnUsable( tableP, SELECTCOL, true ); ! TblHasScrollBar( tableP, true ); ! ! /* Set our custom table item draw callback */ ! TblSetCustomDrawProcedure( tableP, SELECTCOL, SelTableDrawItem ); ! } ! ! /* Populates and draw selectForm table ! * Update : false if this is the first call, true for a refresh (scrolling...) ! */ ! void LoadSelTable(FormPtr pForm, Boolean Update) ! { ! TablePtr tableP; ! Int16 i=0, j=0, oldscrollvalue=0; ! UInt16 numRows=0; ! Boolean newSearch = true; ! DmSearchStateType searchState; ! UInt16 CardNo; ! LocalID dbID; ! char name[dmDBNameLength]; ! dbrowType *pdbarrayP = NULL; ! ! tableP = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,selectFrmTable)); ! numRows = TblGetNumberOfRows(tableP); ! ! oldscrollvalue = ScrollSelectValue; ! ! if (Update == false) { ! if (pdbarrayH) { ! MemHandleFree(pdbarrayH); ! pdbarrayH = NULL; ! } ! ! /* let's count how many databases we have in memory */ ! while (0 == DmGetNextDatabaseByTypeCreator(newSearch, &searchState, ! PDBTYPE, CREATORID, ! false, &CardNo, &dbID)) { ! selpdbcount++; ! newSearch=false; ! } ! ! if (selpdbcount > 0) { ! pdbarrayH = MemHandleNew(selpdbcount * sizeof(dbrowType)); ! pdbarrayP=MemHandleLock(pdbarrayH); ! ! newSearch = true; ! selpdbcount=0; ! while (0 == DmGetNextDatabaseByTypeCreator(newSearch, &searchState, ! PDBTYPE, CREATORID, ! false, &CardNo, &dbID)) { ! newSearch=false; ! ! DmDatabaseInfo(CardNo, dbID, name, NULL, NULL, NULL, NULL, NULL, ! NULL, NULL, NULL, NULL, NULL); ! ! MemMove(pdbarrayP[selpdbcount].DBName, name, dmDBNameLength); ! pdbarrayP[selpdbcount].CardNo = CardNo; ! pdbarrayP[selpdbcount].pdbid = dbID; ! ! selpdbcount++; ! } ! } ! } else { ! pdbarrayP=MemHandleLock(pdbarrayH); ! } ! ! /* avoid scrolling too much */ ! if ((selpdbcount - ScrollSelectValue) < numRows) { ! if (selpdbcount > numRows) { ! ScrollSelectValue = selpdbcount-numRows; ! } else { ! ScrollSelectValue = 0; ! } ! } ! ! i=j=0; ! while ((i < selpdbcount) && (j < numRows)) { ! if ((i < ScrollSelectValue) || (i > (ScrollSelectValue+numRows))) { ! pdbarrayP++; ! } else { ! TblSetItemPtr(tableP,j,SELECTCOL,(dbrowType*)pdbarrayP++); ! TblSetRowUsable(tableP, j, true); ! j++; ! } ! i++; ! } ! ! if (j < numRows) { ! while (j < numRows) { ! TblSetRowUsable(tableP, j, false); ! j++; ! } ! } ! ! SclSetScrollBar(FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, ! selectFrmTableScrollBar)), ! oldscrollvalue, /* current value */ ! 0, /* min */ ! selpdbcount >= numRows ? selpdbcount-numRows+1 : 0, /*max*/ ! numRows-1 ); /* page size */ ! ! TblEraseTable(tableP); ! TblDrawTable(tableP); ! } ! ! /* Callback to ExgDBWrite for beaming */ ! Err WriteDBData(const void *dataP, UInt32 *sizeP, void *userDataP) ! { ! Err err; ! ! *sizeP = ExgSend((ExgSocketPtr)userDataP, (void*)dataP, *sizeP, &err); ! return err; ! } Index: trainsched.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** trainsched.h 25 Apr 2009 16:14:10 -0000 1.10 --- trainsched.h 26 Apr 2009 08:06:50 -0000 1.11 *************** *** 1,76 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /************************************************************************** ! * Resources ! **************************************************************************/ ! /* Main Form */ ! #define resFormMain 1000 ! ! #define resTimeTable 1001 ! #define resTableScrollBar 1002 ! #define resFromList 1003 ! #define resFromTrigger 1004 ! #define resToList 1005 ! #define resToTrigger 1006 ! #define resDayList 1007 ! #define resDayTrigger 1008 ! #define resReverseBtn 1009 ! #define resTimeTable3c 1010 ! ! /* Menu */ ! #define MainFormMenuBar 2000 ! #define MainOptionsAboutCmd 2001 ! #define MainOptionsSelectCmd 2002 ! #define MainOptionsAbbreviations 2003 ! ! /* About dialog */ ! #define aboutForm 1100 ! #define aboutFormOkButton 1101 ! #define aboutBitmap 1102 ! ! /* Database selection dialog */ ! #define selectForm 1200 ! #define selectFrmTable 1201 ! #define selectFrmTableScrollBar 1202 ! #define selectFrmBeamButton 1203 ! #define selectFrmDeleteButton 1204 ! #define selectFrmOKButton 1205 ! #define selectFrmCancel 1206 ! ! /* Alert Dialog */ ! #define alertDialog1 1300 ! #define alertAbbreviations 1306 ! #define NO_PDB 1301 ! #define NO_SELECTION 1302 ! #define NO_DELETE 1303 ! #define NOT_IMPL 1304 ! ! /* Constants */ ! #define SHOWMAX 10 ! #define NOSELECTION 100 ! #define FROMCOL 0 ! #define TOCOL 1 ! #define INFOCOL 2 ! #define SELECTCOL 0 ! ! #define PREFAPPVERSION 2 ! #define CREATORID 'TRSC' ! #define PDBTYPE 'DATA' ! --- 1,76 ---- ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /************************************************************************** ! * Resources ! **************************************************************************/ ! /* Main Form */ ! #define resFormMain 1000 ! ! #define resTimeTable 1001 ! #define resTableScrollBar 1002 ! #define resFromList 1003 ! #define resFromTrigger 1004 ! #define resToList 1005 ! #define resToTrigger 1006 ! #define resDayList 1007 ! #define resDayTrigger 1008 ! #define resReverseBtn 1009 ! #define resTimeTable3c 1010 ! ! /* Menu */ ! #define MainFormMenuBar 2000 ! #define MainOptionsAboutCmd 2001 ! #define MainOptionsSelectCmd 2002 ! #define MainOptionsAbbreviations 2003 ! ! /* About dialog */ ! #define aboutForm 1100 ! #define aboutFormOkButton 1101 ! #define aboutBitmap 1102 ! ! /* Database selection dialog */ ! #define selectForm 1200 ! #define selectFrmTable 1201 ! #define selectFrmTableScrollBar 1202 ! #define selectFrmBeamButton 1203 ! #define selectFrmDeleteButton 1204 ! #define selectFrmOKButton 1205 ! #define selectFrmCancel 1206 ! ! /* Alert Dialog */ ! #define alertDialog1 1300 ! #define alertAbbreviations 1306 ! #define NO_PDB 1301 ! #define NO_SELECTION 1302 ! #define NO_DELETE 1303 ! #define NOT_IMPL 1304 ! ! /* Constants */ ! #define SHOWMAX 10 ! #define NOSELECTION 100 ! #define FROMCOL 0 ! #define TOCOL 1 ! #define INFOCOL 2 ! #define SELECTCOL 0 ! ! #define PREFAPPVERSION 2 ! #define CREATORID 'TRSC' ! #define PDBTYPE 'DATA' ! Index: timetable.h =================================================================== RCS file: /cvsroot/trainsched/trainsched/timetable.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timetable.h 25 Apr 2009 16:14:10 -0000 1.1 --- timetable.h 26 Apr 2009 08:06:50 -0000 1.2 *************** *** 1,38 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! #define STATIONRECORD 0 ! #define DAYRECORD 1 ! #define OFFSETRECORD 2 ! ! #define STATIONMAXNUM 30 ! #define STATIONMAXLENGTH 20 ! #define DAYMAXLENGTH 9 ! #define MAX_ABBREVIATIONS 40 ! ! #define ABBR_PDB 'ABBR' ! ! // Function prototypes ! Int16 getStationNames(DmOpenRef pdbfd); ! Boolean getAbbreviationsDefined(); ! UInt16 getNumberOfRecords(); ! void getAbbreviations(); ! Int16 getDays(DmOpenRef pdbfd); ! Int16 getOffsets(DmOpenRef pdbfd); ! Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station); ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum); --- 1,38 ---- ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! #define STATIONRECORD 0 ! #define DAYRECORD 1 ! #define OFFSETRECORD 2 ! ! #define STATIONMAXNUM 30 ! #define STATIONMAXLENGTH 20 ! #define DAYMAXLENGTH 9 ! #define MAX_ABBREVIATIONS 40 ! ! #define ABBR_PDB 'ABBR' ! ! // Function prototypes ! Int16 getStationNames(DmOpenRef pdbfd); ! Boolean getAbbreviationsDefined(); ! UInt16 getNumberOfRecords(); ! void getAbbreviations(); ! Int16 getDays(DmOpenRef pdbfd); ! Int16 getOffsets(DmOpenRef pdbfd); ! Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station); ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum); Index: trainsched.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/trainsched.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** trainsched.c 25 Apr 2009 16:14:10 -0000 1.24 --- trainsched.c 26 Apr 2009 08:06:50 -0000 1.25 *************** *** 1,798 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, [...1582 lines suppressed...] ! seconds = TimGetSeconds(); ! dateTimeP = MemPtrNew(sizeof(DateTimeType)); ! TimSecondsToDateTime(seconds,dateTimeP); ! ! len = StrLen(DBName); ! if(len>31) len = 31; /* bad hack */ ! ! StrNCopy(FormTitle,DBName,len); ! StrCat(FormTitle," "); ! ! asctime=MemPtrNew(10); ! TimeToAscii(dateTimeP->hour,dateTimeP->minute,tfColon24h,asctime); ! ! StrCat(FormTitle,asctime); ! ! FrmSetTitle(pForm,FormTitle); ! ! MemPtrFree(asctime); ! MemPtrFree(dateTimeP); ! } Index: timetable.c =================================================================== RCS file: /cvsroot/trainsched/trainsched/timetable.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timetable.c 25 Apr 2009 16:14:10 -0000 1.1 --- timetable.c 26 Apr 2009 08:06:50 -0000 1.2 *************** *** 1,313 **** ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! #include <PalmOS.h> ! ! #include "timetable.h" ! #include "trainsched.h" ! ! extern char StationNames[STATIONMAXNUM][STATIONMAXLENGTH+1]; ! extern char DayNames[7][DAYMAXLENGTH+1]; ! extern UInt16 OffsetList[14]; ! extern UInt16 numstations,numdays; ! extern char Abbreviations[MAX_ABBREVIATIONS][10]; ! extern char szAbbreviations[300]; ! ! UInt16 NumRecords=0; ! Boolean abbrevDefined; ! ! /* ! * Get the Station Names. This function sets the global variables StationNames ! * and numstations for the current timetable database. If the variables were ! * successfully initialised then true is returned. If there was a problem ! * accessing the database then false is returned. ! */ ! Int16 getStationNames(DmOpenRef pdbfd) ! { ! char *recordP; ! MemHandle rec_mh; ! UInt16 recPos; ! UInt16 strPos; ! Int16 result = false; ! ! MemSet (StationNames, sizeof(StationNames), 0); ! numstations=0; ! abbrevDefined=false; ! ! // Get number of records in database. ! NumRecords = DmNumRecords(pdbfd); ! ! if (NumRecords > STATIONRECORD) ! { ! // populate StationNames from database. ! rec_mh = DmQueryRecord(pdbfd,STATIONRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! recPos = 0; ! strPos = 0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '\t') { ! StationNames[numstations][strPos]='\0'; ! numstations++; ! strPos=0; ! } else { ! StationNames[numstations][strPos]=recordP[recPos]; ! strPos++; ! } ! recPos++; ! } ! StationNames[numstations][strPos]='\0'; ! numstations++; ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! result = true; // We successfully read the record. ! ! // Special case if last Station name is DUMMY, it is the abbreviations column. ! if (StrNCompare("DUMMY", StationNames[numstations-1], 5) == 0) { ! abbrevDefined=true; ! numstations--; ! } ! } ! } ! return result; ! } ! ! /* ! * Determines whether or not the current database contains abbreviations. ! * This will only be valid after the StationNames have been retrieved for the ! * first time. ! * Returns true if abbreviations are present. ! */ ! Boolean getAbbreviationsDefined() ! { ! return abbrevDefined; ! } ! ! /* ! * Determine the total number of records in the timetable database. ! * This will only be valid after the StationNames have been retrieved for the ! * first time. ! */ ! UInt16 getNumberOfRecords() ! { ! return NumRecords; ! } ! ! /* ! * Get the Abbreviations. This function sets the global variable Abbreviations ! * either from a defined database, or default values if the database does not exist. ! */ ! void getAbbreviations() ! { ! DmOpenRef hAbbrevDb; ! DmSearchStateType searchState; ! UInt16 nNumRecords, uCardNum; ! Int16 i, strLen; ! LocalID lID; ! MemHandle hAbbrevRec; ! uCardNum = 0; ! ! // See if there is an Abbreviations Database. ! if (0 == DmGetNextDatabaseByTypeCreator(true, &searchState, ABBR_PDB, CREATORID, false, &uCardNum, &lID)) ! { ! // Yes, load the defined Abbreviations from it. ! hAbbrevDb = DmOpenDatabase(uCardNum, lID, dmModeReadOnly); ! if (hAbbrevDb != 0) ! { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, 0); ! StrCopy(szAbbreviations, MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! /* Convert '|' to '\n'. */ ! strLen = StrLen(szAbbreviations); ! for (i=0; i<strLen; i++) ! if (szAbbreviations[i] == '|') szAbbreviations[i] = '\n'; ! ! nNumRecords = DmNumRecords(hAbbrevDb); ! /* Read in the abbreviations. */ ! for (i=1; i<=MAX_ABBREVIATIONS; i++) ! { ! /* Default to an empty string. */ ! StrCopy(Abbreviations[i], ""); ! ! /* Ensure index is in range because some releases will */ ! /* display fatal error message if DmQueryRecords() called */ ! /* an out-of-range record number. */ ! if (i <= nNumRecords) ! { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, i); ! if (hAbbrevRec != NULL) ! { ! StrCopy(Abbreviations[i], MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! } ! } ! } ! } ! } ! else ! { ! // No Abbreviations DB, use default values. ! StrCopy( szAbbreviations, "EWD = Mon to Sat\nM-F = Monday to Friday\nT-F = Tuesday to Friday\nMO/WO/FO/SO = Mon/Wed/Fri/Sat only\nWX/FX = Except Wed/Fri\nFSX = Fri/Sat excluded\nFSO = Fri/Sat only\nM-TH = Mon to Thurs" ); ! ! for (i=1; i<=MAX_ABBREVIATIONS; i++) StrCopy(Abbreviations[i], ""); ! StrCopy(Abbreviations[1], "EWD"); ! StrCopy(Abbreviations[2], "M-F"); ! StrCopy(Abbreviations[3], "FO"); ! StrCopy(Abbreviations[4], "SO"); ! StrCopy(Abbreviations[5], "T-F"); ! StrCopy(Abbreviations[6], "MO"); ! StrCopy(Abbreviations[7], "WO"); ! StrCopy(Abbreviations[8], "WX"); ! StrCopy(Abbreviations[9], "FX"); ! StrCopy(Abbreviations[10], "FSX"); ! StrCopy(Abbreviations[11], "FSO"); ! StrCopy(Abbreviations[12], "M-TH"); ! } ! } ! ! /* ! * Get the Days. This function sets the global variables DayNames ! * and numdays for the current timetable database. If the variables were ! * successfully initialised then true is returned. If there was a problem ! * accessing the database then false is returned. ! */ ! Int16 getDays(DmOpenRef pdbfd) ! { ! MemHandle rec_mh; ! char *recordP; ! UInt16 recPos; ! UInt16 strPos; ! Int16 result = false; ! ! MemSet (DayNames, sizeof(DayNames), 0); ! numdays=0; ! ! // Get number of records in database. ! NumRecords = DmNumRecords(pdbfd); ! ! if (NumRecords > DAYRECORD) ! { ! // populate DayList from database. ! rec_mh = DmQueryRecord(pdbfd,DAYRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! recPos=0; ! strPos=0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '\t') { ! DayNames[numdays][strPos]='\0'; ! numdays++; ! strPos=0; ! } else { ! DayNames[numdays][strPos] = recordP[recPos]; ! strPos++; ! } ! recPos++; ! } ! DayNames[numdays][strPos]='\0'; ! numdays++; ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! result = true; ! } ! } ! return result; ! } ! ! /* ! * Get the Offsets for the start of each timetable entry. This function sets ! * the global variable Offsets for the current timetable database. If the ! * variable was successfully initialised then true is returned. If there was a ! * problem accessing the database then false is returned. ! */ ! Int16 getOffsets(DmOpenRef pdbfd) ! { ! MemHandle rec_mh; ! char *recordP; ! Int16 offsetNo; ! Int16 result = false; ! ! // Get number of records in database. ! NumRecords = DmNumRecords(pdbfd); ! ! if (NumRecords > OFFSETRECORD) ! { ! // get offset for directions and days from database. ! rec_mh = DmQueryRecord(pdbfd, OFFSETRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! ! for(offsetNo=0; offsetNo<(numdays*2); offsetNo++) ! OffsetList[offsetNo] = (recordP[(offsetNo*2)+1] & 0xFF) | (recordP[offsetNo*2] << 8); ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! ! result = true; ! } ! } ! return result; ! } ! ! /* ! * Get the time for a given timetable entry and station. Returns time as a ! * signed number (e.g. 07:45 = 745). -1 indicates no time for given station. ! */ ! Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station) ! { ! MemHandle rec_mh; ! char *recordP; ! Int16 time = -1; ! ! rec_mh = DmQueryRecord(pdbfd, recNum); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! time = (recordP[(station*2)+1] & 0xFF) | (recordP[station*2] << 8); ! MemHandleUnlock(rec_mh); ! } ! return time; ! } ! ! /* ! * Get the abbreviation entry number for a given timetable entry. Will return ! * 0 if the database does not support abbreviations. ! */ ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum) ! { ! MemHandle rec_mh; ! char *recordP; ! Int16 abbrev = 0; ! ! if (abbrevDefined) ! { ! rec_mh = DmQueryRecord(pdbfd, recNum); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! abbrev = (recordP[(numstations*2)+1] & 0xFF) | (recordP[numstations*2] << 8); ! MemHandleUnlock(rec_mh); ! } ! } ! return abbrev; } \ No newline at end of file --- 1,313 ---- ! /* Trainsched.c - display train schedule on Palm Pilot ! * (C) 2001 Philippe Marzouk <ph...@us...> ! */ ! /* ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! #include <PalmOS.h> ! ! #include "timetable.h" ! #include "trainsched.h" ! ! extern char StationNames[STATIONMAXNUM][STATIONMAXLENGTH+1]; ! extern char DayNames[7][DAYMAXLENGTH+1]; ! extern UInt16 OffsetList[14]; ! extern UInt16 numstations,numdays; ! extern char Abbreviations[MAX_ABBREVIATIONS][10]; ! extern char szAbbreviations[300]; ! ! UInt16 NumRecords=0; ! Boolean abbrevDefined; ! ! /* ! * Get the Station Names. This function sets the global variables StationNames ! * and numstations for the current timetable database. If the variables were ! * successfully initialised then true is returned. If there was a problem ! * accessing the database then false is returned. ! */ ! Int16 getStationNames(DmOpenRef pdbfd) ! { ! char *recordP; ! MemHandle rec_mh; ! UInt16 recPos; ! UInt16 strPos; ! Int16 result = false; ! ! MemSet (StationNames, sizeof(StationNames), 0); ! numstations=0; ! abbrevDefined=false; ! ! // Get number of records in database. ! NumRecords = DmNumRecords(pdbfd); ! ! if (NumRecords > STATIONRECORD) ! { ! // populate StationNames from database. ! rec_mh = DmQueryRecord(pdbfd,STATIONRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! recPos = 0; ! strPos = 0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '\t') { ! StationNames[numstations][strPos]='\0'; ! numstations++; ! strPos=0; ! } else { ! StationNames[numstations][strPos]=recordP[recPos]; ! strPos++; ! } ! recPos++; ! } ! StationNames[numstations][strPos]='\0'; ! numstations++; ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! result = true; // We successfully read the record. ! ! // Special case if last Station name is DUMMY, it is the abbreviations column. ! if (StrNCompare("DUMMY", StationNames[numstations-1], 5) == 0) { ! abbrevDefined=true; ! numstations--; ! } ! } ! } ! return result; ! } ! ! /* ! * Determines whether or not the current database contains abbreviations. ! * This will only be valid after the StationNames have been retrieved for the ! * first time. ! * Returns true if abbreviations are present. ! */ ! Boolean getAbbreviationsDefined() ! { ! return abbrevDefined; ! } ! ! /* ! * Determine the total number of records in the timetable database. ! * This will only be valid after the StationNames have been retrieved for the ! * first time. ! */ ! UInt16 getNumberOfRecords() ! { ! return NumRecords; ! } ! ! /* ! * Get the Abbreviations. This function sets the global variable Abbreviations ! * either from a defined database, or default values if the database does not exist. ! */ ! void getAbbreviations() ! { ! DmOpenRef hAbbrevDb; ! DmSearchStateType searchState; ! UInt16 nNumRecords, uCardNum; ! Int16 i, strLen; ! LocalID lID; ! MemHandle hAbbrevRec; ! uCardNum = 0; ! ! // See if there is an Abbreviations Database. ! if (0 == DmGetNextDatabaseByTypeCreator(true, &searchState, ABBR_PDB, CREATORID, false, &uCardNum, &lID)) ! { ! // Yes, load the defined Abbreviations from it. ! hAbbrevDb = DmOpenDatabase(uCardNum, lID, dmModeReadOnly); ! if (hAbbrevDb != 0) ! { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, 0); ! StrCopy(szAbbreviations, MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! /* Convert '|' to '\n'. */ ! strLen = StrLen(szAbbreviations); ! for (i=0; i<strLen; i++) ! if (szAbbreviations[i] == '|') szAbbreviations[i] = '\n'; ! ! nNumRecords = DmNumRecords(hAbbrevDb); ! /* Read in the abbreviations. */ ! for (i=1; i<=MAX_ABBREVIATIONS; i++) ! { ! /* Default to an empty string. */ ! StrCopy(Abbreviations[i], ""); ! ! /* Ensure index is in range because some releases will */ ! /* display fatal error message if DmQueryRecords() called */ ! /* an out-of-range record number. */ ! if (i <= nNumRecords) ! { ! hAbbrevRec = DmQueryRecord(hAbbrevDb, i); ! if (hAbbrevRec != NULL) ! { ! StrCopy(Abbreviations[i], MemHandleLock(hAbbrevRec)); ! MemHandleUnlock(hAbbrevRec); ! } ! } ! } ! } ! } ! else ! { ! // No Abbreviations DB, use default values. ! StrCopy( szAbbreviations, "EWD = Mon to Sat\nM-F = Monday to Friday\nT-F = Tuesday to Friday\nMO/WO/FO/SO = Mon/Wed/Fri/Sat only\nWX/FX = Except Wed/Fri\nFSX = Fri/Sat excluded\nFSO = Fri/Sat only\nM-TH = Mon to Thurs" ); ! ! for (i=1; i<=MAX_ABBREVIATIONS; i++) StrCopy(Abbreviations[i], ""); ! StrCopy(Abbreviations[1], "EWD"); ! StrCopy(Abbreviations[2], "M-F"); ! StrCopy(Abbreviations[3], "FO"); ! StrCopy(Abbreviations[4], "SO"); ! StrCopy(Abbreviations[5], "T-F"); ! StrCopy(Abbreviations[6], "MO"); ! StrCopy(Abbreviations[7], "WO"); ! StrCopy(Abbreviations[8], "WX"); ! StrCopy(Abbreviations[9], "FX"); ! StrCopy(Abbreviations[10], "FSX"); ! StrCopy(Abbreviations[11], "FSO"); ! StrCopy(Abbreviations[12], "M-TH"); ! } ! } ! ! /* ! * Get the Days. This function sets the global variables DayNames ! * and numdays for the current timetable database. If the variables were ! * successfully initialised then true is returned. If there was a problem ! * accessing the database then false is returned. ! */ ! Int16 getDays(DmOpenRef pdbfd) ! { ! MemHandle rec_mh; ! char *recordP; ! UInt16 recPos; ! UInt16 strPos; ! Int16 result = false; ! ! MemSet (DayNames, sizeof(DayNames), 0); ! numdays=0; ! ! // Get number of records in database. ! NumRecords = DmNumRecords(pdbfd); ! ! if (NumRecords > DAYRECORD) ! { ! // populate DayList from database. ! rec_mh = DmQueryRecord(pdbfd,DAYRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! recPos=0; ! strPos=0; ! while (recordP[recPos] != '\0') { ! if(recordP[recPos] == '\t') { ! DayNames[numdays][strPos]='\0'; ! numdays++; ! strPos=0; ! } else { ! DayNames[numdays][strPos] = recordP[recPos]; ! strPos++; ! } ! recPos++; ! } ! DayNames[numdays][strPos]='\0'; ! numdays++; ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! result = true; ! } ! } ! return result; ! } ! ! /* ! * Get the Offsets for the start of each timetable entry. This function sets ! * the global variable Offsets for the current timetable database. If the ! * variable was successfully initialised then true is returned. If there was a ! * problem accessing the database then false is returned. ! */ ! Int16 getOffsets(DmOpenRef pdbfd) ! { ! MemHandle rec_mh; ! char *recordP; ! Int16 offsetNo; ! Int16 result = false; ! ! // Get number of records in database. ! NumRecords = DmNumRecords(pdbfd); ! ! if (NumRecords > OFFSETRECORD) ! { ! // get offset for directions and days from database. ! rec_mh = DmQueryRecord(pdbfd, OFFSETRECORD); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! ! for(offsetNo=0; offsetNo<(numdays*2); offsetNo++) ! OffsetList[offsetNo] = (recordP[(offsetNo*2)+1] & 0xFF) | (recordP[offsetNo*2] << 8); ! ! // release lock on record. ! MemHandleUnlock(rec_mh); ! ! result = true; ! } ! } ! return result; ! } ! ! /* ! * Get the time for a given timetable entry and station. Returns time as a ! * signed number (e.g. 07:45 = 745). -1 indicates no time for given station. ! */ ! Int16 getTime(DmOpenRef pdbfd, UInt16 recNum, Int8 station) ! { ! MemHandle rec_mh; ! char *recordP; ! Int16 time = -1; ! ! rec_mh = DmQueryRecord(pdbfd, recNum); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! time = (recordP[(station*2)+1] & 0xFF) | (recordP[station*2] << 8); ! MemHandleUnlock(rec_mh); ! } ! return time; ! } ! ! /* ! * Get the abbreviation entry number for a given timetable entry. Will return ! * 0 if the database does not support abbreviations. ! */ ! Int16 getAbbrev(DmOpenRef pdbfd, UInt16 recNum) ! { ! MemHandle rec_mh; ! char *recordP; ! Int16 abbrev = 0; ! ! if (abbrevDefined) ! { ! rec_mh = DmQueryRecord(pdbfd, recNum); ! if (rec_mh) ! { ! recordP = MemHandleLock(rec_mh); ! abbrev = (recordP[(numstations*2)+1] & 0xFF) | (recordP[numstations*2] << 8); ! MemHandleUnlock(rec_mh); ! } ! } ! return abbrev; } \ No newline at end of file |