Initial Bitbucket→GitHub migration commit, based on release v2.0.0.

This commit is contained in:
Thomas M. Edwards 2019-12-23 13:45:15 -06:00
commit 57e1aa52ff
36 changed files with 5026 additions and 0 deletions

52
statsitics.go Normal file
View file

@ -0,0 +1,52 @@
/*
Copyright © 20142019 Thomas Michael Edwards. All rights reserved.
Use of this source code is governed by a Simplified BSD License which
can be found in the LICENSE file.
*/
package main
import (
"log"
)
// statistics are collected statistics about the compiled story.
type statistics struct {
files struct {
project []string // Project source files.
external []string // Both modules and the head file.
}
counts struct {
passages uint64 // Count of all passages.
storyPassages uint64 // Count of story passages.
storyWords uint64 // Count of story passage "words" (typing measurement style).
}
}
var stats = statistics{}
func statsAddProjectFile(filepath string) {
stats.files.project = append(stats.files.project, filepath)
}
func statsAddExternalFile(filepath string) {
stats.files.external = append(stats.files.external, filepath)
}
func statsLog() {
log.Print("Statistics")
log.Printf(" Total> Passages: %d", stats.counts.passages)
log.Printf(" Story> Passages: %d, Words: %d", stats.counts.storyPassages, stats.counts.storyWords)
}
func statsLogFiles() {
log.Println("Processed files (in order)")
log.Printf(" Project files: %d", len(stats.files.project))
for _, file := range stats.files.project {
log.Printf(" %s", file)
}
log.Printf(" External files: %d", len(stats.files.external))
for _, file := range stats.files.external {
log.Printf(" %s", file)
}
}