updated for version 7.0022

This commit is contained in:
Bram Moolenaar
2004-12-12 11:33:30 +00:00
parent 293ee4d421
commit d8b0cf1cc5
20 changed files with 347 additions and 120 deletions

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2004 Oct 24
*eval.txt* For Vim version 7.0aa. Last change: 2004 Dec 10
VIM REFERENCE MANUAL by Bram Moolenaar
@ -856,6 +856,7 @@ getcmdpos() Number return cursor position in command-line
getcwd() String the current working directory
getfperm( {fname}) String file permissions of file {fname}
getfsize( {fname}) Number size in bytes of file {fname}
getfontname( [{name}]) String name of font being used
getftime( {fname}) Number last modification time of file
getftype( {fname}) String description of type of file {fname}
getline( {lnum}) String line {lnum} from current buffer
@ -1633,6 +1634,20 @@ getfsize({fname}) *getfsize()*
If {fname} is a directory, 0 is returned.
If the file {fname} can't be found, -1 is returned.
getfontname([{name}]) *getfontname()*
Without an argument returns the name of the normal font being
used. Like what is used for the Normal highlight group
|hl-Normal|.
With an argument a check is done whether {name} is a valid
font name. If not then an empty string is returned.
Otherwise the actual font name is returned, or {name} if the
GUI does not support obtaining the real name.
Only works when the GUI is running, thus not you your vimrc or
Note that the GTK 2 GUI accepts any font name, thus checking
for a valid name does not work.
gvimrc file. Use the |GUIEnter| autocommand to use this
function just after the GUI has started.
getfperm({fname}) *getfperm()*
The result is a String, which is the read, write, and execute
permissions of the given file {fname}.

View File

@ -4803,6 +4803,7 @@ getcharmod() eval.txt /*getcharmod()*
getcmdline() eval.txt /*getcmdline()*
getcmdpos() eval.txt /*getcmdpos()*
getcwd() eval.txt /*getcwd()*
getfontname() eval.txt /*getfontname()*
getfperm() eval.txt /*getfperm()*
getfsize() eval.txt /*getfsize()*
getftime() eval.txt /*getftime()*
@ -4932,6 +4933,7 @@ hebrew hebrew.txt /*hebrew*
hebrew.txt hebrew.txt /*hebrew.txt*
help various.txt /*help*
help-context help.txt /*help-context*
help-tags tags 1
help-translated various.txt /*help-translated*
help-xterm-window various.txt /*help-xterm-window*
help.txt help.txt /*help.txt*

View File

@ -3958,6 +3958,16 @@ expand_filename(eap, cmdlinep, errormsgp)
continue;
}
/* Wildcards won't be expanded below, the replacement is taken
* literally. But do expand "~/file", "~user/file" and "$HOME/file". */
if (vim_strchr(repl, '$') != NULL || vim_strchr(repl, '~') != NULL)
{
char_u *l = repl;
repl = expand_env_save(repl);
vim_free(l);
}
/* Need to escape white space et al. with a backslash. Don't do this
* for shell commands (may have to use quotes instead). Don't do this
* for non-unix systems when there is a single argument (spaces don't

View File

@ -546,6 +546,10 @@ gui_init()
if (!im_xim_isvalid_imactivate())
EMSG(_("E599: Value of 'imactivatekey' is invalid"));
#endif
/* When 'cmdheight' was set during startup it may not have taken
* effect yet. */
if (p_ch != 1L)
command_height(1L);
return;
}
@ -741,6 +745,7 @@ set_guifontwide(name)
font = gui_mch_get_font(wide_name, FALSE);
if (font != NOFONT)
{
gui_mch_free_font(gui.wide_font);
gui.wide_font = font;
set_string_option_direct((char_u *)"gfw", -1,
wide_name, OPT_FREE);

View File

@ -1209,6 +1209,11 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
}
#endif
char_u *gui_mch_getfontname(GuiFont font)
{
return vim_strsave((char_u *)"default");
}
int gui_mch_init_font(char_u *font_name, int fontset)
{
/*D("gui_mch_init_font");*/
@ -1227,12 +1232,22 @@ gui_mch_adjust_charsize()
}
GuiFont
gui_mch_get_font( char_u *name, int giveErrorIfMissing)
gui_mch_get_font(char_u *name, int giveErrorIfMissing)
{
/*D("gui_mch_get_font");*/
return NULL;
}
/*
* Return the name of font "font" in allocated memory.
* We always use the default font.
*/
char_u *
gui_mch_get_fontname(GuiFont font, char_u *name)
{
return vim_strsave((char_u *)"default");
}
void
gui_mch_set_font(GuiFont font)
{

View File

@ -2396,6 +2396,15 @@ error:
return (GuiFont)font;
}
/*
* Return the name of font "font" in allocated memory.
*/
char_u *
gui_mch_get_fontname(GuiFont font, char_u *name)
{
return vim_strsave(((VimFont *)font)->name);
}
/*
* Set the current text font.
*/

