1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 16:17:59 +01:00

Sorry, stashed changes including:

Change util.range to accept an increment as the third argument.
    Sanitize Makefile.doc
This commit is contained in:
Kris Maglione
2009-01-21 03:41:43 -05:00
parent 050cd4b2e4
commit eb88d7ea0b
9 changed files with 62 additions and 76 deletions

View File

@@ -8,3 +8,4 @@ $(TARGETS:%=\%.%):
$(MAKE) -C $* $(@:$*.%=%)
$(TARGETS): %: $(DIRS:%=%.%)

View File

@@ -5,7 +5,7 @@ OS = $(shell uname -s)
BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S")
BASE = $(TOP)/../common
DOC_SRC_FILES = $(wildcard locale/*/*.txt) $(wildcard locale/*/*.t2t)
DOC_SRC_FILES = $(wildcard locale/*/*.txt)
LOCALES = $(wildcard locale/*)
MAKE_JAR = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" sh $(BASE)/make_jar.sh
@@ -16,7 +16,7 @@ JAR_DIRS = content skin locale
JAR_TEXTS = js css dtd xml xul html xhtml
JAR_BINS = png
JAR = chrome/${NAME}.jar
JAR = chrome/$(NAME).jar
XPI_BASES = $(JAR_BASES) $(TOP)/..
XPI_FILES = install.rdf TODO AUTHORS Donators NEWS License.txt
@@ -24,14 +24,14 @@ XPI_DIRS = modules components chrome
XPI_TEXTS = js jsm
XPI_BINS = jar
XPI_NAME = ${NAME}_${VERSION}
XPI_PATH = ../downloads/${XPI_NAME}
XPI_NAME = $(NAME)_$(VERSION)
XPI_PATH = ../downloads/$(XPI_NAME)
XPI = $(XPI_PATH).xpi
RDF = ../downloads/update.rdf
RDF_IN = ${RDF}.in
RDF_IN = $(RDF).in
BUILD_DIR = build.${VERSION}.${OS}
BUILD_DIR = build.$(VERSION).$(OS)
ASCIIDOC = asciidoc
@@ -39,17 +39,24 @@ ASCIIDOC = asciidoc
#### rules
.PHONY: all help info doc jar xpi install clean distclean $(JAR)
TARGETS = all help info doc jar xpi install clean distclean $(JAR)
$(TARGETS:%=\%.%):
echo MAKE $* $(@:$*.%=%)
$(MAKE) -C $* $(@:$*.%=%)
$(TARGETS): %: $(LOCALES:%=%.%)
.PHONY: $(TARGETS)
all: help
help:
@echo "${NAME} ${VERSION} build"
@echo "$(NAME) $(VERSION) build"
@echo
@echo " make help - display this help"
@echo " make info - show some info about the system"
@echo " make doc - build doc files"
@echo " make jar - build a JAR (${JAR})"
@echo " make xpi - build an XPI (${XPI_NAME})"
@echo " make jar - build a JAR ($(JAR))"
@echo " make xpi - build an XPI ($(XPI_NAME))"
@echo " make release - updates update.rdf (this is not for you)"
@echo " make clean - clean up"
@echo " make distclean - clean up more"
@@ -57,32 +64,30 @@ help:
@echo "running some commands with V=1 will show more build details"
info:
@echo "version ${VERSION}"
@echo "release file ${XPI}"
@echo "doc files ${DOC_SRC_FILES}"
@echo -e "jar files $(shell echo ${JAR_FILES} | sed 's/ /\\n /g' )"
@echo "xpi files ${XPI_FILES}"
@echo "version $(VERSION)"
@echo "release file $(XPI)"
@echo "doc files $(DOC_SRC_FILES)"
@echo "xpi files $(XPI_FILES)"
xpi: ${XPI}
jar: ${JAR}
xpi: $(XPI)
jar: $(JAR)
release: ${XPI} ${RDF}
release: $(XPI) $(RDF)
${RDF}: ${RDF_IN} Makefile
$(RDF): $(RDF_IN) Makefile
@echo "Preparing release..."
${Q}${SED} -e "s,###VERSION###,${VERSION},g" \
-e "s,###DATE###,${BUILD_DATE},g" \
$(SED) -e "s,###VERSION###,$(VERSION),g" \
-e "s,###DATE###,$(BUILD_DATE),g" \
< $< > $@
@echo "SUCCESS: $@"
clean:
@echo "Cleanup..."
rm -f ${JAR} ${XPI}
rm -f $(JAR) $(XPI)
distclean: clean
distclean: clean $(LOCALES:%=%.distclean)
@echo "More cleanup..."
@set -e; for locale in $(LOCALES); do $(MAKE) -C clean; doc; done
rm -rf ${BUILD_DIR}
rm -rf $(BUILD_DIR)
#### xpi
@@ -102,5 +107,5 @@ $(JAR): doc
#### doc (see Makefile.doc)
doc:
@set -e; for locale in $(LOCALES); do $(MAKE) -C $$locale doc; done
doc: $(LOCALES:%=%.doc) ;

View File

@@ -2,26 +2,16 @@
#### configuration
BASE = ../../../common
THIS_LOCALE = $(notdir $(shell pwd))
THIS_LANG = $(firstword $(subst -, ,$(THIS_LOCALE)))
ifneq ($(strip $(shell echo -n $(THIS_LANG) | wc -c)),2)
THIS_LANG = en
endif
LOCALE = $(shell basename `pwd`)
LANG = $(shell basename `pwd` | awk -F- '{ print ($$1 ~ /^..$$/) ? $$1 : "en" }')
ADC_SRC_FILES = $(wildcard *.txt)
ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html)
ADC_DEPS = $(wildcard asciidoc.conf lang-$(THIS_LANG).conf)
T2T_SRC_FILES = $(wildcard *.t2t)
T2T_FILES = $(T2T_SRC_FILES:%.t2t=%.xhtml)
T2T_DEPS = $(wildcard config.t2t)
ADC_DEPS = $(wildcard asciidoc.conf lang-$(LANG).conf)
DOC_FILES = $(ADC_FILES) $(T2T_FILES)
ASCIIDOC = asciidoc
TXT2TAGS = txt2tags
AWK = awk
.SILENT:
@@ -31,15 +21,13 @@ AWK = awk
.PHONY: all help doc asciidoc check-asciidoc clean distclean
all: doc
doc: asciidoc t2t
doc: asciidoc
help:
@echo "${NAME} ${VERSION} build"
@echo "$(NAME) $(VERSION) build"
@echo
@echo " make help - display this help"
@echo " make doc - build doc files"
@echo " make asciidoc - build asciidoc'd files only"
@echo " make t2t - build txt2tags'd files only"
@echo " make clean - clean up"
@echo " make distclean - clean up more"
@@ -52,12 +40,8 @@ distclean: clean
#### Makes single-file makes easier to type
%: %.html %.t2t %.xhtml %.t2t ;
%: %.html %.txt ;
%: %.xhtml %.t2t ;
#### asciidoc
asciidoc: check-asciidoc $(ADC_FILES)
@@ -67,13 +51,6 @@ check-asciidoc:
echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported"
$(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS)
@echo "DOC locale/$(THIS_LOCALE)/$@"
$(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(THIS_LANG) -a doctitle="$(shell basename $@)" -o $@ $<
@echo "DOC locale/$(LOCALE)/$@"
$(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(LANG) -a doctitle="$(shell basename $@)" -o $@ $<
#### txt2tags
t2t: $(T2T_FILES)
$(T2T_FILES): %.xhtml: %.t2t $(BASE)/Makefile.doc $(T2T_DEPS)
@echo "T2T locale/$(THIS_LOCALE)/$@"
txt2tags --quiet $<

View File

@@ -1064,7 +1064,7 @@ function Buffer() //{{{
let res = buffer.evaluateXPath(options["hinttags"], frame.document);
for (let [,regex] in Iterator(regexps))
{
for (let i in util.range(res.snapshotLength, 0, true))
for (let i in util.range(res.snapshotLength, 0, -1))
{
let elem = res.snapshotItem(i);
if (regex.test(elem.textContent))

View File

@@ -554,10 +554,10 @@ CompletionContext.prototype = {
{
let self = this;
let items = this.items;
let reverse = start > end;
let step = start > end ? -1 : 1;
start = Math.max(0, start || 0);
end = Math.min(items.length, end ? end : items.length);
return util.map(util.range(start, end, reverse), function (i) items[i]);
return util.map(util.range(start, end, step), function (i) items[i]);
},
getRows: function getRows(start, end, doc)
@@ -565,10 +565,10 @@ CompletionContext.prototype = {
let self = this;
let items = this.items;
let cache = this.cache.rows;
let reverse = start > end;
let step = start > end ? -1 : 1;
start = Math.max(0, start || 0);
end = Math.min(items.length, end != null ? end : items.length);
for (let i in util.range(start, end, reverse))
for (let i in util.range(start, end, step))
yield [i, cache[i] = cache[i] || util.xmlToDom(self.createRow(items[i]), doc)];
},

View File

@@ -519,25 +519,28 @@ const util = { //{{{
},
/**
* A generator that returns the values between <b>start</b> and <b>end</b>.
* If <b>reverse</b> is true then the values are returned in reverse order.
* A generator that returns the values between <b>start</b> and <b>end</b>,
* in <b>step</b> increments.
*
* @param {number} start The interval's start value.
* @param {number} end The interval's end value.
* @param {boolean} reverse Reverse the order in which the values are produced.
* @param {boolean} step The value to step the range by. May be
* negative. @default 1
* @returns {Iterator(Object)}
*/
range: function range(start, end, reverse)
range: function range(start, end, step)
{
if (!reverse)
if (!step)
step = 1;
if (step > 0)
{
while (start < end)
yield start++;
for (; start < end; start += step)
yield start;
}
else
{
while (start > end)
yield --start;
yield start += step;
}
},

View File

@@ -711,7 +711,7 @@ function History() //{{{
if (url)
{
let sh = window.getWebNavigation().sessionHistory;
for (let i in util.range(sh.index, 0, true))
for (let i in util.range(sh.index, 0, -1))
{
if (sh.getEntryAtIndex(i, false).URI.spec == url)
{
@@ -735,7 +735,7 @@ function History() //{{{
let sh = window.getWebNavigation().sessionHistory;
context.anchored = false;
context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index, 0, true))];
context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index, 0, -1))];
context.keys = { text: function (item) item.URI.spec, description: "title" };
},
count: true,
@@ -1043,8 +1043,7 @@ function QuickMarks() //{{{
list: function list(filter)
{
let marks = [key for ([key, val] in qmarks)];
// This was a lot nicer without the lambda...
let marks = [k for ([k, v] in qmarks)];
let lowercaseMarks = marks.filter(function (x) /[a-z]/.test(x)).sort();
let uppercaseMarks = marks.filter(function (x) /[A-Z]/.test(x)).sort();
let numberMarks = marks.filter(function (x) /[0-9]/.test(x)).sort();

View File

@@ -1 +0,0 @@
../../../common/Makefile.doc

View File

@@ -0,0 +1,2 @@
BASE = ../../../common
include $(BASE)/Makefile.doc