Hi Bram,
2016/8/7 Sun 22:19:47 UTC+9 Bram Moolenaar wrote:
> Patch 7.4.2176
> Problem: #ifdefs in main() are complicated.
> Solution: Always define vim_main2(). Move params to the file level.
> (suggested by Ken Takata)
> Files: src/main.c, src/structs.h, src/vim.h, src/if_mzsch.c,
> src/proto/if_mzsch.pro
After this patch, we can use cproto for generating the prototype of
vim_main2().
However, when I try to use cproto on Cygwin, some prototypes are not
generated as expected. Please check the attached two patches.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent 20b84236d788862e9e492c307b105779fb1f8994
diff --git a/src/main.c b/src/main.c
--- a/src/main.c
+++ b/src/main.c
@@ -416,6 +416,7 @@ main
#endif
}
#endif /* NO_VIM_MAIN */
+#endif /* PROTO */
/*
* vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep
@@ -879,7 +880,6 @@ vim_main2(void)
return 0;
}
-#endif /* PROTO */
/*
* Initialisation shared by main() and some tests.
diff --git a/src/proto/main.pro b/src/proto/main.pro
--- a/src/proto/main.pro
+++ b/src/proto/main.pro
@@ -1,5 +1,6 @@
/* main.c */
-void common_init(mparm_T *params);
+int vim_main2(void);
+void common_init(mparm_T *paramp);
void main_loop(int cmdwin, int noexmode);
void getout_preserve_modified(int exitval);
void getout(int exitval);
diff --git a/src/vim.h b/src/vim.h
--- a/src/vim.h
+++ b/src/vim.h
@@ -2449,9 +2449,6 @@ typedef enum
#define JSON_JS 1 /* use JS instead of JSON */
#define JSON_NO_NONE 2 /* v:none item not allowed */
-/* This is in main.c, cproto can't handle it. */
-int vim_main2(void);
-
/* Used for flags of do_in_path() */
#define DIP_ALL 0x01 /* all matches, not just the first one */
#define DIP_DIR 0x02 /* find directories instead of files. */
# HG changeset patch
# Parent fe59000c44d3311ea962633b84c7e302c2289aa4
diff --git a/src/gui.h b/src/gui.h
--- a/src/gui.h
+++ b/src/gui.h
@@ -16,7 +16,7 @@
# include <X11/StringDefs.h>
#endif
-#ifdef FEAT_BEVAL
+#if defined(FEAT_BEVAL) || defined(PROTO)
# include "gui_beval.h"
#endif
diff --git a/src/gui_w32.c b/src/gui_w32.c
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -247,6 +247,7 @@ gui_mch_set_rendering_options(char_u *s)
# define CONST
# define FAR
# define NEAR
+# undef _cdecl
# define _cdecl
typedef int BOOL;
typedef int BYTE;
@@ -288,6 +289,7 @@ typedef void VOID;
typedef int LPNMHDR;
typedef int LONG;
typedef int WNDPROC;
+typedef int UINT_PTR;
#endif
#ifndef GET_X_LPARAM
@@ -3411,7 +3413,7 @@ gui_mch_settitle(
set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title));
}
-#ifdef FEAT_MOUSESHAPE
+#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
/* Table for shape IDCs. Keep in sync with the mshape_names[] table in
* misc2.c! */
static LPCSTR mshape_idcs[] =
@@ -3466,7 +3468,7 @@ mch_set_mouse_shape(int shape)
}
#endif
-#ifdef FEAT_BROWSE
+#if defined(FEAT_BROWSE) || defined(PROTO)
/*
* The file browser exists in two versions: with "W" uses wide characters,
* without "W" the current codepage. When FEAT_MBYTE is defined and on
diff --git a/src/ops.c b/src/ops.c
--- a/src/ops.c
+++ b/src/ops.c
@@ -6283,7 +6283,7 @@ write_viminfo_registers(FILE *fp)
* 'permanent' of the two), otherwise the PRIMARY one.
* For now, use a hard-coded sanity limit of 1Mb of data.
*/
-#if defined(FEAT_X11) && defined(FEAT_CLIPBOARD)
+#if (defined(FEAT_X11) && defined(FEAT_CLIPBOARD)) || defined(PROTO)
void
x11_export_final_selection(void)
{
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -33,7 +33,7 @@ void free_all_autocmds(void);
int check_ei(void);
char_u *au_event_disable(char *what);
void au_event_restore(char_u *old_ei);
-void do_autocmd(char_u *arg, int forceit);
+void do_autocmd(char_u *arg_in, int forceit);
int do_doautocmd(char_u *arg, int do_msg, int *did_something);
void ex_doautoall(exarg_T *eap);
int check_nomodeline(char_u **argp);
diff --git a/src/proto/message.pro b/src/proto/message.pro
--- a/src/proto/message.pro
+++ b/src/proto/message.pro
@@ -4,7 +4,7 @@ int verb_msg(char_u *s);
int msg_attr(char_u *s, int attr);
int msg_attr_keep(char_u *s, int attr, int keep);
char_u *msg_strtrunc(char_u *s, int force);
-void trunc_string(char_u *s, char_u *buf, int room, int buflen);
+void trunc_string(char_u *s, char_u *buf, int room_in, int buflen);
void reset_last_sourcing(void);
void msg_source(int attr);
int emsg_not_now(void);
diff --git a/src/proto/normal.pro b/src/proto/normal.pro
--- a/src/proto/normal.pro
+++ b/src/proto/normal.pro
@@ -16,7 +16,7 @@ void push_showcmd(void);
void pop_showcmd(void);
void do_check_scrollbind(int check);
void check_scrollbind(linenr_T topline_diff, long leftcol_diff);
-int find_decl(char_u *ptr, int len, int locally, int thisblock, int searchflags);
+int find_decl(char_u *ptr, int len, int locally, int thisblock, int flags_arg);
void scroll_redraw(int up, long count);
void handle_tabmenu(void);
void do_nv_ident(int c1, int c2);
diff --git a/src/proto/ops.pro b/src/proto/ops.pro
--- a/src/proto/ops.pro
+++ b/src/proto/ops.pro
@@ -47,7 +47,7 @@ void op_addsub(oparg_T *oap, linenr_T Pr
void prepare_viminfo_registers(void);
void finish_viminfo_registers(void);
int read_viminfo_register(vir_T *virp, int force);
-void handle_viminfo_register(garray_T *values, int writing);
+void handle_viminfo_register(garray_T *values, int force);
void write_viminfo_registers(FILE *fp);
void x11_export_final_selection(void);
void clip_free_selection(VimClipboard *cbd);
diff --git a/src/vim.h b/src/vim.h
--- a/src/vim.h
+++ b/src/vim.h
@@ -2118,7 +2118,7 @@ typedef enum
* been seen at that stage. But it must be before globals.h, where error_ga
* is declared. */
#if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \
- && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC)
+ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO)
# define mch_errmsg(str) fprintf(stderr, "%s", (str))
# define display_errors() fflush(stderr)
# define mch_msg(str) printf("%s", (str))