Browse code

modernized project

added mulle_vararg_long_double_aligned_pointer

Nat! authored on 09-06-2017 12:15:48 • Nat! committed on 14-06-2017 15:28:11
Showing 19 changed files
1 1
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-# Always merge with --no-commit
2
-#
3
-# git reset HEAD .bootstrap/MULLE_REPOSITORIES
4
-# git checkout -- .bootstrap/MULLE_REPOSITORIES
5
-#
6
-# in case upstream tries to clobber it
7
-#
8
-https://github.com/mulle-objc
... ...
@@ -1,10 +1,2 @@
1
-#
2
-# override the repositories like so:
3
-#    echo "https://www.mulle-kybernetik.com/repositories" > .bootstrap.local/MULLE_REPOSITORIES
4
-#
5
-# override the branches like so:
6
-#    echo "master" > .bootstrap.local/MULLE_THREAD_BRANCH
7
-
8
-${MULLE_REPOSITORIES}/mulle-tests;tests/mulle-tests;${MULLE_TESTS_BRANCH:-release}
9
-${MULLE_REPOSITORIES}/mulle-homebrew;bin/mulle-homebrew;${MULLE_HOMEBREW_BRANCH:-release}
10
-${MULLE_REPOSITORIES}/mulle-configuration;;${MULLE_CONFIGURATION_BRANCH:-release}
1
+${MULLE_EMBEDDED_REPOSITORIES:-https://github.com/mulle-nat}/mulle-tests;tests/mulle-tests;${MULLE_TESTS_BRANCH:-release}
2
+${MULLE_EMBEDDED_REPOSITORIES:-https://github.com/mulle-nat}/mulle-configuration;;${MULLE_CONFIGURATION_BRANCH:-release}
... ...
@@ -5,4 +5,4 @@
5 5
 # override the branches like so:
6 6
 #    echo "master" > .bootstrap.local/MULLE_C11_BRANCH
7 7
 
8
-${MULLE_REPOSITORIES}/mulle-c11;;${MULLE_C11_BRANCH:-release}
8
+${MULLE_REPOSITORIES:-https://github.com/mulle-nat}/mulle-c11;;${MULLE_C11_BRANCH:-release}
... ...
@@ -20,5 +20,5 @@ before_install:
20 20
    - brew install mulle-kybernetik/software/mulle-build
21 21
 
22 22
 script:
23
-   - mulle-build --bootstrap
24
-   - mulle-test -vvv
23
+   - mulle-build -vv -V --bootstrap
24
+   - mulle-test -vv -V
... ...
@@ -1,3 +1,8 @@
1
+### 0.5.15
2
+
3
+* modernized project
4
+
5
+
1 6
 0.5.14
2 7
 ===
3 8
 
4 9
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+PROJECT="MulleVararg"   # your project name, requires camel-case
2
+DESC="Access variable arguments in struct layout fashion"
3
+DEPENDENCIES='${DEPENDENCY_TAP}mulle-c11'
0 4
new file mode 100755
... ...
@@ -0,0 +1,8 @@
1
+# -- Version Info --
2
+#
3
+# Keep these commented out, if the automatic detection works well
4
+# enough for you. If you don't have this file, there will be 
5
+# not git operations. 
6
+#
7
+# VERSIONFILE=
8
+# VERSIONNAME=
... ...
@@ -1,6 +1,6 @@
1 1
 #! /usr/bin/env bash
2 2
 #
3
-#   Copyright (c) 2017 Nat! - Mulle kybernetiK
3
+#   Copyright (c) 2017 Nat! - Codeon GmbH
4 4
 #   All rights reserved.
5 5
 #
6 6
 #   Redistribution and use in source and binary forms, with or without
... ...
@@ -29,40 +29,29 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 #
32
-
33
-
34
-# Define your project and the dependencies for homebrew
35
-# DEPENDENCIES and BUILD_DEPENDENCIES will be evaled later!
36
-# Then run this as
37
-#   ./bin/release.sh --publisher mulle-nat --publisher-tap mulle-kybernetik/alpha/
38 32
 #
39
-
40
-PROJECT="MulleVararg"    # requires camel-case
41
-DESC="Access variable arguments in struct layout fashion"
42
-LANGUAGE=c               # c,cpp, objc
43
-
44
-
33
+# For documentation and help see:
34
+#    https://github.com/mulle-nat/mulle-homebrew
45 35
 #
46
-# Keep these commented out, if the automatic detection works well
47
-# enough for you
36
+# Run this somewhat like this (for real: remove -n):
37
+#   ./bin/release.sh -v -n --publisher mulle-nat --publisher-tap mulle-kybernetik/software/
48 38
 #
49
-# VERSIONFILE=
50
-# VERSIONNAME=
51 39
 
52
-#
53
-# Specify needed homebrew packages by name as you would when saying
54
-# `brew install`.
55
-#
56
-# Use the ${DEPENDENCY_TAP} prefix for non-official dependencies.
57
-#
58
-# DEPENDENCIES='${DEPENDENCY_TAP}mulle-concurrent
59
-# libpng
60
-# '
61
-DEPENDENCIES='${DEPENDENCY_TAP}mulle-c11' # no camel case, will be evaled later!
40
+EXE_DIR="`dirname -- $0`"
62 41
 
63
-BUILD_DEPENDENCIES='${BOOTSTRAP_TAP}mulle-bootstrap
64
-${BOOTSTRAP_TAP}mulle-build
65
-cmake'
42
+# if there is a release-info.sh file read it
43
+if [ -f "${EXE_DIR}/release-info.sh" ]
44
+then
45
+   DO_GIT_RELEASE="YES"
46
+   . "${EXE_DIR}/release-info.sh"
47
+fi
48
+
49
+# if there is a formula-info.sh file read it
50
+if [ -f "${EXE_DIR}/formula-info.sh" ]
51
+then
52
+   DO_GENERATE_FORMULA="YES"
53
+   . "${EXE_DIR}/formula-info.sh"
54
+fi
66 55
 
67 56
 
68 57
 #######
... ...
@@ -70,7 +59,7 @@ cmake'
70 59
 #######
71 60
 
72 61
 #
73
-# Generate your `def install` `test do` lines here to stdout.
62
+# Generate your `def install` `test do` lines here. echo them to stdout.
74 63
 #
75 64
 generate_brew_formula_build()
76 65
 {
... ...
@@ -107,162 +96,58 @@ generate_brew_formula()
107 96
 #######
108 97
 
109 98
 MULLE_BOOTSTRAP_FAIL_PREFIX="`basename -- $0`"
110
-MULLE_HOMEBREW_VERSION="3.4.5"
111
-
112
-EXEC_DIR="`dirname -- $0`"
99
+MULLE_HOMEBREW_VERSION="4.0.0"
113 100
 
114 101
 #
115 102
 # prefer local mulle-homebrew if available
103
+# Do not embed it anymore!
116 104
 #
117
-if [ -x "${EXEC_DIR}/mulle-homebrew/mulle-homebrew-env" ]
118
-then
119
-   PATH="${EXEC_DIR}/mulle-homebrew:$PATH"
120
-fi
121
-
122 105
 if [ -z "`command -v mulle-homebrew-env`" ]
123 106
 then
124
-   echo "mulle-homebrew-env not found in PATH" >&2
107
+   cat <<EOF >&2
108
+mulle-homebrew-env not found in PATH.
109
+Visit the homepage for installation instructions:
110
+   https://github.com/mulle-nat/mulle-homebrew
111
+EOF
125 112
    exit 1
126 113
 fi
127 114
 
128
-
129 115
 INSTALLED_MULLE_HOMEBREW_VERSION="`mulle-homebrew-env version`" || exit 1
130 116
 LIBEXEC_DIR="`mulle-homebrew-env libexec-path`" || exit 1
131 117
 
132
-. "${LIBEXEC_DIR}/mulle-homebrew.sh" || exit 1
133
-. "${LIBEXEC_DIR}/mulle-git.sh"      || exit 1
134
-
135
-if ! homebrew_is_compatible_version "${INSTALLED_MULLE_HOMEBREW_VERSION}" "${MULLE_HOMEBREW_VERSION}"
136
-then
137
-   fail "Installed mulle-homebrew version ${INSTALLED_MULLE_HOMEBREW_VERSION} is \
138
-not compatible with this script from version ${MULLE_HOMEBREW_VERSION}"
139
-fi
140
-
141
-# parse options
142
-homebrew_parse_options "$@"
143
-
144
-#
145
-# dial past options now as they have been parsed
146
-#
147
-while [ $# -ne 0 ]
148
-do
149
-   case "$1" in
150
-      -*)
151
-         shift
152
-      ;;
153
-
154
-      --*)
155
-         shift
156
-         shift
157
-      ;;
158
-
159
-      *)
160
-         break;
161
-      ;;
162
-   esac
163
-done
164
-
165
-# --- FORMULA GENERATION ---
166
-
167
-BOOTSTRAP_TAP="${BOOTSTRAP_TAP:-mulle-kybernetik/software/}"
168
-
169
-DEPENDENCY_TAP="${DEPENDENCY_TAP:-${PUBLISHER_TAP}}"
170
-
171
-#
172
-# these can usually be deduced, if you follow the conventions
173
-#
174
-if [ -z "${NAME}" ]
175
-then
176
-   NAME="`get_name_from_project "${PROJECT}" "${LANGUAGE}"`"
177
-fi
178
-
179
-if [ -z "${VERSIONFILE}" ]
180
-then
181
-   VERSIONFILE="`get_header_from_name "${NAME}"`"
182
-fi
118
+. "${LIBEXEC_DIR}/mulle-homebrew.sh"    || exit 1
119
+. "${LIBEXEC_DIR}/mulle-git.sh"         || exit 1
120
+. "${LIBEXEC_DIR}/mulle-version.sh"     || exit 1
121
+. "${LIBEXEC_DIR}/mulle-environment.sh" || exit 1
183 122
 
184
-if [ -z "${VERSIONNAME}" ]
185
-then
186
-   VERSIONNAME="`get_versionname_from_project "${PROJECT}"`"
187
-fi
188 123
 
189
-if [ -f VERSION ]
190
-then
191
-   VERSION="`head -1 VERSION`"
192
-else
193
-   VERSION="`get_project_version "${VERSIONFILE}" "${VERSIONNAME}"`"
194
-   if [ -z "${VERSION}" ]
124
+main()
125
+{
126
+   if [ "${DO_GIT_RELEASE}" != "YES" -a "${DO_GENERATE_FORMULA}" != "YES" ]
195 127
    then
196
-      VERSION="`get_project_version "src/version.h" "${VERSIONNAME}"`"
128
+      fail "Nothing to do. release-info.sh and formula-info.sh are missing"
197 129
    fi
198
-fi
199
-
200
-# where homebrew grabs the archive off
201
-ARCHIVE_URL="${ARCHIVE_URL:-https://github.com/${PUBLISHER}/${NAME}/archive/${VERSION}.tar.gz}"
202
-
203
-# written into formula for homebrew, will be evaled
204
-HOMEPAGE_URL="${HOMEPAGE_URL:-https://github.com/${PUBLISHER}/${NAME}}"
205
-
206 130
 
207
-# --- HOMEBREW TAP ---
208
-# Specify to where and under what name to publish via your brew tap
209
-#
210
-if [ -z "${PUBLISHER_TAP}" ]
211
-then
212
-   fail "you need to specify a publisher tap with --publisher-tap (hint: <mulle-kybernetik/software/>)"
213
-fi
214
-
215
-TAPS_LOCATION="${TAPS_LOCATION:-..}"
216
-
217
-HOMEBREW_TAP="${HOMEBREW_TAP:-${TAPS_LOCATION}/homebrew-`basename -- ${PUBLISHER_TAP}`}"
218
-
219
-RBFILE="${RBFILE:-${NAME}.rb}"
220
-
221
-# --- GIT ---
222
-
223
-#
224
-# require PUBLISHER (and PUBLISHER_TAP) as command line parameter, so
225
-# that forks don't have to edit this constantly
226
-#
227
-if [ -z "${PUBLISHER}" ]
228
-then
229
-   fail "You need to specify a publisher with --publisher (hint: https://github.com/<publisher>)"
230
-fi
231
-
232
-if [ -z "${VERSION}" ]
233
-then
234
-   fail "Could not figure out the version. (hint: check VERSIONNAME, VERSIONFILE)"
235
-fi
236
-
237
-# tag to tag your release
238
-TAG="${TAG:-${TAG_PREFIX}${VERSION}}"
239
-
240
-# git remote to push to, usually origin
241
-ORIGIN="${ORIGIN:-origin}"
242
-
243
-# git remote to push to, usually github, can be empty
244
-GITHUB="${GITHUB:-github}"
245
-
246
-# git branch to release to, source is always current
247
-BRANCH="${BRANCH:-release}"
248
-
249
-
250
-main()
251
-{
252
-   # do the release
253
-   git_main "${BRANCH}" "${ORIGIN}" "${TAG}" "${GITHUB}" || exit 1
131
+   if [ "${DO_GIT_RELEASE}" = "YES" ]
132
+   then
133
+     # do the release
134
+      git_main "${BRANCH}" "${ORIGIN}" "${TAG}" "${GITHUB}" || exit 1
135
+   fi
254 136
 
255
-   # generate the formula and push it
256
-   homebrew_main "${PROJECT}" \
257
-                 "${NAME}" \
258
-                 "${VERSION}" \
259
-                 "${DEPENDENCIES}" \
260
-                 "${BUILD_DEPENDENCIES}" \
261
-                 "${HOMEPAGE_URL}" \
262
-                 "${DESC}" \
263
-                 "${ARCHIVE_URL}" \
264
-                 "${HOMEBREW_TAP}" \
265
-                 "${RBFILE}"
137
+   if [ "${DO_GENERATE_FORMULA}" = "YES" ]
138
+   then
139
+      # generate the formula and push it
140
+      homebrew_main "${PROJECT}" \
141
+                    "${NAME}" \
142
+                    "${VERSION}" \
143
+                    "${DEPENDENCIES}" \
144
+                    "${BUILD_DEPENDENCIES}" \
145
+                    "${HOMEPAGE_URL}" \
146
+                    "${DESC}" \
147
+                    "${ARCHIVE_URL}" \
148
+                    "${HOMEBREW_TAP}" \
149
+                    "${RBFILE}"
150
+   fi
266 151
 }
267 152
 
268 153
 main "$@"
... ...
@@ -14,7 +14,7 @@
14 14
 //
15 15
 // community version is always even
16 16
 //
17
-#define MULLE_VARARG_VERSION  ((0 << 20) | (5 << 8) | 14)
17
+#define MULLE_VARARG_VERSION  ((0 << 20) | (5 << 8) | 15)
18 18
 
19 19
 
20 20
 /*
... ...
@@ -141,6 +141,29 @@ static inline char  *_mulle_vararg_double_aligned_pointer( mulle_vararg_list *ar
141 141
       : *(type *) _mulle_vararg_double_aligned_pointer( &args, sizeof( type), alignof( struct{ type x; })))
142 142
 
143 143
 
144
+// untested code!
145
+static inline char  *_mulle_vararg_long_double_aligned_pointer( mulle_vararg_list *args, size_t size, unsigned int align)
146
+{
147
+   char   *q;
148
+
149
+   if( size < sizeof( long double))
150
+   {
151
+      size  = sizeof( long double);
152
+      align = alignof( struct{ long double x; });  // weirdness for i386
153
+   }
154
+
155
+   q       = mulle_pointer_align( args->p, align);
156
+   args->p = &q[ size];
157
+   return( q);
158
+}
159
+
160
+
161
+#define mulle_vararg_next_long_double( args, type)                                                                           \
162
+   (sizeof( type) < sizeof( long double)                                                                                 \
163
+      ? (type) *(long double *) _mulle_vararg_long_double_aligned_pointer( &args, sizeof( type), alignof( struct{ type x; })) \
164
+      : *(type *) _mulle_vararg_long_double_aligned_pointer( &args, sizeof( type), alignof( struct{ type x; })))
165
+
166
+
144 167
 #define mulle_vararg_copy( dst, src)  \
145 168
 do                                    \
146 169
 {                                     \
... ...
@@ -23,4 +23,4 @@ int   main( voids)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -23,4 +23,4 @@ int   main( void)
23 23
 
24 24
    mulle_vararg_end( list);
25 25
    return( 0);
26
-}
27 26
\ No newline at end of file
27
+}
... ...
@@ -22,4 +22,4 @@ int   main( void)
22 22
 
23 23
    mulle_vararg_end( list);
24 24
    return( 0);
25
-}
26 25
\ No newline at end of file
26
+}