w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sh9.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#include <stdlib.h>
#include <stddef.h>
#include <errno.h>
#include <setjmp.h>
#include <limits.h>
#include <unistd.h>
#include <dirent.h>
#include "sh.h"
Include dependency graph for sh9.c:

Go to the source code of this file.

Classes

struct  cmd_history
 
struct  Key_Fun_List
 

Macros

#define _NKEYBRD_READ   0x10 /* read next char from kbd */
 
#define _NKEYBRD_READY   0x11 /* check for keystroke */
 
#define _NKEYBRD_SHIFTSTATUS   0x12 /* get shift key status */
 
#define _KEYBRD_READ   0x00 /* read next char from kbd */
 
#define _KEYBRD_READY   0x01 /* check for keystroke */
 
#define _KEYBRD_SHIFTSTATUS   0x02 /* get shift key status */
 
#define KF_LENGTH   ARRAY_SIZE (KF_List)
 
#define DisplayKeyCode(a, b)
 
#define ChangeKeyboardMode(a)
 

Functions

static bool near ProcessAlphaNumericKey (int)
 
static bool near ProcessFunctionKey (int)
 
static bool near Process_History (int)
 
static bool near ScanHistory (void)
 
static void near ReDisplayInputLine (void)
 
static void near PageHistoryRecord (int)
 
static bool near UpdateConsoleInputLine (char *)
 
static bool near ReStartInput (char *)
 
static void near GenerateNewCursorPosition (void)
 
static void near EraseToEndOfLine (void)
 
static bool near CompleteFileName (char *, bool)
 
static void near InitialiseInput (bool)
 
static void near PrintOutHistory (FILE *, bool, struct cmd_history *)
 
static void near ReleaseCommandMemory (struct cmd_history *)
 
static void near SaveCurrentHistory (void)
 
static void near memrcpy (char *, char *, int)
 
static FILE *near OpenHistoryFile (char *)
 
static void near GetLineFromConsole (void)
 
static bool near InsertACharacter (int)
 
static int near OutputACharacter (int)
 
static int near GetLineFromDevice (void)
 
static void near CheckKeyboardPolling (void)
 
int GetConsoleInput (void)
 
void SetCursorShape (bool mode)
 
int ReadCursorPosition (void)
 
void SetCursorPosition (int new)
 
char * GetHistoryRecord (int event)
 
void LoadHistory (void)
 
void AddHistory (bool AppendToLast)
 
void DumpHistory (void)
 
void ClearHistory (void)
 
void Configure_Keys (void)
 
void PositionCursorInColumnZero (void)
 
void GetScreenParameters (void)
 
bool RingWarningBell (void)
 
unsigned char ReadKeyBoard (unsigned char *f_key)
 
bool ChangeInitialisationValue (char *string, int newvalue)
 
int GetLastHistoryEvent (void)
 
int GetFirstHistoryEvent (void)
 
void PrintHistory (bool r_flag, bool n_flag, int First, int Last, FILE *fp)
 
int SearchHistory (char *buffer)
 
void FlushHistoryBuffer (void)
 
void DeleteLastHistory (void)
 
bool ClearScreen (void)
 
void DisplayLineWithControl (char *line)
 
int GetRootDiskDrive (void)
 
int GetEOFKey (void)
 
char CleanUpBuffer (int length, char *buffer, int eofc)
 
int LookUpKeyBoardFunction (unsigned char a_key, unsigned char f_key)
 
char ** BuildCompletionList (char *String, size_t Length, int *Count, bool Full)
 
size_t GetCommonPartOfFileList (char **FileList)
 
unsigned char GetFunctionKeyMap (int key, unsigned char *f_key)
 

Variables

static bool DESQviewActive = ((bool)0)
 
static unsigned int ReadKeyboardOption = 0x00
 
static bool InsertMode = ((bool)0)
 
static char * c_buffer_pos
 
static char * EndOfCurrentLine
 
static int m_line = 0
 
static int c_history = -1
 
static int l_history = 0
 
static int M_length = -1
 
static int MaxLength = 0
 
static int OldMaxLength = 0
 
static int CurrentHistorySize = 0
 
