bug: startshape FILL

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

bug: startshape FILL

Post by kipling »

While golfing a design in the gallery, curiosity led me to try the shortest possible valid cfdg

Code: Select all

startshape FILL
What happened was the thing I least expected. (insert appropriate clickbait link)
Variations with

Code: Select all

startshape FILL[...]
also are incorrect - the shape count is correct, but not the drawing.
With explicit clipping it is happy:

Code: Select all

startshape FILL[sat 1 b .5]
CF::Size=[s 1]
So the obvious guess is that it fails to find a bounding box in the case where the shape list only has FILLs in it.
Obviously this "bug" is not at all critical - there is no practical reason for wanting this to work.

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: bug: startshape FILL

Post by MtnViewJohn »

It should do better. While checking this out I discovered valid cfdg input that causes Context Free to hang. Do you get the error message "Invalid UTF-8 encoding: ASCII null character" if you have startshape FILL with no line feed at the end?

User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

Re: bug: startshape FILL

Post by kipling »

No, not from within the macOS Context Free.app window that is.

User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

Re: bug: startshape FILL

Post by kipling »

This also doesn't work, except that it momentarily draws the screen black before redrawing it white

Code: Select all

startshape A
shape A{
	FILL[]
	FILL[z 1]
	}
This supports my guess earlier.

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: bug: startshape FILL

Post by MtnViewJohn »

The bug is that the code that filters out shapes that are too small or infinitely large is supposed to always draw FILL shapes. But if there is nothing but FILLs then it filters them out too. You are right that this is caused by the lack of a bounding box.

I also discovered that the cfdg parser handles end-of-file incorrectly in some cases and can hang or report weird errors.

Post Reply