~ubuntu-branches/debian/sid/kodi/sid

« back to all changes in this revision

Viewing changes to lib/timidity/script/dllutl.rb

  • Committer: Package Import Robot
  • Author(s): Balint Reczey
  • Date: 2015-08-18 14:16:59 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20150818141659-4lgq2pksj7918osz
Tags: 15.1+dfsg1-1
* New upstream release 15.0
  See http://www.kodi.tv/kodi-15-0-isengard-one-release-to-rule-them-all/
* Depend on libav.*-dev provided by src:ffmpeg
* Recommend udisks2 instead of udisks.
  Udisks has been removed from unstable but support for udisks2 is not
  implemented yet.
* Ship patch helping Jessie backports
* Refresh patches
* Eliminate __DATE__ macros from source to make build more reproducible
* Build-depend on libsdl2.*-dev instead of libsdl.*-dev
* Build-depend on libgif-dev
* Drop obsoleted fix of installed header's include paths
* Refresh include file list included by kodi-addons-dev
* Build depend on libcec (>= 3)
* Build-depend on groovy2 instead of groovy
* Sort build dependencies
* Fix packaging repository URL
* Remove removed files from debian/copyright
* Fix filenames with spaces in debian/copyright
* Ship TexturePacker in kodi-addons-dev in /usr/lib/kodi
* Build depend on libcec-platform-dev
* Stop using embedded gnulib modules in rsxs screensaver (Closes: #795813)
* Add missing copyright paragraphs to d/copyright
* Stop marking files as excluded which are removed from upstream tarball
  already
* Bump standards version to 3.9.6
* New upstream release 15.1
  See http://kodi.tv/kodi-15-1-isengard-maintenance-release/
* Move TexturePacker to kodi-bin
* Stop building TexturePacker statically

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/local/bin/ruby
2
 
 
3
 
# DLL �̃_�C�i�~�b�N���[�h�p�c�[��
4
 
# �P�s�� �N���X��
5
 
# �Q�s�� dll ��
6
 
# �R�s�ڈȍ~ �֐��v���g�^�C�v
7
 
# �ȃt�@�C�� source ��
8
 
# ruby dllutl.rb < source
9
 
# �Ƃ��Ă��΁A���̊֐��� dll ����_�C�i�~�b�N���[�h���Ă����
10
 
# �\�[�X�������쐬���Ă����B�������A���܂蕡�G�Ȋ֐��v���g�^�C�v�ɂ�
11
 
# ���Ή��B���� () ����݁B
12
 
#
13
 
# �K�p�FPublic Domain
14
 
#
15
 
# Version 0.1p
16
 
#
17
 
# Daisuke Aoki <dai@y7.net>
18
 
 
19
 
def arg_ana(args)
20
 
  list = []
21
 
  temp = ""
22
 
  if args.index(",")==nil
23
 
    temp = args
24
 
  else
25
 
    temp = args.split(/,/)
26
 
  end
27
 
  for i in temp
28
 
    if i == "void"
29
 
      return []
30
 
    end
31
 
    if i =~ /\s*(.*)\s+(\S+)\s*/
32
 
      rest = $2
33
 
      if rest =~ /(\s*\**\s*\**\s*\**\s*\**\s*)(.*)/
34
 
        list << $2
35
 
      else
36
 
        return nil
37
 
      end
38
 
    else
39
 
      return nil
40
 
    end
41
 
  end
42
 
  return list
43
 
end
44
 
 
45
 
class_name = "default_name"
46
 
dll_name = "default_name.dll"
47
 
class_name = gets.chomp
48
 
dll_name = gets.chomp
49
 
 
50
 
funclist = []
51
 
while gets
52
 
#    if $_ =~ /(\s*[^\s]\s+\**)([^\(]+)(\(.*\))\;\s*/
53
 
#    if $_ =~ /(\s*\S+\s+)([^\(]+)(\(.*\))\;\s*/
54
 
    if $_ =~ /^#.*/
55
 
      next
56
 
    end
57
 
    rest = $_
58
 
    part_prev = ""
59
 
    part_func = ""
60
 
    part_post = ""
61
 
    if rest =~ /\s*(.*)\s*(\(.*?\))\s*;/
62
 
      rest = $1
63
 
      part_post << $2
64
 
      if rest =~ /\s*(.*)\s+(\S+)\s*/
65
 
        part_prev << $1
66
 
        rest = $2
67
 
        if rest =~ /(\s*\**\s*\**\s*\**\s*\**\s*)(.*)/
68
 
          part_prev << $1
69
 
          part_func << $2
70
 
#          printf("<%s><%s><%s>\n",part_prev,part_func,part_post)
71
 
        end
72
 
      end
73
 
    end
74
 
    if part_func!=""
75
 
      funclist << [part_prev,part_func,part_post]
76
 
    end
77
 
end
78
 
 
79
 
print "/***************************************************************\n"
80
 
printf " name: %s  dll: %s \n",class_name,dll_name
81
 
print "***************************************************************/\n"
82
 
 
83
 
print "\n"
84
 
printf "extern int load_%s(void);\n",class_name
85
 
printf "extern void free_%s(void);\n",class_name
86
 
print "\n"
87
 
 
88
 
for i in funclist
89
 
  printf "typedef %s(*type_%s)%s;\n",i[0],i[1],i[2]
90
 
end
91
 
printf "\nstatic struct %s_ {\n",class_name
92
 
for i in funclist
93
 
  printf "\t type_%s %s;\n",i[1],i[1]
94
 
end
95
 
printf "} %s;\n\n",class_name
96
 
 
97
 
printf "static volatile HANDLE h_%s = NULL;\n\n",class_name
98
 
 
99
 
printf "void free_%s(void)
100
 
{
101
 
\tif(h_%s){
102
 
\t\tFreeLibrary(h_%s);
103
 
\t\th_%s = NULL;
104
 
\t}
105
 
}
106
 
 
107
 
",class_name,class_name,class_name,class_name
108
 
 
109
 
printf "int load_%s(void)
110
 
{
111
 
\tif(!h_%s){
112
 
\t\th_%s = LoadLibrary(\"%s\");
113
 
\t\tif(!h_%s) return -1;
114
 
\t}
115
 
",class_name,class_name,class_name,dll_name,class_name
116
 
for i in funclist
117
 
  printf "\t%s.%s = (type_%s)GetProcAddress(h_%s,\"%s\");\n",class_name,i[1],i[1],class_name,i[1]
118
 
  printf "\tif(!%s.%s){ free_%s(); return -1; }\n",class_name,i[1],class_name
119
 
end
120
 
printf "\treturn 0;\n}\n\n"
121
 
 
122
 
for i in funclist
123
 
  printf "%s %s%s
124
 
{
125
 
\tif(h_%s){
126
 
",i[0],i[1],i[2],class_name
127
 
  if i[0] =~ /\s*void\s*/
128
 
    printf "\t\t%s.%s(",class_name,i[1]
129
 
  else
130
 
    printf "\t\treturn %s.%s(",class_name,i[1]
131
 
  end
132
 
  args = ""
133
 
  if i[2] =~ /\((.*)\)/
134
 
    args = $1.strip
135
 
  end
136
 
  arglist = arg_ana(args)
137
 
  if arglist == nil
138
 
    print "\n@@@ BAD @@@\n"
139
 
    exit
140
 
  end
141
 
  num = 0
142
 
  for j in arglist
143
 
    if j != "void"
144
 
      print "," if num!=0
145
 
      print j
146
 
      num += 1
147
 
    end
148
 
  end
149
 
  print ");\n"
150
 
  if i[0] =~ /\s*void\s*/
151
 
    printf "\t}\n"
152
 
  else
153
 
    printf "\t}\n\treturn (%s)0;\n",i[0]
154
 
  end
155
 
  printf "}\n\n"
156
 
end
157
 
 
158
 
print "/***************************************************************/\n"
159