Update for language changes regarding unique strings

This commit is contained in:
Patrick Walton 2012-07-12 22:49:01 -07:00
parent 5afae787ce
commit b7b17dccd1
8 changed files with 18 additions and 16 deletions

View file

@ -112,7 +112,7 @@ class Content<S:Sink send copy> {
fn handle_control_msg(control_msg: ControlMsg) -> bool { fn handle_control_msg(control_msg: ControlMsg) -> bool {
alt control_msg { alt control_msg {
ParseMsg(filename) { ParseMsg(filename) {
#debug["content: Received filename `%s` to parse", *filename]; #debug["content: Received filename `%s` to parse", filename];
// Note: we can parse the next document in parallel // Note: we can parse the next document in parallel
// with any previous documents. // with any previous documents.
@ -131,11 +131,11 @@ class Content<S:Sink send copy> {
} }
ExecuteMsg(filename) { ExecuteMsg(filename) {
#debug["content: Received filename `%s` to execute", *filename]; #debug["content: Received filename `%s` to execute", filename];
alt read_whole_file(*filename) { alt read_whole_file(filename) {
err(msg) { err(msg) {
println(#fmt["Error opening %s: %s", *filename, msg]); println(#fmt["Error opening %s: %s", filename, msg]);
} }
ok(bytes) { ok(bytes) {
let cx = self.jsrt.cx(); let cx = self.jsrt.cx();
@ -143,7 +143,7 @@ class Content<S:Sink send copy> {
cx.set_logging_error_reporter(); cx.set_logging_error_reporter();
cx.new_compartment(global_class).chain(|compartment| { cx.new_compartment(global_class).chain(|compartment| {
compartment.define_functions(debug_fns); compartment.define_functions(debug_fns);
cx.evaluate_script(compartment.global_obj, bytes, *filename, 1u) cx.evaluate_script(compartment.global_obj, bytes, filename, 1u)
}); });
} }
} }

View file

@ -36,7 +36,7 @@ class Engine<S:Sink send copy> {
alt request { alt request {
LoadURLMsg(url) { LoadURLMsg(url) {
let url = copy url; let url = copy url;
if (*url).ends_with(".js") { if url.ends_with(".js") {
self.content.send(ExecuteMsg(url)) self.content.send(ExecuteMsg(url))
} else { } else {
self.content.send(ParseMsg(url)) self.content.send(ParseMsg(url))

View file

@ -223,15 +223,15 @@ fn spawn_css_lexer_task(-filename: ~str) -> port<Token> {
let result_chan = chan(result_port); let result_chan = chan(result_port);
task::spawn(|| { task::spawn(|| {
assert (*copy filename).ends_with(".css"); assert (copy filename).ends_with(".css");
let file_try = io::read_whole_file(*filename); let file_try = io::read_whole_file(filename);
// Check if the given css file existed, if it does, parse it, // Check if the given css file existed, if it does, parse it,
// otherwise just send an eof. This is a hack to allow // otherwise just send an eof. This is a hack to allow
// guessing that if foo.html exists, foo.css is the // guessing that if foo.html exists, foo.css is the
// corresponding stylesheet. // corresponding stylesheet.
if file_try.is_ok() { if file_try.is_ok() {
#debug["Lexing css sheet %s", *copy filename]; #debug["Lexing css sheet %s", copy filename];
let file_data = file_try.get(); let file_data = file_try.get();
let reader = io::bytes_reader(file_data); let reader = io::bytes_reader(file_data);
@ -244,7 +244,7 @@ fn spawn_css_lexer_task(-filename: ~str) -> port<Token> {
if should_break { break; } if should_break { break; }
} }
} else { } else {
#debug["Failed to open css sheet %s", *copy filename]; #debug["Failed to open css sheet %s", copy filename];
result_chan.send(Eof); result_chan.send(Eof);
} }
}); });

View file

@ -159,7 +159,7 @@ fn build_dom(scope: NodeScope, stream: port<Token>) -> (Node, port<Stylesheet>)
alt elmt.get_attr("href") { alt elmt.get_attr("href") {
some(filename) { some(filename) {
#debug["Linking to a css sheet named: %s", filename]; #debug["Linking to a css sheet named: %s", filename];
style_chan.send(file(~copy filename)); style_chan.send(file(copy filename));
} }
none { /* fall through*/ } none { /* fall through*/ }
} }

View file

@ -169,8 +169,8 @@ fn spawn_html_lexer_task(-filename: ~str) -> port<Token> {
task::spawn(|| { task::spawn(|| {
let filename = copy html_file; let filename = copy html_file;
assert (copy *filename).ends_with(".html"); assert (copy filename).ends_with(".html");
let file_data = io::read_whole_file(*filename).get(); let file_data = io::read_whole_file(filename).get();
let reader = io::bytes_reader(file_data); let reader = io::bytes_reader(file_data);
let lexer = lexer(reader, NormalHtml); let lexer = lexer(reader, NormalHtml);

View file

@ -69,7 +69,8 @@ fn mainloop(po: port<Msg>) {
let check_for_messages = fn@() { let check_for_messages = fn@() {
// Handle messages // Handle messages
#debug("osmain: peeking"); #debug("osmain: peeking");
if po.peek() { let mut i = 0u;
while po.peek() {
alt po.recv() { alt po.recv() {
AddKeyHandler(key_ch) { AddKeyHandler(key_ch) {
key_handlers.push(key_ch); key_handlers.push(key_ch);

View file

@ -15,6 +15,7 @@ use stb_image;
use geom; use geom;
use glut; use glut;
use layers; use layers;
use opengles;
mod dom { mod dom {
mod base; mod base;

View file

@ -40,7 +40,7 @@ fn run_pipeline_screen(urls: ~[str]) {
for urls.each |filename| { for urls.each |filename| {
#debug["master: Sending filename `%s`", filename]; #debug["master: Sending filename `%s`", filename];
engine_chan.send(LoadURLMsg(~copy filename)); engine_chan.send(LoadURLMsg(copy filename));
#debug["master: Waiting for keypress"]; #debug["master: Waiting for keypress"];
keypress_from_osmain.recv(); keypress_from_osmain.recv();
} }
@ -68,7 +68,7 @@ fn run_pipeline_png(-url: str, outfile: str) {
let engine = Engine(sink); let engine = Engine(sink);
let engine_chan = engine.start(); let engine_chan = engine.start();
let url = copy url; let url = copy url;
engine_chan.send(LoadURLMsg(~url)); engine_chan.send(LoadURLMsg(url));
alt buffered_file_writer(outfile) { alt buffered_file_writer(outfile) {
ok(writer) { ok(writer) {
writer.write(pngdata_from_sink.recv()) writer.write(pngdata_from_sink.recv())