Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-28 Thread Peter Brett
Kai-Martin Knaak k...@lilalaser.de writes:

 Rather than restrict the input to a smallish subset, the code should
 deal gracefully with as much of UTF8 as possible.

Um, the code deals just fine with attribute names containing arbitrary
UTF-8.  It's just not *recommended* to use attribute names that don't
match the regexp I supplied.

 What is the rationale to this restriction?

It's not a restriction, it's a recommendation.  The main reasons are
that:

1) We need to support gnetlist backends when gEDA is compiled against
   Guile 1.8.x, which doesn't understand UTF-8. BTW, if you want to use
   non-ASCII characters in your attributes, I highly recommend to use
   Guile 2.x.

2) In the future, we may wish to do clever things with attribute names,
   perhaps giving characters like '#', '/' or ':' on the left hand side
   of the '=' in an attribute special meaning to gnetlist.  If you stick
   to the regexp I provided, you will be future-proof.

To repeat: you can use any Unicode codepoints you like in attribute
names at the moment.  However, at the moment it's safest to stick to
'^[a-z][a-z0-9_-\.]*$'.

Regards,

   Peter

P.S. To clarify, attributes *must* match '^(.*[^ ])=([^ ].*)$'
(multiline) at the moment.

-- 
Peter Brett pe...@peter-b.co.uk
Remote Sensing Research Group
Surrey Space Centre



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-28 Thread John Doty

On Jun 28, 2011, at 4:17 AM, Peter Brett wrote:

 1) We need to support gnetlist backends when gEDA is compiled against
   Guile 1.8.x, which doesn't understand UTF-8. BTW, if you want to use
   non-ASCII characters in your attributes, I highly recommend to use
   Guile 2.x.

Actually, UTF-8 attributes (names and values) work fine with Guile 1.8-based 
gEDA. The clever design of UTF-8 makes code intended for ASCII just work so 
long as it doesn't need to pick wide characters out of a string.

John Doty  Noqsi Aerospace, Ltd.
http://www.noqsi.com/
j...@noqsi.com




___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-27 Thread Павел Таранов
   This questions intereresting for me too, so it would be nice if
   somebody of Guru could comment them :)

 Hi there,
 I'm still intermittently working on a parser in Python for the
 gEDA/gaf file format and I have a couple of questions that I hope
 the
 list can answer.
 1) are there any restrictions on the characters in attribute names
 and
 values (other than no = in the name) ?

   As I see in gschem sources slot attribute have some special meaning.
   But seems it just providing some special processing for sloted objects
   (couldnt't imagine what is this).
   Also check here:
   [1]http://geda.seul.org/wiki/geda:master_attributes_list
   [2]http://geda.seul.org/wiki/geda:na_howto

 2) Can attributes be multiline text or are they always single line
 text (but perhaps several)?

   As I see attributes are always one line. Attribute editor is one line
   length. In the code I don't see any special processing for multiline
   attributes. So seems 1 attribute = 1 line.

   Regards,
   Pavlo

References

   1. http://geda.seul.org/wiki/geda:master_attributes_list
   2. http://geda.seul.org/wiki/geda:na_howto


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-27 Thread Peter Brett
[Re-sending to list, since there's been additional interest.]

Gareth Edwards gar...@edwardsfamily.org.uk writes:
 Hi there, I'm still intermittently working on a parser in Python for
 the gEDA/gaf file format and I have a couple of questions that I hope
 the list can answer.

 1) are there any restrictions on the characters in attribute names and
 values (other than no = in the name) ?

At the moment, gEDA allows names to include any UTF-8 character other
than '=' or \0, but (for some reason) they must not end with a space.

However, I strongly recommend that you only use attribute names that
match:

  ^[a-z][a-z0-9_-\.]*$

Since you're writing a parser, consider emitting a warning if you
encounter an attribute name which doesn't.

 2) Can attributes be multiline text or are they always single line
 text (but perhaps several)?

Yes, they can be multiline (any UTF-8 character other than \0).  Also,
they (randomly) may not start with a space.

Since the gEDA file format requires UTF-8, please make sure your parser
raises the alarm if it encounters encoding errors.

Cheers,

Peter

P.S. I'm hoping to tighten up the rules on attributes soon-ish.


-- 
Peter Brett pe...@peter-b.co.uk
Remote Sensing Research Group
Surrey Space Centre



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-27 Thread Paul Tan
 1) are there any restrictions on the characters in attribute
names and values (other than no = in the name) ?

The implementation of the attribute name, value parser
is in the function around line 357 of
./libgeda/src/o_attrib.c file:

357  gboolean
358  o_attrib_string_get_name_value (const gchar *string,
  gchar **name_ptr, gchar **value_ptr)

The above parser function, though not perfect, allows
flexibility within UTF-8 encoded string. As such, within
the T object string portion, the first detected =
with no space char   on either adjacent side of it,
separates the attribute name and the attribute value.
attribute value portion can contain any UTF-8 encoded
string (except an immediate '\0'), including =.

Other than the above, there seems to be no other restrictions
imposed by the frontend.

Beyond the gschem file format, there could be other
restriction on attributes imposed by some processing
entity (DRC, etc) and backend netlister. But those are
backend specific, and upto the particular backend
specific needs.

 2) Can attributes be multiline text or are they always
single line text (but perhaps several)?

Attribute or text can be multiline as stated in the
text section of:
   http://geda.seul.org/wiki/geda:file_format_spec

The num_lines field in the T object type line indicates
the number of lines in the string.




___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-27 Thread Kai-Martin Knaak
Peter Brett wrote:

 However, I strongly recommend that you only use attribute names that
 match:
 
   ^[a-z][a-z0-9_-\.]*$

Ouch. 
Every string in the user interface should potentially be subject to 
localization. Every input field should accept local characters.
Since attributes can be introduced by th user, the add attribute 
function is effectively an input field.

Confinement to ascii chars prevents proper spelling of non-english
words. What is the rationale to this restriction? IIRC, the glibc 
string operations are TTF8 aware. Rather than restrict the input to 
a smallish subset, the code should deal gracefully with as much of 
UTF8 as possible.

---)kaimartin(---
-- 
Kai-Martin Knaak
Email: k...@familieknaak.de
Öffentlicher PGP-Schlüssel:
http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: gEDA file format - couple of questions on attributes.

2011-06-27 Thread DJ Delorie

  However, I strongly recommend that you only use attribute names that
  match:

 Confinement to ascii chars prevents proper spelling of non-english
 words. What is the rationale to this restriction? IIRC, the glibc 
 string operations are TTF8 aware. Rather than restrict the input to 
 a smallish subset, the code should deal gracefully with as much of 
 UTF8 as possible.

We're not talking about attribute values or plain text strings.  We're
talking about attribute *names* - things that other bits of software
need to use as keys for understanding what the values are for.  Since
they're mostly for other programs to read, a bit more restriction is
appropriate.


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user