now generating API headers and docs solely from the implementation file, thus eliminating the declaration/definition duplication

This commit is contained in:
Allen Webster 2016-06-27 11:52:58 -04:00
parent f458ba2113
commit ed29d04c10
11 changed files with 729 additions and 614 deletions

View File

@ -26,143 +26,143 @@ This is the documentation for alpha 4.0.8 super! The documentation has been made
<h3>&sect;2.1 Function List</h3> <h3>&sect;2.1 Function List</h3>
<ul> <ul>
<li> <li>
<a href='#2.2.0'>exec_command</a> <a href='#exec_command_doc'>exec_command</a>
</li> </li>
<li> <li>
<a href='#2.2.1'>exec_system_command</a> <a href='#exec_system_command_doc'>exec_system_command</a>
</li> </li>
<li> <li>
<a href='#2.2.2'>directory_get_hot</a> <a href='#clipboard_post_doc'>clipboard_post</a>
</li> </li>
<li> <li>
<a href='#2.2.3'>get_4ed_path</a> <a href='#clipboard_count_doc'>clipboard_count</a>
</li> </li>
<li> <li>
<a href='#2.2.4'>file_exists</a> <a href='#clipboard_index_doc'>clipboard_index</a>
</li> </li>
<li> <li>
<a href='#2.2.5'>directory_cd</a> <a href='#get_buffer_first_doc'>get_buffer_first</a>
</li> </li>
<li> <li>
<a href='#2.2.6'>get_file_list</a> <a href='#get_buffer_next_doc'>get_buffer_next</a>
</li> </li>
<li> <li>
<a href='#2.2.7'>free_file_list</a> <a href='#get_buffer_doc'>get_buffer</a>
</li> </li>
<li> <li>
<a href='#2.2.8'>clipboard_post</a> <a href='#get_buffer_by_name_doc'>get_buffer_by_name</a>
</li> </li>
<li> <li>
<a href='#2.2.9'>clipboard_count</a> <a href='#buffer_boundary_seek_doc'>buffer_boundary_seek</a>
</li> </li>
<li> <li>
<a href='#2.2.10'>clipboard_index</a> <a href='#buffer_read_range_doc'>buffer_read_range</a>
</li> </li>
<li> <li>
<a href='#2.2.11'>get_buffer_first</a> <a href='#buffer_replace_range_doc'>buffer_replace_range</a>
</li> </li>
<li> <li>
<a href='#2.2.12'>get_buffer_next</a> <a href='#buffer_set_setting_doc'>buffer_set_setting</a>
</li> </li>
<li> <li>
<a href='#2.2.13'>get_buffer</a> <a href='#buffer_auto_indent_doc'>buffer_auto_indent</a>
</li> </li>
<li> <li>
<a href='#2.2.14'>get_buffer_by_name</a> <a href='#create_buffer_doc'>create_buffer</a>
</li> </li>
<li> <li>
<a href='#2.2.15'>buffer_seek</a> <a href='#save_buffer_doc'>save_buffer</a>
</li> </li>
<li> <li>
<a href='#2.2.16'>buffer_read_range</a> <a href='#kill_buffer_doc'>kill_buffer</a>
</li> </li>
<li> <li>
<a href='#2.2.17'>buffer_replace_range</a> <a href='#get_view_first_doc'>get_view_first</a>
</li> </li>
<li> <li>
<a href='#2.2.18'>buffer_set_setting</a> <a href='#get_view_next_doc'>get_view_next</a>
</li> </li>
<li> <li>
<a href='#2.2.19'>buffer_auto_indent</a> <a href='#get_view_doc'>get_view</a>
</li> </li>
<li> <li>
<a href='#2.2.20'>create_buffer</a> <a href='#get_active_view_doc'>get_active_view</a>
</li> </li>
<li> <li>
<a href='#2.2.21'>save_buffer</a> <a href='#view_compute_cursor_doc'>view_compute_cursor</a>
</li> </li>
<li> <li>
<a href='#2.2.22'>kill_buffer</a> <a href='#view_set_cursor_doc'>view_set_cursor</a>
</li> </li>
<li> <li>
<a href='#2.2.23'>get_view_first</a> <a href='#view_set_mark_doc'>view_set_mark</a>
</li> </li>
<li> <li>
<a href='#2.2.24'>get_view_next</a> <a href='#view_set_highlight_doc'>view_set_highlight</a>
</li> </li>
<li> <li>
<a href='#2.2.25'>get_view</a> <a href='#view_set_buffer_doc'>view_set_buffer</a>
</li> </li>
<li> <li>
<a href='#2.2.26'>get_active_view</a> <a href='#view_post_fade_doc'>view_post_fade</a>
</li> </li>
<li> <li>
<a href='#2.2.27'>view_compute_cursor</a> <a href='#view_set_paste_rewrite__doc'>view_set_paste_rewrite_</a>
</li> </li>
<li> <li>
<a href='#2.2.28'>view_set_cursor</a> <a href='#view_get_paste_rewrite__doc'>view_get_paste_rewrite_</a>
</li> </li>
<li> <li>
<a href='#2.2.29'>view_set_mark</a> <a href='#get_user_input_doc'>get_user_input</a>
</li> </li>
<li> <li>
<a href='#2.2.30'>view_set_highlight</a> <a href='#get_command_input_doc'>get_command_input</a>
</li> </li>
<li> <li>
<a href='#2.2.31'>view_set_buffer</a> <a href='#get_mouse_state_doc'>get_mouse_state</a>
</li> </li>
<li> <li>
<a href='#2.2.32'>view_post_fade</a> <a href='#start_query_bar_doc'>start_query_bar</a>
</li> </li>
<li> <li>
<a href='#2.2.33'>view_set_paste_rewrite_</a> <a href='#end_query_bar_doc'>end_query_bar</a>
</li> </li>
<li> <li>
<a href='#2.2.34'>view_get_paste_rewrite_</a> <a href='#print_message_doc'>print_message</a>
</li> </li>
<li> <li>
<a href='#2.2.35'>get_user_input</a> <a href='#change_theme_doc'>change_theme</a>
</li> </li>
<li> <li>
<a href='#2.2.36'>get_command_input</a> <a href='#change_font_doc'>change_font</a>
</li> </li>
<li> <li>
<a href='#2.2.37'>get_mouse_state</a> <a href='#set_theme_colors_doc'>set_theme_colors</a>
</li> </li>
<li> <li>
<a href='#2.2.38'>start_query_bar</a> <a href='#get_theme_colors_doc'>get_theme_colors</a>
</li> </li>
<li> <li>
<a href='#2.2.39'>end_query_bar</a> <a href='#directory_get_hot_doc'>directory_get_hot</a>
</li> </li>
<li> <li>
<a href='#2.2.40'>print_message</a> <a href='#get_file_list_doc'>get_file_list</a>
</li> </li>
<li> <li>
<a href='#2.2.41'>change_theme</a> <a href='#free_file_list_doc'>free_file_list</a>
</li> </li>
<li> <li>
<a href='#2.2.42'>change_font</a> <a href='#file_exists_doc'>file_exists</a>
</li> </li>
<li> <li>
<a href='#2.2.43'>set_theme_colors</a> <a href='#directory_cd_doc'>directory_cd</a>
</li> </li>
<li> <li>
<a href='#2.2.44'>get_theme_colors</a> <a href='#get_4ed_path_doc'>get_4ed_path</a>
</li> </li>
</ul> </ul>
<h3 style='margin-top: 5mm; margin-bottom: 5mm;'>&sect;2.2 Descriptions</h3> <h3 style='margin-top: 5mm; margin-bottom: 5mm;'>&sect;2.2 Descriptions</h3>
<div id='2.2.0' style='margin-bottom: 1cm;'> <div id='exec_command' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.0: exec_command</h4> <h4>&sect;2.2.0: exec_command</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void exec_command(Application_Links *app, int command_id)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void exec_command(Application_Links *app, int command_id)</div>
<div> <div>
@ -170,7 +170,7 @@ DOC_PARAM(command_id, an integer id enumerated in 4coder_custom.h starting with
DOC(Executes the command associated with the command_id passed in) DOC(Executes the command associated with the command_id passed in)
</div> </div>
</div> </div>
<div id='2.2.1' style='margin-bottom: 1cm;'> <div id='exec_system_command' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.1: exec_system_command</h4> <h4>&sect;2.2.1: exec_system_command</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int exec_system_command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int exec_system_command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags)</div>
<div> <div>
@ -203,87 +203,8 @@ of at the beginning.
) )
</div> </div>
</div> </div>
<div id='2.2.2' style='margin-bottom: 1cm;'> <div id='clipboard_post' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.2: directory_get_hot</h4> <h4>&sect;2.2.2: clipboard_post</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int directory_get_hot(Application_Links *app, char *out, int capacity)</div>
<div>
DOC_PARAM(out, a buffer that receives the 4coder 'hot directory')
DOC_PARAM(capacity, the maximum size to be output to the output buffer)
DOC_RETURN(returns the size of the string written into the buffer)
DOC
(
4coder has a concept of a 'hot directory' which is the directory most recently
accessed in the GUI. Whenever the GUI is opened it shows the hot directory.
In the future this will be deprecated and eliminated in favor of more flexible
directories controlled by the custom side.
)
</div>
</div>
<div id='2.2.3' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.3: get_4ed_path</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int get_4ed_path(Application_Links *app, char *out, int capacity)</div>
<div>
DOC_PARAM(out, a buffer that receives the path to the 4ed executable file)
DOC_PARAM(capacity, the maximum capacity of the output buffer)
DOC_RETURN(returns non-zero on success, returns zero on failure)
</div>
</div>
<div id='2.2.4' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.4: file_exists</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int file_exists(Application_Links *app, char *filename, int len)</div>
<div>
DOC_PARAM(filename, the full path to a file)
DOC_PARAM(len, the number of characters in the filename string)
DOC_RETURN(returns non-zero if the file exists, returns zero if the file does not exist)
</div>
</div>
<div id='2.2.5' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.5: directory_cd</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int directory_cd(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len)</div>
<div>
DOC_PARAM(dir, a string buffer containing a directory)
DOC_PARAM(len, the length of the string in the string buffer)
DOC_PARAM(capacity, the maximum size of the string buffer)
DOC_PARAM(rel_path, the path to change to, may include '.' or '..')
DOC_PARAM(rel_len, the length of the rel_path string)
DOC_RETURN(returns non-zero if the call succeeds, returns zero otherwise)
DOC
(
This call succeeds if the directory exists and the new directory fits inside the dir buffer.
If the call succeeds the dir buffer is filled with the new directory and len contains the
length of the string in the buffer.
For instance if dir contains "C:/Users/MySelf" and rel is "Documents" the buffer will contain
"C:/Users/MySelf/Documents" and len will contain the length of that string. This call can
also be used with rel as ".." to traverse to parent folders.
)
</div>
</div>
<div id='2.2.6' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.6: get_file_list</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>File_List get_file_list(Application_Links *app, char *dir, int len)</div>
<div>
DOC_PARAM(dir, the directory whose files will be enumerated in the returned list)
DOC_PARAM(len, the length of the dir string)
DOC_RETURN
(
returns a File_List struct containing pointers to the names of the files in
the specified directory. The File_List returned should be passed to free_file_list
when it is no longer in use.
)
</div>
</div>
<div id='2.2.7' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.7: free_file_list</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void free_file_list(Application_Links *app, File_List list)</div>
<div>
DOC_PARAM(list, the file list to be freed)
DOC(after this call the file list passed in should not be read or written to)
</div>
</div>
<div id='2.2.8' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.8: clipboard_post</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void clipboard_post(Application_Links *app, char *str, int len)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void clipboard_post(Application_Links *app, char *str, int len)</div>
<div> <div>
DOC_PARAM(str, the string to post to the clipboard) DOC_PARAM(str, the string to post to the clipboard)
@ -296,15 +217,15 @@ be pasted into other applications.
) )
</div> </div>
</div> </div>
<div id='2.2.9' style='margin-bottom: 1cm;'> <div id='clipboard_count' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.9: clipboard_count</h4> <h4>&sect;2.2.3: clipboard_count</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int clipboard_count(Application_Links *app)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int clipboard_count(Application_Links *app)</div>
<div> <div>
DOC(returns the number of items in the clipboard) DOC(returns the number of items in the clipboard)
</div> </div>
</div> </div>
<div id='2.2.10' style='margin-bottom: 1cm;'> <div id='clipboard_index' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.10: clipboard_index</h4> <h4>&sect;2.2.4: clipboard_index</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int clipboard_index(Application_Links *app, int index, char *out, int len)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int clipboard_index(Application_Links *app, int index, char *out, int len)</div>
<div> <div>
DOC_PARAM(index, the index of the item to be read) DOC_PARAM(index, the index of the item to be read)
@ -323,8 +244,8 @@ string is not null terminated.
) )
</div> </div>
</div> </div>
<div id='2.2.11' style='margin-bottom: 1cm;'> <div id='get_buffer_first' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.11: get_buffer_first</h4> <h4>&sect;2.2.5: get_buffer_first</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary get_buffer_first(Application_Links *app, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary get_buffer_first(Application_Links *app, unsigned int access)</div>
<div> <div>
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
@ -340,8 +261,8 @@ DOC_SEE(Access_Flag)
DOC_SEE(get_buffer_next) DOC_SEE(get_buffer_next)
</div> </div>
</div> </div>
<div id='2.2.12' style='margin-bottom: 1cm;'> <div id='get_buffer_next' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.12: get_buffer_next</h4> <h4>&sect;2.2.6: get_buffer_next</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void get_buffer_next(Application_Links *app, Buffer_Summary *buffer, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void get_buffer_next(Application_Links *app, Buffer_Summary *buffer, unsigned int access)</div>
<div> <div>
DOC_PARAM(buffer, pointer to the loop buffer originally returned by get_buffer_first) DOC_PARAM(buffer, pointer to the loop buffer originally returned by get_buffer_first)
@ -359,8 +280,8 @@ DOC_SEE(Access_Flag)
DOC_SEE(get_buffer_first) DOC_SEE(get_buffer_first)
</div> </div>
</div> </div>
<div id='2.2.13' style='margin-bottom: 1cm;'> <div id='get_buffer' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.13: get_buffer</h4> <h4>&sect;2.2.7: get_buffer</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary get_buffer(Application_Links *app, int buffer_id, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary get_buffer(Application_Links *app, int buffer_id, unsigned int access)</div>
<div> <div>
DOC_PARAM(buffer_id, the id of the buffer to get) DOC_PARAM(buffer_id, the id of the buffer to get)
@ -368,8 +289,8 @@ DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the indicated buffer if it exists and is accessible) DOC_RETURN(returns a summary that describes the indicated buffer if it exists and is accessible)
</div> </div>
</div> </div>
<div id='2.2.14' style='margin-bottom: 1cm;'> <div id='get_buffer_by_name' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.14: get_buffer_by_name</h4> <h4>&sect;2.2.8: get_buffer_by_name</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary get_buffer_by_name(Application_Links *app, char *name, int len, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary get_buffer_by_name(Application_Links *app, char *name, int len, unsigned int access)</div>
<div> <div>
DOC_PARAM(name, the name of the buffer) DOC_PARAM(name, the name of the buffer)
@ -378,9 +299,9 @@ DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the indicated buffer if it exists and is accessible) DOC_RETURN(returns a summary that describes the indicated buffer if it exists and is accessible)
</div> </div>
</div> </div>
<div id='2.2.15' style='margin-bottom: 1cm;'> <div id='buffer_boundary_seek' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.15: buffer_seek</h4> <h4>&sect;2.2.9: buffer_boundary_seek</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_seek(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags)</div>
<div> <div>
DOC_PARAM(buffer, the buffer to seek through) DOC_PARAM(buffer, the buffer to seek through)
DOC_PARAM(start_pos, the absolute position in the buffer to begin the seek) DOC_PARAM(start_pos, the absolute position in the buffer to begin the seek)
@ -390,8 +311,8 @@ DOC_RETURN(returns the position where the seek stops)
DOC_SEE(Seek_Boundary_Flag) DOC_SEE(Seek_Boundary_Flag)
</div> </div>
</div> </div>
<div id='2.2.16' style='margin-bottom: 1cm;'> <div id='buffer_read_range' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.16: buffer_read_range</h4> <h4>&sect;2.2.10: buffer_read_range</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_read_range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_read_range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out)</div>
<div> <div>
DOC_PARAM(buffer, the buffer to read out of) DOC_PARAM(buffer, the buffer to read out of)
@ -409,8 +330,8 @@ is not within the bounds of the buffer.
) )
</div> </div>
</div> </div>
<div id='2.2.17' style='margin-bottom: 1cm;'> <div id='buffer_replace_range' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.17: buffer_replace_range</h4> <h4>&sect;2.2.11: buffer_replace_range</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len)</div>
<div> <div>
DOC_PARAM(buffer, the buffer to edit) DOC_PARAM(buffer, the buffer to edit)
@ -432,8 +353,8 @@ range is not within the bounds of the buffer.
) )
</div> </div>
</div> </div>
<div id='2.2.18' style='margin-bottom: 1cm;'> <div id='buffer_set_setting' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.18: buffer_set_setting</h4> <h4>&sect;2.2.12: buffer_set_setting</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, int setting, int value)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, int setting, int value)</div>
<div> <div>
DOC_PARAM(buffer, the buffer to set a setting on) DOC_PARAM(buffer, the buffer to set a setting on)
@ -442,8 +363,8 @@ DOC_PARAM(value, the value to set the specified setting to)
DOC_SEE(Buffer_Setting_ID) DOC_SEE(Buffer_Setting_ID)
</div> </div>
</div> </div>
<div id='2.2.19' style='margin-bottom: 1cm;'> <div id='buffer_auto_indent' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.19: buffer_auto_indent</h4> <h4>&sect;2.2.13: buffer_auto_indent</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_auto_indent(Application_Links *app, Buffer_Summary *buffer, int start, int end, int tab_width, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int buffer_auto_indent(Application_Links *app, Buffer_Summary *buffer, int start, int end, int tab_width, unsigned int flags)</div>
<div> <div>
DOC_PARAM(buffer, the buffer in which to apply the auto indenting) DOC_PARAM(buffer, the buffer in which to apply the auto indenting)
@ -462,8 +383,8 @@ completed this function will fail.
DOC_SEE(Auto_Tab_Flag) DOC_SEE(Auto_Tab_Flag)
</div> </div>
</div> </div>
<div id='2.2.20' style='margin-bottom: 1cm;'> <div id='create_buffer' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.20: create_buffer</h4> <h4>&sect;2.2.14: create_buffer</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary create_buffer(Application_Links *app, char *filename, int filename_len, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Buffer_Summary create_buffer(Application_Links *app, char *filename, int filename_len, unsigned int flags)</div>
<div> <div>
DOC_PARAM(filename, the name of the file to be opened or created) DOC_PARAM(filename, the name of the file to be opened or created)
@ -481,8 +402,8 @@ the filename does not correspond to a file on disk the buffer is created empty.
DOC_SEE(Buffer_Create_Flag) DOC_SEE(Buffer_Create_Flag)
</div> </div>
</div> </div>
<div id='2.2.21' style='margin-bottom: 1cm;'> <div id='save_buffer' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.21: save_buffer</h4> <h4>&sect;2.2.15: save_buffer</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int filename_len, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int filename_len, unsigned int flags)</div>
<div> <div>
DOC_PARAM(buffer, the buffer to save to a file) DOC_PARAM(buffer, the buffer to save to a file)
@ -492,8 +413,8 @@ DOC_PARAM(flags, not currently used)
DOC_RETURN(returns non-zero if the save succeeds) DOC_RETURN(returns non-zero if the save succeeds)
</div> </div>
</div> </div>
<div id='2.2.22' style='margin-bottom: 1cm;'> <div id='kill_buffer' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.22: kill_buffer</h4> <h4>&sect;2.2.16: kill_buffer</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int kill_buffer(Application_Links *app, Buffer_Identifier buffer, int view_id, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int kill_buffer(Application_Links *app, Buffer_Identifier buffer, int view_id, unsigned int flags)</div>
<div> <div>
DOC_PARAM(buffer, a buffer identifier specifying the buffer to try to kill) DOC_PARAM(buffer, a buffer identifier specifying the buffer to try to kill)
@ -509,8 +430,8 @@ If the view is not open the kill fails.
DOC_SEE(Buffer_Kill_Flags) DOC_SEE(Buffer_Kill_Flags)
</div> </div>
</div> </div>
<div id='2.2.23' style='margin-bottom: 1cm;'> <div id='get_view_first' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.23: get_view_first</h4> <h4>&sect;2.2.17: get_view_first</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>View_Summary get_view_first(Application_Links *app, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>View_Summary get_view_first(Application_Links *app, unsigned int access)</div>
<div> <div>
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
@ -526,8 +447,8 @@ DOC_SEE(Access_Flag)
DOC_SEE(get_view_next) DOC_SEE(get_view_next)
</div> </div>
</div> </div>
<div id='2.2.24' style='margin-bottom: 1cm;'> <div id='get_view_next' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.24: get_view_next</h4> <h4>&sect;2.2.18: get_view_next</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void get_view_next(Application_Links *app, View_Summary *view, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void get_view_next(Application_Links *app, View_Summary *view, unsigned int access)</div>
<div> <div>
DOC_PARAM(view, pointer to the loop view originally returned by get_view_first) DOC_PARAM(view, pointer to the loop view originally returned by get_view_first)
@ -545,8 +466,8 @@ DOC_SEE(Access_Flag)
DOC_SEE(get_view_first) DOC_SEE(get_view_first)
</div> </div>
</div> </div>
<div id='2.2.25' style='margin-bottom: 1cm;'> <div id='get_view' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.25: get_view</h4> <h4>&sect;2.2.19: get_view</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>View_Summary get_view(Application_Links *app, int view_id, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>View_Summary get_view(Application_Links *app, int view_id, unsigned int access)</div>
<div> <div>
DOC_PARAM(view_id, the id of the view to get) DOC_PARAM(view_id, the id of the view to get)
@ -554,16 +475,16 @@ DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the indicated view if it is open and is accessible) DOC_RETURN(returns a summary that describes the indicated view if it is open and is accessible)
</div> </div>
</div> </div>
<div id='2.2.26' style='margin-bottom: 1cm;'> <div id='get_active_view' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.26: get_active_view</h4> <h4>&sect;2.2.20: get_active_view</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>View_Summary get_active_view(Application_Links *app, unsigned int access)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>View_Summary get_active_view(Application_Links *app, unsigned int access)</div>
<div> <div>
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the active view) DOC_RETURN(returns a summary that describes the active view)
</div> </div>
</div> </div>
<div id='2.2.27' style='margin-bottom: 1cm;'> <div id='view_compute_cursor' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.27: view_compute_cursor</h4> <h4>&sect;2.2.21: view_compute_cursor</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out)</div>
<div> <div>
DOC_PARAM(view, the view on which to run the cursor computation) DOC_PARAM(view, the view on which to run the cursor computation)
@ -577,8 +498,8 @@ Computes a full cursor for the given seek position.
DOC_SEE(Buffer_Seek) DOC_SEE(Buffer_Seek)
</div> </div>
</div> </div>
<div id='2.2.28' style='margin-bottom: 1cm;'> <div id='view_set_cursor' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.28: view_set_cursor</h4> <h4>&sect;2.2.22: view_set_cursor</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x)</div>
<div> <div>
DOC_PARAM(view, the view in which to set the cursor) DOC_PARAM(view, the view in which to set the cursor)
@ -593,8 +514,8 @@ cursor position is is a vertical motion that tries to keep the cursor in the sam
DOC_SEE(Buffer_Seek) DOC_SEE(Buffer_Seek)
</div> </div>
</div> </div>
<div id='2.2.29' style='margin-bottom: 1cm;'> <div id='view_set_mark' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.29: view_set_mark</h4> <h4>&sect;2.2.23: view_set_mark</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_mark(Application_Links *app, View_Summary *view, Buffer_Seek seek)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_mark(Application_Links *app, View_Summary *view, Buffer_Seek seek)</div>
<div> <div>
DOC_PARAM(view, the view in which to set the mark) DOC_PARAM(view, the view in which to set the mark)
@ -607,8 +528,8 @@ Sets the the view's mark position.
DOC_SEE(Buffer_Seek) DOC_SEE(Buffer_Seek)
</div> </div>
</div> </div>
<div id='2.2.30' style='margin-bottom: 1cm;'> <div id='view_set_highlight' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.30: view_set_highlight</h4> <h4>&sect;2.2.24: view_set_highlight</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_highlight(Application_Links *app, View_Summary *view, int start, int end, int turn_on)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_highlight(Application_Links *app, View_Summary *view, int start, int end, int turn_on)</div>
<div> <div>
DOC_PARAM(view, the view to set the highlight in) DOC_PARAM(view, the view to set the highlight in)
@ -625,8 +546,8 @@ the turn_on set to false, will switch back to showing the cursor.
) )
</div> </div>
</div> </div>
<div id='2.2.31' style='margin-bottom: 1cm;'> <div id='view_set_buffer' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.31: view_set_buffer</h4> <h4>&sect;2.2.25: view_set_buffer</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_buffer(Application_Links *app, View_Summary *view, int buffer_id, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_set_buffer(Application_Links *app, View_Summary *view, int buffer_id, unsigned int flags)</div>
<div> <div>
DOC_PARAM(view, the view to display the buffer in) DOC_PARAM(view, the view to display the buffer in)
@ -641,8 +562,8 @@ cancels and dialogue shown in the view and displays the file.
DOC_SEE(Set_Buffer_Flag) DOC_SEE(Set_Buffer_Flag)
</div> </div>
</div> </div>
<div id='2.2.32' style='margin-bottom: 1cm;'> <div id='view_post_fade' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.32: view_post_fade</h4> <h4>&sect;2.2.26: view_post_fade</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_post_fade(Application_Links *app, View_Summary *view, float seconds, int start, int end, unsigned int color)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_post_fade(Application_Links *app, View_Summary *view, float seconds, int start, int end, unsigned int color)</div>
<div> <div>
DOC_PARAM(view, the veiw to post a fade effect to) DOC_PARAM(view, the veiw to post a fade effect to)
@ -652,18 +573,18 @@ DOC_PARAM(end, one after the last character in the fade range)
DOC_PARAM(color, the color to fade from) DOC_PARAM(color, the color to fade from)
</div> </div>
</div> </div>
<div id='2.2.33' style='margin-bottom: 1cm;'> <div id='view_set_paste_rewrite_' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.33: view_set_paste_rewrite_</h4> <h4>&sect;2.2.27: view_set_paste_rewrite_</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void view_set_paste_rewrite_(Application_Links *app, View_Summary *view)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void view_set_paste_rewrite_(Application_Links *app, View_Summary *view)</div>
<div>No doc generated ~ assume this call is not meant to be public</div> <div>No doc generated ~ assume this call is not meant to be public</div>
</div> </div>
<div id='2.2.34' style='margin-bottom: 1cm;'> <div id='view_get_paste_rewrite_' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.34: view_get_paste_rewrite_</h4> <h4>&sect;2.2.28: view_get_paste_rewrite_</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_get_paste_rewrite_(Application_Links *app, View_Summary *view)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int view_get_paste_rewrite_(Application_Links *app, View_Summary *view)</div>
<div>No doc generated ~ assume this call is not meant to be public</div> <div>No doc generated ~ assume this call is not meant to be public</div>
</div> </div>
<div id='2.2.35' style='margin-bottom: 1cm;'> <div id='get_user_input' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.35: get_user_input</h4> <h4>&sect;2.2.29: get_user_input</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>User_Input get_user_input(Application_Links *app, unsigned int get_type, unsigned int abort_type)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>User_Input get_user_input(Application_Links *app, unsigned int get_type, unsigned int abort_type)</div>
<div> <div>
DOC_PARAM(get_type, input type flag that specifies the types of inputs that should be returned) DOC_PARAM(get_type, input type flag that specifies the types of inputs that should be returned)
@ -681,24 +602,24 @@ DOC_SEE(Input_Type_Flag)
DOC_SEE(User_Input) DOC_SEE(User_Input)
</div> </div>
</div> </div>
<div id='2.2.36' style='margin-bottom: 1cm;'> <div id='get_command_input' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.36: get_command_input</h4> <h4>&sect;2.2.30: get_command_input</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>User_Input get_command_input(Application_Links *app)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>User_Input get_command_input(Application_Links *app)</div>
<div> <div>
DOC_RETURN(returns the input that triggered the command in execution.) DOC_RETURN(returns the input that triggered the command in execution.)
DOC_SEE(User_Input) DOC_SEE(User_Input)
</div> </div>
</div> </div>
<div id='2.2.37' style='margin-bottom: 1cm;'> <div id='get_mouse_state' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.37: get_mouse_state</h4> <h4>&sect;2.2.31: get_mouse_state</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Mouse_State get_mouse_state(Application_Links *app)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>Mouse_State get_mouse_state(Application_Links *app)</div>
<div> <div>
DOC_RETURN(returns the current mouse state) DOC_RETURN(returns the current mouse state)
DOC_SEE(Mouse_State) DOC_SEE(Mouse_State)
</div> </div>
</div> </div>
<div id='2.2.38' style='margin-bottom: 1cm;'> <div id='start_query_bar' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.38: start_query_bar</h4> <h4>&sect;2.2.32: start_query_bar</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int start_query_bar(Application_Links *app, Query_Bar *bar, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int start_query_bar(Application_Links *app, Query_Bar *bar, unsigned int flags)</div>
<div> <div>
DOC_PARAM(bar, a pointer to the Query_Bar struct that defines the bar's contents) DOC_PARAM(bar, a pointer to the Query_Bar struct that defines the bar's contents)
@ -711,8 +632,8 @@ until the command returns.
) )
</div> </div>
</div> </div>
<div id='2.2.39' style='margin-bottom: 1cm;'> <div id='end_query_bar' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.39: end_query_bar</h4> <h4>&sect;2.2.33: end_query_bar</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void end_query_bar(Application_Links *app, Query_Bar *bar, unsigned int flags)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void end_query_bar(Application_Links *app, Query_Bar *bar, unsigned int flags)</div>
<div> <div>
DOC_PARAM(bar, a pointer to the Query_Bar struct to end) DOC_PARAM(bar, a pointer to the Query_Bar struct to end)
@ -723,32 +644,32 @@ bar must be a pointer previously passed to start_query_bar previously in the sam
) )
</div> </div>
</div> </div>
<div id='2.2.40' style='margin-bottom: 1cm;'> <div id='print_message' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.40: print_message</h4> <h4>&sect;2.2.34: print_message</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void print_message(Application_Links *app, char *str, int len)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void print_message(Application_Links *app, char *str, int len)</div>
<div> <div>
DOC_PARAM(str, the string to post to *messages*) DOC_PARAM(str, the string to post to *messages*)
DOC_PARAM(len, the length of str string) DOC_PARAM(len, the length of str string)
</div> </div>
</div> </div>
<div id='2.2.41' style='margin-bottom: 1cm;'> <div id='change_theme' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.41: change_theme</h4> <h4>&sect;2.2.35: change_theme</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void change_theme(Application_Links *app, char *name, int len)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void change_theme(Application_Links *app, char *name, int len)</div>
<div> <div>
DOC_PARAM(name, the name of the built in theme to change to) DOC_PARAM(name, the name of the built in theme to change to)
DOC_PARAM(len, the length of the name string) DOC_PARAM(len, the length of the name string)
</div> </div>
</div> </div>
<div id='2.2.42' style='margin-bottom: 1cm;'> <div id='change_font' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.42: change_font</h4> <h4>&sect;2.2.36: change_font</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void change_font(Application_Links *app, char *name, int len)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void change_font(Application_Links *app, char *name, int len)</div>
<div> <div>
DOC_PARAM(name, the name of the built in font to change to) DOC_PARAM(name, the name of the built in font to change to)
DOC_PARAM(len, the length of the name string) DOC_PARAM(len, the length of the name string)
</div> </div>
</div> </div>
<div id='2.2.43' style='margin-bottom: 1cm;'> <div id='set_theme_colors' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.43: set_theme_colors</h4> <h4>&sect;2.2.37: set_theme_colors</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void set_theme_colors(Application_Links *app, Theme_Color *colors, int count)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void set_theme_colors(Application_Links *app, Theme_Color *colors, int count)</div>
<div> <div>
DOC_PARAM(colors, an array of color structs pairing differet style tags to color codes) DOC_PARAM(colors, an array of color structs pairing differet style tags to color codes)
@ -760,8 +681,8 @@ code paired with the tag.
) )
</div> </div>
</div> </div>
<div id='2.2.44' style='margin-bottom: 1cm;'> <div id='get_theme_colors' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.44: get_theme_colors</h4> <h4>&sect;2.2.38: get_theme_colors</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void get_theme_colors(Application_Links *app, Theme_Color *colors, int count)</div> <div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void get_theme_colors(Application_Links *app, Theme_Color *colors, int count)</div>
<div> <div>
DOC_PARAM(colors, an array of color structs listing style tags to get color values for) DOC_PARAM(colors, an array of color structs listing style tags to get color values for)
@ -773,6 +694,85 @@ color from the specified color in the pallet.
) )
</div> </div>
</div> </div>
<div id='directory_get_hot' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.39: directory_get_hot</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int directory_get_hot(Application_Links *app, char *out, int capacity)</div>
<div>
DOC_PARAM(out, a buffer that receives the 4coder 'hot directory')
DOC_PARAM(capacity, the maximum size to be output to the output buffer)
DOC_RETURN(returns the size of the string written into the buffer)
DOC
(
4coder has a concept of a 'hot directory' which is the directory most recently
accessed in the GUI. Whenever the GUI is opened it shows the hot directory.
In the future this will be deprecated and eliminated in favor of more flexible
directories controlled by the custom side.
)
</div>
</div>
<div id='get_file_list' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.40: get_file_list</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>File_List get_file_list(Application_Links *app, char *dir, int len)</div>
<div>
DOC_PARAM(dir, the directory whose files will be enumerated in the returned list)
DOC_PARAM(len, the length of the dir string)
DOC_RETURN
(
returns a File_List struct containing pointers to the names of the files in
the specified directory. The File_List returned should be passed to free_file_list
when it is no longer in use.
)
</div>
</div>
<div id='free_file_list' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.41: free_file_list</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>void free_file_list(Application_Links *app, File_List list)</div>
<div>
DOC_PARAM(list, the file list to be freed)
DOC(after this call the file list passed in should not be read or written to)
</div>
</div>
<div id='file_exists' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.42: file_exists</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int file_exists(Application_Links *app, char *filename, int len)</div>
<div>
DOC_PARAM(filename, the full path to a file)
DOC_PARAM(len, the number of characters in the filename string)
DOC_RETURN(returns non-zero if the file exists, returns zero if the file does not exist)
</div>
</div>
<div id='directory_cd' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.43: directory_cd</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int directory_cd(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len)</div>
<div>
DOC_PARAM(dir, a string buffer containing a directory)
DOC_PARAM(len, the length of the string in the string buffer)
DOC_PARAM(capacity, the maximum size of the string buffer)
DOC_PARAM(rel_path, the path to change to, may include '.' or '..')
DOC_PARAM(rel_len, the length of the rel_path string)
DOC_RETURN(returns non-zero if the call succeeds, returns zero otherwise)
DOC
(
This call succeeds if the directory exists and the new directory fits inside the dir buffer.
If the call succeeds the dir buffer is filled with the new directory and len contains the
length of the string in the buffer.
For instance if dir contains "C:/Users/MySelf" and rel is "Documents" the buffer will contain
"C:/Users/MySelf/Documents" and len will contain the length of that string. This call can
also be used with rel set to ".." to traverse to parent folders.
)
</div>
</div>
<div id='get_4ed_path' style='margin-bottom: 1cm;'>
<h4>&sect;2.2.44: get_4ed_path</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>int get_4ed_path(Application_Links *app, char *out, int capacity)</div>
<div>
DOC_PARAM(out, a buffer that receives the path to the 4ed executable file)
DOC_PARAM(capacity, the maximum capacity of the output buffer)
DOC_RETURN(returns non-zero on success, returns zero on failure)
</div>
</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -19,7 +19,7 @@ typedef struct Full_Cursor{
float wrapped_x, wrapped_y; float wrapped_x, wrapped_y;
} Full_Cursor; } Full_Cursor;
typedef enum{ typedef enum Buffer_Seek_Type{
buffer_seek_pos, buffer_seek_pos,
buffer_seek_wrapped_xy, buffer_seek_wrapped_xy,
buffer_seek_unwrapped_xy, buffer_seek_unwrapped_xy,

View File

@ -1,11 +1,5 @@
#define EXEC_COMMAND_SIG(n) void n(Application_Links *app, int command_id) #define EXEC_COMMAND_SIG(n) void n(Application_Links *app, int command_id)
#define EXEC_SYSTEM_COMMAND_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags) #define EXEC_SYSTEM_COMMAND_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags)
#define DIRECTORY_GET_HOT_SIG(n) int n(Application_Links *app, char *out, int capacity)
#define GET_4ED_PATH_SIG(n) int n(Application_Links *app, char *out, int capacity)
#define FILE_EXISTS_SIG(n) int n(Application_Links *app, char *filename, int len)
#define DIRECTORY_CD_SIG(n) int n(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len)
#define GET_FILE_LIST_SIG(n) File_List n(Application_Links *app, char *dir, int len)
#define FREE_FILE_LIST_SIG(n) void n(Application_Links *app, File_List list)
#define CLIPBOARD_POST_SIG(n) void n(Application_Links *app, char *str, int len) #define CLIPBOARD_POST_SIG(n) void n(Application_Links *app, char *str, int len)
#define CLIPBOARD_COUNT_SIG(n) int n(Application_Links *app) #define CLIPBOARD_COUNT_SIG(n) int n(Application_Links *app)
#define CLIPBOARD_INDEX_SIG(n) int n(Application_Links *app, int index, char *out, int len) #define CLIPBOARD_INDEX_SIG(n) int n(Application_Links *app, int index, char *out, int len)
@ -13,7 +7,7 @@
#define GET_BUFFER_NEXT_SIG(n) void n(Application_Links *app, Buffer_Summary *buffer, unsigned int access) #define GET_BUFFER_NEXT_SIG(n) void n(Application_Links *app, Buffer_Summary *buffer, unsigned int access)
#define GET_BUFFER_SIG(n) Buffer_Summary n(Application_Links *app, int buffer_id, unsigned int access) #define GET_BUFFER_SIG(n) Buffer_Summary n(Application_Links *app, int buffer_id, unsigned int access)
#define GET_BUFFER_BY_NAME_SIG(n) Buffer_Summary n(Application_Links *app, char *name, int len, unsigned int access) #define GET_BUFFER_BY_NAME_SIG(n) Buffer_Summary n(Application_Links *app, char *name, int len, unsigned int access)
#define BUFFER_SEEK_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags) #define BUFFER_BOUNDARY_SEEK_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags)
#define BUFFER_READ_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out) #define BUFFER_READ_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out)
#define BUFFER_REPLACE_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len) #define BUFFER_REPLACE_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len)
#define BUFFER_SET_SETTING_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int setting, int value) #define BUFFER_SET_SETTING_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int setting, int value)
@ -43,15 +37,15 @@
#define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int len) #define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int len)
#define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count) #define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count)
#define GET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count) #define GET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count)
#define DIRECTORY_GET_HOT_SIG(n) int n(Application_Links *app, char *out, int capacity)
#define GET_FILE_LIST_SIG(n) File_List n(Application_Links *app, char *dir, int len)
#define FREE_FILE_LIST_SIG(n) void n(Application_Links *app, File_List list)
#define FILE_EXISTS_SIG(n) int n(Application_Links *app, char *filename, int len)
#define DIRECTORY_CD_SIG(n) int n(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len)
#define GET_4ED_PATH_SIG(n) int n(Application_Links *app, char *out, int capacity)
extern "C"{ extern "C"{
typedef EXEC_COMMAND_SIG(Exec_Command_Function); typedef EXEC_COMMAND_SIG(Exec_Command_Function);
typedef EXEC_SYSTEM_COMMAND_SIG(Exec_System_Command_Function); typedef EXEC_SYSTEM_COMMAND_SIG(Exec_System_Command_Function);
typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function);
typedef GET_4ED_PATH_SIG(Get_4ed_Path_Function);
typedef FILE_EXISTS_SIG(File_Exists_Function);
typedef DIRECTORY_CD_SIG(Directory_CD_Function);
typedef GET_FILE_LIST_SIG(Get_File_List_Function);
typedef FREE_FILE_LIST_SIG(Free_File_List_Function);
typedef CLIPBOARD_POST_SIG(Clipboard_Post_Function); typedef CLIPBOARD_POST_SIG(Clipboard_Post_Function);
typedef CLIPBOARD_COUNT_SIG(Clipboard_Count_Function); typedef CLIPBOARD_COUNT_SIG(Clipboard_Count_Function);
typedef CLIPBOARD_INDEX_SIG(Clipboard_Index_Function); typedef CLIPBOARD_INDEX_SIG(Clipboard_Index_Function);
@ -59,7 +53,7 @@ extern "C"{
typedef GET_BUFFER_NEXT_SIG(Get_Buffer_Next_Function); typedef GET_BUFFER_NEXT_SIG(Get_Buffer_Next_Function);
typedef GET_BUFFER_SIG(Get_Buffer_Function); typedef GET_BUFFER_SIG(Get_Buffer_Function);
typedef GET_BUFFER_BY_NAME_SIG(Get_Buffer_By_Name_Function); typedef GET_BUFFER_BY_NAME_SIG(Get_Buffer_By_Name_Function);
typedef BUFFER_SEEK_SIG(Buffer_Seek_Function); typedef BUFFER_BOUNDARY_SEEK_SIG(Buffer_Boundary_Seek_Function);
typedef BUFFER_READ_RANGE_SIG(Buffer_Read_Range_Function); typedef BUFFER_READ_RANGE_SIG(Buffer_Read_Range_Function);
typedef BUFFER_REPLACE_RANGE_SIG(Buffer_Replace_Range_Function); typedef BUFFER_REPLACE_RANGE_SIG(Buffer_Replace_Range_Function);
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function); typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
@ -89,18 +83,18 @@ extern "C"{
typedef CHANGE_FONT_SIG(Change_Font_Function); typedef CHANGE_FONT_SIG(Change_Font_Function);
typedef SET_THEME_COLORS_SIG(Set_Theme_Colors_Function); typedef SET_THEME_COLORS_SIG(Set_Theme_Colors_Function);
typedef GET_THEME_COLORS_SIG(Get_Theme_Colors_Function); typedef GET_THEME_COLORS_SIG(Get_Theme_Colors_Function);
typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function);
typedef GET_FILE_LIST_SIG(Get_File_List_Function);
typedef FREE_FILE_LIST_SIG(Free_File_List_Function);
typedef FILE_EXISTS_SIG(File_Exists_Function);
typedef DIRECTORY_CD_SIG(Directory_CD_Function);
typedef GET_4ED_PATH_SIG(Get_4ed_Path_Function);
} }
struct Application_Links{ struct Application_Links{
void *memory; void *memory;
int memory_size; int memory_size;
Exec_Command_Function *exec_command; Exec_Command_Function *exec_command;
Exec_System_Command_Function *exec_system_command; Exec_System_Command_Function *exec_system_command;
Directory_Get_Hot_Function *directory_get_hot;
Get_4ed_Path_Function *get_4ed_path;
File_Exists_Function *file_exists;
Directory_CD_Function *directory_cd;
Get_File_List_Function *get_file_list;
Free_File_List_Function *free_file_list;
Clipboard_Post_Function *clipboard_post; Clipboard_Post_Function *clipboard_post;
Clipboard_Count_Function *clipboard_count; Clipboard_Count_Function *clipboard_count;
Clipboard_Index_Function *clipboard_index; Clipboard_Index_Function *clipboard_index;
@ -108,7 +102,7 @@ struct Application_Links{
Get_Buffer_Next_Function *get_buffer_next; Get_Buffer_Next_Function *get_buffer_next;
Get_Buffer_Function *get_buffer; Get_Buffer_Function *get_buffer;
Get_Buffer_By_Name_Function *get_buffer_by_name; Get_Buffer_By_Name_Function *get_buffer_by_name;
Buffer_Seek_Function *buffer_seek; Buffer_Boundary_Seek_Function *buffer_boundary_seek;
Buffer_Read_Range_Function *buffer_read_range; Buffer_Read_Range_Function *buffer_read_range;
Buffer_Replace_Range_Function *buffer_replace_range; Buffer_Replace_Range_Function *buffer_replace_range;
Buffer_Set_Setting_Function *buffer_set_setting; Buffer_Set_Setting_Function *buffer_set_setting;
@ -138,54 +132,60 @@ struct Application_Links{
Change_Font_Function *change_font; Change_Font_Function *change_font;
Set_Theme_Colors_Function *set_theme_colors; Set_Theme_Colors_Function *set_theme_colors;
Get_Theme_Colors_Function *get_theme_colors; Get_Theme_Colors_Function *get_theme_colors;
Directory_Get_Hot_Function *directory_get_hot;
Get_File_List_Function *get_file_list;
Free_File_List_Function *free_file_list;
File_Exists_Function *file_exists;
Directory_CD_Function *directory_cd;
Get_4ed_Path_Function *get_4ed_path;
void *cmd_context; void *cmd_context;
void *system_links; void *system_links;
void *current_coroutine; void *current_coroutine;
int type_coroutine; int type_coroutine;
}; };
#define FillAppLinksAPI(app_links) do{\ #define FillAppLinksAPI(app_links) do{\
app_links->exec_command = external_exec_command;\ app_links->exec_command = Exec_Command;\
app_links->exec_system_command = external_exec_system_command;\ app_links->exec_system_command = Exec_System_Command;\
app_links->directory_get_hot = external_directory_get_hot;\ app_links->clipboard_post = Clipboard_Post;\
app_links->get_4ed_path = external_get_4ed_path;\ app_links->clipboard_count = Clipboard_Count;\
app_links->file_exists = external_file_exists;\ app_links->clipboard_index = Clipboard_Index;\
app_links->directory_cd = external_directory_cd;\ app_links->get_buffer_first = Get_Buffer_First;\
app_links->get_file_list = external_get_file_list;\ app_links->get_buffer_next = Get_Buffer_Next;\
app_links->free_file_list = external_free_file_list;\ app_links->get_buffer = Get_Buffer;\
app_links->clipboard_post = external_clipboard_post;\ app_links->get_buffer_by_name = Get_Buffer_By_Name;\
app_links->clipboard_count = external_clipboard_count;\ app_links->buffer_boundary_seek = Buffer_Boundary_Seek;\
app_links->clipboard_index = external_clipboard_index;\ app_links->buffer_read_range = Buffer_Read_Range;\
app_links->get_buffer_first = external_get_buffer_first;\ app_links->buffer_replace_range = Buffer_Replace_Range;\
app_links->get_buffer_next = external_get_buffer_next;\ app_links->buffer_set_setting = Buffer_Set_Setting;\
app_links->get_buffer = external_get_buffer;\ app_links->buffer_auto_indent = Buffer_Auto_Indent;\
app_links->get_buffer_by_name = external_get_buffer_by_name;\ app_links->create_buffer = Create_Buffer;\
app_links->buffer_seek = external_buffer_seek;\ app_links->save_buffer = Save_Buffer;\
app_links->buffer_read_range = external_buffer_read_range;\ app_links->kill_buffer = Kill_Buffer;\
app_links->buffer_replace_range = external_buffer_replace_range;\ app_links->get_view_first = Get_View_First;\
app_links->buffer_set_setting = external_buffer_set_setting;\ app_links->get_view_next = Get_View_Next;\
app_links->buffer_auto_indent = external_buffer_auto_indent;\ app_links->get_view = Get_View;\
app_links->create_buffer = external_create_buffer;\ app_links->get_active_view = Get_Active_View;\
app_links->save_buffer = external_save_buffer;\ app_links->view_compute_cursor = View_Compute_Cursor;\
app_links->kill_buffer = external_kill_buffer;\ app_links->view_set_cursor = View_Set_Cursor;\
app_links->get_view_first = external_get_view_first;\ app_links->view_set_mark = View_Set_Mark;\
app_links->get_view_next = external_get_view_next;\ app_links->view_set_highlight = View_Set_Highlight;\
app_links->get_view = external_get_view;\ app_links->view_set_buffer = View_Set_Buffer;\
app_links->get_active_view = external_get_active_view;\ app_links->view_post_fade = View_Post_Fade;\
app_links->view_compute_cursor = external_view_compute_cursor;\ app_links->view_set_paste_rewrite_ = View_Set_Paste_Rewrite_;\
app_links->view_set_cursor = external_view_set_cursor;\ app_links->view_get_paste_rewrite_ = View_Get_Paste_Rewrite_;\
app_links->view_set_mark = external_view_set_mark;\ app_links->get_user_input = Get_User_Input;\
app_links->view_set_highlight = external_view_set_highlight;\ app_links->get_command_input = Get_Command_Input;\
app_links->view_set_buffer = external_view_set_buffer;\ app_links->get_mouse_state = Get_Mouse_State;\
app_links->view_post_fade = external_view_post_fade;\ app_links->start_query_bar = Start_Query_Bar;\
app_links->view_set_paste_rewrite_ = external_view_set_paste_rewrite_;\ app_links->end_query_bar = End_Query_Bar;\
app_links->view_get_paste_rewrite_ = external_view_get_paste_rewrite_;\ app_links->print_message = Print_Message;\
app_links->get_user_input = external_get_user_input;\ app_links->change_theme = Change_Theme;\
app_links->get_command_input = external_get_command_input;\ app_links->change_font = Change_Font;\
app_links->get_mouse_state = external_get_mouse_state;\ app_links->set_theme_colors = Set_Theme_Colors;\
app_links->start_query_bar = external_start_query_bar;\ app_links->get_theme_colors = Get_Theme_Colors;\
app_links->end_query_bar = external_end_query_bar;\ app_links->directory_get_hot = Directory_Get_Hot;\
app_links->print_message = external_print_message;\ app_links->get_file_list = Get_File_List;\
app_links->change_theme = external_change_theme;\ app_links->free_file_list = Free_File_List;\
app_links->change_font = external_change_font;\ app_links->file_exists = File_Exists;\
app_links->set_theme_colors = external_set_theme_colors;\ app_links->directory_cd = Directory_CD;\
app_links->get_theme_colors = external_get_theme_colors; } while(false) app_links->get_4ed_path = Get_4ed_Path; } while(false)

View File

@ -599,7 +599,7 @@ basic_seek(Application_Links *app, int seek_type, unsigned int flags){
unsigned int access = AccessProtected; unsigned int access = AccessProtected;
View_Summary view = app->get_active_view(app, access); View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access); Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
int pos = app->buffer_seek(app, &buffer, view.cursor.pos, seek_type, flags); int pos = app->buffer_boundary_seek(app, &buffer, view.cursor.pos, seek_type, flags);
app->view_set_cursor(app, &view, seek_pos(pos), true); app->view_set_cursor(app, &view, seek_pos(pos), true);
} }
@ -798,9 +798,9 @@ CUSTOM_COMMAND_SIG(snipe_token_or_word){
view = app->get_active_view(app, access); view = app->get_active_view(app, access);
buffer = app->get_buffer(app, view.buffer_id, access); buffer = app->get_buffer(app, view.buffer_id, access);
pos1 = app->buffer_seek(app, &buffer, view.cursor.pos, false, BoundryToken | BoundryWhitespace); pos1 = app->buffer_boundary_seek(app, &buffer, view.cursor.pos, false, BoundryToken | BoundryWhitespace);
pos2 = app->buffer_seek(app, &buffer, pos1, true, BoundryToken | BoundryWhitespace); pos2 = app->buffer_boundary_seek(app, &buffer, pos1, true, BoundryToken | BoundryWhitespace);
Range range = make_range(pos1, pos2); Range range = make_range(pos1, pos2);
app->buffer_replace_range(app, &buffer, range.start, range.end, 0, 0); app->buffer_replace_range(app, &buffer, range.start, range.end, 0, 0);
@ -836,6 +836,7 @@ CUSTOM_COMMAND_SIG(open_file_in_quotes){
append(&file_name, make_string(short_file_name, size)); append(&file_name, make_string(short_file_name, size));
exec_command(app, cmdid_change_active_panel); exec_command(app, cmdid_change_active_panel);
view = app->get_active_view(app, AccessAll);
view_open_file(app, &view, expand_str(file_name), false); view_open_file(app, &view, expand_str(file_name), false);
} }
} }

