avinfo-1.0.a15+20090102/0000755000175000017500000000000011127442370012621 5ustar stasstasavinfo-1.0.a15+20090102/CHANGELOG0000644000175000017500000001367611127432071014045 0ustar stasstasv 1.0.a15+20090102, *nix package - Compile with -funsigned-char (fixes ClearNonPrintable(), Debian bug #510097). - Fixed v.len bug in the raw template (reported by Alexey ). - This file recoded from CP866 to UTF-8 ;) v 1.0.0 alpha 15-bugfix, *nix package * Cosmetic changes in config.c and the man page. - Fixed a minor bug in src/Makefile. - Fixed bugs in c_conv2.c, avinfo.c with incorrect checking of FILE* pointers. - Fixed a bug in text.c, type char was silently assumed to be a signed type. - BUFFER_SIZE in mkv.c renamed to RD_BUFFER_SIZE to prevent a name conflict. - Some compilation warnings corrected in print.c, riff.c and mpeg.c. - Fixed ass.y to suppress a shift/reduce conflict warning. - Removed a couple of non-informative files from the docs. - Corrected minor issues in templates. * Patch by Cyrille Lefevre in description reading. * Backported ClearNonPrintable() in print.c from SVN. - Fixed bug in ass.y with two '==' in comparison (kudos to gcc -Wall). - More compilation warnings corrected in riff.c, ifu.c, ogm.c. * Files in ./nobison regenerated. * Some russian documentation files recoded to UTF-8 v 1.0.0 alpha 15, *nix package - windows binaries removed + added a high-level Makefile with install/uninstall targets and a separate config.mk file for configurable options. * patched config.c to respond to --help and --version + added avinfo man page (generated by help2man) * dos2unix on all files * README rewritten reflecting the changes * Russian docs recoded to koi, alt and win encodings v 1.0.0 alpha 15 - bug with incorrect var setting from command line - damaged AVI left out (thnx Berni for bugreport). + for --html-list variable: htmlpart (set on/off for html-header) + for --list variable listpre (
 on/off)
	+ for --list and --html-list variables umsg, umsgh.
	+ MKV (Matroska) support (no tags)
	+ tN.cc - subtitle type
	* minor template changes
	- memory leak in mp3parse


v 1.0.0 alpha 14

	+ new template for Excel users (--csv-list)
	+ support files for template (-thf=..., -tbf=..., -tff=...)
	+ new tabs behavior
	* improved --list template
	+ new template --far (contain DOS pseudograph)


v 1.0.0 alpha 13 [OGM support]

	+ IFO (DVD) support (language)
	+ ELSE operator in A.S.S.
	* .bspadd changed to .vbr (from string to number)
	- align to word (riff) (needs fo support AVIUtl)
	+ implemented full OGM support . (And OGG)
	* templates changed for support a#.lang and 'ELSE'
	- minor bugfixes in RIFF INFO processing
	* ISFT in AVI now ignoring


v 1.0.0 alpha 12 [riff.c rewrite]

	* mp3.c integrated as part mpeg.c, mp3 scan +50% speed up
	+ option -s (-sNumber, bit flags for scaning module)
	  (currently supported only by aviparse)
	* now mpegparse use 4k blocks, but can look up to 1Mb if needs,
	+ new template --raw (for use within scripts)
	+ option -v for variable setup
	+ now, some unsupported video files (rm, asf, wmv, mkv, ogm)
	  shown in list (only size and filename, sorry)
	+ option -e for exclude specified file type from scan.
	- bug wigh hang up in some bad mpeg files (seek with negative values,
	  thnx to Christian Grothoff for bugreport and fix idea.
	+ options -th, -tb, -tf for header (th) body (tb) and footer (tf)
	  templates
	* finally rewrited riff.c, (no more!), now AVInfo mus be byteorder 
	  independed. (I'm hope)


v 1.0.0 alpha 11 [clean up]

	* more right MPEG length calculation (but VBR not fully supported -_-)
	* MPEG buffer = 64k

v 1.0.0 alpha 10 [DASH!]

	* some new AI in CRC remove from filename
	* A.S.S. syntax changed:
		+ some values in PRINT, separated by ,
		+ {} can be skipped
		- plain text removed
		+ new command EXIT
	+ -ll:maxlength changed to -m:maxlength
	+ maxlength=0 == infinity
	+ header/footer for templates
	- maxlength used for any template
	+ added mask '#' and '$' (any digit/letter) in STRICMP func.
	- main part of memory leak 
	+ option -i=delay - delay between filescans (in ms)
	- bug with files without extension
	- cr/lf bugs
	* now VOB files with size <16Mb will be skipping
	+ подсчёт битрейта/длительности/fps/звука для MPEG1, MPEG2.
	+ now full MPEG support added (a/v bitrate, length, sound data)
	+ aspect ratio
	+ statistic at the list end (for --list, --html-list)
	- bug with increment/decrement in A.S.S.

v 1.0.0 alpha 9

	- sorry, while fixing memory leak, broke a normal work -_-

v 1.0.0 alpha 8

	* Improved operation with variables.
	* rewrited variable printing function.
	* more correct timeview in tc mode
	- bug in DelVar() 
	+ more strict control for maxlist
	+ short name feature (see docs/sn.txt)
	- big memory leak

v 1.0.0 alpha 7
	
	+ codec base (in test mode)
	* changed string processing (now, in numeric vart of var string length)
	- bug with empty strings ("").
	* tc #print mode now do not show a seconds, if time >9 min.
	+ -l:stdin allow to read filelist from stdin (originally, ne? ^_^)

v 1.0.0 alpha 6

	- bug with add string and number (bug in --list)
	+ -ll=size option (set line lenght for --list)
	* more agressive tc mod.
	+ VBR mp3 detection
	* faster mp3 detection (may produce mistake in length/bitrate for VBR)
	- divide overflow error in mp3
	- hang up on damaged mp3s (hotfix, will be fixed latter)
	* now compiling on BSD without warnings (thnx to ArjLover)
	+ Added DeleteVar() function in var.c
	+ added an a -l:filelist option (se below)
	+ support for mask '*' and '?' in var names

v1.0.0 a5

	- bug with filenames
	+ template --short


v1.0.0 a4
	- supports for older bisons (ass.y line 66)
	+ option -f (force use module, associated with extenshion)
	* simpificated avi reading code
	* -Wall --pedantic -ansi do not show any warnings
	* bitrate now calculating in 1000, not a 1024.
	- bug with length of audio track.
	- trap in some strage avi headers.
	- codec info shows in "kilo" (i.e. codec: 8k -_-)
	* rewrited var.c
	- removed error.c (come back latter?)
	+ supports for string variable in A.S.S. (finally!)
	+ name of vob-files now shown with path	
	- trap with dual freeing string variables
avinfo-1.0.a15+20090102/doc/0000755000175000017500000000000011044034423013360 5ustar  stasstasavinfo-1.0.a15+20090102/doc/ass_tutorial.rus.koi0000644000175000017500000001704210232250600017404 0ustar  stasstas		A.S.S. tutorial

 A.S.S. - AVInfo simple script -    
     AVInfo.

   :

 AVInfo        
   (  ,   )   
 (  ) ,    . 
     -,      
     ( ), 
  .
   ۣ ,    - 
  ,      .

    , ,    ,
    "" (header) - ,  
    . , ,  
  html    , ,   
      html.
      "" (footer), ,
       .  
   /   html.

 AVInfo  ,   ,  
 :

 1)  -   (header, body, footer)  
  ,    .
 (   -th, -tb, -tf, -thf, -tbf, -tff)
 2)      (, --list)
      . ( ,
  , ,    ,  ""
 ,         
   ,  ).
 3)     ,    
   --default.

   . 

        
 ,    .

      ,  
  ""   ,  
   (, ,  '>'  
 AVInfo  "",     ,  
      
 -).
      ,     
     64.

    :

     :
 -th=header
 -tb=body
 -tf=footer

      :
 -thf=header.file
 -tbf=body.file
 -tff=footer.file

      "" , ..
  AVInfo   -tf  .   
     ,    
 ,      . 
  AVInfo      ,   
      (     
 )    (  --default).

  

           
 .

       C  BASIC, 
       .

   ϣ       
 -ң   ޣ   .

    A.S.S.    .
     .

  .

        , 
  .
 (           
 )

  ͣ:

 c -    'c'.
 class23.member2 -    'class23.member'


 .

   .    
    [],   
     ( )  .
         .

 , :

 v[2].l   v2.l
 v[2+2<<4-4].cc   v4.cc

       .

 , ,  c=2,  v[c+1].l  v3.l

  .

  AVInfo   ,  , 
       .

    ̣ :

 1)     
 ,      
   ţ     .
 2)    ,   - .
    (, , ,
 etc)   .

      , 
     signed int32
 [-2147483648;2147483648].   .

 .

  AVInfo  ̣  ( 
 ,     ,   print)
   .

     
  C.     
  C.

   :
 -exp		  
 (exp)		. (   )
 exp+exp	   .      
 			 ,  ,  - .
 exp-exp      
 exp*exp	
 exp/exp     .     
 			-    . 
 exp%exp      .   
 			 ,    .

 exp=exp      .   ,
 			  .    ,
 			 ,  ޣ .  
 			   0.

 exp!=exp    ,    1 
 			  .

 expexp       (, ,   ,
 exp>=exp     ).     0.
 exp<=exp 

 exp>>exp    .
 exp<, 
, « נ   Ġ html. ڭ̬ ̧ "Ţ" (footer), ɠ, ׮̩ ̢ « ת ¥ Ġ ¯ª. ڭ נ Ů נרר / ̢ʨ ץ html. AVInfo Х ɠ, ׮̩ Ǥ ¯ͧ, «ʥ Ф: 1) « -׮ ɠ (header, body, footer) Ǫ ͧץ Т, ׮ Ǥ ¯ͧ . (ڨ -th, -tb, -tf, -thf, -tbf, -tff) 2) « ͧץ Ǫ ɠ (, --list) ׮ ¯ͧ ɠ ®עעʨ . ( ׮, « ͧץ, , Ǫ ɠ, "¢" Ţ, ׮ Ǥ ¯ͧ ɠ ץ ɠ ®עעʨ Ţ, Ǫ̩ ͧץ). 3) « ɠ Ǫ, ׮ Ǥ ¯ͧ ɠ --default. ®ע ɠ. ע̥ ɠ Ǫ̢ Ь , נ ڥ Ġ. « ɠ Ǫ̢ , «ǥ ר "ª" «Ǧ ¨, «ע (נ, , ¨ '>' ɠ AVInfo ڨ "ɥ", ׮   , ɨע ץנ׮ ׮ ¨ ڠ -̢). « Ǫ̢ Ġ ɠ, Ġ ɠ ɠ 64. ̢ ɠ «ʨ : Ǫ : -th=header -tb=body -tf=footer Ǫ Ġ ɠ: -thf=header.file -tbf=body.file -tff=footer.file «ڠ Ůר Ǫ "׮" ɠ, .. ̧̢ AVInfo ɠ -tf . ׮ «ڠ Ǥ ¯ͧ נ׭̩ ɠ, ɠ Ǫ̬ , Ţ ɠ ̧̢ Ǥ. « AVInfo Ǭ ڨנ ɠ Ġ, ׮ Ǥ ¯ͧ ɠ Ǫ̬ (« ̫ Ǫ ) Į׮̩ ɠ ( --default). ɠ ̩ ɠ נХ ¥ ץנ׮. ¨נ¨ ªͪ ¬ C BASIC, ڥ   « . ɨע ¢Ӭ ɠ   ¯ͧ - ڨ ªͪ ֨. ¥ A.S.S. ¨̥. ̢ . . ®׮ Ǫ רª Ġנ, ֨ ׮ڪ. ( ׮ ֨ ׮ڪ ̬ ¨ ) ӭ: c - 'c'. class23.member2 - 'class23.member' ¨. ڥ ¨. « ڠ ׭̥ ª [], ׮ ® ר ª ǥ (¬ ) ڨ«Х. ׮ Ǧ ڨנ ڥ. , : v[2].l ׮ע v2.l v[2+2<<4-4].cc ׮ע v4.cc ׭ ª ¯ͧ ǣ ̥. , , « c=2, ׮ v[c+1].l Ϊ׭ v3.l . AVInfo ר֨, ǣ «, ר Х ¨ר נ ¯ͧ. ׮ ̯ ӭ̥ : 1) « ׮ ¯ͧ ǥ ڨ«, ׮ «ڠ ¯ͧ ڥע ڨ« ڥ ¯ͧǥ . 2) « ª̢ , ׮ ǫנ - . ¥ נ̥ͭ ֨ (ڨנ, Ǭ, , etc) ¯ͧ ڨ«̥ ڥ. ڥ ǯ , ڨ«̥ ̥ ڥ ڥ signed int32 [-2147483648;2147483648]. ǥ. . AVInfo ӭ נ ( ׭ ª, « ע ֨, ׮ print) ¯ͧ . ڨנ רڥª ڭ Ь C. ֠ ץ׮ ®עעǥ ڭ נ֥ C. ® ǯ ֨: -exp (exp) . (¯ͧǥ ץ׮) exp+exp « ڨ¥ . « Ů ڨ«, ǫנ ڨ«, ڥ - . exp-exp ڨנ ڨ¥ exp*exp Ǭ exp/exp ֥ڨ« . ǫנ - ڥ . exp%exp נ׮ ֥ڨ« . « ׮ ǫ, ǫנ . exp=exp ڨ« . ǫנ ֥, « . « , , נ . « ǫנ 0. exp!=exp ڭ ̤ʥ, ǫנ 1 « . expexp « ̯Х « (ɥ, ɥ, ɥ , exp>=exp ɥ ). ר «ڠ ǫנ 0. exp<=exp exp>>exp ¤ . exp<

AVInfo documentation

( , , )

AVInfo - , . , . (txt, html, csv)

, AVInfo , , .

, , , .

( ) . , DIR, ( , fps , ).

