forked from flyunix/emlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace.sh
More file actions
executable file
·52 lines (41 loc) · 1.29 KB
/
Copy pathreplace.sh
File metadata and controls
executable file
·52 lines (41 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
SUB_SEGM="pool_t;POOL_ALIGNMENT;"
SEGMENT="IDECL;INLINE;DECL;IDEF;DEF;size_t;ssize_t;bool_t;TRUE;FALSE;CHECK_STACK;list;str_t;sys_info;assert;bzero;pool_alloc;pool_calloc;pool_release;pool_reset;thread_this;${SUB_SEGM}"
SEGMENT="HAS_THREADS;DEBUG;ansi_;MAX_OBJ_NAME;mutex_lock;mutex_unlock;UNUSED_ARG;${SEGMENT}"
SED_EXP=
isUpper()
{
word="$1"
echo ${word} | grep '^[A-Z]' >/dev/null
if [[ "$?" == "0" ]]; then
return 1;
else
return 0;
fi
}
oldIFS=$IFS;
IFS=";"
for item in $SEGMENT;
do
echo Item: "${item}"
isUpper ${item}
if [ $? -eq 1 ];then
EXP="s/PJ_${item}/EM_${item}/I;"
else
EXP="s/pj_${item}/em_${item}/i;"
fi
SED_EXP="${EXP}${SED_EXP}"
done
DATA_TYPE="int8;int32;int64;uint8;uint32;uint64"
for dtype in $DATA_TYPE;
do
echo dtype: "${dtype}"
SED_EXP="s/pj_${dtype}_t/${dtype}/i;${SED_EXP}"
done
SED_EXP="s/pj_status_t/emlib_ret_t/i;${SED_EXP}"
SED_EXP="s/PJ_ASSERT_RETURN/EMLIB_ASSERT_RETURN/i;${SED_EXP}"
SED_EXP="s/em_locker/em_lock_t/g;${SED_EXP}"
SED_EXP="s/PJ_SUCCESS/EM_SUCC/g;${SED_EXP}"
IFS=${oldIFS}
echo -e "SED_EXP: ${SED_EXP}\n"
find ./ \( -name ".git" -prune -o -name "CMakeFiles" -prune -o -name "replace.sh" -prune \) -o \( -type f -print0 \) | xargs -0 -I {} sed -i "${SED_EXP}" {}