POV-Ray : Newsgroups : povray.bugreports : array mixed crashes in parser Server Time
23 Jun 2021 04:59:35 EDT (-0400)
  array mixed crashes in parser (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: array mixed crashes in parser
Date: 10 Jul 2019 16:50:00
Message: <web.5d264e643c87cc694eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> if there'd been a complete example.  :-(  anyway, I guess the OP will have
> solved the problem already.

Maybe.  The way I read his initial post was that he was trying to run an
"example snippet" - maybe from a file included with the distribution.

I looked in
/usr/share/qtpovray-3.8/scenes/language/arrays/
but nothing there had any mixed array or dictionary examples, but maybe I'm
looking in the wrong place.

The only things I found online were the wiki link I provided, and some example
code for _mixed_ by Ingo.

Maybe he will return with clarification and a solution...


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 10 Jul 2019 19:25:00
Message: <web.5d2673883c87cc69799a5f510@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> 1) I'm not sure what the dots that look like an ellipsis are.

Three sequential dots are indeed ellipses. I posted a correction where there
were two dots in the initial post should have been whitespace followed by the
dot-prefixed naming convention.

> 2) I think it would be easier to declare a (very small) mixed array first and
> THEN create a dictionary for it

This would be a logical progression, with experimentation due.
I'd be glad to work with a mixed array data type and then to extend the code to
read it as a dictionary.
During initial scene development I had complex sets of (single-type) arrays
which became a nightmare to extend.

I'd also be glad to create a mixed array and then initialize a dictionary
element. That'll help debugging but not in the spirit of the outcome. It may
soon be.


> 3) those internal array declarations don't look right to me

I'm not sure what you are referring to as 'internal' array declarations. I'll
discuss the composition of this complex data type in a later posting.

>>> THIS IS CERTAIN <<<
They work fine and fantastic in Pov-Ray 3.8.0a.9844500. In fact, I'm continuing
developing the scene in 9844500/

Presently, with 9844500, the uninitialized { integer, integer, array[10],
array[10]} declaration of the first element of the dictionary, .LeftMain2515:
entry is now, for my purposes { integer, integer, array[20], array[20]}  and
works as interpreted by Reference:Array:

http://wiki.povray.org/content/Reference:Array


> 3) then you could see if you can create a dictionary using a direct declaration
> of the mixed array

This would be a logical progression, with experimentation due.


Post a reply to this message

From: Bald Eagle
Subject: Re: array mixed crashes in parser
Date: 10 Jul 2019 20:55:00
Message: <web.5d2688ab3c87cc694eec112d0@news.povray.org>
"TreeLimb Jim" <all### [at] yahoocom> wrote:

> During initial scene development I had complex sets of (single-type) arrays
> which became a nightmare to extend.


Are you aware of:
http://news.povray.org/povray.text.tutorials/thread/%3C3f13449b$1@news.povray.org%3E/

Not sure if that helps at all.

> I'd also be glad to create a mixed array and then initialize a dictionary
> element. That'll help debugging but not in the spirit of the outcome. It may
> soon be.
>
>
> > 3) those internal array declarations don't look right to me
>
> I'm not sure what you are referring to as 'internal' array declarations. I'll
> discuss the composition of this complex data type in a later posting.

IIRC, it looked like you were trying to declare a dictionary, composed of
arrays, that had elements, all in one go.

I was just looking at the syntax of the array declarations, and they didn't
strike me as "properly formed", but it was hard to puzzle out that little
snippet.

No worries - if what you have is working for you, then carry on!   :)


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 10 Jul 2019 22:35:00
Message: <web.5d26a0363c87cc69799a5f510@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> Are you aware of:
>
http://news.povray.org/povray.text.tutorials/thread/%3C3f13449b$1@news.povray.org%3E/

This is fantastic -- IF I have to write a work around.

> Not sure if that helps at all.

I wouldn't have been even closely where to begin searching the archives. Much
thanks.

[[ What I really want is a way to keep track of a core object's location and
orientation as it becomes part of more complex objects ]]


What I am up to is modeling the ARP 2500 modular synthesizer.

https://encyclotronic.com/synthesizers/arp/2500-r167/

Instead of planting arbitrary knob positions and the matrix switch panels for
every instance of module, I used some data abstraction. An entire System is a
dictionary, divided into one or more cabinets filled with info on the modules'
state. For now the data structure is:

//=============Code==========

#declare System = dictionary {
  .ACabinet: array <mixed> [ slotsInCabinet ][ controlValues ] {
    // First slot
    { moduleID.float, panelSize.float, topJackPosition[20].{locVect, rotVect},
bottomJackPositions[20].{locVect, rotVect} }
    //  Middle slots
    { moduleID.float, panelSize.float, topSliderPositions[],
bottomSliderPositions[] }
   // Last slot, same as the first
  } // end of .ACabinet
.... more cabinets and components
} // end of System


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 10 Jul 2019 23:05:01
Message: <web.5d26a6743c87cc69799a5f510@news.povray.org>
Using the files in scenes/language/arrays/ I extended each sample .pov file to
include a cursory extension of storing and accessing data in mixed arrays, a
dictionary, and a dictionary containing a mixed array. Just basic data types,
float, string, vector. Baseline worked fine, no problems.

