|
Message-ID: <20110922173713.GA10235@eee> Date: Thu, 22 Sep 2011 21:37:14 +0400 From: Aleksey Cherepanov <aleksey.4erepanov@...il.com> To: john-dev@...ts.openwall.com Subject: Re: Request for Comments on .conf file .remove [section] processing On Thu, Sep 22, 2011 at 10:59:01AM -0500, jfoug wrote: > First, I think that only ".remove [section]" is valid. I do not find > .remove <file> to be valid in any way. I do not see how .remove <file> > could be implemented, nor do I see any usefulness. If others see benefit, > please speak up. If file A includes file B and we want to include file A in our .conf file but we do not want to include file B then .remove <file> could be useful. I could not say that to include file A without file B is right and/or could be needed in real world. > [List.External:test] > int curlen, buffer[12], max; > void init() > { > max=12; > curlen=1; > buffer[0] = 'A'-1; > } > void generate() > { > /* do something here */ > } > void restore() > { > /* do something here */ > } > > > [List.External:test2] > .include [List.External.test] > .remove [variable buffer] > .remove [function init] > int buffer[16] /* NOTE, I see a proble here, because the generate() and > restore() function will now be above this buffer variable! */ Maybe there could be other scoping rules than in C: function could see other function or global variable even if they are declared in "wrong" order. > void init() > { > int i; > max=16; > curlen=12; > for (i = 0; i < 12; ++i) { > buffer[i] = 'Z'; > } > } In general it looks for me like inheritance in OO terms. test2 inherits test and overrides its buffer variable and init function. What if we want to include init function from test and restore function from test3 (another external) into test2? There could be different solutions for this. In OOP such behaviour described by OO model (if I am not wrong). Inheritance seems for me to be too heavy for John but I hope such view on the problem could be useful. I think it is possible to use opposite action to select what should be included. It could look like: [List.External:test2] .include [List.External.test:curlen,max,generate,restore] int buffer[16]; void init() {...} There could be general selectors for sections. I think they could be linewise - we list what lines we want to include. In previous mail I made following example: "RulesA[0:2] + RulesB + RulesA[2:4] or may be something more perlish with flexible slices RulesC[0..5, 9] + RulesD[1, 3, 5]" So now this idea could be adopted to be something like: .include [List.External.test[0:10]] However selecting lines we could not override only buffer variable because it is declared with other variables on the same line. Also it is not very comfortable to manipulate line numbers when we could operate with meaningful objects like variables and functions. (back to rules combinations topic) Looking on it I imagined .include [List.External.test + List.External.test2] to be shorthand for .include [List.External.test] .include [List.External.test2] But this gives syntax to make other combination type: .include [List.External.test * List.External.test2] (back to main topic) Other way is to override variable or function just with new declaration without .remove at all. So if variable or function declared twice then the last declaration is actual. Regards, Aleksey Cherepanov
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.