lib/wrappers/c-r - Dropped 'T' from types

This commit is contained in:
pdw 2015-05-24 22:43:13 -05:00 • committed by Araq
commit b2bc5440aa
14 changed files with 1458 additions and 1309 deletions

View file

@ -28,16 +28,17 @@ const
import times, rltypedefs
type
Thistdata* = pointer
Histdata* = pointer
{.deprecated: [Thistdata: Histdata].}
# The structure used to store a history entry.
type
THIST_ENTRY*{.pure, final.} = object
HIST_ENTRY*{.pure, final.} = object
line*: cstring
timestamp*: cstring # char * rather than time_t for read/write
data*: Thistdata
data*: Histdata
{.deprecated: [THIST_ENTRY: HIST_ENTRY].}
# Size of the history-library-managed space in history entry HS.
@ -47,12 +48,13 @@ template HISTENT_BYTES*(hs: expr): expr =
# A structure used to pass the current state of the history stuff around.
type
THISTORY_STATE*{.pure, final.} = object
entries*: ptr ptr THIST_ENTRY # Pointer to the entries themselves.
HISTORY_STATE*{.pure, final.} = object
entries*: ptr ptr HIST_ENTRY # Pointer to the entries themselves.
offset*: cint # The location pointer within this array.
length*: cint # Number of elements within this array.
size*: cint # Number of slots allocated to this array.
flags*: cint
{.deprecated: [THISTORY_STATE: HISTORY_STATE].}
# Flag values for the `flags' member of HISTORY_STATE.
@ -67,11 +69,11 @@ const
proc using_history*(){.cdecl, importc: "using_history", dynlib: historyDll.}
# Return the current HISTORY_STATE of the history.
proc history_get_history_state*(): ptr THISTORY_STATE{.cdecl,
proc history_get_history_state*(): ptr HISTORY_STATE{.cdecl,
importc: "history_get_history_state", dynlib: historyDll.}
# Set the state of the current history array to STATE.
proc history_set_history_state*(a2: ptr THISTORY_STATE){.cdecl,
proc history_set_history_state*(a2: ptr HISTORY_STATE){.cdecl,
importc: "history_set_history_state", dynlib: historyDll.}
# Manage the history list.
# Place STRING at the end of the history list.
@ -88,18 +90,18 @@ proc add_history_time*(a2: cstring){.cdecl, importc: "add_history_time",
# is the magic number that tells us which element to delete. The
# elements are numbered from 0.
proc remove_history*(a2: cint): ptr THIST_ENTRY{.cdecl,
proc remove_history*(a2: cint): ptr HIST_ENTRY{.cdecl,
importc: "remove_history", dynlib: historyDll.}
# Free the history entry H and return any application-specific data
# associated with it.
proc free_history_entry*(a2: ptr THIST_ENTRY): Thistdata{.cdecl,
proc free_history_entry*(a2: ptr HIST_ENTRY): Histdata{.cdecl,
importc: "free_history_entry", dynlib: historyDll.}
# Make the history entry at WHICH have LINE and DATA. This returns
# the old entry so you can dispose of the data. In the case of an
# invalid WHICH, a NULL pointer is returned.
proc replace_history_entry*(a2: cint, a3: cstring, a4: Thistdata): ptr THIST_ENTRY{.
proc replace_history_entry*(a2: cint, a3: cstring, a4: Histdata): ptr HIST_ENTRY{.
cdecl, importc: "replace_history_entry", dynlib: historyDll.}
# Clear the history list and start over.
@ -123,7 +125,7 @@ proc history_is_stifled*(): cint{.cdecl, importc: "history_is_stifled",
# history. Element 0 of this list is the beginning of time. If there
# is no history, return NULL.
proc history_list*(): ptr ptr THIST_ENTRY{.cdecl, importc: "history_list",
proc history_list*(): ptr ptr HIST_ENTRY{.cdecl, importc: "history_list",
dynlib: historyDll.}
# Returns the number which says what history element we are now
# looking at.
@ -132,17 +134,17 @@ proc where_history*(): cint{.cdecl, importc: "where_history", dynlib: historyDll
# Return the history entry at the current position, as determined by
# history_offset. If there is no entry there, return a NULL pointer.
proc current_history*(): ptr THIST_ENTRY{.cdecl, importc: "current_history",
proc current_history*(): ptr HIST_ENTRY{.cdecl, importc: "current_history",
dynlib: historyDll.}
# Return the history entry which is logically at OFFSET in the history
# array. OFFSET is relative to history_base.
proc history_get*(a2: cint): ptr THIST_ENTRY{.cdecl, importc: "history_get",
proc history_get*(a2: cint): ptr HIST_ENTRY{.cdecl, importc: "history_get",
dynlib: historyDll.}
# Return the timestamp associated with the HIST_ENTRY * passed as an
# argument
proc history_get_time*(a2: ptr THIST_ENTRY): Time{.cdecl,
proc history_get_time*(a2: ptr HIST_ENTRY): Time{.cdecl,
importc: "history_get_time", dynlib: historyDll.}
# Return the number of bytes that the primary history entries are using.
# This just adds up the lengths of the_history->lines.
@ -158,13 +160,13 @@ proc history_set_pos*(a2: cint): cint{.cdecl, importc: "history_set_pos",
# a pointer to that entry. If there is no previous entry, return
# a NULL pointer.
proc previous_history*(): ptr THIST_ENTRY{.cdecl, importc: "previous_history",
proc previous_history*(): ptr HIST_ENTRY{.cdecl, importc: "previous_history",
dynlib: historyDll.}
# Move history_offset forward to the next item in the input_history,
# and return the a pointer to that entry. If there is no next entry,
# return a NULL pointer.
proc next_history*(): ptr THIST_ENTRY{.cdecl, importc: "next_history",
proc next_history*(): ptr HIST_ENTRY{.cdecl, importc: "next_history",
dynlib: historyDll.}
# Searching the history list.
# Search the history for STRING, starting at history_offset.

View file

@ -78,9 +78,10 @@ const
# TYPE says which kind of thing FUNCTION is.
type
TKEYMAP_ENTRY*{.pure, final.} = object
KEYMAP_ENTRY*{.pure, final.} = object
typ*: char
function*: TCommandFunc
{.deprecated: [TKEYMAP_ENTRY: KEYMAP_ENTRY].}
# This must be large enough to hold bindings for all of the characters
@ -97,8 +98,9 @@ const
# Maybe I need C lessons.
type
TKEYMAP_ENTRY_ARRAY* = array[0..KEYMAP_SIZE - 1, TKEYMAP_ENTRY]
PKeymap* = ptr TKEYMAP_ENTRY
KEYMAP_ENTRY_ARRAY* = array[0..KEYMAP_SIZE - 1, KEYMAP_ENTRY]
PKeymap* = ptr KEYMAP_ENTRY
{.deprecated: [TKEYMAP_ENTRY_ARRAY: KEYMAP_ENTRY_ARRAY].}
# The values that TYPE can have in a keymap entry.
@ -110,12 +112,12 @@ const
when false:
var
emacs_standard_keymap*{.importc: "emacs_standard_keymap",
dynlib: readlineDll.}: TKEYMAP_ENTRY_ARRAY
emacs_meta_keymap*{.importc: "emacs_meta_keymap", dynlib: readlineDll.}: TKEYMAP_ENTRY_ARRAY
emacs_ctlx_keymap*{.importc: "emacs_ctlx_keymap", dynlib: readlineDll.}: TKEYMAP_ENTRY_ARRAY
dynlib: readlineDll.}: KEYMAP_ENTRY_ARRAY
emacs_meta_keymap*{.importc: "emacs_meta_keymap", dynlib: readlineDll.}: KEYMAP_ENTRY_ARRAY
emacs_ctlx_keymap*{.importc: "emacs_ctlx_keymap", dynlib: readlineDll.}: KEYMAP_ENTRY_ARRAY
var
vi_insertion_keymap*{.importc: "vi_insertion_keymap", dynlib: readlineDll.}: TKEYMAP_ENTRY_ARRAY
vi_movement_keymap*{.importc: "vi_movement_keymap", dynlib: readlineDll.}: TKEYMAP_ENTRY_ARRAY
vi_insertion_keymap*{.importc: "vi_insertion_keymap", dynlib: readlineDll.}: KEYMAP_ENTRY_ARRAY
vi_movement_keymap*{.importc: "vi_movement_keymap", dynlib: readlineDll.}: KEYMAP_ENTRY_ARRAY
# Return a new, empty keymap.
# Free it with free() when you are done.
@ -154,7 +156,8 @@ const
tildeDll = readlineDll
type
Thook_func* = proc (a2: cstring): cstring{.cdecl.}
Hook_func* = proc (a2: cstring): cstring{.cdecl.}
{.deprecated: [Thook_func: Hook_func].}
when not defined(macosx):
# If non-null, this contains the address of a function that the application
@ -163,7 +166,7 @@ when not defined(macosx):
# which is the expansion, or a NULL pointer if the expansion fails.
var expansion_preexpansion_hook*{.importc: "tilde_expansion_preexpansion_hook",
dynlib: tildeDll.}: Thook_func
dynlib: tildeDll.}: Hook_func
# If non-null, this contains the address of a function to call if the
# standard meaning for expanding a tilde fails. The function is called
@ -171,7 +174,7 @@ when not defined(macosx):
# which is the expansion, or a NULL pointer if there is no expansion.
var expansion_failure_hook*{.importc: "tilde_expansion_failure_hook",
dynlib: tildeDll.}: Thook_func
dynlib: tildeDll.}: Hook_func
# When non-null, this is a NULL terminated array of strings which
# are duplicates for a tilde prefix. Bash uses this to expand
@ -214,35 +217,38 @@ const
# the code tells undo what to undo, not how to undo it.
type
Tundo_code* = enum
Undo_code* = enum
UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END
{.deprecated: [Tundo_code: Undo_code].}
# What an element of THE_UNDO_LIST looks like.
type
TUNDO_LIST*{.pure, final.} = object
next*: ptr Tundo_list
UNDO_LIST*{.pure, final.} = object
next*: ptr UNDO_LIST
start*: cint
theEnd*: cint # Where the change took place.
text*: cstring # The text to insert, if undoing a delete.
what*: Tundo_code # Delete, Insert, Begin, End.
what*: Undo_code # Delete, Insert, Begin, End.
{.deprecated: [TUNDO_LIST: UNDO_LIST].}
# The current undo list for RL_LINE_BUFFER.
when not defined(macosx):
var undo_list*{.importc: "rl_undo_list", dynlib: readlineDll.}: ptr TUNDO_LIST
var undo_list*{.importc: "rl_undo_list", dynlib: readlineDll.}: ptr UNDO_LIST
# The data structure for mapping textual names to code addresses.
type
TFUNMAP*{.pure, final.} = object
FUNMAP*{.pure, final.} = object
name*: cstring
function*: TCommandFunc
{.deprecated: [TFUNMAP: FUNMAP].}
when not defined(macosx):
var funmap*{.importc: "funmap", dynlib: readlineDll.}: ptr ptr TFUNMAP
var funmap*{.importc: "funmap", dynlib: readlineDll.}: ptr ptr FUNMAP
# ****************************************************************
#
@ -697,7 +703,7 @@ proc push_macro_input*(a2: cstring){.cdecl, importc: "rl_push_macro_input",
dynlib: readlineDll.}
# Functions for undoing, from undo.c
proc add_undo*(a2: Tundo_code, a3: cint, a4: cint, a5: cstring){.cdecl,
proc add_undo*(a2: Undo_code, a3: cint, a4: cint, a5: cstring){.cdecl,
importc: "rl_add_undo", dynlib: readlineDll.}
proc free_undo_list*(){.cdecl, importc: "rl_free_undo_list", dynlib: readlineDll.}
proc do_undo*(): cint{.cdecl, importc: "rl_do_undo", dynlib: readlineDll.}
@ -816,7 +822,7 @@ proc complete_internal*(a2: cint): cint{.cdecl, importc: "rl_complete_internal",
dynlib: readlineDll.}
proc display_match_list*(a2: cstringArray, a3: cint, a4: cint){.cdecl,
importc: "rl_display_match_list", dynlib: readlineDll.}
proc completion_matches*(a2: cstring, a3: Tcompentry_func): cstringArray{.
proc completion_matches*(a2: cstring, a3: Compentry_func): cstringArray{.
cdecl, importc: "rl_completion_matches", dynlib: readlineDll.}
proc username_completion_function*(a2: cstring, a3: cint): cstring{.cdecl,
importc: "rl_username_completion_function", dynlib: readlineDll.}
@ -1169,13 +1175,13 @@ template ISSTATE*(x: expr): expr =
(readline_state and x) != 0
type
Treadline_state*{.pure, final.} = object
Readline_state*{.pure, final.} = object
point*: cint # line state
theEnd*: cint
mark*: cint
buffer*: cstring
buflen*: cint
ul*: ptr TUNDO_LIST
ul*: ptr UNDO_LIST
prompt*: cstring # global state
rlstate*: cint
done*: cint
@ -1194,9 +1200,10 @@ type
# options state
# reserved for future expansion, so the struct size doesn't change
reserved*: array[0..64 - 1, char]
{.deprecated: [Treadline_state: Readline_state].}
proc save_state*(a2: ptr Treadline_state): cint{.cdecl,
proc save_state*(a2: ptr Readline_state): cint{.cdecl,
importc: "rl_save_state", dynlib: readlineDll.}
proc restore_state*(a2: ptr Treadline_state): cint{.cdecl,
proc restore_state*(a2: ptr Readline_state): cint{.cdecl,
importc: "rl_restore_state", dynlib: readlineDll.}

View file

@ -19,27 +19,32 @@
#
type
TFunction* = proc (): cint{.cdecl.}
TVFunction* = proc (){.cdecl.}
TCPFunction* = proc (): cstring{.cdecl.}
TCPPFunction* = proc (): cstringArray{.cdecl.}
Function* = proc (): cint{.cdecl.}
VFunction* = proc (){.cdecl.}
CPFunction* = proc (): cstring{.cdecl.}
CPPFunction* = proc (): cstringArray{.cdecl.}
{.deprecated: [TFunction: Function, TVFunction: VFunction,
TCPFunction: CPFunction, TCPPFunction: CPPFunction].}
# Bindable functions
type
Tcommand_func* = proc (a2: cint, a3: cint): cint{.cdecl.}
Command_func* = proc (a2: cint, a3: cint): cint{.cdecl.}
{.deprecated: [Tcommand_func: Command_func].}
# Typedefs for the completion system
type
Tcompentry_func* = proc (a2: cstring, a3: cint): cstring{.cdecl.}
Tcompletion_func* = proc (a2: cstring, a3: cint, a4: cint): cstringArray{.
Compentry_func* = proc (a2: cstring, a3: cint): cstring{.cdecl.}
Completion_func* = proc (a2: cstring, a3: cint, a4: cint): cstringArray{.
cdecl.}
Tquote_func* = proc (a2: cstring, a3: cint, a4: cstring): cstring{.cdecl.}
Tdequote_func* = proc (a2: cstring, a3: cint): cstring{.cdecl.}
Tcompignore_func* = proc (a2: cstringArray): cint{.cdecl.}
Tcompdisp_func* = proc (a2: cstringArray, a3: cint, a4: cint){.cdecl.}
Quote_func* = proc (a2: cstring, a3: cint, a4: cstring): cstring{.cdecl.}
Dequote_func* = proc (a2: cstring, a3: cint): cstring{.cdecl.}
Compignore_func* = proc (a2: cstringArray): cint{.cdecl.}
Compdisp_func* = proc (a2: cstringArray, a3: cint, a4: cint){.cdecl.}
{.deprecated: [Tcompentry_func: Compentry_func,Tcompletion_func: Completion_func,
Tquote_func: Quote_func, Tdequote_func: Dequote_func,
Tcompignore_func: Compignore_func, Tcompdisp_func: Compdisp_func].}
# Type for input and pre-read hook functions like rl_event_hook
type