View File

@ -384,7 +384,7 @@ gui_mch_open()//{{{
vmw->menuBar()->insertItem("&KVim", vmw->w->menu);
#endif
if (startfont!=NULL)
gui_mch_init_font((char_u*)startfont->latin1(),0);
gui_mch_init_font((char_u*)startfont->latin1(), FALSE);
if (startsize!=NULL)
vmw->resize(startsize->width(), startsize->height());
@ -558,9 +558,9 @@ char_u *gui_mch_font_dialog (char_u *oldval)//{{{
gui_mch_init_font(char_u * font_name, int fontset)//{{{
{
QString fontname;
GuiFont font=NULL;
GuiFont font = NULL;
if (font_name==NULL)
if (font_name == NULL)
{
#if 0
#if QT_VERSION>=300
@ -589,31 +589,30 @@ gui_mch_init_font(char_u * font_name, int fontset)//{{{
font = new QFont();
font->fromString( fontname );
*/
#ifdef FEAT_XFONTSET
if (fontset)
font = gui_mch_get_fontset(font_name, TRUE, TRUE);
if (font == NULL)
#endif
font = gui_mch_get_font(font_name, FALSE);
if (font == NULL)
return FAIL;
if (fontname.contains('*') && fontname.contains('-'))
return FAIL;
gui_mch_free_font(gui.norm_font);
#ifdef FEAT_XFONTSET
gui_mch_free_fontset(gui.fontset);
gui.fontset = NOFONTSET;
if (fontset)
font = gui_mch_get_fontset(font_name,TRUE,TRUE);
{
gui.fontset = font;
gui.norm_font = NOFONT;
}
else
#endif
if (font == NULL) {
font = gui_mch_get_font(font_name,FALSE);
gui.norm_font = font;
#ifdef FEAT_XFONTSET
gui.fontset=NOFONTSET;
#endif
}
#ifdef FEAT_XFONTSET
else {
gui.fontset=font;
gui.norm_font=NOFONT;
}
#endif
if (font == NULL)
return FAIL;
if (fontname.contains('*') && fontname.contains('-'))
return FAIL;
/* Compute the width of the character cell. Some fonts include
* double-width characters. Use the width of ASCII characters to find
@ -660,6 +659,20 @@ gui_mch_get_font(char_u * name, int report_error)//{{{
return (GuiFont) myFont;
}//}}}
/*
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
*/
char_u *
gui_mch_get_fontname(font, name)
GuiFont font;
char_u *name;
{
if (name == NULL)
return NULL;
return vim_strsave(name);
}
/*
* Set the current text font.
* Since we create all GC on demand, we use just gui.current_font to

View File

@ -548,7 +548,7 @@ char_u **new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error)
/* Caller is able to clean up */
/* TODO: Should be clean up or not? For safety. */
#ifdef USE_SIOUX
printf("aevt_odoc: AEGetNthPtr error: %d\n", newError);
printf("aevt_odoc: AEGetNthPtr error: %ld\n", (long)newError);
#endif
return(fnames);
}
@ -1130,7 +1130,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
if (error)
{
#ifdef USE_SIOUX
printf("aevt_odoc: AEGetParamDesc error: %d\n", error);
printf("aevt_odoc: AEGetParamDesc error: %ld\n", (long)error);
#endif
return(error);
}
@ -1144,15 +1144,16 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
if (error)
{
#ifdef USE_SIOUX
printf("aevt_odoc: AEGetParamPtr error: %d\n", error);
printf("aevt_odoc: AEGetParamPtr error: %ld\n", (long)error);
#endif
return(error);
}
#ifdef USE_SIOUX
printf("aevt_odoc: lineNum: %d, startRange %d, endRange %d, [date %lx]\n",
thePosition.lineNum, thePosition.startRange, thePosition.endRange,
thePosition.theDate);
printf("aevt_odoc: lineNum: %d, startRange %ld, endRange %ld, [date %lx]\n",
(int)thePosition.lineNum,
(long)thePosition.startRange, (long)thePosition.endRange,
(long)thePosition.theDate);
#endif
/*
error = AEGetParamDesc(theAEvent, keyAEPosition, typeChar, &thePosition);
@ -1209,7 +1210,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
{
if (thePosition.lineNum >= 0)
{
lnum = thePosition.lineNum;
lnum = thePosition.lineNum + 1;
/* oap->motion_type = MLINE;
setpcmark();*/
if (lnum < 1L)
@ -1217,6 +1218,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
else if (lnum > curbuf->b_ml.ml_line_count)
lnum = curbuf->b_ml.ml_line_count;
curwin->w_cursor.lnum = lnum;
curwin->w_cursor.col = 0;
/* beginline(BL_SOL | BL_FIX);*/
}
else
@ -1225,9 +1227,32 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
/* Update the screen display */
update_screen(NOT_VALID);
#ifdef FEAT_VISUAL
/* Select the text if possible */
if (gotPosition)
{
VIsual_active = TRUE;
VIsual_select = FALSE;
if (thePosition.lineNum < 0)
{
VIsual_mode = 'v';
VIsual = curwin->w_cursor;
goto_byte(thePosition.endRange);
}
else
{
VIsual_mode = 'V';
VIsual = curwin->w_cursor;
VIsual.col = 0;
}
}
#endif
setcursor();
out_flush();
/* Fake mouse event to wake from stall */
PostEvent(mouseUp, 0);
finished:
AEDisposeDesc(&theList); /* dispose what we allocated */
@ -1235,7 +1260,7 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon)
if (error)
{
#ifdef USE_SIOUX
printf("aevt_odoc: HandleUnusedParms error: %d\n", error);
printf("aevt_odoc: HandleUnusedParms error: %ld\n", (long)error);
#endif
return(error);
}
@ -2513,6 +2538,8 @@ gui_mac_mouse_wheel(EventHandlerCallRef nextHandler, EventRef theEvent,
kEventPriorityLow))
goto bail;
ReleaseEvent(bogusEvent);
if (noErr == GetWindowBounds(gui.VimWindow, kWindowContentRgn, &bounds))
{
point.h -= bounds.left;
@ -3028,6 +3055,10 @@ receiveHandler(WindowRef theWindow, void* handlerRefCon, DragRef theDrag)
count = j;
gui_handle_drop(x, y, modifiers, fnames, count);
/* Fake mouse event to wake from stall */
PostEvent(mouseUp, 0);
return noErr;
}
@ -3433,6 +3464,7 @@ gui_mch_init_font(font_name, fontset)
FontInfo font_info;
short font_id;
GuiFont font;
char_u used_font_name[512];
if (font_name == NULL)
{
@ -3443,23 +3475,26 @@ gui_mch_init_font(font_name, fontset)
{
/* Then pickup the standard application font */
font_id = GetAppFont();
STRCPY(used_font_name, "default");
}
else
STRCPY(used_font_name, "Monaco");
font = (suggestedSize << 16) + ((long) font_id & 0xFFFF);
}
#if defined(USE_CARBONIZED) && defined(MACOS_X)
else if (STRCMP(font_name, "*") == 0)
{
char_u *new_p_guifont, font_name[512];
char_u *new_p_guifont;
font = gui_mac_select_font(font_name);
font = gui_mac_select_font(used_font_name);
if (font == NOFONT)
return FAIL;
/* Set guifont to the name of the selected font. */
new_p_guifont = alloc(STRLEN(font_name) + 1);
new_p_guifont = alloc(STRLEN(used_font_name) + 1);
if (new_p_guifont != NULL)
{
STRCPY(new_p_guifont, font_name);
STRCPY(new_p_guifont, used_font_name);
vim_free(p_guifont);
p_guifont = new_p_guifont;
/* Replace spaces in the font name with underscores. */
@ -3474,12 +3509,17 @@ gui_mch_init_font(font_name, fontset)
else
{
font = gui_mac_find_font(font_name);
STRNCPY(used_font_name, font_name, sizeof(used_font_name));
used_font_name[sizeof(used_font_name) - 1] = NUL;
if (font == NOFONT)
return FAIL;
}
gui.norm_font = font;
hl_set_font_name(used_font_name);
TextSize(font >> 16);
TextFont(font & 0xFFFF);
@ -3529,6 +3569,20 @@ gui_mch_get_font(name, giveErrorIfMissing)
return font;
}
/*
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
*/
char_u *
gui_mch_get_fontname(font, name)
GuiFont font;
char_u *name;
{
if (name == NULL)
return NULL;
return vim_strsave(name);
}
/*
* Set the current text font.
*/

View File

@ -2986,6 +2986,7 @@ gui_mch_init_font(char_u *vim_font_name, int fontset)
vim_free( font_name );
return( FAIL );
}
gui_mch_free_font( gui.norm_font );
gui.norm_font = font_tag;
}
@ -3046,6 +3047,20 @@ gui_mch_get_font(char_u *vim_font_name, int report_error)
return( FAIL );
}
/*
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
*/
char_u *
gui_mch_get_fontname(font, name)
GuiFont font;
char_u *name;
{
if (name == NULL)
return NULL;
return vim_strsave(name);
}
void
gui_mch_set_font(GuiFont font)
{

View File

@ -1052,6 +1052,20 @@ gui_mch_get_font(name, giveErrorIfMissing)
return handle;
}
/*
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
*/
char_u *
gui_mch_get_fontname(font, name)
GuiFont font;
char_u *name;
{
if (name == NULL)
return NULL;
return vim_strsave(name);
}
/*
* Set the current text font.
*/