static bool AppendHistory = ((bool)0)
 
static bool SaveHistory = ((bool)0)
 
static char * No_prehistory = "No previous commands"
 
static char * No_MatchHistory = "No history match found"
 
static char * No_posthistory = "No more commands"
 
static char * History_2long = "History line too long"
 
static struct Key_Fun_List KF_List []
 
static struct cmd_historycmd_history = (struct cmd_history *) 0
 

Macro Definition Documentation

◆ _KEYBRD_READ

#define _KEYBRD_READ   0x00 /* read next char from kbd */

Definition at line 105 of file sh9.c.

◆ _KEYBRD_READY

#define _KEYBRD_READY   0x01 /* check for keystroke */

Definition at line 106 of file sh9.c.

◆ _KEYBRD_SHIFTSTATUS

#define _KEYBRD_SHIFTSTATUS   0x02 /* get shift key status */

Definition at line 107 of file sh9.c.

◆ _NKEYBRD_READ

#define _NKEYBRD_READ   0x10 /* read next char from kbd */

Definition at line 99 of file sh9.c.

◆ _NKEYBRD_READY

#define _NKEYBRD_READY   0x11 /* check for keystroke */

Definition at line 100 of file sh9.c.

◆ _NKEYBRD_SHIFTSTATUS

#define _NKEYBRD_SHIFTSTATUS   0x12 /* get shift key status */

Definition at line 101 of file sh9.c.

◆ ChangeKeyboardMode

#define ChangeKeyboardMode (   a)

Definition at line 160 of file sh9.c.

◆ DisplayKeyCode

#define DisplayKeyCode (   a,
  b 
)

Definition at line 153 of file sh9.c.

◆ KF_LENGTH

#define KF_LENGTH   ARRAY_SIZE (KF_List)

Definition at line 119 of file sh9.c.

Function Documentation

◆ AddHistory()

◆ BuildCompletionList()

char** BuildCompletionList ( char *  String,
size_t  Length,
int Count,
bool  Full 
)

◆ ChangeInitialisationValue()

bool ChangeInitialisationValue ( char *  string,
int  newvalue 
)

Definition at line 2357 of file sh9.c.

References Key_Fun_List::akey, FALSE, i, KF_END_FKEYS, KF_LENGTH, KF_List, stricmp, and TRUE.

Referenced by doset().

◆ CheckKeyboardPolling()

static void near CheckKeyboardPolling ( void  )
static

Definition at line 2378 of file sh9.c.

References _KEYBRD_READ, _NKEYBRD_READ, DESQviewActive, DosInterrupt, FALSE, i, r, ReadKeyboardOption, SystemInterrupt, and TRUE.

Referenced by GetConsoleInput().

◆ CleanUpBuffer()

char CleanUpBuffer ( int  length,
char *  buffer,
int  eofc 
)

Definition at line 2844 of file sh9.c.

References CHAR_NEW_LINE, cp, length, and ret.

Referenced by AddHistory(), doecho(), dofc(), ReadALine(), and VI_EditLine().

◆ ClearHistory()

void ClearHistory ( void  )

◆ ClearScreen()

◆ CompleteFileName()

◆ Configure_Keys()

◆ DeleteLastHistory()

void DeleteLastHistory ( void  )

Definition at line 2604 of file sh9.c.

References l_history, and ReleaseCommandMemory().

Referenced by dofc().

◆ DisplayLineWithControl()

void DisplayLineWithControl ( char *  line)

Definition at line 2755 of file sh9.c.

References CHAR_SPACE, CHAR_TAB, line, fc-lang::off, OutputACharacter(), and ReadCursorPosition().

Referenced by ReDisplayInputLine().

◆ DumpHistory()

void DumpHistory ( void  )

◆ EraseToEndOfLine()

static void near EraseToEndOfLine ( void  )
static

Definition at line 1029 of file sh9.c.

References FlushStreams(), m_line, MaximumColumns, r, and SystemInterrupt.

Referenced by ReDisplayInputLine(), and ReStartInput().

◆ FlushHistoryBuffer()

void FlushHistoryBuffer ( void  )

Definition at line 2544 of file sh9.c.

