Changeset 7325


Ignore:
Timestamp:
04/03/12 09:14:42 (14 months ago)
Author:
anthony
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/MagickWand/magick-cli.c

    r7319 r7325  
    5858 
    5959/* verbose debugging, 
    60       1 - option type 
    61       2 - source of option 
    62       3 - mnemonic lookup 
    63       4 - output options/artifacts 
     60      3 - option type details 
     61      9 - output options/artifacts/propertys 
    6462*/ 
    6563#define MagickCommandDebug 0 
     
    7674} 
    7775 
    78 #if MagickCommandDebug >= 4 
     76#if MagickCommandDebug >= 9 
    7977static void OutputOptions(ImageInfo *image_info) 
    8078{ 
     
    8381    *value; 
    8482 
    85   (void) FormatLocaleFile(stdout,"  Image_Info Options:\n"); 
     83  (void) FormatLocaleFile(stdout,"  Global Options:\n"); 
    8684  ResetImageOptionIterator(image_info); 
    8785  while ((option=GetNextImageOption(image_info)) != (const char *) NULL ) { 
     
    109107  } 
    110108  ResetImageArtifactIterator(image); 
     109} 
     110 
     111static void OutputProperties(Image *image,ExceptionInfo *exception) 
     112{ 
     113  const char 
     114    *property, 
     115    *value; 
     116 
     117  (void) FormatLocaleFile(stdout,"  Image Properity:\n"); 
     118  ResetImagePropertyIterator(image); 
     119  while ((property=GetNextImageProperty(image)) != (const char *) NULL ) { 
     120    (void) FormatLocaleFile(stdout,"    %s: ",property); 
     121    value=GetImageProperty(image,property,exception); 
     122    if (value != (const char *) NULL) 
     123      (void) FormatLocaleFile(stdout,"%s\n",value); 
     124  } 
     125  ResetImagePropertyIterator(image); 
    111126} 
    112127#endif 
     
    215230      count=option_info->type; 
    216231      option_type=(CommandOptionFlags) option_info->flags; 
    217 #if MagickCommandDebug >= 2 
     232#if 0 
    218233      (void) FormatLocaleFile(stderr, "Script: %u,%u: \"%s\" matched \"%s\"\n", 
    219234             cli_wand->line, cli_wand->line, option, option_info->mnemonic ); 
     
    224239    if ( option_type == UndefinedOptionFlag || 
    225240         (option_type & NonMagickOptionFlag) != 0 ) { 
    226 #if MagickCommandDebug 
    227       (void) FormatLocaleFile(stderr, "Script Non-Option: \"%s\"\n", option); 
     241#if MagickCommandDebug >= 3 
     242      (void) FormatLocaleFile(stderr, "Script %u,%u Non-Option: \"%s\"\n", 
     243                  cli_wand->line, cli_wand->line, option); 
    228244#endif 
    229245      if ( IfMagickFalse(IsCommandOption(option))) 
     
    252268      CloneString(&arg2,(char *)NULL); 
    253269 
    254 #if MagickCommandDebug 
     270#if MagickCommandDebug >= 3 
    255271    (void) FormatLocaleFile(stderr, 
    256         "Script Option: \"%s\" \tCount: %d  Flags: %04x  Args: \"%s\" \"%s\"\n", 
    257         option,(int) count,option_type,arg1,arg2); 
     272      "Script %u,%u Option: \"%s\"  Count: %d  Flags: %04x  Args: \"%s\" \"%s\"\n", 
     273          cli_wand->line,cli_wand->line,option,count,option_type,arg1,arg2); 
    258274#endif 
    259275 
     
    292308 
    293309next_token: 
    294 #if MagickCommandDebug >= 4 
     310#if MagickCommandDebug >= 9 
    295311    OutputOptions(cli_wand->wand.image_info); 
    296     if ( cli_wand->wand.images != (Image *)NULL ) 
     312    if ( cli_wand->wand.images != (Image *)NULL ) { 
    297313      OutputArtifacts(cli_wand->wand.images); 
     314      OutputProperties(cli_wand->wand.images,cli_wand->wand.exception); 
     315    } 
    298316#endif 
    299317    if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse ) 
     
    301319  } 
    302320 
    303 #if MagickCommandDebug 
     321#if MagickCommandDebug >= 3 
    304322  (void) FormatLocaleFile(stderr, "Script End: %d\n", token_info->status); 
    305323#endif 
     
    426444      count=option_info->type; 
    427445      option_type=(CommandOptionFlags) option_info->flags; 
    428 #if MagickCommandDebug >= 2 
     446#if 0 
    429447      (void) FormatLocaleFile(stderr, "CLI %d: \"%s\" matched \"%s\"\n", 
    430448            i, argv[i], option_info->mnemonic ); 
     
    434452    if ( option_type == UndefinedOptionFlag || 
    435453         (option_type & NonMagickOptionFlag) != 0 ) { 
    436 #if MagickCommandDebug 
    437       (void) FormatLocaleFile(stderr, "CLI Non-Option: \"%s\"\n", option); 
     454#if MagickCommandDebug >= 3 
     455      (void) FormatLocaleFile(stderr, "CLI %d Non-Option: \"%s\"\n", i, option); 
    438456#endif 
    439457      if ( IfMagickFalse(IsCommandOption(option) ) && 
     
    462480    arg2 = ( count >= 2 ) ? argv[i+2] : (char *)NULL; 
    463481 
    464 #if MagickCommandDebug 
     482#if MagickCommandDebug >= 3 
    465483    (void) FormatLocaleFile(stderr, 
    466         "CLI Option: \"%s\" \tCount: %d  Flags: %04x  Args: \"%s\" \"%s\"\n", 
    467         option,(int) count,option_type,arg1,arg2); 
     484      "CLI %u Option: \"%s\"  Count: %d  Flags: %04x  Args: \"%s\" \"%s\"\n", 
     485          i,option,count,option_type,arg1,arg2); 
    468486#endif 
    469487 
     
    497515 
    498516next_argument: 
    499 #if MagickCommandDebug >= 4 
     517#if MagickCommandDebug >= 9 
    500518    OutputOptions(cli_wand->wand.image_info); 
    501     if ( cli_wand->wand.images != (Image *)NULL ) 
     519    if ( cli_wand->wand.images != (Image *)NULL ) { 
    502520      OutputArtifacts(cli_wand->wand.images); 
     521      OutputProperties(cli_wand->wand.images,cli_wand->wand.exception); 
     522    } 
    503523#endif 
    504524    if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse ) 
     
    518538  cli_wand->line=i; 
    519539 
    520 #if MagickCommandDebug 
    521   (void) FormatLocaleFile(stderr, "CLI Write File: \"%s\"\n", option ); 
     540#if MagickCommandDebug >= 3 
     541  (void) FormatLocaleFile(stderr, "CLI %d Write File: \"%s\"\n", i, option ); 
    522542#endif 
    523543 
Note: See TracChangeset for help on using the changeset viewer.