Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Commit [81df4c] default Maximize Restore History

moved the parser to higher in the directory structure

dmg dmg 2011-02-03

1 2 > >> (Page 1 of 2)
removed src/parser
removed src/parser/panoParser.c
removed src/parser/panoScanner.l
removed src/parser/tparserdebug.h
removed src/parser/Makefile.am
removed src/parser/CMakeLists.txt
removed src/parser/tparser.h
removed src/parser/COPYING
removed src/parser/AUTHORS
removed src/parser/testparser.c
removed src/parser/.hgignore
removed src/parser/TODO
removed src/parser/panoScanner.c
removed src/parser/tparser.c
copied src/parser/tparserprivate.h -> PTOparser/tparserprivate.h
copied src/parser/panoParser.y -> PTOparser/COPYING
copied src/parser/README.txt -> PTOparser/panoParser.h
copied src/parser/panoParser.h -> PTOparser/ChangeLog
copied src/parser/ChangeLog -> PTOparser/tparser.h
src/parser
File was removed.
src/parser/panoParser.c
File was removed.
src/parser/panoScanner.l
File was removed.
src/parser/tparserdebug.h
File was removed.
src/parser/Makefile.am
File was removed.
src/parser/CMakeLists.txt
File was removed.
src/parser/tparser.h
File was removed.
src/parser/COPYING
File was removed.
src/parser/AUTHORS
File was removed.
src/parser/testparser.c
File was removed.
src/parser/.hgignore
File was removed.
src/parser/TODO
File was removed.
src/parser/panoScanner.c
File was removed.
src/parser/tparser.c
File was removed.
src/parser/panoParser.y to PTOparser/COPYING
--- a/src/parser/panoParser.y
+++ b/PTOparser/COPYING
@@ -1,792 +1,340 @@
-/*
- *  panoParser.y
- *
- *  Copyright  Daniel M. German
- *  
- *  April 2007
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This software is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public
- *  License along with this software; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *
- *  Author: Daniel M German dmgerman at uvic doooot ca
- * 
- */
-
-%{
-       #include <stdio.h>
-       #include <stdlib.h>
-       #include <string.h>
-       #include <math.h>
-
-  /*  #define lround gaaekraf adf adf
-       #define lroundf gaaekraf adf adf 
-*/
-
-#include "tparser.h"
-#include "tparserprivate.h"
-#include "tparserdebug.h"
-
-       int yylex (void);
-       void yyerror (char const *);
-/*  Keeps track of the current type of input line in the file */
-int  currentLine = -1;
-
-pt_script script;
-
-/* defining it gives better error messages. It might be an overkill */
-#define YYERROR_VERBOSE 1 
-
-static pt_script_image *image;
-static pt_script_optimize_var *varToOptimize;
-static pt_script_ctrl_point *ctrlPoint;
-static pt_script_morph_point *morphPoint;
-
-// Look ahead variables
-//   Hugin  uses a comment line _before_ the i line: for example
-//   #-hugin  autoCenterCrop=1 cropFactor=1
-
-#define PT_AUTO_CENTER_CROP_ST "autoCenterCrop"
-#define PT_AUTO_CENTER_CROP_DEFAULT 0
-static int autoCenterCrop = PT_AUTO_CENTER_CROP_DEFAULT;
-static int huginPTOfileVersion = 0;
-
-
-#define PT_CROP_FACTOR_ST "cropFactor"
-#define PT_CROP_FACTOR_DEFAULT 0
-static int cropFactor = PT_CROP_FACTOR_DEFAULT;
-
-/* copy a string while allocating and checking for memory */
-static void ParserStringCopy(char **dest, char *from)
-{
-    if (*dest) 
-	free(*dest);
-    *dest = strdup(from);
-    if (*dest == NULL)
-	panoScriptParserError(1,"Not enough memory");
-}
- static void panoAllocateVarToOptimize (void);
-
-
-%}
-     
-%defines
-
-%union {
-  int   iVal;
-  float fVal;
-  char strVal[PT_TOKEN_MAX_LEN+1];
-  char cVal;
-}
-
-
-%token NUM
-%token <fVal> PT_TOKEN_NUMBER
-%token <strVal> PT_TOKEN_STRING
-%token <strVal> PT_TOKEN_HUGIN_KEYWORD
-%token <cVal> PT_TOKEN_KEYWORD
-%token <strVal> PT_TOKEN_KEYWORD_MULTICHAR
-%token <cVal> PT_TOKEN_KEYWORD_CROPPING
-
-%token PT_TOKEN_EOL
-%token PT_TOKEN_SEP
-%token PT_TOKEN_INPUT_LINE
-%token PT_TOKEN_OUTPUT_LINE
-%token PT_TOKEN_PANO_LINE
-%token PT_TOKEN_CONTROL_PT_LINE
-%token PT_TOKEN_OPTIMIZE_OPT_LINE
-%token PT_TOKEN_OPTIMIZE_VARS_LINE
-%token PT_TOKEN_COMMA
-%token PT_TOKEN_REFERENCE
-%token PT_TOKEN_MORPH_PT_LINE
-%token PT_TOKEN_HUGIN_VERSION
-%token PT_TOKEN_HUGIN_LINE
-%token PT_TOKEN_HUGIN_OPTIONS_LINE
-%token PT_TOKEN_ERROR
-%token PT_TOKEN_EOF
-
-%start input
-
-%% /* Grammar rules and actions follow.  */
-
-input: lines PT_TOKEN_EOF
-      { 
-          int i;
-
-          pt_script_morph_point *morphPoint2;
-          int image;
-          pt_script_image *imageSpec;
-          // We have to move the morphing control points to their corresponding images
-          DEBUG_1("Lines");
-          DEBUG_2("Number of control points %d", script.iMorphPointsCount);
-
-          for (i = 0; i < script.iMorphPointsCount; i++) {
-              // get a pointer to the point to make life easier
-              morphPoint = &morphPointsSpec[i];
-              image = morphPoint->iImage;
-              // we need to verify that the iamge pointer exists
-              if (image < 0 || image > script.iInputImagesCount) {
-                  panoScriptParserError(0,"Morphing control point number %d references non existent input image [%c].\n", i, image);
-                  return -1;
-              }
-              // point to the image, avoids long expressions
-              imageSpec = &script.inputImageSpec[image];
-
-              // allocate the pointer
-              morphPoint2 = (pt_script_morph_point *)panoScriptReAlloc((void*)&imageSpec->morphPoints, 
-                                                                  sizeof(pt_script_morph_point), &imageSpec->morphPointsCount);
-              
-              if (morphPoint2 == NULL) {
-                 yyerror("Not enough memory");
-              }
-              memcpy(morphPoint2, morphPoint, sizeof(pt_script_morph_point));
-          }
-          DEBUG_2("Lines: number of images %d", script.iInputImagesCount);
-
-          for (i=0;i<script.iInputImagesCount; i++)  {
-              DEBUG_2("Image %d", script.inputImageSpec[i].morphPointsCount);              
-          }
-          DEBUG_2("Number of control points %d", script.iMorphPointsCount);
-
-          return 0;
-      }
-
-lines:  line lines | 
-{
-    DEBUG_1("End of line\n");
-}
-     
-line:          inputline
-             | outputline
-             | panoline
-             | optimizeOptsline
-             | optimizeVarsline
-             | ctrlPtsLine
-             | morphPtsLine
-             | huginImageParmsLine
-             | huginOptionsLine
-             | huginPTOversion
-             | parsingError
-;
-     
-
-parsingError: PT_TOKEN_ERROR 
-{
-  DEBUG_1("What the heck\n");
-    return -1;
-} 
-
-
-huginPTOversion: PT_TOKEN_HUGIN_VERSION PT_TOKEN_SEP PT_TOKEN_NUMBER eoln
-         {
-            huginPTOfileVersion = lroundf($3);
-            //printf("Version %d", huginPTOfileVersion);
-         }
-
-huginOptionsLine: PT_TOKEN_HUGIN_OPTIONS_LINE 
-         { 
-            currentLine = PT_TOKEN_HUGIN_OPTIONS_LINE;
-         } vars  eoln
-     
-
-huginImageParmsLine: PT_TOKEN_HUGIN_LINE 
-        {
-            currentLine = PT_TOKEN_HUGIN_LINE;
-        }
-        huginVars
-        eoln  { ; }
-//        
-
-
-ctrlPtsLine: PT_TOKEN_CONTROL_PT_LINE  PT_TOKEN_SEP
-        { 
-            currentLine = PT_TOKEN_CONTROL_PT_LINE;
-            ctrlPoint = (pt_script_ctrl_point *)panoScriptReAlloc((void*)&script.ctrlPointsSpec, 
-                                                                  sizeof(pt_script_ctrl_point), &script.iCtrlPointsCount);
-        }  
-        varsparms eoln       { ; }
-
-morphPtsLine: PT_TOKEN_MORPH_PT_LINE  PT_TOKEN_SEP
-        { 
-            currentLine = PT_TOKEN_MORPH_PT_LINE;
-            morphPoint = (pt_script_morph_point *)panoScriptReAlloc((void*)&morphPointsSpec, 
-                                                                  sizeof(pt_script_morph_point), &script.iMorphPointsCount);
-        }  
-        varsparms eoln       { ; }
-
-
-eoln:     PT_TOKEN_EOL  { DEBUG_1("ENDOFLINE");currentLine = -1; /* This says we don't know the type of line being processed */}
-
-inputline:  PT_TOKEN_INPUT_LINE PT_TOKEN_SEP
-        {
-
-	    currentLine = PT_TOKEN_INPUT_LINE; 
-
-            image = (pt_script_image *)panoScriptReAlloc((void*)&(script.inputImageSpec),
-                                                         sizeof(pt_script_image), &script.iInputImagesCount);
-
-            if (image == NULL) {
-		yyerror("Not enough memory");
-            }
-            // This might require more though. Are the defaults of these two variables zero?
-            image->autoCenterCrop = autoCenterCrop;
-            image->cropFactor = cropFactor;
-            cropFactor = PT_CROP_FACTOR_DEFAULT;
-            autoCenterCrop = PT_AUTO_CENTER_CROP_DEFAULT;
-
-        }   
-        vars eoln      { ; }
-
-outputline: PT_TOKEN_OUTPUT_LINE PT_TOKEN_SEP
-        {
-            DEBUG_1("Reading outputline");
-	    currentLine = PT_TOKEN_OUTPUT_LINE; 
-	    // allocate the new output
-	    script.iOutputImagesCount++;
-	    script.outputImageSpec = realloc(script.outputImageSpec, 
-					     sizeof(*script.outputImageSpec) * script.iOutputImagesCount);
-	    if (script.outputImageSpec == NULL) {
-		yyerror("Not enough memory");
-	    }
-	    // clear the end of the reallocated region
-	    bzero(&(script.outputImageSpec[script.iOutputImagesCount-1]), sizeof(*script.outputImageSpec));
-	    image = &script.outputImageSpec[script.iOutputImagesCount-1];
-	}      vars eoln      { ; }
-
-optimizeOptsline: PT_TOKEN_OPTIMIZE_OPT_LINE PT_TOKEN_SEP 
-          { 
-              currentLine=PT_TOKEN_OPTIMIZE_OPT_LINE; 
-          } vars eoln      { ; }
-
-
-/* We get a new variable to optimize */
-optimizeVarsline: PT_TOKEN_OPTIMIZE_VARS_LINE PT_TOKEN_SEP  
-           { 
-              currentLine = PT_TOKEN_OPTIMIZE_VARS_LINE;
-              
-           } varsOpt eoln { ; } 
-           |  PT_TOKEN_OPTIMIZE_VARS_LINE eoln 
-           { 
-              /* last one */; 
-           }
-
-varsOpt: varOpt 
-        | varsOpt PT_TOKEN_SEP varOpt
-
-
-/* Variable to be optimized */
-varOpt: PT_TOKEN_KEYWORD_MULTICHAR PT_TOKEN_NUMBER 
-          { 
-             panoAllocateVarToOptimize ();
-
-             varToOptimize->varName = strdup($1);
-             varToOptimize->varIndex = lroundf($2)+1 //remember, internally we use references based 1, not zero
-          } 
-        | PT_TOKEN_KEYWORD PT_TOKEN_NUMBER 
-          {
-             char temp[10];
-
-             panoAllocateVarToOptimize ();
-
-             temp[0] = $1;
-             temp[1] = 0;
-             varToOptimize->varName = strdup(temp);
-             varToOptimize->varIndex = lroundf($2)+1 //remember, internally we use references based 1, not zero
-          }
-
-
-panoline: PT_TOKEN_PANO_LINE PT_TOKEN_SEP
-          { 
-             currentLine=PT_TOKEN_PANO_LINE; 
-          } vars eoln      { ; }
-
-
-huginVars: huginVar
-           | huginVars huginVar
-
-huginVar: PT_TOKEN_HUGIN_KEYWORD PT_TOKEN_NUMBER 
-          {
-              // The tokens include the = at the end
-              // we could do a substr, but there is no real value on that
-              if (strcmp(PT_AUTO_CENTER_CROP_ST "=", $1) == 0) {
-                  autoCenterCrop = lroundf($2);
-              } else if (strcmp(PT_CROP_FACTOR_ST "=" , $1) == 0) {
-                  cropFactor = $2;
-              } else {
-		panoScriptParserError(1,"Warning: invalid variable %s found in Hugin image line. Ignored...\n", $1);
-              }
-          }
-
-vars:      var
-          | vars PT_TOKEN_SEP var
-
-/* a variable can be a cropping one (with 4 parms), a one-parm one, a reference to another variable, or finally, a name 
-   only */
-var:      varcropping |  varreference | varparameter  | varonly
-
-varsparms:  varparameter
-          | varsparms PT_TOKEN_SEP varparameter
-
-
-
- /*  Rule for input image field references <var>=<index> */
-varreference: 
-   PT_TOKEN_KEYWORD_MULTICHAR PT_TOKEN_REFERENCE PT_TOKEN_NUMBER 
-   {
-       int imageRef = lroundf($3) + 1;
-       char *temp = $1;
-
-       switch (currentLine) {
-       case PT_TOKEN_HUGIN_OPTIONS_LINE:
-          panoScriptParserError(1,"Invalid variable name [%c=] in input line.\n", $1);
-          return -1;
-          break;
-       case PT_TOKEN_OUTPUT_LINE:
-       case PT_TOKEN_INPUT_LINE:
-          if (strcmp($1, "Ra") == 0 ||
-              strcmp($1, "Rb") == 0 ||
-              strcmp($1, "Rc") == 0 ||
-              strcmp($1, "Rd") == 0 ||
-              strcmp($1, "Re") == 0 ) {
-             image->responseCurveCoefRef[*(temp+1)-'a'] = imageRef;
-          } else if (strcmp($1, "Ry") == 0) {
-             image->responseCurveTypeRef = imageRef;
-          } else if (strcmp($1, "Eev") == 0) {
-             image->imageEVRef = imageRef;
-          } else if (strcmp($1, "Er") == 0) {
-             image->whiteBalanceFactorRedRef = imageRef;
-          } else if (strcmp($1, "Eb") == 0) {
-             image->whiteBalanceFactorBlue = imageRef;
-          } else if (strcmp($1, "Va") == 0 ||
-                     strcmp($1, "Vb") == 0 ||
-                     strcmp($1, "Vc") == 0 ||
-                     strcmp($1, "Vd") == 0 ||
-                     strcmp($1, "Ve") == 0 ) {
-             image->vignettingCorrectionCoefRef[*(temp+1)-'a'] = imageRef;
-          } else if (strcmp($1, "Vm") == 0) {
-             image->vignettingCorrectionModeRef = imageRef;
-          } else if (strcmp($1, "Vx") == 0 ||
-                     strcmp($1, "Vy") == 0) {
-             image->vignettingCorrectionCoefRef[*(temp+1)-'x'+4] = imageRef;
-          } else if (strcmp($1, "TrX") == 0 ||
-                     strcmp($1, "TrY") == 0 ||
-                     strcmp($1, "TrZ") == 0) {
-             image->translationCoefRef[*(temp+1)-'X'] = imageRef;
-          } else {
-             panoScriptParserError(1,"Invalid variable name [%s]\n", $1);
-             return -1;
-          }
-          break;
-       default:
-          panoScriptParserError(1,"Invalid variable name [%c=] in input line.\n", $1);
-          return -1;
-          break;
-       }
-   }
-   |  PT_TOKEN_KEYWORD PT_TOKEN_REFERENCE PT_TOKEN_NUMBER 
-   {
-       int imageRef = lroundf($3) + 1;
-
-       switch (currentLine) {
-       case PT_TOKEN_INPUT_LINE:
-	   switch ($1) {
-	    case 'v':
-		image->fHorFOVRef = imageRef;
-		break;
-	    case 'y':
-		image->yawRef = imageRef;
-		break;
-	    case 'p':
-		image->pitchRef = imageRef;
-		break;
-	    case 'r':
-		image->rollRef = imageRef;
-		break;
-	    case 'a':
-	    case 'b':
-	    case 'c':
-	    case 'd':
-	    case 'e':
-		image->coefRef[$1-'a'] = imageRef;
-		break;
-	    case 'g':
-		image->coefRef[5] = imageRef;
-		break;
-	    case 't':
-		image->coefRef[6] = imageRef;
-		break;
-           case 'j':
-              fprintf(stderr, ">>>>Variable j REFERENCE to be done\n");
-              break;
-	   default:
-	       panoScriptParserError(1,"Invalid variable name [%c=] in input line.\n", $1);
-	       return -1;
-	       break;
-	   }
-	   break;
-       default:
-	   panoScriptParserError(1,"Error Not handled 3 [%c]\n", $1);
-	   return -1;
-       }
-   }
-
-
-
- /* Rule for [CS]<x>,<x>,<x>,<x> */
-varcropping: PT_TOKEN_KEYWORD_CROPPING PT_TOKEN_NUMBER PT_TOKEN_COMMA PT_TOKEN_NUMBER PT_TOKEN_COMMA PT_TOKEN_NUMBER PT_TOKEN_COMMA PT_TOKEN_NUMBER
-    {
-	switch (currentLine) {
-	case PT_TOKEN_OUTPUT_LINE:
-	case PT_TOKEN_INPUT_LINE:
-	    switch ($1) {
-	    case 'C':
-	    case 'S':
-		image->cropType = $1;
-		image->cropArea[0] = lroundf($2);
-		image->cropArea[1] = lroundf($4);
-		image->cropArea[2] = lroundf($6);
-		image->cropArea[3] = lroundf($8);
-		break;
-	    default:
-		panoScriptParserError(1,"Invalid variable name- [%c] in image line\n", $1);
-		return -1;
-	    }
-	    break;
-	default:
-	    panoScriptParserError(1,"Error Not handled 3\n");
-	    return -1;
-	}
-    }
-
-/*  
-    Rules for <variable><parameter>  
- */
-varparameter: PT_TOKEN_KEYWORD PT_TOKEN_STRING  
-    { 
-      // For the case where the keyword is one char, followed by a string
-
-        DEBUG_2("Token %s", $2);
-
-        /* Processing of string variables */
-	switch (currentLine) {
-	case PT_TOKEN_PANO_LINE:
-	    switch ($1) {
-	    case 'f':
-		ParserStringCopy(&script.pano.projectionName, $2);
-		break;
-	    case 'n':
-		ParserStringCopy(&script.pano.outputFormat, $2);
-		break;
-	    case 'P':
-		ParserStringCopy(&script.pano.projectionParmsString, $2);
-		break;
-	    case 'T':
-		ParserStringCopy(&script.pano.bitDepthOutput, $2);
-	    default:
-		panoScriptParserError(1,"Invalid variable name [%c] in pano line\n", $1);
-		return -1;
-	    }
-	    break;
-	case PT_TOKEN_OUTPUT_LINE:
-	case PT_TOKEN_INPUT_LINE:
-	    switch ($1) {
-	    case 'n':
-		ParserStringCopy(&image->name, $2);
-		break;
-	    default:
-		panoScriptParserError(1,"Invalid variable name [%c] in image line...\n", $1);
-		return -1;
-	    }
-	    break;
-	default:
-	    panoScriptParserError(1,"Error Not handled case [%c]\n", $1);
-	    return -1;
-	}
-    }
-   | PT_TOKEN_KEYWORD PT_TOKEN_NUMBER
-    {
-        /* Processing of int variables with keyword of one character only */
-	switch (currentLine) {
-        case PT_TOKEN_HUGIN_OPTIONS_LINE:
-            switch ($1) {
-            case 'r':
-                script.optimize.optimizeReferenceImage = lround($2);
-                break;
-            case 'e':
-                script.optimize.blendMode = lround($2);
-                break;
-            default:
-                panoScriptParserError(1, "Invalid variable name [%c] in hugin options line.\n", $1);
-                return -1;
-                break;
-            }
-            break;
-        case PT_TOKEN_CONTROL_PT_LINE:
-	   switch ($1) {
-           case 'n':
-               ctrlPoint->iImage1 = lround($2);
-               break;
-           case 'N':
-               ctrlPoint->iImage2 = lround($2);
-               break;
-           case 'x':
-               ctrlPoint->p1.x = $2;
-               break;
-           case 'y':
-               ctrlPoint->p1.y = $2;
-               break;
-           case 'X':
-               ctrlPoint->p2.x = $2;
-               break;
-           case 'Y':
-               ctrlPoint->p2.y = $2;
-               break;
-           case 't':
-               ctrlPoint->type = $2;
-               break;
-	   default:
-	       panoScriptParserError(1, "Invalid variable name [%c] in control point line.\n", $1);
-	       return -1;
-	       break;
-	   }
-           break;
-        case PT_TOKEN_MORPH_PT_LINE:
-	   switch ($1) {
-           case 'i':
-               morphPoint->iImage = lround($2);
-               break;
-           case 'x':
-               morphPoint->p1.x = $2;
-               break;
-           case 'y':
-               morphPoint->p1.y = $2;
-               break;
-           case 'X':
-               morphPoint->p2.x = $2;
-               break;
-           case 'Y':
-               morphPoint->p2.y = $2;
-               break;
-	   default:
-	       panoScriptParserError(1, "Invalid variable name [%c] in morph line.\n", $1);
-	       return -1;
-	       break;
-	   }
-           break;
-	case PT_TOKEN_PANO_LINE:
-	    switch ($1) {
-	    case 'w':
-		script.pano.width = lroundf($2);
-		break;
-	    case 'h':
-		script.pano.height = lroundf($2);
-		break;
-	    case 'f':
-		script.pano.projection = lroundf($2);
-		break;
-	    case 'v':
-		script.pano.fHorFOV = $2;
-		break;
-	    case 'E':
-                script.pano.exposureValue = $2;
-		break;
-	    case 'R':
-                script.pano.dynamicRangeMode = lroundf($2);
-		break;
-	    default:
-		panoScriptParserError(1,"Error Invalid variable name [%c] in pano line\n", $1);
-		return -1;
-	    }
-	    break;
-	case PT_TOKEN_OUTPUT_LINE:
-	case PT_TOKEN_INPUT_LINE:
-	    switch ($1) {
-	    case 'w':
-		image->width = lroundf($2);
-		break;
-	    case 'h':
-		image->height = lroundf($2);
-		break;
-	    case 'f':
-		image->projection = lroundf($2);
-		break;
-	    case 'v':
-		image->fHorFOV = $2;
-		break;
-	    case 'y':
-		image->yaw = $2;
-		break;
-	    case 'p':
-		image->pitch = $2;
-		break;
-	    case 'r':
-		image->roll = $2;
-		break;
-	    case 'a':
-	    case 'b':
-	    case 'c':
-	    case 'd':
-	    case 'e':
-		image->coef[$1-'a'] = $2;
-		break;
-	    case 'g':
-		image->coef[5] = $2;
-		break;
-	    case 't':
-		image->coef[6] = $2;
-		break;
-	    case 'u':
-                image->featherSize = lroundf($2);
-                break;
-	    case 'm':
-		panoScriptParserError(1,"Warning: Option %c in image line deprecated. Ignored...\n", $1);
-		break;
-           case 'j':
-              fprintf(stderr, ">>>>Variable j to be done\n");
-              break;
-	    default:
-		panoScriptParserError(1,"Invalid variable name [%c] in image line...\n", $1);
-		return -1;
-	    }
-	    break;
-	case PT_TOKEN_OPTIMIZE_OPT_LINE:
-	    switch ($1) {
-	    case 'g':
-		script.optimize.fGamma = $2;
-                if (script.optimize.fGamma <= 0.0) {
-                  panoScriptParserError(1,"Invalid value for gamma %f. Must be bigger than zero\n", script.optimize.fGamma);
-                }
-		break;
-	    case 'i':
-		script.optimize.interpolator = lroundf($2);
-		break;
-	    case 'f':
-		script.optimize.fastFT = lroundf($2);
-		break;
-	    case 'm':
-		script.optimize.huberEstimator = $2;
-		break;
-	    case 'p':
-		script.optimize.photometricHuberSigma = $2;
-		break;
-	    default:
-		panoScriptParserError(1,"Invalid variable name [%c] in optimize line\n", $1);
-		return -1;
-	    }
-	    break;
-	default:
-	    panoScriptParserError(1,"Error. Not handled (token int [%c])\n", $1);
-	    return -1;
-	}
-    }
-   | PT_TOKEN_KEYWORD_MULTICHAR PT_TOKEN_NUMBER
-    {
-       char *temp = $1;
-       switch (currentLine)  {
-       case PT_TOKEN_HUGIN_OPTIONS_LINE:
-          return -1;
-          break;
-       case PT_TOKEN_OUTPUT_LINE:
-       case PT_TOKEN_INPUT_LINE:
-          if (strcmp($1, "Ra") == 0 ||
-              strcmp($1, "Rb") == 0 ||
-              strcmp($1, "Rc") == 0 ||
-              strcmp($1, "Rd") == 0 ||
-              strcmp($1, "Re") == 0 ) {
-             image->responseCurveCoef[*(temp+1)-'a'] = $2;
-          } else if (strcmp($1, "Ry") == 0) {
-             image->responseCurveType = lroundf($2);
-          } else if (strcmp($1, "Eev") == 0) {
-             image->imageEV = $2;
-          } else if (strcmp($1, "Er") == 0) {
-             image->whiteBalanceFactorRed = $2;
-          } else if (strcmp($1, "Eb") == 0) {
-             image->whiteBalanceFactorBlue = $2;
-          } else if (strcmp($1, "Va") == 0 ||
-                     strcmp($1, "Vb") == 0 ||
-                     strcmp($1, "Vc") == 0 ||
-                     strcmp($1, "Vd") == 0 ||
-                     strcmp($1, "Ve") == 0 ) {
-             image->vignettingCorrectionCoef[*(temp+1)-'a'] = $2;
-          } else if (strcmp($1, "Vm") == 0) {
-             image->vignettingCorrectionMode = lroundf($2);
-          } else if (strcmp($1, "Vx") == 0 ||
-                     strcmp($1, "Vy") == 0) {
-             image->vignettingCorrectionCoef[*(temp+1)-'x'+4] = $2;
-          } else if (strcmp($1, "TrX") == 0 ||
-                     strcmp($1, "TrY") == 0 ||
-                     strcmp($1, "TrZ") == 0) {
-             image->translationCoef[*(temp+1)-'X'] = $2;
-          } else {
-             panoScriptParserError(1,"Invalid variable name [%s]\n", $1);
-             return -1;
-          }
-          break;
-       default:
-          panoScriptParserError(1,"Invalid variable name [%s]\n", $1);
-          return -1;
-           
-       }
-    }
-
-             
-
-varonly: PT_TOKEN_KEYWORD
-    {
-	switch (currentLine) {
-	case PT_TOKEN_PANO_LINE:
-	    switch ($1) {
-	    case 'T':
-		ParserStringCopy(&script.pano.bitDepthOutput, "");
-		break;
-	    default:
-		panoScriptParserError(1,"Invalid variable name [%c] in pano line\n", $1);
-		return -1;
-	    }
-	    break;
-	case PT_TOKEN_OUTPUT_LINE:
-	case PT_TOKEN_INPUT_LINE:
-	    switch ($1) {
-	    default:
-		panoScriptParserError(1,"Invalid variable name [%c] in image line....\n", $1);
-		return -1;
-	    }
-	    break;
-	default:
-	    panoScriptParserError(1,"Error Not handled 3\n");
-	    return -1;
-	}
-    }
-
-
-
-
-%%
-
-void panoAllocateVarToOptimize (void)
-{ 
-   // ** Allocate space for this variable */
-   script.iVarsToOptimizeCount++;
-   script.varsToOptimize = realloc(script.varsToOptimize,
-                                   sizeof(*script.varsToOptimize) * script.iVarsToOptimizeCount);
-   if (script.varsToOptimize == NULL) {
-      yyerror("Not enough memory");
-   }
-   // clear the end of the reallocated region
-   bzero(&(script.varsToOptimize[script.iVarsToOptimizeCount-1]), sizeof(*script.varsToOptimize));
-   // And set the pointer to the variable where we will put the variable to optimize
-   varToOptimize = &script.varsToOptimize[script.iVarsToOptimizeCount-1];
-
-}
-
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
src/parser/README.txt to PTOparser/panoParser.h
--- a/src/parser/README.txt
+++ b/PTOparser/panoParser.h
@@ -1,45 +1,94 @@
-Parser for panotools and hugin configuration scripts.
 
