Re: [Gpsbabel-code] target-specific arg lists added
Brought to you by:
robertl
From: Alex M. <al...@co...> - 2002-11-26 19:03:52
|
> > >Good. I was sort of hoping I could bait you into doing the work. :-) > And I'm kinda hoping you may accept it some day after you see it. :) To make a long story short, I sent some stuff to the list on Friday of my intent for an XSV parser (at least I thought I did, probably not). I don't think it ever made it. I've tossed together something that appears to be working for all of the mutants I've tried it against: csv, ozi, maptech, xmap_conduit, tiger, and now NIMA and xmap_waypoint. The gpsmans (gpsmen?) of the world will have to wait until I'm certain this is the way to go... Here's the format I eventually ended up with for what I'm going to call a "style" file. I opted to make it "one directive per line" as my original intent was to make it parse itself. :) : # gpsbabel XSV style file # # Format: OziExplorer Waypoint File Version 1.1 # Author: Alex Mottram # Date: 11/24/2002 # # # FILE LAYOUT DEFINITIONS: # FIELD_DELIMITER COMMA RECORD_DELIMITER NEWLINE BADCHARS , # # HEADER STUFF: # PROLOGUE OziExplorer Waypoint File Version 1.1 PROLOGUE WGS 84 PROLOGUE Reserved 2 PROLOGUE Reserved 3 # # INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE: # The Ozi Spec says we don't need all these constants, but we put # them anyway to stay in line with what ozi.c does. We could technically # stop at whatever point we have the data we need (ALT_FEET). # IFIELD INDEX, "", "%4d" IFIELD SHORTNAME, "", "%-14.14s" IFIELD LAT_DECIMAL, "", "%11.6f" IFIELD LON_DECIMAL, "", "%11.6f" IFIELD CONSTANT, "0", "%11s" # DAYS SINCE 1900 as DAYS.DAYS (5.5) IFIELD CONSTANT, "0", "%3s" # ICONS IFIELD CONSTANT, "1", "%2s" # CONSTANT 1 IFIELD CONSTANT, "3", "%2s" # DISPLAY FORMAT OPTIONS IFIELD CONSTANT, "0", "%10s" # FOREGROUND COLOR IFIELD CONSTANT, "65535", "%10s" # BACKGROUND COLOR IFIELD DESCRIPTION, "", "%-40.40s" IFIELD CONSTANT, "0", "%2s" # POINTER DIRECTION IFIELD CONSTANT, "0", "%2s" # GARMIN DISPLAY FLAGS IFIELD CONSTANT, "0", "%5s" # PROXIMITY DISTANCE-METERS IFIELD ALT_FEET, "", "%7.0f" # ALTITUDE IN FEET IFIELD CONSTANT, "6", "%2s" # WAYPOINT NAME TEXT SIZE IFIELD CONSTANT, "0", "%2s" # BOLD CHECKBOX IFIELD CONSTANT, "17", "%2s" # SYMBOL SIZE I've even slapped together a bit of a "README" for the style file as it's destined to grow (I'm *not* a technical writer). In it's current form it can: o Read an XSV file into a waypt struct. o Write an XSV file from a waypt struct. o Re-map an XSV in/out using "IFIELD (input)" and "OFIELD (output)" designations. (that's a side-effect of other functionality that I'm still not sure I needed to add) o All but do-away with ozi.c, csv.c, mxf.c, tiger.c, etc.... I think the only pieces left are to create parsings for the other position styles (LXX_DMS, LXX_DMM, LAT_DIR, LON_DIR, etc...) and come up with an acceptable method for getting mkshort() settings into the mix. Oh yeah, and some sort of mutant case for testo and a link to some sort of "idiot's guide to printf conversions." At this point, parsing TIME is out of the question. :) The current method for invoking XSV styles is: [alex@machine gpsbabe]$ ./gpsbabel -s -i geo -f geocaching.loc -o xsv,style=style/maptech.style,snlen=16,snwhite=0 -F /dev/fd/1 35.97203, -87.13470, Mountain Bike Heaven by susy1313, MountainBikeHevn, Mountain Bike Heaven by susy1313, ff0000, 47 ... Any comments/suggestions before I roll this into a patch? I'm out for a few days, so there's no rush. I think this is going to be pretty cool, for lack of a better word... Thanks, Alex |