, (, , , "mpeg picture sequence". bat-. html - , "". , , "" ( ).

, AVInfo . - *.mkv .

Microsoft Windows 95,98,ME,NT,2k,XP,2003s ( ):

avinfo.exe , path. , - c:\windows ( windows 95,98,ME,XP) c:\winnt ( NT/2k). , , , "", "avinfo -l-" ( ). . , Ctrl-C. AVInfo . . .

Linux, FreeBSD, *nix:

, src, make. , avinfo . (, /usr/bin, /usr/local/bin) bison gcc.

N.B. , GCC Bison .

N.B. , big-endian , . ( )

AVInfo Windows ( ):

make- *nix-like . windows Makefile.win ( make -f Makefile.win, Makefile Makefile.win Makefile) gcc, , C-. : http://bison.gnu.org/

, ( ) nobison, .

AVInfo () , , (avi - riffparse, mp3 - mp3parse, mpeg 1,2 - mpegparse, ogm -omgparse etc). (, fps, , etc), . avinfo . - (A.S.S. - AVInfo Simple Script) . , stdout, .

, avinfo , /.

- , .

- , . .

AVInfo - . -l ( ). , , .

AVInfo :

  • *.avi - RIFF/AVI, , , (LIST [INFO]), ( idx1) 9 9 .
  • *.mp3, *.mp2 - MPEG/Layer3(2), , (id3v1 tag), ( VBR-)
  • *.mpg,*.mpeg, *.vob - MPEG1(2), , . 9 9 . N.B. vob-, private streams, AVInfo .
  • *.ogm, *.ogg , , ( .. )
  • *.srt, *.smi, *.sub, *.ssa - . (/ ), .

, AVInfo, , , (*.rm, *.asf, *.wmv, *.mkv).

, (--list, --html-list), , :

  • fps
  • (, )

- , "" ( fps/bitrate/resolution).

( )

'=' () ':' () (.. ).

AVInfo :

avinfo [keys] [filename] [--mode]

(keys):

  • -e=extension - . (, ls -1|avinfo -e:mp3 --list , mp3 ).
  • -f=extension - , , . : avinfo test.avi -f:mpg AVInfo test.avi, MPEG .
  • -l=list - . avinfo . (stdin) . (windows) dir /s /b|avinfo -l- --list (*nix) ls -1 |avinfo -l=0- --html-list - . ! ( dir c /b ls -1)
  • -m=size - . 0 - . , -m39 39 .
  • -o=outputfile - , stdout.
  • -s=value - , , BitField : ( )
    0-1 0 3,
    0 -
    ( ,
    , etc)
    avi:
    1 - " " ,
    , .
    avi: 128 ( ) 2 - , (*)
    avi:
    3 -
    avi:
    2-7 reserved
  • -tb=template ( ), -fb , (, )
  • -tbf=filename - , ( 64), , .
  • -tf=template - (-fb )
  • -tff=filename - ,
  • -th=template - (-fh )
  • -thf=filename - , .
  • -v=name=value - . , . ( )

( , ). avinfo (*,?).

(modes)

C , . (--) , . (avinfo a.avi --short)

  • --default ( , , )
  • --description ( descript.ion)
  • --short ( descript.ion)
  • --list ( plain-text )
  • --html-list ( html )
  • --raw ( ( ) )
  • --csv-list ( *.csv (Coma Separated Values), MS Excel.)
  • --far ( , " ". *nix). FAR Manager.

( )

avinfo somefile.ogm

. .

avinfo -f:mpeg somefile.avi

mpeg-.

avinfo test.avi --raw

test.avi, raw ( , ).

( )

dir /s /b somedir|sort|avinfo -l- --list >result.txt ( Windows)

ls -1 -R somedir|sort|avinfo -l- --list >~/result.txt ( Linux)

result.txt c somedir, .

ls -1 -R /data/video |sort|avinfo -e:mp3 -l- --html-list >/pub/www/list/files.html

html- . , mp3.

[TODO]........ avinfo-1.0.a15+20090102/doc/doc_urls.txt0000644000175000017500000000075010232114667015744 0ustar stasstasUsed documentation: AVI: http://msdn.microsoft.com/ (MSDN Home> MSDN Library> Graphics and Multimedia> DirectX> DirectX 9.0 SDK Update (Summer 2003) C++> DirectShow> Appendixes> AVI File Format) mp3: see mpeg id3v1: http://id3.org/ mpeg, ifo: http://dvd.sourceforge.net/dvdinfo/ mpeg_sys source code (peeping a little :) http://www.andrewduncan.ws/ (MPEG 1,2 section) ogm: http://xiph.org/ and http://tobias.everwicked.com/ mkv: http://www.matroska.org/avinfo-1.0.a15+20090102/doc/whatsnew.rus.koi0000644000175000017500000002043010232114667016542 0ustar stasstasv 1.0.0 alpha 15 [Balalayka] - - , - AVI ( ) thnx Berni for bugreport. + --html-list , : htmlpart + --list ,

: listpre
	+   --list, --html-list  umsg, umsgh.
	+  MKV (Matroska)
	+ tN.cc -  
	*    
	- memory leak in mp3parse

v 1.0.0 alpha 14

	+     Excel (,   :) --csv-list
	+     (-thf=..., -tbf=..., -tff=...)
	  (stdin         )
	+  .    . ,  ,
	    ,       
	  ,       max_length.
	*      --list
	+  ""  --far

v 1.0.0 alpha 13

	  - 13.      ,    
	 OGM,        -_-
	 
	+ IFO (DVD) support (language)
	+  IFO  (*.ifo  DVD) - ,   . (  )
	+ ELSE   A.S.S.
	* .bspadd changed to .vbr (from string to number)
	-     (riff) (   AVIUtl)
	+    OGM. (, , ogg)
	*    ޸ a#.lang   ELSE 
	-   ()   avi
	* ISFT  AVI   .

v 1.0.0 alpha 12 

	* mp3.c    mpeg.c, mp3.c   .
	   mp3  ~50-60ms/file  25-30ms/file (+50% speed up)
	+  -s (-sNumber,     )
	  (  aviparse, )
	*  mpegparse     4,   ,
	    ,      1
	+   --raw (   )
	+  -v     
	+      ,    
	  (rm, asf, wmv, mkv, ogm)
	+  -e       .
	-         mpegpase 
	  (       "").
	  Thnx to Christian Grothoff for bugreport and fix idea.
	+  -th, -tb, -tf       
	  (//) .
	*   riff.c,   AVInfo  byteorder 
	  independed.

v 1.0.0 alpha 11 [clean up]

    -   MPEG-  -  (
           VBR).
    -     MPEG'   64k.

v 1.0.0 alpha 10 [dash]

	*  AI  -  CRC
	*     A.S.S.:
		+    print  .
		+   '{}'   .
		-  plain text   .
		+   EXIT
	+  -ll:maxlength   -m:maxlength
	+ maxlength=0 == infinity
	+  header/footer  
	-    maxlength     
	+      '#' -    $ -  
	-    (?) memory leaks,   
       ~600-700k      .
	+  -i=number -     ( )
	*   -m,-l     -m445, -l- ( ':'  '=') 
	-           ,
          .
	-     (-) CR/LF   .
	*  VOB-  ,  16     
      --list  --html-list
    + ޸ //fps/  MPEG1, MPEG2.
	+  vN.aspectX, vN.aspectY  Aspect Ratio,   
	  (   ,  vN.x/vN.y!=vN.aspectX/vN.aspectY)
	+    --list, --html-list
	 ( , fps, bps,  )
	- ݸ     -.

v 1.0.0 alpha 9

	- do not work in any way (too strong bugfix in a8)

v 1.0.0 alpha 8

	* -     (- Op()  ass.y)
	*    
	*      timecompact .
	-   -  
	+       maxlist (,  )
	+   sn (short names) -  ͸  CRC,  ޸,
	   .   sn.txt
	-  memory leak   "" . 

v 1.0.0 alpha 7
	
	+    (   )
	*      (  
	    ""    ).
	-     ("").
	* tc    ,    10 .
	+  -l:  stdin. (try dir /s /b | avinfo -l:stdin --list)
	
v 1.0.0 alpha 6

	-       (    --list)
	+  .  -l:number (   --list )
	*   tc ,     .
	+ VBR mp3 detection (in "default", "html-list", "short" templates)
	*  mp3   ( 1000 ), , ,\
	     /  VBR .
	-           mp3
	-    mp3 ( ,    ޸ )
	*     FreeBSD ( ArjLover'    )
	* -l:size changed to -ll=size (line length=size)
	+ Added DeleteVar() function in var.c
	+ added an a -l:filename option (se below)
	+      .
	!           ! (use dir /b)
	+   '?'  '*'    (DOS LIKE, NOT UNIX!)

v 1.0.0 alpha 5

	-    -   var.c\
	  ( /     )
	-      ޸  .
	+  --short (  )
	*   ()  ,  ޸   a4

v 1.0.0 alpha 4
	
	-    -    (ass.y line 66)
	+  -f ( avinfo -f:ext filename i.e. avinfo -f:mp3 video.avi)
	* ݸ (!)   ,     3 .
	* -Wall --pedantic -ansi       .
	+  127 
	-   -114 
	*      / (  1024/)
	-    -  avi
	-        avi.    \
	       riff-.
	-  ݸ    ޸  (...  )
	-        "-" 
	-       mpeg.c
	*    var.c,    \
	   -.   var.o
	-  (?) error.c -    
	+++     
	+  ,    (VTS_01_0.VOB)     \
	      .
	-   ""  ̸ 

v 1.0.0 alpha 3

	+    m1000 (     \
	  1024,  1000)
	-       - (1024 :)
	-  ( )   struct-report.  . \
	    .
	+  mp3, id3v1
	* Fine-tuning --list,     
	+ linux/bsd(?) compability

v 1.0.0 a2

	*     --list
	*           
	     "" (2ch, XVID, DIVX, DX50, DIV3)
	*  "̸ " XVID, DIVX, DX50, DIV3


near TODO:
	-  ()     ,  
	*   mpeg.
	? id3v2 (suxx)

avinfo-1.0.a15+20090102/doc/whatsnew.rus.win0000644000175000017500000002043010232114667016555 0ustar  stasstasv 1.0.0 alpha 15 [Balalayka]

	-         
	- , -   AVI ( )  
	  thnx Berni for bugreport.
	+   --html-list ,  : htmlpart
	+   --list ,   
: listpre
	+   --list, --html-list  umsg, umsgh.
	+  MKV (Matroska)
	+ tN.cc -  
	*    
	- memory leak in mp3parse

v 1.0.0 alpha 14

	+     Excel (,   :) --csv-list
	+     (-thf=..., -tbf=..., -tff=...)
	  (stdin         )
	+  .    . ,  ,
	    ,       
	  ,       max_length.
	*      --list
	+  ""  --far

v 1.0.0 alpha 13

	  - 13.      ,    
	 OGM,        -_-
	 
	+ IFO (DVD) support (language)
	+  IFO  (*.ifo  DVD) - ,   . (  )
	+ ELSE   A.S.S.
	* .bspadd changed to .vbr (from string to number)
	-     (riff) (   AVIUtl)
	+    OGM. (, , ogg)
	*     a#.lang   ELSE 
	-   ()   avi
	* ISFT  AVI   .

v 1.0.0 alpha 12 

	* mp3.c    mpeg.c, mp3.c   .
	   mp3  ~50-60ms/file  25-30ms/file (+50% speed up)
	+  -s (-sNumber,     )
	  (  aviparse, )
	*  mpegparse     4,   ,
	    ,      1
	+   --raw (   )
	+  -v     
	+      ,    
	  (rm, asf, wmv, mkv, ogm)
	+  -e       .
	-         mpegpase 
	  (       "").
	  Thnx to Christian Grothoff for bugreport and fix idea.
	+  -th, -tb, -tf       
	  (//) .
	*   riff.c,   AVInfo  byteorder 
	  independed.

v 1.0.0 alpha 11 [clean up]

    -   MPEG-  -  (
           VBR).
    -     MPEG'   64k.

v 1.0.0 alpha 10 [dash]

	*  AI  -  CRC
	*     A.S.S.:
		+    print  .
		+   '{}'   .
		-  plain text   .
		+   EXIT
	+  -ll:maxlength   -m:maxlength
	+ maxlength=0 == infinity
	+  header/footer  
	-    maxlength     
	+      '#' -    $ -  
	-    (?) memory leaks,   
       ~600-700k      .
	+  -i=number -     ( )
	*   -m,-l     -m445, -l- ( ':'  '=') 
	-           ,
          .
	-     (-) CR/LF   .
	*  VOB-  ,  16     
      --list  --html-list
    +  //fps/  MPEG1, MPEG2.
	+  vN.aspectX, vN.aspectY  Aspect Ratio,   
	  (   ,  vN.x/vN.y!=vN.aspectX/vN.aspectY)
	+    --list, --html-list
	 ( , fps, bps,  )
	-      -.

v 1.0.0 alpha 9

	- do not work in any way (too strong bugfix in a8)

v 1.0.0 alpha 8

	* -     (- Op()  ass.y)
	*    
	*      timecompact .
	-   -  
	+       maxlist (,  )
	+   sn (short names) -    CRC,  ,
	   .   sn.txt
	-  memory leak   "" . 

v 1.0.0 alpha 7
	
	+    (   )
	*      (  
	    ""    ).
	-     ("").
	* tc    ,    10 .
	+  -l:  stdin. (try dir /s /b | avinfo -l:stdin --list)
	
v 1.0.0 alpha 6

	-       (    --list)
	+  .  -l:number (   --list )
	*   tc ,     .
	+ VBR mp3 detection (in "default", "html-list", "short" templates)
	*  mp3   ( 1000 ), , ,\
	     /  VBR .
	-           mp3
	-    mp3 ( ,     )
	*     FreeBSD ( ArjLover'    )
	* -l:size changed to -ll=size (line length=size)
	+ Added DeleteVar() function in var.c
	+ added an a -l:filename option (se below)
	+      .
	!           ! (use dir /b)
	+   '?'  '*'    (DOS LIKE, NOT UNIX!)

v 1.0.0 alpha 5

	-    -   var.c\
	  ( /     )
	-        .
	+  --short (  )
	*   ()  ,     a4

v 1.0.0 alpha 4
	
	-    -    (ass.y line 66)
	+  -f ( avinfo -f:ext filename i.e. avinfo -f:mp3 video.avi)
	*  (!)   ,     3 .
	* -Wall --pedantic -ansi       .
	+  127 
	-   -114 
	*      / (  1024/)
	-    -  avi
	-        avi.    \
	       riff-.
	-        (...  )
	-        "-" 
	-       mpeg.c
	*    var.c,    \
	   -.   var.o
	-  (?) error.c -    
	+++     
	+  ,    (VTS_01_0.VOB)     \
	      .
	-   ""   

v 1.0.0 alpha 3

	+    m1000 (     \
	  1024,  1000)
	-       - (1024 :)
	-  ( )   struct-report.  . \
	    .
	+  mp3, id3v1
	* Fine-tuning --list,     
	+ linux/bsd(?) compability

v 1.0.0 a2

	*     --list
	*           
	     "" (2ch, XVID, DIVX, DX50, DIV3)
	*  " " XVID, DIVX, DX50, DIV3


near TODO:
	-  ()     ,  
	*   mpeg.
	? id3v2 (suxx)

avinfo-1.0.a15+20090102/doc/readme.rus.koi0000644000175000017500000003260610232250472016142 0ustar  stasstas( ,    ,   )


AVInfo


 

	AVInfo -        
	  , .     , 
	   . 



	Microsoft Windows 95,98,ME,NT,2k,XP,2003s (  ):

		 avinfo.exe      ,   
		path.     ,      -  
		   c:\windows ( windows 95/98/ME/XP)  
		c:\winnt ( NT/2k).  ,    
		,   ,	  "",  
		 "avinfo -l-" ( ).     
		 .    ,  Ctrl-C. AVInfo  
		 .   .   .

	Linux, FreeBSD, *nix:

		 ,    src,   make.
		   ,   avinfo    
		 . (, /usr/bin, /usr/local/bin)  
		  bison  gcc. 
		N.B. , GCC  Bison   .

		N.B.  ,           
		bigendian,        
		.   .

	 AVInfo  Windows (  ):

		make-     GCC (GNU C Compiler)  GNU bison.
		   gcc,    ,  
		    C-.	
		   : http://bison.gnu.org/

 

	AVInfo   ()  ,   ,
	      (avi - riffparse,
	mp3 - mp3parse, mpeg 1,2 - mpegparse, etc).   
	   (, fps,  , etc), 
	   .    avinfo 
	  .  -     
	(A.S.S. - AVInfo Simple Script)	    , Ÿ 
	.   ,     
	(,  stdout,          
	 stdin  ).    , avinfo  
	       ,  .. 
	/. 
	 - ,      . 
	 - ,        . 
	    .

 

	AVInfo      -    
	    .    -l ( ).
	     ,    ,
	.


 

	AVInfo      :

	*.avi - RIFF/AVI,    , ,  
			 (LIST [INFO]),  (  idx1)
			  9   9  .
	*.mp3, *.mp2 - MPEG/Layer3(2),    , 
			  (id3v1 tag),   
			 (     VBR-)
	*.mpg,*.mpeg, *.vob - MPEG1(2),      
			,   .
			  9   9  .
			N.B.     vob-,    
			    private streams,    
			AVInfo .
	*.srt, *.smi, *.sub, *.ssa - .    
			  (/ ), .
	*.ogm, *.ogg - OGG Vorbis.   9   ,
			 ..  .

	  ,   AVInfo,   ,
	 ,     (*.rm, *.mkv, etc)

	 ,    (--list, --html-list),   
	  ,  :

		  
		  
		   
		    
		   
		 fps 
		  (, )
		   

	   - ,    
	 "" (  fps/bitrate/resolution).




	avinfo [keys] [filename] [--mode]

	 (keys):
		    -S[:|=]value, ..   , ,
		  ,     ( )
		   . : -m80, -m=150, -l=mylist, -i:40.
		   ,      ( 
		/)   ,   .
	
        -m=size -     . 0 - .
				, -m39   39 .
        -f=extension -  ,   
				,   .
				: avinfo test.avi -f:mpg  AVInfo 
				 test.avi,      MPEG .
        -l=list -  .     avinfo
				       .
				       (stdin)
				      .
				 (windows) dir /s /b|avinfo -l- --list
				(*nix) ls -1 |avinfo -l=0- --html-list
				    -   
				  .        
				! (   dir c  /b  ls   -1)
        -i=ms (or -iMs) -      
				(   ).
		-e=extension -     .
				(, ls -1|avinfo -e:mp3 --list   
				 ,    mp3 ).
		-s=value - ,  , BitField
				: (׸    )
				0-1   0  3,    
					0 -     
					(    , 
					 , etc)
					avi:   
					1 -  " " ,   
						 Ҹ,    .
					avi:   128  (  
						  )
					2 -   ,      (*)
					avi:    
					3 -  Ӹ 
					avi:    
				2-7 reserved

		-th		-   ( )
		-tb,	-   ( )
		-tf		-  .    Ҹ   
				 ,   .   
				   A.S.S.


	 
	
		   (  Ը,   ).   
		avinfo     (*,?).

	 (modes)

		  ,    
		 .        (--)
		  ,   . (avinfo a.avi --short)

		--default (  , ,    )
		--description (   descript.ion)
		--short (  descript.ion)
		--list ( plain-text  )
		--html-list ( html  )
		--raw (   ( Ӹ)   )

	   :

		--list
			        , 
			""    . , ,   
			  , CRC, .   Ӹ 
			 ,   ,  
			   . ,  fps    20,
			        , 
			  fps - , , ,  ,
			   .

			    html-   ,
			   /  
 / ޸
			( 
  ,     
  
"").
    listpre,
			 Ÿ     -v.

			 umsg ( User Message)    
			 ޸ (, , ,  ޸  ޸).

			 umsgh  "" umsg. umsgh ,
			   html  .  
			 ,  umsg   html .

			: 
dir /s /b c:\anime\new | avinfo -l- -v:listpre=1 -v:umsg=date:%date:~10% -v:umsgh=2 --list >>c:\site\news.html
			( Windows/Dos)    c:\site\news.html ޸,  
			  ,    c:\anime\new, ޸ ޸
			 "׸"   
,   ޸   
			 ޸.

		--html-list

			   

 

	  (  )

		avinfo somefile.avi
	
			  .     .
		
		avinfo -f:mpeg somefile.avi
		
			     mpeg-.

		avinfo test.avi --raw

			    test.avi,   raw
			(    ,   
			   / ).

	  (   )

		dir /s /b somedir|sort|avinfo -l- --list >result.txt  ( Windows)
		ls -1 -R somedir|sort|avinfo -l- --list >~/result.txt ( Linux)

			  result.txt c ޸     somedir,
			       .

ls -1 -R /data/video |sort|avinfo -e:mp3 -l- --html-list >/pub/www/list/files.html
ls -1R |grep -v "^$"|grep -v ":$"
			   html-    .  
			 ,  mp3.


***   ***

    A.S.S. (AVInfo simple script)

	 
		
		
			{} 
				     , 
				   
			IF
				: IF () ;
				     .

			WHILE
				
				: WHILE () ;
				    ,   .
				     .

			DO
				
				: DO  WHILE (  )
				    ,   .
				     .

			EXIT
				
				: EXIT;
				  

			PRINT
	
				: PRINT , ,...,;
					 PRINT :,...,:;
				  STDOUT .    ,  
				.
				    ,  
				     .
				(.  )

			SET 
				
				: SET  = ;
				      .

		

				
				   :   .  
				     -    .
				
				   ,     ͸ .
				 ,    ,  
				    . ( b = a++ + a++  )

				
					     ,  ()
					 .

					    "".   
					  :
					\\ - \
					\" - 
					\n -  
					\b - backspace
					\xFF -     FF
					
				
					    SET,  
					      (,  
					 ).
					    -   .
					 ,   ()   
					,   ,  ,  
					.
					
					 / /  
					    . 
				
				    (    )

					() - ,  . 
					!  - .     ,  ,
								  ,   .
					 *  - .   .
					 /  -  ()
					 %  -   
					 +  - 
					 -  - 
					 <<  -   
					 >>  -   
					 >  - "".     ,  1,  0.
										    >, <=, >=, !=.
					 =  -   ,   1,  0.

/*todo...*/avinfo-1.0.a15+20090102/doc/readme.rus.win0000644000175000017500000003260610232250456016157 0ustar  stasstas( ,    ,   )


AVInfo


 

	AVInfo -        
	  , .     , 
	   . 



	Microsoft Windows 95,98,ME,NT,2k,XP,2003s (  ):

		 avinfo.exe      ,   
		path.     ,      -  
		   c:\windows ( windows 95/98/ME/XP)  
		c:\winnt ( NT/2k).  ,    
		,   ,	  "",  
		 "avinfo -l-" ( ).     
		 .    ,  Ctrl-C. AVInfo  
		 .   .   .

	Linux, FreeBSD, *nix:

		 ,    src,   make.
		   ,   avinfo    
		 . (, /usr/bin, /usr/local/bin)  
		  bison  gcc. 
		N.B. , GCC  Bison   .

		N.B.  ,           
		bigendian,        
		.   .

	 AVInfo  Windows (  ):

		make-     GCC (GNU C Compiler)  GNU bison.
		   gcc,    ,  
		    C-.	
		   : http://bison.gnu.org/

 

	AVInfo   ()  ,   ,
	      (avi - riffparse,
	mp3 - mp3parse, mpeg 1,2 - mpegparse, etc).   
	   (, fps,  , etc), 
	   .    avinfo 
	  .  -     
	(A.S.S. - AVInfo Simple Script)	    ,  
	.   ,     
	(,  stdout,          
	 stdin  ).    , avinfo  
	       ,  .. 
	/. 
	 - ,      . 
	 - ,        . 
	    .

 

	AVInfo      -    
	    .    -l ( ).
	     ,    ,
	.


 

	AVInfo      :

	*.avi - RIFF/AVI,    , ,  
			 (LIST [INFO]),  (  idx1)
			  9   9  .
	*.mp3, *.mp2 - MPEG/Layer3(2),    , 
			  (id3v1 tag),   
			 (     VBR-)
	*.mpg,*.mpeg, *.vob - MPEG1(2),      
			,   .
			  9   9  .
			N.B.     vob-,    
			    private streams,    
			AVInfo .
	*.srt, *.smi, *.sub, *.ssa - .    
			  (/ ), .
	*.ogm, *.ogg - OGG Vorbis.   9   ,
			 ..  .

	  ,   AVInfo,   ,
	 ,     (*.rm, *.mkv, etc)

	 ,    (--list, --html-list),   
	  ,  :

		  
		  
		   
		    
		   
		 fps 
		  (, )
		   

	   - ,    
	 "" (  fps/bitrate/resolution).




	avinfo [keys] [filename] [--mode]

	 (keys):
		    -S[:|=]value, ..   , ,
		  ,     ( )
		   . : -m80, -m=150, -l=mylist, -i:40.
		   ,      ( 
		/)   ,   .
	
        -m=size -     . 0 - .
				, -m39   39 .
        -f=extension -  ,   
				,   .
				: avinfo test.avi -f:mpg  AVInfo 
				 test.avi,      MPEG .
        -l=list -  .     avinfo
				       .
				       (stdin)
				      .
				 (windows) dir /s /b|avinfo -l- --list
				(*nix) ls -1 |avinfo -l=0- --html-list
				    -   
				  .        
				! (   dir c  /b  ls   -1)
        -i=ms (or -iMs) -      
				(   ).
		-e=extension -     .
				(, ls -1|avinfo -e:mp3 --list   
				 ,    mp3 ).
		-s=value - ,  , BitField
				: (    )
				0-1   0  3,    
					0 -     
					(    , 
					 , etc)
					avi:   
					1 -  " " ,   
						 ,    .
					avi:   128  (  
						  )
					2 -   ,      (*)
					avi:    
					3 -   
					avi:    
				2-7 reserved

		-th		-   ( )
		-tb,	-   ( )
		-tf		-  .       
				 ,   .   
				   A.S.S.


	 
	
		   (  ,   ).   
		avinfo     (*,?).

	 (modes)

		  ,    
		 .        (--)
		  ,   . (avinfo a.avi --short)

		--default (  , ,    )
		--description (   descript.ion)
		--short (  descript.ion)
		--list ( plain-text  )
		--html-list ( html  )
		--raw (   ( )   )

	   :

		--list
			        , 
			""    . , ,   
			  , CRC, .    
			 ,   ,  
			   . ,  fps    20,
			        , 
			  fps - , , ,  ,
			   .

			    html-   ,
			   /  
 / 
			( 
  ,     
  
"").
    listpre,
			      -v.

			 umsg ( User Message)    
			  (, , ,    ).

			 umsgh  "" umsg. umsgh ,
			   html  .  
			 ,  umsg   html .

			: 
dir /s /b c:\anime\new | avinfo -l- -v:listpre=1 -v:umsg=date:%date:~10% -v:umsgh=2 --list >>c:\site\news.html
			( Windows/Dos)    c:\site\news.html ,  
			  ,    c:\anime\new,  
			 ""   
,      
			 .

		--html-list

			   

 

	  (  )

		avinfo somefile.avi
	
			  .     .
		
		avinfo -f:mpeg somefile.avi
		
			     mpeg-.

		avinfo test.avi --raw

			    test.avi,   raw
			(    ,   
			   / ).

	  (   )

		dir /s /b somedir|sort|avinfo -l- --list >result.txt  ( Windows)
		ls -1 -R somedir|sort|avinfo -l- --list >~/result.txt ( Linux)

			  result.txt c      somedir,
			       .

ls -1 -R /data/video |sort|avinfo -e:mp3 -l- --html-list >/pub/www/list/files.html
ls -1R |grep -v "^$"|grep -v ":$"
			   html-    .  
			 ,  mp3.


***   ***

    A.S.S. (AVInfo simple script)

	 
		
		
			{} 
				     , 
				   
			IF
				: IF () ;
				     .

			WHILE
				
				: WHILE () ;
				    ,   .
				     .

			DO
				
				: DO  WHILE (  )
				    ,   .
				     .

			EXIT
				
				: EXIT;
				  

			PRINT
	
				: PRINT , ,...,;
					 PRINT :,...,:;
				  STDOUT .    ,  
				.
				    ,  
				     .
				(.  )

			SET 
				
				: SET  = ;
				      .

		

				
				   :   .  
				     -    .
				
				   ,      .
				 ,    ,  
				    . ( b = a++ + a++  )

				
					     ,  ()
					 .

					    "".   
					  :
					\\ - \
					\" - 
					\n -  
					\b - backspace
					\xFF -     FF
					
				
					    SET,  
					      (,  
					 ).
					    -   .
					 ,   ()   
					,   ,  ,  
					.
					
					 / /  
					    . 
				
				    (    )

					() - ,  . 
					!  - .     ,  ,
								  ,   .
					 *  - .   .
					 /  -  ()
					 %  -   
					 +  - 
					 -  - 
					 <<  -   
					 >>  -   
					 >  - "".     ,  1,  0.
										    >, <=, >=, !=.
					 =  -   ,   1,  0.

/*todo...*/avinfo-1.0.a15+20090102/doc/alt-csv.tpl0000644000175000017500000000202610232114667015461 0ustar  stasstasif(ext="vob") print in; else print sn:name;
print ";";
print m1024:size,"b;";
set c=0;
while(c++<9){
  if( a[c].l ) print a[c].l;
  print ";";
  if( a[c].l ) print time:a[c].l;
  print ";";
  if( a[c].cc ) print cn:a[c].cc;
  print ";";
  if( a[c].ch ) print a[c].ch;
  print ";";
  if( a[c].freq ) print a[c].freq;
  print ";";
  if( a[c].bits ) print a[c].bits;
  print ";";
  if( a[c].bps ) print a[c].bps;
  print ";";
  if( a[c].vbr) print a[c].vbr;
  print ";";
  if( a[c].lang ) print a[c].lang;
  print ";";
  if( v[c].l ) print v[c].l;
  print ";";
  if( v[c].l ) print time:v[c].l,";";
  print ";";
  if( v[c].x )  print v[c].x,"x", v[c].y;
  print ";";
  if( v[c].bits ) print v[c].bits;
  print ";";
  if( v[c].cc ) print v[c].cc;
  print ";";
  if( v[c].cc ) print cn:v[c].cc;
  print ";";
  if( v[c].fpsH ) print v[c].fpsH;
  if( v[c].fpsH && v[c].fpsL ) print ".",v[c].fpsL;
  print ";";
  if( v[c].bps ) print v[c].bps; 
  print ";";
  if( v[c].lang ) print v[c].lang;
  print ";";
  if(t[c].lang) print t[c].lang;
  print ";";
}
avinfo-1.0.a15+20090102/doc/ass_tutorial0000644000175000017500000000125710232114667016030 0ustar  stasstasA.S.S. Tutorial
(russian version avaible in ass_tutorial.rus)

hello word sample:

	print "hello word!";

2x2 sample:

	print "2x2=",2*2;

print sample:

	print m1000:65536,"\n";
	print m1024:65536,"\n";
	print t:305;

set sample:

	set a=3;
	print a,"x3=", a*3;

adv. set;

	set foo=5;
	set bar="hello word# \x32";
	set foobar=foo++ * bar;
	print foo, "...", bar, "...", foobar, "\n";

if

	set a=333;
	if(a<<3>4) print "OK"; else print "ooops";


while sample:

	set a=3;
	while(a++<20) print a, "\n";

do sample:

	set x=1;

	do{ print x; print "\n"; set x=x*2;} while (x<65536);


exit sample:

	set a=30;
	while(--a) print a, " ";
	if (!a) exit;
	print "error!";


Simple, isn't it?avinfo-1.0.a15+20090102/doc/faq.rus.koi0000644000175000017500000000375110232114667015460 0ustar  stasstasq:     --list  ? 
       !
a:  avinfo   avi,    .  
     ,   - mpeg/avi/mp3/ogm/mkv/etc. 
       .

q:      ?
a:       C++.   
	   ANSI C.

q:     ?
a: doc_urls.txt

q:      avi.
a: ,        (    
    ),      15-30 .  
    .         -s,
        .
    :
   00 (0x0) -   
   10 (0x1) -   128. (  +- 20-40%)
   01 (0x2) -  
   11 (0x3) -   .
   (   -s -  )

q:        ?
a1:  (: gs@shounen.ru)
a2:    ,   .

q:    () ?
a:   .   avinfo  . 
     ޣ,  .

q:     !!!!111
a:  cmd.exe. AVInfo    ,   
   -.    ,   .  iconv.

q:    / (header/footer)
a:   . : avinfo -th: -tf: [   ]
   ( ,  /  )
a2:  ݣ (  html-list),   -v:htmlpart=1, 
       html-.

q:   ޣ  Excel (csv-list) ?
a:  excel Σ ""  CSV,  .
    - .  xls    
     .

avinfo-1.0.a15+20090102/doc/faq.rus.win0000644000175000017500000000375110232225031015457 0ustar  stasstasq:     --list  ? 
       !
a:  avinfo   avi,    .  
     ,   - mpeg/avi/mp3/ogm/mkv/etc. 
       .

q:      ?
a:       C++.   
	   ANSI C.

q:     ?
a: doc_urls.txt

q:      avi.
a: ,        (    
    ),      15-30 .  
    .         -s,
        .
    :
   00 (0x0) -   
   10 (0x1) -   128. (  +- 20-40%)
   01 (0x2) -  
   11 (0x3) -   .
   (   -s -  )

q:        ?
a1:  (: gs@shounen.ru)
a2:    ,   .

q:    () ?
a:   .   avinfo  . 
     ,  .

q:     !!!!111
a:  cmd.exe. AVInfo    ,   
   -.    ,   .  iconv.

q:    / (header/footer)
a:   . : avinfo -th: -tf: [   ]
   ( ,  /  )
a2:   (  html-list),   -v:htmlpart=1, 
       html-.

q:     Excel (csv-list) ?
a:  excel  ""  CSV,  .
    - .  xls    
     .

avinfo-1.0.a15+20090102/doc/ass_tutorial.rus.utf80000644000175000017500000003165111043626446017532 0ustar  stasstas		A.S.S. tutorial

 A.S.S. - AVInfo simple script - интерпретируемый примитивный язык для
 создания шаблонов в программе AVInfo.

 Основная идеология программы:

 AVInfo после разбора параметров командной строки для каждого файла
 из списка (или единственного файла, если списка нет) вызывает  
 (базируясь на расширении) модуль, собирающий информацию о файле. 
 Каждый модуль делает это по-своему, но каждый из них в результате
 заполняет несколько внутренних переменных (см ниже), описывающих
 параметры файла.
 Если разбор произошёл успешно, вызывается парсер шаблона - 
 интерпретатор скрипта, содержащего команды вывода на экран параметров.

 Если обрабатывается список файла, то, в зависимости от настроек,
 может быть вызвана "шапка" (header) - шаблон, которой обрабатывается
 ДО обработки первого файла. Там, например, может находиться
 заголовок html файла и тег , 
, если предполагается воводить таблицу с описанием файлов в html. Аналогичным образом может быть вызван "хвост" (footer), шаблон, который выводится после обработки всех файлов списка. Обычно там находится статистика и/или закрывающие теги html. AVInfo определяет шаблон, который будет использован, в следующем порядке: 1) Если какой-то из шаблонов (header, body, footer) указан пользователем явно, то будет использоваться он. (ключи командной строки -th, -tb, -tf, -thf, -tbf, -tff) 2) Если пользователь указал имя шаблона (например, --list) то используются шаблоны с соответствующим именем. (при этом, если пользователь, например, указал и имя шаблона, и "свой" хвост, то будет использоваться шапка и тело шаблона с соответствующим именем и хвост, указанный пользователем). 3) Если имя шаблона не указано, то будет использоваться шаблон с именем --default. Указание собственных шаблонов. Собственные шаблоны можно указывать как напрямую из командной строки, так и через файлы. Если шаблон указывается в командной строке, следует позаботиться о "маскировании" возможных служебных символов, во избежание неожиданных последствий (так, например, символ '>' в шаблонах AVInfo значит "больше", в то же самое время, в большинстве командных интерпретаторов этот символ означает перенаправление ввода-вывода). Если указывается имя файла с шаблоном, размер файла для каждого из шаблонов не должен превышать 64к. Указываются шаблоны следующим образом: При указании из командной строки: -th=header -tb=body -tf=footer При указании на файлы с шаблонами: -thf=header.file -tbf=body.file -tff=footer.file В случае необходимости можно указать "пустой" шаблон, т.е. вызывать AVInfo с шаблоном -tf без параметра. В этом случае будет использоваться либо стандартный шаблон, либо шаблон с указанным именем, но хвост шаблона вызываться не будет. Если AVInfo не сумеет прочитать шаблон из файла, то будет использоваться или шаблон с указанным именем (если имя было указанно в командной строке) или дефолтовый шаблон (с именем --default). Стурктура шаблона Каждый шаблон представляет из себя ноль или более команд для встроенного интерпретатора. Команды по синтаксису несколько напоминают смесь C с BASIC, и не предназначены для написания сложных программ. В большинстве своём шаблон вполне может быть написан с использованием двух-трёх переменных для счётчиков и нескольких циклов. Все команды в A.S.S. и имена переменны регистронезависимые. Строки обрабатываются без изменения регистра. Имена переменных. Имена переменных могут состоять из букв латинского алфавита, цифр и точки. (при этом цифра или точка не могут быть первым символом имени переменной) Примеры имён: c - переменная с именем 'c'. class23.member2 - переменная с именем 'class23.member' Массивы. Ограниченно поддерживаются массивы. Если в имени переменной встречаются квадратные скобки [], то содержимое этих скобок трактуется как выражение (см ниже) и вычисляется. При этом в имя переменной попадает уже посчитанное значение. Так, например: v[2].l тождественно равно v2.l v[2+2<<4-4].cc тождественно равно v4.cc Внутри квадратных скобок можно использовать другие переменные. Так, например, если c=2, то v[c+1].l эквивалентно v3.l Типы переменных. Внутри AVInfo нет строгой типизации, другими словами, тип переменной меняется в зависимости от места использования. При этом выполняются определённые правила: 1) Если место использования переменной требует числа, то в случае использования строковой переменной в качестве её числового значения используется длина строки. 2) Если скадываются две строки, то результат - строка. Все остальные операции (вычитание, умножение, сравнение, etc) используют числовые значения. Длина строки ограничена лишь доступной памятью, числовые переменные ограничены диапазоном значений signed int32 [-2147483648;2147483648]. Переполнение не контролируется. Выражения. Внутри AVInfo в определённых местах (внутри квадратных скобок, внутри условий ветвления и циклов, в операторе print) можно использовать выражения. Выражения считаются практически аналогично выражениям из C. Таблица приоритетов соответствует аналогичной таблице из C. Список доступных операций: -exp изменение знака выражения (exp) выражение. (Используется для изменения приоритетов) exp+exp сложение чисел или строк. Если хотя бы одно из выражений число, результат число, иначе - строка. exp-exp вычитание двух чисел exp*exp умножение exp/exp целочисленное деление. Результат деления на ноль - значение первого выражения. exp%exp остаток целочисленного деления. Если второе выражение равно нулю, результат равен первому выражению. exp=exp сравнение численных выражений. Результат равен единице, если выражения равны. Если оба выражения строки, они сравниваются, без учёта регистра. Если выражения не равны результат 0. exp!=exp Аналогично предыдущему, но результат равен 1 если выражения не равны. expexp если выполняется условие (меньше, больше, больше или равно, exp>=exp меньше или равно). В противоположном случае результат 0. exp<=exp exp>>exp сдвиг вправо. exp< до/после отч╦та (тег
 указывает браузеру, что кусок текста между 
 и 
является "текстовым"). Для включения тега
 нужно использовать переменную listpre,
			указав е╦ в ключе командной строки -v.

			Переменная umsg (от User Message) позволяет вставить свою строку
			в отч╦т (например, дату, указание, о ч╦м именно отч╦т).

			Переменная umsgh управляет "выделением" umsg. umsgh указывает,
			какой уровень заголовка html следует использовать. Если переменная
			не указывается, то umsg не выделяется html тегами.

			Пример: 