-* Usage
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
-USAGE:
+/* Skeleton interface for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+   
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-This bison/yacc parser implements a simple parser that reads a file
-and converts it into an equivalent data structure. The main function
-to use is:
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+   
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
 
 
-    scriptPtr = panoScriptParse(inputFilename, dereference?, scriptPtr);
-
-This returns a data structure with all the info in the file.
-Parameters:
-
-  inputFilename: filename to parse
-
-  dereference? : should the referenced variables be resolved? If true
-    variables such as v=0 will be replaced with the value of v in image 0.
-
-  scriptPtr:   : if NOT null, use that point, otherwise allocate a new
-      one.
-
-Return value:
-   a pointer to the structure that contains all the data. It should
-   be disposed properly using panoParseDispose.
-
-CAVEATS:
-
-  - It is not reentrant.
-  - Errors go to standard output (but this is fixable)
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     NUM = 258,
+     PT_TOKEN_NUMBER = 259,
+     PT_TOKEN_STRING = 260,
+     PT_TOKEN_HUGIN_KEYWORD = 261,
+     PT_TOKEN_KEYWORD = 262,
+     PT_TOKEN_KEYWORD_MULTICHAR = 263,
+     PT_TOKEN_KEYWORD_CROPPING = 264,
+     PT_TOKEN_EOL = 265,
+     PT_TOKEN_SEP = 266,
+     PT_TOKEN_INPUT_LINE = 267,
+     PT_TOKEN_OUTPUT_LINE = 268,
+     PT_TOKEN_PANO_LINE = 269,
+     PT_TOKEN_CONTROL_PT_LINE = 270,
+     PT_TOKEN_OPTIMIZE_OPT_LINE = 271,
+     PT_TOKEN_OPTIMIZE_VARS_LINE = 272,
+     PT_TOKEN_COMMA = 273,
+     PT_TOKEN_REFERENCE = 274,
+     PT_TOKEN_MORPH_PT_LINE = 275,
+     PT_TOKEN_HUGIN_VERSION = 276,
+     PT_TOKEN_HUGIN_LINE = 277,
+     PT_TOKEN_HUGIN_OPTIONS_LINE = 278,
+     PT_TOKEN_ERROR = 279,
+     PT_TOKEN_EOF = 280
+   };
+#endif
 
 
 
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+{
+
+/* Line 1676 of yacc.c  */
+#line 86 "/home/dmg/hg.w/panoParser/panoParser.y"
+
+  int   iVal;
+  float fVal;
+  char strVal[PT_TOKEN_MAX_LEN+1];
+  char cVal;
 
 
-void panoParseDispose(pt_script **scriptVar)
 
