nim-lang / c2nim

c2nim is a tool to translate Ansi C code to Nim. The output is human-readable Nim code that is meant to be tweaked by hand before and after the translation process.
MIT License
509 stars 63 forks source link

Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect] #276

Open mantielero opened 6 months ago

mantielero commented 6 months ago

When parsing avcodec.h and the following ffmpeg.c2nim:

#ifdef C2NIM
#def av_const
#def av_always_inline 
#def av_pure
#pp AV_HAVE_BIGENDIAN
#pp FF_API_OLD_CHANNEL_LAYOUT
#def attribute_deprecated
#def av_warn_unused_result
#def AV_PIX_FMT_NE

#endif
#def FF_API_R_FRAME_RATE TRUE
#ifdef C2NIM
#@
template AV_PIX_FMT_NE*(be, le: untyped):untyped  =
  `AV_PIX_FMT le`
@#
#endif

with the command line:

c2nim  --skipinclude --header --skipcomments --out:avcodec/avcodec.nim ffmpeg.c2nim ../FFmpeg-release-6.1/libavcodec/avcodec.h

I get the following error:

...
FFmpeg-release-6.1/libavcodec/avcodec.h(2119, 18) Warning: comment '< neither convert the subtitles, nor check them for valid UTF-8' ignored [CommentXIgnored]
fatal.nim(53)            sysFatal
Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]