--- Log opened Sat Feb 23 00:00:56 2008 |
00:08 | <@gnolam> | ... or can they? |
00:08 | <@gnolam> | Dun-dun-DUUUUN! |
00:20 | | * AnnoDomini is attempting to break his long-standing loathing of C++. |
00:20 | <@Vornicus> | not worth it |
00:21 | <@AnnoDomini> | Could someone tell me how to clear a c-string? |
00:21 | <@McMartin> | foo[0] = '\0'; |
00:21 | <@AnnoDomini> | And that'll clear the entire thing? |
00:22 | <@McMartin> | C strings last until the next null byte. |
00:22 | <@McMartin> | This idea of strings having some notion of their own length is unC. |
00:23 | <@AnnoDomini> | Okay. |
00:23 | <@McMartin> | To wipe an array of characters that you might have been using as a string, see memset. |
00:23 | <@AnnoDomini> | Now, where does file.read() get the extra character? |
00:24 | <@McMartin> | It doesn't. |
00:24 | <@McMartin> | So allocate one more byte than you read. |
00:25 | <@AnnoDomini> | http://en.wikipedia.org/wiki/Fstream <- I'm basing my code on the third and fourth examples. |
00:25 | <@AnnoDomini> | For some reason, when I want to read n bytes into a c-string, I get four bytes from the file, and an additional byte from who-knows-where. |
00:26 | <@McMartin> | What is n? |
00:26 | <@AnnoDomini> | n, not four, there. |
00:26 | <@McMartin> | Hm. |
00:26 | <@AnnoDomini> | Four is just what I'm using. |
00:26 | <@McMartin> | So, fread won't add a trailing null, so printf will cheerfully keep reading through memory until hit hits a 0 by accident or causes a segfault. |
00:26 | <@McMartin> | Welcome to C and its wide wide world of buffer overflow vulnerabilities, any one of which can grant an attacker complete control over your machine. |
00:27 | <@AnnoDomini> | Cool. |
00:27 | <@ToxicFrog> | fread is for reading raw binary data, not strings, so among other things it will not null-terminate. |
00:28 | <@AnnoDomini> | Well, how do I read n bytes of a text file? |
00:28 | | * AnnoDomini is having a 'how do I shot web' moment. |
00:29 | <@McMartin> | Let's see. Is it a known length string? |
00:29 | <@McMartin> | Like "sixteen-char string goes here" kind of thing |
00:29 | <@AnnoDomini> | Yes. |
00:29 | <@McMartin> | For 16: |
00:29 | <@McMartin> | char val[17]; |
00:30 | <@McMartin> | int n = fread (fp, 1, 16, val); // from memory, probably wrong |
00:30 | <@McMartin> | if (n != 16) { /* zomgnoes error */ } |
00:30 | <@McMartin> | val[16] = '\0'; |
00:30 | <@McMartin> | Val is now a Cstr of those 16 bytes, assuming none of them were themselves 0. |
00:31 | <@ToxicFrog> | fgets would be better here, I think. |
00:31 | <@McMartin> | I'm pretty much positive I got the fread call wrong, but you want it to be size 1, 16 units. |
00:31 | <@McMartin> | fgets is always wrong. |
00:31 | <@ToxicFrog> | char val[17]; |
00:32 | <@McMartin> | Hm, OK, maybe not. |
00:32 | <@McMartin> | fgets is not gets. |
00:32 | <@McMartin> | gets is always wrong. |
00:32 | <@ToxicFrog> | fgets(fp, 17, val); |
00:32 | <@ToxicFrog> | Yes. |
00:32 | <@ToxicFrog> | It's gets that has the "BUGS: never use this function. Use fgets instead." entry. |
00:32 | <@ToxicFrog> | fgets is the one that actually does length checking. |
00:32 | <@McMartin> | So |
00:32 | <@McMartin> | Why is it still in libc? |
00:33 | <@McMartin> | zomgbackcompat but guaranteed total system compromise is a kind of backcompat you don't want |
00:33 | <@McMartin> | Every use of gets is not only an overflow vulnerability but an exploitable one. |
00:33 | | * AnnoDomini wishes he knew that wikipedia has a decent enough reference for C/C++ libraries when he was required to code in it for classes. |
00:33 | <@McMartin> | It probably didn't back when you were required to. |
00:34 | <@McMartin> | (Not to mention that C++ hasn't had a truly widespread standard library for more than a few years now) |
00:35 | <@ToxicFrog> | AnnoDomini: if you're in *nix, there is a complete libc reference in chapter 3 of the Manual. |
00:35 | <@AnnoDomini> | I never used gets. I could not understand its syntax. |
00:35 | <@AnnoDomini> | ToxicFrog: Windows. |
00:35 | <@ToxicFrog> | Also, www.cplusplus.com/ref/ has reference material for all of libc, and iostream in C++ |
00:35 | | mode/#code [+v ToxicFrog] by ToxicFrog |
00:35 | <@ToxicFrog> | Also, www.cplusplus.com/ref/ has reference material for all of libc, and iostream in C++ |
00:39 | <@AnnoDomini> | Thanks. |
00:40 | <@ToxicFrog> | (and possibly more; it's been ages since I checked it) |
00:46 | | * AnnoDomini tries to understand how fgets works. |
00:46 | <@AnnoDomini> | It reads ONE character only? |
00:47 | <@gnolam> | No. |
00:47 | <@gnolam> | You supply a max length. |
00:48 | <@AnnoDomini> | But the compiler says things about incompatibility of types. |
00:48 | <@gnolam> | Welcome to C++. |
00:48 | <@AnnoDomini> | char* not compatible with char[5]. |
00:48 | <@gnolam> | Err... what are you trying to do, exactly? |
00:48 | <@gnolam> | Paste code. |
00:49 | <@AnnoDomini> | I'm trying to read four first characters of a file. Nothing more. Nothing less. |
00:49 | <@AnnoDomini> | http://pastie.caboo.se/156168 |
00:50 | <@AnnoDomini> | wait, it compiled now. |
00:50 | <@AnnoDomini> | After I removed the "fourbuff =" from the line. |
00:51 | <@AnnoDomini> | Excellent. It works. |
00:52 | <@AnnoDomini> | Now, to figure out how to read a string of N characters from spot M in line K of a text file. |
00:52 | <@gnolam> | Also, please supply an explicit t or b to fopen's mode string. |
00:53 | <@McMartin> | AnnoDomini: You seek the function fseek(). |
00:53 | <@McMartin> | Although if it's by line, you're going to have to go through line by line maintaining the count. |
00:54 | | * AnnoDomini nods. |
00:54 | <@gnolam> | Also... /conio.h/? BURN. |
00:55 | <@AnnoDomini> | Bah! "while(!kbhit())" :) |
00:55 | <@AnnoDomini> | Or whatever CPU-eating thing we were shown to use in high school. |
00:56 | <@gnolam> | (Although IIRC, you were using some goddamn /Paleolihtic/ version of, of all things, Borland, so... :P) |
00:56 | <@gnolam> | *Paleolithic |
00:56 | <@AnnoDomini> | I installed Dev-C++ 4. |
00:56 | <@gnolam> | Poor sod. |
00:56 | <@ToxicFrog> | <AnnoDomini> Now, to figure out how to read a string of N characters from spot M in line K of a text file. <-- Don't Use C++, generally~ |
00:57 | <@AnnoDomini> | See, C++ is exactly why I don't understand people who bash mIRC scripts. |
00:57 | <@AnnoDomini> | I mean, seriously. |
00:57 | <@ToxicFrog> | ... |
00:57 | <@gnolam> | Seeing someone go from Ancient Borland to Dev-C++ is like seeing woman leave her abusive husband for an abusive trailer-trash boyfriend. |
00:57 | <@gnolam> | Use something /modern/, FFS. |
00:58 | <@ToxicFrog> | What's wrong with dev-c++? |
00:58 | <@ToxicFrog> | apart from the whole C++ bit. |
00:58 | <@ToxicFrog> | It is modern. |
00:58 | <@gnolam> | The hell it is. |
00:58 | <@AnnoDomini> | I didn't want Dev-C++ 5, 'cause it said beta. |
00:58 | <@gnolam> | Buggy mess of poorly understood Delphi that's been stuck in development hell for ages. |
00:58 | <@ToxicFrog> | AnnoDomini: I'm sorry, just because one language is terrible and a pain in the ass to work with doesn't mean all other languages are automatically good. |
00:58 | <@ToxicFrog> | gnolam: ok, suggest a better free IDE. |
00:59 | <@gnolam> | Just go set up MinGW separately and use Code::Blocks or some other /decent/ IDE. |
00:59 | <@AnnoDomini> | ToxicFrog: No, no, I didn't mean that. I just meant that even mIRC scripts are friendlier to the programmer than C++. |
01:00 | <@gnolam> | http://www.codeblocks.org/ <- grab the latest nightly build |
01:00 | <@AnnoDomini> | Personally, I like how Java handles lots of things. |
01:00 | <@AnnoDomini> | But it compiles faster than it runs. |
01:01 | <@gnolam> | (For some reason, the "stable" version is a couple of years old and decidedly less stable than the nightlies. But even that old version is better than a brand new version of Dev-C++.) |
01:01 | <@AnnoDomini> | gnolam: I'd happily just write in Notepad, if I understood how to use C++ compilers from the commandline. |
01:02 | <@ToxicFrog> | No, you wouldn't. |
01:02 | <@ToxicFrog> | Because notepad doesn't understand concepts like indentation. |
01:02 | | * AnnoDomini sighs. |
01:02 | <@AnnoDomini> | I meant Notepad2. |
01:02 | <@AnnoDomini> | It just looks and feels mostly the same, so I call it Notepad. |
01:03 | <@ToxicFrog> | Anyways, it's not hard to use gcc and friends from the command line, and this is in fact how I do my development. |
01:03 | <@gnolam> | g++ foo.cpp -Wall -O2 -o foo.exe . |
01:03 | <@gnolam> | Or go nick a smallish looking makefile and adapt it to your own ends. |
01:05 | <@ToxicFrog> | Although I usually wrap it in a pmfile so I can build the whole thing with "pm" rather than running gcc by hand for each file (make serves a similar purpose) |
01:22 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
01:25 | | AnnoDomini [AnnoDomini@83.21.57.ns-4950] has quit [Quit: There is no Dana, only Zuul.] |
01:53 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has joined #code |
01:54 | | Reltzik is now known as NSGuest-5218 |
01:55 | | NSGuest-5218 is now known as Reltzik |
01:57 | | * Reltzik THINKS he's figured out what he wants for the primitives of this language. |
02:00 | <@ToxicFrog> | Oh? |
02:00 | < Reltzik> | Yeah. Emphasis on the uncertainty. |
02:01 | <@ToxicFrog> | So what do you think you need? |
02:01 | <@Vornicus> | I still don't think making a language for this is the right way to go about it. |
02:01 | | * ToxicFrog suspects this is going to turn out to be a subset of one of the other languages we've already suggested. |
02:01 | < Reltzik> | Vorn: Quit backseat coding. |
02:01 | < Reltzik> | ((Kidding.)) |
02:02 | <@Vornicus> | In the end, there's lots of languages you could use for embedding - if this is a java program, you could build classes to an interface. |
02:02 | < Reltzik> | Probably, but the difference is going to be in the functionality. |
02:02 | | GeekSoldier|bed [~Rob@Nightstar-9493.dip.t-dialin.net] has quit [Ping Timeout] |
02:02 | <@ToxicFrog> | How so? |
02:02 | | Myst [~Myst@Nightstar-16167.sip.shv.bellsouth.net] has joined #code |
02:02 | | mode/#code [+o Myst] by ChanServ |
02:03 | < Reltzik> | Okay, let's see. You've got your basic int and string, plus a typed and keyed collection called a list. Nothing new there. |
02:03 | | * ToxicFrog offers Myst a function closure, sprinkled with delicious upvalues |
02:03 | <@ToxicFrog> | Reltzik: "typed and keyed collection"? |
02:04 | <@ToxicFrog> | If you mean key-value pairs, that's not a list, and calling it one will create lots of confusion. |
02:04 | | GeekSoldier|bed [~Rob@Nightstar-9493.dip.t-dialin.net] has joined #code |
02:04 | <@McMartin> | In Java, that's a Map. |
02:04 | | * Reltzik doesn't have the NAMES for them, will go about naming things later. |
02:04 | <@Vornicus> | it's a map or dictionary or hash, depending on your language. |
02:05 | <@ToxicFrog> | Dictionary is probably the least ambiguous term. |
02:06 | <@McMartin> | Java has those by that name too but they shouldn't generally be used. |
02:06 | <@ToxicFrog> | Anyways. Apart from these data types... |
02:06 | <@McMartin> | But yeah |
02:06 | < Reltzik> | Let's see, the user and system type (mostly like java's System class), again, nothing new. The type type which basicly says, "I'm a class instead of an instance". Again, not much new. |
02:07 | <@ToxicFrog> | "user and system type"? |
02:07 | <@ToxicFrog> | What this sounds like is that you're trying to re-implement Java. |
02:07 | <@ToxicFrog> | Or perhaps Smalltalk. |
02:07 | < Reltzik> | Yeah. I'm unhappy with those, but I'll get back to them. |
02:07 | < Reltzik> | The important one is the rule class. |
02:07 | < Reltzik> | *type, dammit |
02:10 | < Reltzik> | A rule will be made up of three lists. The first is a scope list (map, whatever), sort of like an argument list, but a rule's not a function. It names several things which the rule talks about, and defines what types those things can be. |
02:10 | < Jeff> | Hey, does anyone know if the map in Java implements a tree structure? Or a hash structure? |
02:10 | <@Vornicus> | Jeff: there are TreeMaps and HashMaps |
02:10 | < Reltzik> | Jeff: Map's an abstract type. Some subtyeps... yeah. |
02:10 | < Reltzik> | *subtypes, even. |
02:11 | < Jeff> | Right, now I remember. We're using TreeMaps. |
02:11 | <@ToxicFrog> | Reltzik: this sounds both incredibly vague, and also something that you could do more easily just by writing the whole thing in one of the discussed languages (Java, Lua, or Python) to begin wtih. |
02:11 | <@Vornicus> | Yes. |
02:11 | <@McMartin> | Especially since *all three of these* have dynamic loading. |
02:11 | < Reltzik> | Where does dynamic loading come in? |
02:11 | <@McMartin> | I believe I'm the resident expert on Java plugin architectures. |
02:11 | <@Vornicus> | I would use dynamic loading, and write your modules in the language. |
02:11 | < Jeff> | I just was curious because I figured I should know the underlying structures of what I use for O() notation |
02:11 | <@Vornicus> | McM: you are the resident expert on Java from stem to stern. |
02:11 | <@McMartin> | Basically, you have an API where the user provides code that does stuff. |
02:11 | <@ToxicFrog> | Especially in Java or Python, you just create a Rule class and implement/subclass as needed. Lua has no explicit object system so it would be flavoured kind of differently, but still not hard. |
02:12 | <@ToxicFrog> | Reltzik: so that the user can write, and load, rules without having to recompile your program. |
02:12 | <@McMartin> | In Java you then have the user have a file that says "Relevant class is foo.bar.Baz", and it will go and incorporate it into the program at run time. |
02:12 | <@McMartin> | Class.forName("foo.bar.Baz").newInstance() will return an object of that type, even if it didn't exist at compile time. |
02:12 | <@McMartin> | As long as it's in the classpath at run time. |
02:13 | <@ToxicFrog> | ...if it doesn't exist at compile time, how does it typecheck that? |
02:14 | < Reltzik> | Okay, sure, but dynamic loading, though significant, is not what I'm after here. |
02:14 | <@McMartin> | TF: Everything is castable to Object, which newInstance() returns. Then you cast it to an Interface that *you* defined and they extended. |
02:14 | <@McMartin> | And if they did it wrong, a ClassCastException will be thrown and you catch it and flag a bad plugin. |
02:15 | <@McMartin> | Reltzik: The point is that you don't even have to worry about it yet as long as you keep interfaces as your firewall between "stuff you were planning on puttin gin your language" and "the core engine" |
02:15 | <@McMartin> | And then instead of having a core engine that interprets your language, you instead have it make calls into the user-provided code |
02:15 | <@ToxicFrog> | Aah. |
02:15 | <@McMartin> | But you start with it being *you* provided code and don't worry about it at all. |
02:16 | <@McMartin> | (TF: The other way is to do everything with java.lang.reflect, but if you do that I will hunt you down with a stick with a nail in) |
02:16 | <@ToxicFrog> | Reltzik: I thought what you were after is the ability of the user to write new rules and data structures (eg, character sheets) and feed them to your program for management/evaluation. |
02:16 | <@McMartin> | (I've got a whole stack of them for the authors of Tomcat) |
02:17 | | * Reltzik doesn't follow, probably because the upstairs neighbors' kids are playing "JUMP JUMP JUMP" right above his head, with lots of screaming, and it's heard to concentrate. |
02:17 | <@McMartin> | Ah, they have not learned the Terrible Secret of DDR. |
02:17 | < Jeff> | Oh? |
02:18 | < Reltzik> | TF: Yeah. But for the management evaluation, I've decided to implement a logical interpreter with a simple language in which the rules are programmed. |
02:18 | <@McMartin> | Jeff: Tomcat uses java.lang.reflect to make internal function calls, with constant strings in the reflection. |
02:18 | <@McMartin> | I have yet to deduce what this does for them besides hurt performance. |
02:19 | < Reltzik> | If you want performance, you shouldn't be using Java in the first place. |
02:19 | <@Vornicus> | On the contrary... |
02:19 | <@McMartin> | Java blows the shit out of most of the scripting languages. |
02:19 | <@McMartin> | At least on long-running applications. |
02:19 | <@McMartin> | It has a hefty startup time, but once it's loaded it tends to be very fast. |
02:20 | <@McMartin> | Though I don't know how stock Tomcat compares to, say, mod_python. |
02:20 | < Reltzik> | Well, true, but it's interpretted and I'm used to thinking in terms of compiled languages. |
02:20 | <@ToxicFrog> | Reltzik: why have you decided to implement this interpreter? |
02:20 | <@McMartin> | Java is, in fact, a compiled language. |
02:20 | <@ToxicFrog> | Designing languages is hard. Designing good languages is extremely hard. |
02:20 | < Reltzik> | But it's ALSO interpretted. |
02:20 | <@McMartin> | It just compiles it at link-load time instead of at source analysis time. |
02:20 | <@Vornicus> | And can occasionally do better than C/C++. |
02:20 | <@ToxicFrog> | Reltzik: no, it uses a JIT compiler. |
02:20 | <@McMartin> | It only goes into interpretation if you explicitly tell it to. |
02:20 | <@ToxicFrog> | The bytecode is translated to native machine code at load time. |
02:21 | <@McMartin> | And if it finds that it's idling it uses the time to recompile with more optimizations. |
02:21 | <@ToxicFrog> | It uses an interpreter only if running on a platform where JIT compilation is not yet supported, or if explicitly instructed to. |
02:21 | < Reltzik> | Because, I couldn't find a logical language that did what I wanted to for the rules engine. |
02:21 | <@ToxicFrog> | And what is it you want? |
02:21 | <@McMartin> | You may find that it's easier to make it well-separated imperative code. |
02:22 | | * Reltzik tries to phrase it right, which isn't something he's good at. |
02:22 | < Jeff> | I was actually curious as to what the TSoDDR is, seeing as how that's what got me into relatively good shape. |
02:23 | <@Vornicus> | <McMartin> And if it finds that it's idling it uses the time to recompile with more optimizations. <--- good god, we've already invented Rampancy. |
02:23 | <@McMartin> | Jeff: Do You Have Stairs In Your House? |
02:23 | <@McMartin> | You Must Play Downstairs. |
02:23 | < Jeff> | Yes. |
02:23 | | * Jeff nods. |
02:23 | < Jeff> | That's Rule One. |
02:23 | | * Jeff is on the second floor of an apartment now. So no DDR. |
02:23 | <@McMartin> | This is a reference to The Terrible Secret Of Space. |
02:23 | <@McMartin> | In which the Pusher Robot and the Shover Robot protect people from the Terrible Secret of Space by pushing them down the stairs. |
02:23 | < Reltzik> | Okay. First I want a logical language -- predicates, scopes-or-whatever-they're-called, assertions, so forth -- which is interpretted by a rules engine. |
02:23 | <@McMartin> | Humans must be protected. They must go down the stairs. |
02:24 | <@McMartin> | Reltzik: No. That's an implementation answer. TF wants the *question*. |
02:24 | <@Vornicus> | The question here, I think, is this: He's making a D&D engine. Except that he wants it extensible, so he can add other rule sets later. |
02:25 | <@McMartin> | As much as it goes against type for me to say it... |
02:25 | <@McMartin> | ... this cries out for an inheritance-based solution. |
02:25 | < Reltzik> | Vorn: Mostly, yes, though even if I didn't want extensibility I'd like this model later. |
02:25 | < Reltzik> | Which is why I was including inheritance in this. |
02:25 | <@ToxicFrog> | Vornicus: so - like I've been saying all along - he wants a rule evaluation/data storage engine with the ability to add new data structures and rules later. |
02:25 | <@McMartin> | You need a RuleSet that can talk about various things the game itself cares about -- getSkills, getAttributes, checkSkill, checkAttribute, etc... |
02:25 | <@Vornicus> | TF: yes. |
02:26 | <@ToxicFrog> | And, yes, as McM said, I wanted the question, not the answer. |
02:26 | | * ToxicFrog beats Reltzik with the we-want-problems-not-solutions stick |
02:26 | <@McMartin> | And I hold that his question is "pluggable and/or extensible RPG engine", not "rule evaluation/data storage". |
02:26 | <@McMartin> | But that's arguing over levels and I don't presume to speak for you in what level your question was. |
02:27 | < Reltzik> | Okay, hang on a moment. |
02:27 | < Reltzik> | What you wanted was my overall problem, which spawned the solution of this language, which was in turn a subproblem. |
02:27 | < Reltzik> | And I was answering questions about the subproblem, right? |
02:28 | <@Vornicus> | Well, sort of. Mostly it's been us trying to beat into your puny mind the power of dynamic loading. |
02:28 | < Reltzik> | What the hell does dynamic loading have to do with this? |
02:29 | <@McMartin> | It is an alternate solution to the "pluggable" part. |
02:29 | < Reltzik> | And what does "pluggable" have to do with this? |
02:29 | <@McMartin> | We're skeptical of the language as the proposed solution. |
02:29 | | * Reltzik gathered that. |
02:29 | <@McMartin> | Part of the problem statement is that the engine be extensible later. |
02:29 | <@McMartin> | This is implementable as a plugin system for rule evaluators. |
02:30 | < Reltzik> | Well, yes, and I acknowledge that there are many ways to do that, and a new language is not a requirement for that. I want the language for OTHER reasons. |
02:30 | <@McMartin> | OK, so, what's the part of the problem the language solves that, essentially, engine libraries will not? |
02:31 | < Reltzik> | McM: Define "Engine Libraries". |
02:31 | <@McMartin> | "Here is my RPG, written in an system-neutral fashion" |
02:31 | <@McMartin> | "When I link in the d20 library, it uses the d20 mechanics" |
02:31 | | * Reltzik is thinking 3 or 4 things that could already mean. Does some language already support it? |
02:31 | <@McMartin> | "When I link in the FUDGE library, it uses the FUDGE mechances." |
02:31 | <@McMartin> | Java and Python are built around the concept. |
02:32 | <@McMartin> | C patched it in a few years after its invention, with a bit of difficulty. |
02:32 | < Reltzik> | Okay, not what I was thinking. |
02:32 | <@McMartin> | I'm thinking here that the split is "the scenario is the application, and the 'run D&D' part is a library that could be replaced or extended later" |
02:33 | <@McMartin> | Which is an architecture-level decision that it is, in fact, appropriate to be considering at this point. |
02:33 | < Reltzik> | Yes, and I've gone with that model too, if I read what you're saying right. |
02:33 | <@McMartin> | I have to admit, one of the reasons I'm pushing for this solution is that it's locally the simplest one, and the best way to get your coding skills up is to actually write stuff. Thus, the architecture that gets you writing effective code sooner is the way to go. |
02:35 | < Reltzik> | Okay, I THINK there are two reasons in answer to McM's earlier questions. The less-significant one, but more easilly-articulated, is that I want DMs to be able to implement house- and game-specific rules. This includes DMs who might not be particularly code-savvy. |
02:36 | < Reltzik> | Java and other languages can be a bit arcane. |
02:36 | <@Vornicus> | Quite frankly, I don't see how yours will be any better. |
02:37 | < Reltzik> | And what have I told you that would give you enough information to determine one way or another? |
02:38 | <@Vornicus> | That you're implementing a language. |
02:38 | <@Vornicus> | In any case, you are best off leaving the programming (and there's no getting around it, that's /what the job of adding new rules is/) to the programmers. |
02:39 | < Reltzik> | I just don't see that. |
02:40 | <@ToxicFrog> | If you're worried that Java is too arcane, then both Python and Lua are much friendlier and also have these capabilities, and in fact this problem is the very one Lua was originally created to solve |
02:40 | <@McMartin> | The hard part isn't phrasing it. The hard part is being clear enough of mind to know what needs to be said in the first place. |
02:40 | <@McMartin> | But yes, TF is right. |
02:40 | | * Reltzik goes to look at Lua then. Hasn't looked at it before. |
02:40 | <@Vornicus> | I continue to recommend Python |
02:41 | <@McMartin> | In fact, if you don't mind the security implications, both Python and Lua have an "eval" operation, which will let your extensions be strings of Lua or Python code that are then executed. |
02:41 | <@McMartin> | Handy when you want to change "x+2" to "x+3" |
02:41 | <@McMartin> | Not so awesome when a consequence of losing HP is "os.system('format c: /y')" |
02:41 | <@McMartin> | (DO NOT TYPE THIS INTO A PYTHON TERP PLZ) |
02:42 | <@ToxicFrog> | (ie, the problem being: you have a program, possibly written in a big scary language; you need the ability to control, configure, or extend it by writing stuff in a smaller, simpler language.) |
02:42 | <@ToxicFrog> | (Python does not do that well, but that's because the right answer there is simply to write the whole thing in Python, rather than in Java or C++ or whatever and then bolting on Lua for the stuff the user will actually see) |
02:43 | <@McMartin> | (Lua adds the additional constraint that the extensions should not be able to, as in my example above, wipe the user's hard drive) |
02:43 | <@ToxicFrog> | (which is trivial to enforce: refrain from loading the os and io libraries) |
02:44 | | * Reltzik eyes some code examples. |
02:44 | < Reltzik> | Still much more arcane than I'm thinking. |
02:44 | <@McMartin> | Relt: Also, more to the point, language design is Really Freaking Difficult, and implementation thereof is not a walk in the park either. |
02:44 | <@McMartin> | For someone who is just picking up the cursor again, implementing a new language should not be your first project. |
02:45 | <@ToxicFrog> | Reltzik: ok, show us what you were thinking for a simple rule |
02:45 | < Reltzik> | As in an example? |
02:45 | <@McMartin> | Yes. |
02:46 | <@McMartin> | What kind of extension are you envisioning for a house rule, and how will it be expressed? |
02:46 | < Reltzik> | Well, I've already got a few examples written up for core rules, Here, let me dig out one. |
02:47 | < Reltzik> | Here we go, 5 lines. It'd look SOMETHING like this, I'm far from set on the keywords and so forth. |
02:47 | <@McMartin> | If you've got a link. |
02:47 | <@McMartin> | syntax is largely irrelevant, except for where the hooks are and such. |
02:47 | < Reltzik> | "Tireless Rage" is in DnD's Core Rules's Players Handbook's Classes Chapter's Barbarian Section. |
02:47 | < Reltzik> | it is a rule. |
02:48 | < Reltzik> | its Description is "At 17th level and higher, a barbarian no longer becomes fatigued at the end of his rage." |
02:48 | < Reltzik> | its Scopes include "Subject" which is a Character. |
02:48 | < Reltzik> | its Requirements includes "Level Requirement": at least 17 Barbarian Level((s)) in Subject's Levels. |
02:48 | < Reltzik> | its Consequences includes "Tireless": ignore Subject's Powers's Rage's Fatigue consequence. |
02:48 | < Reltzik> | ((6 lines, sorry)). |
02:48 | < Reltzik> | Now, this is still a bit clunky, want to make it look more natural. |
02:49 | <@ToxicFrog> | That looks like Inform 7. |
02:49 | <@McMartin> | That's only been an unsolved research problem for 50 years; I'm sure you'll do fine. |
02:49 | <@ToxicFrog> | Also: we have a pastebin. Please use it. |
02:49 | <@McMartin> | And yeah, even I7 was 3 years of work by experts. |
02:49 | < Reltzik> | Pastebin? |
02:49 | | * ToxicFrog points at the topic |
02:49 | <@ToxicFrog> | A website where you can paste code, and provide links. |
02:49 | <@Vornicus> | pastebin: a website that you give it text and it gives you a url, and you hand out the url. |
02:50 | <@ToxicFrog> | It's both more readable and less cluttery than pasting the code in channel. |
02:50 | < Reltzik> | Ah. Okay, hang on a sec. |
02:50 | <@ToxicFrog> | And yes, as McM said, getting a computer to understand natural language is not just not easy, it's not solved. |
02:51 | <@ToxicFrog> | Inform 7 is the closest thing I know of, and that's a special purpose language that took years to develop by people who have The Skills. |
02:51 | < Reltzik> | Okay, here. |
02:51 | <@McMartin> | And even then it's enforcing a specific syntax |
02:51 | < Reltzik> | Dammit. |
02:51 | <@ToxicFrog> | And even then, it's not English, it just looks reasonably close. |
02:51 | | * Reltzik can't put up a url here. |
02:52 | <@McMartin> | One moment |
02:52 | | mode/#code [+v Reltzik] by ToxicFrog |
02:52 | <+Reltzik> | http://rafb.net/p/NVHWDj57.html |
02:52 | <@ToxicFrog> | Now you can. |
02:52 | | mode/#code [+oooo Reltzik Attilla EvilDarkLord GeekSoldier|bed] by Vornicus |
02:52 | | mode/#code [+o Pi] by ToxicFrog |
02:52 | <@McMartin> | I totally need to go get dinner |
02:52 | <@McMartin> | However |
02:52 | | mode/#code [+oooo Jeff Raif Serah Syloqs-AFH] by ToxicFrog |
02:52 | | mode/#code [+o Simone] by Vornicus |
02:52 | <@McMartin> | I think you could actually do a Hell of a lot of this in XML. |
02:52 | <@Reltzik> | Well, no, I'm not trying to solve the problem of English language. |
02:52 | <@ToxicFrog> | Reltzik: yes, you are,. |
02:52 | <@McMartin> | Which both Java and Python can parse as internal libraries. |
02:52 | <@Reltzik> | Am I. |
02:52 | <@ToxicFrog> | Or a reasonably close approximation thereof. |
02:53 | <@ToxicFrog> | You're trying to write something that will let people express rules in a language that is at least within shouting distance of english. |
02:53 | <@McMartin> | I will translate this 6-line example after dinner into Java and Python raw code, and an XML version for Classical Data-Driven material. |
02:53 | <@Reltzik> | "within shouting distance" is a pretty vague notion. |
02:54 | <@McMartin> | Yes. |
02:54 | <@McMartin> | That happens when dealing with a problem that hasn't been even acceptably attacked in 5 decades of trying. |
02:54 | <@Reltzik> | What I want is something that translates INTO English, easilly and without much expertise. Translating something OUT of English is the hard part. |
02:54 | <@Reltzik> | THAT I'm not really tackling. |
02:54 | <@McMartin> | ... hold it. |
02:54 | <@McMartin> | Who's rolling the dice here? |
02:55 | <@Reltzik> | How so? |
02:55 | <@McMartin> | Is what you pasted the program's input or its output? |
02:55 | <@Reltzik> | That's an example of code. Input. |
02:55 | <@McMartin> | You're trying to translate it out of English. |
02:55 | <@McMartin> | The GM is writing English, and you're trying to turn it into data structures and code. |
02:56 | <@ToxicFrog> | Then you are trying to translate FROM english, TO something the program can manipulate - ie, out of english. |
02:56 | <@Reltzik> | Let's say that I'm using a very, VERY limited SUBSET of English, which isn't really true, but. |
02:56 | <@McMartin> | Reltzik: But you aren't using it. |
02:56 | <@McMartin> | The GM is. |
02:57 | <@McMartin> | The one who can't program and doesn't understand syntax. |
02:57 | <@McMartin> | You're trying to deal with all the ways he can phrase that. |
02:57 | <@Reltzik> | No, I'm not. |
02:57 | <@McMartin> | If you aren't, then he'll write stuff that looks basically like stuff that does work, except it doesn't. |
02:58 | <@McMartin> | As evidence, I cite the entire development history of Inform 7, which at least three people here have been watching. |
02:58 | <@McMartin> | It's harder to screw up a line like: name = "Tireless Rage" |
02:59 | <@McMartin> | Than to remember that you have to say {NAME} is in {BOOK} precisely. |
02:59 | <@Reltzik> | Now is that harder to screw up? |
02:59 | <@Vornicus> | Watching, and participating in. |
02:59 | <@McMartin> | One is an essay question |
02:59 | <@McMartin> | The other is, essentially, filling in a two-column form. |
03:01 | <@Reltzik> | Mm. |
03:01 | <@McMartin> | What you're doing here is having a very strictly-formatted two-column form and then constructing an elaborate masquerade that it is an essay question. |
03:02 | <@McMartin> | I7's structure involves talking about groups of nouns qualified by adjectives which may themselves be user-defined, and this is Extremely Difficult To Do Right. |
03:02 | <@McMartin> | And is in fact where it gets most of its power over I6. |
03:03 | <@McMartin> | But even looking at this, if your goal is for a non-programmer to be able to come up with this stuff, this is still way too arcane. |
03:03 | <@McMartin> | I guarantee you that they will forget to define the Scopes, or that it has to be a Character, or that the ((s)), if important, will go missing. |
03:03 | <@McMartin> | Or they'll forget to explicitly state that it's a rule. |
03:03 | <@McMartin> | Etc. etc. |
03:03 | <@McMartin> | The interesting question here is how complex requirements can get. |
03:04 | <@Reltzik> | Actually the (( )) notation is a comment. |
03:04 | <@Reltzik> | Not important. |
03:04 | <@McMartin> | Then they'll type "levels" out explicitly. |
03:04 | <@McMartin> | If it's "any amount of computation is allowed", there's no sense in not using a well-established langauge to do this anyway. |
03:05 | <@McMartin> | At worst you can then write a wrapper around it later to autogenerate the computer code from a more informal description, using form filling, pattern matching, or whatever. |
03:05 | <@McMartin> | a Requirement for example is a name and some function that needs to return true. |
03:06 | | * Reltzik gets over being stubborn and starts thinking in terms of that, with an interactive module which DMs can use to edit the rules base. Select the subjects and direct objects of the sentence from a menu, so to speak. |
03:06 | <@ToxicFrog> | Reltzik: http://lua.pastey.net/82808 -- here's one of many ways it might look in Lua. |
03:06 | <@Vornicus> | I think what you need to do, is start writing code. |
03:06 | <@McMartin> | You've also got a concept of procedural rules here, which will not be easy to implement. |
03:06 | <@ToxicFrog> | And now, dinner. |
03:07 | <@Vornicus> | And then refactor refactor refactor until you've got classes, races, and other things like that each in its own file. |
03:07 | <@McMartin> | The python version would be similar but with more equals signs. |
03:07 | <@McMartin> | The XML version would look like an insane HTML page and teh requirement section would be horrifically underspecified |
03:08 | <@McMartin> | While the Lua and Python versions are "strings that, when evaluated, must return true" |
03:09 | <@McMartin> | That said, at this level of granularity |
03:09 | <@McMartin> | Almost all of the scenario design is going to be system specific, so there isn't going to be a Hell of a lot for the extensions to work with. |
03:10 | <@McMartin> | So I wouldn't worry overmuch about the "main program" being d20-bound. |
03:10 | <@Vornicus> | I think we're really looking at just D&D, but with the ability to add new rulebooks. |
03:10 | <@McMartin> | Because you're already essentially requiring that the concepts of "level" and "feat" and etc. be sensible, and they won't be anywhere else. |
03:10 | <@McMartin> | Ah. |
03:10 | | * McMartin heads off for fudz |
03:12 | <@Reltzik> | Not quite. I'm requiring the existence (or eventual creation) of a defined character class, which has a level field (actually a collection of sorts), and then I'm testing it to see how many of what it contains are of type Barbarian Level. |
03:23 | | Vornicus is now known as Vornicus-Latens |
03:41 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has left #code [] |
04:50 | | You're now known as TheWatcher |
05:49 | | GeekSoldier|bed [~Rob@Nightstar-9493.dip.t-dialin.net] has quit [Ping Timeout] |
05:52 | | Myst [~Myst@Nightstar-16167.sip.shv.bellsouth.net] has quit [Ping Timeout] |
05:55 | | GeekSoldier|bed [~Rob@Nightstar-9164.dip.t-dialin.net] has joined #code |
05:57 | | GeekSoldier|bed is now known as GeekSoldier |
06:04 | | Myst [~Myst@Nightstar-16167.sip.shv.bellsouth.net] has joined #code |
06:04 | | mode/#code [+o Myst] by ChanServ |
09:01 | | AnnoDomini [AnnoDomini@83.21.57.ns-4950] has joined #Code |
09:01 | | mode/#code [+o AnnoDomini] by ChanServ |
10:17 | | Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout] |
10:20 | | Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code |
10:20 | | mode/#code [+o Reiver] by ChanServ |
10:30 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
10:30 | | mode/#code [+o gnolam] by ChanServ |
12:33 | | Jeff [~JPL@Nightstar-12251.dsl.sndg02.pacbell.net] has quit [Connection reset by peer] |
13:01 | | AnnoDomini [AnnoDomini@83.21.57.ns-4950] has quit [Ping Timeout] |
13:08 | | AnnoDomini [AnnoDomini@83.21.33.ns-25552] has joined #Code |
13:08 | | mode/#code [+o AnnoDomini] by ChanServ |
14:16 | <@AnnoDomini> | "implicit declaration of function `int setclr(...)'" <- Does anyone know what I did wrong to get this error message? |
14:16 | <@jerith> | Context? |
14:17 | <@AnnoDomini> | cout << setclr(WHITE) << setbk(BLACK) << strbuffer.substr(n+1,2048); |
14:17 | <@jerith> | Where is setclr() defined? |
14:17 | <@AnnoDomini> | It's supposed to be defined in conio.h, which I have included. |
14:18 | <@jerith> | Namespace issues? |
14:18 | <@AnnoDomini> | I don't really understand how namespaces work at all. |
14:19 | <@jerith> | Welcome to the club. |
14:20 | <@AnnoDomini> | Great. |
14:21 | <@jerith> | Do you have a "namespace std;" up at the top? |
14:22 | <@AnnoDomini> | I have a "using namespace std;". |
14:22 | <@jerith> | That's probably what I meant. |
14:22 | <@AnnoDomini> | Whether or not it's there, however, I get the same errors. |
14:23 | <@Vornicus-Latens> | is conio in the std namespace? |
14:24 | <@AnnoDomini> | Hell if I know. |
14:24 | <@jerith> | Look in conio.h? |
14:25 | <@Vornicus-Latens> | References I'm seeing say that the namespace is conio |
14:25 | <@Vornicus-Latens> | add using namespace conio; to your code |
14:26 | <@AnnoDomini> | "namespace conio undeclared" |
14:28 | <@Vornicus-Latens> | Open conio.h |
14:28 | <@Vornicus-Latens> | And search on the word namespace |
14:28 | <@AnnoDomini> | Nothing. |
14:29 | <@Vornicus-Latens> | Search on the word setclr |
14:29 | <@ToxicFrog> | Not present in the mingw headers. |
14:29 | <@ToxicFrog> | Also, conio.h is a C header; it does not use namespaces, which are C++. |
14:30 | <@ToxicFrog> | Some background: "implicit declaration of function foo" occurs when you are attempting to use a function without first declaring it. For some reason - which I should ask my dad about - this is not an error, but instead acts as a declaration of the function in question with return type of int. |
14:30 | <@AnnoDomini> | http://conio.sourceforge.net/tutorial.html <- I'm trying to do the stuff for C++ presented here. |
14:31 | <@ToxicFrog> | Have you installed that library? |
14:32 | <@ToxicFrog> | The conio that comes with mingw is not the same as the one on that site, which is a rewritten one with a bunch of extra stuff. |
14:32 | <@AnnoDomini> | Oh. |
14:32 | <@AnnoDomini> | I got that link off Wikipedia, from the conio.h article. |
14:34 | <@ToxicFrog> | Note that the wikipedia article says "this is NOT the standard conio.h" next to that link. |
14:34 | <@gnolam> | There IS no standard conio.h. :P |
14:34 | <@gnolam> | conio is part of neither ANSI nor POSIX. |
14:34 | <@AnnoDomini> | ToxicFrog: I edited that in. Just now. |
14:34 | <@ToxicFrog> | gnolam: there are some functions common to most or all conios, which are listed on that page |
14:34 | <@gnolam> | It is Pure Evil. |
14:35 | <@ToxicFrog> | setclr isn't one of them, nor is any C++ code. |
14:35 | <@AnnoDomini> | Right... is there an easy way to colour text in cout? |
14:36 | <@ToxicFrog> | http://en.wikipedia.org/wiki/ANSI_escape_code |
14:37 | <@ToxicFrog> | In particular look at SGR, the color table and the SGR parameters table. |
14:38 | <@ToxicFrog> | Note that this is a subset of the DEC control codes; it'll work on most *nix terminal emulators, but is not guaranteed to work out of the box on windows systems - as it says on the page, you will probably need to load ANSI.SYS. |
14:38 | <@AnnoDomini> | So I just do it like I do it in mIRC? <color_control_character><Some_number><stuff><color_control_character>? |
14:38 | <@AnnoDomini> | Arg. |
14:39 | <@ToxicFrog> | Not quite. |
14:39 | <@ToxicFrog> | Like it says on that page, it's CSI n m to set the color |
14:39 | <@ToxicFrog> | Where CSI is the ESCAPE character followed by a [ |
14:40 | <@ToxicFrog> | You can also do CSI a ; b ; c ... m |
14:40 | <@AnnoDomini> | This hurts my brainmeats. |
14:40 | <@ToxicFrog> | To set multiple options at once (eg, bold, underlined, red with a white background) |
14:40 | <@ToxicFrog> | It's not that hard. |
14:41 | <@ToxicFrog> | conceptually, it's very similar to the way mIRC does it. |
14:41 | <@ToxicFrog> | Except that rather than being <color_control><color settings>, it's <terminal_control><color settings>m |
14:42 | <@ToxicFrog> | Takes five minutes to write functions for that in bash or lua and only slightly longer in C. |
14:44 | | * Vornicus-Latens fiddles with his orion code, cleaning it up. |
14:45 | <@ToxicFrog> | That said, terminal control isn't exactly pretty, it's not quite the same between any two terminals even if they claim to support the same interface, and there's at least one huge, nasty library (curses) written to solve this. |
14:46 | <@Vornicus-Latens> | Curses! |
14:46 | <@ToxicFrog> | And windows, of course, has to do things differently - in this case, it actually supports (a subset of) the common interface (?!?!?!), it just doesn't work unless you explicitly load the driver. |
14:55 | | Vornicus-Latens is now known as Vornicus |
14:57 | | * AnnoDomini gives up regarding colours for now. |
15:00 | <@AnnoDomini> | Hm. Let me get this straight - if a function returns a container which has functions, I can just slap a dot after the parentheses, and use the functions of that container in turn? |
15:01 | <@Vornicus> | Okay, so. I have a galaxy, which is full of stars, and has calculated its extents based on the stars' locations. Then I have an aperture, which has offsets and a scale, and can calculate where any point in the window shows up in the aperture. |
15:01 | <@ToxicFrog> | AnnoDomini: yes. |
15:02 | <@AnnoDomini> | This boggles my mind a bit. |
15:02 | <@ToxicFrog> | Why? |
15:02 | <@ToxicFrog> | If you have a function that returns, say, a Screen object, which is full of delicious functions |
15:02 | <@ToxicFrog> | And you write: getScreen().refresh() |
15:02 | <@AnnoDomini> | I used "strbuffer.substr(n+1,2048).c_str()" on a hunch and it worked. I'm not used to stuff working on the first try like I wanted them to. |
15:03 | <@ToxicFrog> | The first call is executed and evaluates into a Screen; and then refresh() is called through the returned object. |
15:03 | <@ToxicFrog> | Aah. |
15:03 | <@ToxicFrog> | Remind me, why are you using C++? |
15:03 | <@Vornicus> | Then I have my Excessively Hairy star generator. |
15:04 | <@AnnoDomini> | ToxicFrog: I figure they're going to expect me to code in it later on. After like two semesters of it, I'm supposed to be competent at it. |
15:05 | <@ToxicFrog> | Aah. |
15:05 | <@AnnoDomini> | It's too bad that they haven't seen to it that competent teaching happened, though. |
15:07 | <@Vornicus> | Actually it's not that hairy, but it needs to be cleaned up. |
15:09 | | * AnnoDomini mumbles about how the first semester of C++ could be passed with knowledge how to include libraries, how to set up a for loop, and how to do basic arithmetic. |
15:10 | | * AnnoDomini additionally mumbles about how the SECOND semester was chucking us into Visual Studio, and hoping we'd manage to stay afloat. |
15:12 | <@ToxicFrog> | You don't include libraries. |
15:13 | <@ToxicFrog> | You include headers, and link against the libraries they represent. |
15:13 | <@AnnoDomini> | Header files. |
15:13 | | * ToxicFrog feeds your professors through a std::iostream feet first |
15:13 | | * AnnoDomini gets the popcorn. |
15:14 | <@ToxicFrog> | Dammit. Somewhere, I discussed an interface for libres on IRC. |
15:14 | <@ToxicFrog> | But I can't find the logs now. |
15:15 | | * Serah PatPats ToxicFrog. |
15:21 | <@ToxicFrog> | API question. |
15:22 | <@ToxicFrog> | Should res::close() automatically write changes made to the resfile to disk? |
15:22 | <@ToxicFrog> | At present I am leaning towards close() saving changes, and destroy() not. |
15:29 | | * Vornicus args. Always hates this part. Have to figure out how to break up the program into modules. |
15:33 | <@Serah> | Aha! |
15:33 | <@Serah> | Then let me start a third topic, and we can talk about each our own thing and then misunderstand eachother! :p |
15:33 | <@Serah> | TF: I really don't know. Sounds sane. |
15:36 | | * Vornicus gives Serah a cheese. |
15:37 | <@ToxicFrog> | Mmm, cheese. |
15:38 | | * Vornicus gives TF a cheese too. |
15:39 | <@Vornicus> | Hm. Stars are definitely their own whole module; there's a lot going on in there. |
15:39 | <@Vornicus> | The galaxy and viewport stuff go together. |
15:40 | <@ToxicFrog> | Also I can no longer remember the interface we designed for struct. |
15:40 | <@ToxicFrog> | I think it was: |
15:40 | <@ToxicFrog> | suffix: width or address |
15:40 | <@ToxicFrog> | prefix: repeat N times |
15:40 | <@ToxicFrog> | (...): grouping (for repeat) |
15:41 | <@ToxicFrog> | {...}: named field declarations |
15:42 | <@Vornicus> | Heh |
15:43 | <@ToxicFrog> | So you might do, say, "u4" for a 4-byte unsigned int; "2u4" for two of them; and "4{ id:u2 packsize:u3 flags:m1 size:u3 type:u1 }" for the first four entries in a resfile's TOC. |
15:47 | <@Vornicus> | That looks right |
16:09 | <@ToxicFrog> | Onwards, then! |
16:19 | | * Vornicus ponders. Should he switch to an integer model of galaxy coordinates? |
16:32 | | Syloqs-AFH [Syloq@NetAdmin.Nightstar.Net] has quit [Quit: ] |
16:34 | | Syloq [Syloq@NetAdmin.Nightstar.Net] has joined #code |
16:35 | | Syloq is now known as Syloqs-AFH |
17:05 | | You're now known as TheWatcher[afk] |
17:08 | | Syloqs-AFH [Syloq@NetAdmin.Nightstar.Net] has quit [Connection reset by peer] |
17:08 | <@ToxicFrog> | Hmm. |
17:08 | <@ToxicFrog> | Ok, the s and z formats - string and cstring. |
17:08 | <@ToxicFrog> | On read: |
17:08 | <@ToxicFrog> | sW reads exactly W bytes and returns them as a string. |
17:09 | <@ToxicFrog> | zW reads exactly W bytes and returns everything up to the first NUL as a string. |
17:10 | <@ToxicFrog> | z reads everything up to and including the next NUL and returns everything (except the NUL) as a string. |
17:10 | <@ToxicFrog> | So, you use sW to read chunks of known size, zW to read null-padded string fields of fixed length and z to read null-terminated strings of unknown length. |
17:10 | <@Vornicus> | ...no, I don't think I should, in the end. The float model actually works better. |
17:10 | <@ToxicFrog> | I'm having a bit of trouble pinning down the write behaviours, though. |
17:11 | <@ToxicFrog> | z obviously writes the string it's given and appends a NUL. |
17:11 | <@ToxicFrog> | zW writes exactly W bytes, null padding if the string it's given is too short, and truncating with a single NUL at the end if it's too long. |
17:12 | <@ToxicFrog> | sW...writes exactly W bytes? Writes at most W bytes? |
17:12 | <@ToxicFrog> | s, obviously, just writes #str bytes with no padding or termination. |
17:15 | <@ToxicFrog> | Vornicus: any insight? |
17:16 | <@Vornicus> | I'm thinking at most W bytes. |
17:17 | <@Vornicus> | Though I have to say, the writing of un-delimited strings to a binary file gives me the jibblies. |
17:17 | <@ToxicFrog> | Well, remember that lua strings also covers byte buffers. |
17:19 | <@ToxicFrog> | So you would use, say, 'z124' to read the comment field of a resfile (null-terminated, null-padded cstring field), and 's10' to read/write a single TOC entry as an opaque binary chunk. |
17:28 | <@ToxicFrog> | Ok. Documentation is done. |
17:28 | <@ToxicFrog> | Now to finish implementing it. |
17:29 | <@ToxicFrog> | I have this fairly cool data/execution queue design going. |
17:30 | <@ToxicFrog> | The lexer creates a queue of functions; this queue is then executed in order, with functions for stuff like repetition modifying the instruction queue and {} modifying the data stack. |
17:53 | | * ToxicFrog finds a bug in explode/implode where they disagree on what the MSB is |
18:28 | | You're now known as TheWatcher |
18:40 | | AnnoDomini [AnnoDomini@83.21.33.ns-25552] has quit [Ping Timeout] |
18:47 | | AnnoDomini [AnnoDomini@83.21.33.ns-25552] has joined #Code |
18:47 | | mode/#code [+o AnnoDomini] by ChanServ |
19:25 | | Myst [~Myst@Nightstar-16167.sip.shv.bellsouth.net] has quit [Ping Timeout] |
21:38 | | * AnnoDomini is wondering - is it even possible to use ncurses/curses under windows? |
21:47 | <@gnolam> | I know PDcurses is supposed to be MinGW compilable at least. |
21:49 | <@ToxicFrog> | Yeah, there are windows ports of curses. pdcurses is one. |
21:49 | <@ToxicFrog> | Cygwin comes with another, although that introduces cygwin dependencies. |
22:16 | <@AnnoDomini> | Mm'kay. I've downloaded the precompiled Win32 library. I got a .dll, a .lib, and two .h files. |
22:17 | <@AnnoDomini> | I figured out that you need to put the .h files in the include folder, probably in the one the IDE calls the C++ include directory. |
22:17 | <@AnnoDomini> | I put the .lib and .dll in the Lib directory. |
22:17 | <@AnnoDomini> | The program compiles. |
22:17 | <@AnnoDomini> | But doesn't link. |
22:17 | <@AnnoDomini> | "undefined reference to `clear'" |
22:21 | | GeekSoldier is now known as GeekSoldier|bed |
22:36 | <@gnolam> | .libs are for MSVC. :P |
22:38 | <@AnnoDomini> | Que? No habla programese. |
22:40 | <@AnnoDomini> | But anyway. Did I at least guess sorta correctly where to put these? What's that error message mean? |
22:41 | <@Vornicus> | Okay. Viewport, galaxy. The viewport ties a surface and a galaxy together. |
22:47 | <@Vornicus> | Viewport uses the surface information and the galaxy information to determine how the galaxy would fit in the surface it's given. |
22:47 | <@ToxicFrog> | AnnoDomini: it means that the program uses the symbol (function or variable) 'clear', but the compiler can't find which library provides that symbol. |
22:47 | <@ToxicFrog> | You did guess correctly as to where to put them. |
22:47 | <@ToxicFrog> | Did you add the library to the list of libraries your project links against? |
22:48 | <@Vornicus> | And then when zooming or panning, the viewport calculates the stuff needed to do the pan/zoom. |
22:49 | <@AnnoDomini> | ToxicFrog: It's the linker that gives that error, to be exact. What else, beyond the #include statement, do I need to do to see that the library is linked? |
22:50 | <@gnolam> | -lwhateverthelibraryiscalled . |
22:50 | <@ToxicFrog> | gnolam: he's using an IDE, I thought. |
22:50 | <@gnolam> | But as I said, .lib files are for MSVC. Last I heard, you were using MinGW. |
22:50 | <@ToxicFrog> | gnolam: mingw will find the dll and link against it. |
22:50 | <@gnolam> | Err, what? |
22:51 | <@ToxicFrog> | gcc can link directly against DLLs. |
22:51 | <@AnnoDomini> | So... what am I doing wrong? |
22:51 | <@ToxicFrog> | It has been able to for quite some time. |
22:51 | <@Vornicus> | Or, rather, it calculates the new zoom and offset, makes sure they stay within acceptable parameters (I'm not sure what these would be - perhaps I'm looking at: the zoom level is never allowed to go below the level where the entire map would just fit in the viewport, and the the offsets should, uh... |
22:51 | <@Vornicus> | How the hell do I put it. |
22:51 | <@ToxicFrog> | AnnoDomini: are you using the IDE, or running the linker by hand? |
22:51 | <@AnnoDomini> | IDE. |
22:51 | <@ToxicFrog> | Ok. |
22:51 | <@ToxicFrog> | In that case, somewhere in the project options, there will be a list of libraries to link against. |
22:51 | <@ToxicFrog> | You need to add the name of this library to that list. |
22:51 | <@gnolam> | And you're still using Dev-Abandonallhopeyewhoenterhere? |
22:52 | <@AnnoDomini> | Yeah. |
22:52 | <@Vornicus> | The rectangle of the most-zoomed-out view, the entirety of it is /always/ inside the galaxy. |
22:52 | <@ToxicFrog> | The #include merely tells the compiler what symbols are available; it provides no information to the linker, which must be told seperately what libraries to make use of. |
22:52 | <@gnolam> | 'fraid I can't help you then. Except to urge you again to switch to a decent IDE. :P |
22:55 | <@AnnoDomini> | gnolam: I don't see what's so bad about it. |
22:57 | <@gnolam> | It's buggy as fuck. It's outdated. It's autocompletion/etc features aren't just limited - they're almost nonexistent. In short, it's crap. |
22:57 | <@AnnoDomini> | ToxicFrog: http://i28.tinypic.com/2ujgkcn.jpg <- I've got this. In which field do I put what? |
22:57 | <@gnolam> | *Its |
22:57 | | * gnolam commits ritual seppuku for abusing an apostrophe. |
22:57 | <@ToxicFrog> | AnnoDomini: I think you should add "-llibraryname" to "extra object files or linker options" |
22:58 | <@ToxicFrog> | But that looks totally different from the versions of dev-C++ I've used. |
22:59 | <@AnnoDomini> | We're making progress, new error: "cannot open -lcurses: No such file or directory". |
23:00 | <@AnnoDomini> | gnolam: Haven't ran into any bugs yet. I'm used to using ancient software. Who needs autocompletion, anyway? |
23:00 | <@gnolam> | If you don't, what the hell are you doing using an IDE in the first place? :P |
23:00 | <@ToxicFrog> | That's odd. |
23:00 | | You're now known as TheWatcher[T-2] |
23:00 | <@ToxicFrog> | It should say "cannot find -lfoo" if it's trying to use it as a library. |
23:01 | <@ToxicFrog> | I've got nothing. |
23:01 | <@AnnoDomini> | gnolam: The only compiler that I was somehow able to discover how to use with a command line was javac. |
23:01 | <@ToxicFrog> | It really is not that hard. |
23:02 | <@ToxicFrog> | And if you're using make or pm or one of the others you don't even need to remember how to invoke the toolchain except when you're setting up the project; you just run "make" and it does it for you. |
23:02 | | * Vornicus fiddles with it. |
23:02 | <@Vornicus> | I also need to figure out how to get in the background. |
23:06 | | You're now known as TheWatcher[zZzZ] |
23:09 | <@AnnoDomini> | Okay, the FAQ says that "-lsomething" means that it'll try loading "libsomething.a". |
23:10 | <@ToxicFrog> | Unless it's using a very old version of gcc, that should also look for "something.dll" |
23:10 | <@ToxicFrog> | What version of dev-c++ is it? |
23:11 | <@AnnoDomini> | Version 4. It says it's got mingm 2.95. |
23:12 | <@ToxicFrog> | ...that's ancient. |
23:13 | <@ToxicFrog> | I don't think DLL loading was added until gcc 3.x. |
23:13 | <@ToxicFrog> | And I note that the current version is 4.2 |
23:14 | | * AnnoDomini goes download an older version of pdcurses. |
23:16 | <@ToxicFrog> | .. |
23:16 | <@ToxicFrog> | Why? |
23:17 | <@ToxicFrog> | There is no reason for you to be using gcc 2! |
23:17 | <@ToxicFrog> | And I don't see how downgrading the pdcurses version will help. |
23:17 | <@AnnoDomini> | Well, for one, this version has libraries in .a files. |
23:17 | <@AnnoDomini> | And the program now links. |
23:18 | <@ToxicFrog> | Aah. |
23:19 | <@AnnoDomini> | Compiles, links, but does not run. :( |
23:19 | <@ToxicFrog> | Still, why not just use a compiler that isn't hugely obsolete? |
23:19 | <@AnnoDomini> | I think I'll do that, then. |
23:27 | | * AnnoDomini boggles at all these strange and arcane things on the MinGW sourceforge download page. Doesn't know which to click. |
23:30 | <@ToxicFrog> | The one labeled "easy mingw installer", generally |
23:30 | <@ToxicFrog> | Or get version 5 of dev-c++, which comes with a more recent gcc |
23:32 | <@AnnoDomini> | Okay. Doing that. |
23:33 | | * AnnoDomini shakes head. Either he's becoming less literate by the hour, or the people writing these websites should learn English better. |
23:34 | <@ToxicFrog> | Personally, if you don't have any particular interest in IDE features, I'd suggest just installing plain mingw and invoking the compiler directly. |
23:34 | <@ToxicFrog> | Knowing how to control the compiler by hand is always useful. |
23:36 | <@AnnoDomini> | Mhm. |
23:37 | <@AnnoDomini> | Okay, got the Automated Installer for MinGW. What features should I choose? I figure g++ compiler is a no-brainer, but I'm not sure about "Objective C compiler" and "MinGW Make". |
23:38 | <@ToxicFrog> | objc you probably won't need. make may be useful. |
23:38 | <@ToxicFrog> | ...actually, does that installer give you any options for MSYS? |
23:39 | <@AnnoDomini> | It does not. |
23:39 | <@AnnoDomini> | I take it I don't need "g77" either? |
23:39 | <@AnnoDomini> | Whatever that is. |
23:40 | <@ToxicFrog> | g77 is for compiling FORTRAN'77 programs. |
23:40 | <@AnnoDomini> | I'll pass. :P |
23:40 | <@ToxicFrog> | Hmm. So what this will get you is a bunch of tools, but no actual shell or terminal to use them from. |
23:41 | <@AnnoDomini> | Eh? Can't I just use DOS/whatever-winXP-uses command line? |
23:42 | <@ToxicFrog> | Well, yes, it's just that it's nice to have things like the ability to resize the terminal. |
23:42 | <@ToxicFrog> | Or a real shell. |
23:42 | <@ToxicFrog> | But yes, you can use these tools from cmd.exe |
23:43 | <@AnnoDomini> | Cool. |
23:44 | <@AnnoDomini> | Now to wait for it to download. Looks like a pretty damn big thing. |
23:45 | <@ToxicFrog> | 100MB or so. |
23:45 | <@ToxicFrog> | Not that large. |
23:45 | <@ToxicFrog> | Now, Cygwin, that's big. |
23:45 | | * AnnoDomini considers anything that doesn't fit on a ten-pack of floppies big. |
23:51 | <@AnnoDomini> | Well, it completed early, what with most of the components being unselected. |
23:52 | <@AnnoDomini> | Now, how to use this contraption? |
23:54 | <@ToxicFrog> | First, you'll probably want to add it to your PATH. |
23:54 | <@ToxicFrog> | Although I don't recall how one does this permanently in windows. |
23:54 | <@AnnoDomini> | I do. |
23:55 | <@AnnoDomini> | What do I write there? |
23:55 | <@ToxicFrog> | Anyways, add the mingw bin/ directory to your path. |
23:55 | <@AnnoDomini> | Okay. |
23:55 | <@ToxicFrog> | (mingw gcc should be able to find include/ and lib/ based on where gcc.exe itself is) |
23:56 | <@ToxicFrog> | Having done this, test 'gcc', 'g++' and 'make' to make sure they all run... |
23:59 | <@AnnoDomini> | "'make' is not recognized as an internal or external command," |
23:59 | <@AnnoDomini> | The other two work. |
23:59 | <@gnolam> | 'tis called mingw32-make. |
23:59 | <@AnnoDomini> | This works. |
--- Log closed Sun Feb 24 00:00:02 2008 |