Once again, you're talking about settings implementation, and my whole point is about settings definition. It's about what the client receives in response to ?getsettings/?quickfix command. Knowing settings by heart doesn't put them in SET files...
I don't pretend my model to be perfect, or the best model around, but I think this discussion must be started as soon as possible for the sake of the project.
I would like asss to be a little bit more friendly with the final user. I think you guys are so deep into the project that you have forgot the perspective of final users. Maybe I'm just wrong and you pretend it to be operated by developers only.
Grelminar - Fri Sep 09, 2005 3:41 am
Post subject: my proposal
Ok, now I have a better idea of what you're proposing. The problem with your proposal is, as you note, everyone writing a module with settings would have to add a bunch of extra code to register and unregister their settings. It's a lot easier to do that for commands, because they have to be registered and unregistered anyway, so it's just a matter of adding an extra parameter. Settings don't have to be registered, so forcing a register/unregister for them is awkward and annoying.
Also, the parsing out of the setting type, range, default values, etc. would have to happen in the server, not in an external script. Command help text doesn't have to be processed, which is why that's easier to do.
I do have an idea for how dynamic config help could work, although it's a little complicated and sort of ugly. There are two parts of the scheme: one for C modules and one for python modules.
For C modules, we hack the build system: whenever it tries to compile a .c file into a .o, it also runs a script on the .c file. That script (an enhanced version of extract-cfg-docs.py) looks for specially formatted cfghelp comments and if it finds any, outputs something similar to the contents of cfghelp.inc to a temporary .c file, which defines an exported symbol based on the module name, that points to static data containing the processed cfghelp. Then we somehow compile both .c files into the .o file (either concatenate the .c files before compiling, or compile them separately and do an incremental link). Then, when loading a C module, we look for the cfghelp pointer, and if we find it, pass it to the cfghelp module (which is enhanced to be able to deal with dynamic data). On unload, we again pass it the pointer so that it can unregister the settings for the module being unloaded.
For python, we hook into module loading, and run a script (again a modified extract-cfg-docs.py) over the module source at load time. This requires the script to be present while the server is running, but that's not a big deal. The script will somehow communicate the cfghelp that it finds to the cfghelp module (I can think of a few ways to do this).
I haven't implemented the system I've described, but I think it would work, and it would have all of the properties you want, plus the important one that none of the current cfghelp text would have to be changed. It has a few big disadvantages, though: it would take additional effort to get the build system hacks to work on windows, it requires a lot of special-casing of the cfghelp module in what is now very generic code (cmod.c and pymod.c would both require code changes specific to cfghelp), and in general it's pretty ugly, especially the C module part. However, it might be possible to add the hooks in cmod.c and pymod.c in generic ways, which would alleviate some of the too-much-special-casing concern.
Comments? Improvements? Alternatives? Do people really want this enough that it's worth all the ugliness?
Smong - Fri Sep 09, 2005 4:53 pm
Post subject:
What about an sss directory and each custom module can be distributed with an optional modulename.sss file? You already have to edit modules.conf to install a new module, so dropping some file in another directory shouldn't hurt too much.
If new settings are hidden away inside the code people might not know about them. A seperate file might make the curious look at it. Alternatively if you go ahead with your idea maybe you could alert the person that did the ?insmod (or first staff to login if from modules.conf) with some text like 'modulename has new settings under somename category'?
Actually if you feel that is too user friendly you could just send the output from ?modinfo when you ?insmod (shouldn't be too hard to add that).
xor eax - Fri Sep 09, 2005 11:28 pm
Post subject:
Well.. thank you grelminar, for thinking about it (specially considering i was being an ass in my firsts posts). I think most people is focused on modules and they don't need to care much about this. I came across this "problem" because I was thinking on writing a GUI tool for asss setting edition. What I really need, and everyone else i guess, is a well-formed SERVER.SET. And it can be solved by building asss in the right way... so maybe is better to forget about this.
Instead of being an offline editor, my editor can be a bot which uses ?getsettings/?quickfix and ?setsettings. This way it'll need the server.set file only.
xor eax - Sat Sep 10, 2005 11:29 am
Post subject:
Just to clarify... I think your idea is ok, grelminar, and i still think that a dynamic model is better than a static one, but i don't want you to change it just because of me. It looks like 99% of asss programmers won't ever need more than they have now.
I like more Smong idea, it is very similar to what i proposed. But it requires some drastic changes that put our theories close to fantasy and far from reality.