dir /s /b c:\anime\new | avinfo -l- -v:listpre=1 -v:umsg=date:%date:~10% -v:umsgh=2 --list >>c:\site\news.html
			(под Windows/Dos) допишет в файл c:\site\news.html отч╦т, в котором
			будут указаны файлы, лежащие в каталоге c:\anime\new, прич╦м отч╦т
			будет "зав╦рнут" в теги 
, а до отч╦та будет помещена дата
			генерации отч╦та.

		--html-list

			В этом режиме 

ПРИМЕРЫ ИСПОЛЬЗОВАНИЯ

	ИНДИВИДУАЛЬНЫЙ РЕЖИМ (режим одного файла)

		avinfo somefile.avi
	
			Самый простой пример. Будет выведена информация про файл.
		
		avinfo -f:mpeg somefile.avi
		
			Попытаться обработать указанный файл как mpeg-файл.

		avinfo test.avi --raw

			Вывести информацию о файле test.avi, используя шаблон raw
			(вывести всю информацию в формате, удобном для обработки
			 внешними модулями и/или скриптами).

	ПАКЕТНЫЙ РЕЖИМ (режим со списком файлов)

		dir /s /b somedir|sort|avinfo -l- --list >result.txt  (для Windows)
		ls -1 -R somedir|sort|avinfo -l- --list >~/result.txt (для Linux)

			сформирует файл result.txt c отч╦том о файлах в каталоге somedir,
			добавит в конец файла статистику об отсканированных файлах.

ls -1 -R /data/video |sort|avinfo -e:mp3 -l- --html-list >/pub/www/list/files.html
ls -1R |grep -v "^$"|grep -v ":$"
			Создаст в виде html-файла список файлов с описаниями. Будут обработаны
			все файлы, кроме mp3.


*** ТЕХНИЧЕСКАЯ ДОКУМЕНТАЦИЯ ***

СПЕЦИФИКАЦИЯ ВСТРОЕННОГО СКРИПТОВОГО ЯЫЗКА A.S.S. (AVInfo simple script)

	ЭЛЕМЕНТЫ ЯЗЫКА
		
		ОПЕРАТОРЫ
			{} ГРУППИРОВКА
				Операторы перечисляются через точку с запятой, объединяются
				в один групповой оператор
			IF
				Синтаксис: IF (ВЫРАЖЕНИЕ) ОПЕРАТОР;
				Оператор выполняется только если выражение истино.

			WHILE
				
				Синтаксис: WHILE (ВЫРАЖЕНИЕ) ОПЕРАТОР;
				ОПЕРАТОР выполняется до тех пор, пока ВЫРАЖЕНИЕ истино.
				Оператор выполняется ноль или более раз.

			DO
				
				Синтаксис: DO ОПЕРАТОР WHILE ( ВЫРАЖЕНИЕ )
				Оператор выполняется до тех пор, пока ВЫРАЖЕНИЕ истино.
				Оператор выполняется один или более раз.

			EXIT
				
				Синтаксис: EXIT;
				Прекращение обработки скрипта

			PRINT
	
				Синтаксис: PRINT ВЫРАЖЕНИЕ, ВЫРАЖЕНИЕ,...,ВЫРАЖЕНИЕ;
					или PRINT ВЫРАЖЕНИЕ:ВЫРАЖЕНИЕ,...,ВЫРАЖЕНИЕ:ВЫРАЖЕНИЕ;
				Выводит на STDOUT выражение. Если выражение равно нулю, оно 
				игнорируется.
				Если два выражения разделены двоеточием, первое трактуется
				как форма вывода второго на экран.
				(см. формы печати)

			SET 
				
				Синтаксис: SET ИМЯ = ВЫРАЖЕНИЕ;
				Устанавливает переменную с именем ИМЯ равным ВЫРАЖЕНИЮ.

		ВЫРАЖЕНИЯ

				
				Выражения бывают двух типов: символьные и численные. У символьного
				значения всегда есть численная форма - она равна длине строки.
				
				Выражения состоят из констант, знаков операций и  им╦н переменных.
				Выражения разбираются, согласно приоритетов знаков операций, в случае
				равного приоритета в порядке следования. ( b = a++ + a++ валидная строка)

				КОНСТАНТЫ
					Численные константы задаются в десятичном виде, запятая (точка)
					не поддерживается.

					Строковые константы задаются в "кавычках". Внутри кавычек 
					существуют следующие подстановки:
					\\ - \
					\" - кавычка
					\n - перевод строки
					\b - backspace
					\xFF - символ с шестнадцатиричным кодом FF
					
				ПЕРЕМЕННЫЕ
					Переменные либо создаются оператором SET, либо передаются
					в скрипт из модулей обработки файлов (внешних, по отношению
					к парсеру).
					Существует два типа переменных - числовые и символьные.
					В случае, если оператора (выражение) требует использования числового
					выражения, а указанно символьное, используется число, равное длине
					строки.
					
					Операции постфиксного/префиксного инкремента/декремента могут использоваться
					только по отношению к переменным. 
				
				ДОПУСТИМЫЕ ОПЕРАЦИИ С ВЫРАЖЕНИЯМИ (сгруппированы в порядке убывания приоритета)

					(ВЫРАЖЕНИЕ) - группировка, указание приоритета. 
					! ВЫРАЖЕНИЕ - отрицание. Если выражение не равно нулю, результат нулевой,
								если выражение нулевое, результат равен единице.
					ВЫРАЖЕНИЕ * ВЫРАЖЕНИЕ - умножение. Переполнение не проверяется.
					ВЫРАЖЕНИЕ / ВЫРАЖЕНИЕ - деление (целочисленное)
					ВЫРАЖЕНИЕ % ВЫРАЖЕНИЕ - остаток от деления
					ВЫРАЖЕНИЕ + ВЫРАЖЕНИЕ - сложение
					ВЫРАЖЕНИЕ - ВЫРАЖЕНИЕ - вычитание
					ВЫРАЖЕНИЕ << ВЫРАЖЕНИЕ - сдвиг в лево
					ВЫРАЖЕНИЕ >> ВЫРАЖЕНИЕ - сдвиг в право
					ВЫРАЖЕНИЕ > ВЫРАЖЕНИЕ - "больше". Если левое выражение больше правого, результат 1, иначе 0.
										 Аналогично определяются выражения >, <=, >=, !=.
					ВЫРАЖЕНИЕ = ВЫРАЖЕНИЕ - если выражения равны, то итог 1, иначе 0.

/*todo...*/avinfo-1.0.a15+20090102/doc/whatsnew.rus.utf80000644000175000017500000003201411043626524016650 0ustar  stasstasv 1.0.0 alpha 15 [Balalayka]

	- бага с неправильной обработкой установки переменной в командной строке
	- багофича, из-за которой битые AVI (без индекса) не обрабатывались
	  thnx Berni for bugreport.
	+ для шаблона --html-list переменная, управляющая оформлением: htmlpart
	+ для шаблона --list переменная, управляющая тегом 
: listpre
	+ для шаблонов --list, --html-list переменные umsg, umsgh.
	+ поддержка MKV (Matroska)
	+ tN.cc - тип субтитров
	* незначительные изменения в темплейтах
	- memory leak in mp3parse

v 1.0.0 alpha 14

	+ новый темплейт для фанатов Excel (программы, не аниме :) --csv-list
	+ поддержка темплейтов из файла (-thf=..., -tbf=..., -tff=...)
	  (stdin в данных режимах не поддерживается и поддерживаться не будет)
	+ обработка табуляции. Как бы сказать понятнее. Вообщем, после того,
	  как строка сформированна, табуляция заменяется на пробелы в таком 
	  количестве, чтобы строка была в длину равна max_length.
	* благодаря предыдущему пункту чуток украсился --list
	+ новый "готовый" темплейт --far

v 1.0.0 alpha 13

	неудачное число - 13. У меня умер винт с исходниками, в которых уже была
	поддержка OGM, существенно поменяны темплейты и многие мелкие улучшения -_-
	Пришлось переделывать
	+ IFO (DVD) support (language)
	+ поддержка IFO  (*.ifo на DVD) - языки, субтитры на ДВД. (пока без каналов)
	+ ELSE оператор в A.S.S.
	* .bspadd changed to .vbr (from string to number)
	- выравнивание на границу слова (riff) (нужно для поддежки AVIUtl)
	+ снова сделал поддержку OGM. (И, заодно, ogg)
	* поменяны темплейты для уч╦та a#.lang и оператора ELSE 
	- пропускалось одно (последнее) описание в avi
	* ISFT в AVI теперь не обрабатывается.

v 1.0.0 alpha 12 

	* mp3.c плавно оказался частью mpeg.c, mp3.c более не существует.
	  обработка mp3 с ~50-60ms/file до 25-30ms/file (+50% speed up)
	+ опция -s (-sNumber, битовые флаги управления процессом сканирования)
	  (поддерживается модулями aviparse, )
	* теперь mpegparse работает с блоками по 4к, но при этом,
	  в случае необходимости, заглядывает в файл аж до 1Мб
	+ новый шаблон --raw (для использования в скриптах)
	+ опция -v для выставления переменных в интрепретаторе
	+ файлы с неизвестным типом не обрабатываются, но в списке указываются
	  (rm, asf, wmv, mkv, ogm)
	+ опция -e для исключения из сканирования файлов указанного типа.
	- потенциальные баги с повисанием на кривых файлах в mpegpase 
	  (баг с отрицательным размером элементов и сиком "назад").
	  Thnx to Christian Grothoff for bugreport and fix idea.
	+ опции -th, -tb, -tf для задания шаблона из командной строки 
	  (шапка/тело/хвост) соответственно.
	* окончательно переписан riff.c, теперь весь AVInfo стал byteorder 
	  independed.

v 1.0.0 alpha 11 [clean up]

    - теперь длительность MPEG-файлов считается более-менее правильно (хотя
      и есть некоторые проблемы с VBR).
    - размер сканируемой области в MPEG'е уменьшен до 64k.

v 1.0.0 alpha 10 [dash]

	* накручивание AI в ф-ции вырезания CRC
	* коренным образом поменялся синтаксис A.S.S.:
		+ несколько переменных в print через запятую.
		+ можно опускать '{}' если оператор один.
		- понятие plain text убрано как класс.
		+ новая команда EXIT
	+ параметр -ll:maxlength поменян на -m:maxlength
	+ maxlength=0 == infinity
	+ концепция header/footer для темплейтов
	- бага с применением maxlength по отношению ко ВСЕМ темплейтам
	+ в операции сравнения добавились маски '#' - любое число и $ - любая буква
	- побороты практически все (?) memory leaks, теперь потребляемая память
      ограничивается ~600-700k вне зависимости от размера сканируемого списка.
	+ опция -i=number - задержка после каждого сканирования (в мс)
	* теперь опции -m,-l можно указывать в виде -m445, -l- (опуская ':' или '=') 
	- если в списке после файла с расширением следовало имя без расширения,
      расширение переносилось на следующий файл.
	- мелкие багфиксы с добавлением (не-добавлением) CR/LF в конце строки.
	* теперь VOB-файлы с размером, меньшим 16Мб не выводятся в режимах 
      --list и --html-list
    + подсч╦т битрейта/длительности/fps/звука для MPEG1, MPEG2.
	+ переменные vN.aspectX, vN.aspectY для Aspect Ratio, добавлено в темплейты
	  (выводится только при условии, что vN.x/vN.y!=vN.aspectX/vN.aspectY)
	+ статистика в конце --list, --html-list
	 (минимальное разрешение, fps, bps, общее время)
	- ещ╦ один странный баг с инкременто-декрементом.

v 1.0.0 alpha 9

	- do not work in any way (too strong bugfix in a8)

v 1.0.0 alpha 8

	* чуть-чуть улучшена работа с переменными (ф-ция Op() в ass.y)
	* переписана процедура вывода переменных
	* более грамотно отображается время в timecompact режиме.
	- баг с не-удалением некоторых переменных
	+ автоматический контоль за НЕ выход за maxlist (топорно, но работает)
	+ фича с sn (short names) - из им╦н вырезается CRC, лишние подч╦ркивания,
	  несущественные значки. Подробнее в sn.txt
	- крупный memory leak при обработке "неавишных" файлов. 

v 1.0.0 alpha 7
	
	+ прикручена база кодеков (пока в тестовом режиме)
	* чуть более аккуратно обрабатываются строки (при строковых операциях
	  в их "числовую" часть заносится длина строки).
	- бага с пустыми строками ("").
	* tc теперь не показывает секунды, если длительность больше 10 мин.
	+ опция -l: поддерживает stdin. (try dir /s /b | avinfo -l:stdin --list)
	
v 1.0.0 alpha 6

	- бага со сложением строки и числа (отсюда бага с кривым --list)
	+ опция ком. строки -l:number (ширина консоли для --list режима)
	* более агрессивный tc режим, секунды отбрасываются при наличии минут.
	+ VBR mp3 detection (in "default", "html-list", "short" templates)
	* Теперь mp3 сканируется быстрее (первая 1000 фреймов), но, возможно,\
	  с ошибками определения длительности/битрейта на VBR файлах.
	- бага с потенциальным трапом на делении на ноль на кривых mp3
	- повисание на кривых mp3 (топорным методом, потом посмотрю в ч╦м дело)
	* Собирается без варнингов на FreeBSD (спасибо ArjLover'у за доступ к машине)
	* -l:size changed to -ll=size (line length=size)
	+ Added DeleteVar() function in var.c
	+ added an a -l:filename option (se below)
	+ поддержка сканирования нескольких файлов по списку.
	! В списке длинные имена с пробелами не должны быть в кавычках! (use dir /b)
	+ поддержка маски '?' и '*' при сравнении переменных (DOS LIKE, NOT UNIX!)

v 1.0.0 alpha 5

	- продолжается удавливание багов из-за смены архитектуры var.c\
	  (криво показывало/не показывало имена в некоторых случаях)
	- пофикшена ошибка знакового переполнения в сч╦тчике пофикшеных ошибок.
	+ темплейт --short (по просьбам трудящихся)
	* поправил документацию (русскую) по шаблоном, с уч╦том изменений в a4

v 1.0.0 alpha 4
	
	- мелкая бага с не-компиляцией на старых бизонах (ass.y line 66)
	+ опция -f (формат avinfo -f:ext filename i.e. avinfo -f:mp3 video.avi)
	* упрощ╦н (существенно!) код чтения ави, размер уменьшился почти в 3 раза.
	* -Wall --pedantic -ansi при компиляции не да╦т ни одного варнинга.
	+ добавлено 127 ошибок
	- пофикшено  -114 ошибок
	* битрейт теперь считается в тысячах бит/с (а не 1024/с)
	- бага с длительностью аудио-потока в avi
	- бага с трапом на некоторых хитрых заголовках avi. Попутно удавлены все \
	  потенциальные баги с делением в riff-модуле.
	- и ещ╦ одна бага с подсч╦том длительности (...и даже две)
	- забавная бага с выводом номера кодека в "кило-" 
	- перепутаны ширина и длина картинки в mpeg.c
	* почти полностью переписан var.c, теперь переменные обрабатываются \
	  одной ф-цией. Уменьшился размер var.o
	- убран (временно?) error.c - не до него сейчас
	+++ ПОДДЕРЖКА строковых переменных в темплейтах
	+ как следствие, вывод для вобов (VTS_01_0.VOB) полного пути к файлу \
	  вместо ничего не значащего имени.
	- бага с "удалением" уже удал╦нных переменных

v 1.0.0 alpha 3

	+ добавлена опция печати m1000 (использовать в качестве делителя не \
	  1024, а 1000)
	- баг с выводом килогерц в программерских кило- (х1024 :)
	- убрана (из планов) идея о struct-report. Неуклюже получается. \
	  Будет отдельная утилита.
	+ поддержка mp3, id3v1
	* Fine-tuning --list, мелкие багфиксы в остальных режимах
	+ linux/bsd(?) compability

v 1.0.0 a2

	* добавленно расширение файла в --list
	* количество каналов звука и кодек для видео теперь печатаются только 
	  если не соответствуют "нормальным" (2ch, XVID, DIVX, DX50, DIV3)
	* добавлены "предопредел╦нные переменные" XVID, DIVX, DX50, DIV3


near TODO:
	- пофиксить багу(и) с сложением числа и строки, переделать математику
	* доделать чтение mpeg.
	? id3v2 (suxx)

avinfo-1.0.a15+20090102/doc/faq.rus.utf80000644000175000017500000000641311044034405015553 0ustar  stasstasq: почему теперь в режиме --list печатается расширение? 
   Это же четыре лишних символа!
a: Раньше avinfo понимал только avi, и расширение было тавтологией. А теперь
   хотелось бы знать, что это - mpeg/avi/mp3/ogm/mkv/etc. 
   Для этого отлично подходит расширение.

q: А почему стандартные библиотеки не используются?
a: Стандартные библиотеки слишком громоздки и требуют C++. Я же предпочитаю
	оставаться в рамках ANSI C.

q: А какие доки ты использовал?
a: doc_urls.txt

q: Ты обещал быстрое чтение индексов avi.
a: Оказалось, что даже при чтении целой половины индекса (для мувика это около 
   полутора метров), битрейт начинает скакать в пределах 15-30 процентов. Штатно 
   такое недопустимо. Для любителей экстрима есть младшие два бита опции -s,
   ими можно управлять глубиной сканирования индекса.
   Значения битов:
   00 (0x0) - не сканировать индекс
   10 (0x1) - сканировать первые 128к. (точность порядка +- 20-40%)
   01 (0x2) - штатный режим
   11 (0x3) - эквивалентен штатному режиму.
   (подробнее про опцию -s - в документации)

q: А что это за странные кракозябры в дескрипшенах?
a1: бага (багрепорты: gs@shounen.ru)
a2: дескрипшн из другой локали, отличной от текущей.

q: Почему вместо русского (иногда) кракозябры?
a: Другая кодовая страница. Перекодирования внутри avinfo не будет. 
   Перекодируйте готовый отчёт, если надо.

q: С русскими именами файлов баги!!!!111
a: Проблемы cmd.exe. AVInfo вообще знать не знает, что за кодировки
   где-либо. Что на вход дали, то на выходе. Используйте iconv.

q: как отключить вывод шапки/хвоста (header/footer)
a: укажите в ком. строке: avinfo -th: -tf: [далее параметры как обычно]
   (другими словами, заменить шапку/хвост на пустую)
a2: можно ещё (в случае html-list), поиграться с -v:htmlpart=1, для
    отключения вывода заголовка html-файла.

q: А поприличнее отчёт для Excel (csv-list) можно?
a: Если excel начнёт "поприличнее" читать CSV, то да.
   Пока - извините. Поддержка xls будет не ранее появления
   нормальной официальной документации.

avinfo-1.0.a15+20090102/src/0000755000175000017500000000000011127442420013404 5ustar  stasstasavinfo-1.0.a15+20090102/src/codec.c0000644000175000017500000000336410232106111014621 0ustar  stasstas/*************************************************************************
 * codec.c codec names support [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/

#include "avinfo.h"

#ifdef CODEC_C_SIZE

typedef struct{
	FOURCC code;
	const char* name;
}codec_data;

const codec_data codecs[]={
	{85, "mp3"},
	{FOURCC_DIVX, "DivX"},
	{FOURCC_DIV3, "DivX3"},
	{FOURCC_XVID, "XviD"},
	{FOURCC_OGG, "Vorbis"},
	{FOURCC_DX50, "DivX5"},
	{FOURCC_MPG1, "MPEG1"},
	{FOURCC_MPG2, "MPEG2"}
};

const char* fcctoa (const FOURCC fcc){
/*convert from FourCC to ASCIIZ string
flag values:
0 - video
1 - audio
*/
	int c;
	static char buffer[5];
	for(c=0;c>8;
	buffer[2]=(fcc&0x00FF0000)>>16;
	buffer[3]=(fcc&0xFF000000)>>24;
	buffer[4]=0;
	return buffer;
}
#endif
avinfo-1.0.a15+20090102/src/codec.h0000644000175000017500000000321410232106111014620 0ustar  stasstas/*************************************************************************
 * codec.h header file for codec.c [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/
#ifndef _H_CODEC_H
#define _H_CODEC_H

#define CODEC_C_SIZE 1
/* use CODEC_C_SIZE to set a number of avaible (build-in) codecs name.
possible values:
(not defined) - do not use a codec detection
1 basic set of codec (DivX/XVID/vp6/mp3, etc)
2 MAX BASE SIZE (full content of http://fourcc.org/ codecs table)
*/

#ifndef CODEC_C_SIZE
	#define fcctoa(a) ""
#endif

#ifdef CODEC_C_SIZE
	extern const char* fcctoa (const FOURCC fcc);
#endif

#define FOURCC_MPG1 0x3147504D
#define FOURCC_MPG2 0x3247504D
#define FOURCC_AC3  0x20334341
#define FOURCC_DTS  0x20535444
#define FOURCC_LPCM	0x4C4D4350
#define FOURCC_OGG	0x2047474F
#endif
avinfo-1.0.a15+20090102/src/ass.h0000644000175000017500000000303210232106111014327 0ustar  stasstas/*************************************************************************
 * ass.h Script language defenition [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/

#ifndef _H_ASS_H
#define _H_ASS_H

enum{ MODE_NORMAL=0, MODE_EXPRESSION=1, MODE_VAR=2, MODE_COMMAND=3};
#include "avinfo.h"

int yyparse(void*);
var_t Op( var_t var1, var_t var2, int op_type );

typedef struct{
	char* line; /*pointer to line for parse*/
	int c;
	int flag; /* EoL or zero at the end*/ /*TODO!*/
	int active;
	int mode;
	linecache *l; /*handle for output*/
}lexerctl_t;
#define ACTIVE (((lexerctl_t*)lexer_ctl)->active)
#define MODE (((lexerctl_t*)lexer_ctl)->mode)
#define  BUFFER_SIZE 256
#endif
avinfo-1.0.a15+20090102/src/ifo.c0000644000175000017500000000741411043612311014326 0ustar  stasstas/*************************************************************************
 * ifo.c - DVD's *.ifo reading code [part of AVInfo 1.x]
 * * format information taked from http://dvd.sf.net/ (domou arigatou)
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/

 /* use a tabulation size 4 spaces for normal editig*/

 /*note: this is a test version, due lack of information about DVD*/

 #include "avinfo.h"

