-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterBannerToPDF() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <config.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterPDFToRaster() filter function
- */
+ //
+ // Fire up the cfFilterBannerToPDF() filter function
+ //
char buf[1024];
const char *datadir = getenv("CUPS_DATADIR");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
#
# Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
msgid "Generic"
msgstr "Generique"
//
// Copyright (c) 2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
//
-// 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
-// AUTHORS OR COPYRIGHT HOLDERS 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.
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
//
#media "110x115/11x11.5" 792 828
#
# Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
# Make sure we have enough options
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
# Make sure we have enough options
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
# Make sure we have enough options
//
// Copyright (c) 2015-2016, 2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
//
-// 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
-// AUTHORS OR COPYRIGHT HOLDERS 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.
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
//
Throughput 1
#
# Copyright (c) 2015-2016, 2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
. @CUPS_DATADIR@/braille/cups-braille.sh
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
. @CUPS_DATADIR@/braille/index.sh
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
. @CUPS_DATADIR@/braille/index.sh
#
# Copyright (c) 2015-2018, 2021 Samuel Thibault <samuel.thibault@ens-lyon.org>
#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
# Make sure we have enough options
-/*
- Copyright (c) 2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
- j
- 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
- AUTHORS OR COPYRIGHT HOLDERS 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.
-*/
+//
+// Character conversion table generator for imageubrltoindexv[34]
+//
+// Copyright (c) 2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
#include <locale.h>
#include <pthread.h>
#include <stdio.h>
-int main(int argc, char *argv[]) {
- int i, j, lo, hi;
- setlocale(LC_ALL,"");
- for (i = 0; i < 256; i++)
- {
- j = (i&0x7) | ((i&0x8) << 3) | ((i&0x70) >> 1) | (i&0x80);
- lo = i & 0xf;
- hi = (i & 0xf0) >> 4;
- printf(" -e 's/%lc/%c%c/g' \\\n", 0x2800+j, '@'+lo, '@'+hi);
- }
- return 0;
+int
+main(int argc,
+ char *argv[])
+{
+ int i, j, lo, hi;
+ setlocale(LC_ALL, "");
+ for (i = 0; i < 256; i ++)
+ {
+ j = (i & 0x7) | ((i & 0x8) << 3) | ((i & 0x70) >> 1) | (i & 0x80);
+ lo = i & 0xf;
+ hi = (i & 0xf0) >> 4;
+ printf(" -e 's/%lc/%c%c/g' \\\n", 0x2800 + j, '@' + lo, '@' + hi);
+ }
+ return (0);
}
//
// Copyright (c) 2015, 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
//
-// 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
-// AUTHORS OR COPYRIGHT HOLDERS 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.
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
//
Group "Braille/Braille transcription"
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
#
# Copyright (c) 2015-2018, 2022 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Get an attribute from the ppd file
getAttribute () {
-//
+//
// Copyright (c) 2015, 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
-//
-// 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
-// AUTHORS OR COPYRIGHT HOLDERS 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.
-//
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
Group "Image/Image conversion"
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
-//
+//
// Copyright (c) 2015 Samuel Thibault <samuel.thibault@ens-lyon.org>
-//
-// 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
-// AUTHORS OR COPYRIGHT HOLDERS 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.
-//
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
#include <liblouis1.defs>
#include <liblouis2.defs>
#!/bin/bash
-#
+#
# Copyright (c) 2015, 2017-2018, 2020 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
TABLESDIR=@TABLESDIR@
#
# Copyright (c) 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
#
# Copyright (c) 2015-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
#
# Copyright (c) 2017-2018 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
#
# Copyright (c) 2017 Samuel Thibault <samuel.thibault@ens-lyon.org>
-#
-# 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
-# AUTHORS OR COPYRIGHT HOLDERS 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.
-#
+#
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
+#
# Make sure we have enough options
if [ $# != 5 -a $# != 6 ]; then
-/*
- * Advanced EPSON ESC/P command filter for CUPS.
- *
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- *
- *
- * Contents:
- *
- * main() - Main entry and command processing.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Advanced EPSON ESC/P command filter for cups-filters.
+//
+// Copyright 2007-2011 by Apple Inc.
+// Copyright 1993-2005 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+//
+// Contents:
+//
+// main() - Main entry and command processing.
+//
+
+//
+// Include necessary headers...
+//
#include <cups/cups.h>
#include <ppd/ppd.h>
#include <ctype.h>
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
- FILE *fp; /* Command file */
- char line[1024], /* Line from file */
- *lineptr; /* Pointer into line */
- int feedpage; /* Feed the page */
- ppd_file_t *ppd; /* PPD file */
+ FILE *fp; // Command file
+ char line[1024], // Line from file
+ *lineptr; // Pointer into line
+ int feedpage; // Feed the page
+ ppd_file_t *ppd; // PPD file
- /*
- * Check for valid arguments...
- */
+ //
+ // Check for valid arguments...
+ //
if (argc < 6 || argc > 7)
{
- /*
- * We don't have the correct number of arguments; write an error message
- * and return.
- */
+ //
+ // We don't have the correct number of arguments; write an error message
+ // and return.
+ //
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
argv[0]);
return (1);
}
- /*
- * Open the PPD file...
- */
+ //
+ // Open the PPD file...
+ //
if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL)
{
return (1);
}
- /*
- * Open the command file as needed...
- */
+ //
+ // Open the command file as needed...
+ //
if (argc == 7)
{
else
fp = stdin;
- /*
- * Some EPSON printers need an additional command issued at the
- * beginning of each job to exit from USB "packet" mode...
- */
+ //
+ // Some EPSON printers need an additional command issued at the
+ // beginning of each job to exit from USB "packet" mode...
+ //
if (ppd->model_number & ESCP_USB)
cfWritePrintData("\000\000\000\033\001@EJL 1284.4\n@EJL \n\033@", 29);
- /*
- * Reset the printer...
- */
+ //
+ // Reset the printer...
+ //
cfWritePrintData("\033@", 2);
- /*
- * Enter remote mode...
- */
+ //
+ // Enter remote mode...
+ //
cfWritePrintData("\033(R\010\000\000REMOTE1", 13);
feedpage = 0;
- /*
- * Read the commands from the file and send the appropriate commands...
- */
+ //
+ // Read the commands from the file and send the appropriate commands...
+ //
while (fgets(line, sizeof(line), fp) != NULL)
{
- /*
- * Drop trailing newline...
- */
+ //
+ // Drop trailing newline...
+ //
lineptr = line + strlen(line) - 1;
if (*lineptr == '\n')
*lineptr = '\0';
- /*
- * Skip leading whitespace...
- */
+ //
+ // Skip leading whitespace...
+ //
for (lineptr = line; isspace(*lineptr); lineptr ++);
- /*
- * Skip comments and blank lines...
- */
+ //
+ // Skip comments and blank lines...
+ //
if (*lineptr == '#' || !*lineptr)
continue;
- /*
- * Parse the command...
- */
+ //
+ // Parse the command...
+ //
if (strncasecmp(lineptr, "Clean", 5) == 0)
{
- /*
- * Clean heads...
- */
+ //
+ // Clean heads...
+ //
cfWritePrintData("CH\002\000\000\000", 6);
}
else if (strncasecmp(lineptr, "PrintAlignmentPage", 18) == 0)
{
- /*
- * Print alignment page...
- */
+ //
+ // Print alignment page...
+ //
int phase;
}
else if (strncasecmp(lineptr, "PrintSelfTestPage", 17) == 0)
{
- /*
- * Print version info and nozzle check...
- */
+ //
+ // Print version info and nozzle check...
+ //
cfWritePrintData("VI\002\000\000\000", 6);
cfWritePrintData("NC\002\000\000\000", 6);
}
else if (strncasecmp(lineptr, "ReportLevels", 12) == 0)
{
- /*
- * Report ink levels...
- */
+ //
+ // Report ink levels...
+ //
cfWritePrintData("IQ\001\000\001", 5);
}
else if (strncasecmp(lineptr, "SetAlignment", 12) == 0)
{
- /*
- * Set head alignment...
- */
+ //
+ // Set head alignment...
+ //
int phase, x;
fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", lineptr);
}
- /*
- * Exit remote mode...
- */
+ //
+ // Exit remote mode...
+ //
cfWritePrintData("\033\000\000\000", 4);
- /*
- * Eject the page as needed...
- */
+ //
+ // Eject the page as needed...
+ //
if (feedpage)
{
putchar(12);
}
- /*
- * Reset the printer...
- */
+ //
+ // Reset the printer...
+ //
cfWritePrintData("\033@", 2);
- /*
- * Close the command file and return...
- */
+ //
+ // Close the command file and return...
+ //
ppdClose(ppd);
return (0);
}
-
-/*
- * Advanced PCL command filter for CUPS.
- *
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- *
- *
- * Contents:
- *
- * main() - Main entry and command processing.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Advanced PCL command filter for cups-filters.
+//
+// Copyright 2007-2011 by Apple Inc.
+// Copyright 1993-2005 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+//
+// Contents:
+//
+// main() - Main entry and command processing.
+//
+
+//
+// Include necessary headers...
+//
#include <cups/cups.h>
#include <ppd/ppd.h>
#include <ctype.h>
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line
+ // arguments
+ char *argv[]) // I - Command-line arguments
{
- FILE *fp; /* Command file */
- char line[1024], /* Line from file */
- *lineptr; /* Pointer into line */
- int feedpage; /* Feed the page */
- ppd_file_t *ppd; /* PPD file */
+ FILE *fp; // Command file
+ char line[1024], // Line from file
+ *lineptr; // Pointer into line
+ int feedpage; // Feed the page
+ ppd_file_t *ppd; // PPD file
- /*
- * Check for valid arguments...
- */
+ //
+ // Check for valid arguments...
+ //
if (argc < 6 || argc > 7)
{
- /*
- * We don't have the correct number of arguments; write an error message
- * and return.
- */
+ //
+ // We don't have the correct number of arguments; write an error message
+ // and return.
+ //
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
argv[0]);
return (1);
}
- /*
- * Open the PPD file...
- */
+ //
+ // Open the PPD file...
+ //
if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL)
{
return (1);
}
- /*
- * Open the command file as needed...
- */
+ //
+ // Open the command file as needed...
+ //
if (argc == 7)
{
else
fp = stdin;
- /*
- * Reset the printer...
- */
+ //
+ // Reset the printer...
+ //
cfWritePrintData("\033E", 2);
- /*
- * Read the commands from the file and send the appropriate commands...
- */
+ //
+ // Read the commands from the file and send the appropriate commands...
+ //
feedpage = 0;
while (fgets(line, sizeof(line), fp) != NULL)
{
- /*
- * Drop trailing newline...
- */
+ //
+ // Drop trailing newline...
+ //
lineptr = line + strlen(line) - 1;
if (*lineptr == '\n')
*lineptr = '\0';
- /*
- * Skip leading whitespace...
- */
+ //
+ // Skip leading whitespace...
+ //
for (lineptr = line; isspace(*lineptr); lineptr ++);
- /*
- * Skip comments and blank lines...
- */
+ //
+ // Skip comments and blank lines...
+ //
if (*lineptr == '#' || !*lineptr)
continue;
- /*
- * Parse the command...
- */
+ //
+ // Parse the command...
+ //
if (strncasecmp(lineptr, "Clean", 5) == 0 &&
(ppd->model_number & PCL_INKJET))
{
- /*
- * Clean heads...
- */
+ //
+ // Clean heads...
+ //
cfWritePrintData("\033&b16WPML \004\000\006\001\004\001\005\001"
"\001\004\001\144", 22);
fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", lineptr);
}
- /*
- * Eject the page as needed...
- */
+ //
+ // Eject the page as needed...
+ //
if (feedpage)
{
putchar(12);
}
- /*
- * Reset the printer...
- */
+ //
+ // Reset the printer...
+ //
cfWritePrintData("\033E", 2);
- /*
- * Close the command file and return...
- */
+ //
+ // Close the command file and return...
+ //
ppdClose(ppd);
return (0);
}
-
-/*
- * This file contains model number definitions for the CUPS unified
- * ESC/P driver.
- *
- * Copyright 2007 by Apple Inc.
- * Copyright 1997-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- */
+//
+// This file contains model number definitions for the unified
+// ESC/P driver of cups-filters.
+//
+// Copyright 2007 by Apple Inc.
+// Copyright 1997-2005 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
-/* General ESC/P Support */
-#define ESCP_DOTMATRIX 0x1 /* Dot matrix printer? */
-#define ESCP_MICROWEAVE 0x2 /* Use microweave command? */
-#define ESCP_STAGGER 0x4 /* Are color jets staggered? */
-#define ESCP_ESCK 0x8 /* Use print mode command?*/
-#define ESCP_EXT_UNITS 0x10 /* Use extended unit commands? */
-#define ESCP_EXT_MARGINS 0x20 /* Use extended margin command */
-#define ESCP_USB 0x40 /* Send USB packet mode escape? */
-#define ESCP_PAGE_SIZE 0x80 /* Use page size command */
-#define ESCP_RASTER_ESCI 0x100 /* Use ESC i graphics command */
-
-/* Remote mode support */
-#define ESCP_REMOTE 0x1000 /* Use remote mode commands? */
+// General ESC/P Support
+#define ESCP_DOTMATRIX 0x1 // Dot matrix printer?
+#define ESCP_MICROWEAVE 0x2 // Use microweave command?
+#define ESCP_STAGGER 0x4 // Are color jets staggered?
+#define ESCP_ESCK 0x8 // Use print mode command?
+#define ESCP_EXT_UNITS 0x10 // Use extended unit commands?
+#define ESCP_EXT_MARGINS 0x20 // Use extended margin command
+#define ESCP_USB 0x40 // Send USB packet mode escape?
+#define ESCP_PAGE_SIZE 0x80 // Use page size command
+#define ESCP_RASTER_ESCI 0x100 // Use ESC i graphics command
+// Remote mode support
+#define ESCP_REMOTE 0x1000 // Use remote mode commands?
-/*
- * PostScript to PDF filter (based on cfFilterGhostscript() filter function).
- */
-
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterGhostscript() for cups-filters.
+//
+// PostScript to PDF filter.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0; /* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterGhostscript() filter function.
- */
+ //
+ // Fire up the cfFilterGhostscript() filter function.
+ //
cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PDF;
ret = ppdFilterCUPSWrapper(argc, argv, cfFilterGhostscript, &outformat,
return (ret);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * PostScript/PDF to PCL-XL filter (based on cfFilterGhostscript() filter
- * function).
- */
-
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterGhostscript() for cups-filters.
+//
+// PostScript/PDF to PCL-XL filter.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
+
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-static int JobCanceled = 0; /* Set to 1 on SIGTERM */
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterGhostscript() filter function.
- */
+ //
+ // Fire up the cfFilterGhostscript() filter function.
+ //
cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PXL;
ret = ppdFilterCUPSWrapper(argc, argv, cfFilterGhostscript, &outformat,
return (ret);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * PostScript/PDF to Raster filter (based on cfFilterGhostscript() filter
- * function).
- */
-
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterGhostscript() for cups-filters.
+//
+// PostScript/PDF to Raster filter.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
+
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-static int JobCanceled = 0; /* Set to 1 on SIGTERM */
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterGhostscript() filter function.
- */
+ //
+ // Fire up the cfFilterGhostscript() filter function.
+ //
ret = ppdFilterCUPSWrapper(argc, argv, cfFilterGhostscript, NULL,
&JobCanceled);
return (ret);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * Image-to-PDF filter for CUPS (based on cfFilterImageToPDF() filter function).
- *
- * Copyright © 2020 by Till Kamppeter
- * Copyright © 2007-2018 by Apple Inc.
- * Copyright © 1993-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0. See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for ppdFilterImageToPDF() for cups-filters.
+//
+// Copyright © 2020 by Till Kamppeter
+// Copyright © 2007-2018 by Apple Inc.
+// Copyright © 1993-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0;// Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterImageToPDF() filter function
- */
+ //
+ // Fire up the ppdFilterImageToPDF() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterImageToPDF, NULL,
&JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-
-/*
- * Image-to-PostScript filter for CUPS (based on cfFilterImageToPS() filter function)
- *
- * Copyright © 2020 by Till Kamppeter
- * Copyright © 2007-2018 by Apple Inc.
- * Copyright © 1993-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0. See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for ppdFilterImageToPS() for cups-filters.
+//
+// Copyright © 2020 by Till Kamppeter
+// Copyright © 2007-2018 by Apple Inc.
+// Copyright © 1993-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the cfFilterImageToPS() filter function
- */
+ //
+ // Fire up the ppdFilterImageToPS() filter function
+ //
- ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterImageToPS, NULL, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterImageToPS, NULL,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: imagetops filter function failed.\n");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-
-/*
- * Image-to-Raster filter for CUPS (based on cfFilterImageToRaster() filter function).
- *
- * Copyright © 2020 by Till Kamppeter
- * Copyright © 2007-2018 by Apple Inc.
- * Copyright © 1993-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0. See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterImageToRaster() for cups-filters.
+//
+// Copyright © 2020 by Till Kamppeter
+// Copyright © 2007-2018 by Apple Inc.
+// Copyright © 1993-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0;// Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterImageToRaster() filter function
- */
+ //
+ // Fire up the cfFilterImageToRaster() filter function
+ //
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterImageToRaster, NULL, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterImageToRaster, NULL,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: imagetoraster filter function failed.\n");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterMuPDFToPWG() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+static int JobCanceled = 0;// Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
char *argv[],
- char *envp[]) /* I - Command-line arguments */
+ char *envp[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterMuPDFToPWG() filter function
- */
+ //
+ // Fire up the cfFilterMuPDFToPWG() filter function
+ //
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterMuPDFToPWG, NULL, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterMuPDFToPWG, NULL,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: mupdftopwg filter function failed.\n");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * Common PCL functions for CUPS.
- *
- * Copyright 2007 by Apple Inc.
- * Copyright 1993-2005 by Easy Software Products
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- *
- * Contents:
- *
- * pcl_set_media_size() - Set media size using the page size command.
- * pjl_write() - Write a PJL command string, performing
- * substitutions as needed.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Common PCL functions for cups-filters.
+//
+// Copyright 2007 by Apple Inc.
+// Copyright 1993-2005 by Easy Software Products
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+// Contents:
+//
+// pcl_set_media_size() - Set media size using the page size command.
+// pjl_write() - Write a PJL command string, performing
+// substitutions as needed.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/driver.h>
#include <ppd/ppd.h>
#include <math.h>
-/*
- * 'pcl_set_media_size()' - Set media size using the page size command.
- */
+//
+// 'pcl_set_media_size()' - Set media size using the page size command.
+//
void
-pcl_set_media_size(ppd_file_t *ppd, /* I - PPD file */
- float width, /* I - Width of page */
- float length) /* I - Length of page */
+pcl_set_media_size(ppd_file_t *ppd, // I - PPD file
+ float width, // I - Width of page
+ float length) // I - Length of page
{
float l;
int l_int;
fprintf (stderr, "DEBUG: Width: %f Length: %f Long Edge: %f\n",
width, length, l);
- printf("\033&l0O"); /* Set portrait orientation */
+ printf("\033&l0O"); // Set portrait orientation
if (!ppd || ppd->model_number & PCL_PAPER_SIZE)
{
- if (l_int >= 418 && l_int <= 420) /* Postcard */
- printf("\033&l71A"); /* Set page size */
- else if (l_int >= 539 && l_int <= 541) /* Monarch Envelope */
- printf("\033&l80A"); /* Set page size */
- else if (l_int >= 566 && l_int <= 568) /* Double Postcard */
- printf("\033&l72A"); /* Set page size */
- else if (l_int >= 594 && l_int <= 596) /* A5 */
- printf("\033&l25A"); /* Set page size */
- else if (l_int >= 611 && l_int <= 613) /* Statement */
- printf("\033&l5A"); /* Set page size */
- else if (l_int >= 623 && l_int <= 625) /* DL Envelope */
- printf("\033&l90A"); /* Set page size */
- else if (l_int >= 648 && l_int <= 650) /* C5 Envelope */
- printf("\033&l91A"); /* Set page size */
- else if (l_int >= 683 && l_int <= 685) /* COM-10 Envelope */
- printf("\033&l81A"); /* Set page size */
- else if (l_int >= 708 && l_int <= 710) /* B5 Envelope */
- printf("\033&l100A"); /* Set page size */
- else if (l_int >= 728 && l_int <= 730) /* B5 */
- printf("\033&l45A"); /* Set page size */
- else if (l_int >= 755 && l_int <= 757) /* Executive */
- printf("\033&l1A"); /* Set page size */
- else if (l_int >= 791 && l_int <= 793) /* Letter */
- printf("\033&l2A"); /* Set page size */
- else if (l_int >= 841 && l_int <= 843) /* A4 */
- printf("\033&l26A"); /* Set page size */
- else if (l_int >= 935 && l_int <= 937) /* Foolscap */
- printf("\033&l23A"); /* Set page size */
- else if (l_int >= 1007 && l_int <= 1009) /* Legal */
- printf("\033&l3A"); /* Set page size */
- else if (l_int >= 1031 && l_int <= 1033) /* B4 */
- printf("\033&l46A"); /* Set page size */
- else if (l_int >= 1190 && l_int <= 1192) /* A3 */
- printf("\033&l27A"); /* Set page size */
- else if (l_int >= 1223 && l_int <= 1225) /* Tabloid */
- printf("\033&l6A"); /* Set page size */
+ if (l_int >= 418 && l_int <= 420) // Postcard
+ printf("\033&l71A"); // Set page size
+ else if (l_int >= 539 && l_int <= 541) // Monarch Envelope
+ printf("\033&l80A"); // Set page size
+ else if (l_int >= 566 && l_int <= 568) // Double Postcard
+ printf("\033&l72A"); // Set page size
+ else if (l_int >= 594 && l_int <= 596) // A5
+ printf("\033&l25A"); // Set page size
+ else if (l_int >= 611 && l_int <= 613) // Statement
+ printf("\033&l5A"); // Set page size
+ else if (l_int >= 623 && l_int <= 625) // DL Envelope
+ printf("\033&l90A"); // Set page size
+ else if (l_int >= 648 && l_int <= 650) // C5 Envelope
+ printf("\033&l91A"); // Set page size
+ else if (l_int >= 683 && l_int <= 685) // COM-10 Envelope
+ printf("\033&l81A"); // Set page size
+ else if (l_int >= 708 && l_int <= 710) // B5 Envelope
+ printf("\033&l100A"); // Set page size
+ else if (l_int >= 728 && l_int <= 730) // B5
+ printf("\033&l45A"); // Set page size
+ else if (l_int >= 755 && l_int <= 757) // Executive
+ printf("\033&l1A"); // Set page size
+ else if (l_int >= 791 && l_int <= 793) // Letter
+ printf("\033&l2A"); // Set page size
+ else if (l_int >= 841 && l_int <= 843) // A4
+ printf("\033&l26A"); // Set page size
+ else if (l_int >= 935 && l_int <= 937) // Foolscap
+ printf("\033&l23A"); // Set page size
+ else if (l_int >= 1007 && l_int <= 1009) // Legal
+ printf("\033&l3A"); // Set page size
+ else if (l_int >= 1031 && l_int <= 1033) // B4
+ printf("\033&l46A"); // Set page size
+ else if (l_int >= 1190 && l_int <= 1192) // A3
+ printf("\033&l27A"); // Set page size
+ else if (l_int >= 1223 && l_int <= 1225) // Tabloid
+ printf("\033&l6A"); // Set page size
else
{
- printf("\033&l101A"); /* Set page size */
- printf("\033&l6D\033&k12H"); /* Set 6 LPI, 10 CPI */
- printf("\033&l%.2fP", l / 12.0); /* Set page length */
- printf("\033&l%.0fF", l / 12.0); /* Set text length to page */
+ printf("\033&l101A"); // Set page size
+ printf("\033&l6D\033&k12H"); // Set 6 LPI, 10 CPI
+ printf("\033&l%.2fP", l / 12.0); // Set page length
+ printf("\033&l%.0fF", l / 12.0); // Set text length to page
}
#if 0
switch ((int)(l + 0.5f))
{
- case 419 : /* Postcard */
- printf("\033&l71A"); /* Set page size */
+ case 419 : // Postcard
+ printf("\033&l71A"); // Set page size
break;
- case 540 : /* Monarch Envelope */
- printf("\033&l80A"); /* Set page size */
+ case 540 : // Monarch Envelope
+ printf("\033&l80A"); // Set page size
break;
- case 567 : /* Double Postcard */
- printf("\033&l72A"); /* Set page size */
+ case 567 : // Double Postcard
+ printf("\033&l72A"); // Set page size
break;
- case 595 : /* A5 */
- printf("\033&l25A"); /* Set page size */
+ case 595 : // A5
+ printf("\033&l25A"); // Set page size
break;
- case 612 : /* Statement */
- printf("\033&l5A"); /* Set page size */
+ case 612 : // Statement
+ printf("\033&l5A"); // Set page size
break;
- case 624 : /* DL Envelope */
- printf("\033&l90A"); /* Set page size */
+ case 624 : // DL Envelope
+ printf("\033&l90A"); // Set page size
break;
- case 649 : /* C5 Envelope */
- printf("\033&l91A"); /* Set page size */
+ case 649 : // C5 Envelope
+ printf("\033&l91A"); // Set page size
break;
- case 684 : /* COM-10 Envelope */
- printf("\033&l81A"); /* Set page size */
+ case 684 : // COM-10 Envelope
+ printf("\033&l81A"); // Set page size
break;
- case 709 : /* B5 Envelope */
- printf("\033&l100A"); /* Set page size */
+ case 709 : // B5 Envelope
+ printf("\033&l100A"); // Set page size
break;
- case 729 : /* B5 */
- printf("\033&l45A"); /* Set page size */
+ case 729 : // B5
+ printf("\033&l45A"); // Set page size
break;
- case 756 : /* Executive */
- printf("\033&l1A"); /* Set page size */
+ case 756 : // Executive
+ printf("\033&l1A"); // Set page size
break;
- case 792 : /* Letter */
- printf("\033&l2A"); /* Set page size */
+ case 792 : // Letter
+ printf("\033&l2A"); // Set page size
break;
- case 842 : /* A4 */
- printf("\033&l26A"); /* Set page size */
+ case 842 : // A4
+ printf("\033&l26A"); // Set page size
break;
- case 936 : /* Foolscap */
- printf("\033&l23A"); /* Set page size */
+ case 936 : // Foolscap
+ printf("\033&l23A"); // Set page size
break;
- case 1008 : /* Legal */
- printf("\033&l3A"); /* Set page size */
+ case 1008 : // Legal
+ printf("\033&l3A"); // Set page size
break;
- case 1032 : /* B4 */
- printf("\033&l46A"); /* Set page size */
+ case 1032 : // B4
+ printf("\033&l46A"); // Set page size
break;
- case 1191 : /* A3 */
- printf("\033&l27A"); /* Set page size */
+ case 1191 : // A3
+ printf("\033&l27A"); // Set page size
break;
- case 1224 : /* Tabloid */
- printf("\033&l6A"); /* Set page size */
+ case 1224 : // Tabloid
+ printf("\033&l6A"); // Set page size
break;
default :
- printf("\033&l101A"); /* Set page size */
- printf("\033&l6D\033&k12H"); /* Set 6 LPI, 10 CPI */
+ printf("\033&l101A"); // Set page size
+ printf("\033&l6D\033&k12H"); // Set 6 LPI, 10 CPI
printf("\033&l%.2fP", l / 12.0);
- /* Set page length */
+ // Set page length
printf("\033&l%.0fF", l / 12.0);
- /* Set text length to page */
+ // Set text length to page
break;
}
#endif
}
else
{
- printf("\033&l6D\033&k12H"); /* Set 6 LPI, 10 CPI */
+ printf("\033&l6D\033&k12H"); // Set 6 LPI, 10 CPI
printf("\033&l%.2fP", l / 12.0);
- /* Set page length */
+ // Set page length
printf("\033&l%.0fF", l / 12.0);
- /* Set text length to page */
+ // Set text length to page
}
- printf("\033&l0L"); /* Turn off perforation skip */
- printf("\033&l0E"); /* Reset top margin to 0 */
+ printf("\033&l0L"); // Turn off perforation skip
+ printf("\033&l0E"); // Reset top margin to 0
}
-/*
- * 'pjl_write()' - Write a PJL command string, performing substitutions as needed.
- */
+//
+// 'pjl_write()' - Write a PJL command string, performing substitutions as
+// needed.
+//
void
-pjl_write(const char *format, /* I - Format string */
- const char *value, /* I - Value for %s */
- int job_id, /* I - Job ID */
- const char *user, /* I - Username */
- const char *title, /* I - Title */
- int num_options, /* I - Number of options */
- cups_option_t *options) /* I - Options */
+pjl_write(const char *format, // I - Format string
+ const char *value, // I - Value for %s
+ int job_id, // I - Job ID
+ const char *user, // I - Username
+ const char *title, // I - Title
+ int num_options, // I - Number of options
+ cups_option_t *options) // I - Options
{
- const char *optval; /* Option value */
- char match[255], /* Match string */
- *mptr; /* Pointer into match string */
+ const char *optval; // Option value
+ char match[255], // Match string
+ *mptr; // Pointer into match string
if (!format)
{
if (*format == '%')
{
- /*
- * Perform substitution...
- */
+ //
+ // Perform substitution...
+ //
format ++;
switch (*format)
{
- case 'b' : /* job-billing */
+ case 'b' : // job-billing
if ((optval = cupsGetOption("job-billing", num_options,
options)) != NULL)
fputs(optval, stdout);
break;
- case 'h' : /* job-originating-host-name */
+ case 'h' : // job-originating-host-name
if ((optval = cupsGetOption("job-originating-host-name",
num_options, options)) != NULL)
fputs(optval, stdout);
break;
- case 'j' : /* job-id */
+ case 'j' : // job-id
printf("%d", job_id);
break;
- case 'n' : /* CR + LF */
+ case 'n' : // CR + LF
putchar('\r');
putchar('\n');
break;
- case 'q' : /* double quote (") */
+ case 'q' : // double quote (")
putchar('\"');
break;
- case 's' : /* "value" */
+ case 's' : // "value"
if (value)
fputs(value, stdout);
break;
- case 't' : /* job-name */
+ case 't' : // job-name
fputs(title, stdout);
break;
- case 'u' : /* job-originating-user-name */
+ case 'u' : // job-originating-user-name
fputs(user, stdout);
break;
- case '?' : /* ?value:string; */
- /*
- * Get the match value...
- */
+ case '?' : // ?value:string;
+ //
+ // Get the match value...
+ //
for (format ++, mptr = match; *format && *format != ':'; format ++)
if (mptr < (match + sizeof(match) - 1))
if (!*format)
return;
- /*
- * See if we have a match...
- */
+ //
+ // See if we have a match...
+ //
format ++;
*mptr = '\0';
if (!value || strcmp(match, value))
{
- /*
- * Value doesn't match; skip the string that follows...
- */
+ //
+ // Value doesn't match; skip the string that follows...
+ //
while (*format && *format != ';')
format ++;
}
else
{
- /*
- * Value matches; copy the string that follows...
- */
+ //
+ // Value matches; copy the string that follows...
+ //
while (*format && *format != ';')
putchar(*format++);
return;
break;
- default : /* Anything else */
+ default : // Anything else
putchar('%');
- case '%' : /* %% = single % */
+ case '%' : // %% = single %
putchar(*format);
break;
}
format ++;
}
}
-
-/*
- * Common HP-PCL definitions for CUPS.
- *
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- */
+//
+// Common HP-PCL definitions for cups-filters.
+//
+// Copyright 2007-2011 by Apple Inc.
+// Copyright 1993-2005 by Easy Software Products, All Rights Reserved.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
-/*
- * Include necessary headers...
- */
+//
+// Include necessary headers...
+//
#include <ppd/ppd.h>
#include <string.h>
#include "pcl.h"
-/*
- * Functions/macros...
- */
+//
+// Functions/macros...
+//
#define pcl_reset()\
printf("\033E")
-/*
- * This file contains model number definitions for the CUPS unified
- * PCL driver.
- *
- * Copyright 2007 by Apple Inc.
- * Copyright 1997-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- */
+//
+// This file contains model number definitions for the unified
+// PCL driver of cups-filters.
+//
+// Copyright 2007 by Apple Inc.
+// Copyright 1997-2005 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
-/* General PCL Support */
-#define PCL_PAPER_SIZE 0x1 /* Use ESC&l#A */
-#define PCL_INKJET 0x2 /* Use inkjet commands */
+// General PCL Support
+#define PCL_PAPER_SIZE 0x1 // Use ESC&l#A
+#define PCL_INKJET 0x2 // Use inkjet commands
-/* Raster Support */
-#define PCL_RASTER_END_COLOR 0x100 /* Use ESC*rC */
-#define PCL_RASTER_CID 0x200 /* Use ESC*v#W */
-#define PCL_RASTER_CRD 0x400 /* Use ESC*g#W */
-#define PCL_RASTER_SIMPLE 0x800 /* Use ESC*r#U */
-#define PCL_RASTER_RGB24 0x1000 /* Use 24-bit RGB mode */
-
-/* PJL Support */
-#define PCL_PJL 0x10000 /* Use PJL Commands */
-#define PCL_PJL_PAPERWIDTH 0x20000 /* Use PJL PAPERWIDTH/LENGTH */
-#define PCL_PJL_HPGL2 0x40000 /* Enter HPGL2 */
-#define PCL_PJL_PCL3GUI 0x80000 /* Enter PCL3GUI */
-#define PCL_PJL_RESOLUTION 0x100000 /* Use PJL SET RESOLUTION */
+// Raster Support
+#define PCL_RASTER_END_COLOR 0x100 // Use ESC*rC
+#define PCL_RASTER_CID 0x200 // Use ESC*v#W
+#define PCL_RASTER_CRD 0x400 // Use ESC*g#W
+#define PCL_RASTER_SIMPLE 0x800 // Use ESC*r#U
+#define PCL_RASTER_RGB24 0x1000 // Use 24-bit RGB mode
+// PJL Support
+#define PCL_PJL 0x10000 // Use PJL Commands
+#define PCL_PJL_PAPERWIDTH 0x20000 // Use PJL PAPERWIDTH/LENGTH
+#define PCL_PJL_HPGL2 0x40000 // Enter HPGL2
+#define PCL_PJL_PCL3GUI 0x80000 // Enter PCL3GUI
+#define PCL_PJL_RESOLUTION 0x100000 // Use PJL SET RESOLUTION
-/**
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * @brief Decode PCLm to a Raster file
- * @file pclmtoraster.c
- * @author Vikrant Malik <vikrantmalik051@gmail.com> (c) 2020
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterPCLmToRaster() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+
+static int JobCanceled = 0;// Set to 1 on SIGTERM
+
int main(int argc, char **argv)
{
int ret;
- /*
- * Fire up the cfFilterPCLmToRaster() filter function
- */
+ //
+ // Fire up the cfFilterPCLmToRaster() filter function
+ //
cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
- if (t) {
+ if (t)
+ {
if (strcasestr(t, "urf"))
outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "cups-raster"))
outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
}
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPCLmToRaster, &outformat, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPCLmToRaster, &outformat,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pclmtoraster filter function failed.\n");
- return ret;
+ return (ret);
}
-/*
- * Pdf to pdf filter based on cfFilterPDFToPDF() filter function.
- */
-
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for ppdFilterPDFToPDF() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterPDFToPDF() filter function
- */
+ //
+ // Fire up the ppdFilterPDFToPDF() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterPDFToPDF, NULL, &JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * PDF-to-PostScript filter for CUPS (based on cfFilterPDFToPS() filter function).
- *
- * Copyright © 2020 by Till Kamppeter
- * Copyright © 2007-2018 by Apple Inc.
- * Copyright © 1993-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0. See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for ppdFilterPDFToPS() for cups-filters.
+//
+// Copyright © 2020 by Till Kamppeter
+// Copyright © 2007-2018 by Apple Inc.
+// Copyright © 1993-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the cfFilterPSToPS() filter function
- */
+ //
+ // Fire up the ppdFilterPDFToPS() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterPDFToPS, NULL, &JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterPDFToRaster() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterPDFToRaster() filter function
- */
+ //
+ // Fire up the cfFilterPDFToRaster() filter function
+ //
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPDFToRaster, NULL, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPDFToRaster, NULL,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pdftoraster filter function failed.\n");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * PostScript filter for CUPS (based on cfFilterPSToPS() filter function).
- *
- * Copyright © 2020 by Till Kamppeter
- * Copyright © 2007-2018 by Apple Inc.
- * Copyright © 1993-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0. See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for ppdFilterPSToPS() for cups-filters.
+//
+// Copyright © 2020 by Till Kamppeter
+// Copyright © 2007-2018 by Apple Inc.
+// Copyright © 1993-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the cfFilterPSToPS() filter function
- */
+ //
+ // Fire up the ppdFilterPSToPS() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterPSToPS, NULL, &JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+ cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-
-/*
- * Raster to PCLm filter (based on cfFilterPWGToPDF() filter function).
- */
-
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterPWGToPDF() for cups-filters.
+//
+// PWG Raster to PCLm filter.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
+
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterRasterToPDF() filter function.
- */
+ //
+ // Fire up the cfFilterPWGToPDF() filter function.
+ //
cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PCLM;
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPWGToPDF, &outformat, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPWGToPDF, &outformat,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pwgtopclm filter failed.\n");
return (ret);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * Raster to PDF filter (based on cfFilterPWGToPDF() filter function).
- */
-
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterPWGToPDF() for cups-filters.
+//
+// PWG Raster to PDF filter.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
+
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterRasterToPDF() filter function.
- */
+ //
+ // Fire up the cfFilterPWGToPDF() filter function.
+ //
cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PDF;
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPWGToPDF, &outformat, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPWGToPDF, &outformat,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pwgtopdf filter failed.\n");
return (ret);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterPWGToRaster() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterPWGToRaster() filter function
- */
+ //
+ // Fire up the cfFilterPWGToRaster() filter function
+ //
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPWGToRaster, NULL, &JobCanceled);
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterPWGToRaster, NULL,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pwgtoraster filter function failed.\n");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+ cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * Advanced EPSON ESC/P raster driver for CUPS.
- *
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- *
- * Contents:
- *
- * Setup() - Prepare the printer for graphics output.
- * StartPage() - Start a page of graphics.
- * EndPage() - Finish a page of graphics.
- * Shutdown() - Shutdown a printer.
- * CancelJob() - Cancel the current job...
- * CompressData() - Compress a line of graphics.
- * OutputBand() - Output a band of graphics.
- * ProcessLine() - Read graphics from the page stream and output
- * as needed.
- * main() - Main entry and processing of driver.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Advanced EPSON ESC/P raster driver for cups-filters.
+//
+// Copyright 2007-2011 by Apple Inc.
+// Copyright 1993-2005 by Easy Software Products.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+// Contents:
+//
+// Setup() - Prepare the printer for graphics output.
+// StartPage() - Start a page of graphics.
+// EndPage() - Finish a page of graphics.
+// Shutdown() - Shutdown a printer.
+// CancelJob() - Cancel the current job...
+// CompressData() - Compress a line of graphics.
+// OutputBand() - Output a band of graphics.
+// ProcessLine() - Read graphics from the page stream and output
+// as needed.
+// main() - Main entry and processing of driver.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/driver.h>
#include <ppd/ppd.h>
#include <ctype.h>
-/*
- * Softweave data...
- */
+//
+// Softweave data...
+//
typedef struct cups_weave_str
{
- struct cups_weave_str *prev, /* Previous band */
- *next; /* Next band */
- int x, y, /* Column/Line on the page */
- plane, /* Color plane */
- dirty, /* Is this buffer dirty? */
- row, /* Row in the buffer */
- count; /* Max rows this pass */
- unsigned char *buffer; /* Data buffer */
+ struct cups_weave_str *prev, // Previous band
+ *next; // Next band
+ int x, y, // Column/Line on the page
+ plane, // Color plane
+ dirty, // Is this buffer dirty?
+ row, // Row in the buffer
+ count; // Max rows this pass
+ unsigned char *buffer; // Data buffer
} cups_weave_t;
-/*
- * Globals...
- */
-
-cf_rgb_t *RGB; /* RGB color separation data */
-cf_cmyk_t *CMYK; /* CMYK color separation data */
-unsigned char *PixelBuffer, /* Pixel buffer */
- *CMYKBuffer, /* CMYK buffer */
- *OutputBuffers[7], /* Output buffers */
- *DotBuffers[7], /* Dot buffers */
- *CompBuffer; /* Compression buffer */
-short *InputBuffer; /* Color separation buffer */
-cups_weave_t *DotAvailList, /* Available buffers */
- *DotUsedList, /* Used buffers */
- *DotBands[128][7]; /* Buffers in use */
-int DotBufferSize, /* Size of dot buffers */
- DotRowMax, /* Maximum row number in buffer */
- DotColStep, /* Step for each output column */
- DotRowStep, /* Step for each output line */
- DotRowFeed, /* Amount to feed for interleave */
- DotRowCount, /* Number of rows to output */
- DotRowOffset[7], /* Offset for each color on print head */
- DotRowCurrent, /* Current row */
- DotSize; /* Dot size (Pro 5000 only) */
-int PrinterPlanes, /* # of color planes */
- BitPlanes, /* # of bit planes per color */
- PrinterTop, /* Top of page */
- PrinterLength; /* Length of page */
-cf_lut_t *DitherLuts[7]; /* Lookup tables for dithering */
-cf_dither_t *DitherStates[7]; /* Dither state tables */
-int OutputFeed; /* Number of lines to skip */
-int Canceled; /* Is the job canceled? */
-cf_logfunc_t logfunc; /* Log function */
-void *ld; /* Log function data */
-
-
-/*
- * Prototypes...
- */
+//
+// Globals...
+//
+
+cf_rgb_t *RGB; // RGB color separation data
+cf_cmyk_t *CMYK; // CMYK color separation data
+unsigned char *PixelBuffer, // Pixel buffer
+ *CMYKBuffer, // CMYK buffer
+ *OutputBuffers[7], // Output buffers
+ *DotBuffers[7], // Dot buffers
+ *CompBuffer; // Compression buffer
+short *InputBuffer; // Color separation buffer
+cups_weave_t *DotAvailList, // Available buffers
+ *DotUsedList, // Used buffers
+ *DotBands[128][7]; // Buffers in use
+int DotBufferSize, // Size of dot buffers
+ DotRowMax, // Maximum row number in buffer
+ DotColStep, // Step for each output column
+ DotRowStep, // Step for each output line
+ DotRowFeed, // Amount to feed for interleave
+ DotRowCount, // Number of rows to output
+ DotRowOffset[7], // Offset for each color on print head
+ DotRowCurrent, // Current row
+ DotSize; // Dot size (Pro 5000 only)
+int PrinterPlanes, // # of color planes
+ BitPlanes, // # of bit planes per color
+ PrinterTop, // Top of page
+ PrinterLength; // Length of page
+cf_lut_t *DitherLuts[7]; // Lookup tables for dithering
+cf_dither_t *DitherStates[7]; // Dither state tables
+int OutputFeed; // Number of lines to skip
+int Canceled; // Is the job canceled?
+cf_logfunc_t logfunc; // Log function
+void *ld; // Log function data
+
+
+//
+// Prototypes...
+//
void Setup(ppd_file_t *);
void StartPage(ppd_file_t *, cups_page_header2_t *);
cups_page_header2_t *, const int y);
-/*
- * 'Setup()' - Prepare a printer for graphics output.
- */
+//
+// 'Setup()' - Prepare a printer for graphics output.
+//
void
-Setup(ppd_file_t *ppd) /* I - PPD file */
+Setup(ppd_file_t *ppd) // I - PPD file
{
- /*
- * Some EPSON printers need an additional command issued at the
- * beginning of each job to exit from USB "packet" mode...
- */
+ //
+ // Some EPSON printers need an additional command issued at the
+ // beginning of each job to exit from USB "packet" mode...
+ //
if (ppd->model_number & ESCP_USB)
cfWritePrintData("\000\000\000\033\001@EJL 1284.4\n@EJL \n\033@", 29);
}
-/*
- * 'StartPage()' - Start a page of graphics.
- */
+//
+// 'StartPage()' - Start a page of graphics.
+//
void
-StartPage(ppd_file_t *ppd, /* I - PPD file */
- cups_page_header2_t *header) /* I - Page header */
+StartPage(ppd_file_t *ppd, // I - PPD file
+ cups_page_header2_t *header) // I - Page header
{
- int i, y; /* Looping vars */
- int subrow, /* Current subrow */
- modrow, /* Subrow modulus */
- plane; /* Current color plane */
- unsigned char *ptr; /* Pointer into dot buffer */
- int bands; /* Number of bands to allocate */
- int units; /* Units for resolution */
- cups_weave_t *band; /* Current band */
- const char *colormodel; /* Color model string */
+ int i, y; // Looping vars
+ int subrow, // Current subrow
+ modrow, // Subrow modulus
+ plane; // Current color plane
+ unsigned char *ptr; // Pointer into dot buffer
+ int bands; // Number of bands to allocate
+ int units; // Units for resolution
+ cups_weave_t *band; // Current band
+ const char *colormodel; // Color model string
char resolution[PPD_MAX_NAME],
- /* Resolution string */
- spec[PPD_MAX_NAME]; /* PPD attribute name */
- ppd_attr_t *attr; /* Attribute from PPD file */
- const float default_lut[2] = /* Default dithering lookup table */
+ // Resolution string
+ spec[PPD_MAX_NAME]; // PPD attribute name
+ ppd_attr_t *attr; // Attribute from PPD file
+ const float default_lut[2] = // Default dithering lookup table
{
0.0,
1.0
fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed);
fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep);
- /*
- * Figure out the color model and spec strings...
- */
+ //
+ // Figure out the color model and spec strings...
+ //
switch (header->cupsColorSpace)
{
if (!header->MediaType[0])
strcpy(header->MediaType, "Plain");
- /*
- * Load the appropriate color profiles...
- */
+ //
+ // Load the appropriate color profiles...
+ //
RGB = NULL;
CMYK = NULL;
fprintf(stderr, "DEBUG: PrinterPlanes = %d\n", PrinterPlanes);
- /*
- * Get the dithering parameters...
- */
+ //
+ // Get the dithering parameters...
+ //
switch (PrinterPlanes)
{
- case 1 : /* K */
+ case 1 : // K
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Black", logfunc, ld);
break;
- case 2 : /* Kk */
+ case 2 : // Kk
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Black", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "LightBlack", logfunc, ld);
break;
- case 3 : /* CMY */
+ case 3 : // CMY
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Yellow", logfunc, ld);
break;
- case 4 : /* CMYK */
+ case 4 : // CMYK
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Black", logfunc, ld);
break;
- case 6 : /* CcMmYK */
+ case 6 : // CcMmYK
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Black", logfunc, ld);
break;
- case 7 : /* CcMmYKk */
+ case 7 : // CcMmYKk
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
else
BitPlanes = 1;
- /*
- * Initialize the printer...
- */
+ //
+ // Initialize the printer...
+ //
printf("\033@");
if (ppd->model_number & ESCP_REMOTE)
{
- /*
- * Go into remote mode...
- */
+ //
+ // Go into remote mode...
+ //
cfWritePrintData("\033(R\010\000\000REMOTE1", 13);
- /*
- * Disable status reporting...
- */
+ //
+ // Disable status reporting...
+ //
cfWritePrintData("ST\002\000\000\000", 6);
- /*
- * Enable borderless printing...
- */
+ //
+ // Enable borderless printing...
+ //
if ((attr = ppdFindAttr(ppd, "cupsESCPFP", NULL)) != NULL && attr->value)
{
- /*
- * Set horizontal offset...
- */
+ //
+ // Set horizontal offset...
+ //
i = atoi(attr->value);
putchar(i >> 8);
}
- /*
- * Set media type...
- */
+ //
+ // Set media type...
+ //
if (header->cupsMediaType)
{
if ((attr = ppdFindAttr(ppd, "cupsESCPSN0", spec)) != NULL && attr->value)
{
- /*
- * Set feed sequence...
- */
+ //
+ // Set feed sequence...
+ //
cfWritePrintData("SN\003\000\000\000", 6);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPSN1", spec)) != NULL && attr->value)
{
- /*
- * Set platten gap...
- */
+ //
+ // Set platten gap...
+ //
cfWritePrintData("SN\003\000\000\001", 6);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPSN2", spec)) != NULL && attr->value)
{
- /*
- * Paper feeding/ejecting sequence...
- */
+ //
+ // Paper feeding/ejecting sequence...
+ //
cfWritePrintData("SN\003\000\000\002", 6);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPSN6", spec)) != NULL && attr->value)
{
- /*
- * Eject delay...
- */
+ //
+ // Eject delay...
+ //
cfWritePrintData("SN\003\000\000\006", 6);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPMT", spec)) != NULL && attr->value)
{
- /*
- * Set media type.
- */
+ //
+ // Set media type.
+ //
cfWritePrintData("MT\003\000\000\000", 6);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPPH", spec)) != NULL && attr->value)
{
- /*
- * Set paper thickness.
- */
+ //
+ // Set paper thickness.
+ //
cfWritePrintData("PH\002\000\000", 5);
putchar(atoi(attr->value));
{
if ((attr = ppdFindAttr(ppd, "cupsESCPPC", spec)) != NULL && attr->value)
{
- /*
- * Paper check.
- */
+ //
+ // Paper check.
+ //
cfWritePrintData("PC\002\000\000", 5);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPPP", spec)) != NULL && attr->value)
{
- /*
- * Paper path.
- */
+ //
+ // Paper path.
+ //
int a, b;
if ((attr = ppdFindAttr(ppd, "cupsESCPEX", spec)) != NULL && attr->value)
{
- /*
- * Set media position.
- */
+ //
+ // Set media position.
+ //
cfWritePrintData("EX\006\000\000\000\000\000\005", 9);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPMS", spec)) != NULL && attr->value)
{
- /*
- * Set media size...
- */
+ //
+ // Set media size...
+ //
cfWritePrintData("MS\010\000\000", 5);
putchar(atoi(attr->value));
switch (header->PageSize[1])
{
- case 1191 : /* A3 */
+ case 1191 : // A3
putchar(0x01);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 1032 : /* B4 */
+ case 1032 : // B4
putchar(0x02);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 842 : /* A4 */
+ case 842 : // A4
putchar(0x03);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 595 : /* A4.Transverse */
+ case 595 : // A4.Transverse
putchar(0x03);
putchar(0x01);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 729 : /* B5 */
+ case 729 : // B5
putchar(0x04);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 516 : /* B5.Transverse */
+ case 516 : // B5.Transverse
putchar(0x04);
putchar(0x01);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 1369 : /* Super A3/B */
+ case 1369 : // Super A3/B
putchar(0x20);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 792 : /* Letter */
+ case 792 : // Letter
putchar(0x08);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 612 : /* Letter.Transverse */
+ case 612 : // Letter.Transverse
putchar(0x08);
putchar(0x01);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 1004 : /* Legal */
+ case 1004 : // Legal
putchar(0x0a);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- case 1224 : /* Tabloid */
+ case 1224 : // Tabloid
putchar(0x2d);
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x00);
break;
- default : /* Custom size */
+ default : // Custom size
putchar(0xff);
putchar(0xff);
i = 360 * header->PageSize[0] / 72;
if ((attr = ppdFindAttr(ppd, "cupsESCPAC", spec)) != NULL && attr->value)
{
- /*
- * Enable/disable cutter.
- */
+ //
+ // Enable/disable cutter.
+ //
cfWritePrintData("AC\002\000\000", 5);
putchar(atoi(attr->value));
- if ((attr = ppdFindAttr(ppd, "cupsESCPSN80", header->MediaType)) != NULL && attr->value)
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN80",
+ header->MediaType)) != NULL && attr->value)
{
- /*
- * Cutting method...
- */
+ //
+ // Cutting method...
+ //
cfWritePrintData("SN\003\000\000\200", 6);
putchar(atoi(attr->value));
}
- if ((attr = ppdFindAttr(ppd, "cupsESCPSN81", header->MediaType)) != NULL && attr->value)
+ if ((attr = ppdFindAttr(ppd, "cupsESCPSN81",
+ header->MediaType)) != NULL && attr->value)
{
- /*
- * Cutting pressure...
- */
+ //
+ // Cutting pressure...
+ //
cfWritePrintData("SN\003\000\000\201", 6);
putchar(atoi(attr->value));
if ((attr = ppdFindAttr(ppd, "cupsESCPCO", spec)) != NULL && attr->value)
{
- /*
- * Enable/disable cutter.
- */
+ //
+ // Enable/disable cutter.
+ //
cfWritePrintData("CO\010\000\000\000", 6);
putchar(atoi(attr->value));
cfWritePrintData("\000\000\000\000\000", 5);
}
- /*
- * Exit remote mode...
- */
+ //
+ // Exit remote mode...
+ //
cfWritePrintData("\033\000\000\000", 4);
}
- /*
- * Enter graphics mode...
- */
+ //
+ // Enter graphics mode...
+ //
cfWritePrintData("\033(G\001\000\001", 6);
- /*
- * Set the line feed increment...
- */
+ //
+ // Set the line feed increment...
+ //
- /* TODO: get this from the PPD file... */
+ // TODO: get this from the PPD file...
for (units = 1440; units < header->HWResolution[0]; units *= 2);
if (ppd->model_number & ESCP_EXT_UNITS)
putchar(3600 / header->HWResolution[1]);
}
- /*
- * Set the page length...
- */
+ //
+ // Set the page length...
+ //
PrinterLength = header->PageSize[1] * header->HWResolution[1] / 72;
if (ppd->model_number & ESCP_PAGE_SIZE)
{
- /*
- * Set page size (expands bottom margin)...
- */
+ //
+ // Set page size (expands bottom margin)...
+ //
cfWritePrintData("\033(S\010\000", 5);
putchar(PrinterLength >> 8);
}
- /*
- * Set the top and bottom margins...
- */
+ //
+ // Set the top and bottom margins...
+ //
PrinterTop = (int)((ppd->sizes[1].length - ppd->sizes[1].top) *
header->HWResolution[1] / 72.0);
putchar(PrinterLength >> 8);
}
- /*
- * Set the top position...
- */
+ //
+ // Set the top position...
+ //
cfWritePrintData("\033(V\002\000\000\000", 7);
- /*
- * Enable unidirectional printing depending on the mode...
- */
+ //
+ // Enable unidirectional printing depending on the mode...
+ //
if ((attr = ppdFindColorAttr(ppd, "cupsESCPDirection", colormodel,
header->MediaType, resolution, spec,
sizeof(spec), logfunc, ld)) != NULL)
printf("\033U%c", atoi(attr->value));
- /*
- * Enable/disable microweaving as needed...
- */
+ //
+ // Enable/disable microweaving as needed...
+ //
if ((attr = ppdFindColorAttr(ppd, "cupsESCPMicroWeave", colormodel,
header->MediaType, resolution, spec,
sizeof(spec), logfunc, ld)) != NULL)
printf("\033(i\001%c%c", 0, atoi(attr->value));
- /*
- * Set the dot size and print speed as needed...
- */
+ //
+ // Set the dot size and print speed as needed...
+ //
if ((attr = ppdFindColorAttr(ppd, "cupsESCPDotSize", colormodel,
header->MediaType, resolution, spec,
if (ppd->model_number & ESCP_ESCK)
{
- /*
- * Set the print mode...
- */
+ //
+ // Set the print mode...
+ //
if (PrinterPlanes == 1)
{
- /*
- * Fast black printing.
- */
+ //
+ // Fast black printing.
+ //
cfWritePrintData("\033(K\002\000\000\001", 7);
}
else
{
- /*
- * Color printing.
- */
+ //
+ // Color printing.
+ //
cfWritePrintData("\033(K\002\000\000\002", 7);
}
}
- /*
- * Get softweave settings from header...
- */
+ //
+ // Get softweave settings from header...
+ //
if (header->cupsRowCount <= 1)
{
DotColStep ++;
}
- /*
- * Setup softweave parameters...
- */
+ //
+ // Setup softweave parameters...
+ //
DotRowCurrent = 0;
DotRowMax = DotRowCount * DotRowStep;
if (DotRowMax > 1)
{
- /*
- * Compute offsets for the color jets on the print head...
- */
+ //
+ // Compute offsets for the color jets on the print head...
+ //
bands = DotRowStep * DotColStep * PrinterPlanes * 4;
if (PrinterPlanes == 1)
{
- /*
- * Use full height of print head...
- */
+ //
+ // Use full height of print head...
+ //
if ((attr = ppdFindAttr(ppd, "cupsESCPBlack", resolution)) != NULL &&
attr->value)
{
- /*
- * Use custom black head data...
- */
+ //
+ // Use custom black head data...
+ //
sscanf(attr->value, "%d%d", &DotRowCount, &DotRowStep);
}
}
else if (ppd->model_number & ESCP_STAGGER)
{
- /*
- * Use staggered print head...
- */
+ //
+ // Use staggered print head...
+ //
fputs("DEBUG: Offset head detected...\n", stderr);
if ((attr = ppdFindAttr(ppd, "cupsESCPOffsets", resolution)) != NULL &&
attr->value)
{
- /*
- * Use only 1/3 of the print head when printing color...
- */
+ //
+ // Use only 1/3 of the print head when printing color...
+ //
sscanf(attr->value, "%d%d%d%d", DotRowOffset + 0,
DotRowOffset + 1, DotRowOffset + 2, DotRowOffset + 3);
for (i = 0; i < PrinterPlanes; i ++)
fprintf(stderr, "DEBUG: DotRowOffset[%d] = %d\n", i, DotRowOffset[i]);
- /*
- * Allocate bands...
- */
+ //
+ // Allocate bands...
+ //
for (i = 0; i < bands; i ++)
{
fputs("DEBUG: ----END----\n", stderr);
- /*
- * Fill the initial bands...
- */
+ //
+ // Fill the initial bands...
+ //
modrow = DotColStep * DotRowStep;
if (DotRowFeed == 0)
{
- /*
- * Automatically compute the optimal feed value...
- */
+ //
+ // Automatically compute the optimal feed value...
+ //
DotRowFeed = DotRowCount / DotColStep - DotRowStep;
{
while (DotBands[subrow][0])
{
- /*
- * This subrow is already used, move to another one...
- */
+ //
+ // This subrow is already used, move to another one...
+ //
subrow = (subrow + 1) % modrow;
}
for (plane = 0; plane < PrinterPlanes; plane ++)
{
- /*
- * Pull the next available band from the list...
- */
+ //
+ // Pull the next available band from the list...
+ //
band = DotAvailList;
DotAvailList = DotAvailList->next;
DotBands[subrow][plane] = band;
- /*
- * Start the band in the first few passes, with the number of rows
- * varying to allow for a nice interleaved pattern...
- */
+ //
+ // Start the band in the first few passes, with the number of rows
+ // varying to allow for a nice interleaved pattern...
+ //
band->x = subrow / DotRowStep;
band->y = (subrow % DotRowStep) + DotRowOffset[plane];
band->count = DotRowCount;
fprintf(stderr, "DEBUG: DotBands[%d][%d] = %p, x = %d, y = %d, plane = %d, count = %d\n",
- subrow, plane, (void*)band, band->x, band->y, band->plane, band->count);
+ subrow, plane, (void*)band, band->x, band->y, band->plane,
+ band->count);
}
subrow = (subrow + DotRowFeed) % modrow;
}
else
{
- /*
- * Allocate memory for a single line of graphics...
- */
+ //
+ // Allocate memory for a single line of graphics...
+ //
ptr = calloc(PrinterPlanes, DotBufferSize);
DotBuffers[plane] = ptr;
}
- /*
- * Set the output resolution...
- */
+ //
+ // Set the output resolution...
+ //
cfWritePrintData("\033(D\004\000", 5);
putchar(units);
putchar(units * DotRowStep / header->HWResolution[1]);
putchar(units * DotColStep / header->HWResolution[0]);
- /*
- * Set the top of form...
- */
+ //
+ // Set the top of form...
+ //
OutputFeed = 0;
- /*
- * Allocate buffers as needed...
- */
+ //
+ // Allocate buffers as needed...
+ //
PixelBuffer = malloc(header->cupsBytesPerLine);
InputBuffer = malloc(header->cupsWidth * PrinterPlanes * 2);
}
-/*
- * 'EndPage()' - Finish a page of graphics.
- */
+//
+// 'EndPage()' - Finish a page of graphics.
+//
void
-EndPage(ppd_file_t *ppd, /* I - PPD file */
- cups_page_header2_t *header) /* I - Page header */
+EndPage(ppd_file_t *ppd, // I - PPD file
+ cups_page_header2_t *header) // I - Page header
{
- int i; /* Looping var */
- cups_weave_t *band, /* Current band */
- *next; /* Next band in list */
- int plane; /* Current plane */
- int subrow; /* Current subrow */
- int subrows; /* Number of subrows */
+ int i; // Looping var
+ cups_weave_t *band, // Current band
+ *next; // Next band in list
+ int plane; // Current plane
+ int subrow; // Current subrow
+ int subrows; // Number of subrows
- /*
- * Output the last bands of print data as necessary...
- */
+ //
+ // Output the last bands of print data as necessary...
+ //
if (DotRowMax > 1)
{
- /*
- * Move the remaining bands to the used or avail lists...
- */
+ //
+ // Move the remaining bands to the used or avail lists...
+ //
subrows = DotRowStep * DotColStep;
{
if (DotBands[subrow][plane]->dirty)
{
- /*
- * Insert into the used list...
- */
+ //
+ // Insert into the used list...
+ //
DotBands[subrow][plane]->count = DotBands[subrow][plane]->row;
}
else
{
- /*
- * Nothing here, so move it to the available list...
- */
+ //
+ // Nothing here, so move it to the available list...
+ //
DotBands[subrow][plane]->next = DotAvailList;
DotAvailList = DotBands[subrow][plane];
DotBands[subrow][plane] = NULL;
}
- /*
- * Loop until all bands are written...
- */
+ //
+ // Loop until all bands are written...
+ //
fputs("DEBUG: Pointer list at end of page...\n", stderr);
free(band);
}
- /*
- * Free memory for the available bands, if any...
- */
+ //
+ // Free memory for the available bands, if any...
+ //
for (band = DotAvailList; band != NULL; band = next)
{
DotBuffers[0] = NULL;
}
- /*
- * Output a page eject sequence...
- */
+ //
+ // Output a page eject sequence...
+ //
putchar(12);
- /*
- * Free memory for the page...
- */
+ //
+ // Free memory for the page...
+ //
for (i = 0; i < PrinterPlanes; i ++)
{
}
-/*
- * 'Shutdown()' - Shutdown a printer.
- */
+//
+// 'Shutdown()' - Shutdown a printer.
+//
void
-Shutdown(ppd_file_t *ppd) /* I - PPD file */
+Shutdown(ppd_file_t *ppd) // I - PPD file
{
- /*
- * Reset the printer...
- */
+ //
+ // Reset the printer...
+ //
printf("\033@");
if (ppd->model_number & ESCP_REMOTE)
{
- /*
- * Go into remote mode...
- */
+ //
+ // Go into remote mode...
+ //
cfWritePrintData("\033(R\010\000\000REMOTE1", 13);
- /*
- * LoadXS defaults...
- */
+ //
+ // LoadXS defaults...
+ //
cfWritePrintData("LD\000\000", 4);
- /*
- * Exit remote mode...
- */
+ //
+ // Exit remote mode...
+ //
cfWritePrintData("\033\000\000\000", 4);
}
}
-/*
- * 'AddBand()' - Add a band of data to the used list.
- */
+//
+// 'AddBand()' - Add a band of data to the used list.
+//
void
-AddBand(cups_weave_t *band) /* I - Band to add */
+AddBand(cups_weave_t *band) // I - Band to add
{
- cups_weave_t *current, /* Current band */
- *prev; /* Previous band */
+ cups_weave_t *current, // Current band
+ *prev; // Previous band
if (band->count < 1)
if (current != NULL)
{
- /*
- * Insert the band...
- */
+ //
+ // Insert the band...
+ //
band->next = current;
band->prev = prev;
}
else if (prev != NULL)
{
- /*
- * Append the band to the end...
- */
+ //
+ // Append the band to the end...
+ //
band->prev = prev;
prev->next = band;
}
else
{
- /*
- * First band in list...
- */
+ //
+ // First band in list...
+ //
DotUsedList = band;
band->prev = NULL;
}
-/*
- * 'CancelJob()' - Cancel the current job...
- */
+//
+// 'CancelJob()' - Cancel the current job...
+//
void
-CancelJob(int sig) /* I - Signal */
+CancelJob(int sig) // I - Signal
{
(void)sig;
}
-/*
- * 'CompressData()' - Compress a line of graphics.
- */
+//
+// 'CompressData()' - Compress a line of graphics.
+//
void
-CompressData(ppd_file_t *ppd, /* I - PPD file information */
- const unsigned char *line, /* I - Data to compress */
- const int length,/* I - Number of bytes */
- int plane, /* I - Color plane */
- int type, /* I - Type of compression */
- const int rows, /* I - Number of lines to write */
- const int xstep, /* I - Spacing between columns */
- const int ystep, /* I - Spacing between lines */
- const int offset)/* I - Head offset */
+CompressData(ppd_file_t *ppd, // I - PPD file information
+ const unsigned char *line, // I - Data to compress
+ const int length,// I - Number of bytes
+ int plane, // I - Color plane
+ int type, // I - Type of compression
+ const int rows, // I - Number of lines to write
+ const int xstep, // I - Spacing between columns
+ const int ystep, // I - Spacing between lines
+ const int offset)// I - Head offset
{
register const unsigned char *line_ptr,
- /* Current byte pointer */
- *line_end, /* End-of-line byte pointer */
- *start; /* Start of compression sequence */
- register unsigned char *comp_ptr; /* Pointer into compression buffer */
- register int count; /* Count of bytes for output */
- register int bytes; /* Number of bytes per row */
- static int ctable[7][7] = /* Colors */
+ // Current byte pointer
+ *line_end, // End-of-line byte pointer
+ *start; // Start of compression sequence
+ register unsigned char *comp_ptr; // Pointer into compression buffer
+ register int count; // Count of bytes for output
+ register int bytes; // Number of bytes per row
+ static int ctable[7][7] = // Colors
{
- { 0, 0, 0, 0, 0, 0, 0 }, /* K */
- { 0, 16, 0, 0, 0, 0, 0 }, /* Kk */
- { 2, 1, 4, 0, 0, 0, 0 }, /* CMY */
- { 2, 1, 4, 0, 0, 0, 0 }, /* CMYK */
+ { 0, 0, 0, 0, 0, 0, 0 }, // K
+ { 0, 16, 0, 0, 0, 0, 0 }, // Kk
+ { 2, 1, 4, 0, 0, 0, 0 }, // CMY
+ { 2, 1, 4, 0, 0, 0, 0 }, // CMYK
{ 0, 0, 0, 0, 0, 0, 0 },
- { 2, 18, 1, 17, 4, 0, 0 }, /* CcMmYK */
- { 2, 18, 1, 17, 4, 0, 16 }, /* CcMmYKk */
+ { 2, 18, 1, 17, 4, 0, 0 }, // CcMmYK
+ { 2, 18, 1, 17, 4, 0, 16 }, // CcMmYKk
};
switch (type)
{
case 0 :
- /*
- * Do no compression...
- */
+ //
+ // Do no compression...
+ //
line_ptr = (const unsigned char *)line;
line_end = (const unsigned char *)line + length;
break;
default :
- /*
- * Do TIFF pack-bits encoding...
- */
+ //
+ // Do TIFF pack-bits encoding...
+ //
line_ptr = (const unsigned char *)line;
line_end = (const unsigned char *)line + length;
{
if ((line_ptr + 1) >= line_end)
{
- /*
- * Single byte on the end...
- */
+ //
+ // Single byte on the end...
+ //
*comp_ptr++ = 0x00;
*comp_ptr++ = *line_ptr++;
}
else if (line_ptr[0] == line_ptr[1])
{
- /*
- * Repeated sequence...
- */
+ //
+ // Repeated sequence...
+ //
line_ptr ++;
count = 2;
}
else
{
- /*
- * Non-repeated sequence...
- */
+ //
+ // Non-repeated sequence...
+ //
start = line_ptr;
line_ptr ++;
break;
}
- /*
- * Position the print head...
- */
+ //
+ // Position the print head...
+ //
putchar(0x0d);
putchar(offset >> 8);
}
- /*
- * Send the graphics...
- */
+ //
+ // Send the graphics...
+ //
bytes = length / rows;
if (ppd->model_number & ESCP_RASTER_ESCI)
{
- /*
- * Send graphics with ESC i command.
- */
+ //
+ // Send graphics with ESC i command.
+ //
printf("\033i");
putchar(ctable[PrinterPlanes - 1][plane]);
}
else
{
- /*
- * Set the color if necessary...
- */
+ //
+ // Set the color if necessary...
+ //
if (PrinterPlanes > 1)
{
printf("\033r%c", plane);
}
- /*
- * Send graphics with ESC . command.
- */
+ //
+ // Send graphics with ESC . command.
+ //
bytes *= 8;
}
-/*
- * 'OutputBand()' - Output a band of graphics.
- */
+//
+// 'OutputBand()' - Output a band of graphics.
+//
void
-OutputBand(ppd_file_t *ppd, /* I - PPD file */
- cups_page_header2_t *header, /* I - Page header */
- cups_weave_t *band) /* I - Current band */
+OutputBand(ppd_file_t *ppd, // I - PPD file
+ cups_page_header2_t *header, // I - Page header
+ cups_weave_t *band) // I - Current band
{
- int xstep, /* Spacing between columns */
- ystep; /* Spacing between rows */
+ int xstep, // Spacing between columns
+ ystep; // Spacing between rows
- /*
- * Interleaved ESC/P2 graphics...
- */
+ //
+ // Interleaved ESC/P2 graphics...
+ //
OutputFeed = band->y - DotRowCurrent;
DotRowCurrent = band->y;
fprintf(stderr, "DEBUG: Printing band %p, x = %d, y = %d, plane = %d, count = %d, OutputFeed = %d\n",
(void*)band, band->x, band->y, band->plane, band->count, OutputFeed);
- /*
- * Compute step values...
- */
+ //
+ // Compute step values...
+ //
xstep = 3600 * DotColStep / header->HWResolution[0];
ystep = 3600 * DotRowStep / header->HWResolution[1];
- /*
- * Output the band...
- */
+ //
+ // Output the band...
+ //
if (OutputFeed > 0)
{
CompressData(ppd, band->buffer, band->count * DotBufferSize, band->plane,
header->cupsCompression, band->count, xstep, ystep, band->x);
- /*
- * Clear the band...
- */
+ //
+ // Clear the band...
+ //
memset(band->buffer, 0, band->count * DotBufferSize);
band->dirty = 0;
- /*
- * Flush the output buffers...
- */
+ //
+ // Flush the output buffers...
+ //
fflush(stdout);
}
-/*
- * 'ProcessLine()' - Read graphics from the page stream and output as needed.
- */
+//
+// 'ProcessLine()' - Read graphics from the page stream and output as needed.
+//
void
-ProcessLine(ppd_file_t *ppd, /* I - PPD file */
- cups_raster_t *ras, /* I - Raster stream */
- cups_page_header2_t *header, /* I - Page header */
- const int y) /* I - Current scanline */
+ProcessLine(ppd_file_t *ppd, // I - PPD file
+ cups_raster_t *ras, // I - Raster stream
+ cups_page_header2_t *header, // I - Page header
+ const int y) // I - Current scanline
{
- int plane, /* Current color plane */
- width, /* Width of line */
- subwidth, /* Width of interleaved row */
- subrow, /* Subrow for interleaved output */
- offset, /* Offset to current line */
- pass, /* Pass number */
- xstep, /* X step value */
- ystep; /* Y step value */
- cups_weave_t *band; /* Current band */
+ int plane, // Current color plane
+ width, // Width of line
+ subwidth, // Width of interleaved row
+ subrow, // Subrow for interleaved output
+ offset, // Offset to current line
+ pass, // Pass number
+ xstep, // X step value
+ ystep; // Y step value
+ cups_weave_t *band; // Current band
- /*
- * Read a row of graphics...
- */
+ //
+ // Read a row of graphics...
+ //
if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine))
return;
- /*
- * Perform the color separation...
- */
+ //
+ // Perform the color separation...
+ //
width = header->cupsWidth;
subwidth = header->cupsWidth / DotColStep;
break;
}
- /*
- * Dither the pixels...
- */
+ //
+ // Dither the pixels...
+ //
for (plane = 0; plane < PrinterPlanes; plane ++)
{
if (DotRowMax == 1)
{
- /*
- * Handle microweaved output...
- */
+ //
+ // Handle microweaved output...
+ //
if (cfCheckBytes(OutputBuffers[plane], width))
continue;
}
else
{
- /*
- * Handle softweaved output...
- */
+ //
+ // Handle softweaved output...
+ //
for (pass = 0, subrow = y % DotRowStep;
pass < DotColStep;
pass ++, subrow += DotRowStep)
{
- /*
- * See if we need to output the band...
- */
+ //
+ // See if we need to output the band...
+ //
band = DotBands[subrow][plane];
offset = band->row * DotBufferSize;
{
if (band->dirty)
{
- /*
- * Dirty band needs to be added to the used list...
- */
+ //
+ // Dirty band needs to be added to the used list...
+ //
AddBand(band);
- /*
- * Then find a new band...
- */
+ //
+ // Then find a new band...
+ //
if (DotAvailList == NULL)
{
}
else
{
- /*
- * This band isn't dirty, so reuse it...
- */
+ //
+ // This band isn't dirty, so reuse it...
+ //
fprintf(stderr, "DEBUG: Blank band %p, x = %d, y = %d, plane = %d, count = %d\n",
(void*)band, band->x, band->y, band->plane, band->count);
}
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
- int fd; /* File descriptor */
+ int fd; // File descriptor
int empty = 1;
- cups_raster_t *ras; /* Raster stream for printing */
- cups_page_header2_t header; /* Page header from file */
- int page; /* Current page */
- int y; /* Current line */
- ppd_file_t *ppd; /* PPD file */
- int num_options; /* Number of options */
- cups_option_t *options; /* Options */
+ cups_raster_t *ras; // Raster stream for printing
+ cups_page_header2_t header; // Page header from file
+ int page; // Current page
+ int y; // Current line
+ ppd_file_t *ppd; // PPD file
+ int num_options; // Number of options
+ cups_option_t *options; // Options
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Log function for the library functions, standard CUPS logging to stderr...
- */
+ //
+ // Log function for the library functions, standard CUPS logging to stderr...
+ //
logfunc = cfCUPSLogFunc;
ld = NULL;
- /*
- * Make sure status messages are not buffered...
- */
+ //
+ // Make sure status messages are not buffered...
+ //
setbuf(stderr, NULL);
- /*
- * Check command-line...
- */
+ //
+ // Check command-line...
+ //
if (argc < 6 || argc > 7)
{
num_options = cupsParseOptions(argv[5], 0, &options);
- /*
- * Open the PPD file...
- */
+ //
+ // Open the PPD file...
+ //
ppd = ppdOpenFile(getenv("PPD"));
if (!ppd)
{
- ppd_status_t status; /* PPD error */
- int linenum; /* Line number */
+ ppd_status_t status; // PPD error
+ int linenum; // Line number
fputs("ERROR: The PPD file could not be opened.\n", stderr);
ppdMarkDefaults(ppd);
ppdMarkOptions(ppd, num_options, options);
- /*
- * Open the page stream...
- */
+ //
+ // Open the page stream...
+ //
if (argc == 7)
{
ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
- /*
- * Register a signal handler to eject the current page if the
- * job is cancelled.
- */
+ //
+ // Register a signal handler to eject the current page if the
+ // job is cancelled.
+ //
Canceled = 0;
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, CancelJob);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, CancelJob);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Process pages as needed...
- */
+ //
+ // Process pages as needed...
+ //
page = 0;
while (cupsRasterReadHeader2(ras, &header))
{
- /*
- * Write a status message with the page number and number of copies.
- */
+ //
+ // Write a status message with the page number and number of copies.
+ //
if (empty)
{
- /*
- * Initialize the print device...
- */
+ //
+ // Initialize the print device...
+ //
+
Setup(ppd);
empty = 0;
}
for (y = 0; y < header.cupsHeight; y ++)
{
- /*
- * Let the user know how far we have progressed...
- */
+ //
+ // Let the user know how far we have progressed...
+ //
if (Canceled)
break;
100 * y / header.cupsHeight);
}
- /*
- * Read and write a line of graphics or whitespace...
- */
+ //
+ // Read and write a line of graphics or whitespace...
+ //
ProcessLine(ppd, ras, &header, y);
}
- /*
- * Eject the page...
- */
+ //
+ // Eject the page...
+ //
fprintf(stderr, "INFO: Finished page %d.\n", page);
}
return (page == 0);
}
-
-/*
- * Advanced HP Page Control Language and Raster Transfer Language
- * filter for CUPS.
- *
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2005 by Easy Software Products
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "COPYING"
- * which should have been included with this file.
- *
- * Contents:
- *
- * StartPage() - Start a page of graphics.
- * EndPage() - Finish a page of graphics.
- * Shutdown() - Shutdown a printer.
- * CancelJob() - Cancel the current job...
- * CompressData() - Compress a line of graphics.
- * OutputLine() - Output the specified number of lines of graphics.
- * ReadLine() - Read graphics from the page stream.
- * main() - Main entry and processing of driver.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Advanced HP Page Control Language and Raster Transfer Language
+// filter for cups-filters.
+//
+// Copyright 2007-2011 by Apple Inc.
+// Copyright 1993-2005 by Easy Software Products
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+// Contents:
+//
+// StartPage() - Start a page of graphics.
+// EndPage() - Finish a page of graphics.
+// Shutdown() - Shutdown a printer.
+// CancelJob() - Cancel the current job...
+// CompressData() - Compress a line of graphics.
+// OutputLine() - Output the specified number of lines of graphics.
+// ReadLine() - Read graphics from the page stream.
+// main() - Main entry and processing of driver.
+//
+
+//
+// Include necessary headers...
+//
#include "pcl-common.h"
#include <cupsfilters/colormanager.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Output modes...
- */
+//
+// Output modes...
+//
typedef enum
{
- OUTPUT_BITMAP, /* Output bitmap data from RIP */
- OUTPUT_INVERBIT, /* Output inverted bitmap data */
- OUTPUT_RGB, /* Output 24-bit RGB data from RIP */
- OUTPUT_DITHERED /* Output dithered data */
+ OUTPUT_BITMAP, // Output bitmap data from RIP
+ OUTPUT_INVERBIT, // Output inverted bitmap data
+ OUTPUT_RGB, // Output 24-bit RGB data from RIP
+ OUTPUT_DITHERED // Output dithered data
} pcl_output_t;
-/*
- * Globals...
- */
-
-cf_rgb_t *RGB; /* RGB color separation data */
-cf_cmyk_t *CMYK; /* CMYK color separation data */
-unsigned char *PixelBuffer, /* Pixel buffer */
- *CMYKBuffer, /* CMYK buffer */
- *OutputBuffers[6], /* Output buffers */
- *DotBuffers[6], /* Bit buffers */
- *CompBuffer, /* Compression buffer */
- *SeedBuffer, /* Mode 3 seed buffers */
- BlankValue; /* The blank value */
-short *InputBuffer; /* Color separation buffer */
-cf_lut_t *DitherLuts[6]; /* Lookup tables for dithering */
-cf_dither_t *DitherStates[6]; /* Dither state tables */
-int PrinterPlanes, /* Number of color planes */
- SeedInvalid, /* Contents of seed buffer invalid? */
- DotBits[6], /* Number of bits per color */
- DotBufferSizes[6], /* Size of one row of color dots */
- DotBufferSize, /* Size of complete line */
- OutputFeed, /* Number of lines to skip */
- Page; /* Current page number */
-pcl_output_t OutputMode; /* Output mode - see OUTPUT_ consts */
-const int ColorOrders[7][7] = /* Order of color planes */
+//
+// Globals...
+//
+
+cf_rgb_t *RGB; // RGB color separation data
+cf_cmyk_t *CMYK; // CMYK color separation data
+unsigned char *PixelBuffer, // Pixel buffer
+ *CMYKBuffer, // CMYK buffer
+ *OutputBuffers[6], // Output buffers
+ *DotBuffers[6], // Bit buffers
+ *CompBuffer, // Compression buffer
+ *SeedBuffer, // Mode 3 seed buffers
+ BlankValue; // The blank value
+short *InputBuffer; // Color separation buffer
+cf_lut_t *DitherLuts[6]; // Lookup tables for dithering
+cf_dither_t *DitherStates[6]; // Dither state tables
+int PrinterPlanes, // Number of color planes
+ SeedInvalid, // Contents of seed buffer invalid?
+ DotBits[6], // Number of bits per color
+ DotBufferSizes[6], // Size of one row of color dots
+ DotBufferSize, // Size of complete line
+ OutputFeed, // Number of lines to skip
+ Page; // Current page number
+pcl_output_t OutputMode; // Output mode - see OUTPUT_ consts
+const int ColorOrders[7][7] = // Order of color planes
{
- { 0, 0, 0, 0, 0, 0, 0 }, /* Black */
+ { 0, 0, 0, 0, 0, 0, 0 }, // Black
{ 0, 0, 0, 0, 0, 0, 0 },
- { 0, 1, 2, 0, 0, 0, 0 }, /* CMY */
- { 3, 0, 1, 2, 0, 0, 0 }, /* KCMY */
+ { 0, 1, 2, 0, 0, 0, 0 }, // CMY
+ { 3, 0, 1, 2, 0, 0, 0 }, // KCMY
{ 0, 0, 0, 0, 0, 0, 0 },
- { 5, 0, 1, 2, 3, 4, 0 }, /* KCMYcm */
- { 5, 0, 1, 2, 3, 4, 6 } /* KCMYcmk */
+ { 5, 0, 1, 2, 3, 4, 0 }, // KCMYcm
+ { 5, 0, 1, 2, 3, 4, 6 } // KCMYcmk
};
-int Canceled; /* Is the job canceled? */
-cf_logfunc_t logfunc; /* Log function */
-void *ld; /* Log function data */
+int Canceled; // Is the job canceled?
+cf_logfunc_t logfunc; // Log function
+void *ld; // Log function data
-/*
- * Prototypes...
- */
+//
+// Prototypes...
+//
void StartPage(cf_filter_data_t *data, ppd_file_t *ppd, cups_page_header2_t *header, int job_id,
const char *user, const char *title, int num_options,
int ReadLine(cups_raster_t *ras, cups_page_header2_t *header);
-/*
- * 'StartPage()' - Start a page of graphics.
- */
+//
+// 'StartPage()' - Start a page of graphics.
+//
void
-StartPage(cf_filter_data_t *data, /* I - filter data */
- ppd_file_t *ppd, /* I - PPD file */
- cups_page_header2_t *header, /* I - Page header */
- int job_id, /* I - Job ID */
- const char *user, /* I - User printing job */
- const char *title, /* I - Title of job */
+StartPage(cf_filter_data_t *data, // I - filter data
+ ppd_file_t *ppd, // I - PPD file
+ cups_page_header2_t *header, // I - Page header
+ int job_id, // I - Job ID
+ const char *user, // I - User printing job
+ const char *title, // I - Title of job
int num_options,
- /* I - Number of command-line options */
- cups_option_t *options) /* I - Command-line options */
+ // I - Number of command-line options
+ cups_option_t *options) // I - Command-line options
{
- int i; /* Temporary/looping var */
- int plane; /* Current plane */
- int cm_disabled; /* Device Color Inhibited */
- char s[255]; /* Temporary value */
- const char *colormodel; /* Color model string */
+ int i; // Temporary/looping var
+ int plane; // Current plane
+ int cm_disabled; // Device Color Inhibited
+ char s[255]; // Temporary value
+ const char *colormodel; // Color model string
char resolution[PPD_MAX_NAME],
- /* Resolution string */
- spec[PPD_MAX_NAME]; /* PPD attribute name */
- ppd_attr_t *attr; /* Attribute from PPD file */
- ppd_choice_t *choice; /* Selected option */
- const int *order; /* Order to use */
- int xorigin, /* X origin of page */
- yorigin; /* Y origin of page */
- static const float default_lut[2] = /* Default dithering lookup table */
+ // Resolution string
+ spec[PPD_MAX_NAME]; // PPD attribute name
+ ppd_attr_t *attr; // Attribute from PPD file
+ ppd_choice_t *choice; // Selected option
+ const int *order; // Order to use
+ int xorigin, // X origin of page
+ yorigin; // Y origin of page
+ static const float default_lut[2] = // Default dithering lookup table
{
0.0,
1.0
};
- cf_cm_calibration_t cm_calibrate; /* Color calibration mode */
+ cf_cm_calibration_t cm_calibrate; // Color calibration mode
- /*
- * Debug info...
- */
+ //
+ // Debug info...
+ //
fprintf(stderr, "DEBUG: StartPage...\n");
fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
#ifdef __APPLE__
- /*
- * MacOS X 10.2.x doesn't set most of the page device attributes, so check
- * the options and set them accordingly...
- */
+ //
+ // MacOS X 10.2.x doesn't set most of the page device attributes, so check
+ // the options and set them accordingly...
+ //
if (ppd && ppdIsMarked(ppd, "Duplex", "DuplexNoTumble"))
{
for (i = 0; i < num_options; i ++)
fprintf(stderr, "DEBUG: options[%d]=[\"%s\" \"%s\"]\n", i,
options[i].name, options[i].value);
-#endif /* __APPLE__ */
+#endif // __APPLE__
- /*
- * Figure out the color model and spec strings...
- */
+ //
+ // Figure out the color model and spec strings...
+ //
switch (header->cupsColorSpace)
{
if (!header->MediaType[0])
strcpy(header->MediaType, "PLAIN");
- /*
- * Get the dithering parameters...
- */
+ //
+ // Get the dithering parameters...
+ //
BlankValue = 0x00;
if (header->cupsBitsPerColor == 1)
{
- /*
- * Use raw bitmap mode...
- */
+ //
+ // Use raw bitmap mode...
+ //
switch (header->cupsColorSpace)
{
else if (header->cupsColorSpace == CUPS_CSPACE_RGB &&
(!ppd || (ppd->model_number & PCL_RASTER_RGB24)))
{
- /*
- * Use 24-bit RGB output mode...
- */
+ //
+ // Use 24-bit RGB output mode...
+ //
OutputMode = OUTPUT_RGB;
PrinterPlanes = 3;
(ppd && (ppd->model_number & PCL_RASTER_RGB24)) &&
header->cupsCompression == 10)
{
- /*
- * Use 24-bit RGB output mode for grayscale/black output...
- */
+ //
+ // Use 24-bit RGB output mode for grayscale/black output...
+ //
OutputMode = OUTPUT_RGB;
PrinterPlanes = 1;
}
else
{
- /*
- * Use dithered output mode...
- */
+ //
+ // Use dithered output mode...
+ //
OutputMode = OUTPUT_DITHERED;
- /*
- * Load the appropriate color profiles...
- */
+ //
+ // Load the appropriate color profiles...
+ //
RGB = NULL;
CMYK = NULL;
- fputs("DEBUG: Attempting to load color profiles using the following values:\n", stderr);
+ fputs("DEBUG: Attempting to load color profiles using the following values:\n",
+ stderr);
fprintf(stderr, "DEBUG: ColorModel = %s\n", colormodel);
fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType);
fprintf(stderr, "DEBUG: Resolution = %s\n", resolution);
- /* support the "cm-calibration" option */
+ // support the "cm-calibration" option
cm_calibrate = cfCmGetCupsColorCalibrateMode(data);
if (cm_calibrate == CF_CM_CALIBRATION_ENABLED)
PrinterPlanes = 3;
else
PrinterPlanes = 1;
- /*fputs("DEBUG: Loading default K separation.\n", stderr);*/
- fprintf(stderr, "DEBUG: Color Space: %d; Color Planes %d\n", header->cupsColorSpace, PrinterPlanes);
+ //fputs("DEBUG: Loading default K separation.\n", stderr);
+ fprintf(stderr, "DEBUG: Color Space: %d; Color Planes %d\n",
+ header->cupsColorSpace, PrinterPlanes);
CMYK = cfCMYKNew(PrinterPlanes);
}
PrinterPlanes = CMYK->num_channels;
- /*
- * Use dithered mode...
- */
+ //
+ // Use dithered mode...
+ //
switch (PrinterPlanes)
{
- case 1 : /* K */
+ case 1 : // K
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Black", logfunc, ld);
break;
- case 3 : /* CMY */
+ case 3 : // CMY
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Yellow", logfunc, ld);
break;
- case 4 : /* CMYK */
+ case 4 : // CMYK
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Black", logfunc, ld);
break;
- case 6 : /* CcMmYK */
+ case 6 : // CcMmYK
DitherLuts[0] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "Cyan", logfunc, ld);
DitherLuts[1] = ppdLutLoad(ppd, colormodel, header->MediaType,
fprintf(stderr, "DEBUG: PrinterPlanes = %d\n", PrinterPlanes);
- /*
- * Initialize the printer...
- */
+ //
+ // Initialize the printer...
+ //
if (ppd && ((attr = ppdFindAttr(ppd, "cupsInitialNulls", NULL)) != NULL))
for (i = atoi(attr->value); i > 0; i --)
{
pjl_escape();
- /*
- * PJL job setup...
- */
+ //
+ // PJL job setup...
+ //
pjl_set_job(job_id, user, title);
{
if (Page == 1)
{
- /*
- * HP-GL/2 initialization...
- */
+ //
+ // HP-GL/2 initialization...
+ //
printf("IN;");
printf("MG\"%d %s %s\";", job_id, user, title);
}
- /*
- * Set media size, position, type, etc...
- */
+ //
+ // Set media size, position, type, etc...
+ //
printf("BP5,0;");
printf("PS%.0f,%.0f;",
else
printf("EC0;");
- /*
- * Set graphics mode...
- */
+ //
+ // Set graphics mode...
+ //
pcl_set_pcl_mode(0);
pcl_set_negative_motion();
}
else
{
- /*
- * Set media size, position, type, etc...
- */
+ //
+ // Set media size, position, type, etc...
+ //
if (!header->Duplex || (Page & 1))
{
if (!ppd || ppdFindAttr(ppd, "cupsPJL", "Duplex") == NULL)
pcl_set_duplex(header->Duplex, header->Tumble);
- /*
- * Set the number of copies...
- */
+ //
+ // Set the number of copies...
+ //
if (!ppd || !ppd->manual_copies)
pcl_set_copies(header->NumCopies);
- /*
- * Set the output order/bin...
- */
+ //
+ // Set the output order/bin...
+ //
if ((!ppd || ppdFindAttr(ppd, "cupsPJL", "Jog") == NULL) && header->Jog)
printf("\033&l%dG", header->Jog);
}
else
{
- /*
- * Print on the back side...
- */
+ //
+ // Print on the back side...
+ //
printf("\033&a2G");
}
if (header->Duplex && (ppd && (ppd->model_number & PCL_RASTER_CRD)))
{
- /*
- * Reload the media...
- */
+ //
+ // Reload the media...
+ //
pcl_set_media_source(-2);
}
- /*
- * Set the units for cursor positioning and go to the top of the form.
- */
+ //
+ // Set the units for cursor positioning and go to the top of the form.
+ //
printf("\033&u%dD", header->HWResolution[0]);
printf("\033*p0Y\033*p0X");
header->MediaType, resolution, spec,
sizeof(spec), logfunc, ld)) != NULL))
{
- /*
- * Set the print quality...
- */
+ //
+ // Set the print quality...
+ //
if (ppd && (ppd->model_number & PCL_PJL_HPGL2))
printf("QM%d", atoi(attr->value));
printf("\033*o%dM", atoi(attr->value));
}
- /*
- * Enter graphics mode...
- */
+ //
+ // Enter graphics mode...
+ //
if (ppd && (ppd->model_number & PCL_RASTER_CRD))
{
- /*
- * Use configure raster data command...
- */
+ //
+ // Use configure raster data command...
+ //
if (OutputMode == OUTPUT_RGB)
{
- /*
- * Send 12-byte configure raster data command with horizontal and
- * vertical resolutions as well as a color count...
- */
+ //
+ // Send 12-byte configure raster data command with horizontal and
+ // vertical resolutions as well as a color count...
+ //
if (ppd && ((attr = ppdFindColorAttr(ppd, "cupsPCLCRDMode", colormodel,
header->MediaType, resolution, spec,
i = 31;
printf("\033*g12W");
- putchar(6); /* Format 6 */
- putchar(i); /* Set pen mode */
- putchar(0x00); /* Number components */
- putchar(0x01); /* (1 for RGB) */
+ putchar(6); // Format 6
+ putchar(i); // Set pen mode
+ putchar(0x00); // Number components
+ putchar(0x01); // (1 for RGB)
putchar(header->HWResolution[0] >> 8);
putchar(header->HWResolution[0]);
putchar(header->HWResolution[1] >> 8);
putchar(header->HWResolution[1]);
- putchar(header->cupsCompression); /* Compression mode 3 or 10 */
- putchar(0x01); /* Portrait orientation */
- putchar(0x20); /* Bits per pixel (32 = RGB) */
- putchar(0x01); /* Planes per pixel (1 = chunky RGB) */
+ putchar(header->cupsCompression); // Compression mode 3 or 10
+ putchar(0x01); // Portrait orientation
+ putchar(0x20); // Bits per pixel (32 = RGB)
+ putchar(0x01); // Planes per pixel (1 = chunky RGB)
}
else
{
- /*
- * Send the configure raster data command with horizontal and
- * vertical resolutions as well as a color count...
- */
+ //
+ // Send the configure raster data command with horizontal and
+ // vertical resolutions as well as a color count...
+ //
printf("\033*g%dW", PrinterPlanes * 6 + 2);
- putchar(2); /* Format 2 */
- putchar(PrinterPlanes); /* Output planes */
+ putchar(2); // Format 2
+ putchar(PrinterPlanes); // Output planes
order = ColorOrders[PrinterPlanes - 1];
else if ((!ppd || (ppd->model_number & PCL_RASTER_CID)) &&
OutputMode == OUTPUT_RGB)
{
- /*
- * Use configure image data command...
- */
+ //
+ // Use configure image data command...
+ //
pcl_set_simple_resolution(header->HWResolution[0]);
- /* Set output resolution */
+ // Set output resolution
cfWritePrintData("\033*v6W\2\3\0\10\10\10", 11);
- /* 24-bit sRGB */
+ // 24-bit sRGB
}
else
{
- /*
- * Use simple raster commands...
- */
+ //
+ // Use simple raster commands...
+ //
pcl_set_simple_resolution(header->HWResolution[0]);
- /* Set output resolution */
+ // Set output resolution
if (PrinterPlanes == 3)
pcl_set_simple_cmy();
OutputFeed = 0;
- /*
- * Allocate memory for the page...
- */
+ //
+ // Allocate memory for the page...
+ //
PixelBuffer = malloc(header->cupsBytesPerLine);
}
-/*
- * 'EndPage()' - Finish a page of graphics.
- */
+//
+// 'EndPage()' - Finish a page of graphics.
+//
void
-EndPage(ppd_file_t *ppd, /* I - PPD file */
- cups_page_header2_t *header) /* I - Page header */
+EndPage(ppd_file_t *ppd, // I - PPD file
+ cups_page_header2_t *header) // I - Page header
{
- int plane; /* Current plane */
+ int plane; // Current plane
- /*
- * End graphics mode...
- */
+ //
+ // End graphics mode...
+ //
if (ppd && (ppd->model_number & PCL_RASTER_END_COLOR))
- printf("\033*rC"); /* End color GFX */
+ printf("\033*rC"); // End color GFX
else
- printf("\033*r0B"); /* End B&W GFX */
+ printf("\033*r0B"); // End B&W GFX
- /*
- * Output a page eject sequence...
- */
+ //
+ // Output a page eject sequence...
+ //
if (ppd && (ppd->model_number & PCL_PJL_HPGL2))
{
- pcl_set_hpgl_mode(0); /* Back to HP-GL/2 mode */
- printf("PG;"); /* Eject the current page */
+ pcl_set_hpgl_mode(0); // Back to HP-GL/2 mode
+ printf("PG;"); // Eject the current page
}
else if (!(header->Duplex && (Page & 1)))
- printf("\014"); /* Eject current page */
+ printf("\014"); // Eject current page
- /*
- * Free memory for the page...
- */
+ //
+ // Free memory for the page...
+ //
free(PixelBuffer);
}
-/*
- * 'Shutdown()' - Shutdown a printer.
- */
+//
+// 'Shutdown()' - Shutdown a printer.
+//
void
-Shutdown(ppd_file_t *ppd, /* I - PPD file */
- int job_id, /* I - Job ID */
- const char *user, /* I - User printing job */
- const char *title, /* I - Title of job */
- int num_options,/* I - Number of command-line options */
- cups_option_t *options) /* I - Command-line options */
+Shutdown(ppd_file_t *ppd, // I - PPD file
+ int job_id, // I - Job ID
+ const char *user, // I - User printing job
+ const char *title, // I - Title of job
+ int num_options,// I - Number of command-line options
+ cups_option_t *options) // I - Command-line options
{
- ppd_attr_t *attr; /* Attribute from PPD file */
+ ppd_attr_t *attr; // Attribute from PPD file
if (ppd && ((attr = ppdFindAttr(ppd, "cupsPCL", "EndJob")) != NULL))
{
- /*
- * Tell the printer how many pages were in the job...
- */
+ //
+ // Tell the printer how many pages were in the job...
+ //
putchar(0x1b);
printf(attr->value, Page);
}
else
{
- /*
- * Return the printer to the default state...
- */
+ //
+ // Return the printer to the default state...
+ //
pcl_reset();
}
}
-/*
- * 'CancelJob()' - Cancel the current job...
- */
+//
+// 'CancelJob()' - Cancel the current job...
+//
void
-CancelJob(int sig) /* I - Signal */
+CancelJob(int sig) // I - Signal
{
(void)sig;
}
-/*
- * 'CompressData()' - Compress a line of graphics.
- */
+//
+// 'CompressData()' - Compress a line of graphics.
+//
void
-CompressData(unsigned char *line, /* I - Data to compress */
- int length, /* I - Number of bytes */
- int plane, /* I - Color plane */
- int pend, /* I - End character for data */
- int type) /* I - Type of compression */
+CompressData(unsigned char *line, // I - Data to compress
+ int length, // I - Number of bytes
+ int plane, // I - Color plane
+ int pend, // I - End character for data
+ int type) // I - Type of compression
{
- unsigned char *line_ptr, /* Current byte pointer */
- *line_end, /* End-of-line byte pointer */
- *comp_ptr, /* Pointer into compression buffer */
- *start, /* Start of compression sequence */
- *seed; /* Seed buffer pointer */
- int count, /* Count of bytes for output */
- offset, /* Offset of bytes for output */
- temp; /* Temporary count */
- int r, g, b; /* RGB deltas for mode 10 compression */
+ unsigned char *line_ptr, // Current byte pointer
+ *line_end, // End-of-line byte pointer
+ *comp_ptr, // Pointer into compression buffer
+ *start, // Start of compression sequence
+ *seed; // Seed buffer pointer
+ int count, // Count of bytes for output
+ offset, // Offset of bytes for output
+ temp; // Temporary count
+ int r, g, b; // RGB deltas for mode 10 compression
switch (type)
{
default :
- /*
- * Do no compression; with a mode-0 only printer, we can compress blank
- * lines...
- */
+ //
+ // Do no compression; with a mode-0 only printer, we can compress blank
+ // lines...
+ //
line_ptr = line;
if (cfCheckBytes(line, length))
- line_end = line; /* Blank line */
+ line_end = line; // Blank line
else
- line_end = line + length; /* Non-blank line */
+ line_end = line + length; // Non-blank line
break;
case 1 :
- /*
- * Do run-length encoding...
- */
+ //
+ // Do run-length encoding...
+ //
line_end = line + length;
for (line_ptr = line, comp_ptr = CompBuffer;
break;
case 2 :
- /*
- * Do TIFF pack-bits encoding...
- */
+ //
+ // Do TIFF pack-bits encoding...
+ //
line_ptr = line;
line_end = line + length;
{
if ((line_ptr + 1) >= line_end)
{
- /*
- * Single byte on the end...
- */
+ //
+ // Single byte on the end...
+ //
*comp_ptr++ = 0x00;
*comp_ptr++ = *line_ptr++;
}
else if (line_ptr[0] == line_ptr[1])
{
- /*
- * Repeated sequence...
- */
+ //
+ // Repeated sequence...
+ //
line_ptr ++;
count = 2;
}
else
{
- /*
- * Non-repeated sequence...
- */
+ //
+ // Non-repeated sequence...
+ //
start = line_ptr;
line_ptr ++;
break;
case 3 :
- /*
- * Do delta-row compression...
- */
+ //
+ // Do delta-row compression...
+ //
line_ptr = line;
line_end = line + length;
while (line_ptr < line_end)
{
- /*
- * Find the next non-matching sequence...
- */
+ //
+ // Find the next non-matching sequence...
+ //
start = line_ptr;
if (SeedInvalid)
{
- /*
- * The seed buffer is invalid, so do the next 8 bytes, max...
- */
+ //
+ // The seed buffer is invalid, so do the next 8 bytes, max...
+ //
offset = 0;
}
else
{
- /*
- * The seed buffer is valid, so compare against it...
- */
+ //
+ // The seed buffer is valid, so compare against it...
+ //
while (*line_ptr == *seed &&
line_ptr < line_end)
offset = line_ptr - start;
- /*
- * Find up to 8 non-matching bytes...
- */
+ //
+ // Find up to 8 non-matching bytes...
+ //
start = line_ptr;
count = 0;
}
}
- /*
- * Place mode 3 compression data in the buffer; see HP manuals
- * for details...
- */
+ //
+ // Place mode 3 compression data in the buffer; see HP manuals
+ // for details...
+ //
if (offset >= 31)
{
- /*
- * Output multi-byte offset...
- */
+ //
+ // Output multi-byte offset...
+ //
*comp_ptr++ = ((count - 1) << 5) | 31;
}
else
{
- /*
- * Output single-byte offset...
- */
+ //
+ // Output single-byte offset...
+ //
*comp_ptr++ = ((count - 1) << 5) | offset;
}
break;
case 10 :
- /*
- * Mode 10 "near lossless" RGB compression...
- */
+ //
+ // Mode 10 "near lossless" RGB compression...
+ //
line_ptr = line;
line_end = line + length;
if (PrinterPlanes == 1)
{
- /*
- * Do grayscale compression to RGB...
- */
+ //
+ // Do grayscale compression to RGB...
+ //
while (line_ptr < line_end)
{
- /*
- * Find the next non-matching sequence...
- */
+ //
+ // Find the next non-matching sequence...
+ //
start = line_ptr;
while (line_ptr < line_end &&
offset = line_ptr - start;
- /*
- * Find non-matching grayscale pixels...
- */
+ //
+ // Find non-matching grayscale pixels...
+ //
start = line_ptr;
while (line_ptr < line_end &&
count = line_ptr - start;
#if 0
- fprintf(stderr, "DEBUG: offset=%d, count=%d, comp_ptr=%p(%d of %d)...\n",
+ fprintf(stderr,
+ "DEBUG: offset=%d, count=%d, comp_ptr=%p(%d of %d)...\n",
offset, count, comp_ptr, comp_ptr - CompBuffer,
BytesPerLine * 5);
-#endif /* 0 */
-
- /*
- * Place mode 10 compression data in the buffer; each sequence
- * starts with a command byte that looks like:
- *
- * CMD SRC SRC OFF OFF CNT CNT CNT
- *
- * For the purpose of this driver, CMD and SRC are always 0.
- *
- * If the offset >= 3 then additional offset bytes follow the
- * first command byte, each byte == 255 until the last one.
- *
- * If the count >= 7, then additional count bytes follow each
- * group of pixels, each byte == 255 until the last one.
- *
- * The offset and count are in RGB tuples (not bytes, as for
- * Mode 3 and 9)...
- */
+#endif // 0
+
+ //
+ // Place mode 10 compression data in the buffer; each sequence
+ // starts with a command byte that looks like:
+ //
+ // CMD SRC SRC OFF OFF CNT CNT CNT
+ //
+ // For the purpose of this driver, CMD and SRC are always 0.
+ //
+ // If the offset >= 3 then additional offset bytes follow the
+ // first command byte, each byte == 255 until the last one.
+ //
+ // If the count >= 7, then additional count bytes follow each
+ // group of pixels, each byte == 255 until the last one.
+ //
+ // The offset and count are in RGB tuples (not bytes, as for
+ // Mode 3 and 9)...
+ //
if (offset >= 3)
{
- /*
- * Output multi-byte offset...
- */
+ //
+ // Output multi-byte offset...
+ //
if (count > 7)
*comp_ptr++ = 0x1f;
}
else
{
- /*
- * Output single-byte offset...
- */
+ //
+ // Output single-byte offset...
+ //
if (count > 7)
*comp_ptr++ = (offset << 3) | 0x07;
{
if (count <= temp)
{
- /*
- * This is exceedingly lame... The replacement counts
- * are intermingled with the data...
- */
+ //
+ // This is exceedingly lame... The replacement counts
+ // are intermingled with the data...
+ //
if (temp >= 255)
*comp_ptr++ = 255;
temp -= 255;
}
- /*
- * Get difference between current and see pixels...
- */
+ //
+ // Get difference between current and see pixels...
+ //
r = *start - *seed;
g = r;
if (r < -16 || r > 15 || g < -16 || g > 15 || b < -16 || b > 15)
{
- /*
- * Pack 24-bit RGB into 23 bits... Lame...
- */
+ //
+ // Pack 24-bit RGB into 23 bits... Lame...
+ //
g = *start;
}
else
{
- /*
- * Pack 15-bit RGB difference...
- */
+ //
+ // Pack 15-bit RGB difference...
+ //
*comp_ptr++ = 0x80 | ((r << 2) & 0x7c) | ((g >> 3) & 0x03);
*comp_ptr++ = ((g << 5) & 0xe0) | (b & 0x1f);
seed ++;
}
- /*
- * Make sure we have the ending count if the replacement count
- * was exactly 8 + 255n...
- */
+ //
+ // Make sure we have the ending count if the replacement count
+ // was exactly 8 + 255n...
+ //
if (temp == 0)
*comp_ptr++ = 0;
}
else
{
- /*
- * Do RGB compression...
- */
+ //
+ // Do RGB compression...
+ //
while (line_ptr < line_end)
{
- /*
- * Find the next non-matching sequence...
- */
+ //
+ // Find the next non-matching sequence...
+ //
start = line_ptr;
while (line_ptr[0] == seed[0] &&
offset = (line_ptr - start) / 3;
- /*
- * Find non-matching RGB tuples...
- */
+ //
+ // Find non-matching RGB tuples...
+ //
start = line_ptr;
while ((line_ptr[0] != seed[0] ||
count = (line_ptr - start) / 3;
- /*
- * Place mode 10 compression data in the buffer; each sequence
- * starts with a command byte that looks like:
- *
- * CMD SRC SRC OFF OFF CNT CNT CNT
- *
- * For the purpose of this driver, CMD and SRC are always 0.
- *
- * If the offset >= 3 then additional offset bytes follow the
- * first command byte, each byte == 255 until the last one.
- *
- * If the count >= 7, then additional count bytes follow each
- * group of pixels, each byte == 255 until the last one.
- *
- * The offset and count are in RGB tuples (not bytes, as for
- * Mode 3 and 9)...
- */
+ //
+ // Place mode 10 compression data in the buffer; each sequence
+ // starts with a command byte that looks like:
+ //
+ // CMD SRC SRC OFF OFF CNT CNT CNT
+ //
+ // For the purpose of this driver, CMD and SRC are always 0.
+ //
+ // If the offset >= 3 then additional offset bytes follow the
+ // first command byte, each byte == 255 until the last one.
+ //
+ // If the count >= 7, then additional count bytes follow each
+ // group of pixels, each byte == 255 until the last one.
+ //
+ // The offset and count are in RGB tuples (not bytes, as for
+ // Mode 3 and 9)...
+ //
if (offset >= 3)
{
- /*
- * Output multi-byte offset...
- */
+ //
+ // Output multi-byte offset...
+ //
if (count > 7)
*comp_ptr++ = 0x1f;
}
else
{
- /*
- * Output single-byte offset...
- */
+ //
+ // Output single-byte offset...
+ //
if (count > 7)
*comp_ptr++ = (offset << 3) | 0x07;
{
if (count <= temp)
{
- /*
- * This is exceedingly lame... The replacement counts
- * are intermingled with the data...
- */
+ //
+ // This is exceedingly lame... The replacement counts
+ // are intermingled with the data...
+ //
if (temp >= 255)
*comp_ptr++ = 255;
temp -= 255;
}
- /*
- * Get difference between current and see pixels...
- */
+ //
+ // Get difference between current and see pixels...
+ //
r = start[0] - seed[0];
g = start[1] - seed[1];
if (r < -16 || r > 15 || g < -16 || g > 15 || b < -16 || b > 15)
{
- /*
- * Pack 24-bit RGB into 23 bits... Lame...
- */
+ //
+ // Pack 24-bit RGB into 23 bits... Lame...
+ //
*comp_ptr++ = start[0] >> 1;
}
else
{
- /*
- * Pack 15-bit RGB difference...
- */
+ //
+ // Pack 15-bit RGB difference...
+ //
*comp_ptr++ = 0x80 | ((r << 2) & 0x7c) | ((g >> 3) & 0x03);
*comp_ptr++ = ((g << 5) & 0xe0) | (b & 0x1f);
seed += 3;
}
- /*
- * Make sure we have the ending count if the replacement count
- * was exactly 8 + 255n...
- */
+ //
+ // Make sure we have the ending count if the replacement count
+ // was exactly 8 + 255n...
+ //
if (temp == 0)
*comp_ptr++ = 0;
break;
}
- /*
- * Set the length of the data and write a raster plane...
- */
+ //
+ // Set the length of the data and write a raster plane...
+ //
printf("\033*b%d%c", (int)(line_end - line_ptr), pend);
cfWritePrintData(line_ptr, line_end - line_ptr);
}
-/*
- * 'OutputLine()' - Output the specified number of lines of graphics.
- */
+//
+// 'OutputLine()' - Output the specified number of lines of graphics.
+//
void
-OutputLine(ppd_file_t *ppd, /* I - PPD file */
- cups_page_header2_t *header) /* I - Page header */
+OutputLine(ppd_file_t *ppd, // I - PPD file
+ cups_page_header2_t *header) // I - Page header
{
- int i, j; /* Looping vars */
- int plane; /* Current plane */
- unsigned char bit; /* Current bit */
- int bytes; /* Number of bytes/plane */
- int width; /* Width of line in pixels */
- const int *order; /* Order to use */
- unsigned char *ptr; /* Pointer into buffer */
+ int i, j; // Looping vars
+ int plane; // Current plane
+ unsigned char bit; // Current bit
+ int bytes; // Number of bytes/plane
+ int width; // Width of line in pixels
+ const int *order; // Order to use
+ unsigned char *ptr; // Pointer into buffer
- /*
- * Output whitespace as needed...
- */
+ //
+ // Output whitespace as needed...
+ //
if (OutputFeed > 0)
{
if (header->cupsCompression < 3)
{
- /*
- * Send blank raster lines...
- */
+ //
+ // Send blank raster lines...
+ //
while (OutputFeed > 0)
{
}
else
{
- /*
- * Send Y offset command and invalidate the seed buffer...
- */
+ //
+ // Send Y offset command and invalidate the seed buffer...
+ //
printf("\033*b%dY", OutputFeed);
OutputFeed = 0;
}
}
- /*
- * Write bitmap data as needed...
- */
+ //
+ // Write bitmap data as needed...
+ //
switch (OutputMode)
{
- case OUTPUT_BITMAP : /* Send 1-bit bitmap data... */
+ case OUTPUT_BITMAP : // Send 1-bit bitmap data...
order = ColorOrders[PrinterPlanes - 1];
bytes = header->cupsBytesPerLine / PrinterPlanes;
}
break;
- case OUTPUT_INVERBIT : /* Send inverted 1-bit bitmap data... */
+ case OUTPUT_INVERBIT : // Send inverted 1-bit bitmap data...
order = ColorOrders[PrinterPlanes - 1];
bytes = header->cupsBytesPerLine / PrinterPlanes;
}
break;
- case OUTPUT_RGB : /* Send 24-bit RGB data... */
+ case OUTPUT_RGB : // Send 24-bit RGB data...
if (PrinterPlanes == 1 && !BlankValue)
{
- /*
- * Invert black to grayscale...
- */
+ //
+ // Invert black to grayscale...
+ //
for (i = header->cupsBytesPerLine, ptr = PixelBuffer;
i > 0;
*ptr = ~*ptr;
}
- /*
- * Compress the output...
- */
+ //
+ // Compress the output...
+ //
CompressData(PixelBuffer, header->cupsBytesPerLine, 0, 'W',
header->cupsCompression);
break;
}
- /*
- * The seed buffer, if any, now should contain valid data...
- */
+ //
+ // The seed buffer, if any, now should contain valid data...
+ //
SeedInvalid = 0;
}
-/*
- * 'ReadLine()' - Read graphics from the page stream.
- */
+//
+// 'ReadLine()' - Read graphics from the page stream.
+//
-int /* O - Number of lines (0 if blank) */
-ReadLine(cups_raster_t *ras, /* I - Raster stream */
- cups_page_header2_t *header) /* I - Page header */
+int // O - Number of lines (0 if blank)
+ReadLine(cups_raster_t *ras, // I - Raster stream
+ cups_page_header2_t *header) // I - Page header
{
- int plane, /* Current color plane */
- width; /* Width of line */
+ int plane, // Current color plane
+ width; // Width of line
- /*
- * Read raster data...
- */
+ //
+ // Read raster data...
+ //
cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine);
- /*
- * See if it is blank; if so, return right away...
- */
+ //
+ // See if it is blank; if so, return right away...
+ //
if (cfCheckValue(PixelBuffer, header->cupsBytesPerLine, BlankValue))
return (0);
- /*
- * If we aren't dithering, return immediately...
- */
+ //
+ // If we aren't dithering, return immediately...
+ //
if (OutputMode != OUTPUT_DITHERED)
return (1);
- /*
- * Perform the color separation...
- */
+ //
+ // Perform the color separation...
+ //
width = header->cupsWidth;
break;
}
- /*
- * Dither the pixels...
- */
+ //
+ // Dither the pixels...
+ //
for (plane = 0; plane < PrinterPlanes; plane ++)
cfDitherLine(DitherStates[plane], DitherLuts[plane], InputBuffer + plane,
PrinterPlanes, OutputBuffers[plane]);
- /*
- * Return 1 to indicate that we have non-blank output...
- */
+ //
+ // Return 1 to indicate that we have non-blank output...
+ //
return (1);
}
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
- int fd; /* File descriptor */
+ int fd; // File descriptor
int empty = 1;
- cups_raster_t *ras; /* Raster stream for printing */
- cups_page_header2_t header; /* Page header from file */
- int y; /* Current line */
- ppd_file_t *ppd; /* PPD file */
- int job_id; /* Job ID */
- int num_options; /* Number of options */
- cups_option_t *options; /* Options */
+ cups_raster_t *ras; // Raster stream for printing
+ cups_page_header2_t header; // Page header from file
+ int y; // Current line
+ ppd_file_t *ppd; // PPD file
+ int job_id; // Job ID
+ int num_options; // Number of options
+ cups_option_t *options; // Options
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Log function for the library functions, standard CUPS logging to stderr...
- */
+ //
+ // Log function for the library functions, standard CUPS logging to stderr...
+ //
logfunc = cfCUPSLogFunc;
ld = NULL;
- /*
- * Make sure status messages are not buffered...
- */
+ //
+ // Make sure status messages are not buffered...
+ //
setbuf(stderr, NULL);
- /*
- * Check command-line...
- */
+ //
+ // Check command-line...
+ //
+
cf_filter_data_t temp;
cf_filter_data_t *data = &temp;
data->printer = getenv("PRINTER");
num_options = cupsParseOptions(argv[5], 0, &options);
- /*
- * Open the PPD file...
- */
+ //
+ // Open the PPD file...
+ //
ppd = ppdOpenFile(getenv("PPD"));
}
else
{
- ppd_status_t status; /* PPD error */
- int linenum; /* Line number */
+ ppd_status_t status; // PPD error
+ int linenum; // Line number
fputs("DEBUG: The PPD file could not be opened.\n", stderr);
fprintf(stderr, "DEBUG: %s on line %d.\n", ppdErrorString(status), linenum);
}
- /*
- * Open the page stream...
- */
+ //
+ // Open the page stream...
+ //
if (argc == 7)
{
ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
- /*
- * Register a signal handler to eject the current page if the
- * job is cancelled.
- */
+ //
+ // Register a signal handler to eject the current page if the
+ // job is cancelled.
+ //
Canceled = 0;
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, CancelJob);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, CancelJob);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Process pages as needed...
- */
+ //
+ // Process pages as needed...
+ //
job_id = atoi(argv[1]);
while (cupsRasterReadHeader2(ras, &header))
{
- /*
- * Write a status message with the page number and number of copies.
- */
+ //
+ // Write a status message with the page number and number of copies.
+ //
if (empty)
empty = 0;
for (y = 0; y < (int)header.cupsHeight; y ++)
{
- /*
- * Let the user know how far we have progressed...
- */
+ //
+ // Let the user know how far we have progressed...
+ //
if (Canceled)
break;
100 * y / header.cupsHeight);
}
- /*
- * Read and write a line of graphics or whitespace...
- */
+ //
+ // Read and write a line of graphics or whitespace...
+ //
if (ReadLine(ras, &header))
OutputLine(ppd, &header);
OutputFeed ++;
}
- /*
- * Eject the page...
- */
+ //
+ // Eject the page...
+ //
fprintf(stderr, "INFO: Finished page %d.\n", Page);
}
return (Page == 0);
}
-
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * @brief Convert PWG Raster to a PostScript file
- * @file rastertops.c
- * @author Pranjal Bhor <bhor.pranjal@gmail.com> (C) 2016
- * @author Neil 'Superna' Armstrong <superna9999@gmail.com> (C) 2010
- * @author Tobias Hoffmann <smilingthax@gmail.com> (c) 2012
- * @author Till Kamppeter <till.kamppeter@gmail.com> (c) 2014
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for ppdFilterRasterToPS() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the cfFilterRasterToPS() filter function
- */
+ //
+ // Fire up the ppdFilterRasterToPS() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, ppdFilterRasterToPS, NULL,
&JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterRasterToPWG() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- /*
- * Fire up the ppdFilterRasterToPWG() filter function
- */
+ //
+ // Fire up the cfFilterRasterToPWG() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, cfFilterRasterToPWG, NULL, &JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
+//
+// Legacy CUPS filter wrapper for cfFilterExternal() and
+// ppdFilterExternalCUPS() for cups-filters.
+//
+// Primarily for testing and debugging. CUPS filters which can be called
+// by these filter functions can also be called directly instead of this
+// wrapper.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
//
// Include necessary headers...
//
#include <signal.h>
#include <config.h>
+
//
// Local globals...
//
static void cancel_job(int sig);
+
//
-// 'main()' - Main entry and processing of driver.
+// 'main()' - Main entry.
//
int // O - Exit status
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterTextToPDF() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <fontconfig/fontconfig.h>
#include <config.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+//
+// 'main()' - Main entry and processing of driver.
+//
+
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
-
- /*
- * Fire up the ppdFilterTextToPDF() filter function
- */
- cf_filter_texttopdf_parameter_t parameters;
- char *p;
-
- if ((p = getenv("CUPS_DATADIR")) != NULL)
- parameters.data_dir = p;
- else
- parameters.data_dir = CUPS_DATADIR;
- if ((p = getenv("CHARSET")) != NULL)
- parameters.char_set = p;
- else
- parameters.char_set = NULL;
- if ((p = getenv("CONTENT_TYPE")) != NULL)
- parameters.content_type = p;
- else
- parameters.content_type = NULL;
- if ((p = getenv("CLASSIFICATION")) != NULL)
- parameters.classification = p;
- else
- parameters.classification = NULL;
-
- ret = ppdFilterCUPSWrapper(argc, argv, cfFilterTextToPDF, ¶meters, &JobCanceled);
+#endif // HAVE_SIGSET
+
+ //
+ // Fire up the cfFilterTextToPDF() filter function
+ //
+
+ cf_filter_texttopdf_parameter_t parameters;
+ char *p;
+
+ if ((p = getenv("CUPS_DATADIR")) != NULL)
+ parameters.data_dir = p;
+ else
+ parameters.data_dir = CUPS_DATADIR;
+ if ((p = getenv("CHARSET")) != NULL)
+ parameters.char_set = p;
+ else
+ parameters.char_set = NULL;
+ if ((p = getenv("CONTENT_TYPE")) != NULL)
+ parameters.content_type = p;
+ else
+ parameters.content_type = NULL;
+ if ((p = getenv("CLASSIFICATION")) != NULL)
+ parameters.classification = p;
+ else
+ parameters.classification = NULL;
+
+ ret = ppdFilterCUPSWrapper(argc, argv, cfFilterTextToPDF, ¶meters,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: texttopdf filter function failed.\n");
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
#!/bin/sh
-# texttops - This is a Text-to-PostScript filter for CUPS
+# texttops - This is a Text-to-PostScript filter for cups-filters
#
# Note: This wrapper filter is only included for backward compatibility with
# certan custom configurations. It is not mentioned in any of the .convs
#
# DO NOT create new PPD or .convs files using this filter! texttops is
# DEPRECATED!
-
+#
# (C) 2012 Till Kamppeter <till.kamppeter@gmail.com>
#
-# Released under GPL 2 or later
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
PDF2PS=`which pdf2ps`
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterTextToText() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+//
+// Local globals...
+//
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry and processing of driver.
- */
+//
+// 'main()' - Main entry and processing of driver.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line arguments
+ char *argv[]) // I - Command-line arguments
{
int ret;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
-
- /*
- * Fire up the ppdFilterTextToText() filter function
- */
+#endif // HAVE_SIGSET
+ //
+ // Fire up the cfFilterTextToText() filter function
+ //
ret = ppdFilterCUPSWrapper(argc, argv, cfFilterTextToText, NULL,
&JobCanceled);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
-/*
- * Include necessary headers...
- */
+//
+// Legacy CUPS filter wrapper for cfFilterUniversal() for cups-filters.
+//
+// Copyright © 2020-2022 by OpenPrinting.
+//
+// Licensed under Apache License v2.0. See the file "LICENSE" for more
+// information.
+//
+
+//
+// Include necessary headers...
+//
#include <cupsfilters/filter.h>
#include <ppd/ppd-filter.h>
#include <signal.h>
-/*
- * Local globals...
- */
+//
+// Local globals...
+//
-static int JobCanceled = 0;/* Set to 1 on SIGTERM */
+static int JobCanceled = 0; // Set to 1 on SIGTERM
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
static void cancel_job(int sig);
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
-int /* O - Exit status */
-main(int argc, /* I - Number of command-line args */
- char *argv[]) /* I - Command-line arguments */
+int // O - Exit status
+main(int argc, // I - Number of command-line args
+ char *argv[]) // I - Command-line arguments
{
int ret;
char *p;
char buf[1024];
const char *datadir;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+ struct sigaction action; // Actions for POSIX signals
+#endif // HAVE_SIGACTION && !HAVE_SIGSET
- /*
- * Register a signal handler to cleanly cancel a job.
- */
+ //
+ // Register a signal handler to cleanly cancel a job.
+ //
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+#ifdef HAVE_SIGSET // Use System V signals over POSIX to avoid bugs
sigset(SIGTERM, cancel_job);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigaction(SIGTERM, &action, NULL);
#else
signal(SIGTERM, cancel_job);
-#endif /* HAVE_SIGSET */
+#endif // HAVE_SIGSET
- universal_parameters.actual_output_type = NULL; /* Determined by PPD file */
+ universal_parameters.actual_output_type = NULL; // Determined by PPD file
if ((p = getenv("CUPS_DATADIR")) != NULL)
universal_parameters.texttopdf_params.data_dir = strdup(p);
}
-/*
- * 'cancel_job()' - Flag the job as canceled.
- */
+//
+// 'cancel_job()' - Flag the job as canceled.
+//
static void
-cancel_job(int sig) /* I - Signal number (unused) */
+cancel_job(int sig) // I - Signal number (unused)
{
(void)sig;
JobCanceled = 1;
}
-