Commit graph

62 commits

Author SHA1 Message Date
Charlie Gordon
6402058e14 ignore case when matching extensions.
* ignore case in match_extension() used for mode selection
2014-02-07 07:38:30 +00:00
Charlie Gordon
c5f56a0d5b Fix memory leaks and bad references detected by valgrind
* add free_font_cache()
* add css_free_colors()
* add unload_ligatures()
* add --free-all cmd line option to free memory upon exit for valgrind
* tty.c: fix off by 3 size in qe_realloc. Should be typed
* qe.c: fix invalid pointer reference upon destroying transient buffer
2014-01-24 00:46:26 +00:00
Charlie Gordon
e967914b5a improve consistency in new/delete methodology
* use qe_mallocz for all structures
* prevent spurious uses of malloc/free/realloc
* pass pointers to pointers to all deletion functions
* use consistent patterns for list deletions
* add more dependencies in Makefiles
2014-01-23 12:56:22 +00:00
Charlie Gordon
890af446cf simplify colorize_line functions: always pass NUL terminated line
* added ustrstart, ustrstr and ustristr utility functions
* simplified org_mode_colorize
2014-01-20 18:04:00 +00:00
Charlie Gordon
2f98140860 add buf_put_key, buf_put_keys, use buf_t more consistently
* changed keytostr to buf_put_key using buf_t structure
* changed keys_to_str tp buf_put_keys using buf_t structure
* add buf_attach to initialize buf_t with non empty buffer
* simplify qe_list_bindings with inherit argument
2014-01-16 14:24:03 +00:00
Charlie Gordon
ccbf2991cf allow NULL extlist in match_extension 2014-01-02 10:12:59 +00:00
Charlie Gordon
67ecab27b5 changed match_extension utility function
* allow multiple extensions eg: |tar.gz|
2013-12-23 23:39:02 +00:00
Charlie Gordon
c1833a2f53 added make_user_path to compute path relative to user HOME directory 2013-12-03 17:35:06 +00:00
Charlie Gordon
9a684a9c25 patch for OS/X to expand user home dir to /Users/xxx instead of /home/xxx
this is a poor solution, should use a more generic method.
2013-11-28 15:52:38 +00:00
Charlie Gordon
23cd92e91c fixed find-charset to use strxfind, implement strxfind correctly 2008-05-04 15:54:39 +00:00
Charlie Gordon
b82a15d4e4 added extra help functions:
added command apropos(string)
added command show-bindings(cmd_name)
moved describe-bindings to extras.c
added qe_get_prototype(CmdDef *d, char *buf, int size);
added an extra argument to qe_get_variable() to produce value as source
fixed typo on window variable window-height
fixed type mismatch on mode variable mode-name
added var_domain string array
added strquote conversion function with simplistic implementation
added history tags for all commands
2008-04-29 18:55:14 +00:00
Charlie Gordon
7bde58c799 renamed qe_collate -> qe_strcollate, cosmetics 2008-04-22 08:15:04 +00:00
Charlie Gordon
a454cbc152 moved get_basename, get_extension, and get_dirname to cutils.h/c
added wrappers for get_basename_nc and get_basename_offset
added wrappers for get_extension_nc and get_extension_offset
added strip_extension
use these where appropriate
remove duplicate definitions in stand-alone utilities
2008-04-22 08:11:55 +00:00
Charlie Gordon
083d96dc3c remark 2008-04-20 11:51:58 +00:00
Charlie Gordon
58b5872c52 fixed OpenBSD compile issues:
- check OpenBSD as uname output
- no longer use strcpy, strcat, sprintf
- added CONFIG_PTSNAME to disable Unix98 API under BSD
- fixed crash bug in tty.c on empty window
2008-04-15 23:24:03 +00:00
Charlie Gordon
53bf5ef8c2 fixed qe_collate to sort system buffers last 2008-04-15 08:14:07 +00:00
Charlie Gordon
597e4a48a0 renamed extension() to get_extension() for consistency
added safe cast functions s8(): u8* -> char * and const variant cs8()
strip # suffix in reduce_filename()
2008-04-09 16:15:45 +00:00
Charlie Gordon
2d0783cfd9 renames basename to get_basename to avoid conflicts 2008-04-08 06:54:44 +00:00
Charlie Gordon
d4d6f8a0f3 fixed some configure issues for mingw compile under cygwin
added CONFIG_MMAP to control availability of memory mapped files
added CONFIG_DOC to control doc rebuild
use state variables to control file mmapping and loading
default limit of 512MB for loading file
try and load the file upon mmap failure
do not use alloca in CONFIG_WIN32
use CONFIG_WIN32 instead of WIN32
update Makefile to enable win32 build under cygwin (dumps core)
renamed mouse_event to prevent compile warning
patched unix.c util.c win32.c to enable WIN32 compile
fixed kmap.c to load mapping files when mmap fails or is unavailable
2008-04-05 23:04:56 +00:00
Charlie Gordon
f430a35836 fixed defined macros bug: first key was combined with current
no longer use register_bottom_half for current keyboard macro
added QEmacsState::executing_macro to prevent double store of macro keys
accept regular text as self insert in defined macros
2008-03-30 12:02:01 +00:00
Charlie Gordon
1ccf1aec26 added is_directory 2008-03-28 12:21:39 +00:00
Charlie Gordon
6106adfa09 fixed bug in buf_putc_utf8 2008-03-26 20:32:47 +00:00
Charlie Gordon
54b6f9c641 added reduce_filename to compute a stripped filename for mode probing
stripping VCS/backup prefixes and suffixes, fixing case.
added Lex (.l .lex) and .C files to C mode
fixed spurious error message at edit_set_mode_file
restored standard behaviour for extension() : return pointer to last extension
2008-03-26 08:03:55 +00:00
Charlie Gordon
74f5008613 ignore numeric extensions in extension() and match_extension() 2008-03-25 11:05:45 +00:00
Charlie Gordon
9516917f97 added variables.h and variables.c for configurable state and window properties
cleaned up Makefile
renamed ModeDef::mode_line function pointer to get_mode_line
fixed some sparse warnings
use c99 syntax in video.c and image.c
added EditBuffer::offset for buffer parsing
added state variables QEmacsState::it, QEmacsState::ignore_spaces,
   QEmacsState::mmap_threshold
