GNU PROLOG with UTF8 support
Macros | Functions | Variables
w32_console.c File Reference
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <malloc.h>
#include "../EnginePl/gp_config.h"
#include "../EnginePl/pl_params.h"
#include "../EnginePl/set_locale.h"
#include "w32gc_interf.h"
#include "../TopComp/prolog_path.c"
#include "../TopComp/copying.c"
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <richedit.h>
#include <shlobj.h>
#include <shellapi.h>
#include "w32_resource.h"
#include "../Linedit/terminal.h"
Include dependency graph for w32_console.c:

Macros

#define GUI_VERSION   "1.1"
 
#define ADDITIONAL_INFORMATION
 
#define DLLEXPORT   __declspec(dllexport)
 
#define GetWindowLongPtr   GetWindowLong
 
#define SetWindowLongPtr   SetWindowLong
 
#define EDIT_FIELD_SIZE   64000 /* 0 does not work ! why ? */
 
#define FIX_TAB   1
 
#define FIX_CR   2
 
#define FIX_BACKSLASH   4
 
#define FIX_QUOTE   8
 
#define Queue_Is_Empty()   (queue_start == queue_end)
 
#define Enqueue(c)
 
#define Dequeue(c)
 
#define SET_CHECKED_OPT(idm_cmd, var)   CheckMenuItem(GetMenu(hwndMain), idm_cmd, (var) ? MF_CHECKED : MF_UNCHECKED)
 
#define READ_INT_REG(key_name, var)
 
#define WRITE_INT_REG(key_name, var)
 
#define READ_BOOL_REG(key_name, var)
 
#define WRITE_BOOL_REG(key_name, var)
 
#define Is_A_Sep(c)   (!isprint(c) || (strchr(separators, c) != NULL))
 
#define BIF_NEWDIALOGSTYLE   0x40
 
#define BIF_NONEWFOLDERBUTTON   0x0200
 

Functions

static int CallMain (void *unused)
 
static int StartWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
 
static BOOL InitApplication (void)
 
static HWND Createw32_consoleWndClassWnd (void)
 
static LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void MainWndProc_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
static void Create_Edit_Control (HWND hwnd)
 
static void SubClassEditField (HWND hwnd)
 
