;+ ; NAME: ; ascii_template_code ; ; ; PURPOSE: ; pit the code needed to hard code an ascii_template() in a read routine ; ; ; CATEGORY: ; coding help ; ; ; OUTPUTS: ; code printed to the screen ; ; ; RESTRICTIONS: ; limited testing, but has worked in each case I have tested on IDL6.4 ; ; ; ; EXAMPLE: ; I cant come up with a simple one... ; IDL> ascii_template_code ; template = create_struct('version', 1.00000, $ ; 'datastart', 1l, $ ; 'delimiter', 32b, $ ; 'missingvalue', !values.f_nan, $ ; 'commentsymbol', '', $ ; 'fieldcount', 2l, $ ; 'fieldtypes', lonarr( 2), $ ; 'fieldnames', strarr( 2), $ ; 'fieldlocations', lonarr( 2), $ ; 'fieldgroups', lonarr( 2) ) ; template.fieldnames = [ $ ; 'PHI', $ ; 'FIELD2'] ; template.fieldtypes = [ $ ; 4, $ ; 4] ; template.fieldlocations = [ $ ; 6, $ ; 18] ; template.fieldgroups = [ $ ; 0, $ ; 1] ; ; ; ; MODIFICATION HISTORY: ; ; Mon Oct 1 15:26:51 2007, Brian Larsen ; ; written and tested ; ;- pro ascii_template_code compile_opt strictarr temp = ascii_template() print, ';----------SNIP---------' print, ';;;;;;;; Created by ASCII_TEMPLATE_CODE ;;;;;;;;;;' print, "template = create_struct('version'," + string(temp.version) + ', $' print, "'datastart'," + string(temp.datastart)+'l, $' print, "'delimiter'," + string(fix(temp.delimiter))+'b, $' if not finite(temp.missingvalue) then $ print, "'missingvalue', !values.f_nan, $" $ else $ print, "'missingvalue'," + string(temp.missingvalue) + ', $' print, "'commentsymbol', '"+ temp.commentsymbol + "', $" print, "'fieldcount'," + string(temp.fieldcount) + 'l, $' print, "'fieldtypes', lonarr("+string(temp.fieldcount)+'), $' print, "'fieldnames', strarr("+string(temp.fieldcount)+'), $' print, "'fieldlocations', lonarr("+string(temp.fieldcount)+'), $' print, "'fieldgroups', lonarr("+string(temp.fieldcount)+') )' print, "template.fieldnames = [ $" for i=0l, temp.fieldcount-2 do $ print, "'" + temp.fieldnames[i] + "', $" print, "'" + temp.fieldnames[i] + "']" print, "template.fieldtypes = [ $" for i=0l, temp.fieldcount-2 do $ print, string(temp.fieldtypes[i]) + ", $" print, string(temp.fieldtypes[i]) + "]" print, "template.fieldlocations = [ $" for i=0l, temp.fieldcount-2 do $ print, string(temp.fieldlocations[i]) + ", $" print, string(temp.fieldlocations[i]) + "]" print, "template.fieldgroups = [ $" for i=0l, temp.fieldcount-2 do $ print, string(temp.fieldgroups[i]) + ", $" print, string(temp.fieldgroups[i]) + "]" print, ';----------SNIP---------' return end