support variables in config file, strings can be delimited with ' and "
2008-01-18 17:03:35 +00:00
Charlie Gordon
28397f424f moved input_methods to QEmacsState
qe_register_binding takes ModeDef* and returns status
cosmetic changes in QEDisplay API
added int dpy_init(QEditScreen *s, QEDisplay *dpy, int w, int h);
  copies *dpy (or dummy_dpy if NULL) to QEditScreen and calls method
simplified dpy_init methods and calls
inlined 5 more methods
moved dummy_dpy to display.c and simplified
simplified to_hex
simplified qe_colors array handling
2008-01-11 11:29:28 +00:00
Charlie Gordon
a5eae3ed92 bumped copyrights, some cosmetics 2008-01-08 16:37:54 +00:00
Charlie Gordon
98939ddcac changed API for completion functions:
- use CompleteState struct
- use complete_test for each potential match with simple prefix comparison
added new smart string compare function qe_collate to sort strings in
  lexicographical order but sort numeric portions in numerical order
use qe_collate in popup lists and dired
removed redundant alias "iso8859-2"
added strequal(a,b) as an alias for !strcmp(a,b)
  this function makes string collation with strcmp more explicit
  this even fixed a spurious bug in do_set_emulation
2008-01-08 03:42:53 +00:00
Charlie Gordon
ae163f897b fixed crash on charset_completion
renamed css_strtolower -> qe_strtolower
use offsetof for SAVED_DATA_SIZE macro (this stuff must go)
cosmetics in css_get_enum
remarks
fixed text-mode colorization bug: because of saved_data stuff,
  must reset colorization function after mode restore.  This saved data
  stuff is bogus and should be rewritten
smaller version of roman numeral converter
fixed alpha converter
smaller implementation of css_counter_str
fixed list_mode name: no longer generates extra mode completion entry
2008-01-07 16:25:22 +00:00
Charlie Gordon
f11cf4a207 eb_scratch takes buffer creation flags
added eb_find_new -> find a buffer by name, create one from flags if not found.
qe_register_cmd_table takes ModeDef* instead of mode name
do_global_set_key -> do_set_key with local/global flag
added local-set-key
reuse *bufed* buffer if one exists
bind increase/decrease-width commands from command definition
cosmetics, comments, remarks
renamed kill buffers from *yank* to *kill-%d*
save QErrorContext in parse_args, load_all_modules:
  improves readability in *messages* buffer
fixed qe_init to fall back from x11 display to terminal session upon failure
2008-01-04 22:24:37 +00:00
Charlie Gordon
a71b9efbb4 renamed do_set_mode -> edit_set_mode
use match_extension in mode probe functions
pass move indicator to do_return, removed do_open_line
renamed do_cmd_set_mode -> do_set_mode for consistency
separated strfind and strcasefind, optimized implementation
published register_input_method
unpublished input_methods
optimized KeyDef structure layout
changed eb_search arguments
used eb_delete_range
comments, remarks
better tests on fread failures
set buffer to read-only upon loading non writable file
do_insert_file tests for failure
  set mark at beginning of inserted block and offset at the end
fixed search for word boundary case
made raw_load_buffer1 return number of bytes read, of -1 on error
2008-01-03 18:31:24 +00:00
Charlie Gordon
4743fa1308 added remove_slash and append_slash path utilities
renamed canonize to canonicalize
added crude support for ~user -> /home/user
added win32 specific stuff in basename
added C-/ as an alias for C-_
some cosmetics, moved code
create files with mode 0644 in raw_save_buffer
untabified, removed redundant spaces
modified code generators to the same effect
2008-01-03 09:51:29 +00:00
Charlie Gordon
aefd95484f added const void *memstr(const void *buf, int size, const char *str);
added line_len and total_size in ModeProbeData structure
extended SEARCH_LENGTH to 256, allowing upto 256 matches in incremental C-s
2007-12-21 14:27:11 +00:00
Charlie Gordon
8a2ad8b193 made color table handling simpler and more consistent 2007-12-21 12:30:34 +00:00
Charlie Gordon
c6514ec938 cosmetics 2007-12-20 11:45:45 +00:00
Charlie Gordon
740f087f60 added defines for MAX_BUFFERNAME_SIZE (256) and MAX_CMDNAME_SIZE (32)
added char *get_dirname(char *dest, int size, const char *file);
added int match_extension(const char *filename, const char *extlist);
fixed prototype for umemmove
added umemcpy, umemcmp
added int get_clock_usec(void);
increased NB_LOGS_MAX to 100000 (was 50 !)
eb_printf return int
added various disabled fields in structures
added int scale(int a, int b, int c);
added "grey" color
added int get_clock_usec(void);
2007-12-18 17:57:11 +00:00
Charlie Gordon
bf17e23390 renamed css_isxxx and css_toxxx ctype alternatives to qe_* 2007-12-15 16:44:31 +00:00
Charlie Gordon
5768f42cd8 no longer use ctype.h macros and functions
- ctype.h has strong constraints on arguments
- ctype.h implements bogus irrelevant inefficient locale specific behaviour
- use replacement css_xxx functions
- all take int arguments: can be any value, yet only test ASCII subset
- all css_isxxx return true boolean (1 or 0)
- removed utoupper(int) -> css_toupper(int) has same functionality

resolved ffmpeg clash on string functions from cutils.c module
- added #defines to make them local
- renamed some strixxx functions to strxxxx (extended behaviour)
- moved case insensitive stuff to util.c

fixed bug in strtokey: C-M-x combinations were not recognized
improved eb_changecase
fixed C comment parsing in css parser
2007-12-15 16:02:47 +00:00
Charlie Gordon
f9f6b42059 fixed subtle bug in qe_realloc: store NULL ptr upon realloc to size 0 2007-12-13 23:13:11 +00:00
Charlie Gordon
26ea3f69a0 added wrappers and utilities for safer memory allocation:
type *qe_malloc(type);
type *qe_mallocz(type);
type *qe_malloc_array(type, count);
type *qe_mallocz_array(type, count);
type *qe_malloc_hack(type, extra_bytes);
type *qe_mallocz_hack(type, extra_bytes);
void qe_free(&ptr);
void *qe_realloc(&ptr, new_size);
char *qe_strdup(const char *str);
void *qe_malloc_bytes(size_t size);
void *qe_mallocz_bytes(size_t size);
void *qe_malloc_dup(const void *src, size_t size);

pass pointer address to bmp_free()
2007-12-12 11:49:02 +00:00
Charlie Gordon
57c3461e0d simplified set_color API, made in inline
improved command parsing, refined argval handling, pass as optional arg
pass command arguments as an array of unions
use correct type in command dispatcher (upto 2 arguments)
merged do_goto_byte, do_goto_line, do_goto_char, extend syntax
fixed kill commands: kills are appended/prepended to kill buffer
added append_next_kill command
added do_kill_line (split from do_kill_region)
added do_kill_word (removed do_delete_word)
added do_kill_paragraph
pass argval to do_backspace and do_delete_char, fix kill behaviour
fixed kill-ring initial state bug
fixed do_yank: set mark and this_cmd_func
fixed do_yank_pop: test last_cmd_func, use eb_delete instead of do_undo
fixed do_yank_pop kill-ring bug
added clamp(int x, int min, int max);
added qs->this_cmd_func so commands can override qs->last_cmd_func
allow KEY_ESC + extended key as command binding
added do_c_forward_block, needs rewrite using colorization code
added do_c_kill_block
added insert-char command (argval repeats instead of forcing char value)
renamed delete-word to kill-word
renamed backward-delete-word to backward-kill-word
added kill-beginning-of-line
2007-12-12 02:51:05 +00:00
Charlie Gordon
0507ffacc3 fixed function key mapping issues in X11 and Wndz
fixed C lang colorizer for some multiline stuff, wide char/strings
use countof() macro
cosmetics
2007-12-10 13:28:07 +00:00
Charlie Gordon
d286b27756 made more local variables static
fixed bug in cfb32_fill_rectangle
use c99 syntax for new style struct initializers instead of gcc specific
simplified tolower unsigned char hacks
fixed various sparse warnings
2007-12-06 17:43:47 +00:00
Charlie Gordon
0446a52d21 added more charsets
simplified charset alias system
reorganized charset functions
groomed completion functions
2007-12-06 15:28:29 +00:00
Charlie Gordon
6c65411200 added missing headings, cosmetics 2007-12-03 16:10:38 +00:00
Charlie Gordon
a0bfcd45bd fixed unsigned char issues
added TODOs
bumped version to 0.4.0dev
mention chqrlie in --version
cosmetics: reindented Makefile
2007-02-06 17:41:16 +00:00
Charlie Gordon
494e9f7866 include cflags.mk for extra gcc warnings if present
utf8_encode now returns the number of characters copied,
  simplified code accordingly
made local functions static
tagged unused function arguments
fixed shadowing issues
added support for GCC attributes for unused arguments and format strings
use snprintf() instead of sprintf()
moved scattered declarations to qe.h
removed duplicate declarations in header files
eb_write() payload argument is now const
fixed crash bug: reset trace_buffer upon deletion
improved trace_buffer readability: trace all pseudo tty streams separately
added missing structure initializers
removed buffered string handling from cutils.h
added new buffered string API for statically allocated buffers (should unify)
small improvements in X11 initialization
improved consistency in tty.c (function names...)
  added STDIN and STDOUT streams in QEditScreen to stop using stdin and stdout
  use unlocked stream I/O if available (faster)
  changed and documented terminal setup and exit sequences
  improved charset handling
mode_line functions now return the character count (like snprintf)
2006-12-31 19:34:00 +00:00
Charlie Gordon
e549c9ae96 made color names case insensitive, simplified color_completion 2006-12-11 23:04:21 +00:00
Charlie Gordon
d447798717 added missing licence header
fixed typos
added constness
comments about potential problems
identified 64 bit portability problem
fixed small issue in get_default_path()
allow signed numbers in config file
added comments about old code for reference (tty.c, shell.c)
2006-12-09 19:47:20 +00:00
Charlie Gordon
bfc549ce42 initialize all fields in find_file_open 2006-04-27 15:24:14 +00:00