Clib: Add AcpiUtMemmove() to improve portability

This patch implements AcpiUtMemmove() as a native replacement of memmove.
This implementation has been roughly tested under unix. Yizhe Wang.

Signed-off-by: Yizhe Wang <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Clib: Add AcpiOsGetFileCharacter()/AcpiOsPutFileCharacter() to improve portability.

This patch added two new OSLs:
1. AcpiOsGetFileCharacter() as a replacement of fgetc()/getc().
2. AcpiOsPutFileCharacter() as a replacement of fputc()/putc().
For Unix/Windows environments, these 2 APIs are implemented using
fgetc()/fputc(). For EFI environment, they are implemented using
AcpiOsReadFile()/AcpiOsWriteFile().

Note in this patch, ACPI_FILE_IN is simply defined as NULL for EFI
environment. Its EFI support should be implemented by further patches.
Yizhe Wang.

Signed-off-by: Yizhe Wang <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Clib: Introduce new file open types - ACPI_FILE_APPENDING/ACPI_FILE_TEXT.

This patch introduced a new types:
1. ACPI_FILE_APPENDING so that "w+" can be expressed as
   (ACPI_FILE_WRITING | ACPI_FILE_APPENDING).
2. ACPI_FILE_TEXT so that "rt" can be expressed as
   (ACPI_FILE_READING | ACPI_FILE_TEXT).
The new types are used by ACPICA applications. Yizhe Wang.

Signed-off-by: Yizhe Wang <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
EFI: Add standard input descriptor support.

This patch implements stdin for EFI environment using
SIMPLE_INPUT_INTERFACE. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
EFI: Add file position seeking/telling support.

This patch adds file position seeking/telling support. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Clib: Add AcpiOsGetFileString() to improve portability.

This patch adds AcpiOsGetFileString() as a wrapper of fgets(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Utilities: Add generic AcpiUtStrpbrk() and AcpiUtStrtok() to improve portability.

This patch implements the following native string APIs:
1. AcpiUtStrpbrk() as a native replacement of strpbrk();
2. AcpiUtStrtok() as a native replacement of strtok().

Unit tests have been done to these two functions in unix environment and no
bugs have been found. Yizhe Wang.

Signed-off-by: Yizhe Wang <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Common: Modify string/memory/file libc invocations in AcpiOsGetLine() into c library wrappers to improve portability.

This patch cleans up AcpiOsGetLine() by replacing the following libc
invocations into the c library wrappers:
1. strlen -> ACPI_STRLEN
2. strcpy -> ACPI_STRCPY
3. strtoul -> ACPI_STRTOUL
4. strcpy -> ACPI_STRCPY
5. memmove -> ACPI_MEMMOVE
6. memset -> ACPI_MEMSET
7. fprintf -> ACPI_FPRINTF
8. putchar -> AcpiOsPutFileCharacter(ACPI_FILE_OUT)
9. getchar -> AcpiOsGetFileCharacter(ACPI_FILE_IN)
No functional changes for Unix/Windows environments. Yizhe Wang.

Signed-off-by: Yizhe Wang <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Debugger/Utilities: Replace stdio invocations with OSL APIs to improve portability.

This patch improves portability by:
1. Replace fclose() with AcpiOsCloseFile().
2. Replace fopen() with AcpiOsOpenFile().
3. Replace perror() and fprintf with AcpiLogError().
4. Replace type FILE with ACPI_FILE
5. Replace fseek() with AcpiOsSetFileOffset().
6. Replace fread() with AcpiOsReadFile().

Signed-off-by: Yizhe Wang <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>