diff options
-rw-r--r-- | src/os_amiga.c | 229 | ||||
-rw-r--r-- | src/os_beos.c | 10 | ||||
-rw-r--r-- | src/os_mac_conv.c | 58 | ||||
-rw-r--r-- | src/os_mswin.c | 452 | ||||
-rw-r--r-- | src/os_qnx.c | 18 | ||||
-rw-r--r-- | src/os_unix.c | 1353 | ||||
-rw-r--r-- | src/os_vms.c | 193 | ||||
-rw-r--r-- | src/os_win32.c | 761 | ||||
-rw-r--r-- | src/version.c | 2 |
9 files changed, 1532 insertions, 1544 deletions
diff --git a/src/os_amiga.c b/src/os_amiga.c index 8627cb60af..6d444142f2 100644 --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -17,13 +17,13 @@ #include "version.h" #ifdef Window -# undef Window /* Amiga has its own Window definition */ +# undef Window // Amiga has its own Window definition #endif -#undef TRUE /* will be redefined by exec/types.h */ +#undef TRUE // will be redefined by exec/types.h #undef FALSE -/* cproto fails on missing include files, skip them */ +// cproto fails on missing include files, skip them #ifndef PROTO #ifndef LATTICE @@ -33,21 +33,19 @@ # include <intuition/intuition.h> #endif -/* XXX These are included from os_amiga.h -#include <proto/exec.h> -#include <proto/dos.h> -#include <proto/intuition.h> -*/ +// XXX These are included from os_amiga.h +// #include <proto/exec.h> +// #include <proto/dos.h> +// #include <proto/intuition.h> #include <exec/memory.h> #include <libraries/dosextens.h> -#include <dos/dostags.h> /* for 2.0 functions */ +#include <dos/dostags.h> // for 2.0 functions #include <dos/dosasl.h> -/* From version 4 of AmigaOS, several system structures must be allocated - * and freed using system functions. "struct AnchorPath" is one. - */ +// From version 4 of AmigaOS, several system structures must be allocated +// and freed using system functions. "struct AnchorPath" is one. #ifdef __amigaos4__ # include <dos/anchorpath.h> # define free_fib(x) FreeDosObject(DOS_FIB, x) @@ -59,7 +57,7 @@ # include <libraries/arp_pragmas.h> #endif -#endif /* PROTO */ +#endif // PROTO /* * Set stack size to 1 MiB on NG systems. This should be enough even for @@ -92,9 +90,9 @@ static int sortcmp(const void *a, const void *b); static BPTR raw_in = (BPTR)NULL; static BPTR raw_out = (BPTR)NULL; -static int close_win = FALSE; /* set if Vim opened the window */ +static int close_win = FALSE; // set if Vim opened the window -#ifndef __amigaos4__ /* Use autoopen for AmigaOS4 */ +#ifndef __amigaos4__ // Use autoopen for AmigaOS4 struct IntuitionBase *IntuitionBase = NULL; #endif #ifdef FEAT_ARP @@ -105,9 +103,9 @@ static struct Window *wb_window; static char_u *oldwindowtitle = NULL; #ifdef FEAT_ARP -int dos2 = FALSE; /* Amiga DOS 2.0x or higher */ +int dos2 = FALSE; // Amiga DOS 2.0x or higher #endif -int size_set = FALSE; /* set to TRUE if window size was set */ +int size_set = FALSE; // set to TRUE if window size was set #ifdef __GNUC__ static char version[] __attribute__((used)) = @@ -151,7 +149,7 @@ mch_write(char_u *p, int len) mch_inchar( char_u *buf, int maxlen, - long time, /* milli seconds */ + long time, // milli seconds int tb_change_cnt) { int len; @@ -160,13 +158,13 @@ mch_inchar( if (time >= 0) { if (time == 0) - utime = 100L; /* time = 0 causes problems in DOS 1.2 */ + utime = 100L; // time = 0 causes problems in DOS 1.2 else - utime = time * 1000L; /* convert from milli to micro secs */ - if (WaitForChar(raw_in, utime) == 0) /* no character available */ + utime = time * 1000L; // convert from milli to micro secs + if (WaitForChar(raw_in, utime) == 0) // no character available return 0; } - else /* time == -1 */ + else // time == -1 { /* * If there is no character available within 2 seconds (default) @@ -186,12 +184,12 @@ mch_inchar( } } - for (;;) /* repeat until we got a character */ + for (;;) // repeat until we got a character { len = Read(raw_in, (char *)buf, (long)maxlen / input_conv.vc_factor); if (len > 0) { - /* Convert from 'termencoding' to 'encoding'. */ + // Convert from 'termencoding' to 'encoding'. if (input_conv.vc_type != CONV_NONE) len = convert_input(buf, len, maxlen); return len; @@ -228,14 +226,14 @@ mch_avail_mem(int special) void mch_delay(long msec, int ignoreinput) { -#ifndef LATTICE /* SAS declares void Delay(ULONG) */ +#ifndef LATTICE // SAS declares void Delay(ULONG) void Delay(long); #endif if (msec > 0) { if (ignoreinput) - Delay(msec / 20L); /* Delay works with 20 msec intervals */ + Delay(msec / 20L); // Delay works with 20 msec intervals else WaitForChar(raw_in, msec * 1000L); } @@ -260,7 +258,7 @@ mch_init(void) static char intlibname[] = "intuition.library"; #ifdef AZTEC_C - Enable_Abort = 0; /* disallow vim to be aborted */ + Enable_Abort = 0; // disallow vim to be aborted #endif Columns = 80; Rows = 24; @@ -313,7 +311,7 @@ mch_init(void) * For the -f option (foreground mode) we open our own window and disable :sh. * Otherwise the calling program would never know when editing is finished. */ -#define BUF2SIZE 320 /* length of buffer for argument with complete path */ +#define BUF2SIZE 320 // length of buffer for argument with complete path int mch_check_win(int argc, char **argv) @@ -342,20 +340,20 @@ mch_check_win(int argc, char **argv) #ifndef __amigaos4__ DosBase = OpenLibrary(DOS_LIBRARY, 37L); if (DosBase != NULL) - /* if (((struct Library *)DOSBase)->lib_Version >= 37) */ + // if (((struct Library *)DOSBase)->lib_Version >= 37) { CloseLibrary(DosBase); # ifdef FEAT_ARP dos2 = TRUE; # endif } - else /* without arp functions we NEED 2.0 */ + else // without arp functions we NEED 2.0 { # ifndef FEAT_ARP mch_errmsg(_("Need Amigados version 2.04 or later\n")); exit(3); # else - /* need arp functions for dos 1.x */ + // need arp functions for dos 1.x if (!(ArpBase = (struct ArpBase *) OpenLibrary((UBYTE *)ArpName, ArpVersion))) { fprintf(stderr, _("Need %s version %ld\n"), ArpName, ArpVersion); @@ -363,7 +361,7 @@ mch_check_win(int argc, char **argv) } # endif } -#endif /* __amigaos4__ */ +#endif // __amigaos4__ /* * scan argv[] for the "-f" and "-d" arguments @@ -380,7 +378,7 @@ mch_check_win(int argc, char **argv) case 'd': if (i < argc - 1 #ifdef FEAT_DIFF - /* require using "-dev", "-d" means diff mode */ + // require using "-dev", "-d" means diff mode && argv[i][2] == 'e' && argv[i][3] == 'v' #endif ) @@ -419,7 +417,7 @@ mch_check_win(int argc, char **argv) (long)MODE_NEWFILE)) != (BPTR)NULL) break; } - if (raw_in == (BPTR)NULL) /* all three failed */ + if (raw_in == (BPTR)NULL) // all three failed { mch_errmsg(_(winerr)); goto exit; @@ -458,7 +456,7 @@ mch_check_win(int argc, char **argv) * Write the command into the file, put quotes around the arguments that * have a space in them. */ - if (argc == 0) /* run from workbench */ + if (argc == 0) // run from workbench ac = ((struct WBStartup *)argv)->sm_NumArgs; else ac = argc; @@ -471,11 +469,11 @@ mch_check_win(int argc, char **argv) if (argp->wa_Lock) (void)lock2name(argp->wa_Lock, buf2, (long)(BUF2SIZE - 1)); #ifdef FEAT_ARP - if (dos2) /* use 2.0 function */ + if (dos2) // use 2.0 function #endif AddPart((UBYTE *)buf2, (UBYTE *)argp->wa_Name, (long)(BUF2SIZE - 1)); #ifdef FEAT_ARP - else /* use arp function */ + else // use arp function TackOn((char *)buf2, argp->wa_Name); #endif av = (char *)buf2; @@ -483,7 +481,7 @@ mch_check_win(int argc, char **argv) else av = argv[i]; - /* skip '-d' or "-dev" option */ + // skip '-d' or "-dev" option if (av[0] == '-' && av[1] == 'd' #ifdef FEAT_DIFF && av[2] == 'e' && av[3] == 'v' @@ -530,13 +528,13 @@ mch_check_win(int argc, char **argv) } #endif } - if (i == 3) /* all three failed */ + if (i == 3) // all three failed { DeleteFile((UBYTE *)buf1); mch_errmsg(_(winerr)); goto exit; } - exitval = 0; /* The Execute succeeded: exit this program */ + exitval = 0; // The Execute succeeded: exit this program exit: #ifdef FEAT_ARP @@ -544,7 +542,7 @@ exit: CloseLibrary((struct Library *) ArpBase); #endif exit(exitval); - /* NOTREACHED */ + // NOTREACHED return FAIL; } @@ -563,11 +561,11 @@ mch_input_isatty(void) * This will cause the file name to remain exactly the same * if the file system ignores, but preserves case. */ -/*ARGSUSED*/ +//ARGSUSED void fname_case( char_u *name, - int len) /* buffer size, ignored here */ + int len) // buffer size, ignored here { struct FileInfoBlock *fib; size_t flen; @@ -576,12 +574,12 @@ fname_case( if (fib != NULL) { flen = STRLEN(name); - /* TODO: Check if this fix applies to AmigaOS < 4 too.*/ + // TODO: Check if this fix applies to AmigaOS < 4 too. #ifdef __amigaos4__ if (fib->fib_DirEntryType == ST_ROOT) strcat(fib->fib_FileName, ":"); #endif - if (flen == strlen(fib->fib_FileName)) /* safety check */ + if (flen == strlen(fib->fib_FileName)) // safety check mch_memmove(name, fib->fib_FileName, flen); free_fib(fib); } @@ -598,7 +596,7 @@ get_fib(char_u *fname) BPTR flock; struct FileInfoBlock *fib; - if (fname == NULL) /* safety check */ + if (fname == NULL) // safety check return NULL; #ifdef __amigaos4__ fib = AllocDosObject(DOS_FIB,0); @@ -610,7 +608,7 @@ get_fib(char_u *fname) flock = Lock((UBYTE *)fname, (long)ACCESS_READ); if (flock == (BPTR)NULL || !Examine(flock, fib)) { - free_fib(fib); /* in case of an error the memory is freed here */ + free_fib(fib); // in case of an error the memory is freed here fib = NULL; } if (flock) @@ -703,9 +701,8 @@ mch_get_host_name(char_u *s, int len) mch_get_pid(void) { #ifdef __amigaos4__ - /* This is as close to a pid as we can come. We could use CLI numbers also, - * but then we would have two different types of process identifiers. - */ + // This is as close to a pid as we can come. We could use CLI numbers also, + // but then we would have two different types of process identifiers. return((long)FindTask(0)); #else return (long)0; @@ -738,13 +735,13 @@ mch_FullName( int retval = FAIL; int i; - /* Lock the file. If it exists, we can get the exact name. */ + // Lock the file. If it exists, we can get the exact name. if ((l = Lock((UBYTE *)fname, (long)ACCESS_READ)) != (BPTR)0) { retval = lock2name(l, buf, (long)len - 1); UnLock(l); } - else if (force || !mch_isFullName(fname)) /* not a full path yet */ + else if (force || !mch_isFullName(fname)) // not a full path yet { /* * If the file cannot be locked (doesn't exist), try to lock the @@ -757,8 +754,8 @@ mch_FullName( if (retval == OK) { i = STRLEN(buf); - /* Concatenate the fname to the directory. Don't add a slash - * if fname is empty, but do change "" to "/". */ + // Concatenate the fname to the directory. Don't add a slash + // if fname is empty, but do change "" to "/". if (i == 0 || *fname != NUL) { if (i < len - 1 && (i == 0 || buf[i - 1] != ':')) @@ -769,7 +766,7 @@ mch_FullName( } } if (*buf == 0 || *buf == ':') - retval = FAIL; /* something failed; use the file name */ + retval = FAIL; // something failed; use the file name return retval; } @@ -792,11 +789,11 @@ mch_isFullName(char_u *fname) lock2name(BPTR lock, char_u *buf, long len) { #ifdef FEAT_ARP - if (dos2) /* use 2.0 function */ + if (dos2) // use 2.0 function #endif return ((int)NameFromLock(lock, (UBYTE *)buf, len) ? OK : FAIL); #ifdef FEAT_ARP - else /* use arp function */ + else // use arp function return ((int)PathName(lock, (char *)buf, (long)(len/32)) ? OK : FAIL); #endif } @@ -828,7 +825,7 @@ mch_getperm(char_u *name) int mch_setperm(char_u *name, long perm) { - perm &= ~FIBF_ARCHIVE; /* reset archived bit */ + perm &= ~FIBF_ARCHIVE; // reset archived bit return (SetProtection((UBYTE *)name, (long)perm) ? OK : FAIL); } @@ -838,7 +835,7 @@ mch_setperm(char_u *name, long perm) void mch_hide(char_u *name) { - /* can't hide a file */ + // can't hide a file } /* @@ -890,7 +887,7 @@ mch_mkdir(char_u *name) int mch_can_exe(char_u *name, char_u **path, int use_path) { - /* TODO */ + // TODO return -1; } @@ -903,7 +900,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path) int mch_nodetype(char_u *name) { - /* TODO */ + // TODO return NODE_NORMAL; } @@ -920,7 +917,7 @@ mch_exit(int r) { exiting = TRUE; - if (raw_in) /* put terminal in 'normal' mode */ + if (raw_in) // put terminal in 'normal' mode { settmode(TMODE_COOK); stoptermcap(); @@ -930,18 +927,18 @@ mch_exit(int r) { if (term_console) { - win_resize_off(); /* window resize events de-activated */ + win_resize_off(); // window resize events de-activated if (size_set) - OUT_STR("\233t\233u"); /* reset window size (CSI t CSI u) */ + OUT_STR("\233t\233u"); // reset window size (CSI t CSI u) } out_flush(); } #ifdef FEAT_TITLE - mch_restore_title(SAVE_RESTORE_BOTH); /* restore window title */ + mch_restore_title(SAVE_RESTORE_BOTH); // restore window title #endif - ml_close_all(TRUE); /* remove all memfiles */ + ml_close_all(TRUE); // remove all memfiles #ifdef FEAT_ARP if (ArpBase) @@ -950,7 +947,7 @@ mch_exit(int r) if (close_win) Close(raw_in); if (r) - printf(_("Vim exiting with %d\n"), r); /* somehow this makes :cq work!? */ + printf(_("Vim exiting with %d\n"), r); // somehow this makes :cq work!? exit(r); } @@ -1027,10 +1024,10 @@ mch_get_shellsize(void) #endif struct InfoData *id=0; - if (!term_console) /* not an amiga window */ + if (!term_console) // not an amiga window goto out; - /* insure longword alignment */ + // insure longword alignment #ifdef __amigaos4__ if (!(id = AllocDosObject(DOS_INFODATA, 0))) goto out; @@ -1044,7 +1041,7 @@ mch_get_shellsize(void) * is rarely needed, so we skip it now, unless we changed the size. */ if (size_set) - OUT_STR("\233t\233u"); /* CSI t CSI u */ + OUT_STR("\233t\233u"); // CSI t CSI u out_flush(); #ifdef __AROS__ @@ -1055,8 +1052,8 @@ mch_get_shellsize(void) || (wb_window = (struct Window *)id->id_VolumeNode) == NULL) #endif { - /* it's not an amiga window, maybe aux device */ - /* terminal type should be set */ + // it's not an amiga window, maybe aux device + // terminal type should be set term_console = FALSE; goto out; } @@ -1069,10 +1066,10 @@ mch_get_shellsize(void) } conUnit = (struct ConUnit *) ((struct IOStdReq *) id->id_InUse)->io_Unit; - /* get window size */ + // get window size Rows = conUnit->cu_YMax + 1; Columns = conUnit->cu_XMax + 1; - if (Rows < 0 || Rows > 200) /* cannot be an amiga window */ + if (Rows < 0 || Rows > 200) // cannot be an amiga window { Columns = 80; Rows = 24; @@ -1083,7 +1080,7 @@ mch_get_shellsize(void) return OK; out: #ifdef __amigaos4__ - FreeDosObject(DOS_INFODATA, id); /* Safe to pass NULL */ + FreeDosObject(DOS_INFODATA, id); // Safe to pass NULL #endif return FAIL; @@ -1114,7 +1111,7 @@ mch_set_shellsize(void) void mch_new_shellsize(void) { - /* Nothing to do. */ + // Nothing to do. } /* @@ -1139,8 +1136,8 @@ out_num(long n) */ #ifndef PROTO -/* #include <proto/exec.h> */ -/* #include <proto/dos.h> */ +// #include <proto/exec.h> +// #include <proto/dos.h> # include <exec/memory.h> #endif @@ -1152,9 +1149,9 @@ out_num(long n) static long dos_packet( - struct MsgPort *pid, /* process identifier ... (handlers message port) */ - long action, /* packet type ... (what you want handler to do) */ - long arg) /* single argument */ + struct MsgPort *pid, // process identifier ... (handlers message port) + long action, // packet type ... (what you want handler to do) + long arg) // single argument { # ifdef FEAT_ARP struct MsgPort *replyport; @@ -1163,14 +1160,14 @@ dos_packet( if (dos2) # endif - return DoPkt(pid, action, arg, 0L, 0L, 0L, 0L); /* use 2.0 function */ + return DoPkt(pid, action, arg, 0L, 0L, 0L, 0L); // use 2.0 function # ifdef FEAT_ARP - replyport = (struct MsgPort *) CreatePort(NULL, 0); /* use arp function */ + replyport = (struct MsgPort *) CreatePort(NULL, 0); // use arp function if (!replyport) return (0); - /* Allocate space for a packet, make it public and clear it */ + // Allocate space for a packet, make it public and clear it packet = (struct StandardPacket *) AllocMem((long) sizeof(struct StandardPacket), MEMF_PUBLIC | MEMF_CLEAR); if (!packet) { @@ -1183,7 +1180,7 @@ dos_packet( packet->sp_Pkt.dp_Type = action; packet->sp_Pkt.dp_Arg1 = arg; - PutMsg(pid, (struct Message *)packet); /* send packet */ + PutMsg(pid, (struct Message *)packet); // send packet WaitPort(replyport); GetMsg(replyport); @@ -1196,7 +1193,7 @@ dos_packet( return (res1); # endif } -#endif /* !defined(AZTEC_C) && !defined(__AROS__) */ +#endif // !defined(AZTEC_C) && !defined(__AROS__) /* * Call shell. @@ -1205,7 +1202,7 @@ dos_packet( int mch_call_shell( char_u *cmd, - int options) /* SHELL_*, see vim.h */ + int options) // SHELL_*, see vim.h { BPTR mydir; int x; @@ -1219,20 +1216,20 @@ mch_call_shell( if (close_win) { - /* if Vim opened a window: Executing a shell may cause crashes */ + // if Vim opened a window: Executing a shell may cause crashes emsg(_("E360: Cannot execute shell with -f option")); return -1; } if (term_console) - win_resize_off(); /* window resize events de-activated */ + win_resize_off(); // window resize events de-activated out_flush(); if (options & SHELL_COOKED) - settmode(TMODE_COOK); /* set to normal mode */ - mydir = Lock((UBYTE *)"", (long)ACCESS_READ); /* remember current dir */ + settmode(TMODE_COOK); // set to normal mode + mydir = Lock((UBYTE *)"", (long)ACCESS_READ); // remember current dir -#if !defined(AZTEC_C) /* not tested very much */ +#if !defined(AZTEC_C) // not tested very much if (cmd == NULL) { # ifdef FEAT_ARP @@ -1289,7 +1286,7 @@ mch_call_shell( retval = x; } } -#else /* else part is for AZTEC_C */ +#else // else part is for AZTEC_C if (p_st >= 4 || (p_st >= 2 && !(options & SHELL_FILTER))) use_execute = 1; else @@ -1300,11 +1297,11 @@ mch_call_shell( * separate shell name from argument */ shellcmd = vim_strsave(p_sh); - if (shellcmd == NULL) /* out of memory, use Execute */ + if (shellcmd == NULL) // out of memory, use Execute use_execute = 1; else { - shellarg = skiptowhite(shellcmd); /* find start of arguments */ + shellarg = skiptowhite(shellcmd); // find start of arguments if (*shellarg != NUL) { *shellarg++ = NUL; @@ -1392,17 +1389,17 @@ mch_call_shell( } } vim_free(shellcmd); -#endif /* AZTEC_C */ +#endif // AZTEC_C - if ((mydir = CurrentDir(mydir)) != 0) /* make sure we stay in the same directory */ + if ((mydir = CurrentDir(mydir)) != 0) // make sure we stay in the same directory UnLock(mydir); if (tmode == TMODE_RAW) - settmode(TMODE_RAW); /* set to raw mode */ + settmode(TMODE_RAW); // set to raw mode #ifdef FEAT_TITLE resettitle(); #endif if (term_console) - win_resize_on(); /* window resize events activated */ + win_resize_on(); // window resize events activated return retval; } @@ -1418,9 +1415,9 @@ mch_breakcheck(int force) got_int = TRUE; } -/* this routine causes manx to use this Chk_Abort() rather than its own */ -/* otherwise it resets our ^C when doing any I/O (even when Enable_Abort */ -/* is zero). Since we want to check for our own ^C's */ +// this routine causes manx to use this Chk_Abort() rather than its own +// otherwise it resets our ^C when doing any I/O (even when Enable_Abort +// is zero). Since we want to check for our own ^C's #ifdef _DCC #define Chk_Abort chkabort @@ -1464,7 +1461,7 @@ Chk_Abort(void) mch_expandpath( garray_T *gap, char_u *pat, - int flags) /* EW_* flags */ + int flags) // EW_* flags { struct AnchorPath *Anchor; LONG Result; @@ -1481,7 +1478,7 @@ mch_expandpath( start_len = gap->ga_len; - /* Get our AnchorBase */ + // Get our AnchorBase #ifdef __amigaos4__ Anchor = AllocDosObject(DOS_ANCHORPATH, AnchorTags); #else @@ -1491,11 +1488,11 @@ mch_expandpath( return 0; #ifndef __amigaos4__ - Anchor->ap_Strlen = ANCHOR_BUF_SIZE; /* ap_Length not supported anymore */ + Anchor->ap_Strlen = ANCHOR_BUF_SIZE; // ap_Length not supported anymore # ifdef APF_DODOT - Anchor->ap_Flags = APF_DODOT | APF_DOWILD; /* allow '.' for current dir */ + Anchor->ap_Flags = APF_DODOT | APF_DOWILD; // allow '.' for current dir # else - Anchor->ap_Flags = APF_DoDot | APF_DoWild; /* allow '.' for current dir */ + Anchor->ap_Flags = APF_DoDot | APF_DoWild; // allow '.' for current dir # endif #endif @@ -1503,7 +1500,7 @@ mch_expandpath( if (dos2) { #endif - /* hack to replace '*' by '#?' */ + // hack to replace '*' by '#?' starbuf = alloc(2 * STRLEN(pat) + 1); if (starbuf == NULL) goto Return; @@ -1561,7 +1558,7 @@ mch_expandpath( qsort((void *)(((char_u **)gap->ga_data) + start_len), (size_t)matches, sizeof(char_u *), sortcmp); - /* Free the wildcard stuff */ + // Free the wildcard stuff #ifdef FEAT_ARP if (dos2) #endif @@ -1638,9 +1635,9 @@ mch_has_wildcard(char_u *p) mch_getenv(char_u *var) { int len; - UBYTE *buf; /* buffer to expand in */ - char_u *retval; /* return value */ - static char_u *alloced = NULL; /* allocated memory */ + UBYTE *buf; // buffer to expand in + char_u *retval; // return value + static char_u *alloced = NULL; // allocated memory #ifdef FEAT_ARP if (!dos2) @@ -1665,7 +1662,7 @@ mch_getenv(char_u *var) vim_free(buf); } - /* if $VIM is not defined, use "vim:" instead */ + // if $VIM is not defined, use "vim:" instead if (retval == NULL && STRCMP(var, "VIM") == 0) retval = (char_u *)"vim:"; @@ -1675,7 +1672,7 @@ mch_getenv(char_u *var) /* * Amiga version of setenv() with AmigaDOS 2.0 support. */ -/* ARGSUSED */ +// ARGSUSED int mch_setenv(char *var, char *value, int x) { @@ -1685,6 +1682,6 @@ mch_setenv(char *var, char *value, int x) #endif if (SetVar((UBYTE *)var, (UBYTE *)value, (LONG)-1, (ULONG)GVF_LOCAL_ONLY)) - return 0; /* success */ - return -1; /* failure */ + return 0; // success + return -1; // failure } diff --git a/src/os_beos.c b/src/os_beos.c index ebb448829b..f3c01730c9 100644 --- a/src/os_beos.c +++ b/src/os_beos.c @@ -21,7 +21,7 @@ #if USE_THREAD_FOR_INPUT_WITH_TIMEOUT -#ifdef PROTO /* making prototypes on Unix */ +#ifdef PROTO // making prototypes on Unix #define sem_id int #define thread_id int #endif @@ -32,7 +32,7 @@ sem_id character_present; sem_id character_wanted; thread_id read_thread_id; -#define TRY_ABORT 0 /* This code does not work so turn it off. */ +#define TRY_ABORT 0 // This code does not work so turn it off. #if TRY_ABORT static void @@ -89,7 +89,7 @@ beos_select(int nbits, bigtime_t tmo; if (nbits == 0) { - /* select is purely being used for delay */ + // select is purely being used for delay snooze(timeout->tv_sec * 1e6 + timeout->tv_usec); return 0; } @@ -140,10 +140,10 @@ beos_select(int nbits, resume_thread(read_thread_id); } - /* timeout == NULL means "indefinitely" */ + // timeout == NULL means "indefinitely" if (timeout) { tmo = timeout->tv_sec * 1e6 + timeout->tv_usec; - /* 0 means "don't wait, which is impossible to do exactly. */ + // 0 means "don't wait, which is impossible to do exactly. if (tmo == 0) tmo = 1.0; } diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c index 211e115e82..6c52e7d20f 100644 --- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -25,7 +25,7 @@ #if defined(MACOS_CONVERT) || defined(PROTO) # ifdef PROTO -/* A few dummy types to be able to generate function prototypes. */ +// A few dummy types to be able to generate function prototypes. typedef int UniChar; typedef int *TECObjectRef; typedef int CFStringRef; @@ -34,9 +34,9 @@ typedef int CFStringRef; static char_u *mac_utf16_to_utf8(UniChar *from, size_t fromLen, size_t *actualLen); static UniChar *mac_utf8_to_utf16(char_u *from, size_t fromLen, size_t *actualLen); -/* Converter for composing decomposed HFS+ file paths */ +// Converter for composing decomposed HFS+ file paths static TECObjectRef gPathConverter; -/* Converter used by mac_utf16_to_utf8 */ +// Converter used by mac_utf16_to_utf8 static TECObjectRef gUTF16ToUTF8Converter; /* @@ -79,9 +79,9 @@ mac_string_convert( if (cfstr == NULL) fprintf(stderr, "Encoding failed\n"); - /* When conversion failed, try excluding bytes from the end, helps when - * there is an incomplete byte sequence. Only do up to 6 bytes to avoid - * looping a long time when there really is something unconvertible. */ + // When conversion failed, try excluding bytes from the end, helps when + // there is an incomplete byte sequence. Only do up to 6 bytes to avoid + // looping a long time when there really is something unconvertible. while (cfstr == NULL && unconvlenp != NULL && len > 1 && *unconvlenp < 6) { --len; @@ -104,7 +104,7 @@ mac_string_convert( #if 0 CFRange convertRange = CFRangeMake(0, CFStringGetLength(cfstr)); - /* Determine output buffer size */ + // Determine output buffer size CFStringGetBytes(cfstr, convertRange, to, NULL, FALSE, NULL, 0, (CFIndex *)&buflen); retval = (buflen > 0) ? alloc(buflen) : NULL; if (retval == NULL) { @@ -127,8 +127,8 @@ mac_string_convert( } fprintf(stderr, "Trying char-by-char conversion...\n"); - /* conversion failed for the whole string, but maybe it will work - * for each character */ + // conversion failed for the whole string, but maybe it will work + // for each character for (d = retval, in = 0, out = 0; in < len && out < buflen - 1;) { if (from == kCFStringEncodingUTF8) @@ -188,8 +188,8 @@ macroman2enc( CFRange r; CFIndex len = *sizep; - /* MacRoman is an 8-bit encoding, no need to move bytes to - * conv_rest[]. */ + // MacRoman is an 8-bit encoding, no need to move bytes to + // conv_rest[]. cfstr = CFStringCreateWithBytes(NULL, ptr, len, kCFStringEncodingMacRoman, 0); /* @@ -203,8 +203,8 @@ macroman2enc( r.length = CFStringGetLength(cfstr); if (r.length != CFStringGetBytes(cfstr, r, (enc_utf8) ? kCFStringEncodingUTF8 : kCFStringEncodingISOLatin1, - 0, /* no lossy conversion */ - 0, /* not external representation */ + 0, // no lossy conversion + 0, // not external representation ptr + *sizep, real_size - *sizep, &len)) { CFRelease(cfstr); @@ -256,9 +256,9 @@ enc2macroman( r.length = CFStringGetLength(cfstr); if (r.length != CFStringGetBytes(cfstr, r, kCFStringEncodingMacRoman, - 0, /* no lossy conversion */ - 0, /* not external representation (since vim - * handles this internally */ + 0, // no lossy conversion + 0, // not external representation (since vim + // handles this internally to, maxtolen, &l)) { CFRelease(cfstr); @@ -296,8 +296,8 @@ mac_conv_init(void) if (TECCreateConverter(&gUTF16ToUTF8Converter, utf16_encoding, utf8_canon_encoding) != noErr) { - /* On pre-10.3, Unicode normalization is not available so - * fall back to non-normalizing converter */ + // On pre-10.3, Unicode normalization is not available so + // fall back to non-normalizing converter if (TECCreateConverter(&gUTF16ToUTF8Converter, utf16_encoding, utf8_encoding) != noErr) gUTF16ToUTF8Converter = NULL; @@ -334,30 +334,30 @@ mac_utf16_to_enc( size_t fromLen, size_t *actualLen) { - /* Following code borrows somewhat from os_mswin.c */ + // Following code borrows somewhat from os_mswin.c vimconv_T conv; size_t utf8_len; char_u *utf8_str; char_u *result = NULL; - /* Convert to utf-8 first, works better with iconv */ + // Convert to utf-8 first, works better with iconv utf8_len = 0; utf8_str = mac_utf16_to_utf8(from, fromLen, &utf8_len); if (utf8_str) { - /* We might be called before we have p_enc set up. */ + // We might be called before we have p_enc set up. conv.vc_type = CONV_NONE; - /* If encoding (p_enc) is any unicode, it is actually in utf-8 (vim - * internal unicode is always utf-8) so don't convert in such cases */ + // If encoding (p_enc) is any unicode, it is actually in utf-8 (vim + // internal unicode is always utf-8) so don't convert in such cases if ((enc_canon_props(p_enc) & ENC_UNICODE) == 0) convert_setup(&conv, (char_u *)"utf-8", p_enc? p_enc: (char_u *)"macroman"); if (conv.vc_type == CONV_NONE) { - /* p_enc is utf-8, so we're done. */ + // p_enc is utf-8, so we're done. result = utf8_str; } else @@ -388,7 +388,7 @@ mac_enc_to_utf16( size_t fromLen, size_t *actualLen) { - /* Following code borrows somewhat from os_mswin.c */ + // Following code borrows somewhat from os_mswin.c vimconv_T conv; size_t utf8_len; char_u *utf8_str; @@ -397,9 +397,9 @@ mac_enc_to_utf16( do { - /* Use MacRoman by default, we might be called before we have p_enc - * set up. Convert to utf-8 first, works better with iconv(). Does - * nothing if 'encoding' is "utf-8". */ + // Use MacRoman by default, we might be called before we have p_enc + // set up. Convert to utf-8 first, works better with iconv(). Does + // nothing if 'encoding' is "utf-8". conv.vc_type = CONV_NONE; if ((enc_canon_props(p_enc) & ENC_UNICODE) == 0 && convert_setup(&conv, p_enc ? p_enc : (char_u *)"macroman", @@ -583,4 +583,4 @@ mac_lang_init(void) } } } -#endif /* MACOS_CONVERT */ +#endif // MACOS_CONVERT diff --git a/src/os_mswin.c b/src/os_mswin.c index a76a94368d..c7cfd27613 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -42,7 +42,7 @@ # include <commdlg.h> # endif -#endif /* PROTO */ +#endif // PROTO #ifdef __MINGW32__ # ifndef FROM_LEFT_1ST_BUTTON_PRESSED @@ -122,8 +122,8 @@ typedef int WPARAM; typedef void VOID; #endif -/* Record all output and all keyboard & mouse input */ -/* #define MCH_WRITE_DUMP */ +// Record all output and all keyboard & mouse input +// #define MCH_WRITE_DUMP #ifdef MCH_WRITE_DUMP FILE* fdDump = NULL; @@ -136,15 +136,15 @@ extern char g_szOrigTitle[]; #ifdef FEAT_GUI extern HWND s_hwnd; #else -static HWND s_hwnd = 0; /* console window handle, set by GetConsoleHwnd() */ +static HWND s_hwnd = 0; // console window handle, set by GetConsoleHwnd() #endif #ifdef FEAT_JOB_CHANNEL -int WSInitialized = FALSE; /* WinSock is initialized */ +int WSInitialized = FALSE; // WinSock is initialized #endif -/* Don't generate prototypes here, because some systems do have these - * functions. */ +// Don't generate prototypes here, because some systems do have these +// functions. #if defined(__GNUC__) && !defined(PROTO) # ifndef __MINGW32__ int _stricoll(char *a, char *b) @@ -199,7 +199,7 @@ mch_exit_g(int r) display_errors(); - ml_close_all(TRUE); /* remove all memfiles */ + ml_close_all(TRUE); // remove all memfiles # ifdef FEAT_OLE UninitOLE(); @@ -225,7 +225,7 @@ mch_exit_g(int r) exit(r); } -#endif /* FEAT_GUI_MSWIN */ +#endif // FEAT_GUI_MSWIN /* @@ -238,7 +238,7 @@ mch_early_init(void) PlatformId(); - /* Init the tables for toupper() and tolower() */ + // Init the tables for toupper() and tolower() for (i = 0; i < 256; ++i) toupper_tab[i] = tolower_tab[i] = i; CharUpperBuff((LPSTR)toupper_tab, 256); @@ -256,7 +256,7 @@ mch_input_isatty(void) # ifdef VIMDLL if (gui.in_use) # endif - return TRUE; /* GUI always has a tty */ + return TRUE; // GUI always has a tty #endif #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) if (isatty(read_cmd_fd)) @@ -336,7 +336,7 @@ mch_can_restore_icon(void) { return FALSE; } -#endif /* FEAT_TITLE */ +#endif // FEAT_TITLE /* @@ -387,17 +387,17 @@ mch_FullName( int mch_isFullName(char_u *fname) { - /* WinNT and later can use _MAX_PATH wide characters for a pathname, which - * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is - * UTF-8. */ + // WinNT and later can use _MAX_PATH wide characters for a pathname, which + // means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is + // UTF-8. char szName[_MAX_PATH * 3 + 1]; - |