References AddHistory(), AppendHistory, ConsoleLineBuffer, FALSE, LINE_MAX, memset(), and SaveHistory.

Referenced by doecho(), doread(), and RunCommands().

◆ GenerateNewCursorPosition()

static void near GenerateNewCursorPosition ( void  )
static

◆ GetCommonPartOfFileList()

size_t GetCommonPartOfFileList ( char **  FileList)

Definition at line 2974 of file sh9.c.

References ap, BaseName, i, NULL, and strlen().

Referenced by CompleteFileName(), and VI_ExecuteCompletion().

◆ GetConsoleInput()

◆ GetEOFKey()

int GetEOFKey ( void  )

Definition at line 2801 of file sh9.c.

References Key_Fun_List::akey, KF_EOFKEY, and KF_List.

Referenced by AddHistory(), EMACS_EndOfInput(), ReadALine(), and VI_GetNextCharacter().

◆ GetFirstHistoryEvent()

int GetFirstHistoryEvent ( void  )

Definition at line 2469 of file sh9.c.

References cmd_history::number.

Referenced by EMACS_GetFirstHistory().

◆ GetFunctionKeyMap()

unsigned char GetFunctionKeyMap ( int  key,
unsigned char *  f_key 
)

Definition at line 3001 of file sh9.c.

References Key_Fun_List::akey, Key_Fun_List::fkey, key, and KF_List.

Referenced by EMACS_Initialisation().

◆ GetHistoryRecord()

◆ GetLastHistoryEvent()

◆ GetLineFromConsole()

◆ GetLineFromDevice()

static int near GetLineFromDevice ( void  )
static

Definition at line 416 of file sh9.c.

References CHAR_HISTORY, ConsoleLineBuffer, fgets, LINE_MAX, NULL, and Process_History().

Referenced by GetConsoleInput().

◆ GetRootDiskDrive()

int GetRootDiskDrive ( void  )

Definition at line 2788 of file sh9.c.

References Key_Fun_List::akey, GetCurrentDrive(), KF_List, and KF_ROOTDRIVE.

Referenced by LoadTheProfileFiles().

◆ GetScreenParameters()

◆ InitialiseInput()

◆ InsertACharacter()

static bool near InsertACharacter ( int  NewCharacter)
static

◆ LoadHistory()

◆ LookUpKeyBoardFunction()

int LookUpKeyBoardFunction ( unsigned char  a_key,
unsigned char  f_key 
)

Definition at line 2864 of file sh9.c.

References Key_Fun_List::fcode, i, int(), KF_END_FKEYS, KF_List, KT_ALTFUNCTION, and KT_FUNCTION.

Referenced by GetLineFromConsole(), and VI_GetNextCharacter().

◆ memrcpy()

static void near memrcpy ( char *  sp1,
char *  sp,
int  cnt 
)
static

Definition at line 1642 of file sh9.c.

References cnt, sp, and sp1.

Referenced by InsertACharacter(), and UpdateConsoleInputLine().

◆ OpenHistoryFile()

static FILE *near OpenHistoryFile ( char *  mode)
static

◆ OutputACharacter()

static int near OutputACharacter ( int  c)
static

Definition at line 2821 of file sh9.c.

References c, CHAR_NOT, and fc-lang::off.

Referenced by DisplayLineWithControl(), InsertACharacter(), and ProcessAlphaNumericKey().

◆ PageHistoryRecord()

static void near PageHistoryRecord ( int  direction)
static

◆ PositionCursorInColumnZero()

void PositionCursorInColumnZero ( void  )

◆ PrintHistory()

void PrintHistory ( bool  r_flag,
bool  n_flag,
int  First,
int  Last,
FILE fp 
)

Definition at line 2489 of file sh9.c.

References fp, i, l_history, and PrintOutHistory().

Referenced by dofc(), and dohistory().

◆ PrintOutHistory()

static void near PrintOutHistory ( FILE fp,
bool  n_flag,
struct cmd_history cmd 
)
static

Definition at line 2431 of file sh9.c.

References CHAR_NEW_LINE, cmd, cp, fp, fprintf, fputs, and putc.

Referenced by PrintHistory().

