Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
f15b7d6b
Commit
f15b7d6b
authored
Sep 29, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zsh completion: refactor
parent
85336e05
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
76 deletions
+51
-76
extras/analyser/zsh.cpp
extras/analyser/zsh.cpp
+51
-76
No files found.
extras/analyser/zsh.cpp
View file @
f15b7d6b
...
@@ -29,26 +29,19 @@
...
@@ -29,26 +29,19 @@
#include <map>
#include <map>
#include <string>
#include <string>
#include <sstream>
#include <sstream>
#include <utility>
#include <iostream>
#include <vlc/vlc.h>
#include <algorithm>
#include <vlc_common.h>
#include <vlc_modules.h>
#include "../src/modules/modules.h"
/* evil hack */
typedef
std
::
pair
<
std
::
string
,
std
::
string
>
mpair
;
typedef
std
::
pair
<
std
::
string
,
std
::
string
>
mpair
;
typedef
std
::
multimap
<
std
::
string
,
std
::
string
>
mumap
;
typedef
std
::
multimap
<
std
::
string
,
std
::
string
>
mumap
;
mumap
mod
s
;
mumap
capabilitie
s
;
typedef
std
::
pair
<
int
,
std
::
string
>
mcpair
;
typedef
std
::
pair
<
int
,
std
::
string
>
mcpair
;
typedef
std
::
multimap
<
int
,
std
::
string
>
mcmap
;
typedef
std
::
multimap
<
int
,
std
::
string
>
mcmap
;
mcmap
mods2
;
mcmap
categories
;
#include <vlc_common.h>
#include <vlc/vlc.h>
#include <vlc_modules.h>
/* evil hack */
#undef __PLUGIN__
#include <../src/modules/modules.h>
static
void
ReplaceChars
(
char
*
str
)
static
void
ReplaceChars
(
char
*
str
)
{
{
...
@@ -114,27 +107,23 @@ static void ParseOption(const module_config_t *item)
...
@@ -114,27 +107,23 @@ static void ParseOption(const module_config_t *item)
switch
(
item
->
i_type
)
switch
(
item
->
i_type
)
{
{
case
CONFIG_ITEM_MODULE
:
case
CONFIG_ITEM_MODULE
:
range_mod
=
mods
.
equal_range
(
item
->
psz_type
);
range_mod
=
capabilities
.
equal_range
(
item
->
psz_type
);
list
=
(
*
range_mod
.
first
).
second
;
args
=
"("
+
(
*
range_mod
.
first
).
second
;
if
(
range_mod
.
first
!=
range_mod
.
second
)
{
while
(
range_mod
.
first
++
!=
range_mod
.
second
)
while
(
range_mod
.
first
++
!=
range_mod
.
second
)
list
+=
" "
+
range_mod
.
first
->
second
;
args
+=
" "
+
range_mod
.
first
->
second
;
args
=
std
::
string
(
"("
)
+
list
+
")"
;
args
+=
")"
;
}
break
;
break
;
case
CONFIG_ITEM_MODULE_CAT
:
case
CONFIG_ITEM_MODULE_CAT
:
range
=
mods2
.
equal_range
(
item
->
min
.
i
);
range
=
categories
.
equal_range
(
item
->
min
.
i
);
list
=
(
*
range
.
first
).
second
;
args
=
"("
+
(
*
range
.
first
).
second
;
if
(
range
.
first
!=
range
.
second
)
{
while
(
range
.
first
++
!=
range
.
second
)
while
(
range
.
first
++
!=
range
.
second
)
list
+=
" "
+
range
.
first
->
second
;
args
+=
" "
+
range
.
first
->
second
;
args
=
std
::
string
(
"("
)
+
list
+
")"
;
args
+=
")"
;
}
break
;
break
;
case
CONFIG_ITEM_MODULE_LIST_CAT
:
case
CONFIG_ITEM_MODULE_LIST_CAT
:
range
=
mods2
.
equal_range
(
item
->
min
.
i
);
range
=
categories
.
equal_range
(
item
->
min
.
i
);
args
=
std
::
string
(
"_values -s , "
)
+
item
->
psz_name
;
args
=
std
::
string
(
"_values -s , "
)
+
item
->
psz_name
;
while
(
range
.
first
!=
range
.
second
)
while
(
range
.
first
!=
range
.
second
)
args
+=
" '*"
+
range
.
first
++->
second
+
"'"
;
args
+=
" '*"
+
range
.
first
++->
second
+
"'"
;
...
@@ -200,60 +189,33 @@ static void ParseOption(const module_config_t *item)
...
@@ -200,60 +189,33 @@ static void ParseOption(const module_config_t *item)
PrintOption
(
item
,
item
->
psz_name
,
""
,
args
);
PrintOption
(
item
,
item
->
psz_name
,
""
,
args
);
}
}
static
void
PrintModule
List
(
)
static
void
PrintModule
(
const
module_t
*
mod
)
{
{
printf
(
"vlc_modules=
\"
"
);
const
char
*
name
=
mod
->
pp_shortcuts
[
0
];
if
(
!
strcmp
(
name
,
"main"
))
size_t
modules
=
0
;
module_t
**
list
=
module_list_get
(
&
modules
);
if
(
!
list
||
modules
==
0
)
return
;
return
;
for
(
module_t
**
pmod
=
list
;
pmod
<
&
list
[
modules
];
pmod
++
)
{
if
(
mod
->
psz_capability
)
/* Exclude empty plugins (submodules don't have config options, they
capabilities
.
insert
(
mpair
(
mod
->
psz_capability
,
name
));
* are stored in the parent module) */
module_t
*
mod
=
*
pmod
;
if
(
!
strcmp
(
mod
->
pp_shortcuts
[
0
],
"main"
))
continue
;
const
char
*
capability
=
mod
->
psz_capability
?
mod
->
psz_capability
:
""
;
mods
.
insert
(
mpair
(
capability
,
mod
->
pp_shortcuts
[
0
]));
module_config_t
*
max
=
&
mod
->
p_config
[
mod
->
i_config_items
];
module_config_t
*
max
=
&
mod
->
p_config
[
mod
->
i_config_items
];
for
(
module_config_t
*
cfg
=
mod
->
p_config
;
cfg
&&
cfg
<
max
;
cfg
++
)
for
(
module_config_t
*
cfg
=
mod
->
p_config
;
cfg
&&
cfg
<
max
;
cfg
++
)
if
(
cfg
->
i_type
==
CONFIG_SUBCATEGORY
)
if
(
cfg
->
i_type
==
CONFIG_SUBCATEGORY
)
mods2
.
insert
(
mcpair
(
cfg
->
value
.
i
,
mod
->
pp_shortcuts
[
0
]
));
categories
.
insert
(
mcpair
(
cfg
->
value
.
i
,
name
));
if
(
!
mod
->
parent
)
if
(
!
mod
->
parent
)
printf
(
"%s "
,
mod
->
pp_shortcuts
[
0
]);
printf
(
"%s "
,
name
);
}
puts
(
"
\"\n
"
);
module_list_free
(
list
);
}
}
static
void
ParseModule
s
(
)
static
void
ParseModule
(
const
module_t
*
mod
)
{
{
size_t
modules
=
0
;
module_t
**
list
=
module_list_get
(
&
modules
);
if
(
!
list
||
modules
==
0
)
return
;
for
(
module_t
**
pmod
=
list
;
pmod
<
&
list
[
modules
];
pmod
++
)
{
/* Exclude empty plugins (submodules don't have config options, they
* are stored in the parent module) */
module_t
*
mod
=
*
pmod
;
if
(
mod
->
parent
)
if
(
mod
->
parent
)
continue
;
return
;
module_config_t
*
max
=
mod
->
p_config
+
mod
->
confsize
;
module_config_t
*
max
=
mod
->
p_config
+
mod
->
confsize
;
for
(
module_config_t
*
cfg
=
mod
->
p_config
;
cfg
&&
cfg
<
max
;
cfg
++
)
for
(
module_config_t
*
cfg
=
mod
->
p_config
;
cfg
&&
cfg
<
max
;
cfg
++
)
if
(
CONFIG_ITEM
(
cfg
->
i_type
))
if
(
CONFIG_ITEM
(
cfg
->
i_type
))
ParseOption
(
cfg
);
ParseOption
(
cfg
);
}
module_list_free
(
list
);
}
}
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
...
@@ -262,16 +224,29 @@ int main(int argc, const char **argv)
...
@@ -262,16 +224,29 @@ int main(int argc, const char **argv)
if
(
!
libvlc
)
if
(
!
libvlc
)
return
1
;
return
1
;
size_t
modules
=
0
;
module_t
**
mod_list
;
mod_list
=
module_list_get
(
&
modules
);
if
(
!
mod_list
||
modules
==
0
)
return
2
;
module_t
**
max
=
&
mod_list
[
modules
];
puts
(
"#compdef vlc cvlc rvlc svlc mvlc qvlc nvlc
\n
"
puts
(
"#compdef vlc cvlc rvlc svlc mvlc qvlc nvlc
\n
"
"#This file is autogenerated by zsh.cpp"
"#This file is autogenerated by zsh.cpp"
"typeset -A opt_args"
"typeset -A opt_args"
"local context state line ret=1"
"local context state line ret=1"
"local modules
\n
"
);
"local modules
\n
"
);
PrintModuleList
();
printf
(
"vlc_modules=
\"
"
);
for
(
module_t
**
mod
=
mod_list
;
mod
<
max
;
mod
++
)
PrintModule
(
*
mod
);
puts
(
"
\"\n
"
);
puts
(
"_arguments -S -s
\\
"
);
puts
(
"_arguments -S -s
\\
"
);
ParseModules
();
for
(
module_t
**
mod
=
mod_list
;
mod
<
max
;
mod
++
)
ParseModule
(
*
mod
);
puts
(
"
\"
(--module)-p[print help on module]:print help on module:($vlc_modules)
\"\\
"
);
puts
(
"
\"
(--module)-p[print help on module]:print help on module:($vlc_modules)
\"\\
"
);
puts
(
"
\"
(-p)--module[print help on module]:print help on module:($vlc_modules)
\"\\
"
);
puts
(
"
\"
(-p)--module[print help on module]:print help on module:($vlc_modules)
\"\\
"
);
puts
(
"
\"
(--help)-h[print help]
\"\\
"
);
puts
(
"
\"
(--help)-h[print help]
\"\\
"
);
...
@@ -294,7 +269,7 @@ int main(int argc, const char **argv)
...
@@ -294,7 +269,7 @@ int main(int argc, const char **argv)
puts
(
"return ret"
);
puts
(
"return ret"
);
module_list_free
(
mod_list
);
libvlc_release
(
libvlc
);
libvlc_release
(
libvlc
);
return
0
;
return
0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment