Skip to content

Commit

Permalink
Merge pull request #128 from HPInc/addressXmlChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
HPSudip authored Oct 1, 2022
2 parents 5f1592b + b12bf92 commit 9b78b17
Show file tree
Hide file tree
Showing 187 changed files with 504 additions and 279 deletions.
51 changes: 43 additions & 8 deletions jipp-core/bin/genTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
'printer-icc-profiles': 'jobAttributes',
}

special_ref_logic = ('media-col-database', 'media-col-ready')


def pretty(o):
return pp.pformat(o).replace('\n', '\n ')

Expand Down Expand Up @@ -328,9 +331,12 @@ def assign_ref(ref, target):

ignored_attributes = [
# XML Fix (obsolete or maybe just deprecated)
'document-format-details-supported',
'document-format-details-supported'
]

# list of members that are obsolete or deprecated in one attribute but used in other
suffix_ignore_list = ['compression', 'ipp-attribute-fidelity']

# Parse a single attribute record
def parse_attribute(record):
attr_name = record.find('{*}name').text
Expand All @@ -343,11 +349,18 @@ def parse_attribute(record):
collection = attributes.setdefault(collection_name, { })

# Ignore (UnderReview) (Deprecated) etc
if re.search("\(.*\)", attr_name):
suffix = re.search("\(([A-Z a-z]+)\)", attr_name)
if suffix:
attr_name = re.sub(' *\(.*\)', '', attr_name)
if attr_name in collection:
del collection[attr_name]
return

# Do not delete attributes with extension suffix
if not (suffix.group(1) == 'extension'):
if attr_name in collection:
del collection[attr_name]
return
elif attr_name not in suffix_ignore_list:
ignored_attributes.append(attr_name)


if attr_name in ignored_attributes:
return
Expand Down Expand Up @@ -405,6 +418,10 @@ def parse_attribute(record):
fix_syntax(attr)

if submember_name is not None:
if submember_name.endswith('(extension)'):
# Chop off (extension) and use it to replace former member syntax
submember_name = submember_name[:-len('(extension)')]

if submember_name.startswith('<'):
if not assign_ref(submember_name, attr):
warn("Unparseable '" + attr_name + "' member '" + member_name + "'" +
Expand Down Expand Up @@ -761,12 +778,24 @@ def emit_attributes(env):
referent = attributes[type['ref_group']][type['ref_col']]
# Push members over to referent
for new_member in list(type['members'].values()):
if new_member['name'] in referent['members'] and \
if type['name'] not in special_ref_logic and new_member['name'] in referent['members'] and \
referent['members'][new_member['name']] != new_member:
warn("Collection type already has different member " + new_member['name'], referent)

# add member attributes of media-col to media-col-database due to [PWG5100.7]
if type['name'] == 'media-col-database':
for k, v in referent['members'].items():
type['members'][k] = v
type['members']['media-size'] = copy.deepcopy(type['members']['media-size'])
type['members']['media-size']['members']['x-dimension']['syntax'] = 'integer(1:MAX) | rangeOfInteger(1:MAX)'
type['members']['media-size']['members']['y-dimension']['syntax'] = 'integer(1:MAX) | rangeOfInteger(1:MAX)'
type['ref_col'] = type['name']
elif type['name'] == 'media-col-ready':
type['ref_col'] = 'media-col-database'
type['members'] = {}
else:
referent['members'][new_member['name']] = new_member
type['members'] = { }
type['members'] = {}

# Pass 2: Emit collection types having members
for group in list(attributes.values()):
Expand Down Expand Up @@ -796,7 +825,13 @@ def emit_attributes(env):
old_type = types[name]
if type['syntax'] == 'collection' and old_type['name'] == type['name']:
old_type['specs'] = sorted(set(old_type['specs'] + type['specs']))
type = None
if old_type.get('set') != type.get('set'):
warn("Difference is syntax detected for '%s'" % name)

if type['name'] == 'finishings-col':
type['specs'] = sorted(set(old_type['specs'] + type['specs']))
else:
type = None
elif set([type['syntax'], old_type['syntax']]) == set(['name', 'keyword | name']):
old_type['specs'] = sorted(set(old_type['specs'] + type['specs']))
old_type['syntax'] = 'keyword | name'
Expand Down
9 changes: 9 additions & 0 deletions jipp-core/src/main/java/com/hp/jipp/encoding/MediaSizes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.hp.jipp.encoding

import com.hp.jipp.model.MediaCol
import com.hp.jipp.model.MediaColDatabase
import java.util.regex.Pattern

object MediaSizes {
Expand Down Expand Up @@ -38,4 +39,12 @@ object MediaSizes {
val y = (matches.group(HEIGHT_AT).toDouble() * units).toInt()
return MediaCol.MediaSize(x, y)
}

/** Convert a [MediaCol.MediaSize] object to [MediaColDatabase.MediaSize] object. */
@JvmStatic
fun MediaCol.MediaSize?.toMediaColDatabaseMediaSize(): MediaColDatabase.MediaSize? {
return this?.let {
MediaColDatabase.MediaSize(IntOrIntRange(xDimension!!), IntOrIntRange(yDimension!!))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/BalingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/BalingWhen.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/BindingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
3 changes: 2 additions & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/CoatingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand All @@ -26,4 +26,5 @@ public class CoatingType {
public static final String semiGloss = "semi-gloss";
public static final String silicone = "silicone";
public static final String translucent = "translucent";
public static final String waterResistant = "water-resistant";
}
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/Compression.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/CoverBack.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/CoverFront.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/CoverType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/DocumentState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand All @@ -11,6 +11,7 @@
/**
* Values applicable for "document-state-reasons" keywords.
*
* @see <a href="https://ftp.pwg.org/pub/pwg/ipp/registrations/reg-ippdepuri10-20211215.pdf">DEPURI</a>
* @see <a href="https://ftp.pwg.org/pub/pwg/candidates/cs-ippjobprinterext3v10-20120727-5100.13.pdf">PWG5100.13</a>
* @see <a href="https://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf">PWG5100.18</a>
* @see <a href="https://ftp.pwg.org/pub/pwg/candidates/cs-ippdocobject11-20190521-5100.5.pdf">PWG5100.5</a>
Expand Down
4 changes: 2 additions & 2 deletions jipp-core/src/main/java/com/hp/jipp/model/EnumTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength")

package com.hp.jipp.model
Expand All @@ -26,8 +26,8 @@ object EnumTypes {
Types.outputDeviceJobState,
Types.outputDeviceJobStates,
Types.operationsSupported,
MediaCol.MediaSourceProperties.mediaSourceFeedOrientation,
InputAttributes.inputOrientationRequested,
MediaColDatabase.MediaSourceProperties.mediaSourceFeedOrientation,
Types.inputOrientationRequestedSupported,
Types.orientationRequested,
Types.orientationRequestedActual,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/Finishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
//
// (Note: Uses Java, not Kotlin, to define public static values in the most efficient manner.)

Expand Down
2 changes: 1 addition & 1 deletion jipp-core/src/main/java/com/hp/jipp/model/FinishingsCol.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-10-14
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2022-08-02
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model
Expand Down
Loading

0 comments on commit 9b78b17

Please sign in to comment.