//  Example Data structure snip from "array3 mixed dictionary.pov"
#declare MyDictionary = dictionary {
 .Digit:
  array mixed[4][10]
  {
    {<7,7,7>,6,7,0,2,1,6,5,5,0},
    {<1,1,1>,2,3,4,5,6,7,8,9,0},
    {<0,0,0>,9,8,7,6,5,4,3,2,1},
    {<1,1,1>,1,2,2,3,3,4,4,5,5}
  }
}
// Works!

One test scenario yet to be tested is to implement a multi-dimensional array,
partially initialized. Sounds similar to my problem.

OT Observation: Within a dictionary one can declare another dictionary

// Data structure snip [condensed] from my project
// Dictionary element representingthe
 .CustomCaps:  array[2] {
  dictionary  { // Upper
   ["1004.3"]: array[5]{ Blue, Green, Yellow, Black, Black } // Never shown
   ["1006.1"]: array[5]{ arpPink, Yellow, White, White, Red } // not a 1006
   ["1016" ]: array[5]{ Black, Black, Black, Black, Black } // Never shown
   ["1023.1"]: array[5]{ Blue, Green, Yellow, Black, Blue }
   ["1027.2"]: array[5]{ Orange, Orange, Green, Green, Red }
   ["1045" ]: array[5]{ Red, Red, Red, Green, Yellow } // PT
   }
  dictionary {  // Lower
   ["1004.3"]: array[5]{ Black, Yellow, Green, Red, White } // Never shown
   ["1006.1"]: array[5]{ Yellow, arpPink, arpPink, arpPink, arpPink } // custom
   ["1016" ]: array[5]{ Gray, Black, White, Black, Yellow } // Never shown
   ["1023.1"]: array[5]{ Yellow, Green, Blue, arpPink, Red }
   ["1027.1"]: array[5]{ White, White, White, Yellow, Yellow }
   ["1027.2"]: array[5]{ Orange, Orange, Green, Green, Red }

   }
  }
// This time implementing string labels, represents the colored slider caps for
a particular module

OT Observation: no message flagging when  .pov files used #version 3.7 or 3.8
and mixed arrays or dictionary implemented. No biggie, I used to test software.

Oh, and kudos for all those working on the parser. I'm trying to stay just an
end user.


Post a reply to this message

From: Bald Eagle
Subject: Re: array mixed crashes in parser
Date: 11 Jul 2019 07:05:01
Message: <web.5d27176b3c87cc694eec112d0@news.povray.org>
"TreeLimb Jim" <all### [at] yahoocom> wrote:

> What I am up to is modeling the ARP 2500 modular synthesizer.
>
> https://encyclotronic.com/synthesizers/arp/2500-r167/
>
> Instead of planting arbitrary knob positions and the matrix switch panels for
> every instance of module, I used some data abstraction. An entire System is a
> dictionary, divided into one or more cabinets filled with info on the modules'
> state.

Excellent.   You're completely psychotic.
I like that in a POV-Ray user.   :D

Also keep in mind that vectors can be up to 7 elements long.
And instead of strings, you can store colors as rgb vectors.
And "save" those vectors in #declared constants.
#declare White = <1, 1, 1>;
Then those words are vectors, not strings.

and if you really needed to store strings, but for whatever reason couldn't, you
could do something like:

#declare _one = 1;
#declare _two = 2;
#declare _three = 3;

#declare Label = array [3] {"One", "Two", "Three"};
and then access the Label element with a "named" value:

#declare SliderLabel = Label [_two];


Just some random pre-coffee ideas that may or may not have any real value.
Hoping to see some of your WIP's   =)


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 11 Jul 2019 19:05:00
Message: <web.5d27beab3c87cc69799a5f510@news.povray.org>
Thanks for all your coaching so far. I'm not certain whether these are hints to
a solution or hints to a work-around.

One hint was array initialization. Another hint was about substitution. This
helped me deconstruct why my specific implementation may function or break:

Recall, this is the thrown error:
"Possible Parse Error: Uncategorized error thrown at
/Volumes/WDVrijstuk/PovRayUnofficial_3.8.0-alpha. 10013324-avx
source/source/parser/parser_tokenizer.cpp line 2413."

// ==== THIS FAILS ====
#declare SampleSystem2 = dictionary  {
 .LeftMain2515:  array mixed[3][4] {
  { 1001, 1, array[20][2],array[20][2] },
  { 1023, 1, array[10] {0,0,0,0,0,0,0,0,0,0}, array[10]{0,0,0,0,0,0,0,0,0,0}},
  { 1036, 1, array[10] {0,0,0,0,0,0,0,0,0,0}, array[10]{0,0,0,0,0,0,0,0,0,0}},
  }
 .RightMain2515: array mixed[3][4] {
  { 1016, 1, array[20][2] , array[20][2] },
  { 1023, 1, array[10]{0,0,0,0,0,0,0,0,0,0},array[10]{0,0,0,0,0,0,0,0,0,0}},
  { 1002, 1, array[20][2] , array[20][2] },
  }
 .Keyboard:   array[1] { 3212 }
};

