flex never-interactive

flex파일을 컴파일 하여 실제 코드에서 사용하려고 하다보면 종종 희안한? 오류를 경험하게 되는데…
unistd.h가 없다고 해서 c스타일로 컴파일 하면 이내 isatty가 없다고 징징거린다…
문제는 Visual Studio 2005이후 이 isatty가 _isatty로 사용하도록 바뀌었기 때문에 그냥은 안되는데…
결국, 이 함수 호출이 없도록 옵션 조절을 하여 회피하는 방법으로 문제를 해결해야 된다…

http://stackoverflow.com/questions/2793413/unistd-h-related-problem-when-compiling-bison-flex-program-under-vc

isatty is used by the lexer to determine if the input stream is a terminal or a pipe/file. The lexer uses this information to change its caching behavior (the lexer reads large chunks of the input when it is not a terminal). If you know that your program will never be used in an interactive kind, you can add %option never-interactive to you lexer. When the program is run with user input, use %option interactive. When both uses are desired, you can either generate an interactive lexer, which gives a performance loss when used in batch mode, or provide your own isatty function.

Leave a Reply