finally break-up Patch Collection
[nedit-bw.git] / enhanced-disable-typeof-macro.patch
blobb5f37304a73984018e3da014819c3bdba0ff9de0
1 ---
3 doc/help.etx | 9 ---------
4 source/highlightData.c | 2 +-
5 source/interpret.c | 14 ++------------
6 source/macro.c | 49 -------------------------------------------------
7 4 files changed, 3 insertions(+), 71 deletions(-)
9 diff --quilt old/doc/help.etx new/doc/help.etx
10 --- old/doc/help.etx
11 +++ new/doc/help.etx
12 @@ -2871,19 +2871,10 @@ Macro Subroutines
13 Return an all lower-case version of string.
15 **toupper( string )**
16 Return an all upper-case version of string.
18 -**typeof( value )**
19 - Returns a string indicating the type of a macro value. The value can be
20 - any NEdit macro language value except for the return value of functions
21 - without a return value. Examples:
22 - typeof(2) # -> "INTEGER"
23 - typeof($empty_array) # -> "ARRAY"
24 - typeof(get_range(10, 20)) # -> "STRING"
25 - typeof(myArray["doesnotexist"]) # -> "UNDEFINED"
27 **valid_number( string )**
28 Returns 1 if the string can be converted to a number without error
29 following the same rules that the implicit conversion would. Otherwise 0.
31 **write_file( string, filename )**
32 diff --quilt old/source/interpret.c new/source/interpret.c
33 --- old/source/interpret.c
34 +++ new/source/interpret.c
35 @@ -1320,17 +1320,13 @@ static int pushSymVal(void)
36 return execError(errMsg, s->name);
38 *StackP = result;
39 } else
40 return execError("reading non-variable: %s", s->name);
42 -/* typeof()
43 if (StackP->tag == NO_TAG) {
44 return execError("variable not set: %s", s->name);
46 -*/
48 StackP++;
49 if (StackP >= &TheStack[STACK_SIZE]) {
50 return execError(StackOverflowMsg, "");
52 return STAT_OK;
53 @@ -1431,15 +1427,13 @@ static int pushArraySymVal(void)
54 if (initEmpty && dataPtr->tag == NO_TAG) {
55 dataPtr->tag = ARRAY_TAG;
56 dataPtr->val.arrayPtr = ArrayNew();
59 -/* typeof()
60 if (dataPtr->tag == NO_TAG) {
61 return execError("variable not set: %s", sym->name);
63 -*/
65 *StackP = *dataPtr;
66 StackP++;
68 if (StackP >= &TheStack[STACK_SIZE]) {
69 @@ -3091,21 +3085,17 @@ static int arrayRef(void)
72 POP(srcArray)
73 if (srcArray.tag == ARRAY_TAG) {
74 if (!ArrayGet(&srcArray, keyString, &valueItem)) {
75 -/*typeof() return(execError("referenced array value not in array: %s", keyString));*/
76 - valueItem.tag = NO_TAG;
77 + return(execError("referenced array value not in array: %s", keyString));
79 PUSH(valueItem)
80 return(STAT_OK);
82 else {
83 -/*typeof() return(execError("operator [] on non-array", NULL));*/
84 - valueItem.tag = NO_TAG;
85 - PUSH(valueItem)
86 - return(STAT_OK);
87 + return(execError("operator [] on non-array", NULL));
90 else {
91 POP(srcArray)
92 if (srcArray.tag == ARRAY_TAG) {
93 diff --quilt old/source/macro.c new/source/macro.c
94 --- old/source/macro.c
95 +++ new/source/macro.c
96 @@ -410,12 +410,10 @@ static int getStyleAtPosMS(WindowInfo *w
97 DataValue *result, char **errMsg);
98 static int filenameDialogMS(WindowInfo* window, DataValue* argList, int nArgs,
99 DataValue* result, char** errMsg);
100 static int callMS(WindowInfo *window, DataValue *argList,
101 int nArgs, DataValue *result, char **errMsg);
102 -static int typeofMS(WindowInfo* window, DataValue* argList, int nArgs,
103 - DataValue* result, char** errMsg);
105 /* Built-in subroutines and variables for the macro language */
106 static const BuiltInSubrName MacroSubrs[] = {
107 { "length", lengthMS },
108 { "get_range", getRangeMS },
109 @@ -473,11 +471,10 @@ static const BuiltInSubrName MacroSubrs[
110 { "get_pattern_at_pos", getPatternAtPosMS },
111 { "get_style_by_name", getStyleByNameMS },
112 { "get_style_at_pos", getStyleAtPosMS },
113 { "filename_dialog", filenameDialogMS },
114 { "call", callMS },
115 - { "typeof", typeofMS },
116 { NULL, NULL } /* sentinel */
119 static const BuiltInSubrName SpecialVars[] = {
120 { "$cursor", cursorMV },
121 @@ -5956,56 +5953,10 @@ static int getPatternAtPosMS(WindowInfo
122 return fillPatternResult(result, errMsg, window,
123 HighlightNameOfCode(window, patCode), False, True,
124 HighlightStyleOfCode(window, patCode), bufferPos);
128 -** Returns a string containing a flag indicating the arguments type:
129 -** ARRAY - Argument is an array
130 -** INTEGER - Argument is an integer or a string that can be cleanly
131 -** transformed into an integer.
132 -** STRING - Argument is a string that cannot be cleanly transformed
133 -** into an integer.
134 -** UNDEFINED - Argument is undefined. No support for void functions though.
136 -static int typeofMS(WindowInfo* window, DataValue* argList, int nArgs,
137 - DataValue* result, char** errMsg)
139 - int buffer;
141 - /* Validate number of arguments. */
142 - if (1 != nArgs) {
143 - return wrongNArgsErr(errMsg);
146 - /* Prepare result. */
147 - result->tag = STRING_TAG;
149 - switch (argList[0].tag) {
150 - case STRING_TAG:
151 - if (readIntArg(argList[0], &buffer, errMsg)) {
152 - AllocNStringCpy(&result->val.str, "INTEGER");
153 - } else {
154 - AllocNStringCpy(&result->val.str, "STRING");
156 - break;
157 - case INT_TAG:
158 - AllocNStringCpy(&result->val.str, "INTEGER");
159 - break;
160 - case ARRAY_TAG:
161 - AllocNStringCpy(&result->val.str, "ARRAY");
162 - break;
163 - case NO_TAG:
164 - AllocNStringCpy(&result->val.str, "UNDEFINED");
165 - break;
166 - default:
167 - fprintf(stderr, "nedit: Internal error: Invalid type in typeofMS().\n");
170 - return True;
173 static int wrongNArgsErr(char **errMsg)
175 *errMsg = "Wrong number of arguments to function %s";
176 return False;
178 diff --quilt old/source/highlightData.c new/source/highlightData.c
179 --- old/source/highlightData.c
180 +++ new/source/highlightData.c
181 @@ -549,11 +549,11 @@ static char *DefaultPatternSets[] = {
182 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
183 Comment:\"#\":\"$\"::Comment::\n\
184 Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line|VERSION|NEDIT_HOME)>\":::Identifier::\n\
185 Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
186 Built-in Special Vars:\"(?<!\\Y)\\$(?:[1-9]|list_dialog_button|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep)>\":::String1::\n\
187 - Built-in Subrs:\"<(?:append_file|beep|call|calltip|clipboard_to_string|dialog|filename_dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|highlight_calltip_line|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_transient|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|typeof|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
188 + Built-in Subrs:\"<(?:append_file|beep|call|calltip|clipboard_to_string|dialog|filename_dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|highlight_calltip_line|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_transient|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
189 Menu Actions:\"<(?:new(?:_tab|_opposite)?|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-pane|split_pane|close-pane|close_pane|detach_document(?:_dialog)?|move_document_dialog|(?:next|previous|last)_document|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|post_tab_context_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
190 Text Actions:\"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)(?=\\s*\\()\":::Subroutine::\n\
191 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
192 Braces:\"[{}\\[\\]]\":::Keyword::\n\
193 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\