PageRenderTime 17ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/gtk2/src/gtk2x11/scripts/gdkx11_h2pas.sh

https://github.com/slibre/freepascal
Shell | 48 lines | 36 code | 8 blank | 4 comment | 1 complexity | 677badd271ad3724cc099f6fdc4bdf72 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
 1#!/usr/bin/env bash
 2
 3#set -x
 4set -e
 5
 6# make sure, we are in the right directory
 7cd ../scripts
 8
 9CHeaderDir=../c_src/x11
10PascalIncDir=../include
11HTmpFile=temp.h
12PasTmpFile=temp.inc
13
14HFiles=$(ls $CHeaderDir/*.h)
15for HFile in $HFiles; do
16  echo $HFile
17  ShortHFile=$(echo $HFile | sed -e 's#.*/##')
18  ShortPascalFile=$(echo $ShortHFile | sed -e 's#\.h$#.inc#')
19  echo $ShortPascalFile
20  PascalFile=$PascalIncDir/$ShortPascalFile
21  cat $HFile | sed \
22    -e 's#G_BEGIN_DECLS##g' \
23    -e 's#G_END_DECLS##g' \
24    -e 's#G_CONST_RETURN#const#g' \
25    > $HTmpFile
26
27  h2pas -d -e -i -p -t -o $PasTmpFile $HTmpFile
28  cat $PasTmpFile | sed \
29    -e 's#\bT\(gint\)\b#\1#g' \
30    -e 's#\bT\(guint\)\b#\1#g' \
31    -e 's#\bT\(gboolean\)\b#\1#g' \
32    -e 's#\bT\(glong\)\b#\1#g' \
33    -e 's#\bT\(gulong\)\b#\1#g' \
34    -e 's#\bT\(gchar\)\b#\1#g' \
35    -e 's#\bT\(guchar\)\b#\1#g' \
36    -e 's#\bT\(gshort\)\b#\1#g' \
37    -e 's#\bT\(gushort\)\b#\1#g' \
38    -e 's#\bT\(gfloat\)\b#\1#g' \
39    -e 's#\bT\(gdouble\)\b#\1#g' \
40    -e 's#\bT\(gpointer\)\b#\1#g' \
41    -e 's#\bT\(gconstpointer\)\b#\1#g' \
42    -e 's#\bT\(guint32\)\b#\1#g' \
43    > $PascalFile
44done
45
46
47# end.
48