int ifoparse(FILE* file, int s){ /*supported only a vts_xx_0.ifo, video_ts.ifo is not needed for AVInfo*/
    unsigned char buffer[0x316];
	unsigned int video[MAX_STREAMS][VIDEO_INFO_SIZE];
	unsigned int audio[MAX_STREAMS][AUDIO_INFO_SIZE];
	const unsigned char VTS_SIGNATURE[12]="DVDVIDEO-VTS";
	const unsigned short int X_table[4][2]={ {720,720}, {704,704}, {352,352}, {352,352} };
	const unsigned short int Y_table[4][2]={ {480,576}, {480,576}, {480,576}, {240,288} };
	const unsigned int Codec_table[8]={ FOURCC_AC3, 0, FOURCC_MPG1, FOURCC_MPG2, FOURCC_LPCM, 0, FOURCC_DTS, 0};
	unsigned int type=0;
	unsigned int a_c=0;
	unsigned int s_c=0;
	unsigned int audio_streams=0;
	unsigned int subtitle_streams=0;
	char *lang;
	memset(video,0,sizeof(video));
	memset(audio,0,sizeof(audio));
	if(!fread(buffer,0x316,1,file)) return 0; /*if we can not read at least 790 bytes we can not recognize IFO file information*/
    if(memcmp(buffer,VTS_SIGNATURE,sizeof(VTS_SIGNATURE))) return 0; /*non VTS IFO or not the IFO*/
/*video (always 1 stream)*/    
    video[0][V_exist]=1;
	switch(buffer[0x200]&0xC){
		case 0:
			video[0][V_cc]=FOURCC_MPG1;
			break;
		case 0x40:
			video[0][V_cc]=FOURCC_MPG2;
			break;
	}
	type=(buffer[0x200]&0x10)>>4;
	SetStringVar("v1.type",type?"PAL":"NTSC");
	switch(buffer[0x200]&0xC){
		case 0: 
			video[0][V_aspectX]=4;
			video[0][V_aspectY]=3;
			break;
		case 0xC:
			video[0][V_aspectX]=16;
			video[0][V_aspectY]=9;
			break;	
	}
	if(buffer[0x201]&0x20) return 0; /*should not be a 1*/
	video[0][V_x]=X_table[(buffer[0x201]&0x18)>>3][type];
	video[0][V_y]=Y_table[(buffer[0x201]&0x18)>>3][type];


/*audio (max 8 streams)*/
	audio_streams=buffer[0x203];
	printf("as:%d\n",audio_streams);
	if(audio_streams>8) audio_streams=8;
	for(a_c=0;a_c>5];
		if(!(buffer[0x205+a_c*8]&0x30)) audio[a_c][A_freq]=48000;
		lang=malloc(3);
		audio[a_c][A_ch]=(buffer[0x20B+a_c*7]&0x70)>>4;
		lang[0]=buffer[0x206+a_c*8];
		lang[1]=buffer[0x207+a_c*8];
		lang[2]=0;
		SetIdxStringVar("a%d.lang",a_c+1,lang);
		/*todo chanels*/		
	}


/*subtitle (max 32 streams, but AVInfo supports only first 9) */
	subtitle_streams=buffer[0x254];
	if(subtitle_streams>9) subtitle_streams=9;
	SetNumericVar("stream.t",subtitle_streams);
	for(s_c=0;s_c
#include 
#include 
#include "avinfo.h"
#include "codec.h"
#include "var.h"
#include "common.h"

typedef long long int64; /*TODO!!!*/
extern int mkvparse(FILE* file, int s);

enum{
MKV_Track_video=1,
MKV_Track_audio=2,
MKV_Track_subtitle=3,
MKV_Track_subtitle_orig=0x11
};
enum{
MKVID_OutputSamplingFrequency=0x78B5,
MKVID_FILE_BEGIN=0x1A,
MKVID_EBML=0x1A45DFA3,
MKVID_Segment=0x18538067,
MKVID_Info=0x1549A966,
MKVID_Tracks=0x1654AE6B,
MKVID_TrackEntry=0xAE,
MKVID_TrackType=0x83,
MKVID_DefaultDuration=0x23E383,
MKVID_Language=0x22B59C,
MKVID_CodecID=0x86,
MKVID_CodecPrivate=0x63A2,
MKVID_PixelWidth=0xB0,
MKVID_PixelHeight=0xBA,
MKVID_TimeCodeScale=0x2AD7B1,
MKVID_Duration=0x4489,
MKVID_Channels=0x9F,
MKVID_BitDepth=0x6264,
MKVID_SamplingFrequency=0xB5,
MKVID_Title=0x7BA9,
MKVID_Tags=0x1254C367,
MKVID_SeekHead=0x114D9B74,
MKVID_Video=0xE0,
MKVID_Audio=0xE1,
MKVID_CodecName=0x258688,
MKVID_DisplayHeight=0x54BA,
MKVID_DisplayWidth=0x54B0
};

#endif
avinfo-1.0.a15+20090102/src/ogm.c0000644000175000017500000002357311043616704014351 0ustar  stasstas/*************************************************************************
 * ogm.c - OGG media reading code [part of AVInfo 1.x]
 * format information from 
 * http://xiph.org/ and http://tobias.everwicked.com/
 *
 * Copyright (c) 2004 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/

 /* use a tabulation size 4 spaces for normal editig*/
#include "ogm.h"

#define DEFAULT_PARSE_BLOCK 32768

#define CharsToInt32(table,offset)  (table[offset]+(table[offset+1]<<8)+(table[offset+2]<<16)+(table[offset+3]<<24))
#define CharsToInt64H(table,offset) (CharsToInt32(table,offset+4))
#define CharsToInt64L(table,offset) (CharsToInt32(table,offset))

#define EoS_FLAG 0x4

typedef struct{
	unsigned char* name;
	unsigned char* value;
}comment_t;

comment_t CommentSplit(unsigned char*CommentVector, int CommentSize){
    comment_t ret_val;
    int c;
    ret_val.name=NULL;
    ret_val.value=NULL;
	if(CommentSize>1){
		for(c=1;c=readed_bytes) break;
		baseD=base+0x1B+buffer[base+0x1A];
		curr_stream_num=CharsToInt32(buffer,base+0xE);
		if(curr_stream_num>63) curr_stream_num=60;
		switch(buffer[baseD]){
			case 1: /*header*/
			    if(page_data_size<8) break;
				for(c=0;c<4;c++) if (!memcmp(buffer+baseD+1,stream_signatures[c],8)) break; /*c: 0-video, 1 - vorbis, 2, - audio, 3 - text*/
				if(c>=4) break; /*unknown pack*/
				switch(c){ 
					case 0:/*video*/
						if(page_data_size<0x35) break; /*too small to be a video header*/
						streams[curr_stream_num].type='v';
						streams[curr_stream_num].num=v_c;
						video[v_c][V_exist]=1;
						video[v_c][V_cc]=CharsToInt32(buffer,baseD+0x9);
						video[v_c][V_fpsH]=10000000/CharsToInt32(buffer,baseD+0x11);
						video[v_c][V_fpsL]=1000000000/CharsToInt32(buffer,baseD+0x11)-video[v_c][V_fpsH]*100;
						video[v_c][V_bits]=CharsToInt32(buffer,baseD+0x29);
						video[v_c][V_x]=CharsToInt32(buffer,baseD+0x2D);
						video[v_c][V_y]=CharsToInt32(buffer,baseD+0x31);
						v_c++;
						break;
					case 1:/*vorbis*/
					    if(page_data_size<0x18) break; /*too small to be a vorbis header*/
						streams[curr_stream_num].type='a';
						streams[curr_stream_num].num=a_c;
						audio[a_c][A_exist]=1;
						audio[a_c][A_ch]=(unsigned int)buffer[baseD+0xB];
						audio[a_c][A_freq]=CharsToInt32(buffer,baseD+0xC);
						audio[a_c][A_bps]=CharsToInt32(buffer,baseD+0x14);
						if((signed int)audio[a_c][A_bps]<0) audio[a_c][A_bps]=0; /*to prevent bps=-1*/
						audio[a_c][A_cc]=CharsToInt32("OGG ",0);
						a_c++;
						break;
					case 2:/*audio*/
						/*not supported -TODO in next version*/
						break;
					case 3:/*text*/
						streams[curr_stream_num].type='t';
						streams[curr_stream_num].num=t_c;
						t_c++;
						break;
				}
				break;
			case 3: /*comment header*/
			    if (page_data_size<6) break; /*too small for any puporses*/
				if(memcmp(baseD+buffer+1,"vorbis",6)) break; /*non vorbis comments not supported*/
				comment_base=baseD+CharsToInt32(buffer,baseD+0x7)+11;/*skip vendor record*/
				if(comment_base+4>readed_bytes) break; /*oops*/
				comm_num=CharsToInt32(buffer,comment_base);
				if(!comm_num) break; /*if no real comments - skip*/
				comment_base+=4;/*move to real comments begin*/
				comment_offset=0;
				for(c=0;creaded_bytes) break;
					comment=CommentSplit(buffer+comment_base+comment_offset+4,comment_size);
					comment_offset+=4+comment_size;
					if(!strcmp((char*)comment.name,"LANGUAGE")){ /*process a LANGUAGE comment, make a long name short (e.g. JAPANESE -> jap)*/
						if(strlen((char*)comment.value)>3){
							comment.value[3]=0;
							lowcase(comment.value);
							sprintf((char*)tempbuff,"%c%d.lang",streams[curr_stream_num].type,streams[curr_stream_num].num+1);
							SetStringVar((char*)tempbuff,(char*)comment.value);
							continue;
						}
					}
					if(strlen((char*)comment.name)>=7){/*ignore stupid descriptions from ogm navigation*/
					   	if(!memcmp(comment.name,"CHAPTER",7)) continue;
					   	if(!memcmp(comment.name,"LWING_GAIN",10)) continue;
					}
					d_c++;
					SetIdxStringVar("d1%d.name",d_c,(char*)comment.name);
					SetIdxStringVar("d1%d.value",d_c,(char*)comment.value);
				}
       			break;
		}
		base+=page_data_size+0x1B+buffer[base+0x1A];
	}
	if(!a_c&&!v_c&&!t_c) {FREE(buffer);return 0;} /*if nothing found - not count*/


	/*tail scan (for stream (a/v) length calculation)*/
	fseek(file,-DEFAULT_PARSE_BLOCK*3,SEEK_END); /*go to file end, get last 32k*3 block */
	readed_bytes=fread(buffer,1,DEFAULT_PARSE_BLOCK*3,file);
	if(readed_bytes<0x1B) goto skip;
	base=0;
	while( cont && base+0x1Breaded_bytes) break;
		curr_stream_num=CharsToInt32(buffer,base+0xE);
		if(curr_stream_num>63) curr_stream_num=60;
		absolute_granue_position=CharsToInt32(buffer,base+0x6);
		if(buffer[base+0x5]&EoS_FLAG){ /*if current page is the LAST page in stream, a_g_p contain common number of frames/samples for stream*/
			switch(streams[curr_stream_num].type){
				case 'a':
					if(audio[streams[curr_stream_num].num][A_freq])audio[streams[curr_stream_num].num][A_l]=absolute_granue_position/audio[streams[curr_stream_num].num][A_freq];
					break;
				case 'v':
					if(video[streams[curr_stream_num].num][V_fpsH])video[streams[curr_stream_num].num][V_l]=absolute_granue_position*100/(video[streams[curr_stream_num].num][V_fpsH]*100+video[streams[curr_stream_num].num][V_fpsL]);
					break;
			}
		}
		base+=page_data_size+0x1B+buffer[base+0x1A];
	}


			/*experimental segment: try to fast calculate a video bitrate:
				video_bps=(filesize-summ(audio_bitrate[stream_num]*audio_length[stream_num])/video_length
				works only if single video stream and defined avg.bitrates for all audio streams.
			*/
			if(v_c>1||!video[0][V_l]) goto skip;
			for(c=0;cname, var_name ) ){
			FREE(current->content.string);
			current->content.type = value.type;
			current->content.number = value.number;
			if(value.type==t_STRING)
				current->content.string = value.string;
			else
				current->content.string = dup("");
			return 0; /*ok*/
		}
		prev=current;
		current = current->Next;
	}
	/*not found - create new*/
	current = (var_item_t*)malloc( sizeof( var_item_t ) );
	if( current == NULL ) return -1; /*no memory.*/
	current->Next           =  NULL;
	current->content.type	=  value.type;
	current->content.number =  value.number;
	if(value.type==t_STRING)
		current->content.string = dup(value.string);
	else
		current->content.string = dup("");
	current->name			=  dup( var_name );
	if(prev) prev->Next =  current;
		else Var_root=current;
	return 0; /*ok*/

}


#define FreeVar(a) {free(a.string);}

var_t GetROVar(const char* var_name);

var_t GetVar( char* var_name ){

	var_item_t *current	=	Var_root;
	var_t ret_val={0,NULL,0};

	while( current ){
		if( !STRCMP( current->name, var_name ) ) {
			ret_val.type=current->content.type;
			ret_val.number=current->content.number;
			ret_val.string=dup(current->content.string);
		}
		current = current->Next;
	}
	if(!ret_val.string) ret_val.string=dup("");
	return ret_val;
}

var_t GetROVar(const char* var_name){
	var_item_t *current	=	Var_root;

	while( current ){
		if( !STRCMP( current->name, var_name ) ) {
			return current->content;
		}
		current = current->Next;
	}
	return FAKE_VAR;/*not found.*/

}

int DelVar(const char* name){
	var_item_t *current = Var_root;
	var_item_t *prev=NULL;
	while(current){
		if(!STRCMP(current->name,name)){
			FREE(current->content.string);
			FREE(current->name);
			if(prev) prev->Next=current->Next;
				else Var_root=current->Next;
			FREE(current);
			current=prev->Next;
		}
		else {
			prev=current;
			current=current->Next;
		}
	}
	return 0;
}

int SetNumericVar( char* var_name, int value ){

	var_t var;

	var.type	=	t_NUMBER;
	var.number	=	value;

	return SetVar( var_name, var );

}

int SetStringVar( char* var_name, char* value ){

	var_t var;

	var.type	=	t_STRING;
	var.string	=	value;
	var.number	=	strlen(value); /*easy way to check: #if stringvar { foobar }*/
	return SetVar( var_name, var );

}



int SetIdxVar( char* name,  int class_number, var_t value ){

	char* temp	=	malloc( strlen( name ) + 10 );
	int q;
	sprintf( temp, name, class_number );
	q=SetVar( temp, value );
	FREE(temp);
	return q;
}

int SetIdxNumericVar( char* name, int class_number, int value ){

	var_t var;

	var.type	=	t_NUMBER;
	var.number	=	value;

	return SetIdxVar( name, class_number, var );

}

int SetIdxStringVar( char* name,  int class_number,  char* value ){

	var_t var;

	var.type	=	t_STRING;
	var.string	=	value;
	var.number 	= 	strlen(value);
	return SetIdxVar( name, class_number, var );

}


int GetNumericVar( char* var_name ){

	var_t var	=	GetROVar(var_name);
	return var.number;

}

int GetIdxNumericVar( char* name, int class_number ){

	char* temp	=	malloc( strlen( name ) + 10 );
	int q;
	sprintf( temp, name, class_number );
	q=GetNumericVar( temp );
	FREE(temp);
	return q;

}

char* GetStringVar( char* var_name ){

	var_t var	=	GetROVar( var_name );
	return ( dup(var.string) );

}

 char* GetROStringVar( char* var_name ){
	var_t var	=	GetROVar( var_name );
	return ( var.string );
}

int IncStreamCounter( int T ){

	char str_num[]	=	"stream.?";

	str_num[7]		=	T;
	IncNumVar( str_num );
	return 0;

}

void PrintVarList(){
	var_item_t* current=Var_root;
	int c=0;
	while(current){
		printf("#%d, \"%s\", %d,%d, ~%p~\n",c++,current->name,current->content.type,current->content.number,current->content.string);
		current=current->Next;
	}
}

/*var_item_t* MakeSnap(){
	var_item_t* current=Var_root;
	if(!current) return NULL;
	while(current->Next) current=current->Next;
	return current;
}*/

const char *vids_names[VIDEO_INFO_SIZE]={
	"v!.l",
	"v!.x",
	"v!.y",
	"v!.bits",
	"v!.cc",
	"v!.fpsH",
	"v!.fpsL",
	"v!.bps",
	"v!.bspadd",
	"v!.aspectX",
	"v!.aspectY"
};
const char *auds_names[AUDIO_INFO_SIZE]={
	"a!.l",
	"a!.bits",
	"a!.cc",
	"a!.bps",
	"a!.bspadd",
	"a!.ch",
	"a!.freq"
};

void AddAudioVideo(unsigned int video[MAX_STREAMS][VIDEO_INFO_SIZE], unsigned int audio[MAX_STREAMS][AUDIO_INFO_SIZE]){
	unsigned int c;
	unsigned int c2;
	unsigned int a_c=0;
	unsigned int v_c=0;
	char buffer[16];
	for(c=0;c
#include 
#include 
#include 
#include "var.h"
#include "common.h"
#include "print.h"
#include "config.h"
#include "wintypes.h"
#include "riff.h"
#include "mpeg.h"
#include "text.h"
#include "ifo.h"
#include "ogm.h"
#include "mkv.h"
#include "codec.h"
#include "ass.h"
/*#include "cache.h"*/

/*#define CASE_SENSETIVE*/
/*Use define CASE_SENSETIVE to set a case sensetive text parsing. if CASE_SENSETIVE not defined var names and keywords will be case unsensetive.*/

#ifdef CASE_SENSITIVE
	#define STRCMP strcmp
#endif

#ifndef CASE_SENSITIVE
	#define STRCMP STRICMP
#endif


#ifndef MAX_PATH 
	#define MAX_PATH 32767
#endif



typedef int (*modulefunc) (FILE* file, int flags ); 


typedef struct{
	char* mask; /*mask of supported files*/
	int ver;
	modulefunc func;
}module_t;

extern const module_t modules[];

#define FREE(a){free(a);a=NULL;}
/*safe ver. of free();*/

#endif
avinfo-1.0.a15+20090102/src/wintypes.h0000644000175000017500000000030610232106111015424 0ustar  stasstas/* no copyrights :-P*/
#ifndef _H_WINTYPES_H
#define _H_WINTYPES_H

typedef 	unsigned int 		DWORD;
typedef 	DWORD 				FOURCC;
typedef 	unsigned short int 	WORD;
typedef 	signed int 			LONG;

#endif
avinfo-1.0.a15+20090102/src/common.c0000644000175000017500000000565110232106420015040 0ustar  stasstas/*************************************************************************
 * common.c Implementation of some common-using function [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/
#include "avinfo.h"
#include 
#include 

int CHARS_PRINT=0;
int MAX_CHARS;

char *ITOA(int value, char *string,int radix){
	if(radix==16)
		sprintf(string,"%x",value);
	else
		sprintf(string,"%d",value);
	return string;
}


#define CI_CMP(a,b)\
	(!\
		(\
			(\
				(a <= 'Z' && a >= 'A' )? \
					a - 'A' + 'a' \
					:\
					a\
			)\
			-\
			(\
				(b <= 'Z' && b >= 'A' )?\
					b - 'A' + 'a'\
					:\
					b\
			)\
		)\
	)

int STRICMP(const char* line1, const char* line2){
/*char '?' used as a "ANY CHAR" substitution, 
'*' == any string to end (LIKE DOS, NOT LIKE UNIX!)*/
	const char* p1=line1,*p2=line2;
	while(
			CI_CMP(*p1,*p2)
			||
			*p1=='?'
			||
			*p2=='?'
			||
			*p2=='*'
			||
			*p1=='*'
			||
			(isdigit(*p1)&&*p2=='#')
			||
			(isdigit(*p2)&&*p1=='#')
			||
			(isalpha(*p1)&&*p2=='$')
			||
			(isalpha(*p2)&&*p1=='$')
		){
		if(!*p1||!*p2||*p1=='*'||*p2=='*') return 0; /*no difference*/
		p1++;
		p2++;
	}
	return *p1-*p2;
}


char* dup( const char* string){
/*Some like strdup - Create copy of string. Traps if line==NULL*/
	int   i    = strlen( string ) + 1;
	char* temp = (char*)malloc( i );

	if( temp != NULL ) memcpy( temp, string, i );
	return temp;

}

int advmemcmp(const unsigned char* base, const unsigned char* pattern, const int number){
/*some like memcmp, but using 0 in pattern as a mask "anybyte"*/
	int c;
	for(c=0;c='A'&&*temp<='Z') *temp=*temp+'a'-'A';
		temp++;
	}
}


void fill(char* line, int c, char pattern){
	int q;
	for(q=0;q

const char* print_mode(const var_t var, const int mode);
char* dup( const char* line );
char* min_view (const int number);
int STRICMP(const char* line1,const char* line2);
char *ITOA(int value, char *string,int radix);
int advmemcmp(const unsigned char* base, const unsigned char* pattern, const int number);
void lowcase(unsigned char* line);
enum{
	PRINT_MODE_NORMAL=0,
	PRINT_MODE_M1000=1,
	PRINT_MODE_M1024=2,
	PRINT_MODE_HEX=3,
	PRINT_MODE_FCC=4,
	PRINT_MODE_COMPACT_TIME=5,
	PRINT_MODE_TIME=6,
	PRINT_MODE_CODEC_NAME=7,
	PRINT_MODE_SHORT_NAME=8
};

void fill(char* line, int c, char pattern);
extern int MAX_CHARS;
extern int CHARS_PRINT;
extern char* mkstr (unsigned char* buffer, int pos, int size);
#endif
avinfo-1.0.a15+20090102/src/config.h0000644000175000017500000000235610232106111015016 0ustar  stasstas/*************************************************************************
 * common.h header file for common.c [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/
#ifndef _H_CONFIG_H
#define _H_CONFIG_H

typedef struct config_s{
	char* force_ext;
	char* template;
}config_t;

extern config_t config;
int SetConfig(int argc, char* argv[]);
int NamePrepare(const char*);
#endif
avinfo-1.0.a15+20090102/src/mpeg.h0000644000175000017500000000234510232106111014477 0ustar  stasstas/*************************************************************************
 * mpeg.h header file for mpeg.c [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/
#ifndef _H_MPEG_H
#define _H_MPEG_H
extern int GetMP3FrameData(int scan,int *bitrate, int *freq, int *ch);
extern int mpegparse ( FILE* file, int flags );
extern int mp3parse( FILE* file, int flags );
#endif
avinfo-1.0.a15+20090102/src/nobison/0000755000175000017500000000000010232106111015041 5ustar  stasstasavinfo-1.0.a15+20090102/src/nobison/ass.tab.c0000644000175000017500000017340711043625723016574 0ustar  stasstas/* A Bison parser, made by GNU Bison 2.3.  */

/* Skeleton implementation 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 2, 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., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.  */

/* 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.  */

/* C LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output.  */
#define YYBISON 1

/* Bison version.  */
#define YYBISON_VERSION "2.3"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 1

/* Using locations.  */
#define YYLSP_NEEDED 0



/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     E_ATOM = 258,
     WHILE = 259,
     DO = 260,
     IF = 261,
     SET = 262,
     ELSE = 263,
     VAR_PART = 264,
     PRINT = 265,
     EXIT = 266,
     AND = 267,
     OR = 268,
     NE = 269,
     LE = 270,
     GE = 271,
     SHIFT_RIGHT = 272,
     SHIFT_LEFT = 273,
     MM = 274,
     PP = 275
   };
#endif
/* Tokens.  */
#define E_ATOM 258
#define WHILE 259
#define DO 260
#define IF 261
#define SET 262
#define ELSE 263
#define VAR_PART 264
#define PRINT 265
#define EXIT 266
#define AND 267
#define OR 268
#define NE 269
#define LE 270
#define GE 271
#define SHIFT_RIGHT 272
#define SHIFT_LEFT 273
#define MM 274
#define PP 275




/* Copy the first part of user declarations.  */
#line 22 "ass.y"


#include "avinfo.h"
#include "ass.h"
#include "ass.tab.h"

#define 		YYLEX_PARAM 	lexer_ctl
#define 		YYPARSE_PARAM 	lexer_ctl
#define 		line 			(((lexerctl_t*)lexer_ctl)->line)
#define 		pos 			(((lexerctl_t*)lexer_ctl)->c)

int yyerror( const char *s );
int yylex (YYSTYPE *lval, void* lexer_ctl);



/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

/* Enabling the token table.  */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif

#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 41 "ass.y"
{
	int 	letter;
	var_t 	var;
	int 	mode;
	struct{
		int position;
		int flag;
	} state;
	char* 	var_name;
}
/* Line 187 of yacc.c.  */
#line 163 "ass.tab.c"
	YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif



/* Copy the second part of user declarations.  */


/* Line 216 of yacc.c.  */
#line 176 "ass.tab.c"

#ifdef short
# undef short
#endif

#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif

#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif

#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif

#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
#  include  /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned int
# endif
#endif

#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)

#ifndef YY_
# if YYENABLE_NLS
#  if ENABLE_NLS
#   include  /* INFRINGES ON USER NAME SPACE */
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#endif

/* Identity function, used to suppress warnings about constant conditions.  */
#ifndef lint
# define YYID(n) (n)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static int
YYID (int i)
#else
static int
YYID (i)
    int i;
#endif
{
  return i;
}
#endif

#if ! defined yyoverflow || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include  /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include  /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
#     include  /* INFRINGES ON USER NAME SPACE */
#     ifndef _STDLIB_H
#      define _STDLIB_H 1
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined _STDLIB_H \
       && ! ((defined YYMALLOC || defined malloc) \
	     && (defined YYFREE || defined free)))
#   include  /* INFRINGES ON USER NAME SPACE */
#   ifndef _STDLIB_H
#    define _STDLIB_H 1
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */


#if (! defined yyoverflow \
     && (! defined __cplusplus \
	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yytype_int16 yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)		\
      do					\
	{					\
	  YYSIZE_T yyi;				\
	  for (yyi = 0; yyi < (Count); yyi++)	\
	    (To)[yyi] = (From)[yyi];		\
	}					\
      while (YYID (0))
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack)					\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack, Stack, yysize);				\
	Stack = &yyptr->Stack;						\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (YYID (0))

#endif

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  3
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   312

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  42
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  23
/* YYNRULES -- Number of rules.  */
#define YYNRULES  60
/* YYNRULES -- Number of states.  */
#define YYNSTATES  111

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   275

#define YYTRANSLATE(YYX)						\
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const yytype_uint8 yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,    33,     2,     2,     2,    32,    13,     2,
      34,    35,    30,    26,    38,    27,     2,    31,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,    39,    36,
      21,    18,    20,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,    40,     2,    41,    14,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     4,    15,    37,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     5,
       6,     7,     8,     9,    10,    11,    12,    16,    17,    19,
      22,    23,    24,    25,    28,    29
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const yytype_uint8 yyprhs[] =
{
       0,     0,     3,     4,     5,     8,    10,    13,    14,    21,
      23,    26,    28,    29,    34,    38,    41,    43,    47,    49,
      53,    54,    55,    56,    66,    67,    68,    72,    73,    74,
      83,    84,    85,    93,    95,    98,   103,   105,   107,   110,
     113,   116,   119,   122,   126,   129,   133,   137,   141,   145,
     149,   153,   157,   161,   165,   169,   173,   177,   181,   185,
     189
};