// ==== THIS DOES NOT GENERATE ERROR  ====
#declare initVect20 = array[20][2] ;
#declare initZero5 = array[10]{0,0,0,0,0,0,0,0,0,0};
#declare SampleSystem2 = dictionary  {
 .LeftMain2515:  array mixed[3][4] {
  { 1001, 1, initVect20 , initVect20 },
  { 1023, 1,initZero10, initZero10 },
  { 1036, 1,initZero10, initZero10 },
  }
 .RightMain2515: array mixed[3][4] {
  { 1016, 1, initVect20 , initVect20 },
  { 1023, 1,initZero10, initZero10 },
  { 1002, 1, initVect20 , initVect20 },
  }
 .Keyboard:   array[1] { 3212 }
};


It doesn't stop there, but I think I'm describing the problem. My next post
will demonstrate further the complexity of implementing "mixed-type" elements.


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 11 Jul 2019 20:40:00
Message: <web.5d27cc333c87cc69799a5f510@news.povray.org>
Time to change the Subject line

Again, I'm not going to peruse the code. That's above my pay grade and those
that are gefingerpoken it will sort it out. [Ref:
https://en.wikipedia.org/wiki/Blinkenlights]

Possible Parse Error: Uncategorized error thrown at
/Volumes/WDVrijstuk/PovRayUnofficial_3.8.0-alpha. 10013324-avx
source/source/parser/parser_tokenizer.cpp line 2413.


//==== THIS GENERATES ERROR ====
#declare ColorDictionary = array mixed[2] {
 dictionary  { // Upper
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10  // Do you think this would?
//  ["1001"]: initZero10  // And why was it a workaround
//  ["1002"]: initZero10  // In my previous post
 },
 dictionary {  // Lower
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10  // Ibidem
//  ["1001"]: initZero10  // That's ibidem-way in Pig Latin
 }
};


//==== Que Voila? THIS DOES NOT GENERATE ERROR
#declare ColorDictionary = array[2] { dictionary, dictionary };

#macro initARPSliderCapColorDictionary()
 #declare ARPSliderCapColorDictionary[0] = dictionary  { // Upper
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10
//  ["1001"]: initZero10 // But this does when used ---
//            ^^^^^^^ Parse Error: Expected 'numeric expression',
string literal found instead
//  ["1002"]: initZero10 //
// };

 #declare ColorDictionary[1] = dictionary {  // Lower
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10  // As above
//  ["1001"]: initZero10
// So <Return> is not necessarily the terminating character for dictionary
containers
 };
#end

initARPSliderCapColorDictionary()



So, consume these experiments in all their richness while I re-code the project.
The next chapter is to find out what is generating a hard crash in
3.8.0-alpha.10013324 but not in 3.8.0-alpha.9844500


Post a reply to this message

From: jr
Subject: Re: array mixed crashes in parser
Date: 12 Jul 2019 11:20:00
Message: <web.5d28a47f3c87cc693936914a0@news.povray.org>
hi,

"TreeLimb Jim" <all### [at] yahoocom> wrote:
> Possible Parse Error: ...
> //==== THIS GENERATES ERROR ====
> #declare ColorDictionary = array mixed[2] {
>  dictionary  { // Upper
>   ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
>   ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
>   ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
>   ...


I think the problem is due to the names you give to the keys.  iiuc, the first
character cannot be a digit (3.3.1.10 Array, cf indices follow generic rules for
identifiers).


regards, jr.


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 16 Jul 2019 00:35:00
Message: <web.5d2d50f23c87cc69799a5f510@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> > //==== THIS GENERATES ERROR ====
> > #declare ColorDictionary = array mixed[2] {
> >  dictionary  { // Upper
> >   ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
> >   ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
> >   ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
> >   ...

Fixed quite a few things in my code. Best behavior so far:
1. >>>IMPORTANT<<< Dictionary names must be STRING but the initial character
must be an alpha character. This must be documented somewhere already. It makes
it handy to use
the dot delimiter as well as not to confuse elements inside the square brackets
as elements of an array.

2. Declare the array of dictionaries and THEN initialize them as in the
following rewrite:

#declare ColorDictionary = array mixed[2] { dictionary, dictionary }
#declare init10 = array[10] { 0,0,0,0,0, 0,0,0,0,0 }

#macro initColorDictionary()
// Upper
  #declare ColorDictionary[0].m0 = init10
  #declare ColorDictionary[0].m1001 = init10
  #declare ColorDictionary[0].m1002 = init10
// Lower
  #declare ColorDictionary[1].m0 = init10
  #declare ColorDictionary[1].m1001 = init10
  #declare ColorDictionary[1].m1002 = init10
#end

initColorDictionary()


I believe I'm getting closer to coding around a few things about concurrently
declaring and initializing but not simultaneously declare and initializing
arrays, including the superset called mixed arrays.

From preliminary explorations, in mixed arrays, my suggestion during alpha
development is to keep the same data type as initialized for that element and
quite likely, the dimension of the arrays and elements composed of arrays, too.
( brings memories of the horrors of writing context-free grammars and LEX/YACC )


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.