Skip to content

Commit

Permalink
Initial skeleton localization code (Issue #58)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Mar 9, 2022
1 parent 3a26c15 commit 1eff2ea
Show file tree
Hide file tree
Showing 32 changed files with 567 additions and 378 deletions.
276 changes: 170 additions & 106 deletions pappl/Dependencies

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions pappl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ OBJS = \
client.o \
client-accessors.o \
client-auth.o \
client-loc.o \
client-ipp.o \
client-webif.o \
contact.o \
Expand All @@ -29,6 +30,7 @@ OBJS = \
job-process.o \
job.o \
link.o \
loc.o \
log.o \
lookup.o \
mainloop.o \
Expand All @@ -50,6 +52,7 @@ OBJS = \
system-accessors.o \
system-ipp.o \
system-loadsave.o \
system-loc.o \
system-printer.o \
$(SYSTEM_STATUS).o \
system-subscription.o \
Expand All @@ -61,6 +64,7 @@ HEADERS = \
client.h \
device.h \
job.h \
loc.h \
log.h \
mainloop.h \
pappl.h \
Expand Down Expand Up @@ -110,7 +114,7 @@ distclean: clean

# Update dependencies
depend:
$(CC) -MM $(CFLAGS) $(OBJS:.o=.c) | sed -e '1,$$s/ \/usr\/include\/[^ ]*//g' -e '1,$$s/ \/usr\/local\/include\/[^ ]*//g' >Dependencies
$(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


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

Expand All @@ -231,7 +235,7 @@ clang:
cppcheck:
echo Analyzing code with Cppcheck...
echo 'cppcheck $(CPPFLAGS) --template=gcc --addon=cert.py --suppressions-list=cppcheck.suppressions ...'
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
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
test -s cppcheck.log && (echo "$(GHA_ERROR)Cppcheck detected issues."; echo ""; cat cppcheck.log; exit 1) || exit 0


Expand Down
8 changes: 0 additions & 8 deletions pappl/base-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@

#ifndef _PAPPL_BASE_PRIVATE_H_
# define _PAPPL_BASE_PRIVATE_H_


//
// Include necessary headers...
//

# include <config.h>
# include "base.h"
# include <limits.h>
# include <sys/stat.h>

# if _WIN32
# include <winreg.h>
# include "win32-gettimeofday.h"
Expand All @@ -34,7 +27,6 @@
# include <pthread.h>
# include <sys/fcntl.h>
# include <sys/wait.h>

extern char **environ;
# define O_BINARY 0 // I hate Windows...
# endif // _WIN32
Expand Down
19 changes: 1 addition & 18 deletions pappl/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@

#ifndef _PAPPL_BASE_H_
# define _PAPPL_BASE_H_


//
// Include necessary headers...
//

# include <cups/cups.h>
# include <cups/raster.h>
# include <stdio.h>
Expand All @@ -33,12 +27,6 @@ typedef int uid_t;
# else
# include <unistd.h>
# endif // _WIN32


//
// C++ magic...
//

# ifdef __cplusplus
extern "C" {
# endif // __cplusplus
Expand Down Expand Up @@ -104,6 +92,7 @@ typedef unsigned char pappl_dither_t[16][16];
typedef struct pappl_pr_driver_data_s pappl_pr_driver_data_t;
// Print driver data
typedef struct _pappl_job_s pappl_job_t;// Job object
typedef struct _pappl_loc_s pappl_loc_t;// Localization data
typedef struct pappl_pr_options_s pappl_pr_options_t;
// Combined print job options
typedef unsigned int pappl_preason_t; // Bitfield for IPP "printer-state-reasons" values
Expand Down Expand Up @@ -148,13 +137,7 @@ extern unsigned papplGetRand(void) _PAPPL_PUBLIC;
extern const char *papplGetTempDir(void) _PAPPL_PUBLIC;


//
// C++ magic...
//

# ifdef __cplusplus
}
# endif // __cplusplus


#endif // !_PAPPL_BASE_H_
24 changes: 24 additions & 0 deletions pappl/client-loc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Client localization functions for the Printer Application Framework
//
// Copyright © 2022 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//

#include "client-private.h"
#include "loc-private.h"


//
// 'papplClientGetLoc()' - Get the localization data for a client connection.
//

pappl_loc_t * // O - Localization data to use
papplClientGetLoc(
pappl_client_t *client) // I - Client
{
(void)client;
return (NULL);
}
8 changes: 2 additions & 6 deletions pappl/client-private.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Private client header file for the Printer Application Framework
//
// Copyright © 2019-2020 by Michael R Sweet.
// Copyright © 2019-2022 by Michael R Sweet.
// Copyright © 2010-2019 by Apple Inc.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
Expand All @@ -10,11 +10,6 @@

#ifndef _PAPPL_CLIENT_PRIVATE_H_
# define _PAPPL_CLIENT_PRIVATE_H_

//
// Include necessary headers...
//

# include "base-private.h"
# include "client.h"
# include "log.h"
Expand Down Expand Up @@ -67,4 +62,5 @@ extern void *_papplClientRun(pappl_client_t *client) _PAPPL_PRIVATE;
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);
extern void _papplClientHTMLPutLinks(pappl_client_t *client, cups_array_t *links, pappl_loptions_t which);


#endif // !_PAPPL_CLIENT_PRIVATE_H_
21 changes: 2 additions & 19 deletions pappl/client.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
//
// Public client header file for the Printer Application Framework
//
// Copyright © 2019-2020 by Michael R Sweet.
// Copyright © 2019-2022 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//

#ifndef _PAPPL_CLIENT_H_
# define _PAPPL_CLIENT_H_


//
// Include necessary headers...
//

# include "base.h"


//
// C++ magic...
//

# ifdef __cplusplus
extern "C" {
# endif // __cplusplus
Expand All @@ -38,6 +26,7 @@ extern const char *papplClientGetHostName(pappl_client_t *client) _PAPPL_PUBLIC;
extern int papplClientGetHostPort(pappl_client_t *client) _PAPPL_PUBLIC;
extern http_t *papplClientGetHTTP(pappl_client_t *client) _PAPPL_PUBLIC;
extern pappl_job_t *papplClientGetJob(pappl_client_t *client) _PAPPL_PUBLIC;
extern pappl_loc_t *papplClientGetLoc(pappl_client_t *client) _PAPPL_PUBLIC;
extern http_state_t papplClientGetMethod(pappl_client_t *client) _PAPPL_PUBLIC;
extern ipp_op_t papplClientGetOperation(pappl_client_t *client) _PAPPL_PUBLIC;
extern const char *papplClientGetOptions(pappl_client_t *client) _PAPPL_PUBLIC;
Expand Down Expand Up @@ -66,13 +55,7 @@ extern void papplClientSetCookie(pappl_client_t *client, const char * name, con
extern void papplClientSetUsername(pappl_client_t *client, const char *username) _PAPPL_PUBLIC;


//
// C++ magic...
//

# ifdef __cplusplus
}
# endif // __cplusplus


#endif // !_PAPPL_CLIENT_H_
25 changes: 1 addition & 24 deletions pappl/device-private.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
//
// Private device communication functions for the Printer Application Framework
//
// Copyright © 2019-2020 by Michael R Sweet.
// Copyright © 2019-2022 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//

#ifndef _PAPPL_DEVICE_PRIVATE_H_
# define _PAPPL_DEVICE_PRIVATE_H_

//
// Include necessary headers...
//

# include "base-private.h"
# include "device.h"


//
// C++ magic...
//

# ifdef __cplusplus
extern "C" {
# endif // __cplusplus


//
// Constants...
//
Expand Down Expand Up @@ -70,13 +56,4 @@ extern void _papplDeviceAddUSBScheme(void) _PAPPL_PRIVATE;
extern void _papplDeviceError(pappl_deverror_cb_t err_cb, void *err_data, const char *message, ...) _PAPPL_FORMAT(3,4) _PAPPL_PRIVATE;


//
// C++ magic...
//

# ifdef __cplusplus
}
# endif // __cplusplus


#endif // !_PAPPL_DEVICE_H_
19 changes: 1 addition & 18 deletions pappl/device.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
//
// Device communication functions for the Printer Application Framework
//
// Copyright © 2019-2020 by Michael R Sweet.
// Copyright © 2019-2022 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//

#ifndef _PAPPL_DEVICE_H_
# define _PAPPL_DEVICE_H_

//
// Include necessary headers...
//

# include "base.h"


//
// C++ magic...
//

# ifdef __cplusplus
extern "C" {
# endif // __cplusplus
Expand Down Expand Up @@ -101,13 +90,7 @@ extern void papplDeviceSetData(pappl_device_t *device, void *data) _PAPPL_PUBLI
extern ssize_t papplDeviceWrite(pappl_device_t *device, const void *buffer, size_t bytes) _PAPPL_PUBLIC;


//
// C++ magic...
//

# ifdef __cplusplus
}
# endif // __cplusplus


#endif // !_PAPPL_DEVICE_H_
7 changes: 1 addition & 6 deletions pappl/dnssd-private.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Private DNS-SD header file for the Printer Application Framework
//
// Copyright © 2019-2021 by Michael R Sweet.
// Copyright © 2019-2022 by Michael R Sweet.
// Copyright © 2010-2019 by Apple Inc.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
Expand All @@ -10,11 +10,6 @@

#ifndef _PAPPL_DNSSD_PRIVATE_H_
# define _PAPPL_DNSSD_PRIVATE_H_

//
// Include necessary headers...
//

# include "base-private.h"
# ifdef HAVE_MDNSRESPONDER
# include <dns_sd.h>
Expand Down
10 changes: 2 additions & 8 deletions pappl/httpmon-private.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Private HTTP monitor definitions for the Printer Application Framework
//
// Copyright © 2021 by Michael R Sweet.
// Copyright © 2021-2022 by Michael R Sweet.
// Copyright © 2012 by Apple Inc.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
Expand All @@ -10,12 +10,6 @@

#ifndef PAPPL_HTTPMON_PRIVATE_H
# define PAPPL_HTTPMON_PRIVATE_H


//
// Include necessary headers...
//

# include "base-private.h"
# include <cups/http.h>

Expand Down Expand Up @@ -64,7 +58,7 @@ typedef struct _pappl_http_monitor_s // HTTP state monitoring data


//
// Prototypes...
// Functions...
//

extern const char *_papplHTTPMonitorGetError(_pappl_http_monitor_t *hm) _PAPPL_PRIVATE;
Expand Down
5 changes: 0 additions & 5 deletions pappl/job-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

#ifndef _PAPPL_JOB_PRIVATE_H_
# define _PAPPL_JOB_PRIVATE_H_

//
// Include necessary headers...
//

# include "base-private.h"
# include "job.h"
# include "log.h"
Expand Down
Loading

0 comments on commit 1eff2ea

Please sign in to comment.