/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
static const yytype_int8 yyrhs[] =
{
      43,     0,    -1,    -1,    -1,    44,    45,    -1,    46,    -1,
      45,    46,    -1,    -1,     8,    47,    63,    18,    64,    36,
      -1,    51,    -1,    57,    36,    -1,    60,    -1,    -1,    11,
      48,    49,    36,    -1,     4,    45,    37,    -1,    12,    36,
      -1,    50,    -1,    49,    38,    50,    -1,    64,    -1,    64,
      39,    64,    -1,    -1,    -1,    -1,     7,    52,    34,    64,
      35,    53,    46,    54,    55,    -1,    -1,    -1,     9,    56,
      46,    -1,    -1,    -1,     6,    58,    46,     5,    59,    34,
      64,    35,    -1,    -1,    -1,     5,    61,    34,    64,    35,
      62,    46,    -1,    10,    -1,    63,    10,    -1,    63,    40,
      64,    41,    -1,     3,    -1,    63,    -1,    29,    63,    -1,
      63,    29,    -1,    28,    63,    -1,    63,    28,    -1,    27,
      64,    -1,    34,    64,    35,    -1,    33,    64,    -1,    64,
      30,    64,    -1,    64,    31,    64,    -1,    64,    26,    64,
      -1,    64,    27,    64,    -1,    64,    19,    64,    -1,    64,
      18,    64,    -1,    64,    13,    64,    -1,    64,    16,    64,
      -1,    64,    15,    64,    -1,    64,    17,    64,    -1,    64,
      21,    64,    -1,    64,    20,    64,    -1,    64,    23,    64,
      -1,    64,    22,    64,    -1,    64,    25,    64,    -1,    64,
      24,    64,    -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const yytype_uint8 yyrline[] =
{
       0,    77,    77,    77,    77,    80,    82,    85,    85,    92,
      94,    96,    98,    98,   100,   102,   105,   107,   109,   114,
     124,   125,   126,   124,   128,   130,   130,   134,   135,   134,
     139,   141,   139,   147,   149,   151,   154,   155,   159,   165,
     173,   179,   186,   187,   188,   189,   190,   191,   192,   193,
     194,   195,   196,   197,   198,   199,   200,   201,   202,   203,
     204
};
#endif

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "E_ATOM", "'{'", "WHILE", "DO", "IF",
  "SET", "ELSE", "VAR_PART", "PRINT", "EXIT", "'&'", "'^'", "'|'", "AND",
  "OR", "'='", "NE", "'>'", "'<'", "LE", "GE", "SHIFT_RIGHT", "SHIFT_LEFT",
  "'+'", "'-'", "MM", "PP", "'*'", "'/'", "'%'", "'!'", "'('", "')'",
  "';'", "'}'", "','", "':'", "'['", "']'", "$accept", "begin", "@1",
  "all", "oper", "@2", "@3", "print_string", "print_var", "if", "@4", "@5",
  "@6", "else_part", "@7", "do", "@8", "@9", "while", "@10", "@11", "var",
  "exp", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const yytype_uint16 yytoknum[] =
{
       0,   256,   257,   258,   123,   259,   260,   261,   262,   263,
     264,   265,   266,    38,    94,   124,   267,   268,    61,   269,
      62,    60,   270,   271,   272,   273,    43,    45,   274,   275,
      42,    47,    37,    33,    40,    41,    59,   125,    44,    58,
      91,    93
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const yytype_uint8 yyr1[] =
{
       0,    42,    43,    44,    43,    45,    45,    47,    46,    46,
      46,    46,    48,    46,    46,    46,    49,    49,    50,    50,
      52,    53,    54,    51,    55,    56,    55,    58,    59,    57,
      61,    62,    60,    63,    63,    63,    64,    64,    64,    64,
      64,    64,    64,    64,    64,    64,    64,    64,    64,    64,
      64,    64,    64,    64,    64,    64,    64,    64,    64,    64,
      64
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const yytype_uint8 yyr2[] =
{
       0,     2,     0,     0,     2,     1,     2,     0,     6,     1,
       2,     1,     0,     4,     3,     2,     1,     3,     1,     3,
       0,     0,     0,     9,     0,     0,     3,     0,     0,     8,
       0,     0,     7,     1,     2,     4,     1,     1,     2,     2,
       2,     2,     2,     3,     2,     3,     3,     3,     3,     3,
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
       3
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const yytype_uint8 yydefact[] =
{
       3,     0,     0,     1,     0,    30,    27,    20,     7,    12,
       0,     4,     5,     9,     0,    11,     0,     0,     0,     0,
       0,     0,    15,     6,    10,    14,     0,     0,     0,    33,
       0,    36,     0,     0,     0,     0,     0,     0,    16,    37,
      18,     0,    28,     0,    34,     0,     0,    42,    40,    38,
      44,     0,    13,     0,    41,    39,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    31,     0,    21,     0,     0,    43,    17,
      51,    53,    52,    54,    50,    49,    56,    55,    58,    57,
      60,    59,    47,    48,    45,    46,    19,     0,     0,     0,
       8,    35,    32,     0,    22,    29,    24,    25,    23,     0,
      26
};

/* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int8 yydefgoto[] =
{
      -1,     1,     2,    11,    12,    20,    21,    37,    38,    13,
      19,    99,   106,   108,   109,    14,    18,    74,    15,    17,
      97,    39,    40
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -27
static const yytype_int16 yypact[] =
{
       3,     6,    55,   -27,    55,   -27,   -27,   -27,   -27,   -27,
     -26,    55,   -27,   -27,    18,   -27,    12,    -5,    55,    30,
      60,    48,   -27,   -27,   -27,   -27,    48,    66,    48,   -27,
      -9,   -27,    48,    60,    60,    48,    48,    -8,   -27,    40,
     111,   158,   -27,   179,   -27,    48,    48,   -16,    15,    15,
     -27,   200,   -27,    48,   -27,   -27,    48,    48,    48,    48,
      48,    48,    48,    48,    48,    48,    48,    48,    48,    48,
      48,    48,    48,   -27,    31,   -27,   136,    84,   -27,   -27,
     256,   256,   256,   256,   269,   281,    65,    65,    65,    65,
      26,    26,   -16,   -16,   -27,   -27,   242,    55,    48,    55,
     -27,   -27,   -27,   221,   -27,   -27,    63,   -27,   -27,    55,
     -27
};

/* YYPGOTO[NTERM-NUM].  */
static const yytype_int8 yypgoto[] =
{
     -27,   -27,   -27,    69,   -11,   -27,   -27,   -27,    25,   -27,
     -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,   -27,
     -27,    -7,   -24
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -3
static const yytype_int8 yytable[] =
{
      23,    44,    41,    -2,    43,    23,     3,    27,    47,    45,
      22,    50,    51,    30,    70,    71,     4,     5,     6,     7,
       8,    76,    77,     9,    10,    44,    48,    49,    52,    26,
      53,    46,    80,    81,    82,    83,    84,    85,    86,    87,
      88,    89,    90,    91,    92,    93,    94,    95,    96,    25,
      44,    31,    68,    69,    24,    46,    70,    71,    29,     4,
       5,     6,     7,     8,    28,    98,     9,    10,    54,    55,
      29,    42,   107,    16,   103,    32,    33,    34,    79,     0,
      46,    35,    36,     0,     0,     0,   102,     0,   104,    66,
      67,    68,    69,     0,     0,    70,    71,    56,   110,    57,
      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
      68,    69,     0,     0,    70,    71,     0,     0,     0,     0,
       0,     0,     0,     0,    56,   101,    57,    58,    59,    60,
      61,    62,    63,    64,    65,    66,    67,    68,    69,     0,
       0,    70,    71,     0,     0,     0,     0,     0,     0,    56,
      72,    57,    58,    59,    60,    61,    62,    63,    64,    65,
      66,    67,    68,    69,     0,     0,    70,    71,     0,     0,
       0,    56,   100,    57,    58,    59,    60,    61,    62,    63,
      64,    65,    66,    67,    68,    69,     0,     0,    70,    71,
       0,     0,    56,    73,    57,    58,    59,    60,    61,    62,
      63,    64,    65,    66,    67,    68,    69,     0,     0,    70,
      71,     0,     0,    56,    75,    57,    58,    59,    60,    61,
      62,    63,    64,    65,    66,    67,    68,    69,     0,     0,
      70,    71,     0,     0,    56,    78,    57,    58,    59,    60,
      61,    62,    63,    64,    65,    66,    67,    68,    69,     0,
       0,    70,    71,     0,     0,    56,   105,    57,    58,    59,
      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
       0,     0,    70,    71,    60,    61,    62,    63,    64,    65,
      66,    67,    68,    69,     0,     0,    70,    71,    61,    62,
      63,    64,    65,    66,    67,    68,    69,     0,     0,    70,
      71,    62,    63,    64,    65,    66,    67,    68,    69,     0,
       0,    70,    71
};

static const yytype_int8 yycheck[] =
{
      11,    10,    26,     0,    28,    16,     0,    18,    32,    18,
      36,    35,    36,    20,    30,    31,     4,     5,     6,     7,
       8,    45,    46,    11,    12,    10,    33,    34,    36,    34,
      38,    40,    56,    57,    58,    59,    60,    61,    62,    63,
      64,    65,    66,    67,    68,    69,    70,    71,    72,    37,
      10,     3,    26,    27,    36,    40,    30,    31,    10,     4,
       5,     6,     7,     8,    34,    34,    11,    12,    28,    29,
      10,     5,     9,     4,    98,    27,    28,    29,    53,    -1,
      40,    33,    34,    -1,    -1,    -1,    97,    -1,    99,    24,
      25,    26,    27,    -1,    -1,    30,    31,    13,   109,    15,
      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
      26,    27,    -1,    -1,    30,    31,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    13,    41,    15,    16,    17,    18,
      19,    20,    21,    22,    23,    24,    25,    26,    27,    -1,
      -1,    30,    31,    -1,    -1,    -1,    -1,    -1,    -1,    13,
      39,    15,    16,    17,    18,    19,    20,    21,    22,    23,
      24,    25,    26,    27,    -1,    -1,    30,    31,    -1,    -1,
      -1,    13,    36,    15,    16,    17,    18,    19,    20,    21,
      22,    23,    24,    25,    26,    27,    -1,    -1,    30,    31,
      -1,    -1,    13,    35,    15,    16,    17,    18,    19,    20,
      21,    22,    23,    24,    25,    26,    27,    -1,    -1,    30,
      31,    -1,    -1,    13,    35,    15,    16,    17,    18,    19,
      20,    21,    22,    23,    24,    25,    26,    27,    -1,    -1,
      30,    31,    -1,    -1,    13,    35,    15,    16,    17,    18,
      19,    20,    21,    22,    23,    24,    25,    26,    27,    -1,
      -1,    30,    31,    -1,    -1,    13,    35,    15,    16,    17,
      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
      -1,    -1,    30,    31,    18,    19,    20,    21,    22,    23,
      24,    25,    26,    27,    -1,    -1,    30,    31,    19,    20,
      21,    22,    23,    24,    25,    26,    27,    -1,    -1,    30,
      31,    20,    21,    22,    23,    24,    25,    26,    27,    -1,
      -1,    30,    31
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,    43,    44,     0,     4,     5,     6,     7,     8,    11,
      12,    45,    46,    51,    57,    60,    45,    61,    58,    52,
      47,    48,    36,    46,    36,    37,    34,    46,    34,    10,
      63,     3,    27,    28,    29,    33,    34,    49,    50,    63,
      64,    64,     5,    64,    10,    18,    40,    64,    63,    63,
      64,    64,    36,    38,    28,    29,    13,    15,    16,    17,
      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
      30,    31,    39,    35,    59,    35,    64,    64,    35,    50,
      64,    64,    64,    64,    64,    64,    64,    64,    64,    64,
      64,    64,    64,    64,    64,    64,    64,    62,    34,    53,
      36,    41,    46,    64,    46,    35,    54,     9,    55,    56,
      46
};

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		(-2)
#define YYEOF		0

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab


/* Like YYERROR except do call yyerror.  This remains here temporarily
   to ease the transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */

#define YYFAIL		goto yyerrlab

#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)					\
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    {								\
      yychar = (Token);						\
      yylval = (Value);						\
      yytoken = YYTRANSLATE (yychar);				\
      YYPOPSTACK (1);						\
      goto yybackup;						\
    }								\
  else								\
    {								\
      yyerror (YY_("syntax error: cannot back up")); \
      YYERROR;							\
    }								\
while (YYID (0))


#define YYTERROR	1
#define YYERRCODE	256


/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)				\
    do									\
      if (YYID (N))                                                    \
	{								\
	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
	}								\
      else								\
	{								\
	  (Current).first_line   = (Current).last_line   =		\
	    YYRHSLOC (Rhs, 0).last_line;				\
	  (Current).first_column = (Current).last_column =		\
	    YYRHSLOC (Rhs, 0).last_column;				\
	}								\
    while (YYID (0))
#endif


/* YY_LOCATION_PRINT -- Print the location on the stream.
   This macro was not mandated originally: define only if we know
   we won't break user code: when these are the locations we know.  */

#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
#  define YY_LOCATION_PRINT(File, Loc)			\
     fprintf (File, "%d.%d-%d.%d",			\
	      (Loc).first_line, (Loc).first_column,	\
	      (Loc).last_line,  (Loc).last_column)
# else
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif


/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, YYLEX_PARAM)
#else
# define YYLEX yylex (&yylval)
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include  /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)			\
do {						\
  if (yydebug)					\
    YYFPRINTF Args;				\
} while (YYID (0))

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
do {									  \
  if (yydebug)								  \
    {									  \
      YYFPRINTF (stderr, "%s ", Title);					  \
      yy_symbol_print (stderr,						  \
		  Type, Value); \
      YYFPRINTF (stderr, "\n");						  \
    }									  \
} while (YYID (0))


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE const * const yyvaluep;
#endif
{
  if (!yyvaluep)
    return;
# ifdef YYPRINT
  if (yytype < YYNTOKENS)
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
  YYUSE (yyoutput);
# endif
  switch (yytype)
    {
      default:
	break;
    }
}


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE const * const yyvaluep;
#endif
{
  if (yytype < YYNTOKENS)
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  YYFPRINTF (yyoutput, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
#else
static void
yy_stack_print (bottom, top)
    yytype_int16 *bottom;
    yytype_int16 *top;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (; bottom <= top; ++bottom)
    YYFPRINTF (stderr, " %d", *bottom);
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)				\
do {								\
  if (yydebug)							\
    yy_stack_print ((Bottom), (Top));				\
} while (YYID (0))


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yyrule)
    YYSTYPE *yyvsp;
    int yyrule;
#endif
{
  int yynrhs = yyr2[yyrule];
  int yyi;
  unsigned long int yylno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
	     yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      fprintf (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
		       &(yyvsp[(yyi + 1) - (yynrhs)])
		       		       );
      fprintf (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug)				\
    yy_reduce_print (yyvsp, Rule); \
} while (YYID (0))

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef	YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined __GLIBC__ && defined _STRING_H
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
    const char *yystr;
#endif
{
  YYSIZE_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
    char *yydest;
    const char *yysrc;
#endif
{
  char *yyd = yydest;
  const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for yyerror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
  if (*yystr == '"')
    {
      YYSIZE_T yyn = 0;
      char const *yyp = yystr;

      for (;;)
	switch (*++yyp)
	  {
	  case '\'':
	  case ',':
	    goto do_not_strip_quotes;

	  case '\\':
	    if (*++yyp != '\\')
	      goto do_not_strip_quotes;
	    /* Fall through.  */
	  default:
	    if (yyres)
	      yyres[yyn] = *yyp;
	    yyn++;
	    break;

	  case '"':
	    if (yyres)
	      yyres[yyn] = '\0';
	    return yyn;
	  }
    do_not_strip_quotes: ;
    }

  if (! yyres)
    return yystrlen (yystr);

  return yystpcpy (yyres, yystr) - yyres;
}
# endif

/* Copy into YYRESULT an error message about the unexpected token
   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
   including the terminating null byte.  If YYRESULT is null, do not
   copy anything; just return the number of bytes that would be
   copied.  As a special case, return 0 if an ordinary "syntax error"
   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
   size calculation.  */
static YYSIZE_T
yysyntax_error (char *yyresult, int yystate, int yychar)
{
  int yyn = yypact[yystate];

  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
    return 0;
  else
    {
      int yytype = YYTRANSLATE (yychar);
      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
      YYSIZE_T yysize = yysize0;
      YYSIZE_T yysize1;
      int yysize_overflow = 0;
      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
      int yyx;

# if 0
      /* This is so xgettext sees the translatable formats that are
	 constructed on the fly.  */
      YY_("syntax error, unexpected %s");
      YY_("syntax error, unexpected %s, expecting %s");
      YY_("syntax error, unexpected %s, expecting %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
# endif
      char *yyfmt;
      char const *yyf;
      static char const yyunexpected[] = "syntax error, unexpected %s";
      static char const yyexpecting[] = ", expecting %s";
      static char const yyor[] = " or %s";
      char yyformat[sizeof yyunexpected
		    + sizeof yyexpecting - 1
		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
		       * (sizeof yyor - 1))];
      char const *yyprefix = yyexpecting;

      /* Start YYX at -YYN if negative to avoid negative indexes in
	 YYCHECK.  */
      int yyxbegin = yyn < 0 ? -yyn : 0;

      /* Stay within bounds of both yycheck and yytname.  */
      int yychecklim = YYLAST - yyn + 1;
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
      int yycount = 1;

      yyarg[0] = yytname[yytype];
      yyfmt = yystpcpy (yyformat, yyunexpected);

      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
	  {
	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
	      {
		yycount = 1;
		yysize = yysize0;
		yyformat[sizeof yyunexpected - 1] = '\0';
		break;
	      }
	    yyarg[yycount++] = yytname[yyx];
	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
	    yysize_overflow |= (yysize1 < yysize);
	    yysize = yysize1;
	    yyfmt = yystpcpy (yyfmt, yyprefix);
	    yyprefix = yyor;
	  }

      yyf = YY_(yyformat);
      yysize1 = yysize + yystrlen (yyf);
      yysize_overflow |= (yysize1 < yysize);
      yysize = yysize1;

      if (yysize_overflow)
	return YYSIZE_MAXIMUM;

      if (yyresult)
	{
	  /* Avoid sprintf, as that infringes on the user's name space.
	     Don't have undefined behavior even if the translation
	     produced a string with the wrong number of "%s"s.  */
	  char *yyp = yyresult;
	  int yyi = 0;
	  while ((*yyp = *yyf) != '\0')
	    {
	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
		{
		  yyp += yytnamerr (yyp, yyarg[yyi++]);
		  yyf += 2;
		}
	      else
		{
		  yyp++;
		  yyf++;
		}
	    }
	}
      return yysize;
    }
}
#endif /* YYERROR_VERBOSE */


/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yymsg, yytype, yyvaluep)
    const char *yymsg;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  YYUSE (yyvaluep);

  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

  switch (yytype)
    {

      default:
	break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */

#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */






/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
    void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
  /* The look-ahead symbol.  */
int yychar;

/* The semantic value of the look-ahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;

  int yystate;
  int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Look-ahead token as an internal (translated) token number.  */
  int yytoken = 0;
#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  yytype_int16 yyssa[YYINITDEPTH];
  yytype_int16 *yyss = yyssa;
  yytype_int16 *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  YYSTYPE *yyvsp;



#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss;
  yyvsp = yyvs;

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
	/* Give user a chance to reallocate the stack.  Use copies of
	   these so that the &'s don't force the real ones into
	   memory.  */
	YYSTYPE *yyvs1 = yyvs;
	yytype_int16 *yyss1 = yyss;


	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  This used to be a
	   conditional around just the two extra args, but that might
	   be undefined if yyoverflow is a macro.  */
	yyoverflow (YY_("memory exhausted"),
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),

		    &yystacksize);

	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyexhaustedlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
	goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
	yystacksize = YYMAXDEPTH;

      {
	yytype_int16 *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyexhaustedlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
	YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

  /* Do appropriate processing given the current state.  Read a
     look-ahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to look-ahead token.  */
  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a look-ahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the look-ahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  yystate = yyn;
  *++yyvsp = yylval;

  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:
#line 77 "ass.y"
    {;}
    break;

  case 4:
#line 78 "ass.y"
    {;}
    break;

  case 5:
#line 80 "ass.y"
    {;}
    break;

  case 6:
#line 82 "ass.y"
    {;}
    break;

  case 7:
#line 85 "ass.y"
    {MODE=MODE_VAR;;}
    break;

  case 8:
#line 86 "ass.y"
    {
				if(ACTIVE) SetVar((yyvsp[(3) - (6)].var_name),(yyvsp[(5) - (6)].var)); 
				FREE((yyvsp[(3) - (6)].var_name));
				MODE=MODE_NORMAL;
			;}
    break;

  case 9:
#line 92 "ass.y"
    {;}
    break;

  case 10:
#line 94 "ass.y"
    {;}
    break;

  case 11:
#line 96 "ass.y"
    {;}
    break;

  case 12:
#line 98 "ass.y"
    {	MODE=MODE_VAR;;}
    break;

  case 13:
#line 98 "ass.y"
    {MODE=MODE_NORMAL;;}
    break;

  case 14:
#line 100 "ass.y"
    {;}
    break;

  case 15:
#line 102 "ass.y"
    {if(ACTIVE) YYACCEPT;;}
    break;

  case 16:
#line 105 "ass.y"
    {;}
    break;

  case 17:
#line 107 "ass.y"
    {;}
    break;

  case 18:
#line 109 "ass.y"
    {
				if (ACTIVE) PrintVarToLineCache(((lexerctl_t*)lexer_ctl)->l,PRINT_MODE_NORMAL,(yyvsp[(1) - (1)].var));
				FREE((yyvsp[(1) - (1)].var).string);
			;}
    break;

  case 19:
#line 114 "ass.y"
    {
				if(ACTIVE){
					PrintVarToLineCache(((lexerctl_t*)lexer_ctl)->l,(yyvsp[(1) - (3)].var).number,(yyvsp[(3) - (3)].var));
				}
				FREE((yyvsp[(1) - (3)].var).string);
				FREE((yyvsp[(3) - (3)].var).string);
			;}
    break;

  case 20:
#line 124 "ass.y"
    {MODE=MODE_VAR;;}
    break;

  case 21:
#line 125 "ass.y"
    {(yyvsp[(1) - (5)].state).flag=ACTIVE; ACTIVE=ACTIVE&&(yyvsp[(4) - (5)].var).number;MODE=MODE_NORMAL;FREE((yyvsp[(4) - (5)].var).string);;}
    break;

  case 22:
#line 126 "ass.y"
    {ACTIVE=(yyvsp[(1) - (7)].state).flag;;}
    break;

  case 24:
#line 128 "ass.y"
    {;}
    break;

  case 25:
#line 130 "ass.y"
    {ACTIVE=ACTIVE&!(yyvsp[(-4) - (1)].var).number;;}
    break;

  case 26:
#line 131 "ass.y"
    {ACTIVE=(yyvsp[(-7) - (3)].state).flag;;}
    break;

  case 27:
#line 134 "ass.y"
    {;}
    break;

  case 28:
#line 135 "ass.y"
    {MODE=MODE_VAR;;}
    break;

  case 29:
#line 136 "ass.y"
    {MODE=MODE_NORMAL;if((yyvsp[(7) - (8)].var).number) pos=(yyvsp[(1) - (8)].state).position;FREE((yyvsp[(7) - (8)].var).string);;}
    break;

  case 30:
#line 139 "ass.y"
    {MODE=MODE_VAR;(yyvsp[(1) - (1)].state).flag=ACTIVE;;}
    break;

  case 31:
#line 141 "ass.y"
    {MODE=MODE_NORMAL; ACTIVE=ACTIVE&&(yyvsp[(4) - (5)].var).number;FREE((yyvsp[(4) - (5)].var).string);;}
    break;

  case 32:
#line 143 "ass.y"
    {if (ACTIVE)  {pos=(yyvsp[(1) - (7)].state).position;}  else {ACTIVE=(yyvsp[(1) - (7)].state).flag; };;}
    break;

  case 33:
#line 147 "ass.y"
    {(yyval.var_name)=(yyvsp[(1) - (1)].var_name);;}
    break;

  case 34:
#line 149 "ass.y"
    {(yyval.var_name)=malloc(strlen((yyvsp[(1) - (2)].var_name))+strlen((yyvsp[(2) - (2)].var_name))+1);strcpy((yyval.var_name),(yyvsp[(1) - (2)].var_name));strcat((yyval.var_name),(yyvsp[(2) - (2)].var_name));FREE((yyvsp[(1) - (2)].var_name));FREE((yyvsp[(2) - (2)].var_name));;}
    break;

  case 35:
#line 151 "ass.y"
    {(yyval.var_name)=malloc(strlen((yyvsp[(1) - (4)].var_name))+10); sprintf((yyval.var_name),"%s%d",(yyvsp[(1) - (4)].var_name),(yyvsp[(3) - (4)].var).number);FREE((yyvsp[(3) - (4)].var).string);FREE((yyvsp[(1) - (4)].var_name));;}
    break;

  case 36:
#line 154 "ass.y"
    {(yyval.var)=(yyvsp[(1) - (1)].var);;}
    break;

  case 37:
#line 155 "ass.y"
    { 
				(yyval.var)=GetVar((yyvsp[(1) - (1)].var_name));
				FREE((yyvsp[(1) - (1)].var_name));
			;}
    break;

  case 38:
#line 159 "ass.y"
    {
					(yyval.var)=GetVar((yyvsp[(2) - (2)].var_name));
					(yyval.var).number++;
					if(ACTIVE) SetVar((yyvsp[(2) - (2)].var_name),(yyval.var));
					FREE((yyvsp[(2) - (2)].var_name));
			;}
    break;

  case 39:
#line 165 "ass.y"
    {
					(yyval.var)=GetVar((yyvsp[(1) - (2)].var_name));
					(yyval.var).number++;					
					if(ACTIVE) SetVar((yyvsp[(1) - (2)].var_name),(yyval.var));
					(yyval.var).number--;
					FREE((yyvsp[(1) - (2)].var_name));
			;}
    break;

  case 40:
#line 173 "ass.y"
    {
					(yyval.var)=GetVar((yyvsp[(2) - (2)].var_name));
					(yyval.var).number--;
					if(ACTIVE) SetVar((yyvsp[(2) - (2)].var_name),(yyval.var));
					FREE((yyvsp[(2) - (2)].var_name));
			;}
    break;

  case 41:
#line 179 "ass.y"
    {
					(yyval.var)=GetVar((yyvsp[(1) - (2)].var_name));
					(yyval.var).number--;
					if(ACTIVE) SetVar((yyvsp[(1) - (2)].var_name),(yyval.var));
					(yyval.var).number++;
					FREE((yyvsp[(1) - (2)].var_name));
			;}
    break;

  case 42:
#line 186 "ass.y"
    {(yyval.var)=(yyvsp[(2) - (2)].var);if((yyval.var).type==t_NUMBER) (yyval.var).number=-(yyval.var).number;;}
    break;

  case 43:
#line 187 "ass.y"
    {(yyval.var)=(yyvsp[(2) - (3)].var);;}
    break;

  case 44:
#line 188 "ass.y"
    {(yyval.var)=(yyvsp[(2) - (2)].var);if((yyval.var).type==t_NUMBER) (yyval.var).number=!(yyval.var).number;;}
    break;

  case 45:
#line 189 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'*');;}
    break;

  case 46:
#line 190 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'/');;}
    break;

  case 47:
#line 191 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'+');;}
    break;

  case 48:
#line 192 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'-');;}
    break;

  case 49:
#line 193 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),NE);;}
    break;

  case 50:
#line 194 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'=');;}
    break;

  case 51:
#line 195 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'&');;}
    break;

  case 52:
#line 196 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),AND);;}
    break;

  case 53:
#line 197 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'|');;}
    break;

  case 54:
#line 198 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),OR);;}
    break;

  case 55:
#line 199 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'<');;}
    break;

  case 56:
#line 200 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),'>');;}
    break;

  case 57:
#line 201 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),GE);;}
    break;

  case 58:
#line 202 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),LE);;}
    break;

  case 59:
#line 203 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),SHIFT_LEFT);;}
    break;

  case 60:
#line 204 "ass.y"
    {(yyval.var)=Op((yyvsp[(1) - (3)].var),(yyvsp[(3) - (3)].var),SHIFT_LEFT);;}
    break;


/* Line 1267 of yacc.c.  */
#line 1832 "ass.tab.c"
      default: break;
    }
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;


  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
      {
	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
	  {
	    YYSIZE_T yyalloc = 2 * yysize;
	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
	    if (yymsg != yymsgbuf)
	      YYSTACK_FREE (yymsg);
	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
	    if (yymsg)
	      yymsg_alloc = yyalloc;
	    else
	      {
		yymsg = yymsgbuf;
		yymsg_alloc = sizeof yymsgbuf;
	      }
	  }

	if (0 < yysize && yysize <= yymsg_alloc)
	  {
	    (void) yysyntax_error (yymsg, yystate, yychar);
	    yyerror (yymsg);
	  }
	else
	  {
	    yyerror (YY_("syntax error"));
	    if (yysize != 0)
	      goto yyexhaustedlab;
	  }
      }
#endif
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse look-ahead token after an
	 error, discard it.  */

      if (yychar <= YYEOF)
	{
	  /* Return failure if at end of input.  */
	  if (yychar == YYEOF)
	    YYABORT;
	}
      else
	{
	  yydestruct ("Error: discarding",
		      yytoken, &yylval);
	  yychar = YYEMPTY;
	}
    }

  /* Else will try to reuse look-ahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  /* Do not reclaim the symbols of the rule which action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
	YYABORT;


      yydestruct ("Error: popping",
		  yystos[yystate], yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  *++yyvsp = yylval;


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEOF && yychar != YYEMPTY)
     yydestruct ("Cleanup: discarding lookahead",
		 yytoken, &yylval);
  /* Do not reclaim the symbols of the rule which action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
		  yystos[*yyssp], yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  /* Make sure YYID is used.  */
  return YYID (yyresult);
}


