2025-07-21 10:16 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003500Spring engineAIpublic2013-02-25 00:27
Reportercranphin 
Assigned Toabma 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version92.0.1+git 
Target VersionFixed in Version 
Summary0003500: jni_wrappCommands.awk should be fixed and re-enabled.
DescriptionCurrently jni_wrappCommands.awk isn't run, but it would be handy for Java AI's :)
I'm on about the file added here:
https://github.com/spring/spring/commit/d452822e36ac1712eba9d5957706c767fcc17868

Later it was disabled, because of mawk lacking length(), see:
https://github.com/spring/spring/commit/0529ae3d23a601d26caf08e05148ef70b1195e15

Fixing this file is easy, I did a quick (working) hack, which I'll attach as diff and full file. with the file fixed, the second commit can be undone, re-enabling this file.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • ? file icon jni_wrappCommands.awk (5,440 bytes) 2013-02-23 22:52
  • patch file icon jni_wrappCommands.awk.patch (2,584 bytes) 2013-02-23 22:55 -
    --- jni_wrappCommands.old.awk	Sat Feb 23 22:53:04 2013
    +++ jni_wrappCommands.awk	Sat Feb 23 22:41:25 2013
    @@ -42,9 +42,13 @@
         myClass = "Enumerations";
     
         #create empty arrays, holding names and values of the two enumerations
    +	cmdsTopicNamesLength = 0;
         split("", cmdsTopicNames);
    +	cmdsTopicValuesLength = 0;
         split("", cmdsTopicValues);
    +	unitCmdsTopicNamesLength = 0;
         split("", unitCmdsTopicNames);
    +	unitCmdsTopicValuesLength = 0;
         split("", unitCmdsTopicValues);
     }
     
    @@ -79,18 +83,18 @@
     }
     
     function printJavaEnums(enums) {
    -    printJavaEnum("CommandTopic", cmdsTopicNames, cmdsTopicValues);
    +    printJavaEnum("CommandTopic", cmdsTopicNames, cmdsTopicNamesLength, cmdsTopicValues);
         print("") >> outFile_i;
    -    printJavaEnum("UnitCommandOptions", unitCmdsTopicNames, unitCmdsTopicValues);
    +    printJavaEnum("UnitCommandOptions", unitCmdsTopicNames, unitCmdsTopicNamesLength, unitCmdsTopicValues);
     }
     
    -function printJavaEnum(enumName, names, values) {
    +function printJavaEnum(enumName, names, namesLength, values) {
     	outFile_i = createJavaFileName(myClass);
         printEnumHeader(enumName);
     
         # Prints the enum members and values
         first = 0;
    -	for (i=0; i<length(names);i++) {
    +	for (i=0; i<namesLength;i++) {
             if (first == 0) {
                 first = 1;
                 printf("\t\t") >> outFile_i;
    @@ -143,8 +147,10 @@
     	if (doWrapp) {
             #parse enumeration of format x = number1,
     		sub(",", "", $4);
    -		cmdsTopicNames[length(cmdsTopicNames)] = $2;
    -		cmdsTopicValues[length(cmdsTopicValues)] = $4;
    +		cmdsTopicNames[cmdsTopicNamesLength] = $2;
    +		cmdsTopicNamesLength++;
    +		cmdsTopicValues[cmdsTopicValuesLength] = $4;
    +		cmdsTopicValuesLength++;
     	} else {
     		print("Java-AIInterface: NOTE: JNI level: COMMANDS: intentionally not wrapped: " $2);
     	}
    @@ -153,14 +159,16 @@
     /^[ \t]*UNIT_COMMAND_.*$/ {
     	doWrapp = !match(($0), /.*COMMAND_NULL.*/);
     	if (doWrapp) {
    -		unitCmdsTopicNames[length(unitCmdsTopicNames)] = $2;
    +		unitCmdsTopicNames[unitCmdsTopicNamesLength] = $2;
    +		unitCmdsTopicNamesLength++;
             #parse enumeration of format x = (number1 << number2),
             sub("[ \t]*//.*", "", $0);
     		sub(",", "", $0);
     		sub($3, "", $0);
     		sub($2, "", $0);
     		sub("[ \t]*", "", $0);
    -		unitCmdsTopicValues[length(unitCmdsTopicValues)] = $0;
    +		unitCmdsTopicValues[unitCmdsTopicValuesLength] = $0;
    +		unitCmdsTopicValuesLength++;
     	} else {
     		print("Java-AIInterface: NOTE: JNI level: UNIT_COMMANDS: intentionally not wrapped: " $2);
     	}
    
    patch file icon jni_wrappCommands.awk.patch (2,584 bytes) 2013-02-23 22:55 +

-Relationships
related to 0003501new Make Command.h available in Java AI's, 
+Relationships

-Notes

~0009915

abma (administrator)

thanks!

if you make a pull request next time on github, you'll take the kudos :)
+Notes

-Issue History
Date Modified Username Field Change
2013-02-23 22:52 cranphin New Issue
2013-02-23 22:52 cranphin File Added: jni_wrappCommands.awk
2013-02-23 22:55 cranphin File Added: jni_wrappCommands.awk.patch
2013-02-25 00:22 abma Changeset attached => spring release bf32e5a6
2013-02-25 00:22 abma Assigned To => abma
2013-02-25 00:22 abma Status new => resolved
2013-02-25 00:22 abma Resolution open => fixed
2013-02-25 00:23 abma Relationship added related to 0003501
2013-02-25 00:27 abma Note Added: 0009915
+Issue History