Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kam-printing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wizards
kam-printing
Commits
21117981
Commit
21117981
authored
9 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Finishings (WIP)
parent
4b4c226d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
xcpt.c
+29
-7
29 additions, 7 deletions
xcpt.c
with
29 additions
and
7 deletions
xcpt.c
+
29
−
7
View file @
21117981
...
@@ -89,7 +89,10 @@ static char *xstrdup(const char *x)
...
@@ -89,7 +89,10 @@ static char *xstrdup(const char *x)
O(TRAYFEED, "stack") \
O(TRAYFEED, "stack") \
O(MEDIATYPE, "system-default") \
O(MEDIATYPE, "system-default") \
O(MEDIAXSIZE, "21000") \
O(MEDIAXSIZE, "21000") \
O(MEDIAYSIZE, "29700")
O(MEDIAYSIZE, "29700") \
O(FINISH_STAPLE, "") \
O(FINISH_PUNCH, "") \
O(FINISH_FOLD, "")
enum
option
{
enum
option
{
#define O(name, val) OPT_##name,
#define O(name, val) OPT_##name,
...
@@ -111,6 +114,7 @@ char *opt[] = {
...
@@ -111,6 +114,7 @@ char *opt[] = {
};
};
#define OPT(name) opt[OPT_##name]
#define OPT(name) opt[OPT_##name]
#define OPT_INT(name) atoi(opt[OPT_##name])
#define OPT_IS(name, val) !strcasecmp(OPT(name), val)
#define OPT_IS(name, val) !strcasecmp(OPT(name), val)
#define OPT_IS_SET(name) *OPT(name)
#define OPT_IS_SET(name) *OPT(name)
#define OPT_IS_TRUE(name) OPT_IS(name, "yes")
#define OPT_IS_TRUE(name) OPT_IS(name, "yes")
...
@@ -160,9 +164,9 @@ static char *get_token(char **pp)
...
@@ -160,9 +164,9 @@ static char *get_token(char **pp)
if
(
!*
p
)
if
(
!*
p
)
return
NULL
;
return
NULL
;
int
c
=
my_toupper
(
*
p
);
int
c
=
my_toupper
(
*
p
);
if
(
c
>=
'A'
&&
c
<=
'Z'
||
c
>=
'0'
&&
c
<=
'9'
)
if
(
c
>=
'A'
&&
c
<=
'Z'
||
c
>=
'0'
&&
c
<=
'9'
||
c
==
'_'
)
{
{
while
(
c
>=
'A'
&&
c
<=
'Z'
||
c
>=
'0'
&&
c
<=
'9'
)
while
(
c
>=
'A'
&&
c
<=
'Z'
||
c
>=
'0'
&&
c
<=
'9'
||
c
==
'_'
)
{
{
*
tok
++
=
c
;
*
tok
++
=
c
;
c
=
my_toupper
(
*++
p
);
c
=
my_toupper
(
*++
p
);
...
@@ -367,6 +371,16 @@ static void xcpt_name(const char *name, const char *text)
...
@@ -367,6 +371,16 @@ static void xcpt_name(const char *name, const char *text)
printf
(
"</%s>
\n
"
,
name
);
printf
(
"</%s>
\n
"
,
name
);
}
}
static
void
gen_finishings
(
const
char
*
opt
)
{
int
fin
,
n
;
while
(
sscanf
(
opt
,
"%d%n"
,
&
fin
,
&
n
)
>
0
)
{
xcpt_enum
(
"value"
,
fin
);
opt
+=
n
;
}
}
static
void
gen_job_template
(
void
)
static
void
gen_job_template
(
void
)
{
{
// Color adjustments
// Color adjustments
...
@@ -387,7 +401,7 @@ static void gen_job_template(void)
...
@@ -387,7 +401,7 @@ static void gen_job_template(void)
xcpt_keyword
(
"color-effects-type"
,
"monochrome-grayscale"
);
xcpt_keyword
(
"color-effects-type"
,
"monochrome-grayscale"
);
}
}
xcpt_integer
(
"copies"
,
atoi
(
OP
T
(
COPIES
))
)
;
xcpt_integer
(
"copies"
,
OPT_IN
T
(
COPIES
));
if
(
OPT_IS_SET
(
ORIENTATION
))
if
(
OPT_IS_SET
(
ORIENTATION
))
xcpt_keyword
(
"document-reading-orientation"
,
OPT
(
ORIENTATION
));
xcpt_keyword
(
"document-reading-orientation"
,
OPT
(
ORIENTATION
));
...
@@ -407,6 +421,14 @@ static void gen_job_template(void)
...
@@ -407,6 +421,14 @@ static void gen_job_template(void)
* 1004 = single-fold outside
* 1004 = single-fold outside
*/
*/
xcpt_set_open
(
"finishings"
);
xcpt_set_open
(
"finishings"
);
if
(
OPT_IS_SET
(
FINISH_FOLD
))
gen_finishings
(
OPT
(
FINISH_FOLD
));
else
if
(
OPT_IS_SET
(
FINISH_STAPLE
)
||
OPT_IS_SET
(
FINISH_PUNCH
))
{
gen_finishings
(
OPT
(
FINISH_STAPLE
));
gen_finishings
(
OPT
(
FINISH_PUNCH
));
}
else
xcpt_enum
(
"value"
,
3
);
xcpt_enum
(
"value"
,
3
);
xcpt_close
();
xcpt_close
();
...
@@ -442,8 +464,8 @@ static void gen_job_template(void)
...
@@ -442,8 +464,8 @@ static void gen_job_template(void)
xcpt_keyword
(
"tray-feed"
,
OPT
(
TRAYFEED
));
xcpt_keyword
(
"tray-feed"
,
OPT
(
TRAYFEED
));
xcpt_keyword
(
"media-color"
,
OPT
(
MEDIACOLOR
));
xcpt_keyword
(
"media-color"
,
OPT
(
MEDIACOLOR
));
xcpt_collection_open
(
"media-size"
);
xcpt_collection_open
(
"media-size"
);
xcpt_integer
(
"x-dimension"
,
atoi
(
OP
T
(
MEDIAXSIZE
))
)
;
xcpt_integer
(
"x-dimension"
,
OPT_IN
T
(
MEDIAXSIZE
));
xcpt_integer
(
"y-dimension"
,
atoi
(
OP
T
(
MEDIAYSIZE
))
)
;
xcpt_integer
(
"y-dimension"
,
OPT_IN
T
(
MEDIAYSIZE
));
xcpt_close
();
xcpt_close
();
xcpt_keyword
(
"media-type"
,
OPT
(
MEDIATYPE
));
xcpt_keyword
(
"media-type"
,
OPT
(
MEDIATYPE
));
xcpt_close
();
xcpt_close
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment