Ticket #45028

Document counters ruleset format

오픈 날짜: 2022-07-06 08:48 마지막 업데이트: 2022-10-07 21:27

Reporter:
소유자:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
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 History (3/51 Histories)

2022-07-06 08:48 Updated by: cazfi
  • New Ticket "Document counters ruleset format" created
2022-07-13 22:29 Updated by: lachu
댓글 올리기

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 Updated by: cazfi
댓글 올리기

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 Updated by: 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:16 Updated by: lachu
댓글 올리기

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 Updated by: cazfi
댓글 올리기

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 Updated by: 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?

2022-08-07 00:26 Updated by: None
댓글 올리기

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 Updated by: lachu
  • File 0001-OSDN-41122-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10044) is attached
2022-08-09 04:08 Updated by: lachu
  • File 0001-OSDN-41122-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10044) is deleted
2022-08-09 04:10 Updated by: lachu
댓글 올리기

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 Updated by: 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 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 Updated by: lachu
댓글 올리기

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 Updated by: 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.

2022-08-21 14:17 Updated by: 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.

2022-08-24 22:47 Updated by: lachu
댓글 올리기

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 Updated by: 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 \"

(Edited, 2022-08-25 11:43 Updated by: cazfi)
2022-08-27 02:11 Updated by: lachu
댓글 올리기

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 Updated by: cazfi
댓글 올리기

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 Updated by: cazfi
댓글 올리기

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 Updated by: None
댓글 올리기

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 Updated by: 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
2022-09-03 22:37 Updated by: 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/ *** 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 Updated by: cazfi
댓글 올리기

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 Updated by: 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.

2022-09-11 21:48 Updated by: lachu
댓글 올리기

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 Updated by: lachu
댓글 올리기

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 Updated by: lachu)
2022-09-28 22:34 Updated by: lachu
댓글 올리기

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 Updated by: cazfi
댓글 올리기

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 Updated by: lachu
댓글 올리기

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 Updated by: lachu
  • File 0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10446) is attached
2022-10-02 20:08 Updated by: lachu
  • File 0001-OSDN-45028-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 10446) is deleted
2022-10-02 20:10 Updated by: lachu
댓글 올리기

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 Updated by: 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++) {

2022-10-06 01:05 Updated by: lachu
댓글 올리기

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 Updated by: cazfi
  • 소유자 Update from (None) to cazfi
  • Resolution Update from None to Accepted
댓글 올리기
2022-10-07 21:27 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Attachment File List

Edit

Please login to add comment to this ticket » Login