Browse code

add tcl language support for the hinter (uses tcl hinter instead of C hinter if first line starts with # and has tclsh, wish or expect)

Dario Rodriguez authored on 21/02/2022 19:05:43
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,22 @@
1
+#!/bin/bash
2
+rm -f prototypestcl.txt
3
+ls -1 /usr/share/man/man3/ | grep "\.3tcl\.gz\$\|\.3tk\.gz\$" | grep -v "_" | grep -v "[A-Z]" | while read l ; do
4
+	f=/usr/share/man/man3/$l
5
+	if zcat $f | grep '^\\fB::' >/dev/null ; then 
6
+		continue
7
+	fi
8
+	n=$(echo $l | cut -d '.' -f 1)
9
+	echo $n >&2
10
+	nopts=$(zcat $f | grep -A1 "^\.TP" | grep '^\\fB' | grep "^...$n " | cut -d ' ' -f 2 | tr '\\' ' ' | cut -d ' '  -f 1 | grep . | uniq | wc -l | tr -cd 0-9)
11
+	if [ "m$nopts" != "m0" ] ; then
12
+		for j in $(zcat $f | grep -A1 "^\.TP" | grep '^\\fB' | grep "^...$n " | cut -d ' ' -f 2 | tr '\\' ' ' | cut -d ' '  -f 1 | grep . | uniq ) ; do
13
+			echo ...$n $j >&2
14
+			echo "$n $j|$(zcat $f | grep -A1 '^\.TP' | grep '^\\fB' | grep ^...$n\ $j | sed 's/\\f[A-Z]//g')"
15
+		done
16
+		echo ...$n >&2
17
+		echo "$n|$n: $(zcat $f | grep -A1 '^\.TP' | grep '^\\fB' | grep ^...$n\  | cut -d ' ' -f 2 | tr '\\' ' ' | cut -d ' '  -f 1 | grep . | uniq | tr '\n' ' ' | sed 's/ *$//g')"
18
+	else
19
+		echo "$n|$(zcat $f | sed '0,/SYNOPSIS/d' | sed '/DESCRIPTION/,$d' | grep  '^\\fB'  | sed 's/\\f[A-Z]//g')"
20
+	fi
21
+done | expand | sed "s/  */ /g;s/  *$//g" | grep '|.' | grep -v '|#' | grep -v ')' | sed 's/\\-/-/g;s/\\&//g;s/\\|/|/g' | tr -d '\r' | sed "s/open fileName\$/open fileName ?access ?permissions??/g;s/fconfigure channelId\$/fconfigure channelId name value ?name value ...?/g" > prototypes_tcl.txt
22
+