Ubuntu Pastebin

Paste from script at Thu, 17 Sep 2015 15:14:10 +0000

Download as text
 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash

###################################################################
## You may distribute or modify it under the terms of either the ##
## GNU LESSER GENERAL PUBLIC LICENSE Version 3.0 or later,       ##
## or Mozilla Public License Version 2.0 or later.               ##
###################################################################

#EN:variables for file paths
resource="../translations/source/ru/formula/source/core/resource.po"
core_resource="../workdir/SrsPartTarget/formula/source/core/resource/core_resource.src"
scfuncs="../workdir/SrsPartMergeTarget/sc/source/ui/src/scfuncs.src"
helpcontent="../helpcontent2/source/text/scalc/01/"
helpcontent_ls=( $(ls "$helpcontent"))
datefunc="../translations/source/ru/scaddins/source/datefunc.po"
file_datefunc="../workdir/SrsPartMergeTarget/scaddins/source/datefunc/datefunc.src"
analysis="../translations/source/ru/scaddins/source/analysis.po"
file_analysis="../workdir/SrsPartMergeTarget/scaddins/source/analysis/analysis_funcnames.src"
file_danalisis="../workdir/SrsPartMergeTarget/scaddins/source/analysis/analysis.src"
pricing="../translations/source/ru/scaddins/source/pricing.po"
file_pricing="../workdir/SrsPartMergeTarget/scaddins/source/pricing/pricing.src"

#EN:Are there files for work?
if [ ! -f "$resource" ]; 	then echo "The file "$resource" do not exist."; 	exit 0; fi
if [ ! -f "$core_resource" ]; 	then echo "The file "$core_resource" do not exist."; 	exit 0; fi
if [ ! -f "$scfuncs" ]; 	then echo "The file "$scfuncs" do not exist."; 		exit 0; fi
if [ -z "$helpcontent_ls" ];	then echo "The file "$helpcontent" is empty" ; 		exit 0; fi

#EN: Declaring arrays for search of functions
declare -a sc_opcode_fun
declare -a date_funcname_fun
declare -a analysis_fun
declare -a pricing_fun
declare -a arrayFUN

#EN:Make a selection of functions and codes from the formula/source/core/resource.po file 
sc_opcode_fun=( $(grep -rhA2 '\"SC_OPCODE' "$resource" | 
	sed -e '/\"string.text\"/d'  -e 's/msgid \"//' -e 's/\\n\"//' -e 's/\"//' -e '2~2d' |
	sed -e '/SC_OPCODE_ERROR_T/!s/SC_OPCODE_ERROR/#SC_OPCODE_ERROR/g' -e '/ *#/d' -e '/SC_OPCODE_TABLE_REF/d' |
	sed -e '/SC_OPCODE_NO_NAME/d')) #переворачиваем сторки

#EN:Make a selection of functions and codes from the scaddins/source/datefunc.po file
date_funcname_fun=( $(grep -rhA2 '\"DATE_FUNCNAME' "$datefunc" | 
	sed -e '/\"string.text\"/d'  -e 's/msgid \"//' -e 's/\\n\"//' -e 's/\"//' -e '2~2d' ))

#EN:Make a selection of functions and codes from the scaddins/source/analysis.po file
analysis_fun=( $(grep -rhA2 '\"ANALYSIS_FUNCNAME' "$analysis" | 
	sed -e '/\"string.text\"/d'  -e 's/msgid \"//' -e 's/\\n\"//' -e 's/\"//' -e '2~2d' ))

#EN:Make a selection of functions and codes from the scaddins/source/pricing.po file
pricing_fun=( $(grep -rhA2 '\"PRICING_FUNCNAME' "$pricing" |
	sed -e '/\"string.text\"/d'  -e 's/msgid \"//' -e 's/\\n\"//' -e 's/\"//' -e '2~2d' ))

arrayFUN=(${pricing_fun[@]} ${date_funcname_fun[@]} ${analysis_fun[@]} ${sc_opcode_fun[@]})

i=0

while [[ ${arrayFUN[$i]} != "" ]] 
	do
	
	#EN:Skip function: NEG, GOALSEEK, MVALUE, MULTIRANGE, MULTIPLE.OPERATIONS
	if [[ ${arrayFUN[$i]} == "NEG" 		|| ${arrayFUN[$i]} == "MULTIPLE.OPERATIONS" ]] ||
	   [[ ${arrayFUN[$i]} == "MULTIRANGE" 	|| ${arrayFUN[$i]} == "GOALSEEK" ]] ||
	   [[ ${arrayFUN[$i]} == "MVALUE" ]]
		then 
		i=$i+2
	fi
	
	tokenFUN=${arrayFUN[$i]}
	(( i++ ))
	strNAME=${arrayFUN[$i]}
	#echo "${tokenFUN:0:9}"

	#EN:Collect and record in the file in order: function_name, KeyID, Macro_name
	if test ${tokenFUN:0:9} == "SC_OPCODE"
		then strQTZ=$(grep -h "||${arrayFUN[$i]/\./\\\.}\"" "$core_resource" | sed -e 's/^[ \t]*//;')
		echo "${tokenFUN:0:9} ${strQTZ:15:5} "
	fi

	if test ${arrayFUN:0:8} == "ANALYSIS"
		then strQTZ=$(grep -h "||${arrayFUN[$i]}\"" "$file_analysis" | sed -e 's/^[ \t]*//;' )
		echo "${arrayFUN:0:8} ${strQTZ:15:5} "
	fi

	if test ${arrayFUN:0:4} == "DATE"
		then strQTZ=$(grep -h "||${arrayFUN[$i]}\"" "$file_datefunc" | sed -e 's/^[ \t]*//;' )
		echo "${arrayFUN:0:4} ${strQTZ:15:5} "
	fi

	if test ${arrayFUN:0:7} == "PRICING"
		then strQTZ=$(grep -h "||${pricing_fun[$i]}\"" "$file_pricing" | sed -e 's/^[ \t]*//;' )
		echo "${arrayFUN:0:7} ${strQTZ:15:5} "
	fi
	
	(( i++ ))

	done

exit 0
Download as text