-* Example:
+/* Line 1676 of yacc.c  */
+#line 86 "panoParser.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+#endif
 
-testparser takes as input a hugin PTO file, and generates one that
-libpano13 tools can use.
+extern YYSTYPE yylval;
 
 
src/parser/panoParser.h to PTOparser/ChangeLog
--- a/src/parser/panoParser.h
+++ b/PTOparser/ChangeLog
@@ -1,94 +1,142 @@
+2011-02-03    <dmg@uvic.ca>
 
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+	* Renamed variables from <name>Index to <name>Ref, which is more appropriate.
+	
+	* tparser.c: Cleanup up code (patch by T. Modes).
 
-/* Skeleton interface for Bison's Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
-   
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+2011-02-02    <dmg@uvic.ca>
 
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-   
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
+	* Fully implemented parsing for PTO files. Except for 'j' param
+	which I don't know what it does.
 
+2008-08-25  dmg  <dmg@phosphorus>
 
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     NUM = 258,
-     PT_TOKEN_NUMBER = 259,
-     PT_TOKEN_STRING = 260,
-     PT_TOKEN_HUGIN_KEYWORD = 261,
-     PT_TOKEN_KEYWORD = 262,
-     PT_TOKEN_KEYWORD_MULTICHAR = 263,
-     PT_TOKEN_KEYWORD_CROPPING = 264,
-     PT_TOKEN_EOL = 265,
-     PT_TOKEN_SEP = 266,
-     PT_TOKEN_INPUT_LINE = 267,
-     PT_TOKEN_OUTPUT_LINE = 268,
-     PT_TOKEN_PANO_LINE = 269,
-     PT_TOKEN_CONTROL_PT_LINE = 270,
-     PT_TOKEN_OPTIMIZE_OPT_LINE = 271,
-     PT_TOKEN_OPTIMIZE_VARS_LINE = 272,
-     PT_TOKEN_COMMA = 273,
-     PT_TOKEN_REFERENCE = 274,
-     PT_TOKEN_MORPH_PT_LINE = 275,
-     PT_TOKEN_HUGIN_VERSION = 276,
-     PT_TOKEN_HUGIN_LINE = 277,
-     PT_TOKEN_HUGIN_OPTIONS_LINE = 278,
-     PT_TOKEN_ERROR = 279,
-     PT_TOKEN_EOF = 280
-   };
-#endif
+	* .svnignore: ignore many files
 
+	* tparser.h, tparser.c, testparser.c: The parser no longer
+	allocates the parsing data structure, instead it is passed as a
+	parameter.
 
+2008-08-24  dmg  <dmg@phosphorus>
 
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
+	* parser.y (PT_TOKEN_STRING): Check that the gamma is >	0. 
+	huberEstimator is a float, not int
 
-/* Line 1676 of yacc.c  */
-#line 86 "/home/dmg/hg.w/panoParser/panoParser.y"
+2008-08-10  dmg  <dmg@uvic.ca>
 
