diff options
Diffstat (limited to '')
-rw-r--r-- | default.bld | 85 | ||||
-rw-r--r-- | gensigs.bld | 330 | ||||
-rw-r--r-- | pkg.bld | 90 |
3 files changed, 255 insertions, 250 deletions
diff --git a/default.bld b/default.bld index 457c71b..aa317f6 100644 --- a/default.bld +++ b/default.bld | |||
@@ -236,91 +236,6 @@ target files("src/unit/*.unit").replace("src/","").replace(".unit","") | |||
236 | LDFLAGS += "-L. -lbu++"; | 236 | LDFLAGS += "-L. -lbu++"; |
237 | } | 237 | } |
238 | 238 | ||
239 | PKG_BASE = "libbu++-$(cat version)-r$(svnversion "-n").tar"; | ||
240 | |||
241 | target PKG_BASE | ||
242 | { | ||
243 | input [ | ||
244 | "LICENSE", | ||
245 | "README.md", | ||
246 | "Doxyfile", | ||
247 | "Makefile", | ||
248 | "version", | ||
249 | files("*.bld"), | ||
250 | "support/vim/syntax/taf.vim", | ||
251 | "support/vim/ftdetect/taf.vim", | ||
252 | "support/vim/ftplugin/taf.vim", | ||
253 | files("*.sh"), | ||
254 | files("autoconfig.cpp"), | ||
255 | files("src/*.cpp"), | ||
256 | files("src/*.h"), | ||
257 | files("src/stable/*.cpp"), | ||
258 | files("src/stable/*.h"), | ||
259 | files("src/unstable/*.cpp"), | ||
260 | files("src/unstable/*.h"), | ||
261 | files("src/experimental/*.cpp"), | ||
262 | files("src/experimental/*.h"), | ||
263 | files("src/tests/*.cpp"), | ||
264 | files("src/tests*.h"), | ||
265 | files("src/tools/*.cpp"), | ||
266 | files("src/tools/*.h"), | ||
267 | files("src/unit/*.unit"), | ||
268 | files("src/doxy/*.dox"), | ||
269 | files("src/compat/*.cpp"), | ||
270 | files("src/compat/*.h"), | ||
271 | files("src/extra/*.cpp"), | ||
272 | files("src/extra/*.h"), | ||
273 | files("pregen/*"), | ||
274 | "api" | ||
275 | ]; | ||
276 | rule "tarball"; | ||
277 | tag "pkg"; | ||
278 | } | ||
279 | |||
280 | target PKG_BASE + ".gz" | ||
281 | { | ||
282 | input PKG_BASE; | ||
283 | tag "pkg"; | ||
284 | display "gzip"; | ||
285 | profile "build" | ||
286 | { | ||
287 | execute("gzip -9 < ${INPUT} > ${OUTPUT}"); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | target PKG_BASE + ".bz2" | ||
292 | { | ||
293 | input PKG_BASE; | ||
294 | tag "pkg"; | ||
295 | display "bzip2"; | ||
296 | profile "build" | ||
297 | { | ||
298 | execute("bzip2 -9 < ${INPUT} > ${OUTPUT}"); | ||
299 | } | ||
300 | } | ||
301 | |||
302 | target PKG_BASE + ".xz" | ||
303 | { | ||
304 | input PKG_BASE; | ||
305 | tag "pkg"; | ||
306 | display "xz"; | ||
307 | profile "build" | ||
308 | { | ||
309 | execute("xz -9vv < ${INPUT} > ${OUTPUT}"); | ||
310 | } | ||
311 | } | ||
312 | |||
313 | rule "tarball" | ||
314 | { | ||
315 | input matches("LICENSE", "*.md", "Makefile", "*.cpp", "*.h", "*.conf", | ||
316 | "*.bld", "Doxyfile", "*.vim", "*.sh", "*.unit", "api", "version"); | ||
317 | profile "build" | ||
318 | { | ||
319 | OUTDIR = OUTPUT.replace(".tar",""); | ||
320 | execute("tar -f ./${OUTPUT} --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT}"); | ||
321 | } | ||
322 | } | ||
323 | |||
324 | rule "unit" | 239 | rule "unit" |
325 | { | 240 | { |
326 | input "*.unit"; | 241 | input "*.unit"; |
diff --git a/gensigs.bld b/gensigs.bld index 344eb62..c452356 100644 --- a/gensigs.bld +++ b/gensigs.bld | |||
@@ -1,171 +1,171 @@ | |||
1 | function genSigs( outName ) | 1 | function genSigs( outName ) |
2 | { | 2 | { |
3 | if exists( outName ) then | 3 | if exists( outName ) then |
4 | { | 4 | { |
5 | unlink( outName ); | 5 | unlink( outName ); |
6 | } | 6 | } |
7 | fOut = open(outName, "w"); | 7 | fOut = open(outName, "w"); |
8 | fOut.write( | 8 | fOut.write( |
9 | "/*\n" | 9 | "/*\n" |
10 | " * Copyright (C) 2007-2012 Xagasoft, All rights reserved.\n" | 10 | " * Copyright (C) 2007-2012 Xagasoft, All rights reserved.\n" |
11 | " *\n" | 11 | " *\n" |
12 | " * This file is part of the libbu++ library and is released under the\n" | 12 | " * This file is part of the libbu++ library and is released under the\n" |
13 | " * terms of the license contained in the file LICENSE.\n" | 13 | " * terms of the license contained in the file LICENSE.\n" |
14 | " */\n" | 14 | " */\n" |
15 | "\n" | 15 | "\n" |
16 | "#ifndef BU_SIGNALS_H\n" | 16 | "#ifndef BU_SIGNALS_H\n" |
17 | "#define BU_SIGNALS_H\n" | 17 | "#define BU_SIGNALS_H\n" |
18 | "\n" | 18 | "\n" |
19 | "#include \"bu/util.h\"\n" | 19 | "#include \"bu/util.h\"\n" |
20 | "#include \"bu/exceptionbase.h\"\n" | 20 | "#include \"bu/exceptionbase.h\"\n" |
21 | "\n" | 21 | "\n" |
22 | "namespace Bu\n" | 22 | "namespace Bu\n" |
23 | "{\n" | 23 | "{\n" |
24 | " subExceptionDecl( SignalException );\n" | 24 | " subExceptionDecl( SignalException );\n" |
25 | "\n" | 25 | "\n" |
26 | ); | 26 | ); |
27 | 27 | ||
28 | for i in range( 0, 10 ) do | 28 | for i in range( 0, 10 ) do |
29 | { | 29 | { |
30 | templParams = "typename ret"; | 30 | templParams = "typename ret"; |
31 | funcParams = ""; | 31 | funcParams = ""; |
32 | funcAnonParams = ""; | 32 | funcAnonParams = ""; |
33 | templCallParams = "ret"; | 33 | templCallParams = "ret"; |
34 | funcCallParams = ""; | 34 | funcCallParams = ""; |
35 | if i >= 1 then | 35 | if i >= 1 then |
36 | { | 36 | { |
37 | for p in range( 1, i ) do | 37 | for p in range( 1, i ) do |
38 | { | 38 | { |
39 | if p > 1 then | 39 | if p > 1 then |
40 | { | 40 | { |
41 | funcCallParams << ", "; | 41 | funcCallParams << ", "; |
42 | funcParams << ", "; | 42 | funcParams << ", "; |
43 | funcAnonParams << ", "; | 43 | funcAnonParams << ", "; |
44 | } | 44 | } |
45 | templParams << ", typename p${p}t"; | 45 | templParams << ", typename p${p}t"; |
46 | funcParams << "p${p}t p${p}"; | 46 | funcParams << "p${p}t p${p}"; |
47 | funcAnonParams << "p${p}t"; | 47 | funcAnonParams << "p${p}t"; |
48 | templCallParams << ", p${p}t"; | 48 | templCallParams << ", p${p}t"; |
49 | funcCallParams << "p${p}"; | 49 | funcCallParams << "p${p}"; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | fOut.write( | 52 | fOut.write( |
53 | "#ifndef BU_SIGNAL_PARAM_COUNT_${i}\n" | 53 | "#ifndef BU_SIGNAL_PARAM_COUNT_${i}\n" |
54 | "#define BU_SIGNAL_PARAM_COUNT_${i}\n" | 54 | "#define BU_SIGNAL_PARAM_COUNT_${i}\n" |
55 | " //\n" | 55 | " //\n" |
56 | " // ${i} Parameter(s)\n" | 56 | " // ${i} Parameter(s)\n" |
57 | " //\n" | 57 | " //\n" |
58 | " template<${templParams}>\n" | 58 | " template<${templParams}>\n" |
59 | " class _Slot${i}\n" | 59 | " class _Slot${i}\n" |
60 | " {\n" | 60 | " {\n" |
61 | " public:\n" | 61 | " public:\n" |
62 | " _Slot${i}() { }\n" | 62 | " _Slot${i}() { }\n" |
63 | " virtual ~_Slot${i}() { }\n" | 63 | " virtual ~_Slot${i}() { }\n" |
64 | " virtual ret operator()( ${funcParams} )=0;\n" | 64 | " virtual ret operator()( ${funcParams} )=0;\n" |
65 | " virtual _Slot${i}<${templCallParams}> *clone() const=0;\n" | 65 | " virtual _Slot${i}<${templCallParams}> *clone() const=0;\n" |
66 | " };\n" | 66 | " };\n" |
67 | " \n" | 67 | " \n" |
68 | " template<typename cls, ${templParams}>\n" | 68 | " template<typename cls, ${templParams}>\n" |
69 | " class __Slot${i} : public _Slot${i}<${templCallParams}>\n" | 69 | " class __Slot${i} : public _Slot${i}<${templCallParams}>\n" |
70 | " {\n" | 70 | " {\n" |
71 | " public:\n" | 71 | " public:\n" |
72 | " __Slot${i}( cls *pCls, ret (cls::*pFnc)( ${funcAnonParams} ) ) :\n" | 72 | " __Slot${i}( cls *pCls, ret (cls::*pFnc)( ${funcAnonParams} ) ) :\n" |
73 | " pCls( pCls ), pFnc( pFnc ) { }\n" | 73 | " pCls( pCls ), pFnc( pFnc ) { }\n" |
74 | " virtual ~__Slot${i}() { }\n" | 74 | " virtual ~__Slot${i}() { }\n" |
75 | " \n" | 75 | " \n" |
76 | " virtual ret operator()( ${funcParams} )\n" | 76 | " virtual ret operator()( ${funcParams} )\n" |
77 | " {\n" | 77 | " {\n" |
78 | " return (pCls->*pFnc)( ${funcCallParams} );\n" | 78 | " return (pCls->*pFnc)( ${funcCallParams} );\n" |
79 | " }\n" | 79 | " }\n" |
80 | " \n" | 80 | " \n" |
81 | " virtual _Slot${i}<${templCallParams}> *clone() const\n" | 81 | " virtual _Slot${i}<${templCallParams}> *clone() const\n" |
82 | " {\n" | 82 | " {\n" |
83 | " return new __Slot${i}<cls, ${templCallParams}>( pCls, pFnc );\n" | 83 | " return new __Slot${i}<cls, ${templCallParams}>( pCls, pFnc );\n" |
84 | " }\n" | 84 | " }\n" |
85 | " \n" | 85 | " \n" |
86 | " private:\n" | 86 | " private:\n" |
87 | " cls *pCls;\n" | 87 | " cls *pCls;\n" |
88 | " ret (cls::*pFnc)( ${funcAnonParams} );\n" | 88 | " ret (cls::*pFnc)( ${funcAnonParams} );\n" |
89 | " };\n" | 89 | " };\n" |
90 | " \n" | 90 | " \n" |
91 | " template<${templParams}>\n" | 91 | " template<${templParams}>\n" |
92 | " class __Slot${i}F : public _Slot${i}<${templCallParams}>\n" | 92 | " class __Slot${i}F : public _Slot${i}<${templCallParams}>\n" |
93 | " {\n" | 93 | " {\n" |
94 | " public:\n" | 94 | " public:\n" |
95 | " __Slot${i}F( ret (*pFnc)( ${funcAnonParams} ) ) :\n" | 95 | " __Slot${i}F( ret (*pFnc)( ${funcAnonParams} ) ) :\n" |
96 | " pFnc( pFnc ) { }\n" | 96 | " pFnc( pFnc ) { }\n" |
97 | " virtual ~__Slot${i}F() { }\n" | 97 | " virtual ~__Slot${i}F() { }\n" |
98 | " \n" | 98 | " \n" |
99 | " virtual ret operator()( ${funcParams} )\n" | 99 | " virtual ret operator()( ${funcParams} )\n" |
100 | " {\n" | 100 | " {\n" |
101 | " return (*pFnc)( ${funcCallParams} );\n" | 101 | " return (*pFnc)( ${funcCallParams} );\n" |
102 | " }\n" | 102 | " }\n" |
103 | " \n" | 103 | " \n" |
104 | " virtual _Slot${i}<${templCallParams}> *clone() const\n" | 104 | " virtual _Slot${i}<${templCallParams}> *clone() const\n" |
105 | " {\n" | 105 | " {\n" |
106 | " return new __Slot${i}F<${templCallParams}>( pFnc );\n" | 106 | " return new __Slot${i}F<${templCallParams}>( pFnc );\n" |
107 | " }\n" | 107 | " }\n" |
108 | " \n" | 108 | " \n" |
109 | " private:\n" | 109 | " private:\n" |
110 | " ret (*pFnc)( ${funcAnonParams} );\n" | 110 | " ret (*pFnc)( ${funcAnonParams} );\n" |
111 | " };\n" | 111 | " };\n" |
112 | " \n" | 112 | " \n" |
113 | " template<${templParams}>\n" | 113 | " template<${templParams}>\n" |
114 | " class Signal${i}\n" | 114 | " class Signal${i}\n" |
115 | " {\n" | 115 | " {\n" |
116 | " public:\n" | 116 | " public:\n" |
117 | " Signal${i}() : pCb( NULL ) { }\n" | 117 | " Signal${i}() : pCb( NULL ) { }\n" |
118 | " Signal${i}( _Slot${i}<${templCallParams}> *pCb ) : pCb( pCb ) { }\n" | 118 | " Signal${i}( _Slot${i}<${templCallParams}> *pCb ) : pCb( pCb ) { }\n" |
119 | " Signal${i}( const Signal${i}<${templCallParams}> &rSrc ) :\n" | 119 | " Signal${i}( const Signal${i}<${templCallParams}> &rSrc ) :\n" |
120 | " pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { }\n" | 120 | " pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { }\n" |
121 | " virtual ~Signal${i}() { delete pCb; pCb = NULL; }\n" | 121 | " virtual ~Signal${i}() { delete pCb; pCb = NULL; }\n" |
122 | " \n" | 122 | " \n" |
123 | " ret operator()( ${funcParams} )\n" | 123 | " ret operator()( ${funcParams} )\n" |
124 | " {\n" | 124 | " {\n" |
125 | " if( !pCb ) throw SignalException(\"Uninitialized signal called.\");\n" | 125 | " if( !pCb ) throw SignalException(\"Uninitialized signal called.\");\n" |
126 | " return (*pCb)( ${funcCallParams} );\n" | 126 | " return (*pCb)( ${funcCallParams} );\n" |
127 | " }\n" | 127 | " }\n" |
128 | " \n" | 128 | " \n" |
129 | " bool isSet() const { return pCb != NULL; }\n" | 129 | " bool isSet() const { return pCb != NULL; }\n" |
130 | " operator bool() const { return isSet(); }\n" | 130 | " operator bool() const { return isSet(); }\n" |
131 | " \n" | 131 | " \n" |
132 | " Signal${i}<${templCallParams}> &operator=( const Signal${i}<${templCallParams}> &rhs )\n" | 132 | " Signal${i}<${templCallParams}> &operator=( const Signal${i}<${templCallParams}> &rhs )\n" |
133 | " {\n" | 133 | " {\n" |
134 | " pCb = rhs.pCb->clone();\n" | 134 | " pCb = rhs.pCb->clone();\n" |
135 | " return *this;\n" | 135 | " return *this;\n" |
136 | " }\n" | 136 | " }\n" |
137 | " \n" | 137 | " \n" |
138 | " private:\n" | 138 | " private:\n" |
139 | " _Slot${i}<${templCallParams}> *pCb;\n" | 139 | " _Slot${i}<${templCallParams}> *pCb;\n" |
140 | " };\n" | 140 | " };\n" |
141 | " \n" | 141 | " \n" |
142 | " template<typename cls, ${templParams}>\n" | 142 | " template<typename cls, ${templParams}>\n" |
143 | " Signal${i}<${templCallParams}> slot( cls *pCls, ret (cls::*pFnc)( ${funcAnonParams} ) )\n" | 143 | " Signal${i}<${templCallParams}> slot( cls *pCls, ret (cls::*pFnc)( ${funcAnonParams} ) )\n" |
144 | " {\n" | 144 | " {\n" |
145 | " if( !pCls || !pFnc ) throw SignalException(\"NULL pointer in slot().\");\n" | 145 | " if( !pCls || !pFnc ) throw SignalException(\"NULL pointer in slot().\");\n" |
146 | " return Signal${i}<${templCallParams}>(\n" | 146 | " return Signal${i}<${templCallParams}>(\n" |
147 | " new __Slot${i}<cls, ${templCallParams}>( pCls, pFnc )\n" | 147 | " new __Slot${i}<cls, ${templCallParams}>( pCls, pFnc )\n" |
148 | " );\n" | 148 | " );\n" |
149 | " }\n" | 149 | " }\n" |
150 | " \n" | 150 | " \n" |
151 | " template<${templParams}>\n" | 151 | " template<${templParams}>\n" |
152 | " Signal${i}<${templCallParams}> slot( ret (*pFnc)( ${funcAnonParams} ) )\n" | 152 | " Signal${i}<${templCallParams}> slot( ret (*pFnc)( ${funcAnonParams} ) )\n" |
153 | " {\n" | 153 | " {\n" |
154 | " if( !pFnc ) throw SignalException(\"NULL pointer in slot().\");\n" | 154 | " if( !pFnc ) throw SignalException(\"NULL pointer in slot().\");\n" |
155 | " return Signal${i}<${templCallParams}>(\n" | 155 | " return Signal${i}<${templCallParams}>(\n" |
156 | " new __Slot${i}F<${templCallParams}>( pFnc )\n" | 156 | " new __Slot${i}F<${templCallParams}>( pFnc )\n" |
157 | " );\n" | 157 | " );\n" |
158 | " }\n" | 158 | " }\n" |
159 | "#endif // BU_SIGNAL_PARAM_COUNT_${i}\n" | 159 | "#endif // BU_SIGNAL_PARAM_COUNT_${i}\n" |
160 | "\n" | 160 | "\n" |
161 | ); | 161 | ); |
162 | } | 162 | } |
163 | 163 | ||
164 | fOut.write( | 164 | fOut.write( |
165 | "};\n" | 165 | "};\n" |
166 | "\n" | 166 | "\n" |
167 | "#endif\n" | 167 | "#endif\n" |
168 | ); | 168 | ); |
169 | fOut.close(); | 169 | fOut.close(); |
170 | } | 170 | } |
171 | 171 | ||
@@ -0,0 +1,90 @@ | |||
1 | action "default" | ||
2 | { | ||
3 | build: targets("pkg"); | ||
4 | } | ||
5 | |||
6 | PKG_BASE = "libbu++-$(cat version)-r$(svnversion "-n").tar"; | ||
7 | |||
8 | target PKG_BASE | ||
9 | { | ||
10 | input [ | ||
11 | "LICENSE", | ||
12 | "README.md", | ||
13 | "Doxyfile", | ||
14 | "Makefile", | ||
15 | "version", | ||
16 | files("*.bld"), | ||
17 | "support/vim/syntax/taf.vim", | ||
18 | "support/vim/ftdetect/taf.vim", | ||
19 | "support/vim/ftplugin/taf.vim", | ||
20 | files("*.sh"), | ||
21 | files("autoconfig.cpp"), | ||
22 | files("src/*.cpp"), | ||
23 | files("src/*.h"), | ||
24 | files("src/stable/*.cpp"), | ||
25 | files("src/stable/*.h"), | ||
26 | files("src/unstable/*.cpp"), | ||
27 | files("src/unstable/*.h"), | ||
28 | files("src/experimental/*.cpp"), | ||
29 | files("src/experimental/*.h"), | ||
30 | files("src/tests/*.cpp"), | ||
31 | files("src/tests*.h"), | ||
32 | files("src/tools/*.cpp"), | ||
33 | files("src/tools/*.h"), | ||
34 | files("src/unit/*.unit"), | ||
35 | files("src/doxy/*.dox"), | ||
36 | files("src/compat/*.cpp"), | ||
37 | files("src/compat/*.h"), | ||
38 | files("src/extra/*.cpp"), | ||
39 | files("src/extra/*.h"), | ||
40 | files("pregen/*"), | ||
41 | "api" | ||
42 | ]; | ||
43 | rule "tarball"; | ||
44 | tag "pkg"; | ||
45 | } | ||
46 | |||
47 | target PKG_BASE + ".gz" | ||
48 | { | ||
49 | input PKG_BASE; | ||
50 | tag "pkg"; | ||
51 | display "gzip"; | ||
52 | profile "build" | ||
53 | { | ||
54 | execute("gzip -9 < ${INPUT} > ${OUTPUT}"); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | target PKG_BASE + ".bz2" | ||
59 | { | ||
60 | input PKG_BASE; | ||
61 | tag "pkg"; | ||
62 | display "bzip2"; | ||
63 | profile "build" | ||
64 | { | ||
65 | execute("bzip2 -9 < ${INPUT} > ${OUTPUT}"); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | target PKG_BASE + ".xz" | ||
70 | { | ||
71 | input PKG_BASE; | ||
72 | tag "pkg"; | ||
73 | display "xz"; | ||
74 | profile "build" | ||
75 | { | ||
76 | execute("xz -9vv < ${INPUT} > ${OUTPUT}"); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | rule "tarball" | ||
81 | { | ||
82 | input matches("LICENSE", "*.md", "Makefile", "*.cpp", "*.h", "*.conf", | ||
83 | "*.bld", "Doxyfile", "*.vim", "*.sh", "*.unit", "api", "version"); | ||
84 | profile "build" | ||
85 | { | ||
86 | OUTDIR = OUTPUT.replace(".tar",""); | ||
87 | execute("tar -f ./${OUTPUT} --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT}"); | ||
88 | } | ||
89 | } | ||
90 | |||