37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
echo ''
echo "${line}"
echo $'\t'"CK_RV (*func)($(echo "${args}" | tr $'\n' ',' | sed 's@,*$@@;s@,@, @g'));"
case "${function}" in
C_Finalize)
echo $'\t''CK_RV retval;'
;;
C_Initialize)
echo $'\t''CK_C_INITIALIZE_ARGS CK_PTR args, localargs;'
;;
C_GetFunctionList)
echo $'\t''CK_RV retval;'
echo $'\t''CK_FUNCTION_LIST_PTR pFunctionList;'
;;
esac
echo ''
echo $'\t''libcackey_wrap_init();'
if [ "${function}" = 'C_Initialize' ]; then
echo ''
echo $'\t''if (pInitArgs) {'
echo $'\t\t''args = pInitArgs;'
echo $'\t\t''if ((args->flags & CKF_OS_LOCKING_OK) == CKF_OS_LOCKING_OK) {'
#echo 'fprintf(stderr, "replacing=%p\n", pInitArgs); fflush(stderr); abort();'
echo $'\t\t\t''memcpy(&localargs, args, sizeof(*args));'
echo $'\t\t\t''localargs.CreateMutex = libcackey_wrap_createmutex;'
echo $'\t\t\t''localargs.DestroyMutex = libcackey_wrap_destroymutex;'
echo $'\t\t\t''localargs.LockMutex = libcackey_wrap_lockmutex;'
echo $'\t\t\t''localargs.UnlockMutex = libcackey_wrap_unlockmutex;'
echo $'\t\t\t''localargs.flags &= ~CKF_OS_LOCKING_OK;'
echo $'\t\t\t''pInitArgs = &localargs;'
echo $'\t\t''}'
echo $'\t''}'
fi
echo ''
echo $'\t'"func = dlsym(libcackey_wrap_handle, \"${function}\");"
echo ''
if [ "${function}" = 'C_Finalize' ]; then
echo $'\t'"retval = func($argNamesList);"
echo ''
echo $'\t''libcackey_wrap_fini();'
|