static LRESULT CALLBACK SubClassEdit (HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
 
static int CALLBACK WordBreakProc (LPTSTR lpcb, int ichCurrent, int cch, int code)
 
static void Toggle_Wrap_Mode (HWND hwnd)
 
static HFONT Create_Courier_Font (void)
 
static int Change_Font (HWND hwnd)
 
BOOL CALLBACK StackSizesProc (HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
static void Load_Options (void)
 
static void Save_Options (void)
 
static void Activate_Options (void)
 
static char * Get_Current_Word (int select_it)
 
static void Consult_File (void)
 
static void Change_Directory (void)
 
static void Insert_File_Name (void)
 
static char * Get_Selected_File_Name (char *title, char *default_ext, char *filter)
 
static char * Get_Selected_Directory (char *title, int new_folder)
 
static void Show_Help (char *word)
 
static int Get_CHM_Help_Path (char *path)
 
static int WINAPI BrowseCallbackProc (HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
 
static void Add_Clipboard_To_Queue (void)
 
static void Add_String_To_Queue (char *str, int mask_fix)
 
static void Add_Char_To_Queue (int c)
 
static void Set_Selection (int posit, int n)
 
static void Set_Caret_Position (int posit)
 
static int Move_Caret_To (int start_or_end)
 
static void Move_Caret_From_Mouse (int if_no_selection)
 
static int Delete_Selection (void)
 
static void Display_Text (char *str, int n)
 
static void Flush_Buffer (void)
 
DLLEXPORT void W32GC_Set_Line_Buffering (int is_buffered)
 
DLLEXPORT void W32GC_Backd (int n)
 
DLLEXPORT int W32GC_Confirm_Box (char *titre, char *msg)
 
static BOOL Launched_From_Command_Line ()
 
static HWND Find_Text_Console_Handle (void)
 
static void Show_Text_Console (int show)
 
BOOL DLLEXPORT WINAPI DllMain (HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
 
DLLEXPORT int W32GC_Start_Window (char *(*get_separators)(), int(*get_prompt_length)(), PlLong(*query_stack)())
 
static char * Make_Windows_Filter (char *filter)
 
DLLEXPORT int W32GC_Kbd_Is_Not_Empty ()
 
DLLEXPORT int W32GC_Get_Char0 ()
 
DLLEXPORT int W32GC_Get_Line_Buffering (void)
 
DLLEXPORT void W32GC_Flush (FILE *f)
 
DLLEXPORT void W32GC_Put_Char (int c)
 
DLLEXPORT void W32GC_Forwd (int n)
 
DLLEXPORT void W32GC_Displ (int n, char *str)
 
DLLEXPORT void W32GC_Displ_Str (char *str)
 
DLLEXPORT void W32GC_Erase (int n)
 
DLLEXPORT void W32GC_Emit_Beep ()
 
DLLEXPORT void W32GC_Ins_Mode (int ins_mode)
 
DLLEXPORT void W32GC_Screen_Size (int *row, int *col)
 
DLLEXPORT void W32GC_Message_Box (char *title, char *msg, int type)
 
DLLEXPORT void W32GC_Exit_Process (int ret_val)
 

Variables

static char *(* fct_get_separators )()
 
static int(* fct_get_prompt_length )()
 
static PlLong(* fct_query_stack )()
 
static unsigned int queue [EDIT_FIELD_SIZE]
 
static int queue_start
 
static int queue_end
 
static CRITICAL_SECTION cs_queue
 
static HANDLE event_window_is_ready
 
static HANDLE event_char_in_queue
 
static HWND hwndMain
 
static HWND hwndEditControl
 
static WNDPROC lpEProc
 
static HINSTANCE hInst
 
static LOGFONT currentFont
 
static HFONT hFont
 
static int show_console = 0
 
static HWND hwnd_console
 
static int in_get_char = 0
 
static int last_is_read = 0
 
static int posit = 0
 
static int ec_start = 0
 
static int win_x = CW_USEDEFAULT
 
static int win_y = CW_USEDEFAULT
 
static int win_width = CW_USEDEFAULT
 
static int win_height = CW_USEDEFAULT
 
static int copy_on_sel = 1
 
static int wrap_mode = 0
 
static int line_buffering = 1
 
static int beep_on_error = 0
 
static char wr_buffer [10240]
 
static char * wr_buffer_ptr = wr_buffer
 
static int dont_use_selection
 
static char buff_pathname [MAX_PATH]
 
struct {
   int   idc_desc
 
   int   idc_def_sz
 
   int   idc_env_var_name
 
   int   idc_env_var_sz
 
   int   idc_reg_sz
 
   int   idc_cur_sz
 
stk []
 

Macro Definition Documentation

#define ADDITIONAL_INFORMATION
Value:
"Windows GUI Console version " GUI_VERSION "\n" \
"By Jacob Navia and Daniel Diaz\n\n"
#define GUI_VERSION
Definition: w32_console.c:51
#define BIF_NEWDIALOGSTYLE   0x40
#define BIF_NONEWFOLDERBUTTON   0x0200
#define Dequeue (   c)
Value:
do \
{ \
queue_start = (queue_start + 1) % sizeof(queue); \
} \
while(0)
static CHAR32_T c
Definition: scan_supp.c:65
static unsigned int queue[EDIT_FIELD_SIZE]
Definition: w32_console.c:157
static int queue_start
Definition: w32_console.c:158
#define DLLEXPORT   __declspec(dllexport)
#define EDIT_FIELD_SIZE   64000 /* 0 does not work ! why ? */
#define Enqueue (   c)
Value:
do \
{ \
queue_end = (queue_end + 1) % sizeof(queue); \
queue_start = (queue_start + 1) % sizeof(queue);\
} \
while(0)
static CHAR32_T c
Definition: scan_supp.c:65
static int queue_end
Definition: w32_console.c:158
static unsigned int queue[EDIT_FIELD_SIZE]
Definition: w32_console.c:157
static int queue_start
Definition: w32_console.c:158
#define FIX_BACKSLASH   4
#define FIX_CR   2
#define FIX_QUOTE   8
#define FIX_TAB   1
#define GetWindowLongPtr   GetWindowLong
#define GUI_VERSION   "1.1"
#define Is_A_Sep (   c)    (!isprint(c) || (strchr(separators, c) != NULL))
#define Queue_Is_Empty ( )    (queue_start == queue_end)
#define READ_BOOL_REG (   key_name,
  var 
)
Value:
{ \
unsigned char x; \
if (Read_Windows_Registry(key_name, REG_BINARY, &x, 1)) \
var = x; \
}
unsigned var
PlLong x
Definition: chkma.c:99
#define READ_INT_REG (   key_name,
  var 
)
Value:
{ \
DWORD x; \
if (Read_Windows_Registry(key_name, REG_DWORD, &x, sizeof(x)))\
var = x; \
}
unsigned var
PlLong x
Definition: chkma.c:99
#define SET_CHECKED_OPT (   idm_cmd,
  var 
)    CheckMenuItem(GetMenu(hwndMain), idm_cmd, (var) ? MF_CHECKED : MF_UNCHECKED)
#define SetWindowLongPtr   SetWindowLong
#define WRITE_BOOL_REG (   key_name,
  var 
)
Value:
{ \
unsigned char x = (unsigned char) var; \
Write_Windows_Registry(key_name, REG_BINARY, &x, 1); \
}
unsigned var
PlLong x
Definition: chkma.c:99
#define WRITE_INT_REG (   key_name,
  var 
)
Value:
{ \
DWORD x = (DWORD) var; \
Write_Windows_Registry(key_name, REG_DWORD, &x, sizeof(x)); \
}
unsigned var
PlLong x
Definition: chkma.c:99