#line 206 "ass.y"


var_t Op(var_t var1, var_t var2, int op_type){
	var_t res;
	res.type=t_NUMBER;
	res.string=NULL;
	res.number=0;
	switch(op_type){
		case '+': if(var1.type==t_STRING && var2.type==t_STRING){
					res.type=t_STRING;
					res.string=malloc(var1.number+var2.number+1);
					strcpy(res.string,var1.string);
					strcpy(res.string+var1.number,var2.string);
				} 
				else res.number=var1.number+var2.number;
				break;
		case '-': res.number=var1.number-var2.number;
				break;
		case '*': res.number=var1.number*var2.number;
				break;
		case '/':res.number=var2.number?var1.number/var2.number:1;
				break;
		case NE :if(var1.type==t_STRING && var2.type==t_STRING) res.number=STRCMP(var1.string,var2.string);
					else res.number=(var1.number!=var2.number);
				break;
		case '=':if(var1.type==t_STRING && var2.type==t_STRING) res.number=!STRCMP(var1.string,var2.string);
					else res.number=(var1.number==var2.number);
				break;
		case '&':res.number=var1.number&var2.number;
				break;
		case AND:res.number=var1.number&&var2.number;
				break;
		case '|':res.number=var1.number|var2.number;
				break;
		case OR :res.number=var1.number||var2.number;
				break;
		case '<':res.number=(var1.number':res.number=(var1.number>var2.number);
				break;
		case GE :res.number=var1.number>=var2.number;
				break;
		case LE :res.number=var1.number<=var2.number;
				break;
		case SHIFT_LEFT:res.number=var1.number<>var2.number;
				break;
		default: res.number=1;
	}
	if(!res.string) res.string=dup("");
	FREE(var1.string);
	FREE(var2.string);
	return res;
}

int yyerror (const char *s) /* 뢠 yyparse  砥 訡 */
{
	printf ("\n(error in template)\n");
	return 1;
}

int isoperator(const char ch1, const char ch2){
	const int ops[]={
				'>','>',SHIFT_RIGHT,
				'<','<',SHIFT_LEFT, 
				'>','=',GE,
				'+', '+', PP,
				'-','-',MM,
				'<','=',LE,
				'!','=',NE,
				'|', '|', OR,
				'&', '&', AND
			}; 
	const char op[]={
			'+', '-', '=', '*', '/', '!', '>', '<',
			'&', '|', '(', ')', '[', ']', ';', '}', '{', ',', ':', ';'
			 }; /*chars to be returned as is - special (reserved) symbols*/
	int cnt=0;
	for(cnt=0;cnt>, >=, !=, ==, etc */
		pos++;
		return tmp_char;
	}
	if(MODE==MODE_VAR){
		if(line[pos]=='"'){
			pos++;
			string=malloc(strlen(line+pos)+1);
			string_pointer=string;
			while(line[pos]!='"'&&line[pos]){
				if(line[pos]=='\\'){
					pos++;
					switch(line[pos]){
						case 0: return 0; /*eol*/
						case 's': *string=' ';
								break;
						case 'n': *string='\n';
								break;
						case 't': *string='\t';
								break;
						case 'x':
								pos++;
								*string=atoi(line+pos);
								skip_digit(line,pos);
								pos--;
						default: 
							*string=line[pos];
					}
				}  else *string=line[pos];
                string++;
				pos++;
			};
			if(line[pos]=='"') pos++;
			*string=0;
			yylval->var.string=string_pointer;
			yylval->var.type=t_STRING;
			yylval->var.number=strlen(yylval->var.string);
			return E_ATOM;
		}
		if(isdigit(line[pos])){
			yylval->var.number=atoi(line+pos);
			yylval->var.type=t_NUMBER;
			yylval->var.string=dup("");
			skip_digit(line,pos);
			return E_ATOM;
		}
		if(isalpha(line[pos])||line[pos]=='.'||line[pos]=='?'){
			buffer=malloc(strlen(line+pos));
			buffer_pos=0;
			while(isalpha(line[pos])||isdigit(line[pos])||line[pos]=='.'||line[pos]=='?')
			buffer[buffer_pos++]=line[pos++];
			buffer[buffer_pos]=0;
			yylval->var_name=buffer;
			return VAR_PART;
		}
		printf ("ERROR!");
	}
	/*ELSE, MODE=MODE_NORMAL*/
	yylval->state.position=pos;
	tmp_char=iskeyword(line+pos);
	if(tmp_char){
		skip_alpha(line,pos);
		return tmp_char;
	};
	return 1; /*error*/
}

 

avinfo-1.0.a15+20090102/src/nobison/ass.tab.h0000644000175000017500000000543311043625723016572 0ustar  stasstas/* A Bison parser, made by GNU Bison 2.3.  */

/* 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 2, 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., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.  */

/* 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.  */

/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     E_ATOM = 258,
     WHILE = 259,
     DO = 260,
     IF = 261,
     SET = 262,
     ELSE = 263,
     VAR_PART = 264,
     PRINT = 265,
     EXIT = 266,
     AND = 267,
     OR = 268,
     NE = 269,
     LE = 270,
     GE = 271,
     SHIFT_RIGHT = 272,
     SHIFT_LEFT = 273,
     MM = 274,
     PP = 275
   };
#endif
/* Tokens.  */
#define E_ATOM 258
#define WHILE 259
#define DO 260
#define IF 261
#define SET 262
#define ELSE 263
#define VAR_PART 264
#define PRINT 265
#define EXIT 266
#define AND 267
#define OR 268
#define NE 269
#define LE 270
#define GE 271
#define SHIFT_RIGHT 272
#define SHIFT_LEFT 273
#define MM 274
#define PP 275




#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 41 "ass.y"
{
	int 	letter;
	var_t 	var;
	int 	mode;
	struct{
		int position;
		int flag;
	} state;
	char* 	var_name;
}
/* Line 1489 of yacc.c.  */
#line 100 "ass.tab.h"
	YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif



avinfo-1.0.a15+20090102/src/riff.h0000644000175000017500000000365510232106111014502 0ustar  stasstas/*************************************************************************
 * riff.h header file for riff.c [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/
#ifndef _H_AVI_H
#define _H_AVI_H

#define AVI_FPS_NUMBERS 100
/*100 for 2 digits, 1000 for 3, etc*/

#define AVI_MAX_STREAMS 9


extern int riffparse (FILE* file , int flags);
enum{
	FOURCC_RIFF=0x46464952,
	FOURCC_AVI =0x20495641,
	FOURCC_LIST=0x5453494C,
	FOURCC_hdrl=0x6C726468,
	FOURCC_avih=0x68697661,
	FOURCC_strl=0x6C727473,
	FOURCC_strh=0x68727473,
	FOURCC_strf=0x66727473,
	FOURCC_STRD=0x64727473,
	FOURCC_vids=0x73646976,
	FOURCC_auds=0x73647561,
	FOURCC_INFO=0x4F464E49,
	FOURCC_idx1=0x31786469,
	FOURCC_movi=0x69766F6D,
	FOURCC_JUNK=0x4B4E554A,
	FOURCC_PAD =0x20444150,
	FOURCC_DIV3=861292868,
	FOURCC_DIVX=1482049860,
	FOURCC_XVID=1145656920,
	FOURCC_DX50=808802372,
	FOURCC_fmt =0x20746D66,  /*for WAVE files*/
	FOURCC_data=0x61746164,  /*for WAVE files*/
	FOURCC_WAVE=0x45564157	 /*for WAVE files*/
};

#define AVIIF_KEYFRAME	0x00000010L /*avi idx1 keyframe flag*/
#define AVIIF_LIST	0x00000001L

#endif
avinfo-1.0.a15+20090102/src/text.h0000644000175000017500000000215710232106111014534 0ustar  stasstas/*************************************************************************
 * text.h Header file for text.c [part of AVInfo 1.x]
 *
 * Copyright (c) 2003 George Shuklin
 *
 * 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 (see the file COPYING); if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA  02111-1307  USA  or visit http://www.gnu.org/copyleft/gpl.html
 *
 *************************************************************************/
#ifndef _H_SUB_H
#define _H_SUB_H

extern int textparse (FILE* file, int flags );

