Skip to content

Commit f9c152c

Browse files
Fritz Mehnervim-scripts
Fritz Mehner
authored andcommitted
Version 5.17
- Two new plugin tags: LICENSE,ORGANIZATION - System-wide installation: minimal Template file for a user will automatically be added. - New menu item and hotkey: choose a makefile. - New idiom: realloc. - New preprocessor item: #if #endif. - New hotkeys: \ire, \ifs, \ifp, \pif.
1 parent 09d6849 commit f9c152c

20 files changed

+362
-187
lines changed

README.csupport

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
README for c.vim (Version 5.16.1) / November 10 2011
1+
README for c.vim (Version 5.17) / December 27 2011
22

33
* DESCRIPTION
44
* INSTALLATION
@@ -147,9 +147,15 @@ Any problems ? See the TROUBLESHOOTING section at the end of the help file
147147
'doc/csupport.txt'.
148148

149149
================================================================================
150-
RELEASE NOTES FOR VERSION 5.16.1
150+
RELEASE NOTES FOR VERSION 5.17
151151
================================================================================
152-
- Bugfix: problem with a system-wide installation under Windows (thanks to Ricardo Vrech).
152+
- Two new plugin tags: LICENSE,ORGANIZATION
153+
- System-wide installation: minimal Template file for a user will automatically
154+
be added.
155+
- New menu item and hotkey: choose a makefile.
156+
- New idiom: realloc.
157+
- New preprocessor item: #if #endif.
158+
- New hotkeys: \ire, \ifs, \ifp, \pif.
153159

154160
OLDER RELEASE NOTES : see file 'ChangeLog'
155161

c-support/codesnippets/calloc_double_matrix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ calloc_double_matrix ( int rows, int columns )
1212
int i;
1313
double **m;
1414
m = calloc ( rows, sizeof(double*) ); /* allocate pointer array */
15-
assert( m != NULL); /* abort if allocation failed */
15+
assert( m != NULL ); /* abort if allocation failed */
1616
*m = calloc ( rows*columns, sizeof(double) );/* allocate data array */
17-
assert(*m != NULL); /* abort if allocation failed */
17+
assert(*m != NULL ); /* abort if allocation failed */
1818
for ( i=1; i<rows; i+=1 ) /* set pointers */
1919
m[i] = m[i-1] + columns;
2020
return m;

c-support/codesnippets/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include <errno.h>
2-
#include <math.h>
3-
#include <stdio.h>
4-
#include <stdlib.h>
5-
#include <string.h>
1+
#include <errno.h>
2+
#include <math.h>
3+
#include <stdio.h>
4+
#include <stdlib.h>
5+
#include <string.h>
66