View File

@ -1240,14 +1240,29 @@ gui_mch_get_font(
int giveErrorIfMissing)
{
LOGFONT lf;
GuiFont font;
GuiFont font = NOFONT;
get_logfont(&lf, name, NULL);
font = get_font_handle(&lf);
if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK)
font = get_font_handle(&lf);
if (font == NOFONT && giveErrorIfMissing)
EMSG2(_(e_font), name);
return font;
}
/*
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
*/
char_u *
gui_mch_get_fontname(font, name)
GuiFont font;
char_u *name;
{
if (name == NULL)
return NULL;
return vim_strsave(name);
}
void
gui_mch_free_font(GuiFont font)
{
@ -2600,21 +2615,65 @@ gui_mch_exit(int rc)
#endif
}
static char_u *
logfont2name(LOGFONT lf)
{
char *p;
char *res;
char *charset_name;
charset_name = charset_id2name((int)lf.lfCharSet);
res = alloc((unsigned)(strlen(lf.lfFaceName) + 20
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
if (res != NULL)
{
p = res;
/* make a normal font string out of the lf thing:*/
sprintf((char *)p, "%s:h%d", lf.lfFaceName, pixels_to_points(
lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
while (*p)
{
if (*p == ' ')
*p = '_';
++p;
}
#ifndef MSWIN16_FASTTEXT
if (lf.lfItalic)
STRCAT(p, ":i");
if (lf.lfWeight >= FW_BOLD)
STRCAT(p, ":b");
#endif
if (lf.lfUnderline)
STRCAT(p, ":u");
if (lf.lfStrikeOut)
STRCAT(p, ":s");
if (charset_name != NULL)
{
STRCAT(p, ":c");
STRCAT(p, charset_name);
}
}
return res;
}
/*
* Initialise vim to use the font with the given name. Return FAIL if the font
* could not be loaded, OK otherwise.
* Initialise vim to use the font with the given name.
* Return FAIL if the font could not be loaded, OK otherwise.
*/
int
gui_mch_init_font(char_u *font_name, int fontset)
{
LOGFONT lf;
GuiFont font = NOFONT;
char_u *p;
/* Load the font */
if (get_logfont(&lf, font_name, NULL))
if (get_logfont(&lf, font_name, NULL, TRUE) == OK)
font = get_font_handle(&lf);
if (font == NOFONT)
return FAIL;
if (font_name == NULL)
font_name = lf.lfFaceName;
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
@ -2627,46 +2686,21 @@ gui_mch_init_font(char_u *font_name, int fontset)
gui.norm_font = font;
current_font_height = lf.lfHeight;
GetFontSize(font);
hl_set_font_name(lf.lfFaceName);
/* When setting 'guifont' to "*" replace it with the actual font name. */
if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0)
p = logfont2name(lf);
if (p != NULL)
{
char *charset_name;
char_u *p;
hl_set_font_name(p);
charset_name = charset_id2name((int)lf.lfCharSet);
p = alloc((unsigned)(strlen(lf.lfFaceName) + 20
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
if (p != NULL)
/* When setting 'guifont' to "*" replace it with the actual font name.
* */
if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0)
{
/* make a normal font string out of the lf thing:*/
sprintf((char *)p, "%s:h%d", lf.lfFaceName, pixels_to_points(
lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
vim_free(p_guifont);
p_guifont = p;
while (*p)
{
if (*p == ' ')
*p = '_';
++p;
}
#ifndef MSWIN16_FASTTEXT
if (lf.lfItalic)
STRCAT(p, ":i");
if (lf.lfWeight >= FW_BOLD)
STRCAT(p, ":b");
#endif
if (lf.lfUnderline)
STRCAT(p, ":u");
if (lf.lfStrikeOut)
STRCAT(p, ":s");
if (charset_name != NULL)
{
STRCAT(p, ":c");
STRCAT(p, charset_name);
}
}
else
vim_free(p);
}
#ifndef MSWIN16_FASTTEXT

View File

@ -2096,7 +2096,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
* Initialise the font according to 'printfont'
*/
memset(&fLogFont, 0, sizeof(fLogFont));
if (!get_logfont(&fLogFont, p_pfn, prt_dlg.hDC))
if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL)
{
EMSG2(_("E613: Unknown printer font: %s"), p_pfn);
mch_print_cleanup();
@ -3161,11 +3161,16 @@ init_logfont(LOGFONT *lf)
return OK;
}
/*
* Get font info from "name" into logfont "lf".
* Return OK for a valid name, FAIL otherwise.
*/
int
get_logfont(
LOGFONT *lf,
char_u *name,
HDC printer_dc)
LOGFONT *lf,
char_u *name,
HDC printer_dc,
int verbose)
{
char_u *p;
int i;
@ -3173,7 +3178,7 @@ get_logfont(
*lf = s_lfDefault;
if (name == NULL)
return 1;
return OK;
if (STRCMP(name, "*") == 0)
{
@ -3191,7 +3196,7 @@ get_logfont(
if (ChooseFont(&cf))
goto theend;
#else
return 0;
return FAIL;
#endif
}
@ -3201,7 +3206,7 @@ get_logfont(
for (p = name; *p && *p != ':'; p++)
{
if (p - name + 1 > LF_FACESIZE)
return 0; /* Name too long */
return FAIL; /* Name too long */
lf->lfFaceName[p - name] = *p;
}
if (p != name)
@ -3229,7 +3234,7 @@ get_logfont(
did_replace = TRUE;
}
if (!did_replace || init_logfont(lf) == FAIL)
return 0;
return FAIL;
}
while (*p == ':')
@ -3273,7 +3278,7 @@ get_logfont(
p += strlen(cp->name);
break;
}
if (cp->name == NULL)
if (cp->name == NULL && verbose)
{
sprintf((char *)IObuff, _("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
EMSG(IObuff);
@ -3282,11 +3287,14 @@ get_logfont(
break;
}
default:
sprintf((char *)IObuff,
_("E245: Illegal char '%c' in font name \"%s\""),
p[-1], name);
EMSG(IObuff);
break;
if (verbose)
{
sprintf((char *)IObuff,
_("E245: Illegal char '%c' in font name \"%s\""),
p[-1], name);
EMSG(IObuff);
}
return FAIL;
}
while (*p == ':')
p++;
@ -3304,7 +3312,7 @@ theend:
mch_memmove(lastlf, lf, sizeof(LOGFONT));
}
return 1;
return OK;
}
#endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */

View File

@ -800,6 +800,8 @@ catch_sigint SIGDEFARG(sigarg)
static RETSIGTYPE
catch_sigpwr SIGDEFARG(sigarg)
{
/* this is not required on all systems, but it doesn't hurt anybody */
signal(SIGPWR, (RETSIGTYPE (*)())catch_sigpwr);
/*
* I'm not sure we get the SIGPWR signal when the system is really going
* down or when the batteries are almost empty. Just preserve the swap
@ -904,9 +906,31 @@ deathtrap SIGDEFARG(sigarg)
#endif
#ifdef SIGHASARG
/* When SIGHUP is blocked: postpone its effect and return here. This
* avoids that a non-reentrant function is interrupted, e.g., free(). */
if (entered == 0 && sigarg == SIGHUP && !handle_sighup(SIGHUP_RCV))
/* When SIGHUP, SIGQUIT, etc. are blocked: postpone the effect and return
* here. This avoids that a non-reentrant function is interrupted, e.g.,
* free(). Calling free() again may then cause a crash. */
if (entered == 0
&& (0
# ifdef SIGHUP
|| sigarg == SIGHUP
# endif
# ifdef SIGQUIT
|| sigarg == SIGQUIT
# endif
# ifdef SIGTERM
|| sigarg == SIGTERM
# endif
# ifdef SIGPWR
|| sigarg == SIGPWR
# endif
# ifdef SIGUSR1
|| sigarg == SIGUSR1
# endif
# ifdef SIGUSR2
|| sigarg == SIGUSR2
# endif
)
&& !handle_signal(sigarg))
SIGRETURN;
#endif
@ -1181,33 +1205,39 @@ catch_signals(func_deadly, func_other)
}
/*
* Handling of SIGHUP:
* "when" == SIGHUP_RCV: when busy, postpone, otherwise return TRUE
* "when" == SIGHUP_BLOCK: Going to be busy, block SIGHUP
* "when" == SIGHUP_UNBLOCK: Going wait, unblock SIGHUP
* Handling of SIGHUP, SIGQUIT and SIGTERM:
* "when" == a signal: when busy, postpone, otherwise return TRUE
* "when" == SIGNAL_BLOCK: Going to be busy, block signals
* "when" == SIGNAL_UNBLOCK: Going wait, unblock signals
* Returns TRUE when Vim should exit.
*/
int
handle_sighup(when)
int when;
handle_signal(sig)
int sig;
{
static int got_sighup = FALSE;
static int blocked = FALSE;
static int got_signal = 0;
static int blocked = TRUE;
switch (when)
switch (sig)
{
case SIGHUP_RCV: if (!blocked)
case SIGNAL_BLOCK: blocked = TRUE;
break;
case SIGNAL_UNBLOCK: blocked = FALSE;
if (got_signal != 0)
{
kill(getpid(), got_signal);
got_signal = 0;
}
break;
default: if (!blocked)
return TRUE; /* exit! */
got_sighup = TRUE;
got_int = TRUE; /* break any loops */
break;
case SIGHUP_BLOCK: blocked = TRUE;
break;
case SIGHUP_UNBLOCK: blocked = FALSE;
if (got_sighup)
kill(getpid(), SIGHUP);
got_signal = sig;
#ifdef SIGPWR
if (sig != SIGPWR)
#endif
got_int = TRUE; /* break any loops */
break;
}
return FALSE;

View File

@ -14,7 +14,6 @@ void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb));
char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir));
int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield));
int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield));
void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
void gui_make_popup __ARGS((char_u *path_name));
void gui_mch_find_dialog __ARGS((exarg_T *eap));

View File

@ -21,6 +21,7 @@ GuiFontset gui_mch_get_fontset __ARGS((char_u *name, int report_error, int fixed
char_u *gui_mch_font_dialog __ARGS((char_u *oldval));
int gui_mch_init_font __ARGS((char_u *font_name, int fontset));
GuiFont gui_mch_get_font __ARGS((char_u *name, int report_error));
char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
void gui_mch_set_font __ARGS((GuiFont font));
void gui_mch_set_fontset __ARGS((GuiFontset fontset));
void gui_mch_free_font __ARGS((GuiFont font));

View File

@ -61,6 +61,7 @@ void gui_mch_show_toolbar __ARGS((int showit));
int gui_mch_init_font __ARGS((char_u *vim_font_name, int fontset));
int gui_mch_adjust_charsize __ARGS((void));
GuiFont gui_mch_get_font __ARGS((char_u *vim_font_name, int report_error));
char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
void gui_mch_set_font __ARGS((GuiFont font));
void gui_mch_free_font __ARGS((GuiFont font));
/* vim: set ft=c : */

View File

@ -14,6 +14,7 @@ void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int
void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient));
int gui_mch_adjust_charsize __ARGS((void));
GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing));
char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
void gui_mch_free_font __ARGS((GuiFont font));
guicolor_T gui_mch_get_color __ARGS((char_u *name));
int gui_mch_haskey __ARGS((char_u *name));
@ -51,6 +52,7 @@ int gui_mch_maximized __ARGS((void));
void gui_mch_newfont __ARGS((void));
void gui_mch_settitle __ARGS((char_u *title, char_u *icon));
void mch_set_mouse_shape __ARGS((int shape));
char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir));
char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
int get_cmd_args __ARGS((char *prog, char *cmdline, char ***argvp, char **tofree));
void gui_mch_prepare __ARGS((int *argc, char **argv));

