summaryrefslogtreecommitdiffstats
path: root/parser-cfg.c
Commit message (Collapse)AuthorAgeFilesLines
* parser-cfg: specify which config file contains the unknown optioncantabile2012-08-201-2/+2
| | | | Also add some punctuation to the warning message.
* options: get rid of ambiguous option parsingwm42012-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Options parsing used to be ambiguous, as in the splitting into option and values pairs was ambiguous. Example: -option -something It wasn't clear whether -option actually takes an argument or not. The string "-something" could either be a separate option, or an argument to "-option". The code had to call the option specific parser function to resolve this. This made everything complicated and didn't even have a real use. There was only one case where this was actually used: string lists (m_option_type_string_list) and options based on it. That is because this option type actually turns a single option into a proxy for several real arguments, e.g. "vf*" can handle "-vf-add" and "-vf-clr". Options suffixed with "-clr" are the only options of this group which take no arguments. This is ambiguous only with the "old syntax" (as shown above). The "new" option syntax always puts option name and value into same argument. (E.g. "--option=--something" or "--option" "--something".) Simplify the code by making it statically known whether an option takes a parameter or not with the flag M_OPT_TYPE_OLD_SYNTAX_NO_PARAM. If it's set, the option parser assumes the option takes no argument. The only real ambiguity left, string list options that end on "-clr", are special cased in the parser. Remove some duplication of the logic in the command line parser by moving all argument splitting logic into split_opt(). (It's arguable whether that can be considered code duplication, but now the code is a bit simpler anyway. This might be subjective.) Remove the "ambiguous" parameter from all option parsing related code. Make m_config unaware of the pre-parsing concept. Make most CONF_NOCFG options also CONF_GLOBAL (except those explicitly usable as per-file options.)
* mplayer: never exit mplayer from within the play loopwm42012-08-041-1/+1
| | | | | | | | | | | | | | | | | The only place exit_player() should be called is the main() function. exit_player() should be the only function allowed to call exit(). This makes it easier to guarantee proper deinitialization, and allows using the --leak-report flag without showing false positives. The quit slave command now sets a flag only. It uses the same mechanism that's normally used to advance to the next file on the playlist, so the rest of the playback path should be able to react to the quit command quickly enough. That is, the player should react just as fast to quit requests in practice as before this commit. In reinit_audio_chain(), the player was actually exited if init_audio_filters() failed. Reuse the normal error handling path to handle this condition.
* windows support: unicode filenameswm42012-03-091-0/+2
| | | | | | | | | | | | | | | | | | | Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this.
* build: fix --enable-debug, remove some "#ifdef MP_DEBUG"Uoti Urpala2011-07-301-10/+0
| | | | | | | | | | | Recent commit 5d5ca22a6d ("options: commandline: accept --foo=xyz style options") left some bad code under "#ifdef MP_DEBUG" in playtree.c, which caused a compilation failure if configured with "--enable-debug". Fix this. Having the "#ifdef MP_DEBUG" there was completely unnecessary; it only increased the risk for this kind of problems for no real benefit - executing the asserts under it would have no noticeable performance or other penalty in default builds either. Remove several cases of such harmful "#ifdef MP_DEBUG".
* options: change option parsing to use bstrUoti Urpala2011-07-291-1/+1
| | | | | | Using bstr allows simpler parsing code, especially because it avoids the need to modify or copy strings just to terminate extracted substrings.
* cosmetics: parser-cfg.c: reformatUoti Urpala2011-07-291-208/+208
|
* options: indicate ambiguous option parameters explicitlyUoti Urpala2011-07-291-1/+1
| | | | | | | | Command line options like "-foo xyz" are ambiguous: "xyz" may be a parameter to the option "foo" or an unrelated argument. Instead of relying on the struct m_config mode field (commandline/file) pass parameters to specify ambiguous mode explicitly. Meant for "--foo" options which are never ambiguous on command line either.
* options: move command line preparse together with parseUoti Urpala2011-07-261-40/+0
|
* Add license header to all top-level files missing them.diego2010-01-301-0/+17
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move variable declaration into block where it is used and make it const.reimar2009-08-311-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29602 b3059339-0415-0410-9bf9-f77b7e298cf2
* Make m_config_parse_config_file file name argument constreimar2009-08-311-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29601 b3059339-0415-0410-9bf9-f77b7e298cf2
* whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Replace the trivial command line preparser with a more robust versionalbeu2008-04-131-0/+38
| | | | | | | allowing all kind of options to be used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26440 b3059339-0415-0410-9bf9-f77b7e298cf2
* Include some .h files in corresponding .c filesuau2008-03-281-0/+1
| | | | | | | | | Include the corresponding .h file in command.c, parser-cfg.c and parser-mpcmd.c. This allows the compiler to check that the declarations in the .h file match the actual defition. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26295 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove some more useless *alloc castsreimar2007-07-191-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23826 b3059339-0415-0410-9bf9-f77b7e298cf2
* increased a bit max param length as it can be too short to declare tv ↵ben2007-01-041-1/+1
| | | | | | channels when you have a long list of git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21817 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix stray newline that should only be printed in verbose mode.diego2006-08-201-2/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19468 b3059339-0415-0410-9bf9-f77b7e298cf2
* Doxygen Attack! - Chapter 3albeu2006-04-251-0/+18
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18266 b3059339-0415-0410-9bf9-f77b7e298cf2
* Profiles support.albeu2006-01-241-1/+19
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17472 b3059339-0415-0410-9bf9-f77b7e298cf2
* Reduce excessive verbosity.diego2004-11-151-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13947 b3059339-0415-0410-9bf9-f77b7e298cf2
* 100l to albeu for his english grammar, and 10l to me becouse I noticed that ↵alex2003-08-131-1/+1
| | | | | | lately (my backward compatibilty macro uses M_OPT_UNKNOWN) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10596 b3059339-0415-0410-9bf9-f77b7e298cf2
* Removed the historic cfgparser and switched full to the new config parser ↵alex2003-08-131-5/+0
| | | | | | (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10595 b3059339-0415-0410-9bf9-f77b7e298cf2
* 1000l! crashing on broken config files finally fixed!rfelker2003-06-041-3/+3
| | | | | | | | | | | | | | Patch by Alex Sisson (alex_sisson at yahoo.co.uk): a missing parameter on mp_msg meant it crashed instead of printing a nice message if you put entries in the config with no parameter. also did a few english-tidies on error messages in there. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10246 b3059339-0415-0410-9bf9-f77b7e298cf2
* longer option buffers, needed for tv optionshenry2003-04-031-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9814 b3059339-0415-0410-9bf9-f77b7e298cf2
* Better error messages (with line number now) and make unknow optionalbeu2003-03-131-7/+11
| | | | | | | non-fatal for ppl wich compile many different versions git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9579 b3059339-0415-0410-9bf9-f77b7e298cf2
* New config system + cleanup of header inter dependencyalbeu2002-11-121-0/+211
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8165 b3059339-0415-0410-9bf9-f77b7e298cf2