77
/*
88
* === FUNCTION ======================================================================

c-support/codesnippets/main.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <cstdlib>
2-
#include <fstream>
3-
#include <iomanip>
4-
#include <iostream>
1+
#include <cstdlib>
2+
#include <fstream>
3+
#include <iomanip>
4+
#include <iostream>
55

66
using namespace std;
77

c-support/codesnippets/print_array.cc.noindent

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
21
// === FUNCTION ======================================================================
32
// Name: print_array
43
// Description: Print an array with one dimension.
54
// Use
6-
// print_array<T,w>( *matrix, n1*n2, n2, "matrix" );
5+
// print_array<T,width,precision>( *matrix, n1*n2, n2, "matrix" );
76
// for
87
// T matrix[n1][n2];
98
// =====================================================================================
10-
template <class T, int width>
9+
template < class T, unsigned width, unsigned precision >
1110
void print_array ( T *array, // array to print
1211
int n, // number of elements to print
1312
int nrow, // number of elements per row
@@ -21,7 +20,7 @@ void print_array ( T *array, // array to print
2120
for ( int i=0; i<n; i+=1 ) {
2221
if( i%nrow == 0 )
2322
cout << endl << setw(6) << i << " | ";
24-
cout << "" << setw(width) << fixed << setprecision(2) << array[i];
23+
cout << setw(width) << fixed << setprecision(precision) << array[i];
2524
}
2625
cout << endl << endl;
2726
return ;

c-support/codesnippets/print_double_array.c.noindent

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Name: print_double_array
55
* Description: Print a double-array with one dimension.
66
* Use
7-
* print_int_array( *matrix, n1*n2, n2, "matrix" );
7+
* print_double_array( *matrix, n1*n2, n2, "matrix" );
88
* for
99
* double matrix[n1][n2];
1010
* =====================================================================================
@@ -16,19 +16,20 @@ print_double_array ( double array[], /* array to print *
1616
char *arrayname /* array name */
1717
)
1818
{
19-
int i;
19+
int i, width = 8, precision = 4;
20+
char frmt[10];
21+
sprintf( frmt, " %%%d.%dlf", width, precision );
2022
printf ("\n\n array \"%s\", length %d\n", arrayname, n );
21-
printf ("\n index | content\n" );
22-
printf ( " ------+-" );
23-
for ( i = 0; i < nrow; i += 1 )
24-
printf ( "---------" );
23+
printf ("\n index | content\n" );
24+
printf ( " ------+-" );
25+
for ( i = 0; i < nrow*( 1+width ); i += 1 )
26+
putchar('-');
2527
for ( i=0; i<n; i+=1 )
2628
{
2729
if( i%nrow == 0 )
2830
printf ("\n%6d | ", i );
29-
printf (" %8.2f", array[i] );
31+
printf ( frmt, array[i] );
3032
}
3133
printf ("\n\n");
3234
return ;
3335
} /* ---------- end of function print_double_array ---------- */
34-

