Welcome to the Builder Academy

Question Does the typo, idea, bug commands work?

More
05 Sep 2020 00:27 #9473 by cry1004
Thanks for the reply.

I compiled and tested the original and localized version as you told me.

The original worked fine.

The Korean version causes an error during debugging.

Attachment 13.jpg not found



Thanks for your many answers.

There seems to be something wrong with the Hangul input code learned on the Internet.

Please Log in or Create an account to join the conversation.

More
05 Sep 2020 15:47 #9495 by cry1004
Typing typo submit <header>
Stop at vwrite_to_output in comm.c file.

This is not the original one
Stops at the version I'm localizing.

Does bufspace read the typo contents and check the size?
The file size is 0.

I don't know why it overflows.


Attachment 14.jpg not found

Please Log in or Create an account to join the conversation.

More
08 Sep 2020 20:39 #9659 by thomas
Getting a NULL descriptor here is not possible in the original code, as far as I know. Can you show your call stack?

Please Log in or Create an account to join the conversation.

More
09 Sep 2020 16:20 #9695 by cry1004

Attachment 202.jpg not found

Please Log in or Create an account to join the conversation.

More
09 Sep 2020 22:28 #9702 by thomas
I'm sorry, but that screenshot is too small for me to read. Just the part on the right, please.

Please Log in or Create an account to join the conversation.

More
10 Sep 2020 00:53 - 11 Sep 2020 00:21 #9708 by cry1004
I finally found where the error occurs.

The error occurred in the command_interpreter function in the interpreter.c file.

I modified the last of the command_interpreter function to look like this:
When the error is corrected, it must be reverted to the original.
Code:
send_to_char(ch, "Commands Error!\r\n"); // ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd));

Then, I modified it to show what arg and line return.
Code:
line = any_one_arg(argument, arg);
Add the following to the next line.
This was used to find the cause of the error. To see how the arguments I entered work.
Code:
send_to_char(ch, "arg: %s line: %s\r\n", arg, line);

If I type
Code:
aa dd ddd typo

You will get the following results.
Code:
500H 100M 82V (news) (motd) > arg: aa line: dd ddd typo

In the case of Hangul, it is natural to change the order of commands.
The current English version of typo usage is as follows.
Code:
typo submit <header>
In the case of <header>, a string containing spaces can be used.

However, in the case of Hangul, it is natural to change the order of commands as follows.
Code:
submit <header> typo
Basic instruction comes last, auxiliary instruction comes first.

Also, since Hangul uses double-byte characters, it is not possible to determine if it is Hangul using isalpha().

So add the following at the end of the utils.h file.
Code:
#define ishan(ch) (((ch) & 0xE0) > 0x90) #define ishanasc(ch) (isascii(ch) || ishan(ch)) #define ishanalp(ch) (isalpha(ch) || ishan(ch)) #define isnhdigit(ch) (!ishan(ch) && isdigit(ch)) #define isnhspace(ch) (!ishan(ch) && isspace(ch))
Code:
static int _parse_name(char *arg, char *name) { int i; skip_spaces(&arg); for (i = 0; (*name = *arg); arg++, i++, name++) if (!isalpha(*arg)) return (1); if (!i) return (1); return (0); }

Change the code above as below.
Hangul is not read 1byte at a time like the English alphabet, and only 2bytes are read to complete Hangul characters.
Code:
static int _parse_name(char *arg, char *name) { int i; //skip_spaces(&arg); for (; isnhspace(*arg); arg++); for (i = 0; (*name = *arg); arg++, i++, name++) //if (!isalpha(*arg)) if (!ishanalp(*arg)) return (1); if (!i) return (1); return (0); }


Also, the void skip_spaces(char **string) function must be modified as follows to use Korean.
Code:
// for (; **string && **string != '\t' && isspace(**string); (*string)++); for (; **string && isnhspace(**string); (*string)++);

Finally, you need to change the order of commands in command_interpreter.
I don't know if this is the right way.
This is how I found it out by searching the Internet.
Code:
void command_interpreter(struct char_data *ch, char *argument) { int cmd, length; char *line; char arg[MAX_INPUT_LENGTH]; // Change commands to Hangul word order char hanparse[MAX_INPUT_LENGTH]; char hancommand[MAX_INPUT_LENGTH]; REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); /* just drop to next line for hitting CR */ skip_spaces(&argument); if (!*argument) return; // Change commands to Korean word order sprintf(hanparse, "%s", argument); if(strrchr(hanparse, ' ')) { sprintf(hancommand, "%s ", strrchr(hanparse, ' ')); hanparse[strlen(hanparse) - (strlen(hancommand) - 1)] = '\0'; strcat(hancommand, hanparse); argument = hancommand; } else argument = hanparse; skip_spaces(&argument); /* special case to handle one-character, non-alphanumeric commands; requested * by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric * Green and Stefan Wasilewski. */ // Change not to skip Hangul if (!ishanalp(*argument)) { // if (!isalpha(*argument)) { arg[0] = argument[0]; arg[1] = '\0'; line = argument + 1; } else line = any_one_arg(argument, arg);
It is true that errors occur in this function, but I need to correct it because of my weak program skills.
The commands entered are not English, and similar Korean commands should be printed even if they are Korean.

Of course, most commands have been changed to Korean.

We've figured out why and where the error occurred, but the error still persists.
Last edit: 11 Sep 2020 00:21 by cry1004.

Please Log in or Create an account to join the conversation.

Time to create page: 0.221 seconds