View File

@ -14,6 +14,7 @@ void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int
void gui_mch_create_scrollbar __ARGS((scrollbar_T *sb, int orient));
int gui_mch_adjust_charsize __ARGS((void));
GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing));
char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
void gui_mch_free_font __ARGS((GuiFont font));
guicolor_T gui_mch_get_color __ARGS((char_u *name));
int gui_mch_haskey __ARGS((char_u *name));

View File

@ -11,7 +11,7 @@ void mch_didjmp __ARGS((void));
void mch_suspend __ARGS((void));
void mch_init __ARGS((void));
void reset_signals __ARGS((void));
int handle_sighup __ARGS((int when));
int handle_signal __ARGS((int sig));
int mch_check_win __ARGS((int argc, char **argv));
int mch_input_isatty __ARGS((void));
int mch_can_restore_title __ARGS((void));

View File

@ -1843,12 +1843,11 @@ typedef int VimClipboard; /* This is required for the prototypes. */
# include <XSUB.h>
#endif
/* values for handle_sighup() */
#define SIGHUP_RCV 1
#define SIGHUP_BLOCK 2
#define SIGHUP_UNBLOCK 3
/* values for handle_signal() that are not a signal */
#define SIGNAL_BLOCK -1
#define SIGNAL_UNBLOCK -2
#ifndef UNIX
# define handle_sighup(x) /* nothing */
# define handle_signal(x) 0
#endif
#endif /* VIM__H */