From 64cfd30f62974a1715b10e81301405a8abc6f8db Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 15 Apr 2010 11:32:56 -0500 Subject: [PATCH] Move Cdefs to the top of the record body. Refine when field attribute values get double-quoted. --- src/dbHost/DBD/Output.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dbHost/DBD/Output.pm b/src/dbHost/DBD/Output.pm index eaff9c45c..c373a3683 100644 --- a/src/dbHost/DBD/Output.pm +++ b/src/dbHost/DBD/Output.pm @@ -42,17 +42,17 @@ sub OutputRecordtypes { my ($out, $recordtypes) = @_; while (my ($name, $recordtype) = each %{$recordtypes}) { printf $out "recordtype(%s) {\n", $name; + print $out " %$_\n" + foreach $recordtype->cdefs; foreach $field ($recordtype->fields) { printf $out " field(%s, %s) {\n", $field->name, $field->dbf_type; while (my ($attr, $val) = each %{$field->attributes}) { - $val = "\"$val\"" if $val =~ m/\s/; + $val = "\"$val\"" if $val !~ m/^[a-zA-Z0-9_\-+:.\[\]<>;]*$/; printf $out " %s(%s)\n", $attr, $val; } print $out " }\n"; } - print $out "% $_\n" - foreach $recordtype->cdefs; printf $out "}\n"; printf $out "device(%s, %s, %s, \"%s\")\n", $name, $_->link_type, $_->name, $_->choice