further formatting fixes. added script to create/find ".so" files which are missing

Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
This commit is contained in:
Thomas E. Dickey 2021-03-14 19:24:48 -04:00
parent 1fd32263c0
commit a383f6cc5d
No known key found for this signature in database
GPG key ID: 702353E0F7E48EDB
10 changed files with 238 additions and 37 deletions

View file

@ -16,6 +16,13 @@ Xcursor_shadows = \
XcursorXcFileLoadAllImages \
XcursorXcFileLoad \
XcursorXcFileSave \
XcursorFileLoad \
XcursorFileLoadAllImages \
XcursorFileLoadImage \
XcursorFileLoadImages \
XcursorFileSave \
XcursorFileSaveImages \
XcursorFilenameLoadCursors \
XcursorFilenameLoadImage \
XcursorFilenameLoadImages \
XcursorFilenameLoadAllImages \

View file

@ -22,12 +22,14 @@
.de NS
.br
.ns
.na
.TP \\$1
.na
.nf
..
.de NE
.br
.ad
.fi
..
.ie \n(.g .ds `` \(lq
.el .ds `` ``
@ -250,132 +252,196 @@ versions.
.SH FUNCTIONS
.SS Object Management
.TP
.NS
XcursorImage *XcursorImageCreate (int width, int height)
.NS
void XcursorImageDestroy (XcursorImage *image)
.NE
Allocate and free images. On allocation, the hotspot and the pixels are
left uninitialized. The size is set to the maximum of width and height.
.TP
.NS
XcursorImages *XcursorImagesCreate (int size)
.NS
void XcursorImagesDestroy (XcursorImages *images)
.NE
Allocate and free arrays to hold multiple cursor images. On allocation,
nimage is set to zero.
.TP
.NS
XcursorCursors *XcursorCursorsCreate (Display *dpy, int size)
.NS
void XcursorCursorsDestroy (XcursorCursors *cursors)
.NE
Allocate and free arrays to hold multiple cursors. On allocation,
ncursor is set to zero, ref is set to one.
.SS Reading and writing images.
.TP
.NS
XcursorImage *XcursorXcFileLoadImage (XcursorFile *file, int size)
.NS
XcursorImages *XcursorXcFileLoadImages (XcursorFile *file, int size)
.NS
XcursorImages *XcursorXcFileLoadAllImages (XcursorFile *file)
.NS
XcursorBool XcursorXcFileLoad (XcursorFile *file, XcursorComments **commentsp, XcursorImages **imagesp)
XcursorBool XcursorXcFileLoad (
XcursorFile *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
.NS
XcursorBool XcursorXcFileSave (XcursorFile *file, const XcursorComments *comments, const XcursorImages *images)
XcursorBool XcursorXcFileSave (
XcursorFile *file,
const XcursorComments *comments,
const XcursorImages *images)
.NE
These read and write cursors from an XcursorFile handle. After reading, the
file pointer will be left at some random place in the file.
.TP
.NS
XcursorImage *XcursorFileLoadImage (FILE *file, int size)
.NS
XcursorImages *XcursorFileLoadImages (FILE *file, int size)
.NS
XcursorImages *XcursorFileLoadAllImages (FILE *file)
.NS
XcursorBool XcursorFileLoad (FILE *file, XcursorComments **commentsp, XcursorImages **imagesp)
XcursorBool XcursorFileLoad (FILE *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
.NS
XcursorBool XcursorFileSaveImages (FILE *file, const XcursorImages *images)
XcursorBool XcursorFileSaveImages (FILE *file,
const XcursorImages *images)
.NS
XcursorBool XcursorFileSave (FILE * file, const XcursorComments *comments, const XcursorImages *images)
XcursorBool XcursorFileSave (
FILE * file,
const XcursorComments *comments,
const XcursorImages *images)
.NE
These read and write cursors from a stdio FILE handle. Writing flushes
before returning so that any errors should be detected.
.TP
XcursorImage *XcursorFilenameLoadImage (const char *filename, int size)
.NS
XcursorImages *XcursorFilenameLoadImages (const char *filename, int size)
XcursorImage *XcursorFilenameLoadImage (
const char *filename,
int size)
.NS
XcursorImages *XcursorFilenameLoadImages (
const char *filename,
int size)
.NS
XcursorImages *XcursorFilenameLoadAllImages (FILE *file)
.NS
XcursorBool XcursorFilenameLoad (const char *file, XcursorComments **commentsp, XcursorImages **imagesp)
XcursorBool XcursorFilenameLoad (
const char *file,
XcursorComments **commentsp,
XcursorImages **imagesp)
.NS
XcursorBool XcursorFilenameSaveImages (const char *filename, const XcursorImages *images)
XcursorBool XcursorFilenameSaveImages (
const char *filename,
const XcursorImages *images)
.NS
XcursorBool XcursorFilenameSave (const char *file, const XcursorComments *comments, const XcursorImages *images)
XcursorBool XcursorFilenameSave (
const char *file,
const XcursorComments *comments,
const XcursorImages *images)
.NE
These parallel the stdio FILE interfaces above, but take filenames.
.SS Reading library images
.TP
XcursorImage *XcursorLibraryLoadImage (const char *name, const char *theme, int size)
.NS
XcursorImages *XcursorLibraryLoadImages (const char *name, const char *theme, int size)
XcursorImage *XcursorLibraryLoadImage (
const char *name,
const char *theme,
int size)
.NS
XcursorImages *XcursorLibraryLoadImages (
const char *name,
const char *theme,
int size)
.NE
These search the library path, loading the first file found. If 'theme' is
not NULL, these functions first try appending -theme to name and then
name alone.
.SS Cursor APIs
.TP
Cursor XcursorFilenameLoadCursor (Display *dpy, const char *file)
.NS
XcursorCursors *XcursorFilenameLoadCursors (Display *dpy, const char *file)
Cursor XcursorFilenameLoadCursor (
Display *dpy,
const char *file)
.NS
XcursorCursors *XcursorFilenameLoadCursors (
Display *dpy,
const char *file)
.NE
These load cursors from the specified file.
.TP
Cursor XcursorLibraryLoadCursor (Display *dpy, const char *name)
.NS
XcursorCursors *XcursorLibraryLoadCursors (Display *dpy, const char *name)
Cursor XcursorLibraryLoadCursor (
Display *dpy,
const char *name)
.NS
XcursorCursors *XcursorLibraryLoadCursors (
Display *dpy,
const char *name)
.NE
These load cursors using the specified library name. The theme
comes from the display.
.SS X Cursor Name APIs
.TP
XcursorImage *XcursorShapeLoadImage (unsigned int shape, const char *theme, int size)
.NS
XcursorImages *XcursorShapeLoadImages (unsigned int shape, const char *theme, int size)
XcursorImage *XcursorShapeLoadImage (
unsigned int shape,
const char *theme,
int size)
.NS
XcursorImages *XcursorShapeLoadImages (
unsigned int shape,
const char *theme,
int size)
.NE
These map 'shape' to a library name using the standard X cursor names and
then load the images.
.TP
Cursor XcursorShapeLoadCursor (Display *dpy, unsigned int shape)
.NS
XcursorCursors *XcursorShapeLoadCursors (Display *dpy, unsigned int shape)
Cursor XcursorShapeLoadCursor (
Display *dpy,
unsigned int shape)
.NS
XcursorCursors *XcursorShapeLoadCursors (
Display *dpy,
unsigned int shape)
.NE
These map 'shape' to a library name and then load the cursors.
.SS Display Information APIs
.TP
.NS
XcursorBool XcursorSupportsARGB (Display *dpy)
.NE
Returns whether the display supports ARGB cursors or whether cursors will be
mapped to a core X cursor.
.TP
.NS
XcursorBool XcursorSetDefaultSize (Display *dpy, int size)
.NE
Sets the default size for cursors on the specified display. When loading
cursors, those whose nominal size is closest to this size will be preferred.
.TP
.NS
int XcursorGetDefaultSize (Display *dpy)
.NE
Gets the default cursor size.
.TP
.NS
XcursorBool XcursorSetTheme (Display *dpy, const char *theme)
.NE
Sets the current theme name.
.TP
.NS
char *XcursorGetTheme (Display *dpy)
.NE
Gets the current theme name.
.SH "ENVIRONMENT VARIABLES"

1
man/XcursorFileLoad.man Normal file
View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

1
man/XcursorFileSave.man Normal file
View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

View file

@ -0,0 +1 @@
.so man__libmansuffix__/Xcursor.__libmansuffix__

121
man/makelinks Executable file
View file

@ -0,0 +1,121 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------------------
# Copyright 2021, Thomas E. Dickey
#
# All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name(s) of the above copyright
# holders shall not be used in advertising or otherwise to promote the
# sale, use or other dealings in this Software without prior written
# authorization.
#-------------------------------------------------------------------------------
# Ensure that the function-prototypes listed in Xcursor.man have ".so" files,
# and that those are listed in the makefile.
use strict;
use warnings;
our %man_links;
sub read_file($) {
my $file = shift;
my @data;
if ( open my $fh, $file ) {
@data = <$fh>;
close $fh;
chomp @data;
}
return @data;
}
sub make_man_link($) {
my $name = shift;
my $link = ".so man__libmansuffix__/Xcursor.__libmansuffix__";
my $file = $name . ".man";
if ( -f $file ) {
my @data = &read_file($file);
if ( $#data != 0 or $data[0] ne $link ) {
printf "?? wrong: $file\n";
}
}
else {
printf "...create: $file\n";
open my $fh, ">$file" or die "cannot create $file";
printf $fh "%s\n", $link;
close $fh;
system("git add $file");
}
$man_links{$name} = $file;
}
sub scan_man($) {
my $file = shift;
printf "** scan $file\n";
my @data = &read_file($file);
my $last = "";
for my $n ( 0 .. $#data ) {
if ( $last =~ /^\.NS\b/ ) {
my $name = $data[$n];
$name =~ s/^\s*\w+\s*[*]*\s*(\w+)\b.*/$1/;
&make_man_link($name);
}
$last = $data[$n];
}
}
sub scan_make($) {
my $find = shift;
my $file = shift;
printf "** find $find in $file\n";
my @data = &read_file($file);
my %data;
my $state = 0;
for my $n ( 0 .. $#data ) {
if ( $data[$n] =~ /^\s*$find\s*=/ ) {
$state = 1;
}
elsif ( $state == 1 ) {
if ( $data[$n] =~ /\\$/ ) {
}
else {
$state = 2;
}
my $name = $data[$n];
$name =~ s/^\s*(\w+)\s*[\\]?$/$1/;
$data{$name} = 1;
}
elsif ( $state == 2 ) {
last;
}
}
for my $key ( sort keys %data ) {
printf "manpage needs $key\n", unless ( defined $man_links{$key} );
}
for my $key ( sort keys %man_links ) {
printf "$file needs $key\n", unless ( defined $data{$key} );
}
}
&scan_man("Xcursor.man");
&scan_make( "Xcursor_shadows", "Makefile.am" );
1;