#endif
avinfo-1.0.a15+20090102/src/tpls.ass0000644000175000017500000003424611127427053015114 0ustar  stasstas{"default",0,0,"","
	if(ext="vob") print m1000:in; else print name;
	print ", ", m1024:size, "b";
	print "\n";
	set c=0;
	while (c++1) print c;
		print ": ";
		if (v[c].lang) print v[c].lang, " ";
		if (v[c].x&&v[c].y) print v[c].x, "x", v[c].y;
		if (v[c].aspectX&&v[c].aspectY) print "(",v[c].aspectX,":",v[c].aspectY,")";
		if (v[c].l) print " ", time:v[c].l;
		if (v[c].x&&v[c].y) print " ";
		if (v[c].fpsH) print v[c].fpsH;
		if (v[c].fpsH && v[c].fpsL) print ".", v[c].fpsL;
		if (v[c].fpsH) print "fps";
		if (v[c].cc) print " ", cn:v[c].cc;
		if (v[c].bps) print	 " ", m1000:v[c].bps, "bps";
		print "\n";
	}
	set c=0;
	while (c++1) print c;
		print ": ";
		if (a[c].lang) print a[c].lang,  " ";
		if (a[c].freq) print m1000: a[c].freq, "Hz ";
		if (a[c].l) print " ", time:a[c].l;
		if (a[c].ch=2) print " Stereo ";
		if (a[c].ch=1) print " Mono ";
		if (a[c].ch>2) print " ", a[c].ch, " chanels ";
		if (a[c].bps) print m1000: a[c].bps,"bps";
		if (a[c].vbr) print "(VBR)";
		if (a[c].cc) print " ", cn: a[c].cc;
		print "\n";
	}
	set c=0;
	if(stream.t){
		print "sub";
		if(stream.t>1) print "s";
		print ": ";
		while (c++";
if(umsg) print umsg;
if(umsgh) print "\n"; else print "\n";
if(listpre) print "
\n";
print "\tFilelist generated by AVInfo 1.0, http://shounen.ru/soft/avinfo/\n\n";","
if(ext="vob"&&size<16000000) exit;
if(ext="vob") print in; else print sn:name;
if(ext!="ifo") print " ", m1024:size,"b"; 
print "\t";
if ( (v1.x<512 || v1.y < 350 ) && v1.x && v1.y ) print v1.x,"x",v1.y, " ";
if (v1.fpsH < 20 && v1.fpsH) print v1.fpsH,"fps ";
if(v1.bps<500000 && v1.bps) print m1000:v1.bps, "bps ";

if (stream.v>1) print "[",stream.v, "]";
if (v1.x>511||v2.y>351) print v1.x,"x",v1.y;
if (v1.aspectX && ((v1.x*v1.aspectX/v1.aspectY)-v1.y)) print "(",v1.aspectX,":",v1.aspectY,")";
if (v1.l) print "/",ct: a1.l;
if (v1.bps>500000) print "/",m1000: v1.bps,"bps";
if (v1.cc && !(v1.cc=XVID || v1.cc=DIVX || v1.cc=DX50 || v1.cc=DIV3) ) print "/",cn: v1.cc;

print " ";
set c=0;
if (stream.t) print "t:";
if(t1.cc) print t1.cc,":";
while(c++1) print "[",stream.a,"]";
set c=0;
while(c++";
          print "\n";
"},{"html-list",0,0,"
if(htmlpart) print "
"; else{ print "filelist"; print " \n"; if(!umsgh&&umsg) print "

"; if(umsgh<7&&umsgh>0) print ""; if(umsg) print umsg; if(umsgh<7&&umsgh>0) print "\n"; print "\n

Generated by AVInfo 1.0

\n
\n"; } "," if(ext="vob"&&size<16000000) {exit;} print "\n\n"; ","print "
"; if(ext="vob")print in; else print sn:name; print "
  ", m1024:size,"b "; set c=0; print "
"; while (c++1) print c; print ": "; if (v[c].x&&v[c].y) print " ",v[c].x,"x", v[c].y; if (v[c].aspectX && ((v[c].x*v[c].aspectX/v[c].aspectY)-v[c].y)) print "(",v[c].aspectX,":",v[c].aspectY,")"; if (v[c].fpsH) print ", ",v[c].fpsH,".",v[c].fpsL,"fps"; if (v[c].cc) print ", ",cn: v[c].cc; if (v[c].bps) print ", ",m1000: v[c].bps,"bps",","; if (v[c].lang) print " language:", v[c].lang; print "
"; } print "
"; set c=0; while (c++1) print c; print ": "; if (a[c].freq) print a[c].freq,"Hz"; if (a[c].ch=2) print ", Stereo"; if (a[c].ch=1) print ", Mono"; if (a[c].ch>2) print a[c].ch," chanels"; if (a[c].bps) print ", ",m1000: a[c].bps,"bps"; if (a[c].vbr) print "(VBR)"; if (a[c].lang) print " language: ", a[c].lang; print "
"; } print "
"; set c=0; print ""; while (c++1) print c; print ": "; if (t[c].lang) print t[c].lang; else print c; if (t[c].cc) print " (",t[c].cc, ")"; print "
"; } print "
"; set c=0; while (c++"; } print "
\n

"; print "\nStatistic: ",total.files, " files (",total.processed, " processed) ", "common length: ", ct:total.time, ", common size: ", 0:total.size, "Gb","
\n"; print "Min found: "; if ( total.minvbps ) print " video: ", m1000:total.minvbps, "bps "; if ( total.minx && total.miny ) print total.minx,"x",total.miny; if ( total.minfps ) print " ", total.minfps, "fps"; if ( total.minabps||total.minfreq) print " audio: "; if ( total.minfreq) print m1000:total.minfreq, "Hz "; if ( total.minabps) print m1000:total.minabps, "bps"; if(!htmlpart) print "\n\n"; else print "\n


"; "},{"short",0,0,""," print "\"",name,"\" "; if (stream.v) print v1.x,"x",v1.y,", "; if(a1.l) print time:a1.l; if(!a1.l&&v1.l) print time:v1.l; if (!stream.v && stream.a) print a1.freq,"/", m1000: a1.bps,"bps"; if (a[c].vbr) print "(VBR)"; if (!stream.v && !stream.a && stream.t) print t1.lang; print "\n"; ",""}, {"raw",0,0,""," print "in=",in,"\n"; print "shortname=",sn:name,"\n"; print "size=",-1:size,"\n"; print "hsize=",m1024:size,"\n"; if(stream.a) print "stream.a=",stream.a,"\n"; if(stream.v) print "stream.v=",stream.v,"\n"; if(stream.t) print "stream.t=",stream.t,"\n"; if(stream.d) print "stream.d=",stream.d,"\n"; if( stream.a ){ set c=0; while(c++1) print "[",stream.v,"] "; while (c++1) print "[",stream.a,"] "; while (c++2) print a[c].ch, " chanels "; if (a[c].bps) print m1000: a[c].bps,"bps"; if (a[c].vbr) print "(VBR)"; if (a[c].cc) print " ", cn: a[c].cc; if(c1) print "[",stream.t,"] "; while (c++1) print " #",c; print ":\t \n"; if( v[c].x&&v[c].y||v[c].cc||v[c].fpsH) { print " "; if(v[c].x&&v[c].y) print v[c].x,"x",v[c].y; else print "\t"; if( v[c].x && v[c].y && v[c].aspectX && v[c].aspectY) print " (",v[c].aspectX,":",v[c].aspectY,")"; if (v[c].cc) print "\t", cn:v[c].cc; else print "\t"; if (v[c].fpsH) print "\t", v[c].fpsH; else print "\t"; if (v[c].fpsH && v[c].fpsL) print ".",v[c].fpsL; if (v[c].fpsH) print "fps"; print "\t \n"; } if (v[c].l||v[c].bps||v[c].lang){ print " "; if (v[c].l) print ct:v[c].l; else print "\t"; if (v[c].bps) print "\t",m1000:v[c].bps, "b/s"; else print "\t"; if (v[c].lang) print "\tlang: ", v[c].lang; else print "\t"; print "\t \n"; } } set c=0; while(c++1) print " #",c; print ":\t \n"; if(a[c].freq||a[c].cc||a[c].ch){ print " "; if(a[c].freq) print m1000:a[c].freq,"Hz\t";else print "\t"; if(a[c].ch) print a[c].ch, "ch\t"; else print "\t"; if(a[c].cc) print cn:a[c].cc, "\t"; else print "\t"; print "\t \n"; } if(a[c].bps||a[c].lang){ print " "; if(a[c].bps) print m1000:a[c].bps,"b/s"; if(a[c].bps&&a[c].vbr) print "(VBR)"; print "\t"; if(a[c].lang) print "lang: ",a[c].lang; print "\t \n"; } } set c=0; if (stream.t) print "\t \n"; while(c++1) print " #",c; print ": "; if (t[c].lang) print t[c].lang; else print "language unknown"; if(t[c].cc) print " (",t[c].cc,")"; print "\t \n"; } print "\n"; "," "}, {"test",0,0,"","set a=5; if(a=6) print "if";else print "else";",""} avinfo-1.0.a15+20090102/src/print.h0000644000175000017500000000345410232106111014705 0ustar stasstas/************************************************************************* * print.h - header of print.c [part of AVInfo 1.x] * * Copyright (c) 2003 George Shuklin * * 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 (see the file COPYING); if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA or visit http://www.gnu.org/copyleft/gpl.html * *************************************************************************/ #ifndef _H_PRINT_H #define _H_PRINT_H #include typedef struct{ int allocated; /*size of allocated buffer for line*/ char* line; /*cached line*/ int last_pos; /*last printed position*/ int max_size; /*max allowed string length*/ FILE* handler; /*handler for output. may be file, strerr, strout, etc*/ int cropflag;/*if cropflag=1, overflow will be croped, else, current line will be printed and line begin to filling from begin*/ }linecache; #include "avinfo.h" linecache* InitLineCache(FILE* handler, int max_size, int cropflag); int ExpandTab(linecache* l); int FlushLineCache(linecache* l); int CloseLineCache(linecache* l); int AddStringToLineCache(linecache *l, const char* line); int PrintVarToLineCache(linecache*l, const int mode_prn,const var_t var); #endif avinfo-1.0.a15+20090102/src/ass.y0000644000175000017500000002246211043614600014370 0ustar stasstas/************************************************************************* * ass.y AVInfo Simple Script parser engie [part of AVInfo 1.x] * * Copyright (c) 2003 George Shuklin * * 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 (see the file COPYING); if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA or visit http://www.gnu.org/copyleft/gpl.html * *************************************************************************/ %{ #include "avinfo.h" #include "ass.h" #include "ass.tab.h" #define YYLEX_PARAM lexer_ctl #define YYPARSE_PARAM lexer_ctl #define line (((lexerctl_t*)lexer_ctl)->line) #define pos (((lexerctl_t*)lexer_ctl)->c) int yyerror( const char *s ); int yylex (YYSTYPE *lval, void* lexer_ctl); %} %pure_parser %expect 1 %union{ int letter; var_t var; int mode; struct{ int position; int flag; } state; char* var_name; } %token E_ATOM %token '{' WHILE DO IF SET ELSE %token VAR_PART %type exp %type var %type do while %type oper %token PRINT EXIT %left '&' '^' '|' OR AND %left '=' %left NE %left '>' '<' GE LE %left SHIFT_LEFT SHIFT_RIGHT %left '+' '-' %left PP MM %left '*' '/' '%' %right '!' %left '(' ')' %% begin: |{} all {}; all: oper {} | all oper{} ; oper: SET {MODE=MODE_VAR;} var '=' exp ';' { if(ACTIVE) SetVar($3,$5); FREE($3); MODE=MODE_NORMAL; } | if {} | do ';' {} | while {} | PRINT { MODE=MODE_VAR;} print_string ';' {MODE=MODE_NORMAL;} | '{' all '}' {} | EXIT ';' {if(ACTIVE) YYACCEPT;} ; print_string: print_var{} | print_string ',' print_var {} ; print_var: exp { if (ACTIVE) PrintVarToLineCache(((lexerctl_t*)lexer_ctl)->l,PRINT_MODE_NORMAL,$1); FREE($1.string); } | exp ':' exp { if(ACTIVE){ PrintVarToLineCache(((lexerctl_t*)lexer_ctl)->l,$1.number,$3); } FREE($1.string); FREE($3.string); }; if: IF {MODE=MODE_VAR;} '(' exp ')' {$1.flag=ACTIVE; ACTIVE=ACTIVE&&$4.number;MODE=MODE_NORMAL;FREE($4.string);} oper {ACTIVE=$1.flag;} else_part; else_part: {}/*no else*/ | ELSE {ACTIVE=ACTIVE&!$-4.number;} oper {ACTIVE=$-7.flag;}; do: DO {} oper WHILE {MODE=MODE_VAR;} '(' exp ')' {MODE=MODE_NORMAL;if($7.number) pos=$1.position;FREE($7.string);}; while: WHILE {MODE=MODE_VAR;$1.flag=ACTIVE;} '(' exp ')' {MODE=MODE_NORMAL; ACTIVE=ACTIVE&&$4.number;FREE($4.string);} oper {if (ACTIVE) {pos=$1.position;} else {ACTIVE=$1.flag; };} ; var: VAR_PART {$$=$1;} | var VAR_PART {$$=malloc(strlen($1)+strlen($2)+1);strcpy($$,$1);strcat($$,$2);FREE($1);FREE($2);} | var '[' exp ']' {$$=malloc(strlen($1)+10); sprintf($$,"%s%d",$1,$3.number);FREE($3.string);FREE($1);}; exp: E_ATOM{$$=$1;}| var { $$=GetVar($1); FREE($1); }| PP var{ $$=GetVar($2); $$.number++; if(ACTIVE) SetVar($2,$$); FREE($2); }| var PP{ $$=GetVar($1); $$.number++; if(ACTIVE) SetVar($1,$$); $$.number--; FREE($1); }| MM var{ $$=GetVar($2); $$.number--; if(ACTIVE) SetVar($2,$$); FREE($2); }| var MM{ $$=GetVar($1); $$.number--; if(ACTIVE) SetVar($1,$$); $$.number++; FREE($1); }| '-' exp {$$=$2;if($$.type==t_NUMBER) $$.number=-$$.number;}| '(' exp ')' {$$=$2;}| '!' exp {$$=$2;if($$.type==t_NUMBER) $$.number=!$$.number;}| exp '*' exp {$$=Op($1,$3,'*');}| exp '/' exp {$$=Op($1,$3,'/');}| exp '+' exp {$$=Op($1,$3,'+');}| exp '-' exp {$$=Op($1,$3,'-');}| exp NE exp {$$=Op($1,$3,NE);}| exp '=' exp {$$=Op($1,$3,'=');}| exp '&' exp {$$=Op($1,$3,'&');}| exp AND exp {$$=Op($1,$3,AND);}| exp '|' exp {$$=Op($1,$3,'|');}| exp OR exp {$$=Op($1,$3,OR);}| exp '<' exp {$$=Op($1,$3,'<');}| exp '>' exp {$$=Op($1,$3,'>');}| exp GE exp {$$=Op($1,$3,GE);}| exp LE exp {$$=Op($1,$3,LE);}| exp SHIFT_LEFT exp {$$=Op($1,$3,SHIFT_LEFT);}| exp SHIFT_RIGHT exp {$$=Op($1,$3,SHIFT_LEFT);}; %% var_t Op(var_t var1, var_t var2, int op_type){ var_t res; res.type=t_NUMBER; res.string=NULL; res.number=0; switch(op_type){ case '+': if(var1.type==t_STRING && var2.type==t_STRING){ res.type=t_STRING; res.string=malloc(var1.number+var2.number+1); strcpy(res.string,var1.string); strcpy(res.string+var1.number,var2.string); } else res.number=var1.number+var2.number; break; case '-': res.number=var1.number-var2.number; break; case '*': res.number=var1.number*var2.number; break; case '/':res.number=var2.number?var1.number/var2.number:1; break; case NE :if(var1.type==t_STRING && var2.type==t_STRING) res.number=STRCMP(var1.string,var2.string); else res.number=(var1.number!=var2.number); break; case '=':if(var1.type==t_STRING && var2.type==t_STRING) res.number=!STRCMP(var1.string,var2.string); else res.number=(var1.number==var2.number); break; case '&':res.number=var1.number&var2.number; break; case AND:res.number=var1.number&&var2.number; break; case '|':res.number=var1.number|var2.number; break; case OR :res.number=var1.number||var2.number; break; case '<':res.number=(var1.number':res.number=(var1.number>var2.number); break; case GE :res.number=var1.number>=var2.number; break; case LE :res.number=var1.number<=var2.number; break; case SHIFT_LEFT:res.number=var1.number<>var2.number; break; default: res.number=1; } if(!res.string) res.string=dup(""); FREE(var1.string); FREE(var2.string); return res; } int yyerror (const char *s) /* 뢠 yyparse 砥 訡 */ { printf ("\n(error in template)\n"); return 1; } int isoperator(const char ch1, const char ch2){ const int ops[]={ '>','>',SHIFT_RIGHT, '<','<',SHIFT_LEFT, '>','=',GE, '+', '+', PP, '-','-',MM, '<','=',LE, '!','=',NE, '|', '|', OR, '&', '&', AND }; const char op[]={ '+', '-', '=', '*', '/', '!', '>', '<', '&', '|', '(', ')', '[', ']', ';', '}', '{', ',', ':', ';' }; /*chars to be returned as is - special (reserved) symbols*/ int cnt=0; for(cnt=0;cnt>, >=, !=, ==, etc */ pos++; return tmp_char; } if(MODE==MODE_VAR){ if(line[pos]=='"'){ pos++; string=malloc(strlen(line+pos)+1); string_pointer=string; while(line[pos]!='"'&&line[pos]){ if(line[pos]=='\\'){ pos++; switch(line[pos]){ case 0: return 0; /*eol*/ case 's': *string=' '; break; case 'n': *string='\n'; break; case 't': *string='\t'; break; case 'x': pos++; *string=atoi(line+pos); skip_digit(line,pos); pos--; default: *string=line[pos]; } } else *string=line[pos]; string++; pos++; }; if(line[pos]=='"') pos++; *string=0; yylval->var.string=string_pointer; yylval->var.type=t_STRING; yylval->var.number=strlen(yylval->var.string); return E_ATOM; } if(isdigit(line[pos])){ yylval->var.number=atoi(line+pos); yylval->var.type=t_NUMBER; yylval->var.string=dup(""); skip_digit(line,pos); return E_ATOM; } if(isalpha(line[pos])||line[pos]=='.'||line[pos]=='?'){ buffer=malloc(strlen(line+pos)); buffer_pos=0; while(isalpha(line[pos])||isdigit(line[pos])||line[pos]=='.'||line[pos]=='?') buffer[buffer_pos++]=line[pos++]; buffer[buffer_pos]=0; yylval->var_name=buffer; return VAR_PART; } printf ("ERROR!"); } /*ELSE, MODE=MODE_NORMAL*/ yylval->state.position=pos; tmp_char=iskeyword(line+pos); if(tmp_char){ skip_alpha(line,pos); return tmp_char; }; return 1; /*error*/ } avinfo-1.0.a15+20090102/src/avinfo.c0000644000175000017500000001454711043607465015056 0ustar stasstas/************************************************************************* * avinfo.c module selection and startup code [part of AVInfo 1.x] * * Copyright (c) 2003 George Shuklin * * 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 (see the file COPYING); if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA or visit http://www.gnu.org/copyleft/gpl.html * *************************************************************************/ #include "avinfo.h" int voidparse(FILE* f, int flags){ /*used for unsupported files*/ return 1; } const module_t modules[]={ { "wav\0" "avi\0" "riff\0", 1, &riffparse }, { "mpg\0" "mpeg\0" "m2v\0" "m1v\0" "vob\0", 1, &mpegparse }, { "smi\0" "ssa\0" "srt\0" "sub\0" "sami\0" "s2k\0", 1, &textparse }, { "mp3\0" "mp2\0", 1, &mp3parse },{ "mkv\0" "mks\0" "mka\0", 1, &mkvparse },{ "rm\0" "asf\0" "wmv\0", 1, &voidparse /*currently unsupported*/ }, { "ifo\0", 1, &ifoparse }, { "ogg\0" "ogm\0", 1, &ogmparse } }; #define ASS_PRINT do {\ lexerctl.c=0;\ lexerctl.flag=0;\ lexerctl.active=1;\ lexerctl.mode=0;\ lexerctl.l=InitLineCache(output,GetNumericVar("linelength"),1);\ processed_flag=0;\ yyparse( &lexerctl );\ CloseLineCache(lexerctl.l);\ } while (0); int main( int argc, char* argv[] ){ int cnt=0; int tmp=0; int flags=0; unsigned int wait=0; /*delay between file scans*/ lexerctl_t lexerctl = { "", 0, 0, 1, 0,NULL }; FILE* file=NULL; FILE* filelist=NULL; FILE* output=NULL; char* curr_ext=NULL; int processed_flag=0; char* flst_name=NULL; char* in_name=NULL; char* force_ext=NULL; char* ext = NULL; char* outputname; struct{ unsigned int total_time; unsigned int files_total; unsigned int files_processed; unsigned int min_x; unsigned int min_y; unsigned int min_fps; unsigned int min_v_bps; unsigned int min_a_bps; unsigned int sound_hz; unsigned int size; /*in 64k blocks*/ }statistic={0,0,0,0,0,0,0,0,0,0}; if( SetConfig( argc, argv ) ) return fprintf(stderr,"Error in command line\n"); outputname=GetROStringVar("output"); if(!*outputname) output=stdout; else { output=fopen(outputname,"w"); if(!output) return fprintf(stderr, "Error opening output file %s\n",outputname); } flst_name=GetROStringVar("filelist"); if(*flst_name){ if(*flst_name=='-'&&!flst_name[1]) filelist=stdin; /*GNU standart for stdin*/ else { filelist=fopen(flst_name,"r"); if(filelist == NULL) return fprintf(stderr,"Error opening filelist: %s\n",flst_name); } } if(filelist) { lexerctl.line=GetROStringVar("tplhead"); if(*lexerctl.line){ ASS_PRINT; } } wait=GetNumericVar("wait"); lexerctl.line=GetROStringVar("template"); flags=GetNumericVar("moduleoption"); if(!flags) flags=2; /*todo!! normal default*/ do{ if(filelist) { in_name=malloc(MAX_PATH+1); if(!fgets(in_name,MAX_PATH,filelist)) break; in_name[MAX_PATH]=0; /*in case we should get non zero line*/ tmp=strlen(in_name); if(in_name[tmp-1]==0xA||in_name[tmp-1]==0xD) in_name[tmp-1]=0; if(in_name[tmp-2]==0xA||in_name[tmp-2]==0xD) in_name[tmp-2]=0; SetStringVar("in",dup(in_name)); } else in_name=GetStringVar("in"); statistic.files_total++; NamePrepare(in_name); force_ext=GetROStringVar("force_ext"); ext=GetROStringVar("ext"); if(!STRCMP(ext,GetROStringVar("ignore"))){FREE(in_name);continue;} for( cnt=0; !processed_flag && (cnt < sizeof(modules) / sizeof(modules[0]) ); cnt++ ){ curr_ext = modules[cnt].mask; while( *curr_ext && !processed_flag){ if((!*force_ext && !STRCMP(curr_ext,ext))||!STRCMP(curr_ext,force_ext)){ file = fopen( in_name, "rb" ); /* one more ... */ /* if( !file || (int)file==-1 ) { */ if(file == NULL) { if(!filelist) return 1; }else{ fseek( file, 0, SEEK_END ); SetNumericVar( "size", ftell( file ) ); rewind( file ); processed_flag=modules[cnt].func( file , flags); fclose(file); } } curr_ext += strlen( curr_ext ) + 1; /* dirty hack. Heh (c) Guu */ } } if(processed_flag){ statistic.files_processed++; tmp=GetNumericVar("v1.l"); if(tmp) statistic.total_time+=tmp; else statistic.total_time+=GetNumericVar("a1.l"); tmp=GetNumericVar("v1.x"); if((!statistic.min_x||statistic.min_x>tmp)&&tmp) statistic.min_x=tmp; tmp=GetNumericVar("v1.y"); if((!statistic.min_y||statistic.min_y>tmp)&&tmp) statistic.min_y=tmp; tmp=GetNumericVar("v1.fpsH"); if((!statistic.min_fps||statistic.min_fps>tmp)&&tmp) statistic.min_fps=tmp; tmp=GetNumericVar("v1.bps"); if((!statistic.min_v_bps||statistic.min_v_bps>tmp)&&tmp) statistic.min_v_bps=tmp; tmp=GetNumericVar("a1.bps"); if((!statistic.min_a_bps||statistic.min_a_bps>tmp)&&tmp) statistic.min_a_bps=tmp; tmp=GetNumericVar("a1.freq"); if((!statistic.sound_hz||statistic.sound_hz>tmp)&&tmp) statistic.sound_hz=tmp; statistic.size+=GetNumericVar("size")/65536; ASS_PRINT; DelVar("stream.*"); DelVar("a#.*"); DelVar("v#.*"); DelVar("t#.*"); DelVar("d##.*"); } FREE(in_name); /*if(wait) sleep(wait);*/ }while(filelist); SetNumericVar("total.time",statistic.total_time); SetNumericVar("total.files",statistic.files_total); SetNumericVar("total.processed",statistic.files_processed); SetNumericVar("total.minx",statistic.min_x); SetNumericVar("total.miny",statistic.min_y); SetNumericVar("total.minfps",statistic.min_fps); SetNumericVar("total.minvbps",statistic.min_v_bps); SetNumericVar("total.minabps",statistic.min_a_bps); SetNumericVar("total.minfreq",statistic.sound_hz); SetNumericVar("total.size",statistic.size/16384); /*in Gb*/ if(filelist) { lexerctl.line=GetROStringVar("tplfoot"); if(*lexerctl.line){ ASS_PRINT; } } if(*outputname) fclose(output); return 0; } avinfo-1.0.a15+20090102/src/c_conv2.c0000644000175000017500000000164011043607330015102 0ustar stasstas/*just convert a plain text to c-string. Not tested, using only for AVInfo compilation */ /* LICENCE: Public domain , (c) George Shuklin, 2004 :-P */ #include #include int main(int argc, char* argv[]){ FILE* file=fopen(argv[1],"rb"); char* buffer; int size; int c; int state=0; if(file==NULL) return 32; fseek(file,0,SEEK_END); size=ftell(file); fseek(file,0,SEEK_SET); buffer=malloc(size+1); fread(buffer,size,1,file); buffer[size]=0; puts("{"); for(c=0;c<=size;c++){ if(buffer[c]==31) {state=!state; continue;} if( !buffer[c]) continue; switch(state){ case 0: switch(buffer[c]){ case '\\': printf("\\\\"); break; case '\n': break; case '"': printf ("\\\""); break; case 0: break; default: printf("%c",buffer[c]); } break; case 1: printf ("%c",buffer[c]); break; } } puts("\n};"); fclose(file); return 0; } avinfo-1.0.a15+20090102/src/Makefile0000644000175000017500000000220211043625332015042 0ustar stasstas# variables are defined in ../config.mk include ../config.mk OBJ=var.o config.o ass.tab.o avinfo.o common.o riff.o mpeg.o text.o codec.o ifo.o ogm.o mkv.o print.o avinfo: $(OBJ) $(CC) $(OBJ) -o avinfo config.o: config.c tpls $(CC) -c $(CFLAGS) config.c tpls: tpls.ass conv ./conv tpls.ass >tpls conv: c_conv2.c $(CC) $(CFLAGS) c_conv2.c -o conv var.o: var.c $(CC) -c $(CFLAGS) var.c ass.tab.o: ass.tab.c $(CC) -c $(CFLAGS) ass.tab.c ifeq ($(BISON),NONE) ass.tab.c: cp ./nobison/ass.tab.c ./nobison/ass.tab.h . else ass.tab.c: ass.y $(BISON) -d -v ass.y endif avinfo.o: avinfo.c $(CC) -c $(CFLAGS) avinfo.c common.o: common.c $(CC) -c $(CFLAGS) common.c print.o: print.c $(CC) -c $(CFLAGS) print.c riff.o: riff.c $(CC) -c $(CFLAGS) riff.c mpeg.o: mpeg.c $(CC) -c $(CFLAGS) mpeg.c text.o: text.c $(CC) -c $(CFLAGS) text.c codec.o: codec.c $(CC) -c $(CFLAGS) codec.c ifo.o: ifo.c $(CC) -c $(CFLAGS) ifo.c ogm.o: ogm.c $(CC) -c $(CFLAGS) ogm.c mkv.o: mkv.c $(CC) -c $(CFLAGS) mkv.c clean: rm -f $(OBJ) rm -f ass.output ass.tab.* tpls conv avinfo ldbg: common.o codec.o $(CC) print.c common.o codec.o avinfo-1.0.a15+20090102/src/mkv.c0000644000175000017500000002116011043013555014345 0ustar stasstas/************************************************************************* * mkv.c - Matroska reading code [part of AVInfo 1.x] * data format from * http://matroska.org/ * * Copyright (c) 2004 George Shuklin * * 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 (see the file COPYING); if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA or visit http://www.gnu.org/copyleft/gpl.html * *************************************************************************/ /* use a tabulation size 4 spaces for normal editig*/ #include "mkv.h" #define RD_BUFFER_SIZE 0x4000 #define MAX_STRING_SIZE 1024 int VINTparse(const unsigned char* buffer, const int start, const int end, int64 *result,const int flag){ /* VINT ( 㪠 ᬥ饭) int64, 頥 ࠧ (ᤢ), flag=0 - elementID, 1 - size*/ const unsigned char mask[8]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1}; const unsigned char imask[8]={0x7F,0x3F,0x1F,0xF,0x7,0x3,0x1,00}; int VINT_WIDTH; int c; if(end-start<2) {printf("debug: oops, out of buffer(%d)\n",start);return 0; /*ops*/} VINT_WIDTH=0; for(c=0;c<8;c++) if( !(buffer[start]&mask[c]) ) VINT_WIDTH++; else break; if(VINT_WIDTH>=8 || VINT_WIDTH+start+1>=end) {printf("debug: oops2\n");return 0;} *result=0; for(c=0;c=readed_bytes){ free(buffer); return 0; } }; /*skip text while EBML begin*/ /*main loop*/ do{ offs=ElementRead(buffer,p,readed_bytes,&eID,&eSize); p+=offs; if(!offs||p>=readed_bytes) break; for(c=0;creaded_bytes) break; /*TODO - add (if requied) suckup from file to buffer*/ if(eSize==4||eSize==8||eSize==1||eSize==2) value=(int)GetInt(buffer,p,eSize); switch(eID){ case MKVID_TrackType: /*detect a stream type (video/audio/text)*/ TrackType=value; pvt_look_flag=0; switch(TrackType){ case MKV_Track_video: v_c++; if(v_c>MAX_STREAMS) v_c=MAX_STREAMS; video[v_c][V_exist]=1; video[v_c][V_l]=(int)(Duration/1e+9*(float)timescale); curr_c=v_c; break; case MKV_Track_audio: a_c++; if(a_c>MAX_STREAMS) a_c=MAX_STREAMS; audio[a_c][A_exist]=1; audio[a_c][A_l]=(int)(Duration/1e+9*(float)timescale); curr_c=a_c; break; case MKV_Track_subtitle_orig: t_c++; TrackType=MKV_Track_subtitle; /*for normal use in lang array*/ if(t_c>MAX_STREAMS) t_c=MAX_STREAMS; curr_c=t_c; break; } break; case MKVID_DefaultDuration: /*fps detection*/ if(TrackType==MKV_Track_video&&v_c>=0){ DefaultDuration=value; if(DefaultDuration>100){ video[v_c][V_fpsH]=1000000000/DefaultDuration; /*DD in nano sec. fps=1s/DD*/ video[v_c][V_fpsL]=1000000000/(DefaultDuration/100)-100*video[v_c][V_fpsH]; } } break; case MKVID_Language: /*stream language*/ if(curr_c>=0&&TrackType<4&&eSize=0&&TrackType<4&&eSize=0&&eSize>=24){ /*CodecPrivate contains a BITMAPINFOHEADER structure due CodecID==V_MS/VFW/FOURCC*/ pvt_look_flag=0; video[v_c][V_cc]=(buffer[p+16]<<24)+(buffer[p+17]<<16)+(buffer[p+18]<<8)+buffer[p+19]; if(codec[v_c][MKV_Track_video]){ free(codec[v_c][MKV_Track_video]); codec[v_c][MKV_Track_video]=NULL; } } break; case MKVID_PixelWidth: /*pasthough*/ case MKVID_DisplayWidth: if(v_c>=0)video[v_c][V_x]=value; break; case MKVID_PixelHeight: /*pasthough*/ case MKVID_DisplayHeight: if(v_c>=0)video[v_c][V_y]=value; break; case MKVID_TimeCodeScale: timescale=GetInt(buffer,p,eSize); break; case MKVID_Duration: Duration=GetFloat(buffer,p,eSize); break; case MKVID_Channels: if(a_c>=0)audio[a_c][A_ch]=value; break; case MKVID_BitDepth: if(a_c>=0)audio[a_c][A_bits]=value; break; case MKVID_OutputSamplingFrequency: /*pasthough*/ case MKVID_SamplingFrequency: if(a_c>=0) audio[a_c][A_freq]=(int)GetFloat(buffer,p,eSize); break; case MKVID_Title: if(eSize>MAX_STRING_SIZE) break; title=mkstr(buffer,p,eSize); SetNumericVar("stream.d",1); SetNumericVar("d1.num",1); SetStringVar("d11.name","Title"); SetStringVar("d11.value",title); free(title); break; /*TODO case MKVID_Tags:*/ } p+=eSize;/*skip unknown or uninteresting*/ }while(1); AddAudioVideo(video,audio); tstr1=dup("dn.lang"); tstr2=dup("dn.cc"); if(tstr1&&tstr2){ for(c=0;c>17; int fr=mp3_freq_table[(scan&0xC00)>>10][mpeg_mp3_ver>>2]; int btr=mp3_bitrate_table[(scan&0xF000)>>12][mpeg_mp3_ver]*8000; if(!fr||!btr) {return 0;} *ch=((scan&0xC0)==0xC0?1:2); *bitrate=btr; *freq=fr; return 144*btr/fr+((scan&0x200)?1:0)-4; } int mpegparse ( FILE* file, int flags ){ #define GETC(a) do {if(pos0) SKIP(size); GETDW(sync); continue; } if ((sync&0xFFFFFC0)==0x0001C0){/* audio or video PES header*/ #ifdef MPEG_DEBUG printf ("got a a/v header at 0x%x, 0x%x\n",pos-4,sync); #endif GETW(size); /*PES packet length*/ if(!mpeg2){ size2=0; do{ GETC(temp); size2++;}while (temp==0xFF); if((temp&0xC0)==0x40) {SKIP(1);GETC(temp);size2+=2;} if(temp&0x20) SKIP(4);size2+=4; if(temp&0x10) SKIP(5);size2+=5; }else{/*if mpeg2*/ SKIP(2); GETC(size2); SKIP(size2); size2+=3; } GETDW(temp); if(sync&0x20){ /*video*/ vids_n=sync&0xF; #ifdef MPEG_DEBUG printf("found video #%d, signature=0x%x\n",sync&0xF,temp); #endif found_v=1; if(vids_n>MAX_STREAMS) {free(buffer);return 0;} if( temp==MPEG_PICTURE_SEQUENCE){ if(pos>MAX_READING_BYTES-12) break; vids[vids_n].exist=1; vids[vids_n].exist=1; vids[vids_n].x=(buffer[pos++]<<4); vids[vids_n].y=((buffer[pos++]&0xF)<<8); vids[vids_n].y+=(buffer[pos++]); vids[vids_n].aspect=(buffer[pos]&0xF0)>>4; vids[vids_n].fps=(buffer[pos++]&0x0F); vids[vids_n].bitrate=(buffer[pos++]<<10); vids[vids_n].bitrate+=(buffer[pos++]<<2); vids[vids_n].bitrate+=(buffer[pos++]&0xC0); vids[vids_n].bitrate*=400; common_bitrate+=vids[vids_n].bitrate; } }else { auds_n=sync&0x1F; #ifdef MPEG_DEBUG printf("found audio #%d\n",sync&0x1F); #endif found_a=1; if(auds_n>MAX_STREAMS) {break;} if((temp&0xFFF00000)==0xFFF00000){ if(GetMP3FrameData(temp,&auds[auds_n].bitrate,&auds[auds_n].freq,&auds[auds_n].ch)){ auds[auds_n].exist=1; common_bitrate+=auds[auds_n].bitrate; } } } if(size-size2-4>0) SKIP(size-size2-4); GETDW(sync); continue; } if((sync&0xFFFFFF00)==0x100){ /*skip all others header*/ GETW(size); if(size>0) SKIP(size); GETDW(sync); continue; } INSC(sync); } } size=GetNumericVar("size"); temp=(int)((double)size*8/(double)(common_bitrate?common_bitrate:0xFFFFFFFF)); for(c=0;cb?a:b #define SPACE ' ' #define MAX_ALLOWED_CACHED_LINE_SIZE 1048576 linecache* InitLineCache(FILE* handler, int max_size, int cropflag){ /*create a record for cache*/ linecache *retval=malloc(sizeof(linecache)); if(!retval) return NULL; retval->handler=handler; retval->line=malloc(MAX(DEFAULT_LINE_BUFFER_SIZE,max_size)); if(!retval->line){FREE(retval);return NULL;} retval->allocated=MAX(DEFAULT_LINE_BUFFER_SIZE,max_size); retval->line[0]=0; retval->max_size=max_size; retval->last_pos=0; retval->cropflag=cropflag; return retval; } int ExpandTab(linecache* l){ /*convert tabs in cached line to 'justify' aligniment line.*/ int tab[MAX_TAB_SUPPORT]; int tab_c=0; int p; int pn=0; int pad_size; int last_pad_size; char *templine=0; int c; if(!l) return 0; if(!l->line) return 0; if(!l->last_pos) return 1;/*nothing to do*/ if(!l->max_size) return 1;/*nothing to do*/ if(l->max_size < l->last_pos ) {return 0;/*oops*/} memset(tab,0,sizeof(tab)); for(p=0;plast_pos;p++) if(l->line[p]=='\t') tab[tab_c++]=p; if(!tab_c) return 1; /*nothing to do*/ pad_size=(l->max_size-l->last_pos+tab_c)/tab_c; last_pad_size= l->max_size - l->last_pos + tab_c - pad_size*(tab_c-1); templine=malloc(l->max_size); if(!templine)return 0;/*big ooooops*/ if(tab[0]) memcpy(templine,l->line,tab[0]); pn=tab[0]; memset(templine+pn,SPACE,tab_c>1?pad_size:last_pad_size); pn+=tab_c>1?pad_size:last_pad_size; for(c=1;cline+tab[c-1]+1,tab[c]-tab[c-1]-1); pn+=tab[c]-tab[c-1]-1; memset(templine+pn,SPACE,clast_pos){ memcpy(templine+pn,l->line+tab[tab_c-1]+1,l->last_pos-tab[tab_c-1]-1); pn+=l->last_pos-tab[tab_c-1]-1; } templine[pn]=0; free(l->line); l->line=templine; l->last_pos=pn; return 2; /*ok, replacement finished*/ } void ClearNonprintable(char* line, char replace){ /*replace all nonprintable character in line with 'replate' char, replace should not be a zero*/ int c; for(c=0;line[c];c++) if((line[c]<32)&&line[c]!='\n'&&line[c]!='\r'&&line[c]!='\t') line[c]=replace; /*is \r requed for *nix?*/ } int FlushLineCache(linecache* l){ /*print unprinted in cache, reset line*/ int errorcode=0; if(!l) return 0; if(!l->handler||!l->line)return 0; if(!ExpandTab(l)) return 0; l->line[l->last_pos]=0; ClearNonprintable(l->line,' '); errorcode=fprintf(l->handler,"%s",l->line); if(errorcode){ l->last_pos=0; l->line[0]=0; } return errorcode;/*ok*/ } int CloseLineCache(linecache* l){ /*print unprinted, delete cache*/ int errorcode=1; errorcode=FlushLineCache(l); FREE(l->line); FREE(l); return errorcode; } int AddStringToLineCache(linecache *l, const char* line){ int p; signed int begin=0; signed int end=0; int alloc_request; int len=strlen(line); if(!len)return 0; /* printf("debug ASTLC: (%d) %s",*line,line);*/ for(p=0;p curr.begin*/ end=p+1; if(l->last_pos+end-beginmax_size ||!l->max_size||line[begin]=='\n'){ if(end-begin+l->last_pos>=l->allocated){/*buffer incresize*/ alloc_request=(end-begin+l->last_pos)/DEFAULT_LINE_BUFFER_SIZE+1; if(alloc_request>MAX_ALLOWED_CACHED_LINE_SIZE/DEFAULT_LINE_BUFFER_SIZE) return 0; l->line=realloc(l->line,alloc_request*DEFAULT_LINE_BUFFER_SIZE); if(!l->line)return 0; } memcpy(l->line+l->last_pos,line+begin,end-begin); l->line[l->last_pos+end-begin]=0; l->last_pos+=end-begin; FlushLineCache(l); } else{/*TODO warp*/} } } if(end!=len){ if(l->last_pos+len-endmax_size ||!l->max_size||line[len-1]=='\n'){ memcpy(l->line+l->last_pos,line+end,len-end); l->line[l->last_pos+len-end]=0; l->last_pos+=len-end; } } return 1; } int in_crc_check(char* from, char* to){ char* p=from; if(from>to) return 0; /*hmm..*/ while(p<=to){ if(!( (*p>='a'&&*p<='f') || (*p>='A'&&*p<='F') || (*p>='0'&&*p<='9') )) return 0; p++; } return 1; /*crc!*/ } char* name_clean(char* line){ int l=strlen(line); char* buffer=malloc(l+9); char *p=buffer; int c; memcpy(buffer,line,l+1); buffer[l+7]=0; while(*p){ if( (*p=='['&&*(p+9)==']') || (*p=='('&&*(p+9)==')') ) { if (in_crc_check(p+1,p+8)) fill(p,10,'_'); } if( ((*p=='_'||*p==' ')&&(p[9]==')'||p[9]==']')) || ((*p=='('||*p=='[')&&(p[9]=='_'||p[9]==' ')) ) if(in_crc_check(p+1,p+8)) fill(p+1,8,'_'); if(*p==' '&&p!=buffer) *p='_'; p++; } c=0; for(p=buffer;*p;p++){ if(*p=='_'&&p[1]=='_') continue; if(*p=='_'&&p[1]=='.'&&p!=buffer) continue; if(*p==']'&&(p[1]=='_'||p[1]==' ')){ line[c++]=*p; p++; continue; } if(*p=='_'&&p[1]=='-'&&p[2]=='_'){p++;continue;} if(*p=='_'&&p!=buffer) line[c]=' '; else line[c]=*p; c++; } line[c]=0; FREE(buffer); return line; } const char* print_mode(const var_t var, const int mode_prn){ static char buffer[257]; int mod=1024; int div=1; int nH,nL; int h,m,s; int ct_flag=0; char *tmp_p; int E=0; /*end char, K,M,G*/ *buffer=0;/*luchshe perebded, chem nedobled ^-~*/ if (var.type==t_STRING){ if(mode_prn==PRINT_MODE_SHORT_NAME) { return name_clean(var.string);/*short_name(buffer,var.string)*/; } return var.string; } switch(mode_prn){ /*numeric processing*/ case PRINT_MODE_NORMAL: if(var.number) sprintf(buffer,"%d",var.number); return buffer; case PRINT_MODE_M1000: mod=1000; /*passthrow*/ case PRINT_MODE_M1024: if(var.number>=mod*mod*mod) { div=mod*mod*mod; E='G'; }else if(var.number>=mod*mod){ div=mod*mod; E='M'; }else if(var.number>mod){ div=mod; E='K'; } nH=(int)var.number/(int)div; nL=(var.number-nH*div)/(div<=mod?mod:div/mod*100); if(!(nL%10)) nL=nL/10; if(nH>20||!nL)sprintf(buffer,"%d%c",nH,(char)E); else sprintf(buffer,"%d.%d%c",nH,nL,(char)E); return buffer; case PRINT_MODE_HEX: sprintf(buffer,"%x",var.number); return buffer; case PRINT_MODE_FCC: buffer[0]=var.number&0x000000FF; buffer[1]=(var.number&0x0000FF00)>>8; buffer[2]=(var.number&0x00FF0000)>>16; buffer[3]=(var.number&0xFF000000)>>24; buffer[4]=0; return buffer; case PRINT_MODE_COMPACT_TIME: ct_flag=1; /*passthrow*/ case PRINT_MODE_TIME: h=var.number/3600; m=(var.number%3600)/60; s=var.number-h*3600-m*60; if(!ct_flag) sprintf(buffer,"%02d:%02d:%02d",h,m,s); else{ tmp_p=buffer; if(h) tmp_p+=sprintf(tmp_p,"%dh",h); if(h<10&&m) tmp_p+=sprintf(tmp_p,"%dm",m); if(!h&&m<10&&s) sprintf(tmp_p,"%ds",s); } return buffer; case PRINT_MODE_CODEC_NAME: return fcctoa(var.number); break; default: sprintf(buffer,"%d",var.number); } return buffer; } int PrintVarToLineCache(linecache*l, const int mode_prn,const var_t var){ char const *tmp_buff; tmp_buff=print_mode(var,mode_prn); AddStringToLineCache(l,tmp_buff); return 1; } avinfo-1.0.a15+20090102/src/riff.c0000644000175000017500000001672611043651607014520 0ustar stasstas/************************************************************************* * riff.c AVI headers reading code [part of AVInfo 1.x] * * Copyright (c) 2003 George Shuklin * * 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 (see the file COPYING); if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA or visit http://www.gnu.org/copyleft/gpl.html * *************************************************************************/ #include "avinfo.h" #define MAX_ALLOWED_AVI_HEADER_SIZE 131072 #define SAFE_PAD 128 #define FRAME_SIZE 65536 #define b2DW(value,buffer,offset) value=buffer[offset]+(buffer[offset+1]<<8)+(buffer[offset+2]<<16)+(buffer[offset+3]<<24); #define b2DWv(buffer,offset) buffer[offset]+(buffer[offset+1]<<8)+(buffer[offset+2]<<16)+(buffer[offset+3]<<24) #define b2Wv(buffer,offset) buffer[offset]+(buffer[offset+1]<<8) #define b2DWi(value,buffer,offset) {value=buffer[offset++];value+=buffer[offset++]<<8;value+=buffer[offset++]<<16;value+=buffer[offset++]<<24;} #define INSb(value,buffer,offset) {value=((value>>8)+((buffer[offset++])<<24));} const unsigned char patterns[4][12]={ "LIST\0\0\0\0hdrl", "LIST\0\0\0\0INFO", "LIST\0\0\0\0movi", "idx1\0\0\0\0\0\0\0\0" }; const unsigned char avi_signature[12]="RIFF\0\0\0\0AVI "; int riffparse(FILE* file, int s){ unsigned char scan[12]; unsigned int video[MAX_STREAMS][VIDEO_INFO_SIZE]; unsigned int audio[MAX_STREAMS][AUDIO_INFO_SIZE]; unsigned char *buffer=NULL; unsigned int pos; unsigned char error_status=1; /*critical error flag*/ unsigned char c; unsigned int size; unsigned int movi_size=0; unsigned int fcc=0; unsigned int a_c=0; unsigned int v_c=0; unsigned int type=0; unsigned int scale=0; unsigned int rate=0; unsigned int length=0; unsigned int cont=1; double fps=0; unsigned int frame_size=0; unsigned int readed_bytes=0; unsigned int temp=0; unsigned int bps[MAX_STREAMS][3]; unsigned int common_data=0; unsigned int entr=0;/*todel!*/ char *desc_name=NULL; char *desc_value=NULL; unsigned int desc_size=0; unsigned int d_c=0; memset(video,0,sizeof(video)); memset(audio,0,sizeof(audio)); memset(bps,0,sizeof(bps)); if(!fread(scan,12,1,file)) return 0; if(advmemcmp(scan, avi_signature,12)) return 0; /*non avi file*/ while(cont){ if(!fread(scan,12,1,file)){cont=0;continue;} b2DW(size,scan,4); if(size<4) size=4; for(c=0;c<4;c++) if(!advmemcmp(scan,patterns[c],12)) break; switch(c){ case 0: /*header reading*/ if(size>MAX_ALLOWED_AVI_HEADER_SIZE) return 0; /*header too big*/ buffer=malloc(size+SAFE_PAD-4); if(!buffer) return 0; memset(buffer+size-4,SAFE_PAD-4,0); if(!fread(buffer,size-4,1,file)) {cont=0;continue;} pos=76; b2DWi(fcc,buffer,pos); while(pos=MAX_STREAMS)v_c=MAX_STREAMS-1; break; case FOURCC_auds: audio[a_c][A_cc]=b2Wv(buffer,pos+4); audio[a_c][A_ch]=b2Wv(buffer,pos+6); audio[a_c][A_freq]=b2DWv(buffer,pos+8); audio[a_c][A_bits]=b2Wv(buffer,pos+18); audio[a_c][A_exist]=1; audio[a_c][A_l]=length; pos+=22; error_status=0; a_c++; if(a_c>=MAX_STREAMS)a_c=MAX_STREAMS-1; break; } fcc=0; break; } INSb(fcc,buffer,pos); } FREE(buffer); continue; case 1: /*INFO reading*/ if(size>MAX_ALLOWED_AVI_HEADER_SIZE){ fseek(file,size-4,SEEK_CUR); continue; } if(size<16) continue; buffer=malloc(size); if(!buffer) continue; if(!fread(buffer,size-4,1,file)){FREE(buffer);continue;} pos=0; while(possize-pos) desc_size=size-pos-1; desc_value=malloc(desc_size+1); desc_name=malloc(5); if(!desc_value||!desc_name) break; memcpy(desc_value,buffer+pos+8,desc_size); memcpy(desc_name,buffer+pos,4); desc_name[4]=0; desc_value[desc_size]=0; if(strcmp(desc_name,"ISFT")){/*skip 'Software' entry */ d_c++; SetIdxStringVar("d1%d.name",d_c,desc_name); SetIdxStringVar("d1%d.value",d_c,desc_value); } pos+=8+desc_size; } if(d_c){ SetNumericVar("d1.num",d_c); SetNumericVar("stream.d",1); } FREE(buffer); continue; case 2: /*movi skip*/ movi_size=size; break; case 3: /*idx1 processing*/ if(sizeframe_size){ readed_bytes+=pos; if(size-readed_bytes-pos'9') {pos+=16;continue; /*skip invalid*/} if(buffer[pos+2]=='d'||buffer[pos+2]=='w'){ bps[temp][0]=buffer[pos+2]; bps[temp][1]++; bps[temp][2]+=b2DWv(buffer,pos+12); } if(!(buffer[pos+4]&0x1)||!(buffer[pos+5]&0x1)) common_data+=b2DWv(buffer,pos+12)+8; /*summ data ,'rec' list, non timing frames ignoring, */ entr++; pos+=16; } a_c=0; v_c=0; for(temp=0;tempMAX_READ_TRY) break; if(!fread(buffer,1023,1,file)) break; try_count++; buffer[1023]=0; pointer=buffer; while(*pointer){ if(*pointer>128) GT_128++; if(*pointer<32 && *pointer!='\x09' && *pointer!='\x0D' && *pointer!='\x0A') bin++; total++; pointer++; } }while(!feof(file)); GT_128++; total++; if(bin>5){ SetStringVar("t1.lang", dup("binary")); } else{ if(total/GT_128<5){ SetStringVar("t1.lang",dup("non-eng")); } else{ SetStringVar("t1.lang",dup("eng")); } } return 1; } avinfo-1.0.a15+20090102/src/avinfo.10000644000175000017500000000562411043015333014753 0ustar stasstas.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. .TH AVINFO "1" "April 2005" "AVInfo 1.0 alpha 15 [Balalaika]" "User Commands" .SH NAME AVInfo \- Audio/Video file information automatic extractor .SH SYNOPSIS .B avinfo [\fIFILENAME\fR] [\fIOPTIONS\fR] [\fITEMPLATE\fR] [\fIOUTPUT\fR] .br .B avinfo [\fI-l=FILELIST\fR] [\fIOPTIONS\fR] [\fITEMPLATE\fR] [\fIOUTPUT\fR] .br .B avinfo \fI-l- \fR[\fIOPTIONS\fR] [\fITEMPLATE\fR] [\fIOUTPUT\fR] .br .B avinfo [\fI--help | --version\fR] .SH DESCRIPTION Extracts information from FILENAME or files in FILELIST and generates a report. .SS "OPTIONS:" .TP \fB\-f\fR=\fIextension\fR forces the use of module associated with extension .TP \fB\-l\fR=\fIlist\fR use filelist (use \fB\-l\-\fR for stdin) .TP \fB\-i\fR=\fIms\fR delay between files in filelist (in ms) (/*TODO*/) .TP \fB\-e\fR=\fIext\fR exclude an extension (do not apply associated module) .TP \fB\-m\fR=\fInumber\fR max line length (0 \- no restriction) .TP \fB\-s\fR=\fIvalue\fR for advanced tuning of modules (/*TODO*/) .TP \fB\-v\fR=\fIname=value\fR set int. variable 'name' to 'value' (text or number) .SS "External TEMPLATEs:" .TP \fB\-th\fR=\fItemplate\fR header template (string, use without value to disable) .TP \fB\-thf\fR=\fIfilename\fR get header template from a file .TP \fB\-tb\fR=\fItemplate\fR body template (string, use without value to disable) .TP \fB\-tbf\fR=\fIfilename\fR get body template from a file .TP \fB\-tf\fR=\fItemplate\fR footer template (string, use without value to disable) .TP \fB\-tff\fR=\fIfilename\fR get footer template from a file .SS "Built-in TEMPLATEs:" .TP \fB\-\-default\fR used by default .TP \fB\-\-description\fR for creating (updating) descrpipt.ion files .TP \fB\-\-list\fR for filelist (plain text) generation .TP \fB\-\-html\-list\fR for filelist (html) generation .TP \fB\-\-csv\-list\fR for filelist (CSV, e.g. for Excel) .TP \fB\-\-short\fR alt. version of \fB\-\-default\fR template .TP \fB\-\-far\fR "nice" formated report (for FAR Manager) (contains MS\-DOS pseudographic characters) .SS "OUTPUT:" .TP \fB\-o\fR=\fIfile\fR file to write the report to (default is stdout) .SS "Other OPTIONS:" .TP \fB\-\-help\fR prints this help page .TP \fB\-\-version\fR prints avinfo version and copyright .PP You can use ':' instead of '=' in all OPTIONS or just omit it. .br TEMPLATEs use AVInfo Simple Script (A.S.S.) syntax. .PP .SS Examples of commands: avinfo file.ogm \fB\-\-raw\fR .br find . \fB\-name\fR '*.avi' \fB\-print\fR | avinfo \fB\-l\-\fR \fB\-\-html\-list\fR \fB\-o\fR=\fIavilist\fR.html .br avinfo \fB\-l\fR:list \fB\-thf\fR:header \fB\-tbf\fR=\fIbody\fR \fB\-tff\fR=\fIfooter\fR >report .SH "SEE ALSO" Additional documentation for .B AVInfo can be found in the package documentation directory. .PP (c) George Shuklin, 2001\-2004, http://shounen.ru/soft/avinfo/ .br This is free software. You are welcome to redistribute it under the terms and conditions of GNU General Public License. avinfo-1.0.a15+20090102/src/config.c0000644000175000017500000002327011043013555015021 0ustar stasstas/************************************************************************* * config.c configuration and CMD line reading [part of AVInfo 1.x] * * Copyright (c) 2003 George Shuklin * * 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 (see the file COPYING); if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA or visit http://www.gnu.org/copyleft/gpl.html * *************************************************************************/ #include "avinfo.h" typedef struct{ char* tpl_name; int maxlength; int moduleoption; char* head; char* template; char* foot; }template_list_t; template_list_t template_list[]= #include "tpls" /*include preprocessed templates from tpls/tpls.ass */ const char* version_message = AVINFO_SIGNATURE " " AVINFO_VERSION " " AVINFO_SUBNAME "\n\n" "(c) George Shuklin, 2001-2004, http://shounen.ru/soft/avinfo/\n\ This is free software. You are welcome to redistribute it under\n\ the terms and conditions of GNU General Public License."; const char* help_message="\ Usage:\t avinfo [FILENAME] [OPTIONS] [TEMPLATE] [OUTPUT]\n\ or: \t avinfo [-l=FILELIST] [OPTIONS] [TEMPLATE] [OUTPUT]\n\ or: \t avinfo -l- [OPTIONS] [TEMPLATE] [OUTPUT]\n\ or: \t avinfo [--help | --version]\n\ Extracts information from FILENAME or files in FILELIST and generates a report.\n\ \n\ OPTIONS:\n\ \t-f=extension forces the use of module associated with extension\n\ \t-l=list use filelist (use -l- for stdin)\n\ \t-i=ms delay between files in filelist (in ms) (/*TODO*/)\n\ \t-e=ext exclude an extension (do not apply associated module)\n\ \t-m=number max line length (0 - no restriction)\n\ \t-s=value for advanced tuning of modules (/*TODO*/)\n\ \t-v=name=value set int. variable 'name' to 'value' (text or number)\n\ \n\ External TEMPLATEs:\n\ \t-th=template header template (string, use without value to disable)\n\ \t-thf=filename get header template from a file\n\ \t-tb=template body template (string, use without value to disable)\n\ \t-tbf=filename get body template from a file\n\ \t-tf=template footer template (string, use without value to disable)\n\ \t-tff=filename get footer template from a file\n\ \n\ Built-in TEMPLATEs:\n\ \t--default used by default\n\ \t--description for creating (updating) descrpipt.ion files\n\ \t--list for filelist (plain text) generation\n\ \t--html-list for filelist (html) generation\n\ \t--csv-list for filelist (CSV, e.g. for Excel)\n\ \t--short alt. version of --default template\n\ \t--far \"nice\" formated report (for FAR Manager)\n\ \t (contains MS-DOS pseudographic characters)\n\ \n\ OUTPUT:\n\ \t-o=file file to write the report to (default is stdout)\n\ \n\ Other OPTIONS:\n\ \t--help prints this help page\n\ \t--version prints avinfo version and copyright\n\ \n\ You can use ':' instead of '=' in all OPTIONS or just omit it.\n\ TEMPLATEs use AVInfo Simple Script (A.S.S.) syntax.\n\ \n\ Examples of commands:\n\ avinfo file.ogm --raw\n\ find . -name '*.avi' -print | avinfo -l- --html-list -o=avilist.html\n\ avinfo -l:list -thf:header -tbf=body -tff=footer >report\n\ "; typedef struct{ char* name; int value; }constants_t; void ImportConstants(){ const constants_t consts[]={ {"AVInfo",10006}, {"m1000",PRINT_MODE_M1000}, {"m1024",PRINT_MODE_M1024}, {"hex",PRINT_MODE_HEX}, {"fcc",PRINT_MODE_FCC}, {"ct",PRINT_MODE_COMPACT_TIME}, {"sn",PRINT_MODE_SHORT_NAME}, {"time",PRINT_MODE_TIME}, {"cn", PRINT_MODE_CODEC_NAME}, {"maxlist",77}, {"sotona",0x29A}, {"DIV3",FOURCC_DIV3}, {"XVID",FOURCC_XVID}, {"DIVX",FOURCC_DIVX}, {"DX50",FOURCC_DX50} }; int c; for (c=0;cMAX_CONF_FILE_SIZE){ fprintf(stderr,"Template file %s too large (>64k). Loaded parially.\n",filename); size=65536; } buffer=malloc(size+1); readed=fread(buffer,1,size,OptFile); if(!readed){ fprintf(stderr,"Error loading %s template, %d readed\n",filename,readed); fclose(OptFile); FREE(buffer); return NULL; } fclose(OptFile); buffer[size]=0; return buffer; } int SetConfig(int argc, char* argv[]){ /* reading command line parameters*/ char* tpl_name="default"; char* tmp_buff=NULL; char* filelist=NULL; int t_h_flag=0; int t_f_flag=0; int t_b_flag=0; int flag=0; int c;/*just a counter*/ int c2; int maxlength=-1; int moduleoption=0; int temp=0; char* templine; /**************** patched here ******************/ /* does anybody really need that "error in command line" message in the situation below? I think nobody needs that... */ /* if(argc<2) return puts(help_message); */ if(argc<2 || strcmp("--help", argv[1]) == 0) { puts(help_message); return 0; } /* every good program must respond to --help and --version A dirty hack could be to implement them as templates :) but that will probably insult Gosha Shuklin to death ;) */ if(argc==2 && strcmp("--version", argv[1]) == 0) { puts(version_message); return 0; } /*************************************************/ ImportConstants(); for(c=1;c Copyright (C) 19yy - 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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. , 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. avinfo-1.0.a15+20090102/README0000644000175000017500000000330411043630102013466 0ustar stasstasThis document describes how to install avinfo-1.0.a15 on a *nix system. Prerequisites: ------------- First of all, you will need a working C compiler and the MAKE utility. GCC and GNU make are recommended. Commands in the making rules assume Bourne shell (sh or bash) syntax. You will need it most likely. If you want the A.S.S. parsing code to be generated locally, you will need BISON parser generator. Berkley's YACC will not work because it lacks %pure_parser. To do the installation you will need the INSTALL program. Installation: ------------ 1. Edit the variables defined in config.mk. The names are self-explanatory so I am not going to talk much about that here. If you do not have BISON or do not want parser code to be generated locally define BISON variable as NONE. 2. In the directory where you extracted the package run $ make; su -c "make install" To uninstall the package start in the same directory $ su -c "make uninstall" Where to find the docs: ---------------------- The docs are installed by default to $(PREFIX)/share/doc/avinfo-$(VER). If you do not understand Russian you will find them not very useful at the moment. Read the man page (man avinfo) or look for examples given in the docs. Basically, generating a list of your avi files can be as simple as $ find . -name '*.avi' -print | avinfo -l- --list > avi.list Credits: ------- AVInfo has been written by George Shuklin. The A.S.S. code has been written also by him from scratch after an inspiration he got from a simple parsing code written by Stanislav Maslovski. The *nix package has been created by Stanislav Maslovski. Contact: ------- George Shuklin: gs@shounen.ru, http://shounen.ru/ Stanislav Maslovski: stanislav.maslovski@gmail.com avinfo-1.0.a15+20090102/config.mk0000644000175000017500000000203511127442370014417 0ustar stasstas# This file configures avinfo Makefiles. You should edit the settings # below as needed. # ---------------------- Compilation options ---------------------- # Set the C compiler to use, and options for it. # Also select a bison-compatible parser generator, if none set NONE CC=gcc CFLAGS=-O2 -Wall BISON=bison #BISON=NONE # --------------------- Installation options ---------------------- # Set BINDIR to directory for binaries, # DOCDIR to directory for documentation files, # MANDIR to directory for man page. PREFIX=/usr/local #PREFIX=$(HOME) BINDIR=$(PREFIX)/bin DOCDIR=$(PREFIX)/share/doc MANDIR=$(PREFIX)/share/man/man1 # To explicitely set file ownership and permissions edit the # lines below. These will be added to the install cmds in Makefile. #BINPERM=-m 755 -o root -g root BINPERM= DIRPERM=$(BINPERM) #DOCPERM=-m 644 -o root -g root DOCPERM= # ----------------- NO CONFIGURABLE OPTIONS BELOW ----------------- # do not touch anything here except you know what you are doing! VER=1.0.a15 SHELL=sh override CFLAGS+=-funsigned-char avinfo-1.0.a15+20090102/Makefile0000644000175000017500000000116411043625343014263 0ustar stasstas# top-level Makefile for avinfo # Edit config.mk with respect to your needs! include config.mk # targets: # # all # install # uninstall # clean all: cd src && $(MAKE) install: all install -d $(DIRPERM) $(BINDIR) $(MANDIR) install $(BINPERM) -s ./src/avinfo $(BINDIR) install $(DOCPERM) ./src/avinfo.1 $(MANDIR) install -d $(DIRPERM) $(DOCDIR)/avinfo-$(VER)/doc install $(DOCPERM) \ CHANGELOG README copying $(DOCDIR)/avinfo-$(VER) install $(DOCPERM) ./doc/* $(DOCDIR)/avinfo-$(VER)/doc uninstall: rm -f $(BINDIR)/avinfo rm -f $(MANDIR)/avinfo.1 rm -r -f $(DOCDIR)/avinfo-$(VER) clean: cd src && $(MAKE) clean