Function Documentation

static void Activate_Options ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Add_Char_To_Queue ( int  c)
static

Here is the caller graph for this function:

static void Add_Clipboard_To_Queue ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Add_String_To_Queue ( char *  str,
int  mask_fix 
)
static

Here is the caller graph for this function:

static int WINAPI BrowseCallbackProc ( HWND  hwnd,
UINT  uMsg,
LPARAM  lp,
LPARAM  pData 
)
static

Here is the caller graph for this function:

static int CallMain ( void *  unused)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Change_Directory ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int Change_Font ( HWND  hwnd)
static

Here is the caller graph for this function:

static void Consult_File ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static HFONT Create_Courier_Font ( void  )
static

Here is the caller graph for this function:

static void Create_Edit_Control ( HWND  hwnd)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static HWND Createw32_consoleWndClassWnd ( void  )
static

Here is the caller graph for this function:

static int Delete_Selection ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Display_Text ( char *  str,
int  n 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL DLLEXPORT WINAPI DllMain ( HINSTANCE  hDLLInst,
DWORD  fdwReason,
LPVOID  lpvReserved 
)
static HWND Find_Text_Console_Handle ( void  )
static

Here is the caller graph for this function:

static void Flush_Buffer ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int Get_CHM_Help_Path ( char *  path)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static char * Get_Current_Word ( int  select_it)
static

Here is the caller graph for this function:

static char * Get_Selected_Directory ( char *  title,
int  new_folder 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static char * Get_Selected_File_Name ( char *  title,
char *  default_ext,
char *  filter 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL InitApplication ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Insert_File_Name ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int Launched_From_Command_Line ( )
static

Here is the caller graph for this function:

static void Load_Options ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static LRESULT CALLBACK MainWndProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void MainWndProc_OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static char* Make_Windows_Filter ( char *  filter)
static

Here is the caller graph for this function:

static void Move_Caret_From_Mouse ( int  if_no_selection)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int Move_Caret_To ( int  start_or_end)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Save_Options ( void  )
static

Here is the caller graph for this function:

static void Set_Caret_Position ( int  posit)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Set_Selection ( int  posit,
int  n 
)
static

Here is the caller graph for this function:

static void Show_Help ( char *  word)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Show_Text_Console ( int  show)
static

Here is the caller graph for this function:

BOOL CALLBACK StackSizesProc ( HWND  hwndDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Here is the caller graph for this function:

static int StartWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpCmdLine,
INT  nCmdShow 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static LRESULT CALLBACK SubClassEdit ( HWND  hwnd,
UINT  msg,
WPARAM  mp1,
LPARAM  mp2 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void SubClassEditField ( HWND  hwnd)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Toggle_Wrap_Mode ( HWND  hwnd)
static

Here is the call graph for this function:

Here is the caller graph for this function:

DLLEXPORT void W32GC_Backd ( int  n)

Here is the call graph for this function:

Here is the caller graph for this function:

DLLEXPORT int W32GC_Confirm_Box ( char *  titre,
char *  msg 
)

Here is the call graph for this function:

Here is the caller graph for this function:

DLLEXPORT void W32GC_Displ ( int  n,
char *  str 
)

Here is the call graph for this function:

DLLEXPORT void W32GC_Displ_Str ( char *  str)

Here is the call graph for this function:

DLLEXPORT void W32GC_Emit_Beep ( )
DLLEXPORT void W32GC_Erase ( int  n)

Here is the call graph for this function:

DLLEXPORT void W32GC_Exit_Process ( int  ret_val)

Here is the call graph for this function:

DLLEXPORT void W32GC_Flush ( FILE *  f)

Here is the call graph for this function:

DLLEXPORT void W32GC_Forwd ( int  n)

Here is the call graph for this function:

DLLEXPORT int W32GC_Get_Char0 ( )

Here is the call graph for this function:

DLLEXPORT int W32GC_Get_Line_Buffering ( void  )
DLLEXPORT void W32GC_Ins_Mode ( int  ins_mode)
DLLEXPORT int W32GC_Kbd_Is_Not_Empty ( )
DLLEXPORT void W32GC_Message_Box ( char *  title,
char *  msg,
int  type 
)

Here is the call graph for this function:

Here is the caller graph for this function:

DLLEXPORT void W32GC_Put_Char ( int  c)

Here is the call graph for this function:

DLLEXPORT void W32GC_Screen_Size ( int *  row,
int *  col 
)
DLLEXPORT void W32GC_Set_Line_Buffering ( int  is_buffered)

Here is the call graph for this function:

Here is the caller graph for this function:

DLLEXPORT int W32GC_Start_Window ( char *(*)()  get_separators,
int(*)()  get_prompt_length,
PlLong(*)()  query_stack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static int CALLBACK WordBreakProc ( LPTSTR  lpcb,
int  ichCurrent,
int  cch,
int  code 
)
static

Here is the caller graph for this function:

Variable Documentation

int beep_on_error = 0
static
char buff_pathname[MAX_PATH]
static
int copy_on_sel = 1
static
CRITICAL_SECTION cs_queue
static
LOGFONT currentFont
static
int dont_use_selection
static
int ec_start = 0
static
HANDLE event_char_in_queue
static
HANDLE event_window_is_ready
static
int(* fct_get_prompt_length) ()
static
char*(* fct_get_separators) ()
static
PlLong(* fct_query_stack) ()
static
HFONT hFont
static
HINSTANCE hInst
static
HWND hwnd_console
static
HWND hwndEditControl
static
HWND hwndMain
static
int idc_cur_sz
int idc_def_sz
int idc_desc
int idc_env_var_name
int idc_env_var_sz
int idc_reg_sz
int in_get_char = 0
static
int last_is_read = 0
static
int line_buffering = 1
static
WNDPROC lpEProc
static
int posit = 0
static
unsigned int queue[EDIT_FIELD_SIZE]
static
int queue_end
static
int queue_start
static
int show_console = 0
static
struct { ... } stk[]
Initial value:
= {
}
#define IDC_REG_SZ1
Definition: w32_resource.h:17
#define IDC_ENV_SZ1
Definition: w32_resource.h:15
#define IDC_CUR_SZ4
Definition: w32_resource.h:60
#define IDC_STACK_DESC2
Definition: w32_resource.h:41
#define IDC_STACK_DESC0
Definition: w32_resource.h:9
#define IDC_ENV_VAR_NAME0
Definition: w32_resource.h:16
#define IDC_ENV_VAR_NAME3
Definition: w32_resource.h:48
#define IDC_DEF_SZ0
Definition: w32_resource.h:13
#define IDC_STACK_DESC1
Definition: w32_resource.h:10
#define IDC_ENV_SZ0
Definition: w32_resource.h:14
#define IDC_ENV_VAR_NAME4
Definition: w32_resource.h:57
#define IDC_ENV_VAR_NAME2
Definition: w32_resource.h:43
#define IDC_CUR_SZ2
Definition: w32_resource.h:52
#define IDC_REG_SZ0
Definition: w32_resource.h:40
#define IDC_CUR_SZ0
Definition: w32_resource.h:18
#define IDC_REG_SZ3
Definition: w32_resource.h:50
#define IDC_ENV_SZ4
Definition: w32_resource.h:58
#define IDC_REG_SZ4
Definition: w32_resource.h:59
#define IDC_STACK_DESC3
Definition: w32_resource.h:46
#define IDC_REG_SZ2
Definition: w32_resource.h:45
#define IDC_ENV_VAR_NAME1
Definition: w32_resource.h:12
#define IDC_DEF_SZ4
Definition: w32_resource.h:56
#define IDC_DEF_SZ3
Definition: w32_resource.h:47
#define IDC_ENV_SZ2
Definition: w32_resource.h:44
#define IDC_STACK_DESC4
Definition: w32_resource.h:55
#define IDC_ENV_SZ3
Definition: w32_resource.h:49
#define IDC_CUR_SZ3
Definition: w32_resource.h:53
#define IDC_DEF_SZ1
Definition: w32_resource.h:11
#define IDC_CUR_SZ1
Definition: w32_resource.h:51
#define IDC_DEF_SZ2
Definition: w32_resource.h:42
int win_height = CW_USEDEFAULT
static
int win_width = CW_USEDEFAULT
static
int win_x = CW_USEDEFAULT
static
int win_y = CW_USEDEFAULT
static
char wr_buffer[10240]
static
char* wr_buffer_ptr = wr_buffer
static
int wrap_mode = 0
static