Programming help request
Ok, I've got my nifty-neato weather station running. But the program for putting the data on the web insists on doing so by creating a *graphic*. This is seriously stupid. Especially given that it's working from a *text* data file.
The file seems to be formatted like a Windows INI file. I know there are routines out there for parsing such files, so I'd rather not re-invent the wheel.
What I need are a set of functions for extracting info from such files. Ones that can be plugged into a BASIC that's not too far from QuickBasic or TurboBasic. Or into Turbo Pascal 7. Yes, I'm behind the times, deal.
My goal is to generate and upload an HTML file from the text file. I can do the automatic FTP easily, just takes a simple 4NT script.
It's parsing the file that is going to be a pain. I'd rather have generalized code that I could re-use later than write something that's specific to the format of this data file.
Here's a sample of the file:
[header]
programm_name = "heavy weather"
programm_version = "Ver. 2.0 beta release"
file_name = "currdat.lst"
file_format_version = "ver. 1.0"
[time]
start = 3311155037
start_date_string = "Sat Dec 04 05:17:17 2004"
last_actualisation = 3311157092
last_actualisation_date_string = "Sat Dec 04 05:51:32 2004"
next_actualisation = 3311157152
next_actualisation_date_string = "Sat Dec 04 05:52:32 2004"
[weather_picture]
comment = "-1=not valid, 0=rain, 1=cloud, 2=sun"
number = 0
[weather_tendency]
comment_1 = "-1=not valid, 0=no change of air pressure"
comment_2 = " 1=air pressure rising, 2=air pressure falling"
number = 2
[indoor_temperature]
deg_C = "22.0"
deg_F = "71.6"
[outdoor_temperature]
deg_C = "5.6"
deg_F = "42.0"
[indoor_humidity]
percent = "24"
[outdoor_humidity]
percent = "76"
[dewpoint]
deg_C = "1.7"
deg_F = "35.2"
[windchill]
deg_C = "---"
deg_F = "---"
[wind_speed]
mps = "---"
kmh = "---"
mph = "---"
knt = "---"
bft = "--"
[wind_direction]
deg = "---.-"
name = "---"
[rain_total]
mm = "0.0"
inch = "0.00"
[rain_24h]
mm = "0.0"
inch = "0.00"
[rain_1h]
mm = "0.0"
inch = "0.00"
[pressure_absolute]
hpa = "1000.1"
inHg = "29.53"
[pressure_relative]
hpa = "1009.1"
inHg = "29.79"
[storm_alarm]
comment = "-1=not valid, 0=storm alarm not activ, 1=storm alarm activ"
number = 1
The file seems to be formatted like a Windows INI file. I know there are routines out there for parsing such files, so I'd rather not re-invent the wheel.
What I need are a set of functions for extracting info from such files. Ones that can be plugged into a BASIC that's not too far from QuickBasic or TurboBasic. Or into Turbo Pascal 7. Yes, I'm behind the times, deal.
My goal is to generate and upload an HTML file from the text file. I can do the automatic FTP easily, just takes a simple 4NT script.
It's parsing the file that is going to be a pain. I'd rather have generalized code that I could re-use later than write something that's specific to the format of this data file.
Here's a sample of the file:
[header]
programm_name = "heavy weather"
programm_version = "Ver. 2.0 beta release"
file_name = "currdat.lst"
file_format_version = "ver. 1.0"
[time]
start = 3311155037
start_date_string = "Sat Dec 04 05:17:17 2004"
last_actualisation = 3311157092
last_actualisation_date_string = "Sat Dec 04 05:51:32 2004"
next_actualisation = 3311157152
next_actualisation_date_string = "Sat Dec 04 05:52:32 2004"
[weather_picture]
comment = "-1=not valid, 0=rain, 1=cloud, 2=sun"
number = 0
[weather_tendency]
comment_1 = "-1=not valid, 0=no change of air pressure"
comment_2 = " 1=air pressure rising, 2=air pressure falling"
number = 2
[indoor_temperature]
deg_C = "22.0"
deg_F = "71.6"
[outdoor_temperature]
deg_C = "5.6"
deg_F = "42.0"
[indoor_humidity]
percent = "24"
[outdoor_humidity]
percent = "76"
[dewpoint]
deg_C = "1.7"
deg_F = "35.2"
[windchill]
deg_C = "---"
deg_F = "---"
[wind_speed]
mps = "---"
kmh = "---"
mph = "---"
knt = "---"
bft = "--"
[wind_direction]
deg = "---.-"
name = "---"
[rain_total]
mm = "0.0"
inch = "0.00"
[rain_24h]
mm = "0.0"
inch = "0.00"
[rain_1h]
mm = "0.0"
inch = "0.00"
[pressure_absolute]
hpa = "1000.1"
inHg = "29.53"
[pressure_relative]
hpa = "1009.1"
inHg = "29.79"
[storm_alarm]
comment = "-1=not valid, 0=storm alarm not activ, 1=storm alarm activ"
number = 1
no subject
no subject
And thed thing is, I *know* I've seen a library like I need. I just don't recall when or where.
no subject
Back to your original question, though - I poked 'Pascal library read ini' into Google, and one of the pages it came back with was http://www.bookcase.com/library/software/msdos.devel.apps.turbo-pascal.html. That page contains a LONG listing of libraries and utilities for Pascal, mostly the Borland series, and one of the items listed was EZ-INI1S, with a link to ftp://ftp.simtel.net/pub/simtelnet/msdos/turbopas/ez_ini1s.zip - so have fun!