c-support/codesnippets/print_int_array.c.noindent

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ print_int_array ( int array[], /* array to print *
1616
char *arrayname /* array name */
1717
)
1818
{
19-
int i;
19+
int i, width = 4;
20+
char frmt[10];
21+
sprintf( frmt, " %%%dd", width );
2022
printf ("\n\n array \"%s\", length %d\n", arrayname, n );
21-
printf ("\n index | content\n" );
22-
printf ( " ------+-" );
23-
for ( i = 0; i < nrow; i += 1 )
24-
printf ( "-------" );
23+
printf ("\n index | content\n" );
24+
printf ( " ------+-" );
25+
for ( i = 0; i < nrow*( 2+width ); i += 1 )
26+
putchar('-');
2527
for ( i=0; i<n; i+=1 )
2628
{
2729
if( i%nrow == 0 )
28-
printf ("\n%6d | ", i );
29-
printf (" %6d", array[i] );
30+
printf ( "\n%6d | ", i );
31+
printf ( frmt, array[i] );
3032
}
3133
printf ("\n\n");
3234
return ;

c-support/templates/c.comments.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4646
* Compiler: gcc
4747
*
4848
* Author: |AUTHOR| (|AUTHORREF|), |EMAIL|
49-
* Company: |COMPANY|
49+
* Organization: |ORGANIZATION|
5050
*
5151
* =====================================================================================
5252
*/
53+
#include <stdlib.h>
5354
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5455
== comment.file-description-header == start ==
5556
/*
@@ -65,7 +66,7 @@ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6566
* Compiler: gcc
6667
*
6768
* Author: |AUTHOR| (|AUTHORREF|), |EMAIL|
68-
* Company: |COMPANY|
69+
* Organization: |ORGANIZATION|
6970
*
7071
* =====================================================================================
7172
*/

c-support/templates/c.idioms.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ if ( |POINTER|==NULL ) {
8484
free (|POINTER|);
8585
|POINTER| = NULL;
8686

87+
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88+
== idioms.realloc ==
89+
|?POINTER| = realloc ( |POINTER|, sizeof(<CURSOR><+TYPE+>) );
90+
if ( |POINTER|==NULL ) {
91+
fprintf ( stderr, "\ndynamic memory reallocation failed\n" );
92+
exit (EXIT_FAILURE);
93+
}
94+
8795
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8896
== idioms.sizeof == insert ==
8997
sizeof(<CURSOR><SPLIT>)

c-support/templates/c.preprocessor.template

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
$-------------------------------------------------------------------------
2-
== preprocessor.include-global ==
2+
== preprocessor.include-global == insert ==
33
#include <<CURSOR>>
44
$-------------------------------------------------------------------------
5-
== preprocessor.include-local ==
5+
== preprocessor.include-local == insert ==
66
#include "<CURSOR>"
77
$-------------------------------------------------------------------------
8-
== preprocessor.define ==
8+
== preprocessor.define == insert ==
99
#define <CURSOR> /* */
1010
$-------------------------------------------------------------------------
11-
== preprocessor.undefine ==
11+
== preprocessor.undefine == insert ==
1212
#undef <CURSOR> /* */
1313
$-------------------------------------------------------------------------
14+
== preprocessor.if-endif ==
15+
#if |?CONDITION:u|
16+
<CURSOR><SPLIT>
17+
#endif /* ----- |CONDITION| ----- */
18+
$-------------------------------------------------------------------------
1419
== preprocessor.if-else-endif ==
1520
#if |?CONDITION:u|
1621
<CURSOR><SPLIT>

c-support/templates/cpp.comments.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3939
// Compiler: g++
4040
//
4141
// Author: |AUTHOR| (|AUTHORREF|), |EMAIL|
42-
// Company: |COMPANY|
42+
// Company: |ORGANIZATION|
4343
//
4444
// =====================================================================================
4545
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -56,7 +56,7 @@ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5656
// Compiler: g++
5757
//
5858
// Author: |AUTHOR| (|AUTHORREF|), |EMAIL|
59-
// Company: |COMPANY|
59+
// Company: |ORGANIZATION|
6060
//
6161
// =====================================================================================
6262
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

c-support/templates/cpp.idioms.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ if ( |POINTER|==NULL ) {
6060
free (|POINTER|);
6161
|POINTER| = NULL;
6262

63+
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64+
== idioms.realloc ==
65+
|?POINTER| = realloc ( |POINTER|, sizeof(<CURSOR><+TYPE+>) );
66+
if ( |POINTER|==NULL ) {
67+
fprintf ( stderr, "\ndynamic memory reallocation failed\n" );
68+
exit (EXIT_FAILURE);
69+
}
70+
6371
$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6472
== idioms.sizeof == insert ==
6573
sizeof(<CURSOR><SPLIT>)

c-support/templates/cpp.preprocessor.template

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ $-------------------------------------------------------------------------
1111
== preprocessor.undefine ==
1212
#undef <CURSOR> //
1313
$-------------------------------------------------------------------------
14+
== preprocessor.if-endif ==
15+
#if |?CONDITION:u|
16+
<CURSOR><SPLIT>
17+
#endif // ----- |CONDITION| -----
18+
$-------------------------------------------------------------------------
1419
== preprocessor.if-else-endif ==
1520
#if |?CONDITION:u|
1621
<CURSOR><SPLIT>
1722
#else // ----- not |CONDITION| -----
1823
<+ELSE PART+>
19-
2024
#endif // ----- not |CONDITION| -----
2125
$-------------------------------------------------------------------------
2226
== preprocessor.ifdef-else-endif ==

doc/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
================================================================================
2+
RELEASE NOTES FOR VERSION 5.16.1
3+
================================================================================
4+
- Bugfix: problem with a system-wide installation under Windows (thanks to Ricardo Vrech).
5+
16
================================================================================
27
RELEASE NOTES FOR VERSION 5.16
38
================================================================================

doc/c-hotkeys.pdf

153 Bytes
Binary file not shown.

doc/c-hotkeys.tex

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
%% Copyright: Copyright (C) 2006-2010 Dr.-Ing. Fritz Mehner (mehner@fh-swf.de)
1111
%% Version: 1.0
1212
%% Created: 10.11.2006
13-
%% Revision: $Id: c-hotkeys.tex,v 1.46 2011/11/05 14:58:35 mehner Exp $
13+
%% Revision: $Id: c-hotkeys.tex,v 1.48 2011/12/27 21:09:44 mehner Exp $
1414
%%
1515
%% Notes:
1616
%%
1717
%%=====================================================================================
1818

19-
\documentclass[oneside,11pt,landscape,DIV16]{scrartcl}
19+
\documentclass[oneside,11pt,landscape,DIV17]{scrartcl}
2020

2121
\usepackage[english]{babel}
2222
\usepackage[utf8]{inputenc}
@@ -28,8 +28,8 @@
2828

2929
\setlength\parindent{0pt}
3030

31-
\newcommand{\Pluginversion}{5.16}
32-
\newcommand{\ReleaseDate}{ November 2011}
31+
\newcommand{\Pluginversion}{5.17}
32+
\newcommand{\ReleaseDate}{ December 2011}
3333
\newcommand{\Rep}{{\tiny{[n]}}}
3434

3535
%%----------------------------------------------------------------------
@@ -148,6 +148,7 @@
148148
\hline \verb'\p"' & \verb$#include"..."$ \hfill (n,i)\\
149149
\hline \verb'\pd' & \verb'#define' \hfill (n,i)\\
150150
\hline \verb'\pu' & \verb'#undef' \hfill (n,i)\\
151+
\hline \verb'\pif' & \verb'#if #endif' \hfill (n,v,i)\\
151152
\hline \verb'\pie' & \verb'#if #else #endif' \hfill (n,v,i)\\
152153
\hline \verb'\pid' & \verb'#ifdef #else #endif' \hfill (n,v,i)\\
153154
\hline \verb'\pin' & \verb'#ifndef #else #endif' \hfill (n,v,i)\\
@@ -203,20 +204,23 @@
203204
\hline \verb'\isc' & \verb'scanf()' \hfill (n,i)\\
204205
\hline \verb'\ica' & \verb'p=calloc()' \hfill (n,i)\\
205206
\hline \verb'\ima' & \verb'p=malloc()' \hfill (n,i)\\
207+
\hline \verb'\ire' & \verb'p=realloc()' \hfill (n,i)\\
206208
\hline \verb'\isi' & \verb'sizeof()' \hfill (n,v,i)\\
207209
\hline \verb'\ias' & \verb'assert()' \hfill (n,v,i)\\
208210
\hline \verb'\ii' & open input file \hfill (n,v,i)\\
209211
\hline \verb'\io' & open output file \hfill (n,v,i)\\
212+
\hline \verb'\ifs' & fscanf \hfill (n,i)\\
213+
\hline \verb'\ifp' & fprintf \hfill (n,i)\\
210214
\hline
211215
\end{tabular}\\
212216
%
213217
\begin{minipage}[b]{64mm}%
214218
\scriptsize{%
215-
\vspace{10mm}
216-
\hrulefill\\
219+
\vspace{1mm}
220+
%\hrulefill\\
217221
$^1$ {system-wide installation only}\\
218222
}%
219-
\end{minipage}\\
223+
\end{minipage}
220224
%
221225
%
222226
%%======================================================================
@@ -278,6 +282,7 @@
278282
\hline \verb'\ra' & set comand line arguments \hfill (n,i)\\
279283
\hline \verb'\rm' & run \texttt{ make}$^1$ \hfill (n,i)\\
280284
\hline \verb'\rmc' & run \texttt{ make clean}$^1$ \hfill (n,i)\\
285+
\hline \verb'\rcm' & choose a makefile $^1$ \hfill (n,i)\\
281286
\hline \verb'\rme' & executable\ to\ run$^1$ \hfill (n,i)\\
282287
\hline \verb'\rma' & cmd.\ line arg.\ for \texttt{make}$^1$ \hfill (n,i)\\
283288
%

0 commit comments

Comments
 (0)