On 8 Aug., 01:48, Yuval Levy <[email protected]> wrote: > On August 7, 2011 03:25:31 am kfj wrote:
> > - plus an import/export facility to make human-readable output > > ... > > all of these points strongly toward XML... > do you really think XML is human-readable? And think of the bloat if you want something like 50000 control points! PTO is a bit like CSV, without the semicolons. Lacking identifiers, explicit delimiters and structuring elements (brackets, braces), it can only be used for very simple things. The problem with the current pto is more it's carelessly and organically grown format. With a clean design for a language to encompass hugin's needs writing a parser is easy. I've already written one for pto with all it's idiosyncrasies and it wasn't hard, so it could only get better. Feeding the internal representation of the parse into a database isn't magic, either. I'd recommend keeping a script language for the project files, though - a mere data dump would be just as annoying as pto, and too verbose. In a way, I can't see why we couldn't simply use plain python - we already have a python interpreter built into hugin. We could have a module containing the data types, and the project file would simply import that and then proceed by defining the data in ordinary python syntax. Just a quick shot, but maybe feasible? It would have the nice effect that the whole thing would become infinitely flexible to do more than merely defining data (think of calculated values, import libraries for other languages, grouping, looping, conditions...) - whereas the syntax would be that of an increasingly common, well- designed language, instead of something arcane you have to learn anew and is only good for the one purpose. >From hugin's point of view, things would become very easy indeed: parsing a pto file would consist in executing the python file - with all the comforts that brings, like to-the-line error messages, exception handling - plus whatever the python modules describing the hugin data types come up with (like, logging, consistency checks, adaptation to external conditions etc. etc.). A parser for pto already exists and could be used for backward compatibility. With appropriate python modules, the whole data content of the project file could be presented to hugin as an already-constructed, ready-to-use data structure - preferably one provided by a database-like engine. Once things evolve, the next step after executing the project file would be to execute the (wxPython) GUI do manipulate the data... I've used the same approach in a project of mine for handling audio data. In it's first incarnations, I designed a language for it. I did a right proper job: meta-specification of the data types, awk and shell scripts generating a lexical analyzer and a grammar, plus the C and C++ objects of the internal representation from the meta-spec - you name it, I had it. I gloried in the feeling of designing THE audio language. It became very complex - after a while I had structures, procedures... and eventually I asked myself: why am I doing this? How different is my anticipated language from any other procedural language? It turned out the differences were minute. Modern languages are so flexible, that they can be put to almost any use with the syntax they have. And one of the most flexible is python, since it's multi-paradigm and interpreted - yet capable of directly calling C code where performance matters. The next incarnation of my project consisted of a bunch of python modules, some in C for heavy-duty DSP stuff, as befits an audio program, some in pure python to deliver the logic and the interface to actually make stuff happen. It was much simpler. Much less code. The resulting scripts, by using python's clear and well-thought-out syntax, were much easier to grasp than my own language. And anyone knowing python could instantly have dealt with it, after a quick acquaintance with the data types and logic. Even the structuring into low-level C modules and higher-level python code wasn't a hindrance but a help, because it forced me to separate the two, which turned out beneficial. Kay -- You received this message because you are subscribed to the Google Groups "Hugin and other free panoramic software" group. A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hugin-ptx
