Skip to content

Commit 1eff2ea

Browse files
committed
Initial skeleton localization code (Issue #58)
1 parent 3a26c15 commit 1eff2ea

32 files changed

+567
-378
lines changed

pappl/Dependencies

+170-106
Large diffs are not rendered by default.

pappl/Makefile

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ OBJS = \
1414
client.o \
1515
client-accessors.o \
1616
client-auth.o \
17+
client-loc.o \
1718
client-ipp.o \
1819
client-webif.o \
1920
contact.o \
@@ -29,6 +30,7 @@ OBJS = \
2930
job-process.o \
3031
job.o \
3132
link.o \
33+
loc.o \
3234
log.o \
3335
lookup.o \
3436
mainloop.o \
@@ -50,6 +52,7 @@ OBJS = \
5052
system-accessors.o \
5153
system-ipp.o \
5254
system-loadsave.o \
55+
system-loc.o \
5356
system-printer.o \
5457
$(SYSTEM_STATUS).o \
5558
system-subscription.o \
@@ -61,6 +64,7 @@ HEADERS = \
6164
client.h \
6265
device.h \
6366
job.h \
67+
loc.h \
6468
log.h \
6569
mainloop.h \
6670
pappl.h \
@@ -110,7 +114,7 @@ distclean: clean
110114

111115
# Update dependencies
112116
depend:
113-
$(CC) -MM $(CFLAGS) $(OBJS:.o=.c) | sed -e '1,$$s/ \/usr\/include\/[^ ]*//g' -e '1,$$s/ \/usr\/local\/include\/[^ ]*//g' >Dependencies
117+
$(CC) -MM $(CFLAGS) `echo $(OBJS:.o=.c) | sed -e '1,$$s/-macos\.c/-macos.m/g'` | sed -e '1,$$s/ \/usr\/include\/[^ ]*//g' -e '1,$$s/ \/usr\/local\/include\/[^ ]*//g' >Dependencies
114118

115119

116120
# Generate documentation uaing codedoc (https://www.msweet.org/codedoc)
@@ -222,7 +226,7 @@ resheader: $(RESOURCES)
222226
# Analyze code with the Clang static analyzer <https://clang-analyzer.llvm.org>
223227
clang:
224228
echo "clang $(CPPFLAGS) --analyze ..."
225-
clang $(CPPFLAGS) --analyze `echo $(OBJS:.o=.c) | sed -e '1,$$s/macos\.c/macos.m/'` 2>clang.log
229+
clang $(CPPFLAGS) --analyze `echo $(OBJS:.o=.c) | sed -e '1,$$s/-macos\.c/-macos.m/g'` 2>clang.log
226230
rm -rf $(OBJS:.o=.plist)
227231
test -s clang.log && (echo "$(GHA_ERROR)Clang detected issues."; echo ""; cat clang.log; exit 1) || exit 0
228232

@@ -231,7 +235,7 @@ clang:
231235
cppcheck:
232236
echo Analyzing code with Cppcheck...
233237
echo 'cppcheck $(CPPFLAGS) --template=gcc --addon=cert.py --suppressions-list=cppcheck.suppressions ...'
234-
cppcheck $(CPPFLAGS) --template=gcc --addon=cert.py --suppressions-list=cppcheck.suppressions `echo $(OBJS:.o=.c) | sed -e '1,$$s/macos\.c/macos.m/'` 2>cppcheck.log
238+
cppcheck $(CPPFLAGS) --template=gcc --addon=cert.py --suppressions-list=cppcheck.suppressions `echo $(OBJS:.o=.c) | sed -e '1,$$s/-macos\.c/-macos.m/g'` 2>cppcheck.log
235239
test -s cppcheck.log && (echo "$(GHA_ERROR)Cppcheck detected issues."; echo ""; cat cppcheck.log; exit 1) || exit 0
236240

237241

pappl/base-private.h

-8
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,10 @@
99

1010
#ifndef _PAPPL_BASE_PRIVATE_H_
1111
# define _PAPPL_BASE_PRIVATE_H_
12-
13-
14-
//
15-
// Include necessary headers...
16-
//
17-
1812
# include <config.h>
1913
# include "base.h"
2014
# include <limits.h>
2115
# include <sys/stat.h>
22-
2316
# if _WIN32
2417
# include <winreg.h>
2518
# include "win32-gettimeofday.h"
@@ -34,7 +27,6 @@
3427
# include <pthread.h>
3528
# include <sys/fcntl.h>
3629
# include <sys/wait.h>
37-
3830
extern char **environ;
3931
# define O_BINARY 0 // I hate Windows...
4032
# endif // _WIN32

pappl/base.h

+1-18
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99

1010
#ifndef _PAPPL_BASE_H_
1111
# define _PAPPL_BASE_H_
12-
13-
14-
//
15-
// Include necessary headers...
16-
//
17-
1812
# include <cups/cups.h>
1913
# include <cups/raster.h>
2014
# include <stdio.h>
@@ -33,12 +27,6 @@ typedef int uid_t;
3327
# else
3428
# include <unistd.h>
3529
# endif // _WIN32
36-
37-
38-
//
39-
// C++ magic...
40-
//
41-
4230
# ifdef __cplusplus
4331
extern "C" {
4432
# endif // __cplusplus
@@ -104,6 +92,7 @@ typedef unsigned char pappl_dither_t[16][16];
10492
typedef struct pappl_pr_driver_data_s pappl_pr_driver_data_t;
10593
// Print driver data
10694
typedef struct _pappl_job_s pappl_job_t;// Job object
95+
typedef struct _pappl_loc_s pappl_loc_t;// Localization data
10796
typedef struct pappl_pr_options_s pappl_pr_options_t;
10897
// Combined print job options
10998
typedef unsigned int pappl_preason_t; // Bitfield for IPP "printer-state-reasons" values
@@ -148,13 +137,7 @@ extern unsigned papplGetRand(void) _PAPPL_PUBLIC;
148137
extern const char *papplGetTempDir(void) _PAPPL_PUBLIC;
149138

150139

151-
//
152-
// C++ magic...
153-
//
154-
155140
# ifdef __cplusplus
156141
}
157142
# endif // __cplusplus
158-
159-
160143
#endif // !_PAPPL_BASE_H_

pappl/client-loc.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// Client localization functions for the Printer Application Framework
3+
//
4+
// Copyright © 2022 by Michael R Sweet.
5+
//
6+
// Licensed under Apache License v2.0. See the file "LICENSE" for more
7+
// information.
8+
//
9+
10+
#include "client-private.h"
11+
#include "loc-private.h"
12+
13+
14+
//
15+
// 'papplClientGetLoc()' - Get the localization data for a client connection.
16+
//
17+
18+
pappl_loc_t * // O - Localization data to use
19+
papplClientGetLoc(
20+
pappl_client_t *client) // I - Client
21+
{
22+
(void)client;
23+
return (NULL);
24+
}

pappl/client-private.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Private client header file for the Printer Application Framework
33
//
4-
// Copyright © 2019-2020 by Michael R Sweet.
4+
// Copyright © 2019-2022 by Michael R Sweet.
55
// Copyright © 2010-2019 by Apple Inc.
66
//
77
// Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -10,11 +10,6 @@
1010

1111
#ifndef _PAPPL_CLIENT_PRIVATE_H_
1212
# define _PAPPL_CLIENT_PRIVATE_H_
13-
14-
//
15-
// Include necessary headers...
16-
//
17-
1813
# include "base-private.h"
1914
# include "client.h"
2015
# include "log.h"
@@ -67,4 +62,5 @@ extern void *_papplClientRun(pappl_client_t *client) _PAPPL_PRIVATE;
6762
extern void _papplClientHTMLInfo(pappl_client_t *client, bool is_form, const char *dns_sd_name, const char *location, const char *geo_location, const char *organization, const char *org_unit, pappl_contact_t *contact);
6863
extern void _papplClientHTMLPutLinks(pappl_client_t *client, cups_array_t *links, pappl_loptions_t which);
6964

65+
7066
#endif // !_PAPPL_CLIENT_PRIVATE_H_

pappl/client.h

+2-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
//
22
// Public client header file for the Printer Application Framework
33
//
4-
// Copyright © 2019-2020 by Michael R Sweet.
4+
// Copyright © 2019-2022 by Michael R Sweet.
55
//
66
// Licensed under Apache License v2.0. See the file "LICENSE" for more
77
// information.
88
//
99

1010
#ifndef _PAPPL_CLIENT_H_
1111
# define _PAPPL_CLIENT_H_
12-
13-
14-
//
15-
// Include necessary headers...
16-
//
17-
1812
# include "base.h"
19-
20-
21-
//
22-
// C++ magic...
23-
//
24-
2513
# ifdef __cplusplus
2614
extern "C" {
2715
# endif // __cplusplus
@@ -38,6 +26,7 @@ extern const char *papplClientGetHostName(pappl_client_t *client) _PAPPL_PUBLIC;
3826
extern int papplClientGetHostPort(pappl_client_t *client) _PAPPL_PUBLIC;
3927
extern http_t *papplClientGetHTTP(pappl_client_t *client) _PAPPL_PUBLIC;
4028
extern pappl_job_t *papplClientGetJob(pappl_client_t *client) _PAPPL_PUBLIC;
29+
extern pappl_loc_t *papplClientGetLoc(pappl_client_t *client) _PAPPL_PUBLIC;
4130
extern http_state_t papplClientGetMethod(pappl_client_t *client) _PAPPL_PUBLIC;
4231
extern ipp_op_t papplClientGetOperation(pappl_client_t *client) _PAPPL_PUBLIC;
4332
extern const char *papplClientGetOptions(pappl_client_t *client) _PAPPL_PUBLIC;
@@ -66,13 +55,7 @@ extern void papplClientSetCookie(pappl_client_t *client, const char * name, con
6655
extern void papplClientSetUsername(pappl_client_t *client, const char *username) _PAPPL_PUBLIC;
6756

6857

69-
//
70-
// C++ magic...
71-
//
72-
7358
# ifdef __cplusplus
7459
}
7560
# endif // __cplusplus
76-
77-
7861
#endif // !_PAPPL_CLIENT_H_

pappl/device-private.h

+1-24
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
//
22
// Private device communication functions for the Printer Application Framework
33
//
4-
// Copyright © 2019-2020 by Michael R Sweet.
4+
// Copyright © 2019-2022 by Michael R Sweet.
55
//
66
// Licensed under Apache License v2.0. See the file "LICENSE" for more
77
// information.
88
//
99

1010
#ifndef _PAPPL_DEVICE_PRIVATE_H_
1111
# define _PAPPL_DEVICE_PRIVATE_H_
12-
13-
//
14-
// Include necessary headers...
15-
//
16-
1712
# include "base-private.h"
1813
# include "device.h"
1914

2015

21-
//
22-
// C++ magic...
23-
//
24-
25-
# ifdef __cplusplus
26-
extern "C" {
27-
# endif // __cplusplus
28-
29-
3016
//
3117
// Constants...
3218
//
@@ -70,13 +56,4 @@ extern void _papplDeviceAddUSBScheme(void) _PAPPL_PRIVATE;
7056
extern void _papplDeviceError(pappl_deverror_cb_t err_cb, void *err_data, const char *message, ...) _PAPPL_FORMAT(3,4) _PAPPL_PRIVATE;
7157

7258

73-
//
74-
// C++ magic...
75-
//
76-
77-
# ifdef __cplusplus
78-
}
79-
# endif // __cplusplus
80-
81-
8259
#endif // !_PAPPL_DEVICE_H_

pappl/device.h

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
//
22
// Device communication functions for the Printer Application Framework
33
//
4-
// Copyright © 2019-2020 by Michael R Sweet.
4+
// Copyright © 2019-2022 by Michael R Sweet.
55
//
66
// Licensed under Apache License v2.0. See the file "LICENSE" for more
77
// information.
88
//
99

1010
#ifndef _PAPPL_DEVICE_H_
1111
# define _PAPPL_DEVICE_H_
12-
13-
//
14-
// Include necessary headers...
15-
//
16-
1712
# include "base.h"
18-
19-
20-
//
21-
// C++ magic...
22-
//
23-
2413
# ifdef __cplusplus
2514
extern "C" {
2615
# endif // __cplusplus
@@ -101,13 +90,7 @@ extern void papplDeviceSetData(pappl_device_t *device, void *data) _PAPPL_PUBLI
10190
extern ssize_t papplDeviceWrite(pappl_device_t *device, const void *buffer, size_t bytes) _PAPPL_PUBLIC;
10291

10392

104-
//
105-
// C++ magic...
106-
//
107-
10893
# ifdef __cplusplus
10994
}
11095
# endif // __cplusplus
111-
112-
11396
#endif // !_PAPPL_DEVICE_H_

pappl/dnssd-private.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Private DNS-SD header file for the Printer Application Framework
33
//
4-
// Copyright © 2019-2021 by Michael R Sweet.
4+
// Copyright © 2019-2022 by Michael R Sweet.
55
// Copyright © 2010-2019 by Apple Inc.
66
//
77
// Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -10,11 +10,6 @@
1010

1111
#ifndef _PAPPL_DNSSD_PRIVATE_H_
1212
# define _PAPPL_DNSSD_PRIVATE_H_
13-
14-
//
15-
// Include necessary headers...
16-
//
17-
1813
# include "base-private.h"
1914
# ifdef HAVE_MDNSRESPONDER
2015
# include <dns_sd.h>

pappl/httpmon-private.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Private HTTP monitor definitions for the Printer Application Framework
33
//
4-
// Copyright © 2021 by Michael R Sweet.
4+
// Copyright © 2021-2022 by Michael R Sweet.
55
// Copyright © 2012 by Apple Inc.
66
//
77
// Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -10,12 +10,6 @@
1010

1111
#ifndef PAPPL_HTTPMON_PRIVATE_H
1212
# define PAPPL_HTTPMON_PRIVATE_H
13-
14-
15-
//
16-
// Include necessary headers...
17-
//
18-
1913
# include "base-private.h"
2014
# include <cups/http.h>
2115

@@ -64,7 +58,7 @@ typedef struct _pappl_http_monitor_s // HTTP state monitoring data
6458

6559

6660
//
67-
// Prototypes...
61+
// Functions...
6862
//
6963

7064
extern const char *_papplHTTPMonitorGetError(_pappl_http_monitor_t *hm) _PAPPL_PRIVATE;

pappl/job-private.h

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010

1111
#ifndef _PAPPL_JOB_PRIVATE_H_
1212
# define _PAPPL_JOB_PRIVATE_H_
13-
14-
//
15-
// Include necessary headers...
16-
//
17-
1813
# include "base-private.h"
1914
# include "job.h"
2015
# include "log.h"

0 commit comments

Comments
 (0)