aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-11 18:39:03 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-11 18:39:03 -0800
commit1776ba30d4a746cd4f1cf7f69ec4f9a7a762d34a (patch)
tree887344165c296ea0c14ab03b1480e39e0757065b /src/preamble.js
parent965d44dc699c22669b0fb4800e15e010f0bf48c0 (diff)
support for printing %p
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js
index da6660ba..7e1300fb 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -264,7 +264,7 @@ function __formatString() {
textIndex++;
next = IHEAP[textIndex+1];
}
- if (['d', 'u', 'f', '.'].indexOf(String.fromCharCode(next)) != -1) {
+ if (['d', 'u', 'p', 'f', '.'].indexOf(String.fromCharCode(next)) != -1) {
var currArg;
var argText;
// Handle very very simply formatting, namely only %.Xf
@@ -292,6 +292,9 @@ function __formatString() {
} else if (next == 'u'.charCodeAt(0)) {
currArg = getNextArg(next);
argText = String(unSign(currArg, 32));
+ } else if (next == 'p'.charCodeAt(0)) {
+ currArg = getNextArg(next);
+ argText = '0x' + currArg.toString(16);
} else {
currArg = getNextArg(next);
argText = String(+currArg); // +: boolean=>int
@@ -306,6 +309,9 @@ function __formatString() {
} else if (next == 'c'.charCodeAt(0)) {
ret = ret.concat(getNextArg(next));
textIndex += 2;
+ } else {
+ ret.push(curr);
+ textIndex += 1; // not sure what to do with this %, so print it
}
} else {
ret.push(curr);