Ticket #45028

Document counters ruleset format

Eröffnet am: 2022-07-06 08:48 Letztes Update: 2022-10-07 21:27

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
14

Details

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

Ticket-Verlauf (3/51 Historien)

2022-07-06 08:48 Aktualisiert von: cazfi
  • New Ticket "Document counters ruleset format" created
2022-07-13 22:29 Aktualisiert von: lachu
Kommentar

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

File 0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 9785) is attached

2022-07-13 22:29 Updated by: lachu

File 0002-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 9786) is attached
2022-07-20 18:13 Aktualisiert von: cazfi
Kommentar

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.

2022-07-28 08:23 Aktualisiert von: cazfi
Kommentar

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:16 Aktualisiert von: lachu
Kommentar

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

File 0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 9959) is attached

2022-07-28 22:14 Updated by: lachu

File 0002-Clarify-about-counters-in-classic-ruleset.patch (File ID: 9960) is attached

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).

2022-07-29 08:37 Aktualisiert von: cazfi
Kommentar

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)

2022-08-06 14:18 Aktualisiert von: cazfi
Kommentar

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?

2022-08-07 00:26 Aktualisiert von: None
Kommentar

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.

2022-08-09 04:08 Aktualisiert von: lachu
  • File 0001-OSDN-41122-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10044) is attached
2022-08-09 04:08 Aktualisiert von: lachu
  • File 0001-OSDN-41122-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10044) is deleted
2022-08-09 04:10 Aktualisiert von: lachu
Kommentar

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.

2022-08-11 00:29 Aktualisiert von: lachu
Kommentar

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

2022-08-17 00:47 Aktualisiert von: lachu
Kommentar

I fall in providing way to apply counters-related-comments to each rulesets automatically, sorry. Apply:

0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch(12KB)
Hand-made changes in game.ruleset
2022-08-17 00:48 Aktualisiert von: lachu
Kommentar

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.

2022-08-21 14:17 Aktualisiert von: cazfi
Kommentar

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.

2022-08-24 22:47 Aktualisiert von: lachu
Kommentar

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.

0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch(15KB)
Assembly prebiously created patches

It should be previously ;-). but you can apply it now, I think.

2022-08-25 11:42 Aktualisiert von: cazfi
Kommentar

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 \"

(Edited, 2022-08-25 11:43 Aktualisiert von: cazfi)
2022-08-27 02:11 Aktualisiert von: lachu
Kommentar

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 \"

0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch(16KB)
I still get *** fix up ruledit manually: data/ruledit/comments-3.2.txt

I repair some problems, but I still got: *** fix up ruledit manually: data/ruledit/comments-3.2.txt

2022-08-27 03:28 Aktualisiert von: cazfi
Kommentar

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.

2022-09-02 02:48 Aktualisiert von: cazfi
Kommentar

Reply To cazfi

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.

That is now even in the repository.

2022-09-03 22:35 Aktualisiert von: None
Kommentar

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

2022-09-03 22:36 Aktualisiert von: lachu
Kommentar

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
2022-09-03 22:37 Aktualisiert von: lachu
Kommentar

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.

2022-09-06 01:04 Aktualisiert von: cazfi
Kommentar

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.

2022-09-08 02:04 Aktualisiert von: cazfi
Kommentar

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.

2022-09-11 21:48 Aktualisiert von: lachu
Kommentar

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.

0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch(11KB)
Still do not apply automatically

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.

2022-09-13 23:09 Aktualisiert von: lachu
Kommentar

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-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch(4KB)
Split patch, remove junks

0001-Add-clarify-what-counter-does-into-each-ruleset.patch(14KB)

Data patch, if it not apply automatically
(Edited, 2022-09-13 23:10 Aktualisiert von: lachu)
2022-09-28 22:34 Aktualisiert von: lachu
Kommentar

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?

2022-09-30 10:00 Aktualisiert von: cazfi
Kommentar

One patch, please.

sandbox ruleset part does not apply. It tries to move some counter definitions that do not exist.

2022-10-02 19:47 Aktualisiert von: lachu
Kommentar

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

!OSDN 45072: Sławomir Lach <slawek@lach.art.pl> Ruleset author can look inside sandbox to figure out how to use counters.

I thought you merge it. I will prepare proper patch.

2022-10-02 20:08 Aktualisiert von: lachu
  • File 0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10446) is attached
2022-10-02 20:08 Aktualisiert von: lachu
  • File 0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10446) is deleted
2022-10-02 20:10 Aktualisiert von: lachu
Kommentar

Reply To cazfi

One patch, please. sandbox ruleset part does not apply. It tries to move some counter definitions that do not exist.

Done.

2022-10-05 13:31 Aktualisiert von: cazfi
Kommentar

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++) {

2022-10-06 01:05 Aktualisiert von: lachu
Kommentar

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++) {

0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch(16KB)
Move invocation of routine adding counters' comment

Still need to apply changes to each ruleset without using special script for this purpose.

2022-10-06 08:05 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
Kommentar
2022-10-07 21:27 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt

Dateianhangliste

Bearbeiten

Please login to add comment to this ticket » Anmelden