-1 karma · joined Dec 31, 2017 (8y ago) · 7 submissions
1.
Show HN: An interpreter I wrote for the ToySanta language(github.com ↗)
2 points · by leresidue · 8y ago · discuss
comment 8y ago · link · parent
I'm using it to call a zoom function in my skeleton image program.
void toysanta() {
toy *nbzoom = nullptr;
nbzoom = isVerb(L"setzoomlevel");
if(nbzoom) {
if(nbzoom->hasClaus && nbzoom->sled == toy::integer) {
bool k = false;
POINT pt = {0,0};
toy *xt = getToy(L"x");
toy *yt = getToy(L"y");
if(xt && yt && xt->canNumber() && yt->canNumber()) {
pt.x = xt->getInteger();
pt.y = yt->getInteger();
k = true;
}
setzoomlevel(nbzoom->claus.integer, k, pt);
}
}
}
The toysanta() member function is from the VerbCommand class. From the zoom widget, there's void ZoomWidget::sendzoom_to_target(bool k, POINT pt) {
if(target) {
std::wstring cc = L"setzoomlevel ";
int zoom = realZ;//(zPos-32)/3;
cc += std::to_wstring(zoom);
if(k) {
cc += L" x " + std::to_wstring(pt.x);
cc += L" y " + std::to_wstring(pt.y);
}
target->receive(&cc);
}
}
The receive() member function calls the toysanta() function from the target.What I plan, is for it to just be perfect, to be honest. I hope it may help others create better software one day.
comment 8y ago · link · parent
(yes, I am a tad attention-grabbing here;-)
...I an autodidact, I work for myself.
comment 8y ago · link · parent
You won't anymore. Predicting a particular narritive is akin to decide what will happen. The more you force the future, the more the future tries to become the past. If the future is the past, then there is no progress made. No progress made, and you have a loop.