<commit_before>#!/usr/bin/tclsh
# /etc/ports.conf options
package provide darwinports 1.0


namespace eval darwinports {
	proc portpath {args} {
		global portpath
		set portpath $args
	}

	proc distpath {args} {
		global distpath
		set distpath $args
	}

	proc readconf {args} {
		global portpath distpath
		if [file isfile /etc/ports.conf] {
			source /etc/ports.conf
		}
	}
	
	proc init {args} {
		global portpath distpath libpath auto_path
		# Defaults

		set portpath /usr/darwinports
		darwinports::readconf
		
		# Prefer the PORTPATH environment variable
		upvar env env
		if {[llength [array names env PORTPATH]] > 0} {
			set portpath [lindex [array get env PORTPATH] 1]
		}

		if ![info exists distpath] {
			set distpath $portpath/distfiles
		}
		if ![info exists libpath] {
			set libpath $portpath/Tcl
		}

		if [file isdirectory $libpath] {
			if [catch {pkg_mkIndex $libpath *.tcl *.so *.dylib} result] {
				return -1
			} else {
				lappend auto_path $libpath
			}
		} else {
			return -1
		}
		return 0
	}
}
<commit_msg>Use global instead of upvar.  Much nicer.<commit_after>#!/usr/bin/tclsh
# /etc/ports.conf options
package provide darwinports 1.0


namespace eval darwinports {
	proc portpath {args} {
		global portpath
		set portpath $args
	}

	proc distpath {args} {
		global distpath
		set distpath $args
	}

	proc readconf {args} {
		global portpath distpath
		if [file isfile /etc/ports.conf] {
			source /etc/ports.conf
		}
	}
	
	proc init {args} {
		global portpath distpath libpath auto_path env
		# Defaults

		set portpath /usr/darwinports
		darwinports::readconf
		
		# Prefer the PORTPATH environment variable
		if {[llength [array names env PORTPATH]] > 0} {
			set portpath [lindex [array get env PORTPATH] 1]
		}

		if ![info exists distpath] {
			set distpath $portpath/distfiles
		}
		if ![info exists libpath] {
			set libpath $portpath/Tcl
		}

		if [file isdirectory $libpath] {
			if [catch {pkg_mkIndex $libpath *.tcl *.so *.dylib} result] {
				return -1
			} else {
				lappend auto_path $libpath
			}
		} else {
			return -1
		}
		return 0
	}
}

{'fraction_non_alphanumeric': 0.09760765550239234, 'fraction_numerical': 0.0066985645933014355, 'mean_word_length': 2.960227272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5309534', 'n_tokens_mistral': 871, 'n_tokens_neox': 738, 'n_words': 226}