Reply To cazfi
Split from #44345. Add the ruleset comments about counters sections. Remember also data/ruledit/comments-3.2.txt, and code changes to tools/ruleutil/comments.ch + call it from tools/ruleutil/rulesave.c
Include this two:
2022-07-13 22:28 Updated by: lachu
2022-07-13 22:29 Updated by: lachu
The code part seems fine after manual review (haven't compiled or tested it yet).
I'll try to make a proposal of my own for the actual documentation text.
Reply To cazfi
I'll try to make a proposal of my own for the actual documentation text.
Attached (just for classic ruleset, as an example). If it looks like ok to you, make a full patch.
I documented default as '.def' as it's loaded (not as '.default' that rulesave currently saves). Assuming that #45253 gets fixed that way.
Reply To cazfi
Reply To cazfi
I'll try to make a proposal of my own for the actual documentation text.
Attached (just for classic ruleset, as an example). If it looks like ok to you, make a full patch. I documented default as '.def' as it's loaded (not as '.default' that rulesave currently saves). Assuming that #45253 gets fixed that way.
2022-07-28 22:14 Updated by: lachu
2022-07-28 22:14 Updated by: lachu
I see we need to join comment about counters data with code to generate ruleset. Also, clarification about counters inside classic ruleset are delivered in separate patch. Typo is also repaired (spaces in blank line).
scripts/spec_propagate.sh might be useful when you set up the documentation comment to all rulesets (but it's quite likely that the lack of common context causes that script to fail with some rulesets)
Reply To cazfi
when you set up the documentation comment to all rulesets
Ping. Can you make such an final patch with all the contents needed for this ticket?
Reply To (Anonymous)
Reply To cazfi
Reply To cazfi
when you set up the documentation comment to all rulesets
Ping. Can you make such an final patch with all the contents needed for this ticket?
I will try in nearest day.
That was my comment. I thought I have had more free time on my holidays. I will try to repair this issue in nearest time.
Reply To cazfi
Reply To cazfi
when you set up the documentation comment to all rulesets
Ping. Can you make such an final patch with all the contents needed for this ticket?
I try to prepare final patch by copy civ2civ3 ruleset, copy some added content to comments-3.2.txt into result of previous operation and call this script with path to newly created ruleset. It complains that I should manually repair comments-3.2.txt
I fall in providing way to apply counters-related-comments to each rulesets automatically, sorry. Apply:
Reply To lachu
Reply To cazfi
Reply To cazfi
when you set up the documentation comment to all rulesets
Ping. Can you make such an final patch with all the contents needed for this ticket?
I fall. Apply last patch, which do this for each game.ruleset files, not providing way to automatically upadate these files.
Can you provide a single patch with all the content of this ticket? This last patch lacks the code changes to rulesave part, and the comments-3.2.txt update.
Reply To cazfi
Reply To lachu
Reply To cazfi
Reply To cazfi
when you set up the documentation comment to all rulesets
Ping. Can you make such an final patch with all the contents needed for this ticket?
I fall. Apply last patch, which do this for each game.ruleset files, not providing way to automatically upadate these files.
Can you provide a single patch with all the content of this ticket? This last patch lacks the code changes to rulesave part, and the comments-3.2.txt update.
It should be previously ;-). but you can apply it now, I think.
Encountered a couple of problems:
- The patch does not apply, for the civ2civ3 part. Apparently you've created this in a tree where you have a (test) counter that does not exist in master
- xgettext gives "warning: unterminated character constant" about the changed game.rulesets, because of the ' in ";checkpoint = Trigger value of the counter. When counter's". Our usual solution to these has been to use ` instead -> "counter`s". Sorry for not realizing that before
- There's no need for adding [counters] -section. There's no entries in it (every counter is a section of its own). Even if we did, the documentation would go above it.
- ruledit gives: "3: Can't parse the comments file" - you would need at least to escape every " in it as \"
Reply To cazfi
Encountered a couple of problems: - The patch does not apply, for the civ2civ3 part. Apparently you've created this in a tree where you have a (test) counter that does not exist in master
- xgettext gives "warning: unterminated character constant" about the changed game.rulesets, because of the ' in ";checkpoint = Trigger value of the counter. When counter's". Our usual solution to these has been to use ` instead -> "counter`s". Sorry for not realizing that before
- There's no need for adding [counters] -section. There's no entries in it (every counter is a section of its own). Even if we did, the documentation would go above it.
- ruledit gives: "3: Can't parse the comments file" - you would need at least to escape every " in it as \"
I repair some problems, but I still got: *** fix up ruledit manually: data/ruledit/comments-3.2.txt
Reply To lachu
I repair some problems, but I still got: *** fix up ruledit manually: data/ruledit/comments-3.2.txt
Apparently one can't get more detailed logs out from ruledit -> #45467
I'll try to make that patch tonight. Maybe you can apply it locally to help you debug the problem with your patch.
I've got:.
/scripts/spec_propagate.sh ./data/special-to-apply/ *** don't know how to propagate ./data/special-to-apply/ *** usage: ./scripts/spec_propagate.sh data/changed-ruleset-dir
I've got:
Reply To lachu
I've got: ./scripts/spec_propagate.sh ./data/special-to-apply/ *** don't know how to propagate ./data/special-to-apply/ *** usage: ./scripts/spec_propagate.sh data/changed-ruleset-dir
If I place changes into data/civ2civ3/game.ruleset and type ./scripts/spec_propagate.sh ./data/civ2civ3 I've got the same.
Reply To lachu
Reply To lachu
I've got: ./scripts/spec_propagate.sh ./data/special-to-apply/ *** don't know how to propagate ./data/special-to-apply/
If I place changes into data/civ2civ3/game.ruleset and type ./scripts/spec_propagate.sh ./data/civ2civ3 I've got the same.
Like I said, that's not unexpected: "(but it's quite likely that the lack of common context causes that script to fail with some rulesets)"
Means the script can't help you, but you have to copy those comments to each ruleset manually.
Reply To cazfi
Encountered a couple of problems: - The patch does not apply, for the civ2civ3 part. Apparently you've created this in a tree where you have a (test) counter that does not exist in master
For some reason this still does not apply. It also seems that you've moved these to the very end of game.ruleset (after settings) from the location after clauses agreed earlier, and where the ruledit/ruleup saves them.
- xgettext gives "warning: unterminated character constant" about the changed game.rulesets, because of the ' in ";checkpoint = Trigger value of the counter. When counter's". Our usual solution to these has been to use ` instead -> "counter`s". Sorry for not realizing that before
That's still an issue.
- There's no need for adding [counters] -section. There's no entries in it (every counter is a section of its own). Even if we did, the documentation would go above it.
Rulesave still adds that. You should not be writing an entry comment but a section one, about a ruleset object type:
- Most importantly: use comment_write() instead of comment_entry_write() in comment_counters()
- Move comment_counters() among the other section comment writing functions (e.g. after the comment_clauses() )
- In comments-3.2.txt move entrydoc.counters to typedoc.counters (again: likely after typedoc.clauses)
- Likewise read the comment from typedoc.counters instead of entrydoc.counters
- Move "counters" in comments_storage among the section ones (again: after "clauses" is a good spot)
- ruledit gives: "3: Can't parse the comments file" - you would need at least to escape every " in it as \"
This escaping seems to work ok now.
Reply To cazfi
Reply To cazfi
Encountered a couple of problems: - The patch does not apply, for the civ2civ3 part. Apparently you've created this in a tree where you have a (test) counter that does not exist in master
For some reason this still does not apply. It also seems that you've moved these to the very end of game.ruleset (after settings) from the location after clauses agreed earlier, and where the ruledit/ruleup saves them.
- xgettext gives "warning: unterminated character constant" about the changed game.rulesets, because of the ' in ";checkpoint = Trigger value of the counter. When counter's". Our usual solution to these has been to use ` instead -> "counter`s". Sorry for not realizing that before
That's still an issue.
- There's no need for adding [counters] -section. There's no entries in it (every counter is a section of its own). Even if we did, the documentation would go above it.
Rulesave still adds that. You should not be writing an entry comment but a section one, about a ruleset object type:
- Most importantly: use comment_write() instead of comment_entry_write() in comment_counters()
- Move comment_counters() among the other section comment writing functions (e.g. after the comment_clauses() )
- In comments-3.2.txt move entrydoc.counters to typedoc.counters (again: likely after typedoc.clauses)
- Likewise read the comment from typedoc.counters instead of entrydoc.counters
- Move "counters" in comments_storage among the section ones (again: after "clauses" is a good spot)
- ruledit gives: "3: Can't parse the comments file" - you would need at least to escape every " in it as \"
This escaping seems to work ok now.
Still do not apply automatically. Maybe case is that I apply data manually. I will try to restore files and try ran script. You wrote there is no need to ensure script will apply changes, so I send patch.
Reply To cazfi
Reply To cazfi
Encountered a couple of problems: - The patch does not apply, for the civ2civ3 part. Apparently you've created this in a tree where you have a (test) counter that does not exist in master
For some reason this still does not apply. It also seems that you've moved these to the very end of game.ruleset (after settings) from the location after clauses agreed earlier, and where the ruledit/ruleup saves them.
- xgettext gives "warning: unterminated character constant" about the changed game.rulesets, because of the ' in ";checkpoint = Trigger value of the counter. When counter's". Our usual solution to these has been to use ` instead -> "counter`s". Sorry for not realizing that before
That's still an issue.
- There's no need for adding [counters] -section. There's no entries in it (every counter is a section of its own). Even if we did, the documentation would go above it.
Rulesave still adds that. You should not be writing an entry comment but a section one, about a ruleset object type:
- Most importantly: use comment_write() instead of comment_entry_write() in comment_counters()
- Move comment_counters() among the other section comment writing functions (e.g. after the comment_clauses() )
- In comments-3.2.txt move entrydoc.counters to typedoc.counters (again: likely after typedoc.clauses)
- Likewise read the comment from typedoc.counters instead of entrydoc.counters
- Move "counters" in comments_storage among the section ones (again: after "clauses" is a good spot)
- ruledit gives: "3: Can't parse the comments file" - you would need at least to escape every " in it as \"
This escaping seems to work ok now.
Sorry for quality of my previous patches. I figure out it even contains some junk data - fix code styling, probably I use --amend while rebasing on to of other person patch.
Apply:
0001-Add-clarify-what-counter-does-into-each-ruleset.patch(14KB)
Reply To cazfi
Reply To cazfi
Encountered a couple of problems: - The patch does not apply, for the civ2civ3 part. Apparently you've created this in a tree where you have a (test) counter that does not exist in master
For some reason this still does not apply. It also seems that you've moved these to the very end of game.ruleset (after settings) from the location after clauses agreed earlier, and where the ruledit/ruleup saves them.
- xgettext gives "warning: unterminated character constant" about the changed game.rulesets, because of the ' in ";checkpoint = Trigger value of the counter. When counter's". Our usual solution to these has been to use ` instead -> "counter`s". Sorry for not realizing that before
That's still an issue.
- There's no need for adding [counters] -section. There's no entries in it (every counter is a section of its own). Even if we did, the documentation would go above it.
Rulesave still adds that. You should not be writing an entry comment but a section one, about a ruleset object type:
- Most importantly: use comment_write() instead of comment_entry_write() in comment_counters()
- Move comment_counters() among the other section comment writing functions (e.g. after the comment_clauses() )
- In comments-3.2.txt move entrydoc.counters to typedoc.counters (again: likely after typedoc.clauses)
- Likewise read the comment from typedoc.counters instead of entrydoc.counters
- Move "counters" in comments_storage among the section ones (again: after "clauses" is a good spot)
- ruledit gives: "3: Can't parse the comments file" - you would need at least to escape every " in it as \"
This escaping seems to work ok now.
Hi.Have you still any remarks to my works?
One patch, please.
sandbox ruleset part does not apply. It tries to move some counter definitions that do not exist.
Problem was I introduce counters (inside sandbox) by:
Author: Sławomir Lach <slawek@lach.art.pl> Date: Mon Aug 1 12:19:19 2022 +0200
I thought you merge it. I will prepare proper patch.
Reply To cazfi
One patch, please. sandbox ruleset part does not apply. It tries to move some counter definitions that do not exist.
Done.
I'm yet to test the patch, but the rulesave.c change seems like you are now writing the counters documentation between clauses documentation and actual clauses, and not just before actual counters:
/* Clauses */
comment_clauses(sfile);
+ /* Counters */
+ comment_counters(sfile);
+
sect_idx = 0;
for (i = 0; i < CLAUSE_COUNT; i++) {
Reply To cazfi
I'm yet to test the patch, but the rulesave.c change seems like you are now writing the counters documentation between clauses documentation and actual clauses, and not just before actual counters: /* Clauses */
comment_clauses(sfile);
+ /* Counters */
+ comment_counters(sfile);
+
sect_idx = 0;
for (i = 0; i < CLAUSE_COUNT; i++) {
Still need to apply changes to each ruleset without using special script for this purpose.
Split from #44345.
Add the ruleset comments about counters sections. Remember also data/ruledit/comments-3.2.txt, and code changes to tools/ruleutil/comments.ch + call it from tools/ruleutil/rulesave.c