2015-02-03 22:56:09 +01:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2015-01-27 21:13:27 +01:00
|
|
|
|
#include "console.h"
|
2015-01-31 22:33:34 +01:00
|
|
|
|
#include "syscalls.h"
|
2015-02-03 22:56:09 +01:00
|
|
|
|
#include "memory.h"
|
2015-01-27 21:13:27 +01:00
|
|
|
|
|
|
|
|
|
static struct line Line[LINE_MAX];
|
2015-02-03 22:56:09 +01:00
|
|
|
|
static struct FMenu FMenu_entries[6];
|
2015-01-27 21:13:27 +01:00
|
|
|
|
static struct location Cursor;
|
|
|
|
|
static unsigned char *Edit_Line;
|
|
|
|
|
static int Start_Line, Last_Line;
|
|
|
|
|
static int Case;
|
|
|
|
|
|
|
|
|
|
#define Current_Line (Start_Line + Cursor.y)
|
|
|
|
|
#define Current_Col (Line[Cursor.y + Start_Line].start_col + Cursor.x)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD>n<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ռ2<EFBFBD>ֽڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>磬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>str<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
λ<EFBFBD><EFBFBD> | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|
|
|
|
|
<EFBFBD>ַ<EFBFBD> |'a'|'b'|'c'|'d'|'e'|'f'| 0 |
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Console_DelStr(str, 3, 2)<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|
|
|
|
|
|
|
|
|
λ<EFBFBD><EFBFBD> | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|
|
|
|
|
<EFBFBD>ַ<EFBFBD> |'a'|'d'|'e'|'f'| 0 |'f'| 0 |
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD>ע<EFBFBD>⣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᱻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ'\0'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ĩβ<EFBFBD><EFBFBD>'\0'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_DelStr(unsigned char *str, int end_pos, int n)
|
|
|
|
|
{
|
|
|
|
|
int str_len, actual_end_pos, start_pos, actual_start_pos, del_len, i;
|
|
|
|
|
|
|
|
|
|
str_len = strlen((const char *)str);
|
|
|
|
|
if ((start_pos = end_pos - n) < 0) return CONSOLE_ARG_ERR;
|
|
|
|
|
|
|
|
|
|
if ((actual_end_pos = Console_GetActualPos(str, end_pos)) == CONSOLE_ARG_ERR) return CONSOLE_ARG_ERR;
|
|
|
|
|
if ((actual_start_pos = Console_GetActualPos(str, start_pos)) == CONSOLE_ARG_ERR) return CONSOLE_ARG_ERR;
|
|
|
|
|
|
|
|
|
|
del_len = actual_end_pos - actual_start_pos;
|
|
|
|
|
|
|
|
|
|
for (i = actual_start_pos; i < str_len; i++)
|
|
|
|
|
{
|
|
|
|
|
str[i] = str[i + del_len];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD>ע<EFBFBD>⣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD>ӡʱ<EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʵ<EFBFBD>λ<EFBFBD>á<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_InsStr(unsigned char *dest, const unsigned char *src, int disp_pos)
|
|
|
|
|
{
|
|
|
|
|
int i, ins_len, str_len, actual_pos;
|
|
|
|
|
|
|
|
|
|
ins_len = strlen((const char *)src);
|
|
|
|
|
str_len = strlen((const char *)dest);
|
|
|
|
|
|
|
|
|
|
actual_pos = Console_GetActualPos(dest, disp_pos);
|
|
|
|
|
|
|
|
|
|
if (ins_len + str_len >= EDIT_LINE_MAX) return CONSOLE_MEM_ERR;
|
|
|
|
|
if (actual_pos > str_len) return CONSOLE_ARG_ERR;
|
|
|
|
|
|
|
|
|
|
for (i = str_len; i >= actual_pos; i--)
|
|
|
|
|
{
|
|
|
|
|
dest[i + ins_len] = dest[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < ins_len; i++)
|
|
|
|
|
{
|
|
|
|
|
dest[actual_pos + i] = src[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡλ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>ʵλ<EFBFBD>á<EFBFBD>
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>磬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>str<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>ӡʱ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|
|
|
|
|
|
|
|
|
λ<EFBFBD><EFBFBD> | 00 | 01 | 02 | 03 | 04 | 05 | 06 |
|
|
|
|
|
<EFBFBD>ַ<EFBFBD> | һ | <EFBFBD><EFBFBD> | <EFBFBD><EFBFBD> | <EFBFBD><EFBFBD> | <EFBFBD><EFBFBD> | <EFBFBD><EFBFBD> | \0 |
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʴ洢ʱ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|
|
|
|
|
|
|
|
|
λ<EFBFBD><EFBFBD> | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 |
|
|
|
|
|
ֵ | 0xD2 | 0xBB | 0xB6 | 0xFE | 0xC8 | 0xFD | 0xCB | 0xC4 | 0xCE | 0xE5 | 0xC1 | 0xF9 |
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>塯ʵ<EFBFBD><EFBFBD><EFBFBD>ϴ洢<EFBFBD>ڵ<EFBFBD>8<EFBFBD><EFBFBD>λ<EFBFBD>á<EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Console_GetActualPos(str, 4)ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_GetActualPos(const unsigned char *str, int disp_pos)
|
|
|
|
|
{
|
|
|
|
|
int actual_pos, count;
|
|
|
|
|
|
|
|
|
|
for (actual_pos = count = 0; count < disp_pos; count++)
|
|
|
|
|
{
|
|
|
|
|
if (str[actual_pos] == '\0') return CONSOLE_ARG_ERR;
|
|
|
|
|
|
|
|
|
|
if (is_wchar(str[actual_pos]))
|
|
|
|
|
{
|
|
|
|
|
actual_pos += 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
actual_pos++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return actual_pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>ӡ<EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>2<EFBFBD>ֽڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_GetDispLen(const unsigned char *str)
|
|
|
|
|
{
|
|
|
|
|
int i, len;
|
|
|
|
|
|
|
|
|
|
for (i = len = 0; str[i]!='\0'; len++)
|
|
|
|
|
{
|
|
|
|
|
if (is_wchar(str[i]))
|
|
|
|
|
{
|
|
|
|
|
i += 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꡣ
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_MoveCursor(int direction)
|
|
|
|
|
{
|
|
|
|
|
switch (direction)
|
|
|
|
|
{
|
|
|
|
|
case CURSOR_UP:
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if ((Cursor.y > 0) || (Start_Line > 0))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>в<EFBFBD><D0B2><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Edit_Line<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>С<EFBFBD>
|
|
|
|
|
if (!Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
if ((Line[Current_Line].str = (unsigned char *)malloc(strlen((const char *)Edit_Line) + 1)) == NULL) return CONSOLE_MEM_ERR;
|
|
|
|
|
strcpy((char *)Line[Current_Line].str, (const char *)Edit_Line);
|
|
|
|
|
Line[Current_Line].disp_len = Console_GetDispLen(Line[Current_Line].str);
|
|
|
|
|
Line[Current_Line].type = LINE_TYPE_INPUT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>Ϸ<EFBFBD>,<2C><>ֱ<EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
|
|
|
|
|
if (Cursor.y > 0)
|
|
|
|
|
{
|
|
|
|
|
Cursor.y--;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2>ǵ<EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>ʼ<EFBFBD><CABC>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
else if (Start_Line > 0)
|
|
|
|
|
{
|
|
|
|
|
Start_Line--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮƽλ<C6BD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ĩ<EFBFBD><C4A9><EFBFBD><EFBFBD><F2BDABB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĩ<EFBFBD><C4A9>
|
|
|
|
|
if (Cursor.x > Line[Current_Line].disp_len)
|
|
|
|
|
{
|
|
|
|
|
Cursor.x = Line[Current_Line].disp_len;
|
|
|
|
|
}
|
|
|
|
|
else if (Line[Current_Line].disp_len - Line[Current_Line].start_col > COL_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
if (Cursor.x == COL_DISP_MAX) Cursor.x = COL_DISP_MAX - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ף<EFBFBD><D7A3>Ҹ<EFBFBD><D2B8><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>δ<EFBFBD><CEB4>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><F2BDABB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>1<EFBFBD><31>
|
|
|
|
|
if (Cursor.x == 0 && Line[Current_Line].start_col > 0) Cursor.x = 1;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Edit_Line<6E>Թ<EFBFBD><D4B9>༭<EFBFBD><E0BCAD>
|
|
|
|
|
if (!Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
strcpy((char *)Edit_Line, (const char *)Line[Current_Line].str);
|
|
|
|
|
free(Line[Current_Line].str);
|
|
|
|
|
Line[Current_Line].str = Edit_Line;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CURSOR_DOWN:
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if ((Cursor.y < LINE_DISP_MAX - 1) && (Current_Line < Last_Line) || (Start_Line + LINE_DISP_MAX - 1 < Last_Line))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>в<EFBFBD><D0B2><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Edit_Line<6E><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>С<EFBFBD>
|
|
|
|
|
if (!Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
if ((Line[Current_Line].str = (unsigned char *)malloc(strlen((const char *)Edit_Line) + 1)) == NULL) return CONSOLE_MEM_ERR;
|
|
|
|
|
strcpy((char *)Line[Current_Line].str, (const char *)Edit_Line);
|
|
|
|
|
Line[Current_Line].disp_len = Console_GetDispLen(Line[Current_Line].str);
|
|
|
|
|
Line[Current_Line].type = LINE_TYPE_INPUT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>·<EFBFBD>,<2C><>ֱ<EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
|
|
|
|
|
if (Cursor.y < LINE_DISP_MAX - 1 && Current_Line < Last_Line)
|
|
|
|
|
{
|
|
|
|
|
Cursor.y++;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>ĩ<EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>ʼ<EFBFBD><CABC>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
else if (Start_Line + LINE_DISP_MAX - 1 < Last_Line)
|
|
|
|
|
{
|
|
|
|
|
Start_Line++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮƽλ<C6BD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ĩ<EFBFBD><C4A9><EFBFBD><EFBFBD><F2BDABB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĩ<EFBFBD><C4A9>
|
|
|
|
|
if (Cursor.x > Line[Current_Line].disp_len)
|
|
|
|
|
{
|
|
|
|
|
Cursor.x = Line[Current_Line].disp_len;
|
|
|
|
|
}
|
|
|
|
|
else if (Line[Current_Line].disp_len - Line[Current_Line].start_col >= COL_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
if (Cursor.x == COL_DISP_MAX) Cursor.x = COL_DISP_MAX - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ף<EFBFBD><D7A3>Ҹ<EFBFBD><D2B8><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>δ<EFBFBD><CEB4>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><F2BDABB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>1<EFBFBD><31>
|
|
|
|
|
if (Cursor.x == 0 && Line[Current_Line].start_col > 0) Cursor.x = 1;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Edit_Line<6E>Թ<EFBFBD><D4B9>༭<EFBFBD><E0BCAD>
|
|
|
|
|
if (!Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
strcpy((char *)Edit_Line, (const char *)Line[Current_Line].str);
|
|
|
|
|
free(Line[Current_Line].str);
|
|
|
|
|
Line[Current_Line].str = Edit_Line;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CURSOR_LEFT:
|
|
|
|
|
if (Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
if (Line[Current_Line].start_col > 0) Line[Current_Line].start_col--;
|
|
|
|
|
}
|
|
|
|
|
else if (Line[Current_Line].start_col > 0)
|
|
|
|
|
{
|
|
|
|
|
if (Cursor.x > 1)
|
|
|
|
|
{
|
|
|
|
|
Cursor.x--;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Line[Current_Line].start_col--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Cursor.x > 0) Cursor.x--;
|
|
|
|
|
break;
|
|
|
|
|
case CURSOR_RIGHT:
|
|
|
|
|
if (Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
if (Line[Current_Line].disp_len - Line[Current_Line].start_col > COL_DISP_MAX) Line[Current_Line].start_col++;
|
|
|
|
|
}
|
|
|
|
|
else if (Line[Current_Line].disp_len - Line[Current_Line].start_col > COL_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
if (Cursor.x < COL_DISP_MAX - 1)
|
|
|
|
|
{
|
|
|
|
|
Cursor.x++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Line[Current_Line].start_col++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (Cursor.x < Line[Current_Line].disp_len - Line[Current_Line].start_col) Cursor.x++;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return CONSOLE_ARG_ERR;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롣
|
|
|
|
|
<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵽<EFBFBD><EFBFBD><EFBFBD>괦<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꽫<EFBFBD>Զ<EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_Input(const unsigned char *str)
|
|
|
|
|
{
|
|
|
|
|
int old_len,i,return_val;
|
|
|
|
|
|
|
|
|
|
if (!Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
old_len = Line[Current_Line].disp_len;
|
|
|
|
|
return_val = Console_InsStr(Edit_Line, str, Current_Col);
|
|
|
|
|
if (return_val != CONSOLE_SUCCEEDED) return return_val;
|
|
|
|
|
if ((Line[Current_Line].disp_len = Console_GetDispLen(Edit_Line)) == CONSOLE_ARG_ERR) return CONSOLE_ARG_ERR;
|
|
|
|
|
for (i = 0; i < Line[Current_Line].disp_len - old_len; i++)
|
|
|
|
|
{
|
|
|
|
|
Console_MoveCursor(CURSOR_RIGHT);
|
|
|
|
|
}
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return CONSOLE_ARG_ERR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>С<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_Output(const unsigned char *str)
|
|
|
|
|
{
|
|
|
|
|
int return_val, old_len, i;
|
|
|
|
|
|
|
|
|
|
if (!Line[Current_Line].readonly)
|
|
|
|
|
{
|
|
|
|
|
old_len = Line[Current_Line].disp_len;
|
|
|
|
|
|
|
|
|
|
return_val = Console_InsStr(Edit_Line, str, Current_Col);
|
|
|
|
|
if (return_val != CONSOLE_SUCCEEDED) return return_val;
|
|
|
|
|
if ((Line[Current_Line].disp_len = Console_GetDispLen(Edit_Line)) == CONSOLE_ARG_ERR) return CONSOLE_ARG_ERR;
|
|
|
|
|
Line[Current_Line].type = LINE_TYPE_OUTPUT;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < Line[Current_Line].disp_len - old_len; i++)
|
|
|
|
|
{
|
|
|
|
|
Console_MoveCursor(CURSOR_RIGHT);
|
|
|
|
|
}
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return CONSOLE_ARG_ERR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>pre_line_type<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pre_line_readonly<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>new_line_type<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>new_line_readonly<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_NewLine(int pre_line_type, int pre_line_readonly)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (strlen((const char *)Edit_Line)||Line[Current_Line].type==LINE_TYPE_OUTPUT)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ洢<DCB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>һ<EFBFBD>С<EFBFBD>
|
|
|
|
|
if (Last_Line == LINE_MAX - 1)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < Last_Line; i++)
|
|
|
|
|
{
|
|
|
|
|
Line[i].disp_len = Line[i + 1].disp_len;
|
|
|
|
|
Line[i].readonly = Line[i + 1].readonly;
|
|
|
|
|
Line[i].start_col = Line[i + 1].start_col;
|
|
|
|
|
Line[i].str = Line[i + 1].str;
|
|
|
|
|
Line[i].type = Line[i + 1].type;
|
|
|
|
|
}
|
|
|
|
|
Last_Line--;
|
|
|
|
|
|
|
|
|
|
if (Start_Line > 0) Start_Line--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Line[Last_Line].type == LINE_TYPE_OUTPUT && strlen((const char *)Edit_Line) == 0) Console_Output((const unsigned char *)"Done");
|
|
|
|
|
|
|
|
|
|
//<2F><>Edit_Line<6E><65><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>С<EFBFBD>
|
|
|
|
|
if ((Line[Last_Line].str = (unsigned char *)malloc(strlen((const char *)Edit_Line) + 1)) == NULL) return CONSOLE_MEM_ERR;
|
|
|
|
|
strcpy((char *)Line[Last_Line].str, (const char *)Edit_Line);
|
|
|
|
|
if ((Line[Last_Line].disp_len = Console_GetDispLen(Line[Last_Line].str)) == CONSOLE_ARG_ERR) return CONSOLE_ARG_ERR;
|
|
|
|
|
Line[Last_Line].type = pre_line_type;
|
|
|
|
|
Line[Last_Line].readonly = pre_line_readonly;
|
|
|
|
|
Line[Last_Line].start_col = 0;
|
|
|
|
|
|
|
|
|
|
Edit_Line[0] = '\0';
|
|
|
|
|
|
|
|
|
|
Last_Line++;
|
|
|
|
|
|
|
|
|
|
Cursor.x = 0;
|
|
|
|
|
|
|
|
|
|
if ((Last_Line - Start_Line) == LINE_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
Start_Line++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Cursor.y++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Line[Last_Line].str = Edit_Line;
|
|
|
|
|
Line[Last_Line].readonly = 0;
|
|
|
|
|
Line[Last_Line].type = LINE_TYPE_INPUT;
|
|
|
|
|
Line[Last_Line].start_col = 0;
|
|
|
|
|
Line[Last_Line].disp_len = 0;
|
|
|
|
|
|
|
|
|
|
return CONSOLE_NEW_LINE_SET;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return CONSOLE_NO_EVENT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_Backspace()
|
|
|
|
|
{
|
|
|
|
|
int return_val;
|
|
|
|
|
|
|
|
|
|
return_val = Console_DelStr(Edit_Line, Current_Col, 1);
|
|
|
|
|
if (return_val != CONSOLE_SUCCEEDED) return return_val;
|
|
|
|
|
Line[Current_Line].disp_len = Console_GetDispLen(Edit_Line);
|
|
|
|
|
return Console_MoveCursor(CURSOR_LEFT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_GetKey()
|
|
|
|
|
{
|
|
|
|
|
unsigned int key, i, move_line, move_col;
|
|
|
|
|
unsigned char tmp_str[2];
|
|
|
|
|
unsigned char *tmp;
|
|
|
|
|
|
|
|
|
|
GetKey(&key);
|
|
|
|
|
|
|
|
|
|
if (key >= '0' && key <= '9')
|
|
|
|
|
{
|
|
|
|
|
tmp_str[0] = key;
|
|
|
|
|
tmp_str[1] = '\0';
|
|
|
|
|
return Console_Input(tmp_str);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 22:56:09 +01:00
|
|
|
|
if (key >= KEY_CTRL_F1 &&
|
|
|
|
|
key <= KEY_CTRL_F6) return Console_FMenu(key);
|
2015-01-27 21:13:27 +01:00
|
|
|
|
if (key == KEY_CHAR_IMGNRY) return Console_Input((const unsigned char *)"i");
|
|
|
|
|
if (key == KEY_CHAR_MAT) return Console_Input((const unsigned char *)"matrix");
|
|
|
|
|
if (key == KEY_CHAR_DP) return Console_Input((const unsigned char *)".");
|
|
|
|
|
if (key == KEY_CHAR_EQUAL) return Console_Input((const unsigned char *)"=");
|
|
|
|
|
if (key == KEY_CHAR_EXP) return Console_Input((const unsigned char *)"*10^(");
|
|
|
|
|
if (key == KEY_CHAR_DQUATE) return Console_Input((const unsigned char *)"\"");
|
|
|
|
|
if (key == KEY_CHAR_SPACE) return Console_Input((const unsigned char *)" ");
|
|
|
|
|
if (key == KEY_CHAR_PI) return Console_Input((const unsigned char *)"pi");
|
|
|
|
|
if (key == KEY_CHAR_PMINUS) return Console_Input((const unsigned char *)"-");
|
|
|
|
|
if (key == KEY_CHAR_MINUS) return Console_Input((const unsigned char *)"-");
|
|
|
|
|
if (key == KEY_CHAR_ANS) return Console_Input((const unsigned char *)"last");
|
|
|
|
|
if (key == KEY_CHAR_PLUS) return Console_Input((const unsigned char *)"+");
|
|
|
|
|
if (key == KEY_CHAR_LBRCKT) return Console_Input((const unsigned char *)"[");
|
|
|
|
|
if (key == KEY_CHAR_RBRCKT) return Console_Input((const unsigned char *)"]");
|
|
|
|
|
if (key == KEY_CHAR_MULT) return Console_Input((const unsigned char *)"*");
|
|
|
|
|
if (key == KEY_CHAR_LBRACE) return Console_Input((const unsigned char *)"{");
|
|
|
|
|
if (key == KEY_CHAR_DIV) return Console_Input((const unsigned char *)"/");
|
|
|
|
|
if (key == KEY_CHAR_RBRACE) return Console_Input((const unsigned char *)"}");
|
|
|
|
|
if (key == KEY_CHAR_FRAC) return Console_Input((const unsigned char *)"/");
|
|
|
|
|
if (key == KEY_CTRL_MIXEDFRAC) return Console_Input((const unsigned char *)"float(");
|
|
|
|
|
if (key == KEY_CTRL_FD) return Console_Input((const unsigned char *)"simplify(");
|
|
|
|
|
if (key == KEY_CTRL_FRACCNVRT) return Console_Input((const unsigned char *)"factor(");
|
|
|
|
|
if (key == KEY_CHAR_LPAR) return Console_Input((const unsigned char *)"(");
|
|
|
|
|
if (key == KEY_CHAR_RPAR) return Console_Input((const unsigned char *)")");
|
|
|
|
|
if (key == KEY_CHAR_CUBEROOT) return Console_Input((const unsigned char *)"^(1/3)");
|
|
|
|
|
if (key == KEY_CHAR_RECIP) return Console_Input((const unsigned char *)"^(-1)");
|
|
|
|
|
if (key == KEY_CHAR_COMMA) return Console_Input((const unsigned char *)",");
|
|
|
|
|
if (key == KEY_CHAR_STORE) return Console_Input((const unsigned char *)"!");
|
|
|
|
|
if (key == KEY_CTRL_XTT) return Console_Input((const unsigned char *)"x");
|
|
|
|
|
if (key == KEY_CHAR_LOG) return Console_Input((const unsigned char *)"log(");
|
|
|
|
|
if (key == KEY_CHAR_EXPN10) return Console_Input((const unsigned char *)"10^(");
|
|
|
|
|
if (key == KEY_CHAR_LN) return Console_Input((const unsigned char *)"ln(");
|
|
|
|
|
if (key == KEY_CHAR_EXPN) return Console_Input((const unsigned char *)"e^(");
|
|
|
|
|
if (key == KEY_CHAR_SIN) return Console_Input((const unsigned char *)"sin(");
|
|
|
|
|
if (key == KEY_CHAR_ASIN) return Console_Input((const unsigned char *)"arcsin(");
|
|
|
|
|
if (key == KEY_CHAR_COS) return Console_Input((const unsigned char *)"cos(");
|
|
|
|
|
if (key == KEY_CHAR_ACOS) return Console_Input((const unsigned char *)"arccos(");
|
|
|
|
|
if (key == KEY_CHAR_TAN) return Console_Input((const unsigned char *)"tan(");
|
|
|
|
|
if (key == KEY_CHAR_ATAN) return Console_Input((const unsigned char *)"arctan(");
|
|
|
|
|
if (key == KEY_CHAR_SQUARE) return Console_Input((const unsigned char *)"^2");
|
|
|
|
|
if (key == KEY_CHAR_ROOT) return Console_Input((const unsigned char *)"sqrt(");
|
|
|
|
|
if (key == KEY_CHAR_VALR) return Console_Input((const unsigned char *)"r");
|
|
|
|
|
if (key == KEY_CHAR_POW) return Console_Input((const unsigned char *)"^");
|
|
|
|
|
if (key == KEY_CHAR_POWROOT) return Console_Input((const unsigned char *)"^(1/");
|
|
|
|
|
if (key == KEY_CHAR_THETA) return Console_Input((const unsigned char *)"theta");
|
|
|
|
|
|
|
|
|
|
if ((key >= 'A') && (key <= 'Z'))
|
|
|
|
|
{
|
|
|
|
|
if (Case == LOWER_CASE) key += 'a' - 'A';
|
|
|
|
|
tmp_str[0] = key;
|
|
|
|
|
tmp_str[1] = 0;
|
|
|
|
|
return Console_Input(tmp_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_UP) return Console_MoveCursor(CURSOR_UP);
|
|
|
|
|
if (key == KEY_CTRL_DOWN) return Console_MoveCursor(CURSOR_DOWN);
|
|
|
|
|
if (key == KEY_CTRL_LEFT) return Console_MoveCursor(CURSOR_LEFT);
|
|
|
|
|
if (key == KEY_CTRL_RIGHT) return Console_MoveCursor(CURSOR_RIGHT);
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_AC)
|
|
|
|
|
{
|
|
|
|
|
if (Line[Current_Line].readonly) return CONSOLE_NO_EVENT;
|
|
|
|
|
Edit_Line[0] = '\0';
|
|
|
|
|
Line[Current_Line].start_col = 0;
|
|
|
|
|
Line[Current_Line].type = LINE_TYPE_INPUT;
|
|
|
|
|
Line[Current_Line].disp_len = 0;
|
|
|
|
|
Cursor.x = 0;
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_EXE)
|
|
|
|
|
{
|
|
|
|
|
if (Current_Line == Last_Line)
|
|
|
|
|
{
|
|
|
|
|
return Console_NewLine(LINE_TYPE_INPUT, 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return CONSOLE_ARG_ERR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_DEL) return Console_Backspace();
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_CLIP)
|
|
|
|
|
{
|
|
|
|
|
tmp = Line[Current_Line].str;
|
|
|
|
|
|
|
|
|
|
move_line = Last_Line - Current_Line;
|
|
|
|
|
for (i = 0; i <= move_line; i++) Console_MoveCursor(CURSOR_DOWN);
|
|
|
|
|
|
|
|
|
|
move_col = Line[Current_Line].disp_len - Current_Col;
|
|
|
|
|
for (i = 0; i <= move_col; i++) Console_MoveCursor(CURSOR_RIGHT);
|
|
|
|
|
|
|
|
|
|
Console_Input(tmp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CONSOLE_NO_EVENT;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 22:56:09 +01:00
|
|
|
|
int Console_FMenu(int key)
|
|
|
|
|
{
|
2015-02-04 00:11:10 +01:00
|
|
|
|
//unsigned char *entries[MAX_MENU_ITEMS] = {NULL};
|
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[key-KEY_CTRL_F1]);
|
|
|
|
|
/*/if(key == KEY_CTRL_F1) {
|
|
|
|
|
entries[0] = (unsigned char *)Console_Make_Entry((const unsigned char *)"sqrt(");
|
2015-02-03 22:56:09 +01:00
|
|
|
|
entries[1] = (unsigned char *)Console_Make_Entry((const unsigned char *)"cos(");
|
|
|
|
|
entries[2] = (unsigned char *)Console_Make_Entry((const unsigned char *)"root(");
|
2015-02-04 00:11:10 +01:00
|
|
|
|
//return Console_Draw_FMenu(key, entries);
|
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[0]);
|
2015-02-03 22:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
if(key == KEY_CTRL_F2) {
|
2015-02-04 00:11:10 +01:00
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[1]);
|
2015-02-03 22:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
if(key == KEY_CTRL_F3) {
|
2015-02-04 00:11:10 +01:00
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[2]);
|
2015-02-03 22:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
if(key == KEY_CTRL_F4) {
|
2015-02-04 00:11:10 +01:00
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[3]);
|
2015-02-03 22:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
if(key == KEY_CTRL_F5) {
|
2015-02-04 00:11:10 +01:00
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[4]);
|
2015-02-03 22:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
if(key == KEY_CTRL_F6) {
|
2015-02-04 00:11:10 +01:00
|
|
|
|
return Console_Draw_FMenu(key, &FMenu_entries[5]);
|
|
|
|
|
}*/
|
2015-02-03 22:56:09 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned char *Console_Make_Entry(const unsigned char* str)
|
|
|
|
|
{
|
|
|
|
|
unsigned char* entry = NULL;
|
|
|
|
|
entry = calloc((strlen(str)+1), sizeof(unsigned char*));
|
|
|
|
|
if(entry) memcpy(entry, str, strlen(str)+1);
|
|
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Console_Draw_FMenu(int key, struct FMenu* menu)
|
|
|
|
|
{
|
|
|
|
|
int i, nb_entries = 0, selector = 0, position_number, position_x, ret, longest = 0;
|
|
|
|
|
unsigned char **entries;
|
|
|
|
|
DISPBOX box;
|
|
|
|
|
|
|
|
|
|
position_number = key - KEY_CTRL_F1;
|
|
|
|
|
|
|
|
|
|
entries = menu->str;
|
|
|
|
|
nb_entries = menu->count;
|
|
|
|
|
|
|
|
|
|
for(i=0; i<nb_entries; i++)
|
|
|
|
|
if(strlen(entries[i]) > longest) longest = strlen(entries[i]);
|
|
|
|
|
|
|
|
|
|
position_x = 21*position_number;
|
|
|
|
|
if(position_x + longest*4 > 115) position_x = 115 - longest*4;
|
|
|
|
|
|
|
|
|
|
box.left = position_x+3;
|
|
|
|
|
box.right = position_x + longest*4 + 7;
|
|
|
|
|
box.bottom = 50+7;
|
|
|
|
|
box.top = 50+7- nb_entries*7;
|
|
|
|
|
|
|
|
|
|
Bdisp_AreaClr_VRAM(&box);
|
|
|
|
|
|
|
|
|
|
Bdisp_DrawLineVRAM(3+position_x, 50+7, 3+position_x, 50+7-nb_entries*7);
|
|
|
|
|
Bdisp_DrawLineVRAM(7+position_x + longest*4, 50+7, 7+position_x+longest*4, 50+7-nb_entries*7);
|
|
|
|
|
|
|
|
|
|
while(key != KEY_CTRL_EXE || key != KEY_CTRL_EXIT) {
|
|
|
|
|
for(i=0; i<nb_entries; i++) {
|
|
|
|
|
PrintMini(5+position_x, 50-7*i, entries[i], MINI_OVER);
|
|
|
|
|
}
|
|
|
|
|
PrintMini(5+position_x,50-7*selector, entries[selector], MINI_REV);
|
|
|
|
|
GetKey(&key);
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_UP && selector < nb_entries-1) selector++;
|
|
|
|
|
if (key == KEY_CTRL_DOWN && selector > 0) selector--;
|
|
|
|
|
|
|
|
|
|
if (key == KEY_CTRL_EXE) return Console_Input(entries[selector]);
|
|
|
|
|
if (key == KEY_CTRL_EXIT) return Console_Input((const unsigned char *)"");
|
|
|
|
|
|
|
|
|
|
if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) {
|
|
|
|
|
Console_Input((const unsigned char *)"");
|
|
|
|
|
Console_Disp();
|
|
|
|
|
return Console_FMenu(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-27 21:13:27 +01:00
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_Init()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
Start_Line = 0;
|
|
|
|
|
Last_Line = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < LINE_MAX; i++)
|
|
|
|
|
{
|
|
|
|
|
free(Line[i].str);
|
|
|
|
|
Line[i].readonly = 0;
|
|
|
|
|
Line[i].type = LINE_TYPE_INPUT;
|
|
|
|
|
Line[i].start_col = 0;
|
|
|
|
|
Line[i].disp_len = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((Edit_Line = (unsigned char *)malloc(EDIT_LINE_MAX + 1)) == NULL) return CONSOLE_MEM_ERR;
|
|
|
|
|
Line[0].str = Edit_Line;
|
|
|
|
|
|
|
|
|
|
Cursor.x = 0;
|
|
|
|
|
Cursor.y = 0;
|
|
|
|
|
|
|
|
|
|
Case = LOWER_CASE;
|
|
|
|
|
|
2015-02-03 22:56:09 +01:00
|
|
|
|
for(i = 0; i < 6; i++) {
|
|
|
|
|
FMenu_entries[i].count = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Console_FMenu_Init();
|
|
|
|
|
|
2015-01-27 21:13:27 +01:00
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 22:56:09 +01:00
|
|
|
|
void Console_FMenu_Init()
|
|
|
|
|
{
|
|
|
|
|
//ToDo : handle when there's no file ...
|
2015-02-04 00:11:10 +01:00
|
|
|
|
int i, number=0, key, handle;
|
2015-02-03 22:56:09 +01:00
|
|
|
|
//unsigned char debug[40] = {'\0'};
|
|
|
|
|
unsigned char* tmp_realloc = NULL;
|
|
|
|
|
unsigned char temp[20] = {'\0'};
|
|
|
|
|
unsigned char* original_cfg;
|
|
|
|
|
unsigned char* cfg = memory_load("\\\\fls0\\FMENU.cfg");
|
|
|
|
|
|
2015-02-04 00:11:10 +01:00
|
|
|
|
|
|
|
|
|
// Does the file exists ?
|
|
|
|
|
// Todo : check the error codes...
|
|
|
|
|
if(!cfg) {
|
|
|
|
|
unsigned char conf_standard[] = {"F2\ncos(\nsin(\ntan(\nF1\ntest(\ntest(\nF4\nje(\nsuis(\nvivant(\nF5\nabdibol(\ngeorges(\ngali(\npom(\npom(\nde(\natol(\nF6\nreturn(\nsolve(\nF3solve(\nfactor(\nsimplify(\nmatrix(\nd("};
|
|
|
|
|
memory_createfile("\\\\fls0\\FMENU.cfg", strlen(conf_standard)+1);
|
|
|
|
|
handle = memory_openfile("\\\\fls0\\FMENU.cfg", _OPENMODE_READWRITE);
|
|
|
|
|
memory_writefile(handle, conf_standard, strlen(conf_standard)+1);
|
|
|
|
|
memory_closefile(handle);
|
|
|
|
|
|
|
|
|
|
cfg = memory_load("\\\\fls0\\FMENU.cfg");
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 22:56:09 +01:00
|
|
|
|
original_cfg = cfg;
|
|
|
|
|
|
|
|
|
|
while(*cfg) {
|
|
|
|
|
for(i=0; i<20, *cfg && *cfg!='\r' && *cfg!='\n'; i++, cfg++) {
|
|
|
|
|
temp[i] = *cfg;
|
|
|
|
|
}
|
|
|
|
|
//if(temp[i-1] == '\r') temp[i-1]='\0';
|
|
|
|
|
|
|
|
|
|
if(temp[0] == 'F' && temp[1]>='1' && temp[1]<='6') number = temp[1]-'0' - 1;
|
|
|
|
|
else if(temp[0]) {
|
|
|
|
|
tmp_realloc=FMenu_entries[number].str;
|
|
|
|
|
FMenu_entries[number].str = realloc(tmp_realloc, sizeof(unsigned char*)*(FMenu_entries[number].count+1));
|
|
|
|
|
|
|
|
|
|
if(FMenu_entries[number].str != NULL) {
|
|
|
|
|
FMenu_entries[number].str[FMenu_entries[number].count] = malloc(strlen(temp)+1);
|
|
|
|
|
|
|
|
|
|
if(FMenu_entries[number].str[FMenu_entries[number].count] == NULL) {
|
|
|
|
|
PrintMini(10,40, "Error realloc bis -> FMenu_init()", MINI_OVER);
|
|
|
|
|
GetKey(&key);
|
|
|
|
|
FMenu_entries[number].str = realloc(FMenu_entries[number].str, FMenu_entries[number].count); //May never fail.
|
|
|
|
|
FMenu_entries[number].count--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
//sprintf(debug, "number = %d and count = %d", number, FMenu_entries[number].count);
|
|
|
|
|
strcpy(FMenu_entries[number].str[FMenu_entries[number].count], temp);
|
|
|
|
|
///PrintMini(10,30, debug, MINI_OVER);
|
|
|
|
|
//PrintMini(50,40, FMenu_entries[number].str[FMenu_entries[number].count], MINI_OVER);
|
|
|
|
|
//if(FMenu_entries[number].count>0)PrintMini(50,50, FMenu_entries[number].str[FMenu_entries[number].count-1], MINI_OVER);
|
|
|
|
|
//GetKey(&key);
|
|
|
|
|
//Bdisp_AllClr_VRAM();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FMenu_entries[number].count++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PrintMini(50,40, "Error realloc -> FMenu_init()", MINI_OVER);
|
|
|
|
|
GetKey(&key);
|
|
|
|
|
FMenu_entries[number].str = tmp_realloc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
memset(temp, '\0', 20);
|
|
|
|
|
cfg++;
|
|
|
|
|
}
|
|
|
|
|
free(original_cfg);
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-27 21:13:27 +01:00
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
|
|
|
|
|
ע<EFBFBD>⣺<EFBFBD><EFBFBD><EFBFBD>øú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ档
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int Console_Disp()
|
|
|
|
|
{
|
2015-01-31 22:33:34 +01:00
|
|
|
|
int i, alpha_shift_status;
|
2015-01-27 21:13:27 +01:00
|
|
|
|
|
|
|
|
|
Bdisp_AllClr_VRAM();
|
|
|
|
|
|
|
|
|
|
for (i = 0; (i < LINE_DISP_MAX) && (i + Start_Line <= Last_Line); i++)
|
|
|
|
|
{
|
|
|
|
|
if (i == Cursor.y)
|
|
|
|
|
{
|
|
|
|
|
if (Line[i + Start_Line].type == LINE_TYPE_INPUT || Line[i + Start_Line].type == LINE_TYPE_OUTPUT && Line[i + Start_Line].disp_len >= COL_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
locate(1, i + 1);
|
|
|
|
|
|
|
|
|
|
if (Line[i + Start_Line].readonly)
|
2015-01-31 22:33:34 +01:00
|
|
|
|
{
|
|
|
|
|
Cursor_SetFlashMode(0);
|
2015-01-27 21:13:27 +01:00
|
|
|
|
PrintRev(Line[i + Start_Line].str + Line[i + Start_Line].start_col);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-02-03 23:41:25 +01:00
|
|
|
|
if(Cursor.x > COL_DISP_MAX-1) {
|
|
|
|
|
Print(Line[i + Start_Line].str + Line[i + Start_Line].start_col + 1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Print(Line[i + Start_Line].str + Line[i + Start_Line].start_col);
|
|
|
|
|
}
|
2015-01-27 21:13:27 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
locate(COL_DISP_MAX - Line[i + Start_Line].disp_len + 1, i + 1);
|
|
|
|
|
|
|
|
|
|
if (Line[i + Start_Line].readonly)
|
|
|
|
|
{
|
2015-01-31 22:33:34 +01:00
|
|
|
|
Cursor_SetFlashMode(0);
|
2015-01-27 21:13:27 +01:00
|
|
|
|
PrintRev(Line[i + Start_Line].str);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Print(Line[i + Start_Line].str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Line[i + Start_Line].start_col > 0)
|
|
|
|
|
{
|
|
|
|
|
locate(1, i + 1);
|
|
|
|
|
|
|
|
|
|
if (Line[i + Start_Line].readonly)
|
|
|
|
|
{
|
2015-01-31 22:33:34 +01:00
|
|
|
|
Cursor_SetFlashMode(0);
|
2015-01-27 21:13:27 +01:00
|
|
|
|
PrintRev((unsigned char *)"\xE6\x9A");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Print((unsigned char *)"\xE6\x9A");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 23:41:25 +01:00
|
|
|
|
if (Line[i + Start_Line].disp_len - Line[i + Start_Line].start_col > COL_DISP_MAX-1)
|
2015-01-27 21:13:27 +01:00
|
|
|
|
{
|
|
|
|
|
locate(COL_DISP_MAX, i + 1);
|
|
|
|
|
if (Line[i + Start_Line].readonly)
|
|
|
|
|
{
|
2015-02-03 23:41:25 +01:00
|
|
|
|
if(Line[i + Start_Line].disp_len - Line[i + Start_Line].start_col != COL_DISP_MAX) {
|
|
|
|
|
Cursor_SetFlashMode(0);
|
|
|
|
|
PrintRev((unsigned char *)"\xE6\x9B");
|
|
|
|
|
}
|
2015-01-27 21:13:27 +01:00
|
|
|
|
}
|
2015-02-03 23:41:25 +01:00
|
|
|
|
else if(Cursor.x < COL_DISP_MAX-1)
|
2015-01-27 21:13:27 +01:00
|
|
|
|
{
|
|
|
|
|
Print((unsigned char *)"\xE6\x9B");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Line[i + Start_Line].readonly)
|
|
|
|
|
{
|
2015-01-31 22:33:34 +01:00
|
|
|
|
switch(Setup_GetEntry(0x14)) {
|
|
|
|
|
case 0:
|
|
|
|
|
alpha_shift_status = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 1: //Shift enabled
|
|
|
|
|
alpha_shift_status = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 4: //Alpha enabled
|
|
|
|
|
alpha_shift_status = 4;
|
|
|
|
|
break;
|
|
|
|
|
case 0x84: //both Shift and Alpha enabled, seems to be not working
|
|
|
|
|
alpha_shift_status = 4;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
alpha_shift_status = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Cursor_SetPosition(Cursor.x, Cursor.y);
|
|
|
|
|
Cursor_SetFlashMode(1);
|
|
|
|
|
Cursor_SetFlashStyle(alpha_shift_status); //Potential 2.00 OS incompatibilty (cf Simon's doc)
|
|
|
|
|
/*Bdisp_DrawLineVRAM(Cursor.x * 6, Cursor.y * 8, Cursor.x * 6, Cursor.y * 8 + 6);
|
|
|
|
|
Bdisp_DrawLineVRAM(Cursor.x * 6 + 1, Cursor.y * 8, Cursor.x * 6 + 1, Cursor.y * 8 + 6);*/
|
2015-01-27 21:13:27 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (Line[i + Start_Line].type == LINE_TYPE_INPUT || Line[i + Start_Line].type == LINE_TYPE_OUTPUT && Line[i + Start_Line].disp_len >= COL_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
locate(1, i + 1);
|
|
|
|
|
Print(Line[i + Start_Line].str + Line[i + Start_Line].start_col);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
locate(COL_DISP_MAX - Line[i + Start_Line].disp_len + 1, i + 1);
|
|
|
|
|
Print(Line[i + Start_Line].str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Line[i + Start_Line].start_col > 0)
|
|
|
|
|
{
|
|
|
|
|
locate(1, i + 1);
|
|
|
|
|
Print((unsigned char *)"\xE6\xAF");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Line[i + Start_Line].disp_len - Line[i + Start_Line].start_col > COL_DISP_MAX)
|
|
|
|
|
{
|
|
|
|
|
locate(COL_DISP_MAX, i + 1);
|
|
|
|
|
Print((unsigned char *)"\xE6\x9F");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Bdisp_PutDisp_DD();
|
|
|
|
|
return CONSOLE_SUCCEEDED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>º<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
unsigned char *Console_GetLine()
|
|
|
|
|
{
|
|
|
|
|
int return_val;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
return_val = Console_GetKey();
|
|
|
|
|
Console_Disp();
|
|
|
|
|
if (return_val == CONSOLE_MEM_ERR) return NULL;
|
|
|
|
|
} while (return_val != CONSOLE_NEW_LINE_SET);
|
|
|
|
|
|
|
|
|
|
return Line[Current_Line - 1].str;
|
|
|
|
|
}
|