◆ Process_History()

◆ ProcessAlphaNumericKey()

static bool near ProcessAlphaNumericKey ( int  c)
static

◆ ProcessFunctionKey()

◆ ReadCursorPosition()

◆ ReadKeyBoard()

unsigned char ReadKeyBoard ( unsigned char *  f_key)

◆ ReDisplayInputLine()

◆ ReleaseCommandMemory()

static void near ReleaseCommandMemory ( struct cmd_history cp)
static

Definition at line 2533 of file sh9.c.

References cp, and ReleaseMemoryCell().

Referenced by AddHistory(), ClearHistory(), and DeleteLastHistory().

◆ ReStartInput()

◆ RingWarningBell()

◆ SaveCurrentHistory()

static void near SaveCurrentHistory ( void  )
static

Definition at line 2559 of file sh9.c.

References AddHistory(), AppendHistory, bool, c_history, l_history, LastUserPrompt, PS1, PS2, and SaveHistory.

Referenced by GetConsoleInput().

◆ ScanHistory()

static bool near ScanHistory ( void  )
static

◆ SearchHistory()

int SearchHistory ( char *  buffer)

Definition at line 2517 of file sh9.c.

References i, l_history, cmd_history::number, strlen(), and strncmp().

Referenced by dofc().

◆ SetCursorPosition()

void SetCursorPosition ( int  new)

◆ SetCursorShape()

◆ UpdateConsoleInputLine()

static bool near UpdateConsoleInputLine ( char *  optionals)
static

Variable Documentation

◆ AppendHistory

bool AppendHistory = ((bool)0)
static

Definition at line 194 of file sh9.c.

Referenced by FlushHistoryBuffer(), and SaveCurrentHistory().

◆ c_buffer_pos

◆ c_history

◆ cmd_history

struct cmd_history* cmd_history = (struct cmd_history *) 0
static

Definition at line 295 of file sh9.c.

Referenced by ClearHistory(), and DumpHistory().

◆ CurrentHistorySize

int CurrentHistorySize = 0
static

Definition at line 192 of file sh9.c.

Referenced by AddHistory(), and ClearHistory().

◆ DESQviewActive

bool DESQviewActive = ((bool)0)
static

Definition at line 168 of file sh9.c.

Referenced by CheckKeyboardPolling(), and ReadKeyBoard().

◆ EndOfCurrentLine

◆ History_2long

char* History_2long = "History line too long"
static

Definition at line 199 of file sh9.c.

Referenced by AddHistory(), and UpdateConsoleInputLine().

◆ InsertMode

bool InsertMode = ((bool)0)
static

◆ KF_List

◆ l_history

◆ M_length

int M_length = -1
static

◆ m_line

int m_line = 0
static

Definition at line 186 of file sh9.c.

Referenced by EraseToEndOfLine(), and ReDisplayInputLine().

◆ MaxLength

int MaxLength = 0
static

Definition at line 190 of file sh9.c.

Referenced by GetLineFromConsole(), InitialiseInput(), and ReDisplayInputLine().

◆ No_MatchHistory

char* No_MatchHistory = "No history match found"
static

Definition at line 197 of file sh9.c.

Referenced by PageHistoryRecord(), and ScanHistory().

◆ No_posthistory

char* No_posthistory = "No more commands"
static

Definition at line 198 of file sh9.c.

Referenced by Process_History().

◆ No_prehistory

char* No_prehistory = "No previous commands"
static

Definition at line 196 of file sh9.c.

Referenced by Process_History(), and ScanHistory().

◆ OldMaxLength

int OldMaxLength = 0
static

Definition at line 191 of file sh9.c.

Referenced by GetLineFromConsole(), and InitialiseInput().

◆ ReadKeyboardOption

unsigned int ReadKeyboardOption = 0x00
static

Definition at line 178 of file sh9.c.

Referenced by CheckKeyboardPolling(), and ReadKeyBoard().

◆ SaveHistory

bool SaveHistory = ((bool)0)
static

Definition at line 195 of file sh9.c.

Referenced by FlushHistoryBuffer(), GetConsoleInput(), and SaveCurrentHistory().