From: Flogromp N. <loo...@gm...> - 2007-11-29 11:24:07
|
An example message coming in from Max/MSP might be a linked-list of tagged-unions which contain the following message each as individual atoms. "global" "{" "freq" 255 "cutoff" 444 "flop" 0.9 "}" "myvoice" "{" 0 "{" "note" "c-4" "samp" 12 "velo" 80 "fxcmd" "{" 0 "[" "e" 8 "]" 1 "[" "p" -127 "]" "}" "}" 1 "{" "note" "e-4" "samp" 11 "}" "}" Joel, please help further. On Nov 29, 2007 4:47 PM, Flogromp N. <loo...@gm...> wrote: > CARL, > > There *is no file*. I am never loading any file, reading any file, or > working with any data in any chunks or any file format of any kind. I am not > parsing any string. > > The data is specifically in a linked list of tagged-unions. > > These are realtime messages being parsed which come from the dataflow > programming language for Music called Max/MSP. You can check it out at > http://cycling74.com > > I looks like this: > > http://interactive.usc.edu/members/mtuters/Picture%201.png > > Do you see those little objects? I'm creating one of those. > The linked list of tagged unions is a MESSAGE which travels over those > wires during the interrupt. The Max/MSP SDK provides messages in this > format. > I need to make sure my CPU usage from parsing is low, so that there's > plenty of power left for DSP processing. > > I think perhaps Joel Guzman ignored helping me because he thinks I am > trying to use some kind of external lexer which is not the case at all :( > > - Flogromp N. > > > > lets see the file format is any combination of four chunks and each > > chunk contains a type in N. bytes > > > > integer_chunk: > > tag: N bytes > > long M bytes > > float_chunk: > > tag: N bytes > > float: P bytes > > string_chunk: > > tag: N bytes > > data: '\0' stream of chars unlimited size. > > object_chunk: > > tag: N bytes > > object_data: some computable size > > > > if the object size is variable we need to parse the file from the > > point after the tag was read until > > object is computed . if its fixed size we can gather the data and parse > > it. [spirit or ad_hoc depending > > on complexity] > > > > so it seams that you really need only to parse a string [possibly an > > Object] via spirit. so if you have > > a grammar that parses the string into an other string then you can > > store the results of everything > > in a vector<boost;:variant<long,float,std::string,Object> and write one > > visitor use to process the > > contents of the vector. the visitor is really a functor with > > opertor() overloaded for each type in > > the variant. > > > > |