-  int   iVal;
-  float fVal;
-  char strVal[PT_TOKEN_MAX_LEN+1];
-  char cVal;
+	* CMakeLists.txt: Changed name of library to tparser, added
+	tparser.h as a file to install
 
+2008-08-10  dmg  <dmg@uvic.ca>
 
+	* scanner.l, parser.y: Finally! properly handle end-of-input.
 
-/* Line 1676 of yacc.c  */
-#line 86 "panoParser.h"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
+	* CMakeLists.txt: Added GCC declaration for GCC compilation of
+	lround. It might not work on other compilers. This needs ot be fixed.
 
-extern YYSTYPE yylval;
+	* tparser.h: Added declarations to remove warning
 
+2007-06-28  dmg  <dmg@uvic.ca>
 
+	* parser.y, tparser.c, tparser.h, scanner.l: I think I finished
+	implementing all the hugin specific parameters.
+
+	* tparser.h, tparser.h, tparser.c: Added all the variables needed
+	by Hugin, renamed some of them.
+
+	* parser.y, tparser.c, tparser.h: Implemented R variable in p-line
+	
+	* parser.y, tparser.c, tparser.h, scanner.l: Implemented Hugin
+	autoCenterCrop and cropFactor in i-lines.
+
+2007-06-27  dmg  <dmg@uvic.ca>
+
+	* parser.y, tparser.c, tparser.h, scanner.l: Implemented Ra...Re
+	variables and their references
+
+	* parser.y, tparser.c, tparser.h: implemented hugin_options
+	variables r and e.
+
+	* Removed several debugging messages to make the output cleaner.
+
+	* parser.y: Improved error handling in case of unrecognized
+	lines. Previously it was stopping at the first line it did not
+	recognized, but returned no error.
+
+	* parser.y, tparser.c, tparser.h (struct): Added parameters
+	outputPixelType and photometricHuberSigma. Added feather size (u)
+	in images lines
+
+	* scanner.l: Added token for #-hugin variables.
+	
+2007-06-14  dmg  <dmg@uvic.ca>
+
+	* parser.y (PT_TOKEN_STRING): Removed yydebug for the time being.
+
+	* tparserdebug.h (DEBUG_2): THe #else had the wrong number of parms.
+
+	* parser.y: Fixed an out-of-bounds error.
+
+	* tparserdebug.h, parser.y, tparser.c: added this file. 
+
+2007-06-09  Pablo d'Angelo  <pablo.dangelo@web.de>
+
+	* CMakeLists.txt: build a library for the parser anyway, this is
+	required for the transform wrapper. Added link to lm, required on
+	unix. I hope it still works on OSX.
+
+2007-06-06  dmg  <dmg@uvic.ca>
+
+	* CMakeLists.txt: Fixed script. At least it now creates the test executable
+
+	* Tparser.c (panoParserDumpImage): Fixed a compilation error that
+	slip through in my last commit
+
+	* Added support for reading control points.
+
+2007-05-13  dmg  <dmg@uvic.ca>
+
+	* scanner.l, parser.y: Changed PT_TOKEN_FLOAT to
+	PT_TOKEN_NUMBER. Removed PT_TOKEN_INT. Now all numbers are float,
+	but down-converted to int if necessary (using lroundf). Created a
+	new token for cropping (PT_TOKEN_CROPPING). It simplifies error messages.
+
+2007-05-03  dmg  <dmg@uvic.ca>
+
+	* parser.y (PT_TOKEN_STRING): Fixed spelling mistake in huberEstimator
+
+	* tparser.c (panoScriptParse): Fixed spelling mistake in name of parameter
+
+2007-04-18  dmg  <dmg@uvic.ca>
+
+	* tparser.c, tparser.h: Renamed some functions to the tlalli naming
+	standards.  Added functions to parse projection parameters. Added
+	functions to de-reference variables. Added a function to dump the
+	content of the script variable. Fixed some bugs. 
+
+	* tparserprivate.h: Added this file to keep any declarations that
+	are only required to by parser.
+
+	* parser.y: Clear newly allocated memory for image specs
+
+	* testparser.c: Added logic to dereference variables. Moved
+	dumping of variables to a function in tparser.c
+	
+
+2007-04-11  pablo  <pablo.dangelo@web.de>
+
+	* CMakeLists.txt, CMakeModules/FindBISON.cmake,
+	CMakeModules/FindFLEX.cmake, src/CMakeLists.txt,
+	src/parser/CMakeLists.txt: CMake based build system
+
+	* src/parser/tparser.c, src/parser/testparser.c: Moved main into a
+	separate file, build library and test program. Added panoPrintError()
+	function.
+	
+2007-04-10  dmg  <dmg@uvic.ca>
+
+	* scanner.y, parser.l, tparser.h, tparser.c, README.txt, COPYING,
+	Makefile.am, ChangeLog, AUTHORS: First commit. Iimplement a simple
+	bison/yacc parser for the panotools/hugin scripts.
+	
+
src/parser/ChangeLog to PTOparser/tparser.h
--- a/src/parser/ChangeLog
+++ b/PTOparser/tparser.h
@@ -1,142 +1,233 @@
-2011-02-03    <dmg@uvic.ca>
-
-	* Renamed variables from <name>Index to <name>Ref, which is more appropriate.
-	
-	* tparser.c: Cleanup up code (patch by T. Modes).
-
-2011-02-02    <dmg@uvic.ca>
-
-	* Fully implemented parsing for PTO files. Except for 'j' param
-	which I don't know what it does.
-
-2008-08-25  dmg  <dmg@phosphorus>
-
-	* .svnignore: ignore many files
-
-	* tparser.h, tparser.c, testparser.c: The parser no longer
-	allocates the parsing data structure, instead it is passed as a
-	parameter.
-
-2008-08-24  dmg  <dmg@phosphorus>
-
-	* parser.y (PT_TOKEN_STRING): Check that the gamma is >	0. 
-	huberEstimator is a float, not int
-
-2008-08-10  dmg  <dmg@uvic.ca>
-
-	* CMakeLists.txt: Changed name of library to tparser, added
-	tparser.h as a file to install
-
-2008-08-10  dmg  <dmg@uvic.ca>
-
-	* scanner.l, parser.y: Finally! properly handle end-of-input.
-
-	* CMakeLists.txt: Added GCC declaration for GCC compilation of
-	lround. It might not work on other compilers. This needs ot be fixed.
-
-	* tparser.h: Added declarations to remove warning
-
-2007-06-28  dmg  <dmg@uvic.ca>
-
-	* parser.y, tparser.c, tparser.h, scanner.l: I think I finished
-	implementing all the hugin specific parameters.
-
-	* tparser.h, tparser.h, tparser.c: Added all the variables needed
-	by Hugin, renamed some of them.
-
-	* parser.y, tparser.c, tparser.h: Implemented R variable in p-line
-	
-	* parser.y, tparser.c, tparser.h, scanner.l: Implemented Hugin
-	autoCenterCrop and cropFactor in i-lines.
-
-2007-06-27  dmg  <dmg@uvic.ca>
-
-	* parser.y, tparser.c, tparser.h, scanner.l: Implemented Ra...Re
-	variables and their references
-
-	* parser.y, tparser.c, tparser.h: implemented hugin_options
-	variables r and e.
-
-	* Removed several debugging messages to make the output cleaner.
-
-	* parser.y: Improved error handling in case of unrecognized
-	lines. Previously it was stopping at the first line it did not
-	recognized, but returned no error.
-
-	* parser.y, tparser.c, tparser.h (struct): Added parameters
-	outputPixelType and photometricHuberSigma. Added feather size (u)
-	in images lines
-
-	* scanner.l: Added token for #-hugin variables.
-	
-2007-06-14  dmg  <dmg@uvic.ca>
-
-	* parser.y (PT_TOKEN_STRING): Removed yydebug for the time being.
-
-	* tparserdebug.h (DEBUG_2): THe #else had the wrong number of parms.
-
-	* parser.y: Fixed an out-of-bounds error.
-
-	* tparserdebug.h, parser.y, tparser.c: added this file. 
-
-2007-06-09  Pablo d'Angelo  <pablo.dangelo@web.de>
-
-	* CMakeLists.txt: build a library for the parser anyway, this is
-	required for the transform wrapper. Added link to lm, required on
-	unix. I hope it still works on OSX.
-
-2007-06-06  dmg  <dmg@uvic.ca>
-
-	* CMakeLists.txt: Fixed script. At least it now creates the test executable
-
-	* Tparser.c (panoParserDumpImage): Fixed a compilation error that
-	slip through in my last commit
-
-	* Added support for reading control points.
-
-2007-05-13  dmg  <dmg@uvic.ca>
-
-	* scanner.l, parser.y: Changed PT_TOKEN_FLOAT to
-	PT_TOKEN_NUMBER. Removed PT_TOKEN_INT. Now all numbers are float,
-	but down-converted to int if necessary (using lroundf). Created a
-	new token for cropping (PT_TOKEN_CROPPING). It simplifies error messages.
-
-2007-05-03  dmg  <dmg@uvic.ca>
-
-	* parser.y (PT_TOKEN_STRING): Fixed spelling mistake in huberEstimator
-
-	* tparser.c (panoScriptParse): Fixed spelling mistake in name of parameter
-
-2007-04-18  dmg  <dmg@uvic.ca>
-
-	* tparser.c, tparser.h: Renamed some functions to the tlalli naming
-	standards.  Added functions to parse projection parameters. Added
-	functions to de-reference variables. Added a function to dump the
-	content of the script variable. Fixed some bugs. 
-
-	* tparserprivate.h: Added this file to keep any declarations that
-	are only required to by parser.
-
-	* parser.y: Clear newly allocated memory for image specs
-
-	* testparser.c: Added logic to dereference variables. Moved
-	dumping of variables to a function in tparser.c
-	
-
-2007-04-11  pablo  <pablo.dangelo@web.de>
-
-	* CMakeLists.txt, CMakeModules/FindBISON.cmake,
-	CMakeModules/FindFLEX.cmake, src/CMakeLists.txt,
-	src/parser/CMakeLists.txt: CMake based build system
-
-	* src/parser/tparser.c, src/parser/testparser.c: Moved main into a
-	separate file, build library and test program. Added panoPrintError()
-	function.
-	
-2007-04-10  dmg  <dmg@uvic.ca>
-
-	* scanner.y, parser.l, tparser.h, tparser.c, README.txt, COPYING,
-	Makefile.am, ChangeLog, AUTHORS: First commit. Iimplement a simple
-	bison/yacc parser for the panotools/hugin scripts.
-	
-
+/*
+ *  tparser.h
+ *
+ *  Copyright  Daniel M. German
+ *  
+ *  April 2007
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ *  Author: Daniel M German dmgerman at uvic doooot ca
+ * 
+ */
+
+#ifndef __TPARSER_H__
+#define __TPARSER_H__
+
+
+/* Maximum size for an input token */
+#define PARSER_MAX_LINE 1000
+#define PT_TOKEN_MAX_LEN PARSER_MAX_LINE
+
+#define PANO_PARSER_MAX_PROJECTION_PARMS 10
+/* 
+ Data structure where the entire input file will be read 
+*/
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE  1
+#endif
+
+#define PANO_PARSER_COEF_COUNT 7
+#define PANO_PARSER_RESP_CURVE_COEF_COUNT 5
+#define PANO_PARSER_VIGN_COEF_COUNT 6
+#define PANO_TRANSLATION_COEF_COUNT 3
+
+typedef struct {
+    double x;
+    double y;
+} pt_point;
+
+typedef struct {
+    int iImage;
+    pt_point p1;
+    pt_point p2;
+} pt_script_morph_point;
+
+typedef struct {
+    char *varName;
+    int  varIndex;
+} pt_script_optimize_var;
+
+
+typedef struct {
+    int iImage1;
+    int iImage2;
+    pt_point p1;
+    pt_point p2;
+    int type;
+} pt_script_ctrl_point;
+
+typedef struct {
+    int width;
+    int height;
+    int projection;
+    int projectionParmsCount;
+    float projectionParms[PANO_PARSER_MAX_PROJECTION_PARMS];
+    char *projectionParmsString;
+    char *projectionName;
+    float fHorFOV;
+    char *outputFormat;  // n : file format of output
+
+    // Hugin parameters
+    int dynamicRangeMode; // R[01] 0 -> LDR; 1 -> HDR
+    char *bitDepthOutput; // T bitdepth of output images, possible values are
+    //XXX TO BE IMPLEMENTED
+    float exposureValue;  // E exposure value of final panorama
+}  pt_script_pano;
+
+typedef struct {
+    int projection;
+    int width;
+    int height;
+    float fHorFOV;
+    float yaw;
+    float pitch;
+    float roll;
+
+    int featherSize;
+    float coef[PANO_PARSER_COEF_COUNT]; // a, b, c, d, e, g, t
+
+
+    // These are hugin parameters
+    int autoCenterCrop;
+    float cropFactor;
+    
+    // Exposure related
+    float imageEV;  // Exposure value of image Eev
+    float whiteBalanceFactorRed;  // Er
+    float whiteBalanceFactorBlue; // Eb
+    
+    int responseCurveType; // Ry 0 -> EMoR, 1 -> linear
+    float responseCurveCoef[PANO_PARSER_RESP_CURVE_COEF_COUNT]; // R[abcde]
+
+    int vignettingCorrectionMode; // Vm
+    float vignettingCorrectionCoef[PANO_PARSER_VIGN_COEF_COUNT]; // V[abcdxy]
+    float translationCoef[PANO_TRANSLATION_COEF_COUNT]; // TrX parms
+
+
+    char *name;
+    char cropType ; // it can be 'S' or  'C'
+    int cropArea[PANO_PARSER_COEF_COUNT]; // the rectangle to crop to
+    int morphToFit;  // true if morph to fit
+
+    // these variables hold pointers to equivalent variables in other images
+    //  they are equivalent to the format <var>=<index> where
+    // <var> is variable name, and index is a base-zero pointer to another image
+    // For the sake of simplicity they start at 1, if they are zero they are unused
+    int fHorFOVRef;
+    int yawRef;
+    int pitchRef;
+    int rollRef;
+    int coefRef[PANO_PARSER_COEF_COUNT]; // a, b, c, d, e       , g, t
+
+    // hugin indexes for de-referencing
+
+    int imageEVRef; //Exposure value of image
+    int whiteBalanceFactorRedRef;  // Er
+    int whiteBalanceFactorBlueRef; // Eb
+    int vignettingCorrectionModeRef; // Vm
+    int vignettingCorrectionCoefRef[PANO_PARSER_VIGN_COEF_COUNT]; // V[abcdxy]
+    int responseCurveTypeRef; // Ry variable
+    int responseCurveCoefRef[PANO_PARSER_RESP_CURVE_COEF_COUNT]; // R[abcde]
+    int translationCoefRef[PANO_TRANSLATION_COEF_COUNT]; // TrX parms
+
+    // Morphing Points
+    int morphPointsCount;
+    pt_script_morph_point *morphPoints;    
+}  pt_script_image;
+
+
+typedef struct {
+    float fGamma;
+    int interpolator;
+    int fastFT;
+    int huberEstimator;
+    float photometricHuberSigma;
+    int optimizeReferenceImage;
+    int blendMode;
+} pt_script_optimize;
+
+typedef struct {
+    pt_script_pano pano;
+    int iInputImagesCount;
+    pt_script_image *inputImageSpec;
+    int iOutputImagesCount;
+    pt_script_image *outputImageSpec;
+    int iMorphPointsCount;
+    pt_script_optimize optimize;
+    int iVarsToOptimizeCount;
+    pt_script_optimize_var *varsToOptimize;
+    int iCtrlPointsCount;
+    pt_script_ctrl_point *ctrlPointsSpec;
+}  pt_script;
+
+
+
+void panoScriptParserSetDefaults(pt_script *ptr);
+pt_script *panoScriptParse(char *, int , pt_script *);
+void panoScriptParserDispose(pt_script *ptr);
+void panoScriptDump(pt_script *script);
+void panoParserDispose(pt_script **scriptVar);
+void panoScriptLibpanoFormat(FILE *where, pt_script *script);
+
+
+// Accessors to the data structures above...
+// they  are the preferred way to access the data in them
+
+float panoScriptGetImageCoefA(pt_script_image *pImage);
+float panoScriptGetImageCoefB(pt_script_image *pImage);
+float panoScriptGetImageCoefC(pt_script_image *pImage);
+float panoScriptGetImageCoefD(pt_script_image *pImage);
+float panoScriptGetImageCoefE(pt_script_image *pImage);
+float panoScriptGetImageSheerX(pt_script_image *pImage);
+float panoScriptGetImageSheerY(pt_script_image *pImage);
+int panoScriptGetImageCropType(pt_script_image *pImage);
+int panoScriptGetImageMorphToFit(pt_script_image *pImage);
+int panoScriptGetImageProjection(pt_script_image *pImage);
+float panoScriptGetImageHFOV(pt_script_image *pImage);
+float panoScriptGetImagePitch(pt_script_image *pImage);
+float panoScriptGetImageYaw(pt_script_image *pImage);
+float panoScriptGetImageRoll(pt_script_image *pImage);
+char *panoScriptGetName(pt_script_image *pImage);
+
+int panoScriptGetInputImagesCount(pt_script *script);
+int panoScriptGetOutputImagesCount(pt_script *script);
+pt_script_image *panoScriptGetInputImage(pt_script *script, int i);
+pt_script_image *panoScriptGetOutputImage(pt_script *script, int i);
+int panoScriptGetPanoProjection(pt_script *script);
+int panoScriptGetPanoWidth(pt_script *script);
+int panoScriptGetPanoHeight(pt_script *script);
+float panoScriptGetPanoHFOV(pt_script *script);
+float panoScriptGetPanoParmsCount(pt_script *script);
+float panoScriptGetPanoParm(pt_script *script, int index);
+char *panoScriptGetPanoOutputFormat(pt_script *script);
+int panoScriptDeReferenceVariables(pt_script* script);
+char *panoScriptGetInputFileNameOfImage(pt_script* script,int index);
+char *panoScriptGetOutputFileNameOfImage(pt_script* script,int index);
+
+
+// 
+
+
+
+
+#endif
+
1 2 > >> (Page 1 of 2)