Jun. 27th, 2006

swestrup: (Default)

I escaped from the Dungeon of Swestrup!

I killed Sarahcarotte the floating eye, Mousme the rat, Teghrannah the rat, Xipetotec the zombie, Skjalm the leprechaun, Electricland the nymph, Libie the owlbear, Angorian the gelatinous cube and The Exclamation the troll.

I looted the Sword of Tjernobyl, the Amulet of Xenophrenology, the Shield of Ipanicked, a Figurine of Miseri, the Dagger of Secret History, the Wand of Writing and 166 gold pieces.

Score: 241

Explore the Dungeon of Swestrup and try to beat this score,
or enter your username to generate and explore your own dungeon...


And now, off to bed!
swestrup: (Default)
I think I finally fell asleep around 1:00 am last night. Maybe as late as 2:00. In either case, getting up at 5:00 was not really in my plans any more. Instead, my bladder and sinuses conspired to wake me at 7:00, just late enough so that if I really rushed, I would still miss the networking meeting, but far too early for any other purpose I can think of.

Naturally attempts to fall back asleep failed. So, here I am awake in the morning, with far too little sleep, and no real plans for the rest of the day. I think genuine caffeine is called for in this situation...
swestrup: (Default)
Since I'm awake way too early, and drinking caffeine, I've been thinking strange things about extending CPP. Mainly because I have been reading the Boost Preprocessor libraries to see how they implemented things. In short, its obvious that they used a combination of utterly gormless stubborness, and a preprocessor-header generator. This is because they have 256 versions of almost every macro they defined, as well as any macros it may depend on. Sometimes they have 5 or 6 sets of 256 macros so they can nest. Eeep.

I've been wondering what the simplest extension to CPP would be that would greatly reduce the difficulty of writing the Boost PP libraries, while simultaneously not breaking existing code. I came up with one, but its kinda ugly.

Ideally, one would want to introduce a new CPP operator such as #eval(x) which simply returns the expansion of x as it would be evaluated on a #if line (with all booleans yielding 0 or 1). A macro inside a #eval() would be expanded, even if it appears in the expansion of that macro. Thus one could now explicitly request recursion. With this one could write something like:

#define ARG2_0(x,y) x
#define ARG2_1(x,y) y
#define IF_(b,x,y) ARG2_##b(x,y)

#define IF(b,x,y) IF_(#eval(b),x,y)
#define IFDEF(m,x,y) IF(defined(m),x,y)

#define FAC(n) IF( (n<=1), 1, #eval(FAC(n-1)))

(There's some handwaving above. I'm not sure that, as written, FAC would really work within CPP's rules without a few more levels of indirection, but I'm fairly sure it can be written to work). Now, actually using #eval() as the operator could cause all sorts of conflicts, and the only thing I've been able to think of (other than introducing another syntactic marker like @), is to hijack the new _Pragma operator for this. Thus, one would need to actually write:

#define PRAGMA(x) _Pragma(#x)
#define EVAL(x) PRAGMA(GCC oper eval x)

#define ARG2_0(x,y) x
#define ARG2_1(x,y) y
#define IF_(b,x,y) ARG2_##b(x,y)

#define IF(b,x,y) IF_(EVAL(b),x,y)
#define IFDEF(m,x,y) IF(defined(m),x,y)

#define FAC(n) IF( ((n)<=1), 1, EVAL(FAC(n-1)))

Which is either lots better or lots worse, depending on how you look at it. What thinks people?

It would be non-trivial to implement in, for instance, GCC because their implementation of _Pragma is already a horrible hack of their implementation of #Pragma which is a horrible hack of their implementation of command-line options (I just looked). Still, it looks to be less than a weeks work (part time). I wonder if suggesting an extension, with a patch, is a good idea, or a stupid one?
swestrup: (Default)


I discovered while I was in Copenhagen that while Google has maps of the area, it doesn't have any of the street names, so you can't ask it to put a marker anywhere. This site lets you just click where you want the marker. So, the above (should be) a map of Copenhagen with a marker showing the location of the apartment we stayed at there.

EDIT: Bah: LJ strips out IFrames. Anyway, go to http://www.quikmaps.com to check it out. They were knocked out by Digg, but should be back up soon. Meanwhile you can visit their mirror at http://quikmaps.geotripping.com.

You might also try clicking on this link, to see if it gets you the map.
swestrup: (Default)
From somewhere in my youth, the term "Joe Job" referred to a job that was so simple any old joe could do it. Since I didn't get enough sleep last night, there are severe limits on my ability to think today, so I've spent it doing joe jobs.

There are more than enough to fill a day. Mostly what I've been working on so far is entering the scribbled data about what I've been doing the last two weeks, so that I can produce invoices for my client, so I can get paid. Not exactly unimportant work, but its rather tedious.

After that, I have some mind-numbing data entry, and some scanning that needs to be done. Oh, joy.

Done!

Jun. 27th, 2006 08:33 pm
swestrup: (Default)
I am so done for today. I'm not even toast. I'm charcoal. Having finally finished my MDANT (minimum daily allotment of necessary tasks), I shall now proceed to wind down, fall over, and push out some Zzzzzzzs.
swestrup: (Default)
Its unkind to think of someone as stupid. Instead, try to consider them 'insufficiently smart' instead!

January 2017

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 15th, 2026 09:44 am
Powered by Dreamwidth Studios