In case you haven’t noticed, the work so far in Project Distribute has simply been gathering components: finding a solid HTML control, finding a HTML template system. Part of this gathering is testing and research: making sure that we can do everything with the control that we’ll need to do with the control.
We’ve done that homework for wxWebKit. I haven’t yet finished evaluating Google CTemplate, and as soon as I find more than a few hours at a time to do some testing, that’ll be done as well.
Over the last few nights I’ve been sitting down, thinking about what I know so far, refining the Milestones I gave you before, and putting an estimate on each milestone. This thinking has uncovered some more questions I need to investigate, and more places we need to gather components.
I have one technical question left to resolve before I have a solid estimate for the first Milestone. With that line-item done I can gather up the components needed for the next steps, start learning and evaluating them, and estimate the next steps.
I can’t give you an estimate until I figure out if we can find good components or if we have to create something big from scratch. That’s where the research comes in (and why I’ve been poking hard at wxWebKit: it plays a pretty important part in the puzzle, we have to make sure it’s a good choice)
We have a web control, but we need something to display in it. In our case (constructing HTML mostly from scratch) we really don’t want to code all that HTML into our C++ program: that would make the HTML much harder to change than it should be. Ideally we want to load the HTML from a file, run it through some HTML template system that replaces (markers we left in the HTML code) with values from the C++ program.
Over the weekend I looked into these systems, and I found two: ClearSilver and Google CTemplate. ClearSilver is a C based library, available for multiple languages (including C++ bindings). It looks well used from what I can see. It also looks really complex, and the C++ bindings are very involved.
Google’s CTemplate is much better: a very simple C++ facing API, and still a fairly powerful HTML templating language. It seems that Google is switching from ClearSilver over to this. This says two things to me: that it’s Fast Enough For Google, and There Has To Be A Reason Google Wrote Its Own When It Had ClearSilver. (I suspect the answer is: this is simpler).
So I’m going to take Google’s CTemplate out for a ride: see if we can get a very basic version of our main screen working.
void PutJSValue(const std::string& memberName, KJS::JSValue* val)
WebCore::KJSProxy* js = m_frame->scriptProxy();
KJS::ScriptInterpreter* interp = js->interpreter();
KJS::ExecState* exec = interp->globalExec();
//TODO: error checking ASSERT(!exec->hadException());
//look up the object
KJS::JSValue* JSMemberName = KJS::jsString( memberName.c_str() );
KJS::Identifier identifier( JSMemberName->toString(exec) );
KJS::JSObject* rootObj = interp->globalObject();
rootObj->put(exec, identifier, val);
if ( exec->hadException() )
KJS::JSValue* theEx = exec->exception();
//TODO: figure out how to convert UString to a wxString
//use JSValue.toString() gives us a UString
window.document.baseURI. I can access
window.something, but I don’t know about anything more complex. Right now I’m not going to worry about it.
My blog now looks like the rest of my site, almost a year after I moved to WordPress.
Thanks go to my sister, who, thanks to a bit of HTML knowledge from high school, was able to piece together this WordPress theme for me (while I was making money other places). Thanks Mara!