summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-07-02 14:53:33 +0000
committerwlemb <wlemb>2003-07-02 14:53:33 +0000
commit8e53963522b71803c304e465d2eb78780b085062 (patch)
tree1e22409cf78e692e72ad66fd3d5547c67411ffa3 /src
parent27aee6bcf61afbd21b15213a25da621bf12c069a (diff)
downloadgroff-8e53963522b71803c304e465d2eb78780b085062.tar.gz
* src/xditview/*.c: Add prototypes, fix return types, add includes.
Based on work by Fumitoshi UKAI <ukai@debian.or.jp>.
Diffstat (limited to 'src')
-rw-r--r--src/xditview/Dvi.c15
-rw-r--r--src/xditview/DviChar.c10
-rw-r--r--src/xditview/DviP.h1
-rw-r--r--src/xditview/XFontName.c1
-rw-r--r--src/xditview/device.c3
-rw-r--r--src/xditview/draw.c34
-rw-r--r--src/xditview/font.c16
-rw-r--r--src/xditview/lex.c2
-rw-r--r--src/xditview/page.c5
-rw-r--r--src/xditview/parse.c47
-rw-r--r--src/xditview/xditview.c36
-rw-r--r--src/xditview/xtotroff.c14
12 files changed, 143 insertions, 41 deletions
diff --git a/src/xditview/Dvi.c b/src/xditview/Dvi.c
index 08eb810a..b577b9aa 100644
--- a/src/xditview/Dvi.c
+++ b/src/xditview/Dvi.c
@@ -94,6 +94,20 @@ static void FindPage ();
static void SaveToFile ();
+/* font.c */
+extern void ParseFontMap();
+extern void DestroyFontMap();
+extern void ForgetFonts();
+
+/* page.c */
+extern void DestroyFileMap();
+extern long SearchPagePosition();
+extern void FileSeek();
+extern void ForgetPagePositions();
+
+/* parse.c */
+extern int ParseInput();
+
DviClassRec dviClassRec = {
{
&widgetClassRec, /* superclass */
@@ -406,6 +420,7 @@ QueryGeometry (w, request, geometry_return)
return ret;
}
+void
SetDevice (dw, name)
DviWidget dw;
char *name;
diff --git a/src/xditview/DviChar.c b/src/xditview/DviChar.c
index ac4d7ce1..fa37b24c 100644
--- a/src/xditview/DviChar.c
+++ b/src/xditview/DviChar.c
@@ -5,7 +5,9 @@
* font indexes and back
*/
-#include "DviChar.h"
+#include <stdlib.h>
+#include <string.h>
+#include "DviChar.h"
extern char *xmalloc();
@@ -21,7 +23,7 @@ static struct map_list *world;
static int standard_maps_loaded = 0;
static void load_standard_maps ();
static int hash_name ();
-static dispose_hash(), compute_hash();
+static void dispose_hash(), compute_hash();
DviCharNameMap *
DviFindMap (encoding)
@@ -58,7 +60,7 @@ DviRegisterMap (map)
compute_hash (map);
}
-static
+static void
dispose_hash (map)
DviCharNameMap *map;
{
@@ -88,7 +90,7 @@ hash_name (name)
return i;
}
-static
+static void
compute_hash (map)
DviCharNameMap *map;
{
diff --git a/src/xditview/DviP.h b/src/xditview/DviP.h
index 851fdfee..825d42b3 100644
--- a/src/xditview/DviP.h
+++ b/src/xditview/DviP.h
@@ -182,6 +182,7 @@ typedef struct {
int word_flag;
} DviPart;
+extern int DviGetAndPut();
#define DviGetIn(dw,cp)\
(dw->dvi.tmpFile ? (\
DviGetAndPut (dw, cp) \
diff --git a/src/xditview/XFontName.c b/src/xditview/XFontName.c
index 5ca9bb81..9de68eda 100644
--- a/src/xditview/XFontName.c
+++ b/src/xditview/XFontName.c
@@ -225,6 +225,7 @@ XCompareFontName (name1, name2, fontNameAttributes)
return True;
}
+Bool
XCopyFontName (name1, name2, fontNameAttributes)
XFontName *name1, *name2;
unsigned int fontNameAttributes;
diff --git a/src/xditview/device.c b/src/xditview/device.c
index 264f681e..0716bbdb 100644
--- a/src/xditview/device.c
+++ b/src/xditview/device.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
@@ -559,7 +560,7 @@ static
FILE *open_device_file(device_name, file_name, result)
char *device_name, *file_name, **result;
{
- char *buf, *path;
+ char *buf;
FILE *fp;
buf = XtMalloc(3 + strlen(device_name) + 1 + strlen(file_name) + 1);
diff --git a/src/xditview/draw.c b/src/xditview/draw.c
index fe7c80f7..77539509 100644
--- a/src/xditview/draw.c
+++ b/src/xditview/draw.c
@@ -25,6 +25,10 @@
static int FakeCharacter();
+/* font.c */
+extern int MaxFontPosition();
+
+void
HorizontalMove(dw, delta)
DviWidget dw;
int delta;
@@ -32,6 +36,7 @@ HorizontalMove(dw, delta)
dw->dvi.state->x += delta;
}
+void
HorizontalGoto(dw, NewPosition)
DviWidget dw;
int NewPosition;
@@ -39,6 +44,7 @@ HorizontalGoto(dw, NewPosition)
dw->dvi.state->x = NewPosition;
}
+void
VerticalMove(dw, delta)
DviWidget dw;
int delta;
@@ -46,6 +52,7 @@ VerticalMove(dw, delta)
dw->dvi.state->y += delta;
}
+void
VerticalGoto(dw, NewPosition)
DviWidget dw;
int NewPosition;
@@ -53,6 +60,7 @@ VerticalGoto(dw, NewPosition)
dw->dvi.state->y = NewPosition;
}
+void
AdjustCacheDeltas (dw)
DviWidget dw;
{
@@ -94,6 +102,7 @@ AdjustCacheDeltas (dw)
}
}
+void
FlushCharCache (dw)
DviWidget dw;
{
@@ -115,6 +124,7 @@ FlushCharCache (dw)
dw->dvi.cache.start_y = dw->dvi.cache.y = YPos (dw);
}
+void
Newline (dw)
DviWidget dw;
{
@@ -123,6 +133,7 @@ Newline (dw)
dw->dvi.word_flag = 0;
}
+void
Word (dw)
DviWidget dw;
{
@@ -152,7 +163,7 @@ int charExists (fi, c)
|| p->ascent != 0 || p->descent != 0 || p->attributes != 0);
}
-static
+static void
DoCharacter (dw, c, wid)
DviWidget dw;
int c;
@@ -349,6 +360,7 @@ int FakeCharacter (dw, buf, wid)
return 1;
}
+void
PutNumberedCharacter (dw, c)
DviWidget dw;
int c;
@@ -391,13 +403,14 @@ PutNumberedCharacter (dw, c)
}
}
+void
ClearPage (dw)
DviWidget dw;
{
XClearWindow (XtDisplay (dw), XtWindow (dw));
}
-static
+static void
setGC (dw)
DviWidget dw;
{
@@ -421,7 +434,7 @@ setGC (dw)
}
}
-static
+static void
setFillGC (dw)
DviWidget dw;
{
@@ -448,6 +461,7 @@ setFillGC (dw)
}
}
+void
DrawLine (dw, x, y)
DviWidget dw;
int x, y;
@@ -463,6 +477,7 @@ DrawLine (dw, x, y)
xp + DeviceToX (dw, x), yp + DeviceToX (dw, y));
}
+void
DrawCircle (dw, diam)
DviWidget dw;
int diam;
@@ -477,6 +492,7 @@ DrawCircle (dw, diam)
d, d, 0, 64*360);
}
+void
DrawFilledCircle (dw, diam)
DviWidget dw;
int diam;
@@ -494,6 +510,7 @@ DrawFilledCircle (dw, diam)
d, d, 0, 64*360);
}
+void
DrawEllipse (dw, a, b)
DviWidget dw;
int a, b;
@@ -505,6 +522,7 @@ DrawEllipse (dw, a, b)
DeviceToX (dw, a), DeviceToX (dw, b), 0, 64*360);
}
+void
DrawFilledEllipse (dw, a, b)
DviWidget dw;
int a, b;
@@ -519,6 +537,7 @@ DrawFilledEllipse (dw, a, b)
DeviceToX (dw, a), DeviceToX (dw, b), 0, 64*360);
}
+void
DrawArc (dw, x0, y0, x1, y1)
DviWidget dw;
int x0, y0, x1, y1;
@@ -545,6 +564,7 @@ DrawArc (dw, x0, y0, x1, y1)
rad*2, rad*2, angle1, angle2);
}
+void
DrawPolygon (dw, v, n)
DviWidget dw;
int *v;
@@ -576,7 +596,7 @@ DrawPolygon (dw, v, n)
XtFree((char *)p);
}
-
+void
DrawFilledPolygon (dw, v, n)
DviWidget dw;
int *v;
@@ -612,7 +632,7 @@ DrawFilledPolygon (dw, v, n)
#define POINTS_MAX 10000
-static
+static void
appendPoint(points, pointi, x, y)
XPoint *points;
int *pointi;
@@ -627,7 +647,7 @@ appendPoint(points, pointi, x, y)
#define FLATNESS 1
-static
+static void
flattenCurve(points, pointi, x2, y2, x3, y3, x4, y4)
XPoint *points;
int *pointi;
@@ -663,7 +683,7 @@ flattenCurve(points, pointi, x2, y2, x3, y3, x4, y4)
}
}
-
+void
DrawSpline (dw, v, n)
DviWidget dw;
int *v;
diff --git a/src/xditview/font.c b/src/xditview/font.c
index 2e028aa6..8b4114af 100644
--- a/src/xditview/font.c
+++ b/src/xditview/font.c
@@ -9,10 +9,16 @@
#include <X11/StringDefs.h>
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
#include "DviP.h"
#include "XFontName.h"
-static DisposeFontSizes();
+static void DisposeFontSizes();
+void DestroyFontMap();
+
+/* XFontName.c */
+extern Bool XParseFontName();
+extern Bool XFormatFontName();
static char *
savestr (s)
@@ -115,7 +121,7 @@ SkipFontNameElement (n)
# define SizePosition 8
# define EncodingPosition 13
-static
+static int
ConvertFontNameToSize (n)
char *n;
{
@@ -191,7 +197,7 @@ InstallFontSizes (dw, x_name, scalablep)
return sizes;
}
-static
+static void
DisposeFontSizes (dw, fs)
DviWidget dw;
DviFontSizeList *fs;
@@ -263,6 +269,7 @@ InstallFont (dw, position, dvi_name, x_name)
return f;
}
+void
ForgetFonts (dw)
DviWidget dw;
{
@@ -322,6 +329,7 @@ MapXNameToDviName (dw, x_name)
}
#endif
+void
ParseFontMap (dw)
DviWidget dw;
{
@@ -357,6 +365,7 @@ ParseFontMap (dw)
dw->dvi.font_map = fm;
}
+void
DestroyFontMap (font_map)
DviFontMap *font_map;
{
@@ -374,6 +383,7 @@ DestroyFontMap (font_map)
/* ARGSUSED */
+void
SetFontPosition (dw, position, dvi_name, extra)
DviWidget dw;
int position;
diff --git a/src/xditview/lex.c b/src/xditview/lex.c
index 32831bda..1f60bbbb 100644
--- a/src/xditview/lex.c
+++ b/src/xditview/lex.c
@@ -4,6 +4,7 @@
#include <stdio.h>
#include "DviP.h"
+int
DviGetAndPut(dw, cp)
DviWidget dw;
int *cp;
@@ -67,6 +68,7 @@ GetWord(dw, Buffer, Length)
return Buffer;
}
+int
GetNumber(dw)
DviWidget dw;
{
diff --git a/src/xditview/page.c b/src/xditview/page.c
index 9284199c..bd3bb60d 100644
--- a/src/xditview/page.c
+++ b/src/xditview/page.c
@@ -28,6 +28,7 @@ MapPageNumberToFileMap (dw, number)
return m;
}
+void
DestroyFileMap (m)
DviFileMap *m;
{
@@ -39,6 +40,7 @@ DestroyFileMap (m)
}
}
+void
ForgetPagePositions (dw)
DviWidget dw;
{
@@ -46,6 +48,7 @@ ForgetPagePositions (dw)
dw->dvi.file_map = 0;
}
+void
RememberPagePosition(dw, number)
DviWidget dw;
int number;
@@ -64,6 +67,7 @@ RememberPagePosition(dw, number)
m->position = ftell (dw->dvi.file);
}
+long
SearchPagePosition (dw, number)
DviWidget dw;
int number;
@@ -75,6 +79,7 @@ SearchPagePosition (dw, number)
return m->position;
}
+void
FileSeek(dw, position)
DviWidget dw;
long position;
diff --git a/src/xditview/parse.c b/src/xditview/parse.c
index d763268c..4606438c 100644
--- a/src/xditview/parse.c
+++ b/src/xditview/parse.c
@@ -12,12 +12,44 @@
#include "DviP.h"
static int StopSeen = 0;
-static ParseDrawFunction(), ParseDeviceControl();
-static push_env(), pop_env();
+static void ParseDrawFunction(), ParseDeviceControl();
+static void push_env(), pop_env();
+
+/* draw.c */
+extern int PutCharacter();
+extern int PutNumberedCharacter();
+extern void HorizontalGoto();
+extern void Word();
+extern void VerticalGoto();
+extern void VerticalMove();
+extern void FlushCharCache();
+extern void Newline();
+extern void DrawLine();
+extern void DrawCircle();
+extern void DrawFilledCircle();
+extern void DrawEllipse();
+extern void DrawFilledEllipse();
+extern void DrawArc();
+extern void DrawPolygon();
+extern void DrawFilledPolygon();
+extern void DrawSpline();
+
+/* Dvi.c */
+extern void SetDevice();
+
+/* page.c */
+extern void RememberPagePosition();
+
+/* font.c */
+extern void SetFontPosition();
+
+/* lex.c */
+extern int GetNumber();
#define HorizontalMove(dw, delta) ((dw)->dvi.state->x += (delta))
+int
ParseInput(dw)
register DviWidget dw;
{
@@ -158,7 +190,7 @@ ParseInput(dw)
}
}
-static
+static void
push_env(dw)
DviWidget dw;
{
@@ -177,7 +209,7 @@ push_env(dw)
dw->dvi.state = new;
}
-static
+static void
pop_env(dw)
DviWidget dw;
{
@@ -188,7 +220,7 @@ pop_env(dw)
XtFree ((char *) old);
}
-static
+static void
InitTypesetter (dw)
DviWidget dw;
{
@@ -200,7 +232,7 @@ InitTypesetter (dw)
#define DRAW_ARGS_MAX 128
-static
+static void
ParseDrawFunction(dw, buf)
DviWidget dw;
char *buf;
@@ -284,13 +316,12 @@ char *buf;
}
}
-static
+static void
ParseDeviceControl(dw) /* Parse the x commands */
DviWidget dw;
{
char str[20], str1[50];
int c, n;
- extern int LastPage, CurrentPage;
GetWord (dw, str, 20);
switch (str[0]) { /* crude for now */
diff --git a/src/xditview/xditview.c b/src/xditview/xditview.c
index 75b7fd14..eac2edd8 100644
--- a/src/xditview/xditview.c
+++ b/src/xditview/xditview.c
@@ -46,6 +46,7 @@ static char rcsid[] = "$XConsortium: xditview.c,v 1.17 89/12/10 17:05:08 rws Exp
#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/SmeBSB.h>
+#include <stdlib.h>
#include <signal.h>
#include "Dvi.h"
@@ -101,7 +102,7 @@ static FILE *current_file;
* Report the syntax for calling xditview.
*/
-static
+static void
Syntax(call)
char *call;
{
@@ -126,12 +127,12 @@ static struct menuEntry {
char *name;
void (*function)();
} menuEntries[] = {
- "nextPage", NextPage,
- "previousPage", PreviousPage,
- "selectPage", SelectPage,
- "print", Print,
- "openFile", OpenFile,
- "quit", Quit,
+ {"nextPage", NextPage},
+ {"previousPage", PreviousPage},
+ {"selectPage", SelectPage},
+ {"print", Print},
+ {"openFile", OpenFile},
+ {"quit", Quit},
};
static void NextPageAction(), PreviousPageAction(), SelectPageAction();
@@ -139,17 +140,18 @@ static void OpenFileAction(), QuitAction();
static void AcceptAction(), CancelAction();
static void PrintAction();
static void RerasterizeAction();
+static void MakePrompt();
XtActionsRec xditview_actions[] = {
- "NextPage", NextPageAction,
- "PreviousPage", PreviousPageAction,
- "SelectPage", SelectPageAction,
- "Print", PrintAction,
- "OpenFile", OpenFileAction,
- "Rerasterize", RerasterizeAction,
- "Quit", QuitAction,
- "Accept", AcceptAction,
- "Cancel", CancelAction,
+ {"NextPage", NextPageAction},
+ {"PreviousPage", PreviousPageAction},
+ {"SelectPage", SelectPageAction},
+ {"Print", PrintAction},
+ {"OpenFile", OpenFileAction},
+ {"Rerasterize", RerasterizeAction},
+ {"Quit", QuitAction},
+ {"Accept", AcceptAction},
+ {"Cancel", CancelAction},
};
#define MenuNextPage 0
@@ -318,6 +320,7 @@ char *name;
static char fileBuf[1024];
+static void
ResetMenuEntry (entry)
Widget entry;
{
@@ -516,6 +519,7 @@ void AcceptAction (widget, event, params, num_params)
CancelAction (widget, event, params, num_params);
}
+static void
MakePrompt(centerw, prompt, func, def)
Widget centerw;
char *prompt;
diff --git a/src/xditview/xtotroff.c b/src/xditview/xtotroff.c
index 97cac0a5..cea0e70b 100644
--- a/src/xditview/xtotroff.c
+++ b/src/xditview/xtotroff.c
@@ -9,6 +9,7 @@
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
+#include <string.h>
#include <fcntl.h>
#include "XFontName.h"
#include "DviChar.h"
@@ -19,6 +20,10 @@ char *malloc();
#include <stdlib.h>
#endif
+/* XFontName.c */
+extern Bool XParseFontName();
+extern Bool XFormatFontName();
+
#define charWidth(fi,c) ((fi)->per_char[(c) - (fi)->min_char_or_byte2].width)
#define charHeight(fi,c) ((fi)->per_char[(c) - (fi)->min_char_or_byte2].ascent)
#define charDepth(fi,c) ((fi)->per_char[(c) - (fi)->min_char_or_byte2].descent)
@@ -45,6 +50,7 @@ int charExists (fi, c)
/* Canonicalize the font name by replacing scalable parts by *s. */
+static int
CanonicalizeFontName (font_name, canon_font_name)
char *font_name, *canon_font_name;
{
@@ -63,7 +69,8 @@ CanonicalizeFontName (font_name, canon_font_name)
return 1;
}
-int FontNamesAmbiguous(font_name, names, count)
+static int
+FontNamesAmbiguous(font_name, names, count)
char *font_name;
char **names;
int count;
@@ -90,6 +97,7 @@ int count;
return 0;
}
+static int
MapFont (font_name, troff_name)
char *font_name;
char *troff_name;
@@ -211,7 +219,8 @@ MapFont (font_name, troff_name)
return 1;
}
-static usage(prog)
+static void
+usage(prog)
char *prog;
{
fprintf (stderr,
@@ -234,6 +243,7 @@ int n;
return p;
}
+int
main (argc, argv)
char **argv;
{