View File

@ -984,9 +984,7 @@ update_command_data(App_Vars *vars, Command_Data *cmd){
globalvar Command_Function command_table[cmdid_count]; globalvar Command_Function command_table[cmdid_count];
//extern "C"{
#include "4ed_api_implementation.cpp" #include "4ed_api_implementation.cpp"
//}
struct Command_In{ struct Command_In{
Command_Data *cmd; Command_Data *cmd;

View File

@ -139,7 +139,10 @@ imp_get_view(Command_Data *cmd, View_Summary *view){
return(vptr); return(vptr);
} }
EXEC_COMMAND_SIG(external_exec_command)/* #define API_EXPORT
API_EXPORT void
Exec_Command(Application_Links *app, int command_id)/*
DOC_PARAM(command_id, an integer id enumerated in 4coder_custom.h starting with cmdid) DOC_PARAM(command_id, an integer id enumerated in 4coder_custom.h starting with cmdid)
DOC(Executes the command associated with the command_id passed in) DOC(Executes the command associated with the command_id passed in)
*/{ */{
@ -153,7 +156,8 @@ DOC(Executes the command associated with the command_id passed in)
} }
// TODO(allen): This is a bit of a mess and needs to be fixed soon // TODO(allen): This is a bit of a mess and needs to be fixed soon
EXEC_SYSTEM_COMMAND_SIG(external_exec_system_command)/* API_EXPORT int
Exec_System_Command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags)/*
DOC_PARAM(view, the target view that will display the output buffer, may be NULL, see description for details) DOC_PARAM(view, the target view that will display the output buffer, may be NULL, see description for details)
DOC_PARAM(buffer, a buffer identifier for the buffer that will be filled with the output from the command) DOC_PARAM(buffer, a buffer identifier for the buffer that will be filled with the output from the command)
DOC_PARAM(path, the path from which the command is executed) DOC_PARAM(path, the path from which the command is executed)
@ -321,63 +325,8 @@ of at the beginning.
return(result); return(result);
} }
DIRECTORY_GET_HOT_SIG(external_directory_get_hot)/* API_EXPORT void
DOC_PARAM(out, a buffer that receives the 4coder 'hot directory') Clipboard_Post(Application_Links *app, char *str, int len)/*
DOC_PARAM(capacity, the maximum size to be output to the output buffer)
DOC_RETURN(returns the size of the string written into the buffer)
DOC
(
4coder has a concept of a 'hot directory' which is the directory most recently
accessed in the GUI. Whenever the GUI is opened it shows the hot directory.
In the future this will be deprecated and eliminated in favor of more flexible
directories controlled by the custom side.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Hot_Directory *hot = &cmd->models->hot_directory;
i32 copy_max = capacity - 1;
hot_directory_clean_end(hot);
if (copy_max > hot->string.size)
copy_max = hot->string.size;
memcpy(out, hot->string.str, copy_max);
out[copy_max] = 0;
return(hot->string.size);
}
#define external_get_4ed_path system->get_4ed_path
#define external_file_exists system->file_exists
#define external_directory_cd system->directory_cd
GET_FILE_LIST_SIG(external_get_file_list)/*
DOC_PARAM(dir, the directory whose files will be enumerated in the returned list)
DOC_PARAM(len, the length of the dir string)
DOC_RETURN
(
returns a File_List struct containing pointers to the names of the files in
the specified directory. The File_List returned should be passed to free_file_list
when it is no longer in use.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
File_List result = {};
system->set_file_list(&result, make_string(dir, len));
return(result);
}
FREE_FILE_LIST_SIG(external_free_file_list)/*
DOC_PARAM(list, the file list to be freed)
DOC(after this call the file list passed in should not be read or written to)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
system->set_file_list(&list, make_string(0, 0));
}
CLIPBOARD_POST_SIG(external_clipboard_post)/*
DOC_PARAM(str, the string to post to the clipboard) DOC_PARAM(str, the string to post to the clipboard)
DOC_PARAM(len, the length of the string str) DOC_PARAM(len, the length of the string str)
DOC DOC
@ -398,7 +347,8 @@ be pasted into other applications.
system->post_clipboard(*dest); system->post_clipboard(*dest);
} }
CLIPBOARD_COUNT_SIG(external_clipboard_count)/* API_EXPORT int
Clipboard_Count(Application_Links *app)/*
DOC(returns the number of items in the clipboard) DOC(returns the number of items in the clipboard)
*/{ */{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
@ -407,7 +357,8 @@ DOC(returns the number of items in the clipboard)
return(count); return(count);
} }
CLIPBOARD_INDEX_SIG(external_clipboard_index)/* API_EXPORT int
Clipboard_Index(Application_Links *app, int index, char *out, int len)/*
DOC_PARAM(index, the index of the item to be read) DOC_PARAM(index, the index of the item to be read)
DOC_PARAM(out, a buffer where the clipboard contents are written or NULL) DOC_PARAM(out, a buffer where the clipboard contents are written or NULL)
DOC_PARAM(len, the length of the out buffer) DOC_PARAM(len, the length of the out buffer)
@ -460,7 +411,8 @@ internal_get_buffer_next(Working_Set *working_set, Buffer_Summary *buffer){
} }
} }
GET_BUFFER_FIRST_SIG(external_get_buffer_first)/* API_EXPORT Buffer_Summary
Get_Buffer_First(Application_Links *app, unsigned int access)/*
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns the summary of the first buffer in a buffer loop) DOC_RETURN(returns the summary of the first buffer in a buffer loop)
DOC DOC
@ -485,7 +437,8 @@ DOC_SEE(get_buffer_next)
return(result); return(result);
} }
GET_BUFFER_NEXT_SIG(external_get_buffer_next)/* API_EXPORT void
Get_Buffer_Next(Application_Links *app, Buffer_Summary *buffer, unsigned int access)/*
DOC_PARAM(buffer, pointer to the loop buffer originally returned by get_buffer_first) DOC_PARAM(buffer, pointer to the loop buffer originally returned by get_buffer_first)
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC DOC
@ -509,7 +462,8 @@ DOC_SEE(get_buffer_first)
} }
} }
GET_BUFFER_SIG(external_get_buffer)/* API_EXPORT Buffer_Summary
Get_Buffer(Application_Links *app, int buffer_id, unsigned int access)/*
DOC_PARAM(buffer_id, the id of the buffer to get) DOC_PARAM(buffer_id, the id of the buffer to get)
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the indicated buffer if it exists and is accessible) DOC_RETURN(returns a summary that describes the indicated buffer if it exists and is accessible)
@ -530,7 +484,8 @@ DOC_RETURN(returns a summary that describes the indicated buffer if it exists an
return(buffer); return(buffer);
} }
GET_BUFFER_BY_NAME_SIG(external_get_buffer_by_name)/* API_EXPORT Buffer_Summary
Get_Buffer_By_Name(Application_Links *app, char *name, int len, unsigned int access)/*
DOC_PARAM(name, the name of the buffer) DOC_PARAM(name, the name of the buffer)
DOC_PARAM(len, the length of the name string) DOC_PARAM(len, the length of the name string)
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
@ -552,7 +507,8 @@ DOC_RETURN(returns a summary that describes the indicated buffer if it exists an
return(buffer); return(buffer);
} }
BUFFER_SEEK_SIG(external_buffer_seek)/* API_EXPORT int
Buffer_Boundary_Seek(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags)/*
DOC_PARAM(buffer, the buffer to seek through) DOC_PARAM(buffer, the buffer to seek through)
DOC_PARAM(start_pos, the absolute position in the buffer to begin the seek) DOC_PARAM(start_pos, the absolute position in the buffer to begin the seek)
DOC_PARAM(seek_forward, non-zero indicates to seek forward otherwise the seek goes backward) DOC_PARAM(seek_forward, non-zero indicates to seek forward otherwise the seek goes backward)
@ -651,7 +607,8 @@ DOC_SEE(Seek_Boundary_Flag)
return(result); return(result);
} }
BUFFER_READ_RANGE_SIG(external_buffer_read_range)/* API_EXPORT int
Buffer_Read_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out)/*
DOC_PARAM(buffer, the buffer to read out of) DOC_PARAM(buffer, the buffer to read out of)
DOC_PARAM(start, the beginning of the read range) DOC_PARAM(start, the beginning of the read range)
DOC_PARAM(end, one past the end of the read range) DOC_PARAM(end, one past the end of the read range)
@ -683,7 +640,8 @@ is not within the bounds of the buffer.
return(result); return(result);
} }
BUFFER_REPLACE_RANGE_SIG(external_buffer_replace_range)/* API_EXPORT int
Buffer_Replace_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len)/*
DOC_PARAM(buffer, the buffer to edit) DOC_PARAM(buffer, the buffer to edit)
DOC_PARAM(start, the start of the range to edit) DOC_PARAM(start, the start of the range to edit)
DOC_PARAM(end, the end of the range to edit) DOC_PARAM(end, the end of the range to edit)
@ -728,7 +686,8 @@ range is not within the bounds of the buffer.
return(result); return(result);
} }
BUFFER_SET_SETTING_SIG(external_buffer_set_setting)/* API_EXPORT int
Buffer_Set_Setting(Application_Links *app, Buffer_Summary *buffer, int setting, int value)/*
DOC_PARAM(buffer, the buffer to set a setting on) DOC_PARAM(buffer, the buffer to set a setting on)
DOC_PARAM(setting, one of the Buffer_Setting_ID enum values that identifies the setting to set) DOC_PARAM(setting, one of the Buffer_Setting_ID enum values that identifies the setting to set)
DOC_PARAM(value, the value to set the specified setting to) DOC_PARAM(value, the value to set the specified setting to)
@ -799,7 +758,8 @@ DOC_SEE(Buffer_Setting_ID)
return(result); return(result);
} }
BUFFER_AUTO_INDENT_SIG(external_buffer_auto_indent)/* API_EXPORT int
Buffer_Auto_Indent(Application_Links *app, Buffer_Summary *buffer, int start, int end, int tab_width, unsigned int flags)/*
DOC_PARAM(buffer, the buffer in which to apply the auto indenting) DOC_PARAM(buffer, the buffer in which to apply the auto indenting)
DOC_PARAM(start, the position to start the auto indenting) DOC_PARAM(start, the position to start the auto indenting)
DOC_PARAM(end, the position to end the auto indenting) DOC_PARAM(end, the position to end the auto indenting)
@ -839,7 +799,8 @@ DOC_SEE(Auto_Tab_Flag)
return(result); return(result);
} }
CREATE_BUFFER_SIG(external_create_buffer)/* API_EXPORT Buffer_Summary
Create_Buffer(Application_Links *app, char *filename, int filename_len, unsigned int flags)/*
DOC_PARAM(filename, the name of the file to be opened or created) DOC_PARAM(filename, the name of the file to be opened or created)
DOC_PARAM(filename_len, the length of the filename string) DOC_PARAM(filename_len, the length of the filename string)
DOC_PARAM(flags, flags for buffer creation behavior) DOC_PARAM(flags, flags for buffer creation behavior)
@ -930,7 +891,8 @@ DOC_SEE(Buffer_Create_Flag)
return(result); return(result);
} }
SAVE_BUFFER_SIG(external_save_buffer)/* API_EXPORT int
Save_Buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int filename_len, unsigned int flags)/*
DOC_PARAM(buffer, the buffer to save to a file) DOC_PARAM(buffer, the buffer to save to a file)
DOC_PARAM(filename, the name of the file to save the buffer into) DOC_PARAM(filename, the name of the file to save the buffer into)
DOC_PARAM(filename_len, length of the filename string) DOC_PARAM(filename_len, length of the filename string)
@ -952,7 +914,8 @@ DOC_RETURN(returns non-zero if the save succeeds)
return(result); return(result);
} }
KILL_BUFFER_SIG(external_kill_buffer)/* API_EXPORT int
Kill_Buffer(Application_Links *app, Buffer_Identifier buffer, int view_id, unsigned int flags)/*
DOC_PARAM(buffer, a buffer identifier specifying the buffer to try to kill) DOC_PARAM(buffer, a buffer identifier specifying the buffer to try to kill)
DOC_PARAM(view_id, the id of view that will contain the "are you sure" dialogue) DOC_PARAM(view_id, the id of view that will contain the "are you sure" dialogue)
DOC_PARAM(flags, flags for buffer kill behavior) DOC_PARAM(flags, flags for buffer kill behavior)
@ -1027,7 +990,8 @@ internal_get_view_next(Command_Data *cmd, View_Summary *view){
} }
} }
GET_VIEW_FIRST_SIG(external_get_view_first)/* API_EXPORT View_Summary
Get_View_First(Application_Links *app, unsigned int access)/*
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns the summary of the first view in a view loop) DOC_RETURN(returns the summary of the first view in a view loop)
DOC DOC
@ -1051,7 +1015,8 @@ DOC_SEE(get_view_next)
return(view); return(view);
} }
GET_VIEW_NEXT_SIG(external_get_view_next)/* API_EXPORT void
Get_View_Next(Application_Links *app, View_Summary *view, unsigned int access)/*
DOC_PARAM(view, pointer to the loop view originally returned by get_view_first) DOC_PARAM(view, pointer to the loop view originally returned by get_view_first)
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC DOC
@ -1074,7 +1039,8 @@ DOC_SEE(get_view_first)
} }
} }
GET_VIEW_SIG(external_get_view)/* API_EXPORT View_Summary
Get_View(Application_Links *app, int view_id, unsigned int access)/*
DOC_PARAM(view_id, the id of the view to get) DOC_PARAM(view_id, the id of the view to get)
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the indicated view if it is open and is accessible) DOC_RETURN(returns a summary that describes the indicated view if it is open and is accessible)
@ -1097,7 +1063,8 @@ DOC_RETURN(returns a summary that describes the indicated view if it is open and
return(view); return(view);
} }
GET_ACTIVE_VIEW_SIG(external_get_active_view)/* API_EXPORT View_Summary
Get_Active_View(Application_Links *app, unsigned int access)/*
DOC_PARAM(access, the access flags for the access) DOC_PARAM(access, the access flags for the access)
DOC_RETURN(returns a summary that describes the active view) DOC_RETURN(returns a summary that describes the active view)
*/{ */{
@ -1110,7 +1077,8 @@ DOC_RETURN(returns a summary that describes the active view)
return(view); return(view);
} }
VIEW_COMPUTE_CURSOR_SIG(external_view_compute_cursor)/* API_EXPORT int
View_Compute_Cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out)/*
DOC_PARAM(view, the view on which to run the cursor computation) DOC_PARAM(view, the view on which to run the cursor computation)
DOC_PARAM(seek, the seek position) DOC_PARAM(seek, the seek position)
DOC_PARAM(cursor_out, on success this is filled with result of the seek) DOC_PARAM(cursor_out, on success this is filled with result of the seek)
@ -1141,7 +1109,8 @@ DOC_SEE(Buffer_Seek)
return(result); return(result);
} }
VIEW_SET_CURSOR_SIG(external_view_set_cursor)/* API_EXPORT int
View_Set_Cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x)/*
DOC_PARAM(view, the view in which to set the cursor) DOC_PARAM(view, the view in which to set the cursor)
DOC_PARAM(seek, the seek position) DOC_PARAM(seek, the seek position)
DOC_PARAM(set_preferred_x, if true the preferred x is updated to match the new cursor position) DOC_PARAM(set_preferred_x, if true the preferred x is updated to match the new cursor position)
@ -1177,7 +1146,8 @@ DOC_SEE(Buffer_Seek)
return(result); return(result);
} }
VIEW_SET_MARK_SIG(external_view_set_mark)/* API_EXPORT int
View_Set_Mark(Application_Links *app, View_Summary *view, Buffer_Seek seek)/*
DOC_PARAM(view, the view in which to set the mark) DOC_PARAM(view, the view in which to set the mark)
DOC_PARAM(seek, the seek position) DOC_PARAM(seek, the seek position)
DOC_RETURN(returns non-zero on success) DOC_RETURN(returns non-zero on success)
@ -1207,7 +1177,8 @@ DOC_SEE(Buffer_Seek)
return(result); return(result);
} }
VIEW_SET_HIGHLIGHT_SIG(external_view_set_highlight)/* API_EXPORT int
View_Set_Highlight(Application_Links *app, View_Summary *view, int start, int end, int turn_on)/*
DOC_PARAM(view, the view to set the highlight in) DOC_PARAM(view, the view to set the highlight in)
DOC_PARAM(start, the start of the highlight range) DOC_PARAM(start, the start of the highlight range)
DOC_PARAM(end, the end of the highlight range) DOC_PARAM(end, the end of the highlight range)
@ -1239,7 +1210,8 @@ the turn_on set to false, will switch back to showing the cursor.
return(result); return(result);
} }
VIEW_SET_BUFFER_SIG(external_view_set_buffer)/* API_EXPORT int
View_Set_Buffer(Application_Links *app, View_Summary *view, int buffer_id, unsigned int flags)/*
DOC_PARAM(view, the view to display the buffer in) DOC_PARAM(view, the view to display the buffer in)
DOC_PARAM(buffer_id, the buffer to show in the view) DOC_PARAM(buffer_id, the buffer to show in the view)
DOC_PARAM(flags, set buffer behavior flags) DOC_PARAM(flags, set buffer behavior flags)
@ -1276,7 +1248,8 @@ DOC_SEE(Set_Buffer_Flag)
return(result); return(result);
} }
VIEW_POST_FADE_SIG(external_view_post_fade)/* API_EXPORT int
View_Post_Fade(Application_Links *app, View_Summary *view, float seconds, int start, int end, unsigned int color)/*
DOC_PARAM(view, the veiw to post a fade effect to) DOC_PARAM(view, the veiw to post a fade effect to)
DOC_PARAM(seconds, the number of seconds the fade effect should last) DOC_PARAM(seconds, the number of seconds the fade effect should last)
DOC_PARAM(start, the first character in the fade range) DOC_PARAM(start, the first character in the fade range)
@ -1299,7 +1272,8 @@ DOC_PARAM(color, the color to fade from)
return(result); return(result);
} }
VIEW_SET_PASTE_REWRITE__SIG(external_view_set_paste_rewrite_){ API_EXPORT void
View_Set_Paste_Rewrite_(Application_Links *app, View_Summary *view){
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr = imp_get_view(cmd, view); View *vptr = imp_get_view(cmd, view);
if (vptr){ if (vptr){
@ -1307,7 +1281,8 @@ VIEW_SET_PASTE_REWRITE__SIG(external_view_set_paste_rewrite_){
} }
} }
VIEW_GET_PASTE_REWRITE__SIG(external_view_get_paste_rewrite_){ API_EXPORT int
View_Get_Paste_Rewrite_(Application_Links *app, View_Summary *view){
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr = imp_get_view(cmd, view); View *vptr = imp_get_view(cmd, view);
int result = false; int result = false;
@ -1317,7 +1292,8 @@ VIEW_GET_PASTE_REWRITE__SIG(external_view_get_paste_rewrite_){
return(result); return(result);
} }
GET_USER_INPUT_SIG(external_get_user_input)/* API_EXPORT User_Input
Get_User_Input(Application_Links *app, unsigned int get_type, unsigned int abort_type)/*
DOC_PARAM(get_type, input type flag that specifies the types of inputs that should be returned) DOC_PARAM(get_type, input type flag that specifies the types of inputs that should be returned)
DOC_PARAM(abort_type, input type flag that specifies the types of inputs that should cause an abort signal) DOC_PARAM(abort_type, input type flag that specifies the types of inputs that should cause an abort signal)
DOC_RETURN(returns a User_Input that describes an event passed to the command) DOC_RETURN(returns a User_Input that describes an event passed to the command)
@ -1348,7 +1324,8 @@ DOC_SEE(User_Input)
return(result); return(result);
} }
GET_COMMAND_INPUT_SIG(external_get_command_input)/* API_EXPORT User_Input
Get_Command_Input (Application_Links *app)/*
DOC_RETURN(returns the input that triggered the command in execution.) DOC_RETURN(returns the input that triggered the command in execution.)
DOC_SEE(User_Input) DOC_SEE(User_Input)
*/{ */{
@ -1363,7 +1340,8 @@ DOC_SEE(User_Input)
return(result); return(result);
} }
GET_MOUSE_STATE_SIG(external_get_mouse_state)/* API_EXPORT Mouse_State
Get_Mouse_State(Application_Links *app)/*
DOC_RETURN(returns the current mouse state) DOC_RETURN(returns the current mouse state)
DOC_SEE(Mouse_State) DOC_SEE(Mouse_State)
*/{ */{
@ -1374,7 +1352,9 @@ DOC_SEE(Mouse_State)
} }
#if 0 #if 0
GET_EVENT_MESSAGE_SIG(external_get_event_message){ //API_EXPORT
Event_Message
Get_Event_Message (Application_Links *app){
Event_Message message = {0}; Event_Message message = {0};
System_Functions *system = (System_Functions*)app->system_links; System_Functions *system = (System_Functions*)app->system_links;
Coroutine *coroutine = (Coroutine*)app->current_coroutine; Coroutine *coroutine = (Coroutine*)app->current_coroutine;
@ -1389,7 +1369,8 @@ GET_EVENT_MESSAGE_SIG(external_get_event_message){
} }
#endif #endif
START_QUERY_BAR_SIG(external_start_query_bar)/* API_EXPORT int
Start_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags)/*
DOC_PARAM(bar, a pointer to the Query_Bar struct that defines the bar's contents) DOC_PARAM(bar, a pointer to the Query_Bar struct that defines the bar's contents)
DOC_PARAM(flags, not currently used) DOC_PARAM(flags, not currently used)
DOC_RETURN(returns non-zero on success) DOC_RETURN(returns non-zero on success)
@ -1411,7 +1392,8 @@ until the command returns.
return(slot != 0); return(slot != 0);
} }
END_QUERY_BAR_SIG(external_end_query_bar)/* API_EXPORT void
End_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags)/*
DOC_PARAM(bar, a pointer to the Query_Bar struct to end) DOC_PARAM(bar, a pointer to the Query_Bar struct to end)
DOC_PARAM(flags, not currently used) DOC_PARAM(flags, not currently used)
DOC DOC
@ -1425,7 +1407,8 @@ bar must be a pointer previously passed to start_query_bar previously in the sam
free_query_slot(&vptr->query_set, bar); free_query_slot(&vptr->query_set, bar);
} }
PRINT_MESSAGE_SIG(external_print_message)/* API_EXPORT void
Print_Message(Application_Links *app, char *str, int len)/*
DOC_PARAM(str, the string to post to *messages*) DOC_PARAM(str, the string to post to *messages*)
DOC_PARAM(len, the length of str string) DOC_PARAM(len, the length of str string)
*/{ */{
@ -1434,7 +1417,8 @@ DOC_PARAM(len, the length of str string)
do_feedback_message(cmd->system, models, make_string(str, len)); do_feedback_message(cmd->system, models, make_string(str, len));
} }
CHANGE_THEME_SIG(external_change_theme)/* API_EXPORT void
Change_Theme(Application_Links *app, char *name, int len)/*
DOC_PARAM(name, the name of the built in theme to change to) DOC_PARAM(name, the name of the built in theme to change to)
DOC_PARAM(len, the length of the name string) DOC_PARAM(len, the length of the name string)
*/{ */{
@ -1454,7 +1438,8 @@ DOC_PARAM(len, the length of the name string)
} }
} }
CHANGE_FONT_SIG(external_change_font)/* API_EXPORT void
Change_Font(Application_Links *app, char *name, int len)/*
DOC_PARAM(name, the name of the built in font to change to) DOC_PARAM(name, the name of the built in font to change to)
DOC_PARAM(len, the length of the name string) DOC_PARAM(len, the length of the name string)
*/{ */{
@ -1470,7 +1455,8 @@ DOC_PARAM(len, the length of the name string)
} }
} }
SET_THEME_COLORS_SIG(external_set_theme_colors)/* API_EXPORT void
Set_Theme_Colors(Application_Links *app, Theme_Color *colors, int count)/*
DOC_PARAM(colors, an array of color structs pairing differet style tags to color codes) DOC_PARAM(colors, an array of color structs pairing differet style tags to color codes)
DOC_PARAM(count, the number of color structs in the colors array) DOC_PARAM(count, the number of color structs in the colors array)
DOC DOC
@ -1492,7 +1478,8 @@ code paired with the tag.
} }
} }
GET_THEME_COLORS_SIG(external_get_theme_colors)/* API_EXPORT void
Get_Theme_Colors(Application_Links *app, Theme_Color *colors, int count)/*
DOC_PARAM(colors, an array of color structs listing style tags to get color values for) DOC_PARAM(colors, an array of color structs listing style tags to get color values for)
DOC_PARAM(count, the number of color structs in the colors array) DOC_PARAM(count, the number of color structs in the colors array)
DOC DOC
@ -1519,5 +1506,62 @@ color from the specified color in the pallet.
} }
} }
API_EXPORT int
Directory_Get_Hot(Application_Links *app, char *out, int capacity)/*
DOC_PARAM(out, a buffer that receives the 4coder 'hot directory')
DOC_PARAM(capacity, the maximum size to be output to the output buffer)
DOC_RETURN(returns the size of the string written into the buffer)
DOC
(
4coder has a concept of a 'hot directory' which is the directory most recently
accessed in the GUI. Whenever the GUI is opened it shows the hot directory.
In the future this will be deprecated and eliminated in favor of more flexible
directories controlled by the custom side.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Hot_Directory *hot = &cmd->models->hot_directory;
i32 copy_max = capacity - 1;
hot_directory_clean_end(hot);
if (copy_max > hot->string.size)
copy_max = hot->string.size;
memcpy(out, hot->string.str, copy_max);
out[copy_max] = 0;
return(hot->string.size);
}
#define Get_4ed_Path system->get_4ed_path
#define File_Exists system->file_exists
#define Directory_CD system->directory_cd
API_EXPORT File_List
Get_File_List(Application_Links *app, char *dir, int len)/*
DOC_PARAM(dir, the directory whose files will be enumerated in the returned list)
DOC_PARAM(len, the length of the dir string)
DOC_RETURN
(
returns a File_List struct containing pointers to the names of the files in
the specified directory. The File_List returned should be passed to free_file_list
when it is no longer in use.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
File_List result = {};
system->set_file_list(&result, make_string(dir, len));
return(result);
}
API_EXPORT void
Free_File_List(Application_Links *app, File_List list)/*
DOC_PARAM(list, the file list to be freed)
DOC(after this call the file list passed in should not be read or written to)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
system->set_file_list(&list, make_string(0, 0));
}
// BOTTOM // BOTTOM

View File

@ -431,7 +431,7 @@ is_comment(String str){
return(result); return(result);
} }
struct Doc_Parse{ struct Parse{
Cpp_Token_Stack tokens; Cpp_Token_Stack tokens;
}; };
@ -471,7 +471,7 @@ doc_parse_identifier(String lexeme, int *pos){
} }
void void
perform_doc_parse(Doc_Parse *parse, String lexeme){ perform_doc_parse(Parse *parse, String lexeme){
int keep_parsing = true; int keep_parsing = true;
int pos = 0; int pos = 0;
@ -499,6 +499,9 @@ generate_custom_headers(){
char *filename = API_H " & " API_DOC; char *filename = API_H " & " API_DOC;
Function_Set function_set = {0};
#if 0
// NOTE(allen): Header // NOTE(allen): Header
String data = file_dump("custom_api_spec.cpp"); String data = file_dump("custom_api_spec.cpp");
@ -510,16 +513,6 @@ generate_custom_headers(){
++line_count; ++line_count;
} }
Function_Set function_set = {0};
function_set.name = (String*)malloc((sizeof(String)*6 + sizeof(int))*line_count);
function_set.ret = function_set.name + line_count;
function_set.args = function_set.ret + line_count;
function_set.macros = function_set.args + line_count;
function_set.public_name = function_set.macros + line_count;
function_set.doc_string = function_set.public_name + line_count;
function_set.valid = (int*)(function_set.public_name + line_count);
int max_name_size = 0; int max_name_size = 0;
int sig_count = 0; int sig_count = 0;
line_count = 0; line_count = 0;
@ -584,8 +577,189 @@ generate_custom_headers(){
} }
} }
} }
#endif
FILE *file = fopen(API_H, "wb"); // NOTE(allen): Documentation
String code_data[2];
code_data[0] = file_dump("4ed_api_implementation.cpp");
code_data[1] = file_dump("win32_api_impl.cpp");
Parse parses[2];
int max_name_size = 0;
int line_count = 0;
for (int J = 0; J < 2; ++J){
String *code = &code_data[J];
Parse *parse = &parses[J];
// TODO(allen): KILL THIS FUCKIN' Cpp_File FUCKIN' NONSENSE HORSE SHIT!!!!!
Cpp_File file;
file.data = code->str;
file.size = code->size;
parse->tokens = cpp_make_token_stack(512);
cpp_lex_file(file, &parse->tokens);
int count = parse->tokens.count;
Cpp_Token *tokens = parse->tokens.tokens;
Cpp_Token *token = tokens;
for (int i = 0; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
String lexeme = make_string(file.data + token->start, token->size);
if (match(lexeme, "API_EXPORT")){
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_PARENTHESE_OPEN){
break;
}
}
if (i < count){
--i;
--token;
if (token->type == CPP_TOKEN_IDENTIFIER){
++line_count;
if (max_name_size < token->size){
max_name_size = token->size;
}
}
}
}
}
}
}
int total_memory = (sizeof(String)*6 + sizeof(int))*line_count;
function_set.name = (String*)malloc(total_memory);
function_set.ret = function_set.name + line_count;
function_set.args = function_set.ret + line_count;
function_set.macros = function_set.args + line_count;
function_set.public_name = function_set.macros + line_count;
function_set.doc_string = function_set.public_name + line_count;
function_set.valid = (int*)(function_set.doc_string + line_count);
memset(function_set.name, 0, total_memory);
int sig_count = 0;
for (int J = 0; J < 2; ++J){
String *code = &code_data[J];
Parse *parse = &parses[J];
// TODO(allen): KILL THIS FUCKIN' Cpp_File FUCKIN' NONSENSE HORSE SHIT!!!!!
Cpp_File file;
file.data = code->str;
file.size = code->size;
int count = parse->tokens.count;
Cpp_Token *tokens = parse->tokens.tokens;
Cpp_Token *token = 0;
// NOTE(allen): Header Parse
token = tokens;
for (int i = 0; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
String lexeme = make_string(file.data + token->start, token->size);
if (match(lexeme, "API_EXPORT")){
++i;
++token;
if (i < count){
Cpp_Token *ret_start_token = token;
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_PARENTHESE_OPEN){
break;
}
}
Cpp_Token *args_start_token = token;
if (i < count){
--i;
--token;
function_set.name[sig_count] = make_string(file.data + token->start, token->size);
int size = token->start - ret_start_token->start;
String ret = make_string(file.data + ret_start_token->start, size);
ret = chop_whitespace(ret);
function_set.ret[sig_count] = ret;
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_PARENTHESE_CLOSE){
break;
}
}
if (i < count){
int size = token->start + token->size - args_start_token->start;;
function_set.args[sig_count] =
make_string(file.data + args_start_token->start, size);
function_set.valid[sig_count] = true;
}
}
}
if (!function_set.valid[sig_count]){
function_set.ret[sig_count] = string_zero();
function_set.name[sig_count] = string_zero();
function_set.args[sig_count] = string_zero();
// TODO(allen): get warning line numbers
printf("custom_api_spec.cpp(???) : generator warning : invalid function signature\n");
}
++sig_count;
}
}
}
// NOTE(allen): Documentation Parse
token = tokens;
for (int i = 0; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
String lexeme = make_string(file.data + token->start, token->size);
if (match(lexeme, "API_EXPORT")){
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_PARENTHESE_OPEN){
break;
}
}
if (i < count){
--i;
--token;
if (token->type == CPP_TOKEN_IDENTIFIER){
lexeme = make_string(file.data + token->start, token->size);
int match = 0;
if (string_set_match(function_set.name, sig_count, lexeme, &match)){
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_COMMENT){
lexeme = make_string(file.data + token->start, token->size);
if (check_and_fix_docs(&lexeme)){
function_set.doc_string[match] = lexeme;
perform_doc_parse(parse, lexeme);
break;
}
}
else if (token->type == CPP_TOKEN_BRACE_OPEN){
break;
}
}
}
}
}
}
}
}
}
for (int i = 0; i < sig_count; ++i){ for (int i = 0; i < sig_count; ++i){
String name_string = function_set.name[i]; String name_string = function_set.name[i];
@ -609,6 +783,9 @@ generate_custom_headers(){
to_lower(public_name); to_lower(public_name);
} }
// NOTE(allen): Header
FILE *file = fopen(API_H, "wb");
for (int i = 0; i < sig_count; ++i){ for (int i = 0; i < sig_count; ++i){
String ret_string = function_set.ret[i]; String ret_string = function_set.ret[i];
String args_string = function_set.args[i]; String args_string = function_set.args[i];
@ -655,13 +832,14 @@ generate_custom_headers(){
fprintf(file, "#define FillAppLinksAPI(app_links) do{"); fprintf(file, "#define FillAppLinksAPI(app_links) do{");
for (int i = 0; i < sig_count; ++i){ for (int i = 0; i < sig_count; ++i){
String name = function_set.name[i];
String public_string = function_set.public_name[i]; String public_string = function_set.public_name[i];
fprintf(file, fprintf(file,
"\\\n" "\\\n"
"app_links->%.*s = external_%.*s;", "app_links->%.*s = %.*s;",
public_string.size, public_string.str, public_string.size, public_string.str,
public_string.size, public_string.str name.size, name.str
); );
} }
fprintf(file, " } while(false)\n"); fprintf(file, " } while(false)\n");
@ -669,51 +847,6 @@ generate_custom_headers(){
fclose(file); fclose(file);
// NOTE(allen): Documentation // NOTE(allen): Documentation
String code_data[2];
Doc_Parse parses[2];
code_data[0] = file_dump("4ed_api_implementation.cpp");
code_data[1] = file_dump("win32_4ed.cpp");
for (int J = 0; J < 2; ++J){
String *code = &code_data[J];
Doc_Parse *parse = &parses[J];
// TODO(allen): KILL THIS FUCKIN' Cpp_File FUCKIN NONSENSE HORSE SHIT!!!!!
Cpp_File file;
file.data = code->str;
file.size = code->size;
parse->tokens = cpp_make_token_stack(512);
cpp_lex_file(file, &parse->tokens);
int count = parse->tokens.count;
Cpp_Token *tokens = parse->tokens.tokens;
Cpp_Token *token = tokens;
for (int i = 0; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_IDENTIFIER){
String lexeme = make_string(file.data + token->start, token->size);
int match = 0;
if (string_set_match(function_set.macros, sig_count, lexeme, &match)){
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_COMMENT){
lexeme = make_string(file.data + token->start, token->size);
if (check_and_fix_docs(&lexeme)){
function_set.doc_string[match] = lexeme;
perform_doc_parse(parse, lexeme);
break;
}
}
else if (token->type == CPP_TOKEN_BRACE_OPEN){
break;
}
}
}
}
}
}
file = fopen(API_DOC, "wb"); file = fopen(API_DOC, "wb");
#define CODE_STYLE "font-family: \"Courier New\", Courier, monospace; text-align: left;" #define CODE_STYLE "font-family: \"Courier New\", Courier, monospace; text-align: left;"
@ -809,9 +942,10 @@ generate_custom_headers(){
String name = function_set.public_name[i]; String name = function_set.public_name[i];
fprintf(file, fprintf(file,
"<li>\n" "<li>\n"
"<a href='#2.2.%d'>%.*s</a>\n" "<a href='#%.*s_doc'>%.*s</a>\n"
"</li>\n", "</li>\n",
i, name.size, name.str name.size, name.str,
name.size, name.str
); );
} }
fprintf(file, "</ul>\n"); fprintf(file, "</ul>\n");
@ -832,10 +966,10 @@ generate_custom_headers(){
} }
fprintf(file, fprintf(file,
"<div id='"SECTION".%d' style='margin-bottom: 1cm;'>\n" "<div id='%.*s' style='margin-bottom: 1cm;'>\n"
" <h4>&sect;"SECTION".%d: %.*s</h4>\n" " <h4>&sect;"SECTION".%d: %.*s</h4>\n"
" <div style='"CODE_STYLE" margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>", " <div style='"CODE_STYLE" margin-top: 3mm; margin-bottom: 3mm; font-size: .95em;'>",
i, i, name.size, name.str, i,
name.size, name.str name.size, name.str
); );

View File

@ -24,16 +24,16 @@ popd
pushd ..\build pushd ..\build
REM call "..\code\buildsuper.bat" ..\code\4coder_default_bindings.cpp REM call "..\code\buildsuper.bat" ..\code\4coder_default_bindings.cpp
REM call "..\code\buildsuper.bat" ..\code\power\4coder_experiments.cpp call "..\code\buildsuper.bat" ..\code\power\4coder_experiments.cpp
REM call "..\code\buildsuper.bat" ..\code\power\4coder_casey.cpp REM call "..\code\buildsuper.bat" ..\code\power\4coder_casey.cpp
REM call "..\code\buildsuper.bat" ..\4vim\4coder_chronal.cpp REM call "..\code\buildsuper.bat" ..\4vim\4coder_chronal.cpp
if %ERRORLEVEL% neq 0 (set FirstError=1) if %ERRORLEVEL% neq 0 (set FirstError=1)
set EXPORTS=/EXPORT:app_get_functions set EXPORTS=/EXPORT:app_get_functions
REM cl %OPTS% %INCLUDES% %DEFINES% ..\code\4ed_app_target.cpp %* /Fe4ed_app /LD /link /INCREMENTAL:NO /OPT:REF %EXPORTS% cl %OPTS% %INCLUDES% %DEFINES% ..\code\4ed_app_target.cpp %* /Fe4ed_app /LD /link /INCREMENTAL:NO /OPT:REF %EXPORTS%
if %ERRORLEVEL% neq 0 (set FirstError=1) if %ERRORLEVEL% neq 0 (set FirstError=1)
REM cl %OPTS% %INCLUDES% %DEFINES% ..\code\win32_4ed.cpp %LIBS% %ICON% %* /Fe4ed /link /NODEFAULTLIB:library cl %OPTS% %INCLUDES% %DEFINES% ..\code\win32_4ed.cpp %LIBS% %ICON% %* /Fe4ed /link /NODEFAULTLIB:library
if %ERRORLEVEL% neq 0 (set FirstError=1) if %ERRORLEVEL% neq 0 (set FirstError=1)
call "print_size.bat" 4ed_app.dll call "print_size.bat" 4ed_app.dll

View File

@ -1,76 +0,0 @@
// Command exectuion
void Exec_Command(Application_Links *app, int command_id);
int Exec_System_Command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags);
// File system navigation
int Directory_Get_Hot(Application_Links *app, char *out, int capacity);
int Get_4ed_Path(Application_Links *app, char *out, int capacity);
int File_Exists(Application_Links *app, char *filename, int len);
int Directory_CD(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len);
File_List Get_File_List(Application_Links *app, char *dir, int len);
void Free_File_List(Application_Links *app, File_List list);
// Clipboard
// TODO(allen): extend this API out a little bit to allow for future expansion.
void Clipboard_Post(Application_Links *app, char *str, int len);
int Clipboard_Count(Application_Links *app);
int Clipboard_Index(Application_Links *app, int index, char *out, int len);
// Direct buffer manipulation
Buffer_Summary Get_Buffer_First(Application_Links *app, unsigned int access);
void Get_Buffer_Next(Application_Links *app, Buffer_Summary *buffer, unsigned int access);
Buffer_Summary Get_Buffer(Application_Links *app, int buffer_id, unsigned int access);
Buffer_Summary Get_Buffer_By_Name(Application_Links *app, char *name, int len, unsigned int access);
int Buffer_Seek(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags);
int Buffer_Read_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out);
int Buffer_Replace_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len);
int Buffer_Set_Setting(Application_Links *app, Buffer_Summary *buffer, int setting, int value);
int Buffer_Auto_Indent(Application_Links *app, Buffer_Summary *buffer, int start, int end, int tab_width, unsigned int flags);
Buffer_Summary Create_Buffer(Application_Links *app, char *filename, int filename_len, unsigned int flags);
int Save_Buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int filename_len, unsigned int flags);
int Kill_Buffer(Application_Links *app, Buffer_Identifier buffer, int view_id, unsigned int flags);
// View manipulation
View_Summary Get_View_First(Application_Links *app, unsigned int access);
void Get_View_Next(Application_Links *app, View_Summary *view, unsigned int access);
View_Summary Get_View(Application_Links *app, int view_id, unsigned int access);
View_Summary Get_Active_View(Application_Links *app, unsigned int access);
int View_Compute_Cursor (Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out);
int View_Set_Cursor (Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x);
int View_Set_Mark (Application_Links *app, View_Summary *view, Buffer_Seek seek);
int View_Set_Highlight (Application_Links *app, View_Summary *view, int start, int end, int turn_on);
int View_Set_Buffer (Application_Links *app, View_Summary *view, int buffer_id, unsigned int flags);
int View_Post_Fade (Application_Links *app, View_Summary *view, float seconds, int start, int end, unsigned int color);
// TODO(allen):
// Get rid of this temporary hack ass soon ass possible.
void View_Set_Paste_Rewrite_(Application_Links *app, View_Summary *view);
int View_Get_Paste_Rewrite_(Application_Links *app, View_Summary *view);
// Directly get user input
User_Input Get_User_Input (Application_Links *app, unsigned int get_type, unsigned int abort_type);
User_Input Get_Command_Input (Application_Links *app);
Mouse_State Get_Mouse_State (Application_Links *app);
//Event_Message Get_Event_Message (Application_Links *app);
// Queries and information display
int Start_Query_Bar (Application_Links *app, Query_Bar *bar, unsigned int flags);
void End_Query_Bar (Application_Links *app, Query_Bar *bar, unsigned int flags);
void Print_Message (Application_Links *app, char *str, int len);
//GUI_Functions* Get_GUI_Functions(Application_Links *app);
//GUI* Get_GUI(Application_Links *app, int view_id);
// Color settings
void Change_Theme (Application_Links *app, char *name, int len);
void Change_Font (Application_Links *app, char *name, int len);
void Set_Theme_Colors (Application_Links *app, Theme_Color *colors, int count);
void Get_Theme_Colors (Application_Links *app, Theme_Color *colors, int count);

View File

@ -867,100 +867,12 @@ Sys_File_Unique_Hash_Sig(system_file_unique_hash){
return(hash); return(hash);
} }
// NOTE(allen): Exposed to the custom layer.
internal
FILE_EXISTS_SIG(system_file_exists)/*
DOC_PARAM(filename, the full path to a file)
DOC_PARAM(len, the number of characters in the filename string)
DOC_RETURN(returns non-zero if the file exists, returns zero if the file does not exist)
*/{
char full_filename_space[1024];
String full_filename;
HANDLE file;
b32 result;
result = 0;
if (len < sizeof(full_filename_space)){
full_filename = make_fixed_width_string(full_filename_space);
copy(&full_filename, make_string(filename, len));
terminate_with_null(&full_filename);
file = CreateFile(full_filename.str, GENERIC_READ, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (file != INVALID_HANDLE_VALUE){
CloseHandle(file);
result = 1;
}
}
return(result);
}
b32 Win32DirectoryExists(char *path){ b32 Win32DirectoryExists(char *path){
DWORD attrib = GetFileAttributesA(path); DWORD attrib = GetFileAttributesA(path);
return (attrib != INVALID_FILE_ATTRIBUTES && return (attrib != INVALID_FILE_ATTRIBUTES &&
(attrib & FILE_ATTRIBUTE_DIRECTORY)); (attrib & FILE_ATTRIBUTE_DIRECTORY));
} }
// NOTE(allen): Exposed to the custom layer.
internal
DIRECTORY_CD_SIG(system_directory_cd)/*
DOC_PARAM(dir, a string buffer containing a directory)
DOC_PARAM(len, the length of the string in the string buffer)
DOC_PARAM(capacity, the maximum size of the string buffer)
DOC_PARAM(rel_path, the path to change to, may include '.' or '..')
DOC_PARAM(rel_len, the length of the rel_path string)
DOC_RETURN(returns non-zero if the call succeeds, returns zero otherwise)
DOC
(
This call succeeds if the directory exists and the new directory fits inside the dir buffer.
If the call succeeds the dir buffer is filled with the new directory and len contains the
length of the string in the buffer.
For instance if dir contains "C:/Users/MySelf" and rel is "Documents" the buffer will contain
"C:/Users/MySelf/Documents" and len will contain the length of that string. This call can
also be used with rel as ".." to traverse to parent folders.
)
*/{
String directory = make_string(dir, *len, capacity);
b32 result = 0;
i32 old_size;
char rel_path_space[1024];
String rel_path_string = make_fixed_width_string(rel_path_space);
copy(&rel_path_string, make_string(rel_path, rel_len));
terminate_with_null(&rel_path_string);
if (rel_path[0] != 0){
if (rel_path[0] == '.' && rel_path[1] == 0){
result = 1;
}
else if (rel_path[0] == '.' && rel_path[1] == '.' && rel_path[2] == 0){
result = remove_last_folder(&directory);
terminate_with_null(&directory);
}
else{
if (directory.size + rel_len + 1 > directory.memory_size){
old_size = directory.size;
append_partial(&directory, rel_path);
append_partial(&directory, "\\");
if (Win32DirectoryExists(directory.str)){
result = 1;
}
else{
directory.size = old_size;
}
}
}
}
*len = directory.size;
return(result);
}
internal internal
Sys_Get_Binary_Path_Sig(system_get_binary_path){ Sys_Get_Binary_Path_Sig(system_get_binary_path){
i32 result = 0; i32 result = 0;
@ -974,16 +886,7 @@ Sys_Get_Binary_Path_Sig(system_get_binary_path){
return(result); return(result);
} }
// NOTE(allen): Exposed to the custom layer. #include "win32_api_impl.cpp"
GET_4ED_PATH_SIG(system_get_4ed_path)/*
DOC_PARAM(out, a buffer that receives the path to the 4ed executable file)
DOC_PARAM(capacity, the maximum capacity of the output buffer)
DOC_RETURN(returns non-zero on success, returns zero on failure)
*/{
String str = make_string(out, 0, capacity);
return(system_get_binary_path(&str));
}
// //
// Clipboard // Clipboard
@ -1323,9 +1226,9 @@ Win32LoadSystemCode(){
win32vars.system.file_load_end = system_file_load_end; win32vars.system.file_load_end = system_file_load_end;
win32vars.system.file_save = system_file_save; win32vars.system.file_save = system_file_save;
win32vars.system.file_exists = system_file_exists; win32vars.system.file_exists = File_Exists;
win32vars.system.directory_cd = system_directory_cd; win32vars.system.directory_cd = Directory_CD;
win32vars.system.get_4ed_path = system_get_4ed_path; win32vars.system.get_4ed_path = Get_4ed_Path;
win32vars.system.post_clipboard = system_post_clipboard; win32vars.system.post_clipboard = system_post_clipboard;

111
win32_api_impl.cpp Normal file
View File

@ -0,0 +1,111 @@
/*
Implementation of system level functions that get exposed straight
into the 4coder custom API. This file need not be split on other platforms,
as this is the only one that will be used for generating headers and docs.
-Allen
27.06.2016 (dd.mm.yyyy)
*/
// TOP
#define API_EXPORT
API_EXPORT int
File_Exists(Application_Links *app, char *filename, int len)/*
DOC_PARAM(filename, the full path to a file)
DOC_PARAM(len, the number of characters in the filename string)
DOC_RETURN(returns non-zero if the file exists, returns zero if the file does not exist)
*/{
char full_filename_space[1024];
String full_filename;
HANDLE file;
b32 result;
result = 0;
if (len < sizeof(full_filename_space)){
full_filename = make_fixed_width_string(full_filename_space);
copy(&full_filename, make_string(filename, len));
terminate_with_null(&full_filename);
file = CreateFile(full_filename.str, GENERIC_READ, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (file != INVALID_HANDLE_VALUE){
CloseHandle(file);
result = 1;
}
}
return(result);
}
API_EXPORT int
Directory_CD(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len)/*
DOC_PARAM(dir, a string buffer containing a directory)
DOC_PARAM(len, the length of the string in the string buffer)
DOC_PARAM(capacity, the maximum size of the string buffer)
DOC_PARAM(rel_path, the path to change to, may include '.' or '..')
DOC_PARAM(rel_len, the length of the rel_path string)
DOC_RETURN(returns non-zero if the call succeeds, returns zero otherwise)
DOC
(
This call succeeds if the directory exists and the new directory fits inside the dir buffer.
If the call succeeds the dir buffer is filled with the new directory and len contains the
length of the string in the buffer.
For instance if dir contains "C:/Users/MySelf" and rel is "Documents" the buffer will contain
"C:/Users/MySelf/Documents" and len will contain the length of that string. This call can
also be used with rel set to ".." to traverse to parent folders.
)
*/{
String directory = make_string(dir, *len, capacity);
b32 result = 0;
i32 old_size;
char rel_path_space[1024];
String rel_path_string = make_fixed_width_string(rel_path_space);
copy(&rel_path_string, make_string(rel_path, rel_len));
terminate_with_null(&rel_path_string);
if (rel_path[0] != 0){
if (rel_path[0] == '.' && rel_path[1] == 0){
result = 1;
}
else if (rel_path[0] == '.' && rel_path[1] == '.' && rel_path[2] == 0){
result = remove_last_folder(&directory);
terminate_with_null(&directory);
}
else{
if (directory.size + rel_len + 1 > directory.memory_size){
old_size = directory.size;
append_partial(&directory, rel_path);
append_partial(&directory, "\\");
if (Win32DirectoryExists(directory.str)){
result = 1;
}
else{
directory.size = old_size;
}
}
}
}
*len = directory.size;
return(result);
}
API_EXPORT int
Get_4ed_Path(Application_Links *app, char *out, int capacity)/*
DOC_PARAM(out, a buffer that receives the path to the 4ed executable file)
DOC_PARAM(capacity, the maximum capacity of the output buffer)
DOC_RETURN(returns non-zero on success, returns zero on failure)
*/{
String str = make_string(out, 0, capacity);
return(system_get_binary_path(&str));
}
// BOTTOM