← Back to team overview

kicad-developers team mailing list archive

Re: Sweet parser

 

On 04/04/2011 01:03 PM, Wayne Stambaugh wrote:
> On 4/4/2011 12:15 PM, Dick Hollenbeck wrote:
>> On 04/04/2011 10:40 AM, Chris Giorgi wrote:
>>> On Mon, Apr 4, 2011 at 06:59, Dick Hollenbeck <dick@xxxxxxxxxxx> wrote:
>>> -snip-
>>>> If anything looks long winded (overly verbose), the next couple of weeks
>>>> would be a good time to make those 11th hour changes.
>>>>
>>>> 'line_width' as a keyword name, seems a bit long to me, but its a minor deal.
>>>>
>>>> Overall, hopefully it still looks sweet.
>>> Hi Dick,
>>> The grammar is looking great! I have a few suggestions regarding line
>>> styling, including obviating the line_width keyword: Create a 'stroke'
>>> property for the stroke of a figure, and within 'stroke' define a
>>> 'weight' attribute to replace the 'line_width' property. The 'stroke'
>>> property could also include a 'style' attribute , allowing for dashed
>>> lines, and perhaps even an 'endpoint' attribute, allowing for arrow
>>> heads and tails. This would be consistent with most vector graphics
>>> packages, and I would consider it highly desirable functionality in
>>> some circumstances.
>>>
>>> (rectangle (start -5 -14) (end 5 14) (stroke (weight 1.2) (style
>>> (dashed 0.5 0.1)) (fill none))
>>>
>>> Draw an unfilled rectangle from (-5,-14) to (5,14) using a pen weight
>>> of 1.2, with dashes 0.5 long with 0.1 spaces between each dash.
>>>
>>>
>>> (line (start 1 3) (end 2 5) (stroke (weight 1.0) (style solid)
>>> (endpoint tail head)))
>>>
>>> Draw a solid line segment from (1,3) to (2,5) using a pen weight of
>>> 1.2. Decorate the start with a standard tail shape and the end with a
>>> standard head shape.
>>>
>>> A few open questions:
>>> One issue that I'm unclear about is what the units for the
>>> 'line_width' were, and what they should be for 'stroke(weight)'.
>>
>> (line_width WIDTH) has WIDTH as a "percent of a logical unit".
>>
>> So 1.5 would be 1.5 percent of a logical unit, or .015 logical units.
>> A logical unit is defined as the standard distance between two neighboring
>> schematic pins, a dimensionless number.  See the *.odt file in /new for more
>> info.
>>
>> This grammar is specific to schematic parts.  I won't talk about eventual
>> PCBNEW requirements at this time.
>>
>> My concern about line_width was lack of brevity, so now instead of
>>
>> (line_width 1.2) we now have
>>
>> (stroke (weight 1.2) (style (dashed 0.5 0.1))
> I like it.  It's more descriptive and flexible.
>
>>
>> We are going in the wrong direction regarding brevity  :)
>>
>> Maybe we can have defaults, and get rid of the weight wrapper:
> We currently have default line widths.  If line does have a width, then the
> default applies.
>
>>
>> (stroke 1.2) which is now shorter than:
>> (line_width 1.2)
>>
>> This is an improvement that gives us a container element in which to add in
>> the fancy lines when not using default solid line:
>>
>> (stroke 1.2 (style (dashed 0.5 0.1))



[(stroke [WIDTH] [(style ....)])]


meaning:

the whole stroke thing is present only when defaults do not apply, the WIDTH
is optional when stroke is present, style is optional when stroke is
present, and (style) holds your future line glamor.

Practically, either WIDTH or (style) should be present.


We may be better off naming a few dashed line styles, rather than the fully
customizable (dashed ..) suggestion, could be faster on some graphics APIs.


I'll code it in next weekend, or so, and update the *.odt file.


Thanks Chris.

Dick





Follow ups

References