code logs -> 2008 -> Sat, 26 Apr 2008< code.20080425.log - code.20080427.log >
--- Log opened Sat Apr 26 00:00:58 2008
00:32 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Client exited]
00:32 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
00:32 mode/#code [+o ToxicFrog] by ChanServ
00:47 Shoukanjuu [~Shoukanju@67.232.178.ns-12163] has quit [Quit: Shoukanjuu]
00:55 Shoukanjuu [~Shoukanju@Nightstar-18016.dhcp.embarqhsd.net] has joined #code
01:44 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?]
02:06 Reltzik [Reltzik@Nightstar-6074.dsl.pltn13.sbcglobal.net] has joined #code
02:07 * Reltzik needs someone to talk some sanity into him.
02:07
< Shoukanjuu>
?
02:08
< Reltzik>
I'm breeding binary search trees with linked lists. And when that didn't prove enough, I caught myself contemplating splicing in a hash table.
02:08
< Vornicus>
Why are you doing this?
02:10
<@McMartin>
You may be able to just use one hash table and be done with it
02:10
< Reltzik>
I'm storing things which have an ordering, but several distinct things which register as "equal" need to be stored in this structure.
02:10
<@McMartin>
You need an IdentityTreeSet.
02:10
< Reltzik>
The three functions I need it to perform are: add, remove, and....
02:11
< Reltzik>
something which returns a set of items in an interval. Thus, if it stored ints, and if I called interval(12, 722), it would return a set (or some set-like structure, I'm flexible there) containing all ints between 12 and 722.
02:12
< Vornicus>
yeah, an identitytreeset.
02:13
< Reltzik>
I'm not familiar with that.
02:13
< Vornicus>
It's a set, built on a tree, that works on object identity to test equality for uniqueness.
02:14
<@ToxicFrog>
Reltzik: but you might need to store, say, multiple 35s?
02:15
<@McMartin>
There actually isn't a library identitytreeset.
02:15
<@McMartin>
But basically you need a wrapper for your keys that defines equals as == on the wrapped object
02:15
<@McMartin>
And then put those into a treeset.
02:15
< Reltzik>
TF: Yeah. Or, at least, multiple things which REGISTER as 35s (but have different associated data).
02:16
< Reltzik>
Can you link me a detailed description of identitytreeset?
02:16
<@ToxicFrog>
Associated data?
02:16
<@McMartin>
No, but I can point you to IdentityHashMap.
02:16
<@McMartin>
Which is in the library and does everything you want except for the sorting.
02:16
<@ToxicFrog>
So what you actually want is an ordered set of key => value-set mappings?
02:17
<@McMartin>
And yeah, if TF is right, what you really want is a TreeMap<int, List<Record>>.
02:18
< Reltzik>
The RESULTING set from the interval function doesn't have to be ordered, but it strikes me that the function itself will be much easier if I keep the data within the structure ordered.
02:18
<@McMartin>
You may be entirely wrong.
02:18
<@McMartin>
Especially if they're integers.
02:18
< Reltzik>
They're a generic Comparable type.
02:18
<@McMartin>
You can just build a list out of successive calls to Map.get().
02:19
<@McMartin>
Ok, then that won't work.
02:19
< Reltzik>
(self-comparable)
02:19
<@McMartin>
Riht
02:19
<@McMartin>
You'll need a TreeMap.
02:19
< Reltzik>
So NO to IdentityHashMap?
02:19
<@McMartin>
Well, first
02:20
<@McMartin>
IdentityHashMap is the interface that's close to what you said you first wanted
02:20
<@McMartin>
We are now trying to discern what you actually want.
02:20
<@McMartin>
You have multiple things in this set that register as 35
02:20
<@McMartin>
And then you call, say, "get 35", and it returns all of theM?
02:20
< Reltzik>
No, actually.
02:21
<@McMartin>
Give me the story from the user's side.
02:22
< Reltzik>
Okay. The user stores THINGS in it. These things have an ordering expressed by Comparable, however, distinct objects may register as equal under comparable. This is desired -- they're getting categorized, not identified, by the compared value. (more)
02:22
< Serah>
Things, I like this technical definition. So very precise while being so very vague.
02:22
< Serah>
THINGS!
02:23
< Reltzik>
It's supposed to be vague, it's a generic class.
02:23
<@McMartin>
That's unpleasant for a natural ordering, though if you're using a custom comparable, this is acceptable.
02:23
<@McMartin>
You will want constructors for both, much like TreeSet.
02:23
< Reltzik>
Okay, here's what I'm ACTUALLY using it for.
02:24
< Reltzik>
I've got a given value of data I want to monitor and a whole bunch of stuff that subscribes to it, watching for changes. (Though this sounds like event-driven stuff, it isn't, all in the same thread.)
02:25
< Reltzik>
I'm making a class of monitor that does something whenever a certain line is crossed. Imagine, say, a thermostat, which you've programmed to switch modes when the temperature goes above/below 75 degrees.
02:25
< Reltzik>
If one moment the thermostat registers 70 degrees, and the next it registers 78, you can't just lookup 70 or 78 and find the instructions for the 75 threshold.
02:26
< Reltzik>
So what I'm doing is making a collection of these monitors. Whenever a new value comes in, I'll get the set of everything monitoring on the INTERVAL from 70 to 78.
02:26
< Reltzik>
There can be multiple 75s because there can be multiple things WATCHING for it to cross the 75 line.
02:27
<@McMartin>
OK. What you'll really be doing, in the collections framework, is iterating over everthing, firing results once you hit 70, and then stopping once you hit 78.
02:27
<@McMartin>
Or collecting htem and returning them as an interval.
02:27
< Reltzik>
..... I just made that more confusing, didn't I?
02:27
<@McMartin>
You want a TreeSet made of these: http://rafb.net/p/Md3ebJ77.html
02:27
<@McMartin>
I missed a method, though.
02:27
<@McMartin>
public int compareTo(Object o) { return val.compare(o); }
02:28
<@McMartin>
Also, I guess, public T getVal() { return val; }
02:28
<@McMartin>
So that you can actually pick the value out once you've extracted it.
02:28
< Reltzik>
That's one way to do it, but my crossbreeding approach gives me O(lg n) + O(k) (k being the size of the interval), whereas iterating over everything is O(n).
02:28
< Reltzik>
*checks link*
02:29
<@McMartin>
That said
02:29
<@McMartin>
Stick with O(n) until you can prove it's not good enough.
02:30
< Reltzik>
It's going to be a frequently-used aspect of my overall program, with several pieces of data having lots of monitors stuck on them. I'd rather squeeze as much efficeincy out of it as I can.
02:30
<@McMartin>
TreeSet includes a method called "subSet" that does exactly what you want.
02:31
< Reltzik>
*goes to check*
02:31
<@McMartin>
That said, You're Doing It Wrong.
02:31
<@McMartin>
You want a multimap.
02:32
<@McMartin>
From Data -> List<Monitor>.
02:32
<@McMartin>
It would be a TreeMap with variants to append instead of replace when you add elements.
02:32
<@McMartin>
(And the method there is "subMap".)
02:33
<@McMartin>
The problem with your interval version with sets is that the event is the data piece
02:33 * Reltzik doesn't follow.
02:33
<@McMartin>
When you're pulling the interval out, you need to tell it "give me all the monitors between THIS monitor and THAT monitor."
02:33
<@McMartin>
You want to take a set of data points and get a set of monitors.
02:33
<@McMartin>
That's a mapping operation.
02:34 * Reltzik ponders.
02:34
<@McMartin>
public class TreeMultiMap<K,V> extends TreeMap<K, List<V>>
02:34
< Reltzik>
List being a Listener?
02:34
<@McMartin>
V being Listener.
02:35
<@McMartin>
List being, you know, List.
02:35
<@McMartin>
By extending this, add (35, list_of_monitors) will do a replace
02:35
<@McMartin>
You will need to implement an add (K, V) operation that either produces a one-element list and sets it, or appends it to the already-present list.
02:36
<@McMartin>
To do interval, you pull out the subMap and iterate over the values().
02:36
<@McMartin>
remove will also need modification to not wipe the whole list.
02:38
<@McMartin>
There doesn't seem to be a free implementation of MultiTreeMap.
02:38
< Reltzik>
I suppose that's easilly-enough done... just wish the API documented the time efficeincies. *frowns at the exception generated by keys outside of range*
02:40
< Reltzik>
Bah, no big deal, it's not that much trouble to say that it maps to sets.
02:42 * Reltzik REALLY hopes that they didn't make that submap opperation O(n) time...
02:43
<@ToxicFrog>
As McM said, don't worry about the efficiency until you can prove it's not good enough.
02:44
< Reltzik>
And hey! Even if it doesn't, using hashsets for "equal" entries would solve my original problem!
02:45
< Reltzik>
The problem is, I have no way of projecting what's going to be a commonly looked-up interval. The entire thing? Four or five items right on the median? How big would a normal thing be? No clue. So I won't be able to prove it until I implement it, and I'd rather not have to retool the screws once the entire engine's assembled.
02:46
< Reltzik>
All I know is that the interval operation should be expected to be called more than add or remove.
02:47
<@McMartin>
You're going to have to retool the screws once the entire engine's assembled.
02:47
< Reltzik>
SOME screws, yes. I'd rather keep the number to a minimum.
02:47
<@McMartin>
If you try to plan out your corner cases in advance, you'll find out that in carefully ensuring that the upholstery didn't catch on the door handle, you made the wheels be square.
02:48
< Reltzik>
Heh. I don't think this is THAT extreme.
02:48
< Reltzik>
Actually, a linked-list/balanced-tree hybrid holding hashsets should cover it.... if only it didn't PAIN me to read that.
02:49
<@McMartin>
I'm still not seeing where the linked-list comes in.
02:49 * Reltzik ponders.
02:50
<@McMartin>
Iterating over a tree is O(n), and finding the first element is O(lg n).
02:50
< Reltzik>
Oh, dammit! I just realized that the linked list adds almost nothing.
02:50
< Reltzik>
Yeah. I was worrying about the case of a large tree, where the start and finish of a small interval are on opposite sides of the root.
02:51
< Reltzik>
But getting the interval's still O(lg n). I'd gotten it stuck in my head that it was O(n) for some reason.
02:51
<@McMartin>
Starting it is O(lg n)
02:52
< Reltzik>
Er, correction.
02:52
<@McMartin>
If they ask for the whole map, duplicating it is O(n) at the least
02:52
< Reltzik>
Correction, O(lg n) + O(k), with k = interval size.
02:52
< Reltzik>
(Provided the tree's balanced, of course.)
02:53
< Reltzik>
And I'd gotten it stuck in my head that it was O(k * lg n).
02:53
<@McMartin>
TreeMap is red-black tree
02:53
<@McMartin>
O(k*lg n) for building a TreeMap/Set in the first place.
02:54
< Reltzik>
Mrrr.... I can get O(k) + O(lg n) out of it.... I suppose lg n isn't much.... still....
02:55
< Reltzik>
See, what I pass back doesn't have to be the same type as what I store it in. A linked list will do just fine.
02:56
<@McMartin>
Yes.
02:56
<@McMartin>
Hell, actually return it as a Collection.
02:56
< Reltzik>
((Not a linked list IN the structure, though.))
02:56
< Reltzik>
Exactly.
02:57
<@McMartin>
Anyway, home, food, sleep
02:57
< Reltzik>
Okies. Thanks.
02:58 Reltzik [Reltzik@Nightstar-6074.dsl.pltn13.sbcglobal.net] has quit [Quit: DEATH TO THE UNDEAD!]
03:12 Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has joined #code
03:12 mode/#code [+o Thaqui] by ChanServ
04:35 peace_72 [peace_72@41.249.49.ns-11893] has joined #code
04:35 peace_72 [peace_72@41.249.49.ns-11893] has left #code []
05:08 C_tiger [~c_wyz@Nightstar-5214.nycmny.east.verizon.net] has joined #code
05:08 mode/#code [+o C_tiger] by ChanServ
06:17 C_tiger [~c_wyz@Nightstar-5214.nycmny.east.verizon.net] has quit [Ping Timeout]
06:21 C_tiger [~c_wyz@Nightstar-18112.nycmny.east.verizon.net] has joined #code
06:21 mode/#code [+o C_tiger] by ChanServ
06:30 AnnoDomini [AnnoDomini@Nightstar-29241.neoplus.adsl.tpnet.pl] has joined #Code
06:30 mode/#code [+o AnnoDomini] by ChanServ
07:02 Kazriko [~kaz@Nightstar-26352.gdj-co.client.bresnan.net] has quit [Ping Timeout]
07:04 Kazriko [~kaz@Nightstar-26352.gdj-co.client.bresnan.net] has joined #code
07:04 mode/#code [+o Kazriko] by ChanServ
07:37 McMartin [~mcmartin@Nightstar-18930.dsl.pltn13.sbcglobal.net] has quit [Operation timed out]
07:46 McMartin [~mcmartin@Nightstar-5868.dsl.pltn13.sbcglobal.net] has joined #code
07:46 mode/#code [+o McMartin] by ChanServ
08:20 Vornicus is now known as Vornicus-Latens
09:47 JeffL [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has quit [Quit: Leaving]
10:11 AnnoDomini [AnnoDomini@Nightstar-29241.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
10:18 AnnoDomini [AnnoDomini@Nightstar-6902.neoplus.adsl.tpnet.pl] has joined #Code
10:18 mode/#code [+o AnnoDomini] by ChanServ
10:51 Chalcedon [~Chalcy@Nightstar-488.ue.woosh.co.nz] has quit [Quit: Leaving]
10:57 You're now known as TheWatcher[afk]
11:08 Molgorn [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has joined #code
11:08
< Molgorn>
Hey hey hey, kids and kidettes! It's time for another round of Happy Compiler Fun Time!
11:09
<@AnnoDomini>
beer_pump.c:335: robust error in 'traffic_cone()' - 'traffic_light' is not a budgerigar
11:09 * jerith feeds epic poetry to erlc.
11:19 Aesir [~Aesir@64.252.167.ns-22145] has quit [Ping Timeout]
11:37
< Molgorn>
Anyone here familiar with yacc/bison? It turns out I suck quite a lot, and hints would be much appreciated
11:41 JeffL [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has joined #code
11:45 You're now known as TheWatcher
11:52 Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has left #code [Leaving]
13:06
< Molgorn>
Would someone kindly a) voice me, and b) take a very swift shufti at my .l and .y files to see if they're remotely sane? plzplz?
13:06 mode/#code [+v Molgorn] by C_tiger
13:06
<+Molgorn>
barring the fact that setType isn't defined yet, etc
13:06
<+Molgorn>
Cheers, C
13:06
<@C_tiger>
I can't help with part b
13:06
<@C_tiger>
sorry.
13:08
<+Molgorn>
No worries
13:08 * Molgorn drops http://rafb.net/p/XdWhf894.html on the channel anyway, in case anyone can and wants to
13:09
<+Molgorn>
er, whoops, "yylval.type" should be "yylval.string" throughout
13:12 You're now known as TheWatcher[afk]
13:41 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Quit: <Insert Humorous and/or serious exit message here>]
13:45
<@McMartin>
Molgorn: Does goal have a nonrecursive production?
13:46 * McMartin isn't fully up on his syntax for these tools, but other than that, a quick glance looks basically OK
13:46
<+Molgorn>
All I was given for goal is goal -> statementlist
13:46
<@McMartin>
I'm seeing goal -> goal statementlist '\n';
13:46
<+Molgorn>
...which I seem to have allowed to become goal _> goal statementlist
13:46
<+Molgorn>
blar
13:47
<+Molgorn>
Thank you kindly
13:47
<@McMartin>
Other than that, the only thing that jumps out is that the returns in the lexer are sometimes types and sometimes values but it's entirely possible that flex allows this and guarantees that custom tokens never conflict with characters.
13:48
<@McMartin>
But if it doesn't, that's a minor yellow flag.
13:50
<+Molgorn>
It worked last time, at least
13:53
<@McMartin>
Assuming input in ASCII, Latin-1, or UTF-8, it can't be a problem until you have 32 tokens anyway.
14:06 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
14:06 mode/#code [+o Attilla] by ChanServ
14:36
<+Molgorn>
awriiiight
14:37
<+Molgorn>
got lex and yacc to behave and play together nicely
14:37
<+Molgorn>
Now I just need to make the bits that do stuff not lead nowhere ¬¬
14:37
<@McMartin>
Heh
14:39
<+Molgorn>
That wasn't a comedically rural double negative, idly
14:39
<+Molgorn>
I do, in fact, want to create useful functionality
14:39
<@McMartin>
This is #code; !! is a perfectly valid construct!
14:40
<+Molgorn>
Damn my more-linguist-than-coder approaches to language for overenthusiasts, then
14:40
<@AnnoDomini>
#Code; ?? This is #Spar-Ta; !!
14:41 * McMartin sets AnnoDomini on fire, heads off to get breakfast
14:41
<@McMartin>
"Now you too can be as flaming as the main characters"
14:42
<@AnnoDomini>
How droll.
15:02 C_tiger [~c_wyz@Nightstar-18112.nycmny.east.verizon.net] has quit [Connection reset by peer]
15:04 You're now known as TheWatcher
15:15 C_tiger [~c_wyz@Nightstar-18112.nycmny.east.verizon.net] has joined #code
15:15 mode/#code [+o C_tiger] by ChanServ
17:12 Vornicus-Latens is now known as Vornicus
17:14 You're now known as TheWatcher[afk]
17:42
<+Molgorn>
If I make a tree out of nodes consisting of (pointer to left) (content) (pointer to right) and then make a function to (print left node) (print content) (print right node), that ought to behave, right?
17:42
<+Molgorn>
and do Happy Recursive Fun
17:42
<+Molgorn>
eh, or rather (print left node if it exists) etc
17:44
<@McMartin>
That's an inorder traversal, yep
17:44
<+Molgorn>
Nifteh
17:44
<+Molgorn>
Now to do it~
17:44
<@McMartin>
And if you want it dump it in RPN, you make it (print left) (print right) (print content)
17:44
<@McMartin>
aka postorder
17:44
<@McMartin>
ASTs are in fact love
17:54
<+Molgorn>
muwahaha
17:54
<+Molgorn>
There's no way that this could possibly work first time~
17:54 * Molgorn push the button!
17:55
<+Molgorn>
...eh, only 31 errors
17:55
<+Molgorn>
weak
18:04 * AnnoDomini brushes against Molgorn, setting him on fire.
18:05 * Molgorn accidentally sets AnnoDomini on awesome at the same time.
18:05 * Shoukanjuu uses a fire extinguisher to put both of them out
18:17
<+Molgorn>
22
18:17 You're now known as TheWatcher
18:19
<+Molgorn>
16~
18:19
<@McMartin>
Progress!
18:19 * McMartin gets to work on his iFiction importer
18:28
<+Molgorn>
More than half of my errors are " request for member `foo' in `treeout', which is of non-aggregate type `TREE *' "
18:31
<+Molgorn>
oh, and it's giving me 17 bugs every other time I hit compile
18:31
<@ToxicFrog>
This is because you're going treeout.foo
18:31
<@ToxicFrog>
But treeout is a pointer
18:31
<@ToxicFrog>
So you need treeout->foo
18:31
<+Molgorn>
ahh
18:31
<+Molgorn>
thanks
18:32
<@ToxicFrog>
(which is a convenient way of writing (*treeout).foo)
18:32
<@jerith>
Which is syntactic sugar...
18:32
<@jerith>
Yeah, that.
18:32
<@jerith>
Syntactic sugar causes cancer of the semicolon.
18:33
<+Molgorn>
woo, 13
18:33
<+Molgorn>
o_O fot the wuck
18:33
<+Molgorn>
8 c: b`.0ds
18:33
<+Molgorn>
larir becrttou)et.itab.6: `' unaredrst thisctioy.ta897:se e bef`;'
18:33
<+Molgorn>
^ ACTUAL QUOTE TIME ^
18:34
<@ToxicFrog>
o.O
18:34
< JeffL>
o.O
18:36 * Kazriko obvious woke up too early, and goes back to bed.
18:37
<+Molgorn>
hm, it's gone this time
18:37
<+Molgorn>
12.
18:42
<@AnnoDomini>
Kazriko: You got up to early, then went over to the computer, typed a response, and only then gone back to bed? o_O
18:43
<+Molgorn>
blarg, enough enough
18:43
<+Molgorn>
I shall come back to this later
18:43
<@McMartin>
Molgorn: I suspect you're missing a string-terminating null somewhere so your printf is reading all over memory
18:43
<+Molgorn>
else I shall become as bitter about code as Syn is about maths, and that would be a bit bad with another year of it to go~
18:44
<+Molgorn>
McM: Fair enough, but why did it appear once and then go away without my changing a thing?
18:44
<@jerith>
Because the memory contained different stuff.
18:44
<+Molgorn>
And by "go away" I mean "generate seven extra errors, then four, then none"
18:45
<@Kazriko>
AnnoDomini, late actually, and I saw that 8 c: gibberish. I must need more sleep because I can't make sense of it.
18:45
<@jerith>
Assuming "generate errors" means printing weird stuff rather than compiler messages.
18:45
<+Molgorn>
No, they were reasonably-worded
18:46
<+Molgorn>
It only did that horrible garbage thing the first time.
19:08
<@McMartin>
Hum. Were these compiler errors or errors that occured when you ran the program?
19:19
<+Molgorn>
Compiler errors.
19:20
<+Molgorn>
I've not got to the point where I can make the horrible run-time errors start yet ¬¬
19:20
<@McMartin>
OK, I rescind my earlier theory.
19:20 * McMartin finishes ripping and encoding 3 CDs of Chapman Stick recordings.
19:36 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
19:36 mode/#code [+o gnolam] by ChanServ
20:45
<@McMartin>
Grar. Foolish iTunes! Get out of my Dock!
20:46
< Shoukanjuu>
Begone! *drags the itunes icon off his dock and watches it poof into nothingness*
20:46
< Shoukanjuu>
Shortcuts of Doom >__>
20:46 * McMartin actually used Control-Click to much the same effect
20:47
< Shoukanjuu>
That to
20:47
< Shoukanjuu>
o*
21:22
< JeffL>
Do any of you know anything about what I'd need to host my own wiki?
21:23
<@McMartin>
Webserver machine, wiki software, time, patience
21:23
<@gnolam>
Depends on the Wiki.
21:24
<@gnolam>
The simplest ones don't even require databases but only write access.
21:25
<@gnolam>
And there are solutions for most server-side languages.
21:26
<@gnolam>
I'm oddly fond of Oddmuse. 'tis very minimal.
21:27 C_tiger [~c_wyz@Nightstar-18112.nycmny.east.verizon.net] has quit [Killed (NickServ (GHOST command used by C_tiger_))]
21:27 C_tiger [~c_wyz@Nightstar-18112.nycmny.east.verizon.net] has joined #code
21:27 mode/#code [+o C_tiger] by ChanServ
21:28 Serah [~Z@87.72.35.ns-26506] has quit [Ping Timeout]
21:28 Serah [~Z@87.72.35.ns-26506] has joined #Code
21:28 mode/#code [+o Serah] by ChanServ
21:54
<@MyCatVerbs>
There are quite a lot of wiki programs. Heck, there are even a couple written in shell script. :)
21:55 * AnnoDomini wonders how a 16-byte bitmap looks like in Define Byte instructions.
21:56
<@MyCatVerbs>
Vaguely unlike the image?
21:56
<@McMartin>
Let me find some of my old Ophis code~
21:56
<@McMartin>
Though those were actually 63-byte bitmaps.
21:57
<@AnnoDomini>
I'm looking at INT 33,9. It wants to be pointed at a 16-byte bitmap.
21:57
<@McMartin>
Oh
21:57
<@McMartin>
8x16 image?
21:57
<@AnnoDomini>
16x16.
21:57
<@McMartin>
Insufficient bits.
21:58
<@McMartin>
A 16x16 bitmap requires 16x16/8 = 32 bytes.
21:58
<@AnnoDomini>
http://heim.ifi.uio.no/~stanisls/helppc/int_33-9.html <- What does it want, then?
21:59
<@jerith>
Double-wide pixels, perhaps?
21:59
<@McMartin>
That's actually two 8x8 maps.
21:59
<@McMartin>
One for the screen mask, one for the cursor mask.
21:59
<@McMartin>
It looks like for a classical mouse cursor, 0-7 is the inverse
22:00
<@McMartin>
So, let's take this image for the cursor:
22:00
<@McMartin>
XXX XXX
22:00
<@McMartin>
X X
22:00
<@McMartin>
X X
22:00
<@McMartin>
X X
22:00
<@McMartin>
X X
22:00
<@McMartin>
X X
22:00
<@McMartin>
XXX XXX
22:00
<@McMartin>
Well, OK. one more of the middle ones.
22:00
<@McMartin>
That bitmap is $E7, $81 (six times), $E7
22:01
<@McMartin>
And then I THINK the screen mask would be each of those XORed with $FF
22:01
<@McMartin>
Basically, the screen mask will wipe out everything that's a zero bit in that 8x8 area
22:01
<@McMartin>
Then the cursor mask will be XORed over the result, which should only be in points cleared by the screen mask or it will look Seriously Wacky.
22:03
<@McMartin>
That said
22:03
<@McMartin>
... why are you writing code for 16-bit DOS?
22:03
<@AnnoDomini>
Classes.
22:04
<@McMartin>
Seriously?
22:04
<@AnnoDomini>
Yes.
22:04
<@McMartin>
They're having you write x86 assembler for a memory model that was consigned to the scrapheap of history with the 386, back when I was in middle school?
22:05
<@AnnoDomini>
I don't understand what you told me, not all of it. I remember how to make a bitmap from messing around with the graphical representations of the character set, but the screen mask and the confusion is beyond me.
22:05
<@Kazriko>
they taught us 16 bit dos assembly too in college.
22:05
<@McMartin>
AnnoDomini: OK. You're making two characters here, each 8x8.
22:05
<@AnnoDomini>
I find it refreshing from 8051 and M6800.
22:05
<@Kazriko>
There's still a large number of processors out there with memory maps as convoluted as 16 bit x86.
22:05
<@McMartin>
With charaters, this is a straight copy to the screen
22:06
<@McMartin>
Mice don't do that, though, because they're partially transparent, but not entirely.
22:06
<@AnnoDomini>
Okay.
22:06
<@McMartin>
So it does two steps; first it erases a bunch of bits, and then it toggles some in.
22:06
<@McMartin>
The screen mask is the erasure step
22:06
<@AnnoDomini>
Aha.
22:06
<@McMartin>
Any clear bit in the screen mask will be cleared at that point at the mouse cursor.
22:07
<@McMartin>
So basically, take the outline of the cursor and 1 everything else.
22:07
<@AnnoDomini>
Okay.
22:07
<@McMartin>
The part you want set visible is then the "real" sprite, which is the cursor mask.
22:07
<@McMartin>
The screen mask - erasure - was done with AND, which will force clear anything you set 0 in the mask, and just copies the background otherwise.
22:08
<@McMartin>
The cursor mask is done with XOR, which leaves the screen intact with a 0 in the cursor mask, and toggles the point state if it's 1.
22:08
<@McMartin>
If the cursor mask is only 1 in places where the screen mask is 0, you will get a standard windows-style mouse cursor.
22:09
<@McMartin>
Forced black where the screen mask is 0 and the cursor mask is 0, forced white when screen is 0 and mask is 1, and transparent where screen is 1 and cursor is 0.
22:09
<@McMartin>
screen and cursor both being 1 is ugly and you shouldn't do it unless forced by the instructor.
22:09
<@McMartin>
Also, I haven't touched DOS interrupt calls since 1994, for serious; experiment to make sure.
22:09
<@McMartin>
I'm drawing from my knowledge of boolean algebra and extensive experience with the VIC-II chip.
22:12 * Kazriko remembers when people used xor sprites...
22:13
<@McMartin>
This is in fact an AND sprite followed by an xor sprite.
22:13
<@McMartin>
On a 1-bit color plane.
22:13
<@McMartin>
The VIC-II had proper transparency support, though.
22:16
<@AnnoDomini>
I'll try.
22:18
<@Kazriko>
1-bit would make it work better. They used a 8-bit on the games I'm thinking of. Was fine until two sprites interacted or there was anything but a solid color on the background.
22:18 Attilla_ [~The.Attil@194.72.70.ns-11849] has joined #code
22:18
<@McMartin>
Yeah, QBASIC's GET and PUT statements are just Not The Done Thing.
22:18 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Killed (NickServ (GHOST command used by Attilla_))]
22:19 Attilla_ is now known as Attilla
22:21 * AnnoDomini wonders if DosBox has mouse drivers loaded by default.
22:21
<@McMartin>
Yes
22:22
<@McMartin>
But you'll need to click in the window to capture
22:22
<@AnnoDomini>
Yes, yes.
22:22
<@McMartin>
And BEFORE YOU DO THAT find the key combination in the manual to release it
22:22
<@C_tiger>
Lol
22:22
<@AnnoDomini>
Alt+TAB.
22:22
<@AnnoDomini>
I don't remember the proper one.
22:22
<@McMartin>
It's something like Ctrl-F10.
22:23
<@AnnoDomini>
Okay, I have:
22:23
<@AnnoDomini>
SCRMASK DB 247,247,247,247,0,247,247,247
22:23
<@AnnoDomini>
CRSBITM DB 08H,08H,08H,08H,0FFH,08H,08H,08H
22:23
<@AnnoDomini>
Will this be visible?
22:23
<@McMartin>
Uh, hex(247) plz?
22:23
<@McMartin>
That should be a vertical line.
22:23
<@AnnoDomini>
F7H, I think.
22:23
<@McMartin>
And the hotspot is probably not going to be in the right point.
22:23
<@McMartin>
Yeah.
22:24
<@AnnoDomini>
I want a crosshair.
22:24
<@McMartin>
Nod
22:24
<@McMartin>
Here's hoping the hotspot isn't the upper left.
22:24
<@AnnoDomini>
I think the interrupt allows me to set the hotspot.
22:25
<@AnnoDomini>
Okay, a different question - I want to test the thing. Will setting a long time-wasting loop be sufficient?
22:27
<@AnnoDomini>
Or am I failing to grasp how mouse handling works?
22:27
<@McMartin>
I have no idea how DOS handles it.
22:27
<@McMartin>
Real operating systems pre-emptively give time to an event-handling thread.
22:27
<@McMartin>
DOS may use hardware interrupts to the same end
22:28
<@McMartin>
Don't forget to turn the mouse on.
22:29
<@AnnoDomini>
What is needed to turn it on?
22:29
<@AnnoDomini>
Just resetting it?
22:29
<@McMartin>
I have no idea.
22:29
<@McMartin>
But I imagine there's another system call that sets mouse visibility
22:30
<@AnnoDomini>
Oh, wait. In my zeal, I have forgotten to Show Cursor.
22:30
<@McMartin>
Bingo
22:30
<@AnnoDomini>
Heh.
22:30
<@McMartin>
Incidentally, what are you guys using as your assembler?
22:30
<@AnnoDomini>
It's not a crosshair. It's two parallel vertical pipes.
22:30
<@AnnoDomini>
TASM.
22:31
<@McMartin>
Damn.
22:31
<@McMartin>
Hm. Thick pipes?
22:31
<@McMartin>
And is there a gap in the middle?
22:31
<@McMartin>
Maybe the XOR map is actually bit-inverted or something.
22:32
<@AnnoDomini>
http://i28.tinypic.com/9tk4y8.gif
22:33
<@McMartin>
That is fascinating.
22:33
<@McMartin>
That doesn't look like it's described by any interpretation of your data bytes.
22:34
<@McMartin>
... are you sure you got the pointer value right?
22:35
<@AnnoDomini>
http://pastie.caboo.se/187353 <- Pretty sure.
22:36
<@McMartin>
That looks right on a first glance...
22:36
<@McMartin>
The 0FFH concerns me a little, but it shouldn't wreck it like that.
22:37
<@AnnoDomini>
Which 0FFH?
22:37
<@McMartin>
CRSBITM+5.
22:37
<@AnnoDomini>
Oh.
22:37
<@McMartin>
Er, +4
22:38
<@AnnoDomini>
Nah, it's right. Otherwise, it'd get treated as a label.
22:38 * AnnoDomini tries 255 instead anyway.
22:38
<@AnnoDomini>
Nope. Same.
22:39
<@McMartin>
New theory.
22:39
<@McMartin>
Documentation is a lie, and it's actually 32x32.
22:39
<@AnnoDomini>
Hehe.
22:39
<@AnnoDomini>
How do we define a 32 by 32?
22:40
<@McMartin>
Er. 16x16, rather.
22:40
<@McMartin>
What I don't get is why the FF isn't showing up anywhere.
22:40
<@McMartin>
Anyway
22:41
<@McMartin>
Instead of one byte per row of eight bits, it's two bytes per row.
22:41
<@McMartin>
probably bigendian.
22:41
<@McMartin>
(so 01h, 80h is a line in the middle)
22:42
<@McMartin>
Oh, wait
22:42
<@McMartin>
Just use DW. =P
22:42
<@McMartin>
Try changing the DBs to DWs and see how it reacts.
22:43
<@McMartin>
That'll make it little-endian, but this other tutorial I found looks like it's right.
22:43
<@McMartin>
Also, why are you reduced to googling for references for the basic assignment?
22:44
<@McMartin>
Anyway, the final result will have a crsrmask of 0180H and FFFFH as the values.
22:44
<@AnnoDomini>
We got a reference manual of the interrupts. We got task definitions. This task is, 'make something that uses mouse'.
22:44
<@AnnoDomini>
We get little else.
22:44
<@AnnoDomini>
I'm too stingy to buy books on this.
22:46
<@McMartin>
Yes, but the manual. Is it a cavern of lies?
22:46
<@McMartin>
The tutorials I'm finding for DOS mouse coding indicate that the masks are actually 32 16-bit integers.
22:47
<@McMartin>
Not 16 8-bit values.
22:47
<@AnnoDomini>
The manual's... very unclear at times. And the writer's weren't paid by word.
22:47
<@McMartin>
So that implies a 16x16 image.
22:47
<@AnnoDomini>
Okay, so I'll make words now.
22:47
<@McMartin>
"16 bytes" - in the page you lined - is flat out wrong under any interpretation.
22:48
<@McMartin>
... Hm. Though really, it shouldn't have managed to find the data at all under that interpretation.
22:49
<@AnnoDomini>
Okay, I think it ISN'T finding the data.
22:49
<@McMartin>
Make it words, and add 8 "0H" words to the end of each
22:49
<@AnnoDomini>
Whatever I do, it stays the same.
22:50
<@McMartin>
Yeah, it's reading memory past the end of DATA.
22:50
<@McMartin>
Because originally it was just half the mask, and now it's all of the mask.
22:50
<@McMartin>
screen mask, rather
22:50
<@McMartin>
So pad it out so each of the lines is 16 words, not just 8
22:50
<@AnnoDomini>
Nah, I mean, I just changed both maps completely. And the cursor didn't change at al.
22:50
<@AnnoDomini>
*all
22:51
<@McMartin>
Yeah, I'm not expecting that, because the cursor mask is expected to start at byte address SCRNBITM+32.
22:51
<@McMartin>
Which you haven't been defining, even with DW.
22:51
<@McMartin>
And the background is blank, so switchign between force-on and toggle is invisible
22:52
<@AnnoDomini>
I'm afraid you lost me somewhere along the way.
22:53
<@McMartin>
OK
22:53
<@McMartin>
If the references and tutorials I'm googling up are accurate...
22:53
<@McMartin>
each bitmap is 32 bytes long, not 8.
22:53
<@AnnoDomini>
Okay.
22:53
<@McMartin>
This means that we've only been modifying the screen mask, since we were originally defining 16 bytes, and the shift to DW bumped that to 32.
22:53
<@McMartin>
Your background image is blank.
22:54
<@McMartin>
This means that ANDing any mask whatsoever with it always produces 0.
22:54
<@McMartin>
The cursor mask in each run is uninitialized memory.
22:54
<@McMartin>
Hence why changing the screen mask produces no visible result.
22:55
<@AnnoDomini>
You are correct.
22:55
<@AnnoDomini>
I get a nifty dot now.
22:56
<@McMartin>
Now to figure out the bytesex of the mask.
22:56
<@McMartin>
Use a value of 0180H for the cursor mask all the way down and see if you get one line or two.
22:57
<@AnnoDomini>
'all the way down?'
22:59
<@McMartin>
"For all 16 values of the cursor mask"
23:00
<@AnnoDomini>
And what for the cursor?L
23:00
<@AnnoDomini>
-L
23:04
<@McMartin>
That is the cursor.
23:04
<@McMartin>
Screen mask is irrelevant in this app
23:04
<@AnnoDomini>
Oh.
23:05
<@AnnoDomini>
I'm a bit weary.
23:05
<@AnnoDomini>
A single thick line.
23:05
<@McMartin>
Basically, if it's little-endian, as I currently suspect, then you can use DW to specify the 16 pixels of each line, in hex.
23:05
<@McMartin>
It is little-endian.
23:05
<@McMartin>
OK, so, second verse, same as the first, but four times bigger.
23:05 Jeff [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has joined #code
23:05
<@McMartin>
Design our cursor again, but now it's 16 entries of 16-bit numbers.
23:06 JeffL [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has quit [Ping Timeout]
23:06 AFKSkull [~none@Nightstar-7066.dyn.optonline.net] has quit [Ping Timeout]
23:09
<@AnnoDomini>
Whee. I can has crosshair.
23:12
<@McMartin>
You'll need to experiment to ensure that the hotspot is properly set.
23:13 * McMartin can has iFiction import
23:14
<@AnnoDomini>
The program I have in mind is one that draws lines using Bresenham's Line Algorithm between points clicked at with the mouse.
23:14
<@McMartin>
Sounds good
23:15
<@McMartin>
You might want to start with just drawing a dot at the point you click.
23:15
<@AnnoDomini>
I suppose. I have a PutPixel subroutine.
23:15
<@McMartin>
Bresenham's is nontrivial and you probably want immediate gratification first.
23:16
<@AnnoDomini>
Nah. I've got Bresenham's already. The biggest problem would be the starting conditions.
23:19 Chalcedon [~Chalcy@Nightstar-488.ue.woosh.co.nz] has joined #code
23:19 mode/#code [+o Chalcedon] by ChanServ
23:19
<@AnnoDomini>
I have a better idea - trace a line after the cursor. It's easier. :D
23:20
<@McMartin>
Just set a pixel as long as the button is held.
23:20
<@McMartin>
Pencil tool!
23:21
< Shoukanjuu>
Hahaha
23:22
<@McMartin>
The First Rule Of Homework: Never do more work when less work will do.
23:22
<@McMartin>
Unless you plan on using the assignment as an excuse for doing something you really want to do.
23:22
<@AnnoDomini>
Nah.
23:23 * McMartin now has all UI features in for the next version of Blorple.
23:23
<@McMartin>
However, the internals are still Horribly Broken and this means some files will index but won't play.
23:25
<@AnnoDomini>
Heh. Infernals. I've signed up to a PbP Exalted game.
23:25
<@McMartin>
No. Internals.
23:25 * AnnoDomini sleepy.
23:27
<@AnnoDomini>
Hm. This isn't working as well as I'd hoped.
23:28
<@AnnoDomini>
It kinda sorta draws, but it doesn't leave marks at all most of the time.
23:43
<@AnnoDomini>
Hrm. No, this isn't working well.
23:43
<@AnnoDomini>
For some reason, it's not properly putting dots where I point the mouse.
23:59
<@AnnoDomini>
Hm. Crashes. That's not good at all.
--- Log closed Sun Apr 27 00:00:04 2008
code logs -> 2008 -> Sat, 26 Apr 2